Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sortable Paginated Table #250

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3,335 changes: 1,599 additions & 1,736 deletions content/body/sortable-pagination-table.php

Large diffs are not rendered by default.

19 changes: 8 additions & 11 deletions content/bottom/sortable-pagination-table.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script type="module">
import sortableTables from './js/modules/sortable-tables.js';
import paginationTables from "./js/modules/paginate.js";
import sortableTables from './js/modules/sortable-tables.js';
import showcode from "./js/enable-libs/showcode.js";

function normalizeNumber(numString) {
Expand All @@ -9,14 +9,13 @@ function normalizeNumber(numString) {
const rSplit = r.split(/ /);
if (rSplit.length === 2) {
const suffix = rSplit[1].trim();
switch(suffix) {
case "billion":
switch (suffix) {
case 'billion':
multiplier = 1000000000;
break;
case "trillion":
case 'trillion':
multiplier = 1000000000000;
break;
case 'Mn':
case 'million':
multiplier = 1000000;
break;
Expand All @@ -31,22 +30,20 @@ function normalizeNumber(numString) {
return r;
}


function exampleCustomCompare(a, b) {
const normalA = normalizeNumber(a + '');
const normalB = normalizeNumber(b + '');


return (normalA - normalB);
return normalA - normalB;
}

sortableTables.addSortFunction('exampleCustomCompare', exampleCustomCompare);

sortableTables.init({
onBeforeSort: paginationTables.showAll,
onAfterSort: paginationTables.renderTable
onBeforeSort: paginationTables.showAll,
onAfterSort: paginationTables.renderTable,
});

paginationTables.init();

showcode.addJsObj('paginationTables', paginationTables);
Expand Down
8 changes: 6 additions & 2 deletions css/sortable-tables.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 48 additions & 0 deletions images/icons/content/sortable-pagination-table.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 7 additions & 1 deletion js/modules/es4/ablePlayerCustomizations.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
******************************************************************************/

/* global AblePlayer, jQuery */
import '../../enable-node-libs/jquery/dist/jquery.min.js';
import '../enable-libs/ableplayer/thirdparty/js.cookie.js';
import { AblePlayerInstances } from '../enable-libs/ableplayer/build/ableplayer.js';

let hasClicked = false;

function ablePlayerCustomizations($, extraCustomizations) {
Expand Down Expand Up @@ -111,4 +115,6 @@ function ablePlayerCustomizations($, extraCustomizations) {

}

ablePlayerCustomizations(jQuery);
ablePlayerCustomizations(jQuery);

export { ablePlayerCustomizations, AblePlayerInstances };
1 change: 1 addition & 0 deletions js/modules/es4/accessibility.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -860,3 +860,4 @@ accessibility = {
this.initGroup(el, options);
}
};
export default accessibility;
7 changes: 5 additions & 2 deletions js/modules/es4/checkbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* Released under the MIT License.
******************************************************************************/

const checkbox = new (function() {
const checkbox = new function () {

this.navigate = (evt) => {
// ref is the element that fired the event.
Expand Down Expand Up @@ -65,4 +65,7 @@ const checkbox = new (function() {

this.init();

});
};


export default checkbox;
11 changes: 9 additions & 2 deletions js/modules/es4/combobox.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
* Released under the MIT License.
******************************************************************************/

import accessibility from "../../enable-node-libs/accessibility-js-routines/dist/accessibility.module.js";
import { interpolate } from "./interpolate.js";


const EnableCombobox = function(componentRoot) {
let root = null,
form = null,
Expand Down Expand Up @@ -509,7 +513,7 @@ const EnableCombobox = function(componentRoot) {
this.initCombo(componentRoot);
};

const enableComboboxes = new (function() {
const enableComboboxes = new function() {
this.isKeyboardUser = false;

this.list = [];
Expand All @@ -536,4 +540,7 @@ const enableComboboxes = new (function() {

document.addEventListener('keyup', keyUpEvent);
}
})
}


export default enableComboboxes;
7 changes: 5 additions & 2 deletions js/modules/es4/enable-animatedGif.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* Released under the MIT License.
******************************************************************************/

const animatedGifPause = new (function() {
const animatedGifPause = new function () {
const detailsQuery = '.pausable-animated-gif details';
let summaryPauseClass;

Expand Down Expand Up @@ -100,4 +100,7 @@ const animatedGifPause = new (function() {
}

this.init();
})
}


export default animatedGifPause;
4 changes: 4 additions & 0 deletions js/modules/es4/enable-carousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
* Released under the MIT License.
******************************************************************************/

import '../../enable-node-libs/glider-js/glider.js';

let counter = 0;

const EnableCarousel = function (container, options, gliderOptions) {
Expand Down Expand Up @@ -312,3 +314,5 @@ const EnableCarousel = function (container, options, gliderOptions) {
}
};
}

export default EnableCarousel;
8 changes: 6 additions & 2 deletions js/modules/es4/enable-character-count.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const enableCharacterCount = new (function() {
import { interpolate } from "./interpolate.js";

const enableCharacterCount = new function() {
'use strict';

const defaultReadCharacterCountKey = 'Escape';
Expand Down Expand Up @@ -201,4 +203,6 @@ const enableCharacterCount = new (function() {
const characterCountText = target.dataset.characterCountText ?? 'Character Count: ${numChars} out of ${maxLength}. ${charsRemaining} characters remaining.'
return interpolate(characterCountText, { numChars, maxLength, charsRemaining });
}
})
}

export default enableCharacterCount;
8 changes: 6 additions & 2 deletions js/modules/es4/enable-dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
* Released under the MIT License.
******************************************************************************/

const enableDialog = new (function() {
import accessibility from '../../enable-node-libs/accessibility-js-routines/dist/accessibility.module.js';

const enableDialog = new function() {
/**
* Updates the passed dialog to retain focus and restore it when the dialog is closed. Won't
* upgrade a dialog more than once. Supports IE11+ and is a no-op otherwise.
Expand Down Expand Up @@ -111,4 +113,6 @@ const enableDialog = new (function() {
this.registerFocusRestoreDialog(favDialog);
}
}
});
}

export default enableDialog;
6 changes: 4 additions & 2 deletions js/modules/es4/enable-drawer.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
******************************************************************************/


const enableDrawer = new (function() {
const enableDrawer = new function() {
this.init = function() {
document.body.addEventListener("click", function(e) {
var target = e.target;
Expand All @@ -40,4 +40,6 @@ const enableDrawer = new (function() {
}
});
}
})
}

export default enableDrawer;
10 changes: 8 additions & 2 deletions js/modules/es4/enable-flyout.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@
*
* Released under the MIT License.
******************************************************************************/
import accessibility from "../../enable-node-libs/accessibility-js-routines/dist/accessibility.module.js"

let EnableFlyout;



EnableFlyout = new (function() {
EnableFlyout = new function() {
// cache all the queries, classes, node lists and media queries.
const menuSel = '.enable-flyout__open-menu-button';
const topNavSel = '.enable-flyout__top-level';
Expand Down Expand Up @@ -389,4 +391,8 @@ EnableFlyout = new (function() {

$root.classList.add('enable-flyout--initialized');
}
})
}

// EnableFlyout.init();

export default EnableFlyout;
9 changes: 7 additions & 2 deletions js/modules/es4/enable-listbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
* Released under the MIT License.
******************************************************************************/

const enableListbox = new (function() {
import accessibility from '../../enable-node-libs/accessibility-js-routines/dist/accessibility.module.js';

const enableListbox = new function() {

const showEvent = new CustomEvent('enable-listbox-show', {
bubbles: true
Expand Down Expand Up @@ -247,4 +249,7 @@ const enableListbox = new (function() {
this.collapse(buttonEl, listboxEl, true);
});
}
});
}


export default enableListbox;
9 changes: 8 additions & 1 deletion js/modules/es4/enable-slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
* Released under the MIT License.
******************************************************************************/

import { interpolate, htmlToDomNode } from "../modules/interpolate.js";

/**
* keyCodes() is an object to contain key code values for the application
*/
const keyCodes = function() {
// Define values for keycodes
this.backspace = 8;
Expand All @@ -34,7 +39,7 @@ const keyCodes = function() {
this.up = 38;
this.right = 39;
this.down = 40;
};
} // end keyCodes

/**
*
Expand Down Expand Up @@ -855,3 +860,5 @@ const enableSliders = new(function() {
}
};
})();

export default enableSliders;
11 changes: 9 additions & 2 deletions js/modules/es4/enable-toc.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@
******************************************************************************/

// import tooltip from './tooltip.js'; // Temp: disable init of tooltip since it causes unexpected behavior
const tableOfContents = new (function() {
import { addMissingIDToHeading, getCookie, setCookie } from "./helpers.js";

/**
* Represents the table of contents.
*/
const tableOfContents = new function() {
this.toc;

/**
Expand Down Expand Up @@ -404,4 +409,6 @@ const tableOfContents = new (function() {
// Add the tooltip component
// tooltip.init(); // Temp: disable init of tooltip since it causes unexpected behavior
}
});
}

export default tableOfContents;
Loading
Loading