From a0b242612fedd8f7241c10f960abf7102f8fe0b7 Mon Sep 17 00:00:00 2001 From: Zach Leatherman Date: Fri, 5 Dec 2014 15:59:43 -0600 Subject: [PATCH] 1.0 dist files. --- dist/bare/tablesaw.bare.css | 21 ++++++----- dist/stackonly/tablesaw.stackonly.js | 10 +++--- dist/tablesaw.css | 21 ++++++----- dist/tablesaw.js | 52 +++++++++++++++------------- 4 files changed, 58 insertions(+), 46 deletions(-) diff --git a/dist/bare/tablesaw.bare.css b/dist/bare/tablesaw.bare.css index cf659e7..255a942 100644 --- a/dist/bare/tablesaw.bare.css +++ b/dist/bare/tablesaw.bare.css @@ -496,6 +496,11 @@ table.tablesaw { display: inline-block; } +.tablesaw-columntoggle-btnwrap { + position: relative; + /* for dialog positioning */ +} + .tablesaw-columntoggle-btnwrap .dialog-content { padding: .5em; } @@ -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; @@ -693,8 +698,8 @@ 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"; @@ -702,11 +707,11 @@ table.tablesaw { 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: "↓"; } diff --git a/dist/stackonly/tablesaw.stackonly.js b/dist/stackonly/tablesaw.stackonly.js index b5a4f5d..5c036b7 100644 --- a/dist/stackonly/tablesaw.stackonly.js +++ b/dist/stackonly/tablesaw.stackonly.js @@ -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 ) { @@ -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(); }; @@ -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 ); }; @@ -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 ) { diff --git a/dist/tablesaw.css b/dist/tablesaw.css index 6454526..80ce830 100644 --- a/dist/tablesaw.css +++ b/dist/tablesaw.css @@ -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; } @@ -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; @@ -780,8 +785,8 @@ 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"; @@ -789,11 +794,11 @@ table.tablesaw thead td { 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: "↓"; } diff --git a/dist/tablesaw.js b/dist/tablesaw.js index 9d07095..bf98ac2 100644 --- a/dist/tablesaw.js +++ b/dist/tablesaw.js @@ -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 ) { @@ -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(); }; @@ -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 ); }; @@ -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 ) { @@ -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" ) { @@ -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" ) { @@ -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' ), @@ -577,7 +577,7 @@ } function isPersistent( headerCell ) { - return $( headerCell ).is( '[data-priority="persist"]' ); + return $( headerCell ).is( '[data-tablesaw-priority="persist"]' ); } function unmaintainWidths() { @@ -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 ); @@ -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' @@ -829,7 +831,7 @@ $switcher; var addClassToTable = function(){ - el.addClass( topLevelPluginName ); + el.addClass( pluginName ); }, addClassToHeads = function( h ){ $.each( h , function( i , v ){ @@ -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 ); }); @@ -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 ); } @@ -892,7 +894,7 @@ html.push( ' ' ); @@ -1193,7 +1195,7 @@ $switcher.remove(); $table.data( 'table' ).destroy(); - $table.attr( 'data-mode', val ); + $table.attr( 'data-tablesaw-mode', val ); $table.table(); } };