@hpcc-js/dgrid-shim
Version:
1,434 lines (1,316 loc) • 1.07 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__ = ({
/***/ 28:
/*!************************************************!*\
!*** ../../node_modules/dojo/dom-construct.js ***!
\************************************************/
/***/ ((module, exports, __webpack_require__) => {
var require = __webpack_require__.dj.r;var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports, __webpack_require__(/*! ./_base/kernel */ 1054), __webpack_require__(/*! ./sniff */ 2616), __webpack_require__(/*! ./_base/window */ 5075), __webpack_require__(/*! ./dom */ 2284), __webpack_require__(/*! ./dom-attr */ 7878)], __WEBPACK_AMD_DEFINE_RESULT__ = (function(exports, dojo, has, win, dom, attr){
// module:
// dojo/dom-construct
// summary:
// This module defines the core dojo DOM construction API.
// TODOC: summary not showing up in output, see https://github.com/csnover/js-doc-parse/issues/42
// support stuff for toDom()
var tagWrap = {
option: ["select"],
tbody: ["table"],
thead: ["table"],
tfoot: ["table"],
tr: ["table", "tbody"],
td: ["table", "tbody", "tr"],
th: ["table", "thead", "tr"],
legend: ["fieldset"],
caption: ["table"],
colgroup: ["table"],
col: ["table", "colgroup"],
li: ["ul"]
},
reTag = /<\s*([\w\:]+)/,
masterNode = {}, masterNum = 0,
masterName = "__" + dojo._scopeName + "ToDomId";
// generate start/end tag strings to use
// for the injection for each special tag wrap case.
for(var param in tagWrap){
if(tagWrap.hasOwnProperty(param)){
var tw = tagWrap[param];
tw.pre = param == "option" ? '<select multiple="multiple">' : "<" + tw.join("><") + ">";
tw.post = "</" + tw.reverse().join("></") + ">";
// the last line is destructive: it reverses the array,
// but we don't care at this point
}
}
var html5domfix;
if(has("ie") <= 8){
html5domfix = function(doc){
doc.__dojo_html5_tested = "yes";
var div = create('div', {innerHTML: "<nav>a</nav>", style: {visibility: "hidden"}}, doc.body);
if(div.childNodes.length !== 1){
('abbr article aside audio canvas details figcaption figure footer header ' +
'hgroup mark meter nav output progress section summary time video').replace(
/\b\w+\b/g, function(n){
doc.createElement(n);
}
);
}
destroy(div);
}
}
function _insertBefore(/*DomNode*/ node, /*DomNode*/ ref){
var parent = ref.parentNode;
if(parent){
parent.insertBefore(node, ref);
}
}
function _insertAfter(/*DomNode*/ node, /*DomNode*/ ref){
// summary:
// Try to insert node after ref
var parent = ref.parentNode;
if(parent){
if(parent.lastChild == ref){
parent.appendChild(node);
}else{
parent.insertBefore(node, ref.nextSibling);
}
}
}
exports.toDom = function toDom(frag, doc){
// summary:
// instantiates an HTML fragment returning the corresponding DOM.
// frag: String
// the HTML fragment
// doc: DocumentNode?
// optional document to use when creating DOM nodes, defaults to
// dojo/_base/window.doc if not specified.
// returns:
// Document fragment, unless it's a single node in which case it returns the node itself
// example:
// Create a table row:
// | require(["dojo/dom-construct"], function(domConstruct){
// | var tr = domConstruct.toDom("<tr><td>First!</td></tr>");
// | });
doc = doc || win.doc;
var masterId = doc[masterName];
if(!masterId){
doc[masterName] = masterId = ++masterNum + "";
masterNode[masterId] = doc.createElement("div");
}
if(has("ie") <= 8){
if(!doc.__dojo_html5_tested && doc.body){
html5domfix(doc);
}
}
// make sure the frag is a string.
frag += "";
// find the starting tag, and get node wrapper
var match = frag.match(reTag),
tag = match ? match[1].toLowerCase() : "",
master = masterNode[masterId],
wrap, i, fc, df;
if(match && tagWrap[tag]){
wrap = tagWrap[tag];
master.innerHTML = wrap.pre + frag + wrap.post;
for(i = wrap.length; i; --i){
master = master.firstChild;
}
}else{
master.innerHTML = frag;
}
// one node shortcut => return the node itself
if(master.childNodes.length == 1){
return master.removeChild(master.firstChild); // DOMNode
}
// return multiple nodes as a document fragment
df = doc.createDocumentFragment();
while((fc = master.firstChild)){ // intentional assignment
df.appendChild(fc);
}
return df; // DocumentFragment
};
exports.place = function place(node, refNode, position){
// summary:
// Attempt to insert node into the DOM, choosing from various positioning options.
// Returns the first argument resolved to a DOM node.
// node: DOMNode|DocumentFragment|String
// id or node reference, or HTML fragment starting with "<" to place relative to refNode
// refNode: DOMNode|String
// id or node reference to use as basis for placement
// position: String|Number?
// string noting the position of node relative to refNode or a
// number indicating the location in the childNodes collection of refNode.
// Accepted string values are:
//
// - before
// - after
// - replace
// - only
// - first
// - last
//
// "first" and "last" indicate positions as children of refNode, "replace" replaces refNode,
// "only" replaces all children. position defaults to "last" if not specified
// returns: DOMNode
// Returned values is the first argument resolved to a DOM node.
//
// .place() is also a method of `dojo/NodeList`, allowing `dojo/query` node lookups.
// example:
// Place a node by string id as the last child of another node by string id:
// | require(["dojo/dom-construct"], function(domConstruct){
// | domConstruct.place("someNode", "anotherNode");
// | });
// example:
// Place a node by string id before another node by string id
// | require(["dojo/dom-construct"], function(domConstruct){
// | domConstruct.place("someNode", "anotherNode", "before");
// | });
// example:
// Create a Node, and place it in the body element (last child):
// | require(["dojo/dom-construct", "dojo/_base/window"
// | ], function(domConstruct, win){
// | domConstruct.place("<div></div>", win.body());
// | });
// example:
// Put a new LI as the first child of a list by id:
// | require(["dojo/dom-construct"], function(domConstruct){
// | domConstruct.place("<li></li>", "someUl", "first");
// | });
refNode = dom.byId(refNode);
if(typeof node == "string"){ // inline'd type check
node = /^\s*</.test(node) ? exports.toDom(node, refNode.ownerDocument) : dom.byId(node);
}
if(typeof position == "number"){ // inline'd type check
var cn = refNode.childNodes;
if(!cn.length || cn.length <= position){
refNode.appendChild(node);
}else{
_insertBefore(node, cn[position < 0 ? 0 : position]);
}
}else{
switch(position){
case "before":
_insertBefore(node, refNode);
break;
case "after":
_insertAfter(node, refNode);
break;
case "replace":
refNode.parentNode.replaceChild(node, refNode);
break;
case "only":
exports.empty(refNode);
refNode.appendChild(node);
break;
case "first":
if(refNode.firstChild){
_insertBefore(node, refNode.firstChild);
break;
}
// else fallthrough...
default: // aka: last
refNode.appendChild(node);
}
}
return node; // DomNode
};
var create = exports.create = function create(/*DOMNode|String*/ tag, /*Object*/ attrs, /*DOMNode|String?*/ refNode, /*String?*/ pos){
// summary:
// Create an element, allowing for optional attribute decoration
// and placement.
// description:
// A DOM Element creation function. A shorthand method for creating a node or
// a fragment, and allowing for a convenient optional attribute setting step,
// as well as an optional DOM placement reference.
//
// Attributes are set by passing the optional object through `dojo/dom-attr.set`.
// See `dojo/dom-attr.set` for noted caveats and nuances, and API if applicable.
//
// Placement is done via `dojo/dom-construct.place`, assuming the new node to be
// the action node, passing along the optional reference node and position.
// tag: DOMNode|String
// A string of the element to create (eg: "div", "a", "p", "li", "script", "br"),
// or an existing DOM node to process.
// attrs: Object
// An object-hash of attributes to set on the newly created node.
// Can be null, if you don't want to set any attributes/styles.
// See: `dojo/dom-attr.set` for a description of available attributes.
// refNode: DOMNode|String?
// Optional reference node. Used by `dojo/dom-construct.place` to place the newly created
// node somewhere in the dom relative to refNode. Can be a DomNode reference
// or String ID of a node.
// pos: String?
// Optional positional reference. Defaults to "last" by way of `dojo/domConstruct.place`,
// though can be set to "first","after","before","last", "replace" or "only"
// to further control the placement of the new node relative to the refNode.
// 'refNode' is required if a 'pos' is specified.
// example:
// Create a DIV:
// | require(["dojo/dom-construct"], function(domConstruct){
// | var n = domConstruct.create("div");
// | });
//
// example:
// Create a DIV with content:
// | require(["dojo/dom-construct"], function(domConstruct){
// | var n = domConstruct.create("div", { innerHTML:"<p>hi</p>" });
// | });
//
// example:
// Place a new DIV in the BODY, with no attributes set
// | require(["dojo/dom-construct", "dojo/_base/window"], function(domConstruct, win){
// | var n = domConstruct.create("div", null, win.body());
// | });
//
// example:
// Create an UL, and populate it with LI's. Place the list as the first-child of a
// node with id="someId":
// | require(["dojo/dom-construct", "dojo/_base/array"],
// | function(domConstruct, arrayUtil){
// | var ul = domConstruct.create("ul", null, "someId", "first");
// | var items = ["one", "two", "three", "four"];
// | arrayUtil.forEach(items, function(data){
// | domConstruct.create("li", { innerHTML: data }, ul);
// | });
// | });
//
// example:
// Create an anchor, with an href. Place in BODY:
// | require(["dojo/dom-construct", "dojo/_base/window"], function(domConstruct, win){
// | domConstruct.create("a", { href:"foo.html", title:"Goto FOO!" }, win.body());
// | });
var doc = win.doc;
if(refNode){
refNode = dom.byId(refNode);
doc = refNode.ownerDocument;
}
if(typeof tag == "string"){ // inline'd type check
tag = doc.createElement(tag);
}
if(attrs){ attr.set(tag, attrs); }
if(refNode){ exports.place(tag, refNode, pos); }
return tag; // DomNode
};
function _empty(/*DomNode*/ node){
// TODO: remove this if() block in 2.0 when we no longer have to worry about IE memory leaks,
// and then uncomment the emptyGrandchildren() test case from html.html.
// Note that besides fixing #16957, using removeChild() is actually faster than setting node.innerHTML,
// see http://jsperf.com/clear-dom-node.
if("innerHTML" in node){
try{
// fast path
node.innerHTML = "";
return;
}catch(e){
// innerHTML is readOnly (e.g. TABLE (sub)elements in quirks mode)
// Fall through (saves bytes)
}
}
// SVG/strict elements don't support innerHTML
for(var c; c = node.lastChild;){ // intentional assignment
node.removeChild(c);
}
}
exports.empty = function empty(/*DOMNode|String*/ node){
// summary:
// safely removes all children of the node.
// node: DOMNode|String
// a reference to a DOM node or an id.
// example:
// Destroy node's children byId:
// | require(["dojo/dom-construct"], function(domConstruct){
// | domConstruct.empty("someId");
// | });
_empty(dom.byId(node));
};
function _destroy(/*DomNode*/ node, /*DomNode*/ parent){
// in IE quirks, node.canHaveChildren can be false but firstChild can be non-null (OBJECT/APPLET)
if(node.firstChild){
_empty(node);
}
if(parent){
// removeNode(false) doesn't leak in IE 6+, but removeChild() and removeNode(true) are known to leak under IE 8- while 9+ is TBD.
// In IE quirks mode, PARAM nodes as children of OBJECT/APPLET nodes have a removeNode method that does nothing and
// the parent node has canHaveChildren=false even though removeChild correctly removes the PARAM children.
// In IE, SVG/strict nodes don't have a removeNode method nor a canHaveChildren boolean.
has("ie") && parent.canHaveChildren && "removeNode" in node ? node.removeNode(false) : parent.removeChild(node);
}
}
var destroy = exports.destroy = function destroy(/*DOMNode|String*/ node){
// summary:
// Removes a node from its parent, clobbering it and all of its
// children.
//
// description:
// Removes a node from its parent, clobbering it and all of its
// children. Function only works with DomNodes, and returns nothing.
//
// node: DOMNode|String
// A String ID or DomNode reference of the element to be destroyed
//
// example:
// Destroy a node byId:
// | require(["dojo/dom-construct"], function(domConstruct){
// | domConstruct.destroy("someId");
// | });
node = dom.byId(node);
if(!node){ return; }
_destroy(node, node.parentNode);
};
}).apply(null, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
/***/ }),
/***/ 225:
/*!********************************************!*\
!*** ../../node_modules/dojo/_base/xhr.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__(/*! ./kernel */ 1054),
__webpack_require__(/*! ./sniff */ 3927),
__webpack_require__.dj.c(module),
__webpack_require__(/*! ../io-query */ 6587),
/*===== "./declare", =====*/
__webpack_require__(/*! ../dom */ 2284),
__webpack_require__(/*! ../dom-form */ 3159),
__webpack_require__(/*! ./Deferred */ 280),
__webpack_require__(/*! ./config */ 7361),
__webpack_require__(/*! ./json */ 4861),
__webpack_require__(/*! ./lang */ 6323),
__webpack_require__(/*! ./array */ 6974),
__webpack_require__(/*! ../on */ 2075),
__webpack_require__(/*! ../aspect */ 6566),
__webpack_require__(/*! ../request/watch */ 3621),
__webpack_require__(/*! ../request/xhr */ 9648),
__webpack_require__(/*! ../request/util */ 5540)
], __WEBPACK_AMD_DEFINE_RESULT__ = (function(dojo, has, require, ioq, /*===== declare, =====*/ dom, domForm, Deferred, config, json, lang, array, on, aspect, watch, _xhr, util){
// module:
// dojo/_base/xhr
/*=====
dojo._xhrObj = function(){
// summary:
// does the work of portably generating a new XMLHTTPRequest object.
};
=====*/
dojo._xhrObj = _xhr._create;
var cfg = dojo.config;
// mix in io-query and dom-form
dojo.objectToQuery = ioq.objectToQuery;
dojo.queryToObject = ioq.queryToObject;
dojo.fieldToObject = domForm.fieldToObject;
dojo.formToObject = domForm.toObject;
dojo.formToQuery = domForm.toQuery;
dojo.formToJson = domForm.toJson;
// need to block async callbacks from snatching this thread as the result
// of an async callback might call another sync XHR, this hangs khtml forever
// must checked by watchInFlight()
dojo._blockAsync = false;
// MOW: remove dojo._contentHandlers alias in 2.0
var handlers = dojo._contentHandlers = dojo.contentHandlers = {
// summary:
// A map of available XHR transport handle types. Name matches the
// `handleAs` attribute passed to XHR calls.
// description:
// A map of available XHR transport handle types. Name matches the
// `handleAs` attribute passed to XHR calls. Each contentHandler is
// called, passing the xhr object for manipulation. The return value
// from the contentHandler will be passed to the `load` or `handle`
// functions defined in the original xhr call.
// example:
// Creating a custom content-handler:
// | xhr.contentHandlers.makeCaps = function(xhr){
// | return xhr.responseText.toUpperCase();
// | }
// | // and later:
// | dojo.xhrGet({
// | url:"foo.txt",
// | handleAs:"makeCaps",
// | load: function(data){ /* data is a toUpper version of foo.txt */ }
// | });
"text": function(xhr){
// summary:
// A contentHandler which simply returns the plaintext response data
return xhr.responseText;
},
"json": function(xhr){
// summary:
// A contentHandler which returns a JavaScript object created from the response data
return json.fromJson(xhr.responseText || null);
},
"json-comment-filtered": function(xhr){
// summary:
// A contentHandler which expects comment-filtered JSON.
// description:
// A contentHandler which expects comment-filtered JSON.
// the json-comment-filtered option was implemented to prevent
// "JavaScript Hijacking", but it is less secure than standard JSON. Use
// standard JSON instead. JSON prefixing can be used to subvert hijacking.
//
// Will throw a notice suggesting to use application/json mimetype, as
// json-commenting can introduce security issues. To decrease the chances of hijacking,
// use the standard `json` contentHandler, and prefix your "JSON" with: {}&&
//
// use djConfig.useCommentedJson = true to turn off the notice
if(!config.useCommentedJson){
console.warn("Consider using the standard mimetype:application/json."
+ " json-commenting can introduce security issues. To"
+ " decrease the chances of hijacking, use the standard the 'json' handler and"
+ " prefix your json with: {}&&\n"
+ "Use djConfig.useCommentedJson=true to turn off this message.");
}
var value = xhr.responseText;
var cStartIdx = value.indexOf("\/*");
var cEndIdx = value.lastIndexOf("*\/");
if(cStartIdx == -1 || cEndIdx == -1){
throw new Error("JSON was not comment filtered");
}
return json.fromJson(value.substring(cStartIdx+2, cEndIdx));
},
"javascript": function(xhr){
// summary:
// A contentHandler which evaluates the response data, expecting it to be valid JavaScript
// FIXME: try Moz and IE specific eval variants?
return dojo.eval(xhr.responseText);
},
"xml": function(xhr){
// summary:
// A contentHandler returning an XML Document parsed from the response data
var result = xhr.responseXML;
if(result && has("dom-qsa2.1") && !result.querySelectorAll && has("dom-parser")){
// http://bugs.dojotoolkit.org/ticket/15631
// IE9 supports a CSS3 querySelectorAll implementation, but the DOM implementation
// returned by IE9 xhr.responseXML does not. Manually create the XML DOM to gain
// the fuller-featured implementation and avoid bugs caused by the inconsistency
result = new DOMParser().parseFromString(xhr.responseText, "application/xml");
}
if(has("ie")){
if((!result || !result.documentElement)){
//WARNING: this branch used by the xml handling in dojo.io.iframe,
//so be sure to test dojo.io.iframe if making changes below.
var ms = function(n){ return "MSXML" + n + ".DOMDocument"; };
var dp = ["Microsoft.XMLDOM", ms(6), ms(4), ms(3), ms(2)];
array.some(dp, function(p){
try{
var dom = new ActiveXObject(p);
dom.async = false;
dom.loadXML(xhr.responseText);
result = dom;
}catch(e){ return false; }
return true;
});
}
}
return result; // DOMDocument
},
"json-comment-optional": function(xhr){
// summary:
// A contentHandler which checks the presence of comment-filtered JSON and
// alternates between the `json` and `json-comment-filtered` contentHandlers.
if(xhr.responseText && /^[^{\[]*\/\*/.test(xhr.responseText)){
return handlers["json-comment-filtered"](xhr);
}else{
return handlers["json"](xhr);
}
}
};
/*=====
// kwargs function parameter definitions. Assigning to dojo namespace rather than making them local variables
// because they are used by dojo/io modules too
dojo.__IoArgs = declare(null, {
// url: String
// URL to server endpoint.
// content: Object?
// Contains properties with string values. These
// properties will be serialized as name1=value2 and
// passed in the request.
// timeout: Integer?
// Milliseconds to wait for the response. If this time
// passes, the then error callbacks are called.
// form: DOMNode?
// DOM node for a form. Used to extract the form values
// and send to the server.
// preventCache: Boolean?
// Default is false. If true, then a
// "dojo.preventCache" parameter is sent in the request
// with a value that changes with each request
// (timestamp). Useful only with GET-type requests.
// handleAs: String?
// Acceptable values depend on the type of IO
// transport (see specific IO calls for more information).
// rawBody: String?
// Sets the raw body for an HTTP request. If this is used, then the content
// property is ignored. This is mostly useful for HTTP methods that have
// a body to their requests, like PUT or POST. This property can be used instead
// of postData and putData for dojo/_base/xhr.rawXhrPost and dojo/_base/xhr.rawXhrPut respectively.
// ioPublish: Boolean?
// Set this explicitly to false to prevent publishing of topics related to
// IO operations. Otherwise, if djConfig.ioPublish is set to true, topics
// will be published via dojo/topic.publish() for different phases of an IO operation.
// See dojo/main.__IoPublish for a list of topics that are published.
load: function(response, ioArgs){
// summary:
// This function will be
// called on a successful HTTP response code.
// ioArgs: dojo/main.__IoCallbackArgs
// Provides additional information about the request.
// response: Object
// The response in the format as defined with handleAs.
},
error: function(response, ioArgs){
// summary:
// This function will
// be called when the request fails due to a network or server error, the url
// is invalid, etc. It will also be called if the load or handle callback throws an
// exception, unless djConfig.debugAtAllCosts is true. This allows deployed applications
// to continue to run even when a logic error happens in the callback, while making
// it easier to troubleshoot while in debug mode.
// ioArgs: dojo/main.__IoCallbackArgs
// Provides additional information about the request.
// response: Object
// The response in the format as defined with handleAs.
},
handle: function(loadOrError, response, ioArgs){
// summary:
// This function will
// be called at the end of every request, whether or not an error occurs.
// loadOrError: String
// Provides a string that tells you whether this function
// was called because of success (load) or failure (error).
// response: Object
// The response in the format as defined with handleAs.
// ioArgs: dojo/main.__IoCallbackArgs
// Provides additional information about the request.
}
});
dojo.__IoCallbackArgs = declare(null, {
// args: Object
// the original object argument to the IO call.
// xhr: XMLHttpRequest
// For XMLHttpRequest calls only, the
// XMLHttpRequest object that was used for the
// request.
// url: String
// The final URL used for the call. Many times it
// will be different than the original args.url
// value.
// query: String
// For non-GET requests, the
// name1=value1&name2=value2 parameters sent up in
// the request.
// handleAs: String
// The final indicator on how the response will be
// handled.
// id: String
// For dojo/io/script calls only, the internal
// script ID used for the request.
// canDelete: Boolean
// For dojo/io/script calls only, indicates
// whether the script tag that represents the
// request can be deleted after callbacks have
// been called. Used internally to know when
// cleanup can happen on JSONP-type requests.
// json: Object
// For dojo/io/script calls only: holds the JSON
// response for JSONP-type requests. Used
// internally to hold on to the JSON responses.
// You should not need to access it directly --
// the same object should be passed to the success
// callbacks directly.
});
dojo.__IoPublish = declare(null, {
// summary:
// This is a list of IO topics that can be published
// if djConfig.ioPublish is set to true. IO topics can be
// published for any Input/Output, network operation. So,
// dojo.xhr, dojo.io.script and dojo.io.iframe can all
// trigger these topics to be published.
// start: String
// "/dojo/io/start" is sent when there are no outstanding IO
// requests, and a new IO request is started. No arguments
// are passed with this topic.
// send: String
// "/dojo/io/send" is sent whenever a new IO request is started.
// It passes the dojo.Deferred for the request with the topic.
// load: String
// "/dojo/io/load" is sent whenever an IO request has loaded
// successfully. It passes the response and the dojo.Deferred
// for the request with the topic.
// error: String
// "/dojo/io/error" is sent whenever an IO request has errored.
// It passes the error and the dojo.Deferred
// for the request with the topic.
// done: String
// "/dojo/io/done" is sent whenever an IO request has completed,
// either by loading or by erroring. It passes the error and
// the dojo.Deferred for the request with the topic.
// stop: String
// "/dojo/io/stop" is sent when all outstanding IO requests have
// finished. No arguments are passed with this topic.
});
=====*/
dojo._ioSetArgs = function(/*dojo/main.__IoArgs*/args,
/*Function*/canceller,
/*Function*/okHandler,
/*Function*/errHandler){
// summary:
// sets up the Deferred and ioArgs property on the Deferred so it
// can be used in an io call.
// args:
// The args object passed into the public io call. Recognized properties on
// the args object are:
// canceller:
// The canceller function used for the Deferred object. The function
// will receive one argument, the Deferred object that is related to the
// canceller.
// okHandler:
// The first OK callback to be registered with Deferred. It has the opportunity
// to transform the OK response. It will receive one argument -- the Deferred
// object returned from this function.
// errHandler:
// The first error callback to be registered with Deferred. It has the opportunity
// to do cleanup on an error. It will receive two arguments: error (the
// Error object) and dfd, the Deferred object returned from this function.
var ioArgs = {args: args, url: args.url};
//Get values from form if requested.
var formObject = null;
if(args.form){
var form = dom.byId(args.form);
//IE requires going through getAttributeNode instead of just getAttribute in some form cases,
//so use it for all. See #2844
var actnNode = form.getAttributeNode("action");
ioArgs.url = ioArgs.url || (actnNode ? actnNode.value : (dojo.doc ? dojo.doc.URL : null));
formObject = domForm.toObject(form);
}
// set up the query params
var miArgs = {};
if(formObject){
// potentially over-ride url-provided params w/ form values
lang.mixin(miArgs, formObject);
}
if(args.content){
// stuff in content over-rides what's set by form
lang.mixin(miArgs, args.content);
}
if(args.preventCache){
miArgs["dojo.preventCache"] = new Date().valueOf();
}
ioArgs.query = ioq.objectToQuery(miArgs);
// .. and the real work of getting the deferred in order, etc.
ioArgs.handleAs = args.handleAs || "text";
var d = new Deferred(function(dfd){
dfd.canceled = true;
canceller && canceller(dfd);
var err = dfd.ioArgs.error;
if(!err){
err = new Error("request cancelled");
err.dojoType="cancel";
dfd.ioArgs.error = err;
}
return err;
});
d.addCallback(okHandler);
//Support specifying load, error and handle callback functions from the args.
//For those callbacks, the "this" object will be the args object.
//The callbacks will get the deferred result value as the
//first argument and the ioArgs object as the second argument.
var ld = args.load;
if(ld && lang.isFunction(ld)){
d.addCallback(function(value){
return ld.call(args, value, ioArgs);
});
}
var err = args.error;
if(err && lang.isFunction(err)){
d.addErrback(function(value){
return err.call(args, value, ioArgs);
});
}
var handle = args.handle;
if(handle && lang.isFunction(handle)){
d.addBoth(function(value){
return handle.call(args, value, ioArgs);
});
}
// Attach error handler last (not including topic publishing)
// to catch any errors that may have been generated from load
// or handle functions.
d.addErrback(function(error){
return errHandler(error, d);
});
//Plug in topic publishing, if dojo.publish is loaded.
if(cfg.ioPublish && dojo.publish && ioArgs.args.ioPublish !== false){
d.addCallbacks(
function(res){
dojo.publish("/dojo/io/load", [d, res]);
return res;
},
function(res){
dojo.publish("/dojo/io/error", [d, res]);
return res;
}
);
d.addBoth(function(res){
dojo.publish("/dojo/io/done", [d, res]);
return res;
});
}
d.ioArgs = ioArgs;
// FIXME: need to wire up the xhr object's abort method to something
// analogous in the Deferred
return d;
};
var _deferredOk = function(/*Deferred*/dfd){
// summary:
// okHandler function for dojo._ioSetArgs call.
var ret = handlers[dfd.ioArgs.handleAs](dfd.ioArgs.xhr);
return ret === undefined ? null : ret;
};
var _deferError = function(/*Error*/error, /*Deferred*/dfd){
// summary:
// errHandler function for dojo._ioSetArgs call.
if(!dfd.ioArgs.args.failOk){
console.error(error);
}
return error;
};
//Use a separate count for knowing if we are starting/stopping io calls.
var _checkPubCount = function(dfd){
if(_pubCount <= 0){
_pubCount = 0;
if(cfg.ioPublish && dojo.publish && (!dfd || dfd && dfd.ioArgs.args.ioPublish !== false)){
dojo.publish("/dojo/io/stop");
}
}
};
var _pubCount = 0;
aspect.after(watch, "_onAction", function(){
_pubCount -= 1;
});
aspect.after(watch, "_onInFlight", _checkPubCount);
dojo._ioCancelAll = watch.cancelAll;
/*=====
dojo._ioCancelAll = function(){
// summary:
// Cancels all pending IO requests, regardless of IO type
// (xhr, script, iframe).
};
=====*/
dojo._ioNotifyStart = function(/*Deferred*/dfd){
// summary:
// If dojo.publish is available, publish topics
// about the start of a request queue and/or the
// the beginning of request.
//
// Used by IO transports. An IO transport should
// call this method before making the network connection.
if(cfg.ioPublish && dojo.publish && dfd.ioArgs.args.ioPublish !== false){
if(!_pubCount){
dojo.publish("/dojo/io/start");
}
_pubCount += 1;
dojo.publish("/dojo/io/send", [dfd]);
}
};
dojo._ioWatch = function(dfd, validCheck, ioCheck, resHandle){
// summary:
// Watches the io request represented by dfd to see if it completes.
// dfd: Deferred
// The Deferred object to watch.
// validCheck: Function
// Function used to check if the IO request is still valid. Gets the dfd
// object as its only argument.
// ioCheck: Function
// Function used to check if basic IO call worked. Gets the dfd
// object as its only argument.
// resHandle: Function
// Function used to process response. Gets the dfd
// object as its only argument.
var args = dfd.ioArgs.options = dfd.ioArgs.args;
lang.mixin(dfd, {
response: dfd.ioArgs,
isValid: function(response){
return validCheck(dfd);
},
isReady: function(response){
return ioCheck(dfd);
},
handleResponse: function(response){
return resHandle(dfd);
}
});
watch(dfd);
_checkPubCount(dfd);
};
var _defaultContentType = "application/x-www-form-urlencoded";
dojo._ioAddQueryToUrl = function(/*dojo.__IoCallbackArgs*/ioArgs){
// summary:
// Adds query params discovered by the io deferred construction to the URL.
// Only use this for operations which are fundamentally GET-type operations.
if(ioArgs.query.length){
ioArgs.url += (ioArgs.url.indexOf("?") == -1 ? "?" : "&") + ioArgs.query;
ioArgs.query = null;
}
};
/*=====
dojo.__XhrArgs = declare(dojo.__IoArgs, {
// summary:
// In addition to the properties listed for the dojo._IoArgs type,
// the following properties are allowed for dojo.xhr* methods.
// handleAs: String?
// Acceptable values are: text (default), json, json-comment-optional,
// json-comment-filtered, javascript, xml. See `dojo/_base/xhr.contentHandlers`
// sync: Boolean?
// false is default. Indicates whether the request should
// be a synchronous (blocking) request.
// headers: Object?
// Additional HTTP headers to send in the request.
// failOk: Boolean?
// false is default. Indicates whether a request should be
// allowed to fail (and therefore no console error message in
// the event of a failure)
// contentType: String|Boolean
// "application/x-www-form-urlencoded" is default. Set to false to
// prevent a Content-Type header from being sent, or to a string
// to send a different Content-Type.
});
=====*/
dojo.xhr = function(/*String*/ method, /*dojo.__XhrArgs*/ args, /*Boolean?*/ hasBody){
// summary:
// Deprecated. Use dojo/request instead.
// description:
// Sends an HTTP request with the given method.
// See also dojo.xhrGet(), xhrPost(), xhrPut() and dojo.xhrDelete() for shortcuts
// for those HTTP methods. There are also methods for "raw" PUT and POST methods
// via dojo.rawXhrPut() and dojo.rawXhrPost() respectively.
// method:
// HTTP method to be used, such as GET, POST, PUT, DELETE. Should be uppercase.
// hasBody:
// If the request has an HTTP body, then pass true for hasBody.
var rDfd;
//Make the Deferred object for this xhr request.
var dfd = dojo._ioSetArgs(args, function(dfd){
rDfd && rDfd.cancel();
}, _deferredOk, _deferError);
var ioArgs = dfd.ioArgs;
//Allow for specifying the HTTP body completely.
if("postData" in args){
ioArgs.query = args.postData;
}else if("putData" in args){
ioArgs.query = args.putData;
}else if("rawBody" in args){
ioArgs.query = args.rawBody;
}else if((arguments.length > 2 && !hasBody) || "POST|PUT".indexOf(method.toUpperCase()) === -1){
//Check for hasBody being passed. If no hasBody,
//then only append query string if not a POST or PUT request.
dojo._ioAddQueryToUrl(ioArgs);
}
var options = {
method: method,
handleAs: "text",
timeout: args.timeout,
withCredentials: args.withCredentials,
ioArgs: ioArgs
};
if(typeof args.headers !== 'undefined'){
options.headers = args.headers;
}
if(typeof args.contentType !== 'undefined'){
if(!options.headers){
options.headers = {};
}
options.headers['Content-Type'] = args.contentType;
}
if(typeof ioArgs.query !== 'undefined'){
options.data = ioArgs.query;
}
if(typeof args.sync !== 'undefined'){
options.sync = args.sync;
}
dojo._ioNotifyStart(dfd);
try{
rDfd = _xhr(ioArgs.url, options, true);
}catch(e){
// If XHR creation fails, dojo/request/xhr throws
// When this happens, cancel the deferred
dfd.cancel();
return dfd;
}
// sync ioArgs
dfd.ioArgs.xhr = rDfd.response.xhr;
rDfd.then(function(){
dfd.resolve(dfd);
}).otherwise(function(error){
ioArgs.error = error;
if(error.response){
error.status = error.response.status;
error.responseText = error.response.text;
error.xhr = error.response.xhr;
}
dfd.reject(error);
});
return dfd; // dojo/_base/Deferred
};
dojo.xhrGet = function(/*dojo.__XhrArgs*/ args){
// summary:
// Sends an HTTP GET request to the server.
return dojo.xhr("GET", args); // dojo/_base/Deferred
};
dojo.rawXhrPost = dojo.xhrPost = function(/*dojo.__XhrArgs*/ args){
// summary:
// Sends an HTTP POST request to the server. In addition to the properties
// listed for the dojo.__XhrArgs type, the following property is allowed:
// postData:
// String. Send raw data in the body of the POST request.
return dojo.xhr("POST", args, true); // dojo/_base/Deferred
};
dojo.rawXhrPut = dojo.xhrPut = function(/*dojo.__XhrArgs*/ args){
// summary:
// Sends an HTTP PUT request to the server. In addition to the properties
// listed for the dojo.__XhrArgs type, the following property is allowed:
// putData:
// String. Send raw data in the body of the PUT request.
return dojo.xhr("PUT", args, true); // dojo/_base/Deferred
};
dojo.xhrDelete = function(/*dojo.__XhrArgs*/ args){
// summary:
// Sends an HTTP DELETE request to the server.
return dojo.xhr("DELETE", args); // dojo/_base/Deferred
};
/*
dojo.wrapForm = function(formNode){
// summary:
// A replacement for FormBind, but not implemented yet.
// FIXME: need to think harder about what extensions to this we might
// want. What should we allow folks to do w/ this? What events to
// set/send?
throw new Error("dojo.wrapForm not yet implemented");
}
*/
dojo._isDocumentOk = function(x){
return util.checkStatus(x.status);
};
dojo._getText = function(url){
var result;
dojo.xhrGet({url:url, sync:true, load:function(text){
result = text;
}});
return result;
};
// Add aliases for static functions to dojo.xhr since dojo.xhr is what's returned from this module
lang.mixin(dojo.xhr, {
_xhrObj: dojo._xhrObj,
fieldToObject: domForm.fieldToObject,
formToObject: domForm.toObject,
objectToQuery: ioq.objectToQuery,
formToQuery: domForm.toQuery,
formToJson: domForm.toJson,
queryToObject: ioq.queryToObject,
contentHandlers: handlers,
_ioSetArgs: dojo._ioSetArgs,
_ioCancelAll: dojo._ioCancelAll,
_ioNotifyStart: dojo._ioNotifyStart,
_ioWatch: dojo._ioWatch,
_ioAddQueryToUrl: dojo._ioAddQueryToUrl,
_isDocumentOk: dojo._isDocumentOk,
_getText: dojo._getText,
get: dojo.xhrGet,
post: dojo.xhrPost,
put: dojo.xhrPut,
del: dojo.xhrDelete // because "delete" is a reserved word
});
return dojo.xhr;
}).apply(null, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
/***/ }),
/***/ 231:
/*!****************************************!*\
!*** ../../node_modules/dijit/main.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/kernel */ 1054)
], __WEBPACK_AMD_DEFINE_RESULT__ = (function(dojo){
// module:
// dijit/main
/*=====
return {
// summary:
// The dijit package main module.
// Deprecated. Users should access individual modules (ex: dijit/registry) directly.
};
=====*/
return dojo.dijit;
}).apply(null, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
/***/ }),
/***/ 280:
/*!*************************************************!*\
!*** ../../node_modules/dojo/_base/Deferred.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__(/*! ./kernel */ 1054),
__webpack_require__(/*! ../Deferred */ 5625),
__webpack_require__(/*! ../promise/Promise */ 5479),
__webpack_require__(/*! ../errors/CancelError */ 1662),
__webpack_require__(/*! ../has */ 6356),
__webpack_require__(/*! ./lang */ 6323),
__webpack_require__(/*! ../when */ 3534)
], __WEBPACK_AMD_DEFINE_RESULT__ = (function(dojo, NewDeferred, Promise, CancelError, has, lang, when){
// module:
// dojo/_base/Deferred
var mutator = function(){};
var freeze = Object.freeze || function(){};
// A deferred provides an API for creating and resolving a promise.
var Deferred = dojo.Deferred = function(/*Function?*/ canceller){
// summary:
// Deprecated. This module defines the legacy dojo/_base/Deferred API.
// New code should use dojo/Deferred instead.
// description:
// The Deferred API is based on the concept of promises that provide a
// generic interface into the eventual completion of an asynchronous action.
// The motivation for promises fundamentally is about creating a
// separation of concerns that allows one to achieve the same type of
// call patterns and logical data flow in asynchronous code as can be
// achieved in synchronous code. Promises allows one
// to be able to call a function purely with arguments needed for
// execution, without conflating the call with concerns of whether it is
// sync or async. One shouldn't need to alter a call's arguments if the
// implementation switches from sync to async (or vice versa). By having
// async functions return promises, the concerns of making the call are
// separated from the concerns of asynchronous interaction (which are
// handled by the promise).
//
// The Deferred is a type of promise that provides methods for fulfilling the
// promise with a successful result or an error. The most important method for
// working with Dojo's promises is the then() method, which follows the
// CommonJS proposed promise API. An example of using a Dojo promise:
//
// | var resultingPromise = someAsyncOperation.then(function(result){
// | ... handle result ...
// | },
// | function(error){
// | ... handle error ...
// | });
//
// The .then() call returns a new promise that represents the result of the
// execution of the callback. The callbacks will never affect the original promises value.
//
// The Deferred instances also provide the following functions for backwards compatibility:
//
// - addCallback(handler)
// - addErrback(handler)
// - callback(result)
// - errback(result)
//
// Callbacks are allowed to return promises themselves, so
// you can build complicated sequences of events with ease.
//
// The creator of the Deferred may specify a canceller. The canceller
// is a function that will be called if Deferred.cancel is called
// before the Deferred fires. You can use this to implement clean
// aborting of an XMLHttpRequest, etc. Note that cancel will fire the
// deferred with a CancelledError (unless your canceller returns
// another kind of error), so the errbacks should be prepared to
// handle that error for cancellable Deferreds.
// example:
// | var deferred = new Deferred();
// | setTimeout(function(){ deferred.callback({success: true}); }, 1000);
// | return deferred;
// example:
// Deferred objects are often used when making code asynchronous. It
// may be easiest to write functions in a synchronous manner and then
// split code using a deferred to trigger a response to a long-lived
// operation. For example, instead of register a callback function to
// denote when a rendering operation completes, the function can
// simply return a deferred:
//
// | // callback style:
// | function renderLotsOfData(data, callback){
// | var success = false
// | try{
// | for(var x in data){
// | renderDataitem(data[x]);
// | }
// | success = true;
// | }catch(e){ }
// | if(callback){
// | callback(success);
// | }
// | }
//
// | // using callback style
// | renderLotsOfData(someDataObj, function(success){
// | // handles success or failure
// | if(!success){
// | promptUserToRecover();
// | }
// | });
// | // NOTE: no way to add another callback here!!
// example:
// Using a Deferred doesn't simplify the sending code any, but it
// provides a standard interface for callers and senders alike,
// providing both with a simple way to service multiple callbacks for
// an operation and freeing both sides from worrying about details
// such as "did this get called already?". With Deferreds, new
// callbacks can be added at any time.
//
// | // Deferred style:
// | function renderLotsOfData(data){
// | var d = new Deferred();
// | try{
// | for(var x in data){
// | renderDataitem(data[x]);
// | }
// | d.callback(true);
// | }catch(e){
// | d.errback(new Error("rendering failed"));
// | }
// | return d;
// | }
//
// | // using Deferred style
// | renderLotsOfData(someDataObj).then(null, function(){
// | promptUserToRecover();
// | });
// | // NOTE: addErrback and addCallback both return the Deferred
// | // again, so we could chain adding callbacks or save the
// | // deferred for later should we need to be notified again.
// example:
// In this example, renderLotsOfData is synchronous and so both
// versions are pretty artificial. Putting the data display on a
// timeout helps show why Deferreds rock:
//
// | // Deferred style and async func
// | function renderLotsOfData(data){
// | var d = new Deferred();
// | setTimeout(function(){
// | try{
// | for(var x in data){
// | renderDataitem(data[x]);
// | }
// | d.callback(true);
// | }catch(e){
// | d.errback(new Error("rendering failed"));
// | }
// | }, 100);
// | return d;
// | }
//
// | // using Deferred style
// | renderLotsOfData(someDataObj).then(null, function(){
// | promptUserToRecover();
// | });
//
// Note that the caller doesn't have to change his code at all to
// handle the asynchronous case.
var result, finished, canceled, fired, isError, head, nextListener;
var promise = (this.promise = new Promise());
function complete(value){
if(finished){
throw new Error("This deferred has already been resolved");
}
result = value;
finished = true;
notify();
}
function notify(){
var mutated;
while(!mutated && nextListener){
var listener = nextListener;
nextListener = nextListener.next;
if((mutated = (listener.progress == mutator))){ // assignment and check
finished = false;
}
var func = (isError ? listener.error : listener.resolved);
if(has("config-useDeferredInstrumentation")){
if(isError && NewDeferred.instrumentRejected){
NewDeferred.instrumentRejected(result, !!func);
}
}
if(func){
try{
var newResult = func(result);
if (newResult && typeof newResult.then === "function"){
newResult.then(lang.hitch(listener.deferred, "resolve"), lang.hitch(listener.deferred, "reject"), lang.hitch(listener.deferred, "progress"));
continue;
}
var unchanged = mutated && newResult === undefined;
if(mutated && !unchanged){
isError = newResult instanceof Error;
}
listener.deferred[unchanged && isError ? "reject" : "resolve"](unchanged ? result : newResult);
}catch(e){
listener.deferred.reject(e);
}
}else{
if(isError){
listener.deferred.reject(result);
}else{
listener.deferred.resolve(result);
}
}
}
}
this.isResolved = promise.isResolved = function(){
// summary:
// Checks whether the deferred has been resolved.
// returns: Boolean
return fired == 0;
};
this.isRejected = promise.isRejected = function(){
// summary:
// Checks whether the deferred has been rejected.
// returns: Boolean
return fired == 1;
};
this.isFulfilled = promise.isFulfilled = function(){
// summary:
// Checks whether the deferred has been resolved or rejected.
// returns: Boolean
return fired >= 0;
};
this.isCanceled = promise.isCanceled = function(){
// summary:
// Checks whether the deferred has been canceled.
// returns: Boolean
return canceled;
};
// calling resolve will resolve the promise
this.resolve = this.callback = function(value){
// summary:
// Fulfills the Deferred instance successfully with the provide value
this.fired = fired = 0;
this.results = [value, null];
complete(value);
};
// calling error will indicate that the promise failed
this.reject = this.errback = function(error){
// summary:
// Fulfills the Deferred instance as an error with the provided error
isError = true;
this.fired = fired = 1;
if(has("config-useDeferredInstrumentation")){
if(NewDeferred.instrumentRejected){
NewDeferred.instrumentRejected(error, !!nextListener);
}
}
complete(error);
this.results = [null, error];
};
// call progress to provide updates on the progress on the completion of the promise
this.progress = function(update){
// summary:
// Send progress events to all listeners
var listener = nextListener;
while(listener){
var progress = listener.progress;
pr