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

Commit

Permalink
1.0 dist files.
Browse files Browse the repository at this point in the history
  • Loading branch information
zachleat committed Dec 5, 2014
1 parent 27540bb commit a0b2426
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 46 deletions.
21 changes: 13 additions & 8 deletions dist/bare/tablesaw.bare.css
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,11 @@ table.tablesaw {
display: inline-block;
}

.tablesaw-columntoggle-btnwrap {
position: relative;
/* for dialog positioning */
}

.tablesaw-columntoggle-btnwrap .dialog-content {
padding: .5em;
}
Expand Down Expand Up @@ -669,19 +674,19 @@ table.tablesaw {
vertical-align: top;
}

.tablesaw-sortable th.sortable-head,
.tablesaw-sortable tr:first-child th.sortable-head {
.tablesaw-sortable th.tablesaw-sortable-head,
.tablesaw-sortable tr:first-child th.tablesaw-sortable-head {
padding: 0;
}

.tablesaw-sortable th.sortable-head button {
.tablesaw-sortable th.tablesaw-sortable-head button {
padding-top: .9em;
padding-bottom: .7em;
padding-left: .6em;
padding-right: 1.6em;
}

.tablesaw-sortable .sortable-head button {
.tablesaw-sortable .tablesaw-sortable-head button {
min-width: 100%;
color: inherit;
background: transparent;
Expand All @@ -693,20 +698,20 @@ table.tablesaw {
position: relative;
}

.tablesaw-sortable .sortable-head.sortable-ascending button:after,
.tablesaw-sortable .sortable-head.sortable-descending button:after {
.tablesaw-sortable .tablesaw-sortable-head.tablesaw-sortable-ascending button:after,
.tablesaw-sortable .tablesaw-sortable-head.tablesaw-sortable-descending button:after {
width: 7px;
height: 10px;
content: "\0020";
position: absolute;
right: .5em;
}

.tablesaw-sortable .sortable-head.sortable-ascending button:after {
.tablesaw-sortable .tablesaw-sortable-head.tablesaw-sortable-ascending button:after {
content: "↑";
}

.tablesaw-sortable .sortable-head.sortable-descending button:after {
.tablesaw-sortable .tablesaw-sortable-head.tablesaw-sortable-descending button:after {
content: "↓";
}

Expand Down
10 changes: 5 additions & 5 deletions dist/stackonly/tablesaw.stackonly.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
refresh: "tablesawrefresh"
},
defaultMode = "stack",
initSelector = "table[data-mode],table[data-sortable]";
initSelector = "table[data-tablesaw-mode],table[data-tablesaw-sortable]";

var Table = function( element ) {
if( !element ) {
Expand All @@ -48,7 +48,7 @@
this.table = element;
this.$table = $( element );

this.mode = this.$table.attr( "data-mode" ) || defaultMode;
this.mode = this.$table.attr( "data-tablesaw-mode" ) || defaultMode;

this.init();
};
Expand Down Expand Up @@ -131,7 +131,7 @@
// other plugins
this.$table.trigger( events.destroy, [ this ] );

this.$table.removeAttr( 'data-mode' );
this.$table.removeAttr( 'data-tablesaw-mode' );

this.$table.removeData( pluginName );
};
Expand Down Expand Up @@ -169,8 +169,8 @@
};

var attrs = {
labelless: 'data-no-labels',
hideempty: 'data-hide-empty'
labelless: 'data-tablesaw-no-labels',
hideempty: 'data-tablesaw-hide-empty'
};

var Stack = function( element ) {
Expand Down
21 changes: 13 additions & 8 deletions dist/tablesaw.css
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,11 @@ table.tablesaw thead td {
display: inline-block;
}

.tablesaw-columntoggle-btnwrap {
position: relative;
/* for dialog positioning */
}

.tablesaw-columntoggle-btnwrap .dialog-content {
padding: .5em;
}
Expand Down Expand Up @@ -756,19 +761,19 @@ table.tablesaw thead td {
vertical-align: top;
}

.tablesaw-sortable th.sortable-head,
.tablesaw-sortable tr:first-child th.sortable-head {
.tablesaw-sortable th.tablesaw-sortable-head,
.tablesaw-sortable tr:first-child th.tablesaw-sortable-head {
padding: 0;
}

.tablesaw-sortable th.sortable-head button {
.tablesaw-sortable th.tablesaw-sortable-head button {
padding-top: .9em;
padding-bottom: .7em;
padding-left: .6em;
padding-right: 1.6em;
}

.tablesaw-sortable .sortable-head button {
.tablesaw-sortable .tablesaw-sortable-head button {
min-width: 100%;
color: inherit;
background: transparent;
Expand All @@ -780,20 +785,20 @@ table.tablesaw thead td {
position: relative;
}

.tablesaw-sortable .sortable-head.sortable-ascending button:after,
.tablesaw-sortable .sortable-head.sortable-descending button:after {
.tablesaw-sortable .tablesaw-sortable-head.tablesaw-sortable-ascending button:after,
.tablesaw-sortable .tablesaw-sortable-head.tablesaw-sortable-descending button:after {
width: 7px;
height: 10px;
content: "\0020";
position: absolute;
right: .5em;
}

.tablesaw-sortable .sortable-head.sortable-ascending button:after {
.tablesaw-sortable .tablesaw-sortable-head.tablesaw-sortable-ascending button:after {
content: "↑";
}

.tablesaw-sortable .sortable-head.sortable-descending button:after {
.tablesaw-sortable .tablesaw-sortable-head.tablesaw-sortable-descending button:after {
content: "↓";
}

Expand Down
52 changes: 27 additions & 25 deletions dist/tablesaw.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
refresh: "tablesawrefresh"
},
defaultMode = "stack",
initSelector = "table[data-mode],table[data-sortable]";
initSelector = "table[data-tablesaw-mode],table[data-tablesaw-sortable]";

var Table = function( element ) {
if( !element ) {
Expand All @@ -48,7 +48,7 @@
this.table = element;
this.$table = $( element );

this.mode = this.$table.attr( "data-mode" ) || defaultMode;
this.mode = this.$table.attr( "data-tablesaw-mode" ) || defaultMode;

this.init();
};
Expand Down Expand Up @@ -131,7 +131,7 @@
// other plugins
this.$table.trigger( events.destroy, [ this ] );

this.$table.removeAttr( 'data-mode' );
this.$table.removeAttr( 'data-tablesaw-mode' );

this.$table.removeData( pluginName );
};
Expand Down Expand Up @@ -169,8 +169,8 @@
};

var attrs = {
labelless: 'data-no-labels',
hideempty: 'data-hide-empty'
labelless: 'data-tablesaw-no-labels',
hideempty: 'data-tablesaw-hide-empty'
};

var Stack = function( element ) {
Expand Down Expand Up @@ -385,7 +385,7 @@
var hasNonPersistentHeaders = false;
$( this.headers ).not( "td" ).each( function() {
var $this = $( this ),
priority = $this.attr("data-priority"),
priority = $this.attr("data-tablesaw-priority"),
$cells = $this.add( this.cells );

if( priority && priority !== "persist" ) {
Expand Down Expand Up @@ -477,7 +477,7 @@
var self = this;
$(this.headers).not( "td" ).each( function() {
var $this = $( this ),
priority = $this.attr("data-priority"),
priority = $this.attr("data-tablesaw-priority"),
$cells = $this.add( this.cells );

if( priority && priority !== "persist" ) {
Expand Down Expand Up @@ -533,7 +533,7 @@
hideBtn = 'disabled',
persistWidths = 'tablesaw-fix-persist',
$headerCells = $table.find( "thead th" ),
$headerCellsNoPersist = $headerCells.not( '[data-priority="persist"]' ),
$headerCellsNoPersist = $headerCells.not( '[data-tablesaw-priority="persist"]' ),
headerWidths = [],
$head = $( document.head || 'head' ),
tableId = $table.attr( 'id' ),
Expand Down Expand Up @@ -577,7 +577,7 @@
}

function isPersistent( headerCell ) {
return $( headerCell ).is( '[data-priority="persist"]' );
return $( headerCell ).is( '[data-tablesaw-priority="persist"]' );
}

function unmaintainWidths() {
Expand Down Expand Up @@ -651,7 +651,7 @@

$headerCells.each(function( index ) {
var $t = $( this ),
isPersist = $t.is( '[data-priority="persist"]' );
isPersist = $t.is( '[data-tablesaw-priority="persist"]' );

persist.push( isPersist );

Expand Down Expand Up @@ -794,17 +794,19 @@
}).join( '' );
}

var topLevelPluginName = "tablesaw-sortable",
pluginName = "sortable",
var pluginName = "tablesaw-sortable",
initSelector = "table[data-" + pluginName + "]",
sortableSwitchSelector = "[data-" + pluginName + "-switch]",
attrs = {
defaultCol: "data-tablesaw-sortable-default-col"
},
classes = {
head: pluginName + "-head",
ascend: pluginName + "-ascending",
descend: pluginName + "-descending",
switcher: topLevelPluginName + "-switch",
switcher: pluginName + "-switch",
tableToolbar: 'tablesaw-toolbar',
sortButton: topLevelPluginName + "-btn"
sortButton: pluginName + "-btn"
},
i18n = {
sort: 'Sort'
Expand All @@ -829,7 +831,7 @@
$switcher;

var addClassToTable = function(){
el.addClass( topLevelPluginName );
el.addClass( pluginName );
},
addClassToHeads = function( h ){
$.each( h , function( i , v ){
Expand All @@ -846,7 +848,7 @@
clearOthers = function( sibs ){
$.each( sibs , function( i , v ){
var col = $( v );
col.removeAttr( "data-sortable-default-col" );
col.removeAttr( attrs.defaultCol );
col.removeClass( classes.ascend );
col.removeClass( classes.descend );
});
Expand Down Expand Up @@ -878,7 +880,7 @@
handleDefault = function( heads ){
$.each( heads , function( idx , el ){
var $el = $( el );
if( $el.is( "[data-sortable-default-col]" ) ){
if( $el.is( "[" + attrs.defaultCol + "]" ) ){
if( !$el.hasClass( classes.descend ) ) {
$el.addClass( classes.ascend );
}
Expand All @@ -892,7 +894,7 @@
html.push( '<span class="btn btn-small">&#160;<select>' );
heads.each(function( j ) {
var $t = $( this ),
isDefaultCol = $t.is( '[data-sortable-default-col]' ),
isDefaultCol = $t.is( "[" + attrs.defaultCol + "]" ),
isDescending = $t.hasClass( classes.descend ),
isNumeric = false;

Expand Down Expand Up @@ -926,7 +928,7 @@
head = heads.eq( val[ 0 ] );

clearOthers( head.siblings() );
el.sortable( 'sortBy', head.get( 0 ), val[ 1 ] === 'asc' );
el[ pluginName ]( 'sortBy', head.get( 0 ), val[ 1 ] === 'asc' );
});
};

Expand Down Expand Up @@ -1002,7 +1004,7 @@
},
makeColDefault: function( col , a ){
var c = $( col );
c.attr( "data-sortable-default-col" , "true" );
c.attr( attrs.defaultCol , "true" );
if( a ){
c.removeClass( classes.descend );
c.addClass( classes.ascend );
Expand Down Expand Up @@ -1054,7 +1056,7 @@

var MM = {
attr: {
init: 'data-minimap'
init: 'data-tablesaw-minimap'
}
};

Expand Down Expand Up @@ -1129,10 +1131,10 @@

var S = {
selectors: {
init: 'table[data-mode-switch]'
init: 'table[data-tablesaw-mode-switch]'
},
attributes: {
excludeMode: 'data-mode-exclude'
excludeMode: 'data-tablesaw-mode-exclude'
},
classes: {
main: 'tablesaw-modeswitch',
Expand All @@ -1150,7 +1152,7 @@
modeVal = '',
$switcher = $( '<div>' ).addClass( S.classes.main + ' ' + S.classes.toolbar ).html(function() {
var html = [ '<label>' + S.i18n.columns + ':' ],
dataMode = $table.attr( 'data-mode' ),
dataMode = $table.attr( 'data-tablesaw-mode' ),
isSelected;

html.push( '<span class="btn btn-small">&#160;<select>' );
Expand Down Expand Up @@ -1193,7 +1195,7 @@
$switcher.remove();
$table.data( 'table' ).destroy();

$table.attr( 'data-mode', val );
$table.attr( 'data-tablesaw-mode', val );
$table.table();
}
};
Expand Down

0 comments on commit a0b2426

Please sign in to comment.