@hpcc-js/dgrid-shim
Version:
1,458 lines (1,271 loc) • 1.06 MB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["@hpcc-js/dgrid-shim"] = factory();
else
root["@hpcc-js/dgrid-shim"] = factory();
})(self, () => {
return /******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ 7957
/*!*******************************************************************!*\
!*** ../../../../../../../tmp/tmp-2755-3St0Maj5xojH/dojo/dojo.js ***!
\*******************************************************************/
(module) {
module.exports = function(userConfig, defaultConfig, global, window) { this.loaderVersion = "1.17.3"; (function(
userConfig,
defaultConfig
){
// summary:
// This is the "source loader" and is the entry point for Dojo during development. You may also load Dojo with
// any AMD-compliant loader via the package main module dojo/main.
// description:
// This is the "source loader" for Dojo. It provides an AMD-compliant loader that can be configured
// to operate in either synchronous or asynchronous modes. After the loader is defined, dojo is loaded
// IAW the package main module dojo/main. In the event you wish to use a foreign loader, you may load dojo as a package
// via the package main module dojo/main and this loader is not required; see dojo/package.json for details.
//
// In order to keep compatibility with the v1.x line, this loader includes additional machinery that enables
// the dojo.provide, dojo.require et al API. This machinery is loaded by default, but may be dynamically removed
// via the has.js API and statically removed via the build system.
//
// This loader includes sniffing machinery to determine the environment; the following environments are supported:
//
// - browser
// - node.js
// - rhino
//
// This is the so-called "source loader". As such, it includes many optional features that may be discarded by
// building a customized version with the build system.
// Design and Implementation Notes
//
// This is a dojo-specific adaption of bdLoad, donated to the dojo foundation by Altoviso LLC.
//
// This function defines an AMD-compliant (http://wiki.commonjs.org/wiki/Modules/AsynchronousDefinition)
// loader that can be configured to operate in either synchronous or asynchronous modes.
//
// Since this machinery implements a loader, it does not have the luxury of using a load system and/or
// leveraging a utility library. This results in an unpleasantly long file; here is a road map of the contents:
//
// 1. Small library for use implementing the loader.
// 2. Define the has.js API; this is used throughout the loader to bracket features.
// 3. Define the node.js and rhino sniffs and sniff.
// 4. Define the loader's data.
// 5. Define the configuration machinery.
// 6. Define the script element sniffing machinery and sniff for configuration data.
// 7. Configure the loader IAW the provided user, default, and sniffing data.
// 8. Define the global require function.
// 9. Define the module resolution machinery.
// 10. Define the module and plugin module definition machinery
// 11. Define the script injection machinery.
// 12. Define the window load detection.
// 13. Define the logging API.
// 14. Define the tracing API.
// 16. Define the AMD define function.
// 17. Define the dojo v1.x provide/require machinery--so called "legacy" modes.
// 18. Publish global variables.
//
// Language and Acronyms and Idioms
//
// moduleId: a CJS module identifier, (used for public APIs)
// mid: moduleId (used internally)
// packageId: a package identifier (used for public APIs)
// pid: packageId (used internally); the implied system or default package has pid===""
// pack: package is used internally to reference a package object (since javascript has reserved words including "package")
// prid: plugin resource identifier
// The integer constant 1 is used in place of true and 0 in place of false.
//
// The "foreign-loader" has condition is defined if another loader is being used (e.g. webpack) and this code is only
// needed for resolving module identifiers based on the config. In this case, only the functions require.toUrl and
// require.toAbsMid are supported. The require and define functions are not supported.
// define global
var globalObject = (function(){
if (typeof global !== 'undefined' && typeof global !== 'function') {
// global spec defines a reference to the global object called 'global'
// https://github.com/tc39/proposal-global
// `global` is also defined in NodeJS
return global;
}
else if (typeof window !== 'undefined') {
// window is defined in browsers
return window;
}
else if (typeof self !== 'undefined') {
// self is defined in WebWorkers
return self;
}
return this;
})();
// define a minimal library to help build the loader
var noop = function(){
},
isEmpty = function(it){
for(var p in it){
return 0;
}
return 1;
},
toString = {}.toString,
isFunction = function(it){
return toString.call(it) == "[object Function]";
},
isString = function(it){
return toString.call(it) == "[object String]";
},
isArray = function(it){
return toString.call(it) == "[object Array]";
},
forEach = function(vector, callback){
if(vector){
for(var i = 0; i < vector.length;){
callback(vector[i++]);
}
}
},
mix = function(dest, src){
for(var p in src){
dest[p] = src[p];
}
return dest;
},
makeError = function(error, info){
return mix(new Error(error), {src:"dojoLoader", info:info});
},
uidSeed = 1,
uid = function(){
// Returns a unique identifier (within the lifetime of the document) of the form /_d+/.
return "_" + uidSeed++;
},
// FIXME: how to doc window.require() api
// this will be the global require function; define it immediately so we can start hanging things off of it
req = function(
config, //(object, optional) hash of configuration properties
dependencies, //(array of commonjs.moduleId, optional) list of modules to be loaded before applying callback
callback //(function, optional) lambda expression to apply to module values implied by dependencies
){
return contextRequire(config, dependencies, callback, 0, req);
},
// the loader uses the has.js API to control feature inclusion/exclusion; define then use throughout
global = globalObject,
doc = global.document,
element = doc && doc.createElement("DiV"),
has = req.has = function(name){
return isFunction(hasCache[name]) ? (hasCache[name] = hasCache[name](global, doc, element)) : hasCache[name];
},
hasCache = has.cache = defaultConfig.hasCache;
if (isFunction(userConfig)) {
userConfig = userConfig(globalObject);
}
has.add = function(name, test, now, force){
(hasCache[name]===undefined || force) && (hasCache[name] = test);
return now && has(name);
};
0 && 0;
if( false )// removed by dead control flow
{}
0 && 0;
if( false )// removed by dead control flow
{ var baseUrl, arg, rhinoArgs, i; }
0 && 0;
if( false )// removed by dead control flow
{}
// userConfig has tests override defaultConfig has tests; do this after the environment detection because
// the environment detection usually sets some has feature values in the hasCache.
for(var p in userConfig.has){
has.add(p, userConfig.has[p], 0, 1);
}
//
// define the loader data
//
// the loader will use these like symbols if the loader has the traceApi; otherwise
// define magic numbers so that modules can be provided as part of defaultConfig
var requested = 1,
arrived = 2,
nonmodule = 3,
executing = 4,
executed = 5;
if( false )// removed by dead control flow
{}
var legacyMode = 0,
sync = "sync",
xd = "xd",
syncExecStack = [],
dojoRequirePlugin = 0,
checkDojoRequirePlugin = noop,
transformToAmd = noop,
getXhr;
if( false )// removed by dead control flow
{ var XMLHTTP_PROGIDS, progid, i, locationProtocol, locationHost; }else{
req.async = 1;
}
//
// loader eval
//
var eval_ = true ?
// noop eval if there are csp restrictions
function(){} :
// use the function constructor so our eval is scoped close to (but not in) in the global space with minimal pollution
0;
req.eval =
function(text, hint){
return eval_(text + "\r\n//# sourceURL=" + hint);
};
//
// loader micro events API
//
var listenerQueues = {},
error = "error",
signal = req.signal = function(type, args){
var queue = listenerQueues[type];
// notice we run a copy of the queue; this allows listeners to add/remove
// other listeners without affecting this particular signal
forEach(queue && queue.slice(0), function(listener){
listener.apply(null, isArray(args) ? args : [args]);
});
},
on = req.on = function(type, listener){
// notice a queue is not created until a client actually connects
var queue = listenerQueues[type] || (listenerQueues[type] = []);
queue.push(listener);
return {
remove:function(){
for(var i = 0; i<queue.length; i++){
if(queue[i]===listener){
queue.splice(i, 1);
return;
}
}
}
};
};
// configuration machinery; with an optimized/built defaultConfig, all configuration machinery can be discarded
// lexical variables hold key loader data structures to help with minification; these may be completely,
// one-time initialized by defaultConfig for optimized/built versions
var
aliases
// a vector of pairs of [regexs or string, replacement] => (alias, actual)
= [],
paths
// CommonJS paths
= {},
pathsMapProg
// list of (from-path, to-path, regex, length) derived from paths;
// a "program" to apply paths; see computeMapProg
= [],
packs
// a map from packageId to package configuration object; see fixupPackageInfo
= {},
map = req.map
// AMD map config variable; dojo/_base/kernel needs req.map to figure out the scope map
= {},
mapProgs
// vector of quads as described by computeMapProg; map-key is AMD map key, map-value is AMD map value
= [],
modules
// A hash:(mid) --> (module-object) the module namespace
//
// pid: the package identifier to which the module belongs (e.g., "dojo"); "" indicates the system or default package
// mid: the fully-resolved (i.e., mappings have been applied) module identifier without the package identifier (e.g., "dojo/io/script")
// url: the URL from which the module was retrieved
// pack: the package object of the package to which the module belongs
// executed: 0 => not executed; executing => in the process of traversing deps and running factory; executed => factory has been executed
// deps: the dependency vector for this module (vector of modules objects)
// def: the factory for this module
// result: the result of the running the factory for this module
// injected: (0 | requested | arrived) the status of the module; nonmodule means the resource did not call define
// load: plugin load function; applicable only for plugins
//
// Modules go through several phases in creation:
//
// 1. Requested: some other module's definition or a require application contained the requested module in
// its dependency vector or executing code explicitly demands a module via req.require.
//
// 2. Injected: a script element has been appended to the insert-point element demanding the resource implied by the URL
//
// 3. Loaded: the resource injected in [2] has been evaluated.
//
// 4. Defined: the resource contained a define statement that advised the loader about the module. Notice that some
// resources may just contain a bundle of code and never formally define a module via define
//
// 5. Evaluated: the module was defined via define and the loader has evaluated the factory and computed a result.
= {},
cacheBust
// query string to append to module URLs to bust browser cache
= "",
cache
// hash:(mid | url)-->(function | string)
//
// A cache of resources. The resources arrive via a config.cache object, which is a hash from either mid --> function or
// url --> string. The url key is distinguished from the mid key by always containing the prefix "url:". url keys as provided
// by config.cache always have a string value that represents the contents of the resource at the given url. mid keys as provided
// by configl.cache always have a function value that causes the same code to execute as if the module was script injected.
//
// Both kinds of key-value pairs are entered into cache via the function consumePendingCache, which may relocate keys as given
// by any mappings *iff* the config.cache was received as part of a module resource request.
//
// Further, for mid keys, the implied url is computed and the value is entered into that key as well. This allows mapped modules
// to retrieve cached items that may have arrived consequent to another namespace.
//
= {},
urlKeyPrefix
// the prefix to prepend to a URL key in the cache.
= "url:",
pendingCacheInsert
// hash:(mid)-->(function)
//
// Gives a set of cache modules pending entry into cache. When cached modules are published to the loader, they are
// entered into pendingCacheInsert; modules are then pressed into cache upon (1) AMD define or (2) upon receiving another
// independent set of cached modules. (1) is the usual case, and this case allows normalizing mids given in the pending
// cache for the local configuration, possibly relocating modules.
= {},
dojoSniffConfig
// map of configuration variables
// give the data-dojo-config as sniffed from the document (if any)
= {},
insertPointSibling
// the nodes used to locate where scripts are injected into the document
= 0;
if( false )// removed by dead control flow
{ var doh, scripts, i, script, dojoDir, src, match, escapeString, computeMapProg, computeAliases, fixupPackageInfo, delayedModuleConfig, config, consumePendingCacheInsert; }else{
// no config API, assume defaultConfig has everything the loader needs...for the entire lifetime of the application
paths = defaultConfig.paths;
pathsMapProg = defaultConfig.pathsMapProg;
packs = defaultConfig.packs;
aliases = defaultConfig.aliases;
mapProgs = defaultConfig.mapProgs;
modules = defaultConfig.modules;
cache = defaultConfig.cache;
cacheBust = defaultConfig.cacheBust;
// remember the default config for other processes (e.g., dojo/config)
req.rawConfig = defaultConfig;
}
if (false ) // removed by dead control flow
{ var injectDependencies, contextRequire, createRequire, execQ, defQ, waiting, setRequested, setArrived, execComplete, comboPending, combosPending, comboPendingTimer; }
var runMapProg = function(targetMid, map){
// search for targetMid in map; return the map item if found; falsy otherwise
if(map){
for(var i = 0; i < map.length; i++){
if(map[i][2].test(targetMid)){
return map[i];
}
}
}
return 0;
},
compactPath = function(path){
var result = [],
segment, lastSegment;
path = path.replace(/\\/g, '/').split('/');
while(path.length){
segment = path.shift();
if(segment==".." && result.length && lastSegment!=".."){
result.pop();
lastSegment = result[result.length - 1];
}else if(segment!="."){
result.push(lastSegment= segment);
} // else ignore "."
}
return result.join("/");
},
makeModuleInfo = function(pid, mid, pack, url){
if( false )// removed by dead control flow
{ var xd; }else{
return {pid:pid, mid:mid, pack:pack, url:url, executed:0, def:0};
}
},
getModuleInfo_ = function(mid, referenceModule, packs, modules, baseUrl, mapProgs, pathsMapProg, aliases, alwaysCreate, fromPendingCache){
// arguments are passed instead of using lexical variables so that this function my be used independent of the loader (e.g., the builder)
// alwaysCreate is useful in this case so that getModuleInfo never returns references to real modules owned by the loader
var pid, pack, midInPackage, mapItem, url, result, isRelative, requestedMid;
requestedMid = mid;
isRelative = /^\./.test(mid);
if(/(^\/)|(\:)|(\.js$)/.test(mid) || (isRelative && !referenceModule)){
// absolute path or protocol of .js filetype, or relative path but no reference module and therefore relative to page
// whatever it is, it's not a module but just a URL of some sort
// note: pid===0 indicates the routine is returning an unmodified mid
return makeModuleInfo(0, mid, 0, mid);
}else{
// relative module ids are relative to the referenceModule; get rid of any dots
mid = compactPath(isRelative ? (referenceModule.mid + "/../" + mid) : mid);
if(/^\./.test(mid)){
throw makeError("irrationalPath", mid);
}
// at this point, mid is an absolute mid
// map the mid
if(!fromPendingCache && !isRelative && mapProgs.star){
mapItem = runMapProg(mid, mapProgs.star[1]);
}
if(!mapItem && referenceModule){
mapItem = runMapProg(referenceModule.mid, mapProgs);
mapItem = mapItem && runMapProg(mid, mapItem[1]);
}
if(mapItem){
mid = mapItem[1] + mid.substring(mapItem[3]);
}
match = mid.match(/^([^\/]+)(\/(.+))?$/);
pid = match ? match[1] : "";
if((pack = packs[pid])){
mid = pid + "/" + (midInPackage = (match[3] || pack.main));
}else{
pid = "";
}
// search aliases
var candidateLength = 0,
candidate = 0;
forEach(aliases, function(pair){
var match = mid.match(pair[0]);
if(match && match.length>candidateLength){
candidate = isFunction(pair[1]) ? mid.replace(pair[0], pair[1]) : pair[1];
}
});
if(candidate){
return getModuleInfo_(candidate, 0, packs, modules, baseUrl, mapProgs, pathsMapProg, aliases, alwaysCreate);
}
result = modules[mid];
if(result){
return alwaysCreate ? makeModuleInfo(result.pid, result.mid, result.pack, result.url) : modules[mid];
}
}
// get here iff the sought-after module does not yet exist; therefore, we need to compute the URL given the
// fully resolved (i.e., all relative indicators and package mapping resolved) module id
// note: pid!==0 indicates the routine is returning a url that has .js appended unmodified mid
mapItem = runMapProg(mid, pathsMapProg);
if(mapItem){
url = mapItem[1] + mid.substring(mapItem[3]);
}else if(pid){
url = (pack.location.slice(-1) === '/' ? pack.location.slice(0, -1) : pack.location) + "/" + midInPackage;
}else if( false )// removed by dead control flow
{}else{
url = mid;
}
// if result is not absolute, add baseUrl
if(!(/(^\/)|(\:)/.test(url))){
url = baseUrl + url;
}
url += ".js";
return makeModuleInfo(pid, mid, pack, compactPath(url));
},
getModuleInfo = function(mid, referenceModule, fromPendingCache){
return getModuleInfo_(mid, referenceModule, packs, modules, req.baseUrl, mapProgs, pathsMapProg, aliases, undefined, fromPendingCache);
};
if (false ) // removed by dead control flow
{ var resolvePluginResourceId, dynamicPluginUidGenerator, getModule; }
var toAbsMid = req.toAbsMid = function(mid, referenceModule){
return getModuleInfo(mid, referenceModule).mid;
},
toUrl = req.toUrl = function(name, referenceModule){
var moduleInfo = getModuleInfo(name+"/x", referenceModule),
url= moduleInfo.url;
return fixupUrl(moduleInfo.pid===0 ?
// if pid===0, then name had a protocol or absolute path; either way, toUrl is the identify function in such cases
name :
// "/x.js" since getModuleInfo automatically appends ".js" and we appended "/x" to make name look like a module id
url.substring(0, url.length-5)
);
};
if (false ) // removed by dead control flow
{ var nonModuleProps, makeCjs, cjsRequireModule, cjsExportsModule, cjsModuleModule, runFactory, abortExec, defOrder, promoteModuleToPlugin, resolvePluginLoadQ, finishExec, circleTrace, execModule, checkCompleteGuard, guardCheckComplete, checkComplete; }
var fixupUrl= typeof userConfig.fixupUrl == "function" ? userConfig.fixupUrl : function(url){
url += ""; // make sure url is a Javascript string (some paths may be a Java string)
return url + (cacheBust ? ((/\?/.test(url) ? "&" : "?") + cacheBust) : "");
};
if( false )// removed by dead control flow
{}
if( false )// removed by dead control flow
{ var injectPlugin, cached, injectingModule, injectingCachedModule, evalModuleText, injectModule, defineModule, runDefQ; }
var timerId = 0,
clearTimer = noop,
startTimer = noop;
if( false )// removed by dead control flow
{}
if ( false ) // removed by dead control flow
{}
if( false)// removed by dead control flow
{ var scripts, i, script, domOn, windowOnLoadListener; }
if( false )// removed by dead control flow
{}else{
req.log = noop;
}
if( false )// removed by dead control flow
{ var trace; }else{
req.trace = noop;
}
if (false ) // removed by dead control flow
{ var def; } else {
var def = noop;
}
// allow config to override default implementation of named functions; this is useful for
// non-browser environments, e.g., overriding injectUrl, getText, log, etc. in node.js, Rhino, etc.
// also useful for testing and monkey patching loader
mix(mix(req, defaultConfig.loaderPatch), userConfig.loaderPatch);
// now that req is fully initialized and won't change, we can hook it up to the error signal
on(error, function(arg){
try{
console.error(arg);
if(arg instanceof Error){
for(var p in arg){
console.log(p + ":", arg[p]);
}
console.log(".");
}
}catch(e){}
});
// always publish these
mix(req, {
uid:uid,
cache:cache,
packs:packs
});
if( false )// removed by dead control flow
{}
// the loader can be defined exactly once; look for global define which is the symbol AMD loaders are
// *required* to define (as opposed to require, which is optional)
if(global.define){
if( false )// removed by dead control flow
{}
return;
}else{
global.define = def;
global.require = req;
if( false )// removed by dead control flow
{}
}
if( false)// removed by dead control flow
{ var plugins, pluginName; }
if( false )// removed by dead control flow
{ var bootDeps, bootCallback; }
if(false )// removed by dead control flow
{}
})
.call(this, userConfig, defaultConfig);};
/***/ },
/***/ 1996
/*!*********************************************!*\
!*** ../../node_modules/dgrid/ColumnSet.js ***!
\*********************************************/
(module, exports, __webpack_require__) {
var require = __webpack_require__.dj.r;var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
__webpack_require__(/*! dojo/_base/declare */ 6345),
__webpack_require__(/*! dojo/_base/lang */ 6323),
__webpack_require__(/*! dojo/dom-class */ 8945),
__webpack_require__(/*! dojo/dom-construct */ 28),
__webpack_require__(/*! dojo/on */ 2075),
__webpack_require__(/*! dojo/aspect */ 6566),
__webpack_require__(/*! dojo/query */ 1172),
__webpack_require__(/*! dojo/has */ 6356),
__webpack_require__(/*! ./util/misc */ 4975),
__webpack_require__(/*! dojo/_base/sniff */ 3927)
], __WEBPACK_AMD_DEFINE_RESULT__ = (function (declare, lang, domClass, domConstruct, on, aspect, query, has, miscUtil) {
has.add('event-mousewheel', function (global, document, element) {
return 'onmousewheel' in element;
});
has.add('event-wheel', function (global, document, element) {
return 'onwheel' in element;
});
var colsetidAttr = 'data-dgrid-column-set-id';
function adjustScrollLeft(grid, root) {
// Adjusts the scroll position of each column set in each row under the given root.
// (root can be a row, or e.g. a tree parent row element's connected property to adjust children)
var scrollLefts = grid._columnSetScrollLefts;
query('.dgrid-column-set', root).forEach(function (element) {
element.scrollLeft = scrollLefts[element.getAttribute(colsetidAttr)];
});
}
function getColumnSetSubRows(subRows, columnSetId) {
// Builds a subRow collection that only contains columns that correspond to
// a given column set id.
if (!subRows || !subRows.length) {
return;
}
var subset = [];
var idPrefix = columnSetId + '-';
for (var i = 0, numRows = subRows.length; i < numRows; i++) {
var row = subRows[i];
var subsetRow = [];
subsetRow.className = row.className;
for (var k = 0, numCols = row.length; k < numCols; k++) {
var column = row[k];
// The column id begins with the column set id.
if (column.id != null && column.id.indexOf(idPrefix) === 0) {
subsetRow.push(column);
}
}
subset.push(subsetRow);
}
return subset;
}
function isRootNode(node, rootNode) {
// If we've reached the top-level node for the grid then there is no parent column set.
// This guard prevents an error when scroll is initated over some node in the grid that is not a descendant of
// a column set. This can happen in a grid that has empty space below its rows (grid is taller than the rows).
return (rootNode && node === rootNode) || domClass.contains(node, 'dgrid');
}
function findParentColumnSet(node, root) {
// WebKit will invoke mousewheel handlers with an event target of a text
// node; check target and if it's not an element node, start one node higher
// in the tree
if (node.nodeType !== 1) {
node = node.parentNode;
}
while (node && !query.matches(node, '.dgrid-column-set[' + colsetidAttr + ']', root)) {
if (isRootNode(node, root)) {
return null;
}
node = node.parentNode;
}
return node;
}
var pointerMap = (/* unused pure expression or super */ null && ({
start: 'down',
end: 'up'
}));
function getTouchEventName(type) {
// Given 'start', 'move', or 'end', returns appropriate touch or pointer event name
// based on browser support. (Assumes browser supports touch or pointer.)
var hasPointer = has('pointer');
if (hasPointer) {
type = pointerMap[type] || type;
if (hasPointer.slice(0, 2) === 'MS') {
return 'MSPointer' + type.slice(0, 1).toUpperCase() + type.slice(1);
}
else {
return 'pointer' + type;
}
}
return 'touch' + type;
}
var horizTouchMove = false && 0;
var horizMouseWheel = has('event-mousewheel') || has('event-wheel') ? function (grid) {
return function (target, listener) {
return on(target, has('event-wheel') ? 'wheel' : 'mousewheel', function (event) {
var node = findParentColumnSet(event.target, target),
deltaX;
if (!node) {
return;
}
// Normalize reported delta value:
// wheelDeltaX (webkit, mousewheel) needs to be negated and divided by 3
// deltaX (FF17+, wheel) can be used exactly as-is
deltaX = event.deltaX || -event.wheelDeltaX / 3;
if (deltaX) {
// only respond to horizontal movement
listener.call(null, grid, node, deltaX);
}
});
};
} : function (grid) {
return function (target, listener) {
return on(target, '.dgrid-column-set[' + colsetidAttr + ']:MozMousePixelScroll', function (event) {
if (event.axis === 1) {
// only respond to horizontal movement
listener.call(null, grid, this, event.detail);
}
});
};
};
function horizMoveHandler(grid, colsetNode, amount) {
var id = colsetNode.getAttribute(colsetidAttr),
scroller = grid._columnSetScrollers[id],
scrollLeft = scroller.scrollLeft + amount;
scroller.scrollLeft = scrollLeft < 0 ? 0 : scrollLeft;
}
return declare(null, {
// summary:
// Provides column sets to isolate horizontal scroll of sets of
// columns from each other. This mainly serves the purpose of allowing for
// column locking.
constructor: function () {
if ('_editorInstances' in this) {
throw new Error('When used with Editor ColumnSet must be mixed in before Editor.');
}
},
postCreate: function () {
var self = this;
this.inherited(arguments);
this.on(horizMouseWheel(this), horizMoveHandler);
if (false) // removed by dead control flow
{}
this.on('.dgrid-column-set:dgrid-cellfocusin', function (event) {
self._onColumnSetCellFocus(event, this);
});
if (typeof this.expand === 'function') {
this._listeners.push(
aspect.after(this, 'expand', function (promise, args) {
promise.then(function () {
var row = self.row(args[0]);
if (self._expanded[row.id]) {
// scrollLeft changes can't take effect on collapsed child rows;
// ensure they are properly updated once re-expanded.
adjustScrollLeft(self, row.element.connected);
}
});
return promise;
})
);
}
},
columnSets: [],
createRowCells: function (tag, each, subRows, object, options) {
var row = domConstruct.create('table', { className: 'dgrid-row-table' });
var tbody = domConstruct.create('tbody', null, row);
var tr = domConstruct.create('tr', null, tbody);
for (var i = 0, l = this.columnSets.length; i < l; i++) {
// iterate through the columnSets
var cell = domConstruct.create(tag, {
className: 'dgrid-column-set-cell dgrid-column-set-' + i
}, tr);
cell = domConstruct.create('div', {
className: 'dgrid-column-set'
}, cell);
cell.setAttribute(colsetidAttr, i);
var subset = getColumnSetSubRows(subRows || this.subRows, i) || this.columnSets[i];
cell.appendChild(this.inherited(arguments, [tag, each, subset, object, options]));
}
return row;
},
renderArray: function () {
var rows = this.inherited(arguments);
for (var i = 0; i < rows.length; i++) {
adjustScrollLeft(this, rows[i]);
}
return rows;
},
insertRow: function () {
var row = this.inherited(arguments);
adjustScrollLeft(this, row);
return row;
},
renderHeader: function () {
// summary:
// Setup the headers for the grid
this.inherited(arguments);
var columnSets = this.columnSets,
scrollers = this._columnSetScrollers,
grid = this,
i, l;
function reposition() {
grid._positionScrollers();
}
this._columnSetScrollerContents = {};
this._columnSetScrollLefts = {};
if (scrollers) {
// this isn't the first time; destroy existing scroller nodes first
for (i in scrollers) {
domConstruct.destroy(scrollers[i]);
}
} else {
// first-time-only operations: hook up event/aspected handlers
this._listeners.push(
aspect.after(this, 'resize', reposition, true),
aspect.after(this, 'styleColumn', reposition, true)
);
this._columnSetScrollerNode = domConstruct.create('div', {
className: 'dgrid-column-set-scroller-container'
}, this.footerNode, 'after');
}
// reset to new object to be populated in loop below
scrollers = this._columnSetScrollers = {};
for (i = 0, l = columnSets.length; i < l; i++) {
this._putScroller(columnSets[i], i);
}
this._positionScrollers();
},
styleColumnSet: function (colsetId, css) {
// summary:
// Dynamically creates a stylesheet rule to alter a columnset's style.
var rule = this.addCssRule('#' + miscUtil.escapeCssIdentifier(this.domNode.id) +
' .dgrid-column-set-' + miscUtil.escapeCssIdentifier(colsetId, '-'), css);
this._positionScrollers();
return rule;
},
configStructure: function () {
// Squash the column sets together so the grid and other dgrid extensions and mixins can
// configure the columns and create any needed subrows.
this.columns = {};
this.subRows = [];
for (var i = 0, l = this.columnSets.length; i < l; i++) {
var columnSet = this.columnSets[i];
for (var j = 0; j < columnSet.length; j++) {
columnSet[j] = this._configColumns(i + '-' + j + '-', columnSet[j]);
}
}
this.inherited(arguments);
},
_positionScrollers: function () {
var domNode = this.domNode,
scrollers = this._columnSetScrollers,
scrollerContents = this._columnSetScrollerContents,
columnSets = this.columnSets,
scrollerWidth = 0,
numScrollers = 0, // tracks number of visible scrollers (sets w/ overflow)
i, l, columnSetElement, contentWidth;
for (i = 0, l = columnSets.length; i < l; i++) {
// iterate through the columnSets
columnSetElement = query('.dgrid-column-set[' + colsetidAttr + '="' + i + '"]', domNode)[0];
scrollerWidth = columnSetElement.offsetWidth;
contentWidth = columnSetElement.firstChild.offsetWidth;
scrollerContents[i].style.width = contentWidth + 'px';
scrollers[i].style.width = scrollerWidth + 'px';
if (has('ie') < 9) {
// IE seems to need scroll to be set explicitly
scrollers[i].style.overflowX = contentWidth > scrollerWidth ? 'scroll' : 'auto';
}
// Keep track of how many scrollbars we're showing
if (contentWidth > scrollerWidth) {
numScrollers++;
}
}
this._columnSetScrollerNode.style.bottom = this.showFooter ? this.footerNode.offsetHeight + 'px' : '0';
// Align bottom of body node depending on whether there are scrollbars
this.bodyNode.style.bottom = numScrollers ?
(has('dom-scrollbar-height') + (has('ie') ? 1 : 0) + 'px') :
'0';
},
_putScroller: function (columnSet, i) {
// function called for each columnSet
var scroller = this._columnSetScrollers[i] = domConstruct.create('span', {
// IE8 needs dgrid-scrollbar-height class for scrollbar to be visible,
// but for some reason IE11's scrollbar arrows become unresponsive, so avoid applying it there
className: 'dgrid-column-set-scroller dgrid-column-set-scroller-' + i +
(has('ie') < 9 ? ' dgrid-scrollbar-height' : '')
}, this._columnSetScrollerNode);
scroller.setAttribute(colsetidAttr, i);
this._columnSetScrollerContents[i] = domConstruct.create('div', {
className: 'dgrid-column-set-scroller-content'
}, scroller);
on(scroller, 'scroll', lang.hitch(this, '_onColumnSetScroll'));
},
_onColumnSetScroll: function (evt) {
var scrollLeft = evt.target.scrollLeft,
colSetId = evt.target.getAttribute(colsetidAttr),
newScrollLeft;
if (this._columnSetScrollLefts[colSetId] !== scrollLeft) {
query('.dgrid-column-set[' + colsetidAttr + '="' + colSetId +
'"],.dgrid-column-set-scroller[' + colsetidAttr + '="' + colSetId + '"]', this.domNode
).forEach(function (element, i) {
element.scrollLeft = scrollLeft;
if (!i) {
// Compute newScrollLeft based on actual resulting
// value of scrollLeft, which may be different than
// what we assigned under certain circumstances
// (e.g. Chrome under 33% / 67% / 90% zoom).
// Only need to compute this once, as it will be the
// same for every row.
newScrollLeft = element.scrollLeft;
}
});
this._columnSetScrollLefts[colSetId] = newScrollLeft;
}
},
_setColumnSets: function (columnSets) {
this._destroyColumns();
this.columnSets = columnSets;
this._updateColumns();
},
_scrollColumnSet: function (nodeOrId, offsetLeft) {
var id = nodeOrId.tagName ? nodeOrId.getAttribute(colsetidAttr) : nodeOrId;
var scroller = this._columnSetScrollers[id];
scroller.scrollLeft = offsetLeft < 0 ? 0 : offsetLeft;
},
_onColumnSetCellFocus: function (event, columnSetNode) {
var focusedNode = event.target;
var columnSetId = columnSetNode.getAttribute(colsetidAttr);
// columnSetNode's offsetLeft is not always correct,
// so get the columnScroller to check offsetLeft against
var columnScroller = this._columnSetScrollers[columnSetId];
var elementEdge = focusedNode.offsetLeft - columnScroller.scrollLeft + focusedNode.offsetWidth;
if (elementEdge > columnSetNode.offsetWidth ||
columnScroller.scrollLeft > focusedNode.offsetLeft) {
this._scrollColumnSet(columnSetNode, focusedNode.offsetLeft);
}
}
});
}).apply(null, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
/***/ },
/***/ 1540
/*!****************************************!*\
!*** ../../node_modules/dgrid/Grid.js ***!
\****************************************/
(module, exports, __webpack_require__) {
var require = __webpack_require__.dj.r;var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
__webpack_require__(/*! dojo/_base/declare */ 6345),
__webpack_require__(/*! dojo/_base/lang */ 6323),
__webpack_require__(/*! dojo/dom-construct */ 28),
__webpack_require__(/*! dojo/dom-class */ 8945),
__webpack_require__(/*! dojo/on */ 2075),
__webpack_require__(/*! dojo/has */ 6356),
__webpack_require__(/*! ./List */ 4624),
__webpack_require__(/*! ./util/misc */ 4975),
__webpack_require__(/*! dojo/_base/sniff */ 3927)
], __WEBPACK_AMD_DEFINE_RESULT__ = (function (declare, lang, domConstruct, domClass, listen, has, List, miscUtil) {
function appendIfNode(parent, subNode) {
if (subNode && subNode.nodeType) {
parent.appendChild(subNode);
}
}
function replaceInvalidChars(str) {
// Replaces invalid characters for a CSS identifier with hyphen,
// as dgrid does for field names / column IDs when adding classes.
return miscUtil.escapeCssIdentifier(str, '-');
}
var Grid = declare(List, {
columns: null,
// hasNeutralSort: Boolean
// Determines behavior of toggling sort on the same column.
// If false, sort toggles between ascending and descending and cannot be
// reset to neutral without sorting another column.
// If true, sort toggles between ascending, descending, and neutral.
hasNeutralSort: false,
// cellNavigation: Boolean
// This indicates that focus is at the cell level. This may be set to false to cause
// focus to be at the row level, which is useful if you want only want row-level
// navigation.
cellNavigation: true,
tabableHeader: true,
showHeader: true,
column: function (target) {
// summary:
// Get the column object by node, or event, or a columnId
if (typeof target !== 'object') {
return this.columns[target];
}
else {
return this.cell(target).column;
}
},
listType: 'grid',
cell: function (target, columnId) {
// summary:
// Get the cell object by node, or event, id, plus a columnId
if (target.column && target.element) {
return target;
}
if (target.target && target.target.nodeType) {
// event
target = target.target;
}
var element;
if (target.nodeType) {
do {
if (this._rowIdToObject[target.id]) {
break;
}
var colId = target.columnId;
if (colId) {
columnId = colId;
element = target;
break;
}
target = target.parentNode;
} while (target && target !== this.domNode);
}
if (!element && typeof columnId !== 'undefined') {
var row = this.row(target),
rowElement = row && row.element;
if (rowElement) {
var elements = rowElement.getElementsByTagName('td');
for (var i = 0; i < elements.length; i++) {
if (elements[i].columnId === columnId) {
element = elements[i];
break;
}
}
}
}
if (target != null) {
return {
row: row || this.row(target),
column: columnId && this.column(columnId),
element: element
};
}
},
createRowCells: function (tag, createCell, subRows, item, options) {
// summary:
// Generates the grid for each row (used by renderHeader and and renderRow)
var row = domConstruct.create('table', {
className: 'dgrid-row-table',
role: 'presentation'
}),
// IE < 9 needs an explicit tbody; other browsers do not
tbody = (has('ie') < 9) ? domConstruct.create('tbody', null, row) : row,
tr,
si, sl, i, l, // iterators
subRow, column, id, extraClasses, className,
cell, colSpan, rowSpan; // used inside loops
// Allow specification of custom/specific subRows, falling back to
// those defined on the instance.
subRows = subRows || this.subRows;
for (si = 0, sl = subRows.length; si < sl; si++) {
subRow = subRows[si];
// for single-subrow cases in modern browsers, TR can be skipped
// http://jsperf.com/table-without-trs
tr = domConstruct.create('tr', null, tbody);
if (subRow.className) {
tr.className = subRow.className;
}
for (i = 0, l = subRow.length; i < l; i++) {
// iterate through the columns
column = subRow[i];
id = column.id;
extraClasses = column.field ?
' field-' + replaceInvalidChars(column.field) :
'';
className = typeof column.className === 'function' ?
column.className(item) : column.className;
if (className) {
extraClasses += ' ' + className;
}
cell = domConstruct.create(tag, {
className: 'dgrid-cell' +
(id ? ' dgrid-column-' + replaceInvalidChars(id) : '') + extraClasses,
role: tag === 'th' ? 'columnheader' : 'gridcell'
});
cell.columnId = id;
colSpan = column.colSpan;
if (colSpan) {
cell.colSpan = colSpan;
}
rowSpan = column.rowSpan;
if (rowSpan) {
cell.rowSpan = rowSpan;
}
createCell(cell, column, item, options);
// add the td to the tr at the end for better performance
tr.appendChild(cell);
}
}
return row;
},
_createBodyRowCell: function (cellElement, column, item, options) {
var cellData = item;
// Support get function or field property (similar to DataGrid)
if (column.get) {
cellData = column.get(item);
}
else if ('field' in column && column.field !== '_item') {
cellData = item[column.field];
}
if (column.renderCell) {
// A column can provide a renderCell method to do its own DOM manipulation,
// event handling, etc.
appendIfNode(cellElement, column.renderCell(item, cellData, cellElement, options));
}
else {
this._defaultRenderCell.call(column, item, cellData, cellElement, options);
}
},
_createHeaderRowCell: function (cellElement, column) {
var contentNode = column.headerNode = cellElement;
var field = column.field;
if (field) {
cellElement.field = field;
}
// allow for custom header content manipulation
if (column.renderHeaderCell) {
appendIfNode(contentNode, column.renderHeaderCell(contentNode));
}
else if ('label' in column || column.field) {
contentNode.appendChild(document.createTextNode(
'label' in column ? column.label : column.field));
}
if (column.sortable !== false && field && field !== '_item') {
cellElement.sortable = true;
cellElement.className += ' dgrid-sortable';
}
},
left: function (cell, steps) {
if (!cell.element) {
cell = this.cell(cell);
}
return this.cell(this._move(cell, -(steps || 1), 'dgrid-cell'));
},
right: function (cell, steps) {
if (!cell.element) {
cell = this.cell(cell);
}
return this.cell(this._move(cell, steps || 1, 'dgrid-cell'));
},
_defaultRenderCell: function (object, value, td) {
// summary:
// Default renderCell implementation.
// NOTE: Called in context of column definition object.
// object: Object
// The data item for the row currently being rendered
// value: Mixed
// The value of the field applicable to the current cell
// td: DOMNode
// The cell element representing the current item/field
// options: Object?
// Any additional options passed through from renderRow
if (this.formatter) {
// Support formatter, with or without formatterScope
var formatter = this.formatter,
formatterScope = this.grid.formatterScope;
var formattedValue = typeof formatter === 'string' && formatterScope ?
formatterScope[formatter](value, object) : this.formatter(value, object);
if (formattedValue != null && formattedValue.hasOwnProperty('html')) {
td.innerHTML = formattedValue.html;
} else if (formattedValue != null) {
td.appendChild(document.createTextNode(formattedValue));
}
}
else if (value != null) {
td.appendChild(document.createTextNode(value));
}
},
renderRow: function (item, options) {
var row = this.createRowCells('td', lang.hitch(this, '_createBodyRowCell'),
options && options.subRows, item, options);
// row gets a wrapper div for a couple reasons:
// 1. So that one can set a fixed height on rows (heights can't be set on <table>'s AFAICT)
// 2. So that outline style can be set on a row when it is focused,
// and Safari's outline style is broken on <table>
var div = domConstruct.create('div', { role: 'row' });
div.appendChild(row);
return div;
},
renderHeader: function () {
// summary:
// Setup the headers for the grid
var grid = this,
headerNode = this.headerNode;
headerNode.setAttribute('role', 'row');
// clear out existing header in case we're resetting
domConstruct.empty(headerNode);
var row = this.createRowCells('th', lang.hitch(this, '_createHeaderRowCell'),
this.subRows && this.subRows.headerRows);
this._rowIdToObject[row.id = this.id + '-header'] = this.columns;
headerNode.appendChild(row);
// If the columns are sortable, re-sort on clicks.
// Use a separate listener property to be managed by renderHeader in case
// of subsequent calls.
if (this._sortListener) {
this._sortListener.remove();
}
this._sortListener = listen(row, 'click,keydown', function (event) {
// respond to click, space keypress, or enter keypress
if (event.type === 'click' || event.keyCode === 32 ||
(!has('opera') && event.keyCode === 13)) {
var target = event.target;
var field;
var sort;
var newSort;
var eventObj;
do {
if (target.sortable) {
field = target.field || target.columnId;
sort = grid.sort[0];
if (!grid.hasNeutralSort || !sort || sort.property !== field || !sort.descending) {
// If the user toggled the same column as the active sort,
// reverse sort direction
newSort = [{
property: field,
descending: sort && sort.property === field &&
!sort.descending
}];
}
else {
// If the grid allows neutral sort and user toggled an already-descending column,
// clear sort entirely
newSort = [];
}
// Emit an event with the new sort
eventObj = {
bubbles: true,
cancelable: true,
grid: grid,
parentType: event.type,
sort: newSort
};
if (listen.emit(event.target, 'dgrid-sort', eventObj)) {
// Stash node subject to DOM manipulations,
// to be referenced then removed by sort()
grid._sortNode = target;
grid.set('sort', newSort);
}
break;
}
} while ((target = target.parentNode) && target !== headerNode);
}
});
},
resize: function () {
// extension of List.resize to allow accounting for
// column sizes larger than actual grid area
var headerTableNode = this.headerNode.firstChild,
contentNode = this.contentNode,
width;
this.inherited(arguments);
// Force contentNode width to match up with header width.
contentNode.style.width = ''; // reset first
if (contentNode && headerTableNode) {
if ((width = headerTableNode.offsetWidth) > contentNode.offsetWidth) {
// update size of content node if necessary (to match size of rows)
// (if headerTableNode can't be found, there isn't much we can do)
contentNode.style.width = width + 'px';
}
}
},
destroy: function () {
// Run _destroyColumns first to perform any column plugin tear-down logic.
this._destroyColumns();
if (this._sortListener) {
this._sortListener.remove();
}
this.inherited(arguments);
},
_setSort: function () {
// summary:
// Extension of List.js sort to update sort arrow in UI
// Normalize sort first via inherited logic, then update the sort arrow
this.inherited(arguments);
this.updateSortArrow(this.sort);
},
_findSortArrowParent: function (field) {
// summary:
// Method responsible for finding cell that sort arrow should be
// added under. Called by updateSortArrow; separated for extensibility.
var columns = this.columns;
for (var i in columns) {
var column = columns[i];
if (column.field === field) {
return column.headerNode;
}
}
},
updateSortArrow: function (sort, updateSort) {
// summary:
// Method responsible for updating the placement of the arrow in the
// appropriate header cell. Typically this should not be called (call
// set("sort", ...) when actually updating sort programmatically), but
// this method may be used by code which is customizing sort (e.g.
// by reacting to the dgrid-sort event, canceling it, then
// performing logic and calling this manually).
// sort: Array
// Standard sort parameter - array of object(s) containing property name
// and optional descending flag
// updateSort: Boolean?
// If true, will update this.sort based on the passed sort array
// (i.e. to keep it in sync when custom logic is otherwise preventing
// it from being updated); defaults to false
// Clean up UI from any previous sort
if (this._lastSortedArrow) {
// Remove the sort classes from the parent node
if (this._lastSortedArrow.parentNode) {
domClass.remove(this._lastSortedArrow.parentNode, 'dgrid-sort-up dgrid-sort-down');
}
// Destroy the lastSortedArrow node
domConstruct.destroy(this._lastSortedArrow);
delete this._lastSortedArrow;
}
if (updateSort) {
this.sort = sort;
}
if (!sort[0]) {
return; // Nothing to do if no sort is specified
}