Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

datatables.net-rowgroup

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

datatables.net-rowgroup - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

js/dataTables.rowGroup.min.mjs

57

js/dataTables.rowGroup.js

@@ -1,23 +0,5 @@

/*! RowGroup 1.2.0
/*! RowGroup 1.3.0
* ©2017-2022 SpryMedia Ltd - datatables.net/license
*/
/**
* @summary RowGroup
* @description RowGrouping for DataTables
* @version 1.2.0
* @author SpryMedia Ltd (www.sprymedia.co.uk)
* @contact datatables.net
* @copyright SpryMedia Ltd.
*
* This source file is free software, available under the following license:
* MIT license - http://datatables.net/license/mit
*
* This source file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
*
* For details please refer to: http://www.datatables.net
*/
(function( factory ){

@@ -34,9 +16,18 @@ if ( typeof define === 'function' && define.amd ) {

if ( ! root ) {
// CommonJS environments without a window global must pass a
// root. This will give an error otherwise
root = window;
}
if ( ! $ || ! $.fn.dataTable ) {
$ = require('datatables.net')(root, $).$;
if ( ! $ ) {
$ = typeof window !== 'undefined' ? // jQuery's factory checks for a global window
require('jquery') :
require('jquery')( root );
}
if ( ! $.fn.dataTable ) {
require('datatables.net')(root, $);
}
return factory( $, root, root.document );

@@ -54,2 +45,21 @@ };

/**
* @summary RowGroup
* @description RowGrouping for DataTables
* @version 1.3.0
* @author SpryMedia Ltd (www.sprymedia.co.uk)
* @contact datatables.net
* @copyright SpryMedia Ltd.
*
* This source file is free software, available under the following license:
* MIT license - http://datatables.net/license/mit
*
* This source file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
*
* For details please refer to: http://www.datatables.net
*/
var RowGroup = function ( dt, opts ) {

@@ -418,3 +428,3 @@ // Sanity check that we are using DataTables 1.10 or newer

RowGroup.version = "1.2.0";
RowGroup.version = "1.3.0";

@@ -487,4 +497,3 @@

return RowGroup;
return DataTable;
}));

@@ -1,28 +0,4 @@

/*!
SpryMedia Ltd.
This source file is free software, available under the following license:
MIT license - http://datatables.net/license/mit
This source file is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
For details please refer to: http://www.datatables.net
RowGroup 1.2.0
©2017-2022 SpryMedia Ltd - datatables.net/license
*/
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(b,c,d){b instanceof String&&(b=String(b));for(var g=b.length,e=0;e<g;e++){var k=b[e];if(c.call(d,k,e,b))return{i:e,v:k}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;$jscomp.ISOLATE_POLYFILLS=!1;
$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(b,c,d){if(b==Array.prototype||b==Object.prototype)return b;b[c]=d.value;return b};$jscomp.getGlobal=function(b){b=["object"==typeof globalThis&&globalThis,b,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var c=0;c<b.length;++c){var d=b[c];if(d&&d.Math==Math)return d}throw Error("Cannot find global object");};$jscomp.global=$jscomp.getGlobal(this);
$jscomp.IS_SYMBOL_NATIVE="function"===typeof Symbol&&"symbol"===typeof Symbol("x");$jscomp.TRUST_ES6_POLYFILLS=!$jscomp.ISOLATE_POLYFILLS||$jscomp.IS_SYMBOL_NATIVE;$jscomp.polyfills={};$jscomp.propertyToPolyfillSymbol={};$jscomp.POLYFILL_PREFIX="$jscp$";var $jscomp$lookupPolyfilledValue=function(b,c){var d=$jscomp.propertyToPolyfillSymbol[c];if(null==d)return b[c];d=b[d];return void 0!==d?d:b[c]};
$jscomp.polyfill=function(b,c,d,g){c&&($jscomp.ISOLATE_POLYFILLS?$jscomp.polyfillIsolated(b,c,d,g):$jscomp.polyfillUnisolated(b,c,d,g))};$jscomp.polyfillUnisolated=function(b,c,d,g){d=$jscomp.global;b=b.split(".");for(g=0;g<b.length-1;g++){var e=b[g];if(!(e in d))return;d=d[e]}b=b[b.length-1];g=d[b];c=c(g);c!=g&&null!=c&&$jscomp.defineProperty(d,b,{configurable:!0,writable:!0,value:c})};
$jscomp.polyfillIsolated=function(b,c,d,g){var e=b.split(".");b=1===e.length;g=e[0];g=!b&&g in $jscomp.polyfills?$jscomp.polyfills:$jscomp.global;for(var k=0;k<e.length-1;k++){var a=e[k];if(!(a in g))return;g=g[a]}e=e[e.length-1];d=$jscomp.IS_SYMBOL_NATIVE&&"es6"===d?g[e]:null;c=c(d);null!=c&&(b?$jscomp.defineProperty($jscomp.polyfills,e,{configurable:!0,writable:!0,value:c}):c!==d&&($jscomp.propertyToPolyfillSymbol[e]=$jscomp.IS_SYMBOL_NATIVE?$jscomp.global.Symbol(e):$jscomp.POLYFILL_PREFIX+e,e=
$jscomp.propertyToPolyfillSymbol[e],$jscomp.defineProperty(g,e,{configurable:!0,writable:!0,value:c})))};$jscomp.polyfill("Array.prototype.find",function(b){return b?b:function(c,d){return $jscomp.findInternal(this,c,d).v}},"es6","es3");
(function(b){"function"===typeof define&&define.amd?define(["jquery","datatables.net"],function(c){return b(c,window,document)}):"object"===typeof exports?module.exports=function(c,d){c||(c=window);d&&d.fn.dataTable||(d=require("datatables.net")(c,d).$);return b(d,c,c.document)}:b(jQuery,window,document)})(function(b,c,d,g){var e=b.fn.dataTable,k=function(a,f){if(!e.versionCheck||!e.versionCheck("1.10.8"))throw"RowGroup requires DataTables 1.10.8 or newer";this.c=b.extend(!0,{},e.defaults.rowGroup,
k.defaults,f);this.s={dt:new e.Api(a)};this.dom={};a=this.s.dt.settings()[0];if(f=a.rowGroup)return f;a.rowGroup=this;this._constructor()};b.extend(k.prototype,{dataSrc:function(a){if(a===g)return this.c.dataSrc;var f=this.s.dt;this.c.dataSrc=a;b(f.table().node()).triggerHandler("rowgroup-datasrc.dt",[f,a]);return this},disable:function(){this.c.enable=!1;return this},enable:function(a){if(!1===a)return this.disable();this.c.enable=!0;return this},enabled:function(){return this.c.enable},_constructor:function(){var a=
this,f=this.s.dt,h=f.settings()[0];f.on("draw.dtrg",function(m,r){a.c.enable&&h===r&&a._draw()});f.on("column-visibility.dt.dtrg responsive-resize.dt.dtrg",function(){a._adjustColspan()});f.on("destroy",function(){f.off(".dtrg")})},_adjustColspan:function(){b("tr."+this.c.className,this.s.dt.table().body()).find("td:visible").attr("colspan",this._colspan())},_colspan:function(){return this.s.dt.columns().visible().reduce(function(a,f){return a+f},0)},_draw:function(){var a=this._group(0,this.s.dt.rows({page:"current"}).indexes());
this._groupDisplay(0,a)},_group:function(a,f){for(var h=Array.isArray(this.c.dataSrc)?this.c.dataSrc:[this.c.dataSrc],m=e.ext.oApi._fnGetObjectDataFn(h[a]),r=this.s.dt,n,q,p=[],l=0,t=f.length;l<t;l++){var u=f[l];n=r.row(u).data();n=m(n);if(null===n||n===g)n=this.c.emptyDataGroup;if(q===g||n!==q)p.push({dataPoint:n,rows:[]}),q=n;p[p.length-1].rows.push(u)}if(h[a+1]!==g)for(l=0,t=p.length;l<t;l++)p[l].children=this._group(a+1,p[l].rows);return p},_groupDisplay:function(a,f){for(var h=this.s.dt,m,r=
0,n=f.length;r<n;r++){var q=f[r],p=q.dataPoint,l=q.rows;this.c.startRender&&(m=this.c.startRender.call(this,h.rows(l),p,a),(m=this._rowWrap(m,this.c.startClassName,a))&&m.insertBefore(h.row(l[0]).node()));this.c.endRender&&(m=this.c.endRender.call(this,h.rows(l),p,a),(m=this._rowWrap(m,this.c.endClassName,a))&&m.insertAfter(h.row(l[l.length-1]).node()));q.children&&this._groupDisplay(a+1,q.children)}},_rowWrap:function(a,f,h){if(null===a||""===a)a=this.c.emptyDataGroup;return a===g||null===a?null:
("object"===typeof a&&a.nodeName&&"tr"===a.nodeName.toLowerCase()?b(a):a instanceof b&&a.length&&"tr"===a[0].nodeName.toLowerCase()?a:b("<tr/>").append(b("<th/>").attr("colspan",this._colspan()).attr("scope","row").append(a))).addClass(this.c.className).addClass(f).addClass("dtrg-level-"+h)}});k.defaults={className:"dtrg-group",dataSrc:0,emptyDataGroup:"No group",enable:!0,endClassName:"dtrg-end",endRender:null,startClassName:"dtrg-start",startRender:function(a,f){return f}};k.version="1.2.0";b.fn.dataTable.RowGroup=
k;b.fn.DataTable.RowGroup=k;e.Api.register("rowGroup()",function(){return this});e.Api.register("rowGroup().disable()",function(){return this.iterator("table",function(a){a.rowGroup&&a.rowGroup.enable(!1)})});e.Api.register("rowGroup().enable()",function(a){return this.iterator("table",function(f){f.rowGroup&&f.rowGroup.enable(a===g?!0:a)})});e.Api.register("rowGroup().enabled()",function(){var a=this.context;return a.length&&a[0].rowGroup?a[0].rowGroup.enabled():!1});e.Api.register("rowGroup().dataSrc()",
function(a){return a===g?this.context[0].rowGroup.dataSrc():this.iterator("table",function(f){f.rowGroup&&f.rowGroup.dataSrc(a)})});b(d).on("preInit.dt.dtrg",function(a,f,h){"dt"===a.namespace&&(a=f.oInit.rowGroup,h=e.defaults.rowGroup,a||h)&&(h=b.extend({},h,a),!1!==a&&new k(f,h))});return k});
/*! RowGroup 1.3.0
* ©2017-2022 SpryMedia Ltd - datatables.net/license
*/
!function(e){"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(t){return e(t,window,document)}):"object"==typeof exports?module.exports=function(t,r){return t=t||window,(r=r||("undefined"!=typeof window?require("jquery"):require("jquery")(t))).fn.dataTable||require("datatables.net")(t,r),e(r,0,t.document)}:e(jQuery,window,document)}(function(o,t,r,l){"use strict";function a(t,r){if(!p.versionCheck||!p.versionCheck("1.10.8"))throw"RowGroup requires DataTables 1.10.8 or newer";if(this.c=o.extend(!0,{},p.defaults.rowGroup,a.defaults,r),this.s={dt:new p.Api(t)},this.dom={},r=this.s.dt.settings()[0],t=r.rowGroup)return t;(r.rowGroup=this)._constructor()}var p=o.fn.dataTable;return o.extend(a.prototype,{dataSrc:function(t){var r;return t===l?this.c.dataSrc:(r=this.s.dt,this.c.dataSrc=t,o(r.table().node()).triggerHandler("rowgroup-datasrc.dt",[r,t]),this)},disable:function(){return this.c.enable=!1,this},enable:function(t){return!1===t?this.disable():(this.c.enable=!0,this)},enabled:function(){return this.c.enable},_constructor:function(){var e=this,t=this.s.dt,n=t.settings()[0];t.on("draw.dtrg",function(t,r){e.c.enable&&n===r&&e._draw()}),t.on("column-visibility.dt.dtrg responsive-resize.dt.dtrg",function(){e._adjustColspan()}),t.on("destroy",function(){t.off(".dtrg")})},_adjustColspan:function(){o("tr."+this.c.className,this.s.dt.table().body()).find("td:visible").attr("colspan",this._colspan())},_colspan:function(){return this.s.dt.columns().visible().reduce(function(t,r){return t+r},0)},_draw:function(){var t=this.s.dt,t=this._group(0,t.rows({page:"current"}).indexes());this._groupDisplay(0,t)},_group:function(t,r){for(var e,n=Array.isArray(this.c.dataSrc)?this.c.dataSrc:[this.c.dataSrc],o=p.ext.oApi._fnGetObjectDataFn(n[t]),a=this.s.dt,s=[],i=0,u=r.length;i<u;i++){var d,c=r[i];null!==(d=o(a.row(c).data()))&&d!==l||(d=this.c.emptyDataGroup),e!==l&&d===e||(s.push({dataPoint:d,rows:[]}),e=d),s[s.length-1].rows.push(c)}if(n[t+1]!==l)for(i=0,u=s.length;i<u;i++)s[i].children=this._group(t+1,s[i].rows);return s},_groupDisplay:function(t,r){for(var e,n=this.s.dt,o=0,a=r.length;o<a;o++){var s,i=r[o],u=i.dataPoint,d=i.rows;this.c.startRender&&(e=this.c.startRender.call(this,n.rows(d),u,t),(s=this._rowWrap(e,this.c.startClassName,t))&&s.insertBefore(n.row(d[0]).node())),this.c.endRender&&(e=this.c.endRender.call(this,n.rows(d),u,t),(s=this._rowWrap(e,this.c.endClassName,t))&&s.insertAfter(n.row(d[d.length-1]).node())),i.children&&this._groupDisplay(t+1,i.children)}},_rowWrap:function(t,r,e){return(t=null!==t&&""!==t?t:this.c.emptyDataGroup)===l||null===t?null:("object"==typeof t&&t.nodeName&&"tr"===t.nodeName.toLowerCase()?o(t):t instanceof o&&t.length&&"tr"===t[0].nodeName.toLowerCase()?t:o("<tr/>").append(o("<th/>").attr("colspan",this._colspan()).attr("scope","row").append(t))).addClass(this.c.className).addClass(r).addClass("dtrg-level-"+e)}}),a.defaults={className:"dtrg-group",dataSrc:0,emptyDataGroup:"No group",enable:!0,endClassName:"dtrg-end",endRender:null,startClassName:"dtrg-start",startRender:function(t,r){return r}},a.version="1.3.0",o.fn.dataTable.RowGroup=a,o.fn.DataTable.RowGroup=a,p.Api.register("rowGroup()",function(){return this}),p.Api.register("rowGroup().disable()",function(){return this.iterator("table",function(t){t.rowGroup&&t.rowGroup.enable(!1)})}),p.Api.register("rowGroup().enable()",function(r){return this.iterator("table",function(t){t.rowGroup&&t.rowGroup.enable(r===l||r)})}),p.Api.register("rowGroup().enabled()",function(){var t=this.context;return!(!t.length||!t[0].rowGroup)&&t[0].rowGroup.enabled()}),p.Api.register("rowGroup().dataSrc()",function(r){return r===l?this.context[0].rowGroup.dataSrc():this.iterator("table",function(t){t.rowGroup&&t.rowGroup.dataSrc(r)})}),o(r).on("preInit.dt.dtrg",function(t,r,e){var n;"dt"===t.namespace&&(t=r.oInit.rowGroup,n=p.defaults.rowGroup,(t||n)&&(n=o.extend({},n,t),!1!==t&&new a(r,n)))}),p});

@@ -5,6 +5,8 @@ {

"main": "js/dataTables.rowGroup.js",
"module": "js/dataTables.rowGroup.mjs",
"types": "./types/types.d.ts",
"version": "1.2.0",
"version": "1.3.0",
"files": [
"js/**/*.js",
"js/**/*.mjs",
"types/**/*.d.ts"

@@ -22,3 +24,3 @@ ],

"dependencies": {
"datatables.net": ">=1.11.3",
"datatables.net": ">=1.12.1",
"jquery": ">=1.7"

@@ -25,0 +27,0 @@ },

@@ -1,105 +0,145 @@

// Type definitions for datatables.net-rowgroup 1.0
// Type definitions for DataTables RowGroup
//
// Project: https://datatables.net/extensions/rowgroup/, https://datatables.net
// Definitions by: Matthieu Tabuteau <https://github.com/maixiu>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
// Definitions by:
// SpryMedia
// Matthieu Tabuteau <https://github.com/maixiu>
/// <reference types="jquery" />
/// <reference types="datatables.net"/>
declare namespace DataTables {
interface Settings {
/**
* RowGroup extension options
*/
rowGroup?: boolean | RowGroupSettings;
}
import DataTables, {Api} from 'datatables.net';
interface StaticFunctions {
RowGroup: RowGroupStaticFunctions;
}
export default DataTables;
interface RowGroupStaticFunctions {
new (dt: Api<any>, settings: boolean | RowGroupSettings): undefined;
version: string;
defaults: RowGroupSettings;
}
interface Api<T> {
rowGroup(): RowGroupApi;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* DataTables' types integration
*/
declare module 'datatables.net' {
interface Config {
/**
* RowGroup extension options
*/
rowGroup?: boolean | ConfigRowGroup;
}
interface RowGroupApi {
/**
* Get the data source for the row grouping
*
* @returns Data source property
*/
dataSrc(): number | string;
interface Api<T> {
/**
* RowGroup methods container
*
* @returns Api for chaining with the additional RowGroup methods
*/
rowGroup(): ApiRowGroup<T>;
}
/**
* Set the data source for the row grouping
*
* @param prop Data source property
* @returns DataTables Api instance
*/
dataSrc(prop: number|string): Api<any>;
interface ApiStatic {
/**
* RowGroup class
*/
RowGroup: {
/**
* Create a new RowGroup instance for the target DataTable
*/
new (dt: Api<any>, settings: boolean | ConfigRowGroup);
/**
* Disable RowGroup's interaction with the table
*
* @returns DataTables API instance
*/
disable(): Api<any>;
/**
* Default configuration values
*/
defaults: ConfigRowGroup;
/**
* Enable or disable RowGroup's interaction with the table
*
* @param enable Either enables or disables RowGroup depending on the value of the flag
* @returns DataTables Api instance
*/
enable(enable?: boolean): Api<any>;
/**
* RowGroup version
*/
version: string;
}
}
}
/**
* Get the enabled state for RowGroup.
*
* @returns true if enabled, false otherwise
*/
enabled(): boolean;
}
/**
* RowGroup extension options
*/
interface RowGroupSettings {
/**
* Set the class name to be used for the grouping rows
*/
className?: string;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Options
*/
/**
* Set the data point to use as the grouping data source
*/
dataSrc?: number|string;
interface ConfigRowGroup {
/**
* Set the class name to be used for the grouping rows
*/
className?: string;
/**
* Provides the ability to disable row grouping at initialisation
*/
enable?: boolean;
/**
* Set the data point to use as the grouping data source
*/
dataSrc?: number|string;
/**
* Set the class name to be used for the grouping end rows
*/
endClassName?: string;
/**
* Text to show for rows which have `null`, `undefined` or empty string group data
*
* @since 1.0.2
*/
emptyDataGroup?: string;
/**
* Provide a function that can be used to control the data shown in the end grouping row
*/
endRender?: (rows: Api<any>, group: string) => string|HTMLElement|JQuery;
/**
* Provides the ability to disable row grouping at initialisation
*/
enable?: boolean;
/**
* Provide a function that can be used to control the data shown in the start grouping row
*/
startRender?: (rows: Api<any>, group: string) => string|HTMLElement|JQuery;
}
/**
* Set the class name to be used for the grouping end rows
*/
endClassName?: string;
/**
* Provide a function that can be used to control the data shown in the end grouping row
*/
endRender?: (rows: Api<any>, group: string) => string|HTMLElement|JQuery;
/**
* Set the class name to be used for the start grouping rows
*/
startClassName?: string;
/**
* Provide a function that can be used to control the data shown in the start grouping row
*/
startRender?: (rows: Api<any>, group: string) => string|HTMLElement|JQuery;
}
interface ApiRowGroup<T> extends Api<T> {
/**
* Get the data source for the row grouping
*
* @returns Data source property
*/
dataSrc(): number | string;
/**
* Set the data source for the row grouping
*
* @param prop Data source property
* @returns DataTables Api instance
*/
dataSrc(prop: number|string): Api<T>;
/**
* Disable RowGroup's interaction with the table
*
* @returns DataTables API instance
*/
disable(): Api<T>;
/**
* Enable or disable RowGroup's interaction with the table
*
* @param enable Either enables or disables RowGroup depending on the value of the flag
* @returns DataTables Api instance
*/
enable(enable?: boolean): Api<T>;
/**
* Get the enabled state for RowGroup.
*
* @returns true if enabled, false otherwise
*/
enabled(): boolean;
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc