Skip to content
This repository has been archived by the owner on Oct 21, 2022. It is now read-only.

Commit

Permalink
1.0.4 release
Browse files Browse the repository at this point in the history
  • Loading branch information
zachleat committed Feb 19, 2015
1 parent b3c7102 commit e960568
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 36 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "filament-tablesaw",
"version": "1.0.3",
"version": "1.0.4",
"main": [
"dist/tablesaw.js",
"dist/tablesaw.css",
Expand Down
2 changes: 1 addition & 1 deletion dist/bare/tablesaw.bare.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! Tablesaw - v1.0.3 - 2015-01-27
/*! Tablesaw - v1.0.4 - 2015-02-19
* https://github.com/filamentgroup/tablesaw
* Copyright (c) 2015 Filament Group; Licensed MIT */

Expand Down
2 changes: 1 addition & 1 deletion dist/stackonly/tablesaw.stackonly.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! Tablesaw - v1.0.3 - 2015-01-27
/*! Tablesaw - v1.0.4 - 2015-02-19
* https://github.com/filamentgroup/tablesaw
* Copyright (c) 2015 Filament Group; Licensed MIT */

Expand Down
12 changes: 10 additions & 2 deletions dist/stackonly/tablesaw.stackonly.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! Tablesaw - v1.0.3 - 2015-01-27
/*! Tablesaw - v1.0.4 - 2015-02-19
* https://github.com/filamentgroup/tablesaw
* Copyright (c) 2015 Filament Group; Licensed MIT */
;(function( $ ) {
Expand Down Expand Up @@ -35,7 +35,15 @@
*/

if( typeof Tablesaw === "undefined" ) {
Tablesaw = {};
Tablesaw = {
i18n: {
modes: [ 'Stack', 'Swipe', 'Toggle' ],
columns: 'Col<span class=\"a11y-sm\">umn</span>s',
columnBtnText: 'Columns',
columnsDialogError: 'No eligible columns.',
sort: 'Sort'
}
};
}
if( !Tablesaw.config ) {
Tablesaw.config = {};
Expand Down
4 changes: 2 additions & 2 deletions dist/stackonly/tablesaw.stackonly.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*! Tablesaw - v1.0.3 - 2015-01-27
/*! Tablesaw - v1.0.4 - 2015-02-19
* https://github.com/filamentgroup/tablesaw
* Copyright (c) 2015 Filament Group; Licensed MIT */
/*! Tablesaw - v1.0.3 - 2015-01-27
/*! Tablesaw - v1.0.4 - 2015-02-19
* https://github.com/filamentgroup/tablesaw
* Copyright (c) 2015 Filament Group; Licensed MIT */

Expand Down
2 changes: 1 addition & 1 deletion dist/tablesaw.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! Tablesaw - v1.0.3 - 2015-01-27
/*! Tablesaw - v1.0.4 - 2015-02-19
* https://github.com/filamentgroup/tablesaw
* Copyright (c) 2015 Filament Group; Licensed MIT */

Expand Down
65 changes: 38 additions & 27 deletions dist/tablesaw.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! Tablesaw - v1.0.3 - 2015-01-27
/*! Tablesaw - v1.0.4 - 2015-02-19
* https://github.com/filamentgroup/tablesaw
* Copyright (c) 2015 Filament Group; Licensed MIT */
;(function( $ ) {
Expand Down Expand Up @@ -35,7 +35,15 @@
*/

if( typeof Tablesaw === "undefined" ) {
Tablesaw = {};
Tablesaw = {
i18n: {
modes: [ 'Stack', 'Swipe', 'Toggle' ],
columns: 'Col<span class=\"a11y-sm\">umn</span>s',
columnBtnText: 'Columns',
columnsDialogError: 'No eligible columns.',
sort: 'Sort'
}
};
}
if( !Tablesaw.config ) {
Tablesaw.config = {};
Expand Down Expand Up @@ -366,11 +374,6 @@ if( !Tablesaw.config ) {
toolbar: 'tablesaw-bar'
};

this.i18n = {
columnBtnText: 'Columns',
columnsDialogError: 'No eligible columns.'
};

// Expose headers and allHeaders properties on the widget
// headers references the THs within the first TR in the table
this.headers = this.$table.find( 'tr:first > th' );
Expand All @@ -394,7 +397,7 @@ if( !Tablesaw.config ) {
id = tableId + "-popup";
$btnContain = $( "<div class='" + this.classes.columnBtnContain + "'></div>" );
$menuButton = $( "<a href='#" + id + "' class='btn btn-micro " + this.classes.columnBtn +"' data-popup-link>" +
"<span>" + this.i18n.columnBtnText + "</span></a>" );
"<span>" + Tablesaw.i18n.columnBtnText + "</span></a>" );
$popup = $( "<div class='dialog-table-coltoggle " + this.classes.popup + "' id='" + id + "'></div>" );
$menu = $( "<div class='btn-group'></div>" );

Expand All @@ -417,7 +420,7 @@ if( !Tablesaw.config ) {
});

if( !hasNonPersistentHeaders ) {
$menu.append( '<label>' + this.i18n.columnsDialogError + '</label>' );
$menu.append( '<label>' + Tablesaw.i18n.columnsDialogError + '</label>' );
}

$menu.appendTo( $popup );
Expand Down Expand Up @@ -562,12 +565,11 @@ if( !Tablesaw.config ) {
}

// Calculate initial widths
var initialWidth = $table.css( 'width' );
$table.css('width', 'auto');
$headerCells.each(function() {
headerWidths.push( $( this ).outerWidth() );
});
$table.css( 'width', initialWidth );
$table.css( 'width', '' );

$btns.appendTo( $table.prev( '.tablesaw-bar' ) );

Expand Down Expand Up @@ -606,7 +608,9 @@ if( !Tablesaw.config ) {
function maintainWidths() {
var prefix = '#' + tableId + '.tablesaw-swipe ',
styles = [],
tableWidth = $table.width();
tableWidth = $table.width(),
hash = [],
newHash;

$headerCells.each(function( index ) {
var width;
Expand All @@ -615,14 +619,28 @@ if( !Tablesaw.config ) {

// Only save width on non-greedy columns (take up less than 75% of table width)
if( width < tableWidth * 0.75 ) {
hash.push( index + '-' + width );
styles.push( prefix + ' .tablesaw-cell-persist:nth-child(' + ( index + 1 ) + ') { width: ' + width + 'px; }' );
}
}
});
newHash = hash.join( '_' );

unmaintainWidths();
$table.addClass( persistWidths );
$head.append( $( '<style>' + styles.join( "\n" ) + '</style>' ).attr( 'id', tableId + '-persist' ) );

var $style = $( '#' + tableId + '-persist' );
// If style element not yet added OR if the widths have changed
if( !$style.length || $style.data( 'hash' ) !== newHash ) {
// Remove existing
$style.remove();

if( styles.length ) {
$( '<style>' + styles.join( "\n" ) + '</style>' )
.attr( 'id', tableId + '-persist' )
.data( 'hash', newHash )
.appendTo( $head );
}
}
}

function getNext(){
Expand Down Expand Up @@ -670,7 +688,7 @@ if( !Tablesaw.config ) {
}

var extraPaddingPixels = 20,
tableWidth = $table.width(),
containerWidth = $table.parent().width(),
persist = [],
sum = 0,
sums = [],
Expand All @@ -686,7 +704,7 @@ if( !Tablesaw.config ) {
sums.push( sum );

// is persistent or is hidden
if( isPersist || sum > tableWidth ) {
if( isPersist || sum > containerWidth ) {
visibleNonPersistantCount--;
}
});
Expand All @@ -701,7 +719,7 @@ if( !Tablesaw.config ) {
return;
}

if( sums[ index ] <= tableWidth || needsNonPersistentColumn ) {
if( sums[ index ] <= containerWidth || needsNonPersistentColumn ) {
needsNonPersistentColumn = false;
showColumn( this );
} else {
Expand Down Expand Up @@ -847,9 +865,6 @@ if( !Tablesaw.config ) {
tableToolbar: 'tablesaw-toolbar',
sortButton: pluginName + "-btn"
},
i18n = {
sort: 'Sort'
},
methods = {
_create: function( o ){
return $( this ).each(function() {
Expand Down Expand Up @@ -928,7 +943,7 @@ if( !Tablesaw.config ) {
},
addSwitcher = function( heads ){
$switcher = $( '<div>' ).addClass( classes.switcher ).addClass( classes.tableToolbar ).html(function() {
var html = [ '<label>' + i18n.sort + ':' ];
var html = [ '<label>' + Tablesaw.i18n.sort + ':' ];

html.push( '<span class="btn btn-small">&#160;<select>' );
heads.each(function( j ) {
Expand Down Expand Up @@ -1182,17 +1197,13 @@ if( !Tablesaw.config ) {
toolbar: 'tablesaw-toolbar'
},
modes: [ 'stack', 'swipe', 'columntoggle' ],
i18n: {
modes: [ 'Stack', 'Swipe', 'Toggle' ],
columns: 'Col<span class="a11y-sm">umn</span>s'
},
init: function( table ) {
var $table = $( table ),
ignoreMode = $table.attr( S.attributes.excludeMode ),
$toolbar = $table.prev( '.tablesaw-bar' ),
modeVal = '',
$switcher = $( '<div>' ).addClass( S.classes.main + ' ' + S.classes.toolbar ).html(function() {
var html = [ '<label>' + S.i18n.columns + ':' ],
var html = [ '<label>' + Tablesaw.i18n.columns + ':' ],
dataMode = $table.attr( 'data-tablesaw-mode' ),
isSelected;

Expand All @@ -1210,7 +1221,7 @@ if( !Tablesaw.config ) {

html.push( '<option' +
( isSelected ? ' selected' : '' ) +
' value="' + S.modes[ j ] + '">' + S.i18n.modes[ j ] + '</option>' );
' value="' + S.modes[ j ] + '">' + Tablesaw.i18n.modes[ j ] + '</option>' );
}
html.push( '</select></span></label>' );

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "tablesaw",
"title": "Tablesaw",
"description": "A set of plugins for responsive tables.",
"version": "1.0.3",
"version": "1.0.4",
"homepage": "https://github.com/filamentgroup/tablesaw",
"author": {
"name": "Zach Leatherman",
Expand Down

0 comments on commit e960568

Please sign in to comment.