1
0
Fork 0
mirror of https://github.com/koalyptus/TableFilter.git synced 2024-04-26 12:10:45 +02:00

Continuing Webpack investigation

This commit is contained in:
Max Guglielmi 2015-05-03 21:11:06 +10:00
parent 25b358a18f
commit c995091db4
17 changed files with 30 additions and 1333 deletions

View file

@ -61,6 +61,7 @@ module.exports = function (grunt) {
publicPath: "/dist/",
path: __dirname + "/dist",
filename: "tablefilter.js",
// chunkFilename: "[name]-[chunkhash].js",
chunkFilename: "[name].js",
libraryTarget: 'umd'
},
@ -83,25 +84,7 @@ module.exports = function (grunt) {
compact: false
},
loader: 'babel-loader'
}
// ,
// {
// // test: /[\/\\]libs[\/\\]sortabletable\.js$/,
// // test: path.join(__dirname, 'libs') + 'sortabletable.js',
// test: /sortabletable\.js$/,
// exclude: /node_modules/,
// loader: "imports?this=>window"
// },
// {
// test: /sortabletable\.js$/,
// exclude: /node_modules/,
// loader: "expose?SortableTable"
// }
// {
// test: /[\/]sortabletable\.js$/,
// loader: "exports?SortableTable"
// }
]
}]
},
plugins: [
// new webpack.DefinePlugin({
@ -110,6 +93,12 @@ module.exports = function (grunt) {
// "NODE_ENV": JSON.stringify("production")
// }
// }),
// new webpack.optimize.CommonsChunkPlugin(
// 'main', 1, false),
// new webpack.IgnorePlugin(/adapterSortabletable$/),
// new webpack.optimize.CommonsChunkPlugin(
// "commons.js",
// ["1", "2"]),
new webpack.optimize.DedupePlugin()
// ,
// new webpack.optimize.UglifyJsPlugin()

458
dist/1.js vendored

File diff suppressed because one or more lines are too long

35
dist/tablefilter.js vendored
View file

@ -37,7 +37,8 @@ return /******/ (function(modules) { // webpackBootstrap
/******/ // "0" means "already loaded"
/******/ // Array means "loading", array contains callbacks
/******/ var installedChunks = {
/******/ 0:0
/******/ 0:0,
/******/ 3:0
/******/ };
/******/ // The require function
@ -174,12 +175,6 @@ return /******/ (function(modules) { // webpackBootstrap
var _ColOps = __webpack_require__(24);
// Extensions
// import './extensions/sortabletable/sortabletable';
// import {AdapterSortableTable}
// from './extensions/sortabletable/adapterSortabletable';
// import {ColsVisibility} from 'extensions/colsVisibility/colsVisibility';
var global = window,
isValidDate = _dateHelper.DateHelper.isValid,
formatDate = _dateHelper.DateHelper.format,
@ -1617,32 +1612,6 @@ return /******/ (function(modules) { // webpackBootstrap
value: function setSort() {
var _this2 = this;
// require("script!../libs/sortabletable.js");
// var SortableTable = require('sortabletable');
// console.log(SortableTable);
// require(['sortabletable'], function(m) {
// console.log(m);
// });
// var adapterSortabletable = new AdapterSortableTable(this);
// this.ExtRegistry.sort = adapterSortabletable;
// adapterSortabletable.init();
// require(['sortabletable',
// './extensions/sortabletable/adapterSortabletable'],
// (s, m)=> {
// console.log(s, m);
// var adapterSortabletable = new m.AdapterSortableTable(this);
// this.ExtRegistry.sort = adapterSortabletable;
// adapterSortabletable.init();
// });
// this.includeFile(
// 'sortConfig.name',
// '../libs/sortabletable.js',
// function(){
// console.log(AdapterSortableTable);
// }
// );
__webpack_require__.e/* require */(2, function(__webpack_require__) { var __WEBPACK_AMD_REQUIRE_ARRAY__ = [__webpack_require__(25)]; (function (m) {
var adapterSortabletable = new m.AdapterSortableTable(_this2);
_this2.ExtRegistry.sort = adapterSortabletable;

View file

@ -76,7 +76,6 @@
</tbody>
</table>
<!-- <script type="text/javascript" src="../libs/sortabletable.js"></script> -->
<script type="text/javascript" src="../dist/tablefilter.js"></script>
<script>
var table = document.getElementById('demo');

View file

@ -1,20 +0,0 @@
{
"name": "almond",
"version": "0.3.1",
"main": "almond.js",
"ignore": [
"tests",
"shrinktest.sh"
],
"homepage": "https://github.com/jrburke/almond",
"_release": "0.3.1",
"_resolution": {
"type": "version",
"tag": "0.3.1",
"commit": "8336992b1a3fee8d10310822d4222fb82d24f097"
},
"_source": "git://github.com/jrburke/almond.git",
"_target": "~0.3.1",
"_originalSource": "almond",
"_direct": true
}

View file

@ -1 +0,0 @@
.DS_Store

View file

@ -1,2 +0,0 @@
tests
*.sh

View file

@ -1,12 +0,0 @@
language: node_js
node_js: 0.10
before_script:
- node tests/server.js &
- sleep 1
script: phantomjs tests/runner.js
after_script:
- kill -9 `cat tests/pid.txt`
- rm tests/pid.txt

View file

@ -1,58 +0,0 @@
almond is released under two licenses: new BSD, and MIT. You may pick the
license that best suits your development needs. The text of both licenses are
provided below.
The "New" BSD License:
----------------------
Copyright (c) 2010-2011, The Dojo Foundation
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the Dojo Foundation nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
MIT License
-----------
Copyright (c) 2010-2011, The Dojo Foundation
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View file

@ -1,239 +0,0 @@
#almond
A replacement [AMD](https://github.com/amdjs/amdjs-api/wiki/AMD) loader for
[RequireJS](http://requirejs.org). It provides a minimal AMD API footprint that includes [loader plugin](http://requirejs.org/docs/plugins.html) support. Only useful for built/bundled AMD modules, does not do dynamic loading.
## Why
Some developers like to use the AMD API to code modular JavaScript, but after doing an optimized build,
they do not want to include a full AMD loader like RequireJS, since they do not need all that functionality.
Some use cases, like mobile, are very sensitive to file sizes.
By including almond in the built file, there is no need for RequireJS.
almond is around **1 kilobyte** when minified with Closure Compiler and gzipped.
Since it can support certain types of loader plugin-optimized resources, it is a great
fit for a library that wants to use [text templates](http://requirejs.org/docs/api.html#text)
or [CoffeeScript](https://github.com/jrburke/require-cs) as part of
their project, but get a tiny download in one file after using the
[RequireJS Optimizer](http://requirejs.org/docs/optimization.html).
If you are building a library, the wrap=true support in the RequireJS optimizer
will wrap the optimized file in a closure, so the define/require AMD API does not
escape the file. Users of your optimized file will only see the global API you decide
to export, not the AMD API. See the usage section below for more details.
So, you get great code cleanliness with AMD and the use of powerful loader plugins
in a tiny wrapper that makes it easy for others to use your code even if they do not use AMD.
If you want a single file build output but without the module APIs included, you might want to consider [AMDclean](https://github.com/gfranko/amdclean).
## Restrictions
It is best used for libraries or apps that use AMD and:
* optimize all the modules into one file -- no dynamic code loading.
* all modules have IDs and dependency arrays in their define() calls -- the RequireJS optimizer will take care of this for you.
* only have **one** requirejs.config() or require.config() call.
* the requirejs.config/require.config call needs to be included in the build output. This is particularly important for making sure any [map config](http://requirejs.org/docs/api.html#config-map) use still works.
* do not use the `var require = {};` style of [passing config](http://requirejs.org/docs/api.html#config).
* do not use [RequireJS multiversion support/contexts](http://requirejs.org/docs/api.html#multiversion).
* do not use require.toUrl() or require.nameToUrl().
* do not use [packages/packagePaths config](http://requirejs.org/docs/api.html#packages). If you need to use packages that have a main property, [volo](https://github.com/volojs/volo) can create an adapter module so that it can work without this config. Use the `amdify add` command to add the dependency to your project.
What is supported:
* dependencies with relative IDs.
* define('id', {}) definitions.
* define(), require() and requirejs() calls.
* loader plugins that can inline their resources into optimized files, and
can access those inlined resources synchronously after the optimization pass.
The [text](http://requirejs.org/docs/api.html#text) and
[CoffeeScript](https://github.com/jrburke/require-cs) plugins are two such plugins.
## Download
[Latest release](https://github.com/jrburke/almond/raw/latest/almond.js)
## Usage
[Download the RequireJS optimizer](http://requirejs.org/docs/download.html#rjs).
[Download the current release of almond.js](https://github.com/jrburke/almond/raw/latest/almond.js).
Run the optimizer using [Node](http://nodejs.org) (also [works in Java](https://github.com/jrburke/r.js/blob/master/README.md)):
node r.js -o baseUrl=. name=path/to/almond include=main out=main-built.js wrap=true
This assumes your project's top-level script file is called main.js and the command
above is run from the directory containing main.js. If you prefer to use a build.js build profile instead of command line arguments, [this RequireJS optimization section](http://requirejs.org/docs/optimization.html#pitfalls) has info on how to do that.
wrap=true will add this wrapper around the main-built.js contents (which will be minified by UglifyJS:
(function () {
//almond will be here
//main and its nested dependencies will be here
}());
If you do not want that wrapper, leave off the wrap=true argument.
These optimizer arguments can also be used in a build config object, so it can be used
in [runtime-generated server builds](https://github.com/jrburke/r.js/blob/master/build/tests/http/httpBuild.js).
## Triggering module execution <a name="execution"></a>
As of RequireJS 2.0 and almond 0.1, modules are only executed if they are
called by a top level require call. The data-main attribute on a script tag
for require.js counts as a top level require call.
However with almond, it does not look for a data-main attribute, and if your
main JS module does not use a top level require() or requirejs() call to
trigger module loading/execution, after a build, it may appear that the code
broke -- no modules execute.
The 2.0 RequireJS optimizer has a build config, option **insertRequire** that you
can use to specify that a require([]) call is inserted at the end of the built
file to trigger module loading. Example:
node r.js -o baseUrl=. name=path/to/almond.js include=main insertRequire=main out=main-built.js wrap=true
or, if using a build config file:
```javascript
{
baseUrl: '.',
name: 'path/to/almond',
include: ['main'],
insertRequire: ['main'],
out: 'main-built.js',
wrap: true
}
```
This will result with `require(["main"]);` at the bottom of main-built.js.
## Exporting a public API
If you are making a library that is made up of AMD modules in source form, but will be built with almond into one file, and you want to export a small public
API for that library, you can use the `wrap` build config to do so. Build
config:
```javascript
{
baseUrl: '.',
name: 'path/to/almond',
include: ['main'],
out: 'lib-built.js',
wrap: {
startFile: 'path/to/start.frag',
endFile: 'path/to/end.frag'
}
}
```
Where start.frag could look like this:
```javascript
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
//Allow using this built library as an AMD module
//in another project. That other project will only
//see this AMD call, not the internal modules in
//the closure below.
define([], factory);
} else {
//Browser globals case. Just assign the
//result to a property on the global.
root.libGlobalName = factory();
}
}(this, function () {
//almond, and your modules will be inlined here
```
and end.frag is like this:
```javascript
//The modules for your project will be inlined above
//this snippet. Ask almond to synchronously require the
//module value for 'main' here and return it as the
//value to use for the public API for the built file.
return require('main');
}));
```
After the build, then the built file should be structured like so:
* start.frag
* almond.js
* modules for your lib, including 'main'
* end.frag
## Common errors
Explanations of common errors:
### incorrect module build, no module name
In almond 3.0.0 and earlier, this would show up as "deps is undefined", where
this line is mentioned:
if (!deps.splice) {
In 3.0.1+ the error is explicitly: "incorrect module build, no module name".
This means that there is a define()'d module, but it is missing a name,
something that looks like this:
define(function () {});
//or
define([], function () {});
when it should look like:
define('someName', function () {});
//or
define('someName', [], function () {});
This is usually a sign that the tool you used to combine all the modules
together did not properly name an anonymous AMD module.
Multiple modules built into a single file **must** have names in the define calls.
Otherwise almond has no way to assign the module to a name key for use in the code.
The fix is to use a build tool that understand AMD modules and inserts the module
IDs in the build. The
[requirejs optimizer](http://requirejs.org/docs/optimization.html) is a build tool
that can do this correctly.
### x missing y
It means that module 'x' asked for module 'y', but module 'y' was not available.
This usually means that 'y' was not included in the built file that includes almond.
almond can only handle modules built in with it, it cannot dynamically load
modules from the network.
### No y
It means that a `require('y')` call was done but y was not available.
This usually means that 'y' was not included in the built file that includes almond.
almond can only handle modules built in with it, it cannot dynamically load
modules from the network.
## How to get help
* Contact the [requirejs list](https://groups.google.com/group/requirejs).
* Open issues in the [issue tracker](https://github.com/jrburke/almond/issues).
## Contributing
Almond follows the
[same contribution model as requirejs](http://requirejs.org/docs/contributing.html)
and is considered a sub-project of requirejs.

View file

@ -1,430 +0,0 @@
/**
* @license almond 0.3.1 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved.
* Available via the MIT or new BSD license.
* see: http://github.com/jrburke/almond for details
*/
//Going sloppy to avoid 'use strict' string cost, but strict practices should
//be followed.
/*jslint sloppy: true */
/*global setTimeout: false */
var requirejs, require, define;
(function (undef) {
var main, req, makeMap, handlers,
defined = {},
waiting = {},
config = {},
defining = {},
hasOwn = Object.prototype.hasOwnProperty,
aps = [].slice,
jsSuffixRegExp = /\.js$/;
function hasProp(obj, prop) {
return hasOwn.call(obj, prop);
}
/**
* Given a relative module name, like ./something, normalize it to
* a real name that can be mapped to a path.
* @param {String} name the relative name
* @param {String} baseName a real name that the name arg is relative
* to.
* @returns {String} normalized name
*/
function normalize(name, baseName) {
var nameParts, nameSegment, mapValue, foundMap, lastIndex,
foundI, foundStarMap, starI, i, j, part,
baseParts = baseName && baseName.split("/"),
map = config.map,
starMap = (map && map['*']) || {};
//Adjust any relative paths.
if (name && name.charAt(0) === ".") {
//If have a base name, try to normalize against it,
//otherwise, assume it is a top-level require that will
//be relative to baseUrl in the end.
if (baseName) {
name = name.split('/');
lastIndex = name.length - 1;
// Node .js allowance:
if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) {
name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, '');
}
//Lop off the last part of baseParts, so that . matches the
//"directory" and not name of the baseName's module. For instance,
//baseName of "one/two/three", maps to "one/two/three.js", but we
//want the directory, "one/two" for this normalization.
name = baseParts.slice(0, baseParts.length - 1).concat(name);
//start trimDots
for (i = 0; i < name.length; i += 1) {
part = name[i];
if (part === ".") {
name.splice(i, 1);
i -= 1;
} else if (part === "..") {
if (i === 1 && (name[2] === '..' || name[0] === '..')) {
//End of the line. Keep at least one non-dot
//path segment at the front so it can be mapped
//correctly to disk. Otherwise, there is likely
//no path mapping for a path starting with '..'.
//This can still fail, but catches the most reasonable
//uses of ..
break;
} else if (i > 0) {
name.splice(i - 1, 2);
i -= 2;
}
}
}
//end trimDots
name = name.join("/");
} else if (name.indexOf('./') === 0) {
// No baseName, so this is ID is resolved relative
// to baseUrl, pull off the leading dot.
name = name.substring(2);
}
}
//Apply map config if available.
if ((baseParts || starMap) && map) {
nameParts = name.split('/');
for (i = nameParts.length; i > 0; i -= 1) {
nameSegment = nameParts.slice(0, i).join("/");
if (baseParts) {
//Find the longest baseName segment match in the config.
//So, do joins on the biggest to smallest lengths of baseParts.
for (j = baseParts.length; j > 0; j -= 1) {
mapValue = map[baseParts.slice(0, j).join('/')];
//baseName segment has config, find if it has one for
//this name.
if (mapValue) {
mapValue = mapValue[nameSegment];
if (mapValue) {
//Match, update name to the new value.
foundMap = mapValue;
foundI = i;
break;
}
}
}
}
if (foundMap) {
break;
}
//Check for a star map match, but just hold on to it,
//if there is a shorter segment match later in a matching
//config, then favor over this star map.
if (!foundStarMap && starMap && starMap[nameSegment]) {
foundStarMap = starMap[nameSegment];
starI = i;
}
}
if (!foundMap && foundStarMap) {
foundMap = foundStarMap;
foundI = starI;
}
if (foundMap) {
nameParts.splice(0, foundI, foundMap);
name = nameParts.join('/');
}
}
return name;
}
function makeRequire(relName, forceSync) {
return function () {
//A version of a require function that passes a moduleName
//value for items that may need to
//look up paths relative to the moduleName
var args = aps.call(arguments, 0);
//If first arg is not require('string'), and there is only
//one arg, it is the array form without a callback. Insert
//a null so that the following concat is correct.
if (typeof args[0] !== 'string' && args.length === 1) {
args.push(null);
}
return req.apply(undef, args.concat([relName, forceSync]));
};
}
function makeNormalize(relName) {
return function (name) {
return normalize(name, relName);
};
}
function makeLoad(depName) {
return function (value) {
defined[depName] = value;
};
}
function callDep(name) {
if (hasProp(waiting, name)) {
var args = waiting[name];
delete waiting[name];
defining[name] = true;
main.apply(undef, args);
}
if (!hasProp(defined, name) && !hasProp(defining, name)) {
throw new Error('No ' + name);
}
return defined[name];
}
//Turns a plugin!resource to [plugin, resource]
//with the plugin being undefined if the name
//did not have a plugin prefix.
function splitPrefix(name) {
var prefix,
index = name ? name.indexOf('!') : -1;
if (index > -1) {
prefix = name.substring(0, index);
name = name.substring(index + 1, name.length);
}
return [prefix, name];
}
/**
* Makes a name map, normalizing the name, and using a plugin
* for normalization if necessary. Grabs a ref to plugin
* too, as an optimization.
*/
makeMap = function (name, relName) {
var plugin,
parts = splitPrefix(name),
prefix = parts[0];
name = parts[1];
if (prefix) {
prefix = normalize(prefix, relName);
plugin = callDep(prefix);
}
//Normalize according
if (prefix) {
if (plugin && plugin.normalize) {
name = plugin.normalize(name, makeNormalize(relName));
} else {
name = normalize(name, relName);
}
} else {
name = normalize(name, relName);
parts = splitPrefix(name);
prefix = parts[0];
name = parts[1];
if (prefix) {
plugin = callDep(prefix);
}
}
//Using ridiculous property names for space reasons
return {
f: prefix ? prefix + '!' + name : name, //fullName
n: name,
pr: prefix,
p: plugin
};
};
function makeConfig(name) {
return function () {
return (config && config.config && config.config[name]) || {};
};
}
handlers = {
require: function (name) {
return makeRequire(name);
},
exports: function (name) {
var e = defined[name];
if (typeof e !== 'undefined') {
return e;
} else {
return (defined[name] = {});
}
},
module: function (name) {
return {
id: name,
uri: '',
exports: defined[name],
config: makeConfig(name)
};
}
};
main = function (name, deps, callback, relName) {
var cjsModule, depName, ret, map, i,
args = [],
callbackType = typeof callback,
usingExports;
//Use name if no relName
relName = relName || name;
//Call the callback to define the module, if necessary.
if (callbackType === 'undefined' || callbackType === 'function') {
//Pull out the defined dependencies and pass the ordered
//values to the callback.
//Default to [require, exports, module] if no deps
deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps;
for (i = 0; i < deps.length; i += 1) {
map = makeMap(deps[i], relName);
depName = map.f;
//Fast path CommonJS standard dependencies.
if (depName === "require") {
args[i] = handlers.require(name);
} else if (depName === "exports") {
//CommonJS module spec 1.1
args[i] = handlers.exports(name);
usingExports = true;
} else if (depName === "module") {
//CommonJS module spec 1.1
cjsModule = args[i] = handlers.module(name);
} else if (hasProp(defined, depName) ||
hasProp(waiting, depName) ||
hasProp(defining, depName)) {
args[i] = callDep(depName);
} else if (map.p) {
map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {});
args[i] = defined[depName];
} else {
throw new Error(name + ' missing ' + depName);
}
}
ret = callback ? callback.apply(defined[name], args) : undefined;
if (name) {
//If setting exports via "module" is in play,
//favor that over return value and exports. After that,
//favor a non-undefined return value over exports use.
if (cjsModule && cjsModule.exports !== undef &&
cjsModule.exports !== defined[name]) {
defined[name] = cjsModule.exports;
} else if (ret !== undef || !usingExports) {
//Use the return value from the function.
defined[name] = ret;
}
}
} else if (name) {
//May just be an object definition for the module. Only
//worry about defining if have a module name.
defined[name] = callback;
}
};
requirejs = require = req = function (deps, callback, relName, forceSync, alt) {
if (typeof deps === "string") {
if (handlers[deps]) {
//callback in this case is really relName
return handlers[deps](callback);
}
//Just return the module wanted. In this scenario, the
//deps arg is the module name, and second arg (if passed)
//is just the relName.
//Normalize module name, if it contains . or ..
return callDep(makeMap(deps, callback).f);
} else if (!deps.splice) {
//deps is a config object, not an array.
config = deps;
if (config.deps) {
req(config.deps, config.callback);
}
if (!callback) {
return;
}
if (callback.splice) {
//callback is an array, which means it is a dependency list.
//Adjust args if there are dependencies
deps = callback;
callback = relName;
relName = null;
} else {
deps = undef;
}
}
//Support require(['a'])
callback = callback || function () {};
//If relName is a function, it is an errback handler,
//so remove it.
if (typeof relName === 'function') {
relName = forceSync;
forceSync = alt;
}
//Simulate async callback;
if (forceSync) {
main(undef, deps, callback, relName);
} else {
//Using a non-zero value because of concern for what old browsers
//do, and latest browsers "upgrade" to 4 if lower value is used:
//http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout:
//If want a value immediately, use require('id') instead -- something
//that works in almond on the global level, but not guaranteed and
//unlikely to work in other AMD implementations.
setTimeout(function () {
main(undef, deps, callback, relName);
}, 4);
}
return req;
};
/**
* Just drops the config on the floor, but returns req in case
* the config return value is used.
*/
req.config = function (cfg) {
return req(cfg);
};
/**
* Expose module registry for debugging and tooling
*/
requirejs._defined = defined;
define = function (name, deps, callback) {
if (typeof name !== 'string') {
throw new Error('See almond README: incorrect module build, no module name');
}
//This module may not have dependencies
if (!deps.splice) {
//deps is not an array, so probably means
//an object literal or factory function for
//the value. Adjust args.
callback = deps;
deps = [];
}
if (!hasProp(defined, name) && !hasProp(waiting, name)) {
waiting[name] = [name, deps, callback];
}
};
define.amd = {
jQuery: true
};
}());

View file

@ -1,9 +0,0 @@
{
"name": "almond",
"version": "0.3.1",
"main": "almond.js",
"ignore": [
"tests",
"shrinktest.sh"
]
}

View file

@ -1,29 +0,0 @@
{
"name": "almond",
"description": "A minimal AMD API implementation for use in optimized browser builds.",
"version": "0.3.1",
"homepage": "http://github.com/jrburke/almond",
"author": "James Burke <jrburke@gmail.com> (http://github.com/jrburke)",
"repository": {
"type": "git",
"url": "git://github.com/jrburke/almond.git"
},
"licenses": [
{
"type": "BSD",
"url": "https://github.com/jrburke/almond/blob/master/LICENSE"
},
{
"type": "MIT",
"url": "https://github.com/jrburke/almond/blob/master/LICENSE"
}
],
"main": "almond.js",
"engines": {
"node": ">=0.4.0"
},
"devDependencies": {
"connect": "^3.3.4",
"serve-static": "^1.9.1"
}
}

View file

@ -436,6 +436,3 @@ SortableTable.prototype.addSortType("CaseInsensitiveString", SortableTable.toUpp
SortableTable.prototype.addSortType("Date", SortableTable.toDate);
SortableTable.prototype.addSortType("String");
// None is a special case
module.exports = SortableTable;

View file

@ -6,6 +6,7 @@
"babel-loader": "^5.0.0",
"grunt": "^0.4.5",
"grunt-webpack": "^1.0.8",
"script-loader": "^0.6.1",
"webpack": "^1.8.10",
"webpack-dev-server": "^1.8.2"
},

View file

@ -4,9 +4,7 @@ import {Arr} from '../../array';
import {Event} from '../../event';
import {DateHelper} from '../../date';
import {Helpers} from '../../helpers';
import 'sortabletable';
// var SortableTable = require('sortabletable');
import 'script!sortabletable';
export class AdapterSortableTable{
@ -58,8 +56,6 @@ export class AdapterSortableTable{
var sortConfig = tf.sortConfig;
var adpt = this;
// var SortableTable = require('sortabletable');
// SortableTable class sanity check (sortabletable.js)
if(Types.isUndef(SortableTable)){
throw new Error('SortableTable class not found.');

View file

@ -36,12 +36,6 @@ import {Help} from './modules/help';
import {AlternateRows} from './modules/alternateRows';
import {ColOps} from './modules/colOps';
// Extensions
// import './extensions/sortabletable/sortabletable';
// import {AdapterSortableTable}
// from './extensions/sortabletable/adapterSortabletable';
// import {ColsVisibility} from 'extensions/colsVisibility/colsVisibility';
var global = window,
isValidDate = dateHelper.isValid,
formatDate = dateHelper.format,
@ -1538,38 +1532,12 @@ export class TableFilter{
and TF adapter by Max Guglielmi
=====================================================*/
setSort(){
// require("script!../libs/sortabletable.js");
// var SortableTable = require('sortabletable');
// console.log(SortableTable);
// require(['sortabletable'], function(m) {
// console.log(m);
// });
// var adapterSortabletable = new AdapterSortableTable(this);
// this.ExtRegistry.sort = adapterSortabletable;
// adapterSortabletable.init();
// require(['sortabletable',
// './extensions/sortabletable/adapterSortabletable'],
// (s, m)=> {
// console.log(s, m);
// var adapterSortabletable = new m.AdapterSortableTable(this);
// this.ExtRegistry.sort = adapterSortabletable;
// adapterSortabletable.init();
// });
// this.includeFile(
// 'sortConfig.name',
// '../libs/sortabletable.js',
// function(){
// console.log(AdapterSortableTable);
// }
// );
require(['adapterSortabletable'], (m)=> {
var adapterSortabletable = new m.AdapterSortableTable(this);
this.ExtRegistry.sort = adapterSortabletable;
adapterSortabletable.init();
});
}
setOldSort(){
var fn = this.Evt._EnableSort,