Skip to content

Commit

Permalink
3396fc6ed6ff6be2346e557b89383a69e4813c6f New: -api DataTable.use()
Browse files Browse the repository at this point in the history
…can now have Bootstrap (5) and Foundation JS libraries set so extensions such as Editor and Responsive can use the JS function (e.g. Modal). They had their own methods for that in the past (which will work for backwards compatibility), but this provides a single common approach for all libraries that DataTables components can use.

Sync to source repo @3396fc6ed6ff6be2346e557b89383a69e4813c6f
  • Loading branch information
dtbuild committed Oct 24, 2024
1 parent 7a71113 commit d27563c
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 7 deletions.
2 changes: 1 addition & 1 deletion datatables.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
],
"src-repo": "http://github.com/DataTables/DataTablesSrc",
"last-tag": "2.1.8",
"last-sync": "e412ed5850e072210e68dba7a701a3291c64e88c"
"last-sync": "3396fc6ed6ff6be2346e557b89383a69e4813c6f"
}
22 changes: 20 additions & 2 deletions js/dataTables.js
Original file line number Diff line number Diff line change
Expand Up @@ -9403,6 +9403,10 @@
} );
} );

// Can be assigned in DateTable.use() - note luxon and moment vars are in helpers.js
var __bootstrap;
var __foundation;

/**
* Set the libraries that DataTables uses, or the global objects.
* Note that the arguments can be either way around (legacy support)
Expand Down Expand Up @@ -9436,6 +9440,12 @@
case 'moment':
return __moment;

case 'bootstrap':
return __bootstrap;

case 'foundation':
return __foundation;

default:
return null;
}
Expand All @@ -9458,6 +9468,14 @@
else if (type === 'moment' || (module && module.isMoment)) {
__moment = module;
}
else if (type === 'bootstrap' || (module && module.Modal && module.Modal.NAME === 'modal'))
{
// This is currently for BS5 only. BS3/4 attach to jQuery, so no need to use `.use()`
__bootstrap = module;
}
else if (type === 'foundation' || (module && module.Reveal)) {
__foundation = module;
}
}

/**
Expand Down Expand Up @@ -12111,8 +12129,8 @@


var __mlWarning = false;
var __luxon; // Can be assigned in DateTeble.use()
var __moment; // Can be assigned in DateTeble.use()
var __luxon; // Can be assigned in DateTable.use()
var __moment; // Can be assigned in DateTable.use()

/**
*
Expand Down
2 changes: 1 addition & 1 deletion js/dataTables.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/dataTables.min.mjs

Large diffs are not rendered by default.

22 changes: 20 additions & 2 deletions js/dataTables.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9350,6 +9350,10 @@ _api_register( 'state.save()', function () {
} );
} );

// Can be assigned in DateTable.use() - note luxon and moment vars are in helpers.js
var __bootstrap;
var __foundation;

/**
* Set the libraries that DataTables uses, or the global objects.
* Note that the arguments can be either way around (legacy support)
Expand Down Expand Up @@ -9383,6 +9387,12 @@ DataTable.use = function (arg1, arg2) {
case 'moment':
return __moment;

case 'bootstrap':
return __bootstrap;

case 'foundation':
return __foundation;

default:
return null;
}
Expand All @@ -9405,6 +9415,14 @@ DataTable.use = function (arg1, arg2) {
else if (type === 'moment' || (module && module.isMoment)) {
__moment = module;
}
else if (type === 'bootstrap' || (module && module.Modal && module.Modal.NAME === 'modal'))
{
// This is currently for BS5 only. BS3/4 attach to jQuery, so no need to use `.use()`
__bootstrap = module;
}
else if (type === 'foundation' || (module && module.Reveal)) {
__foundation = module;
}
}

/**
Expand Down Expand Up @@ -12058,8 +12076,8 @@ function __mld( dtLib, momentFn, luxonFn, dateFn, arg1 ) {


var __mlWarning = false;
var __luxon; // Can be assigned in DateTeble.use()
var __moment; // Can be assigned in DateTeble.use()
var __luxon; // Can be assigned in DateTable.use()
var __moment; // Can be assigned in DateTable.use()

/**
*
Expand Down

0 comments on commit d27563c

Please sign in to comment.