tg-turing
Version:
turing components
1,737 lines (1,431 loc) • 468 kB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define("tg-turing", [], factory);
else if(typeof exports === 'object')
exports["tg-turing"] = factory();
else
root["tg-turing"] = factory();
})(typeof self !== 'undefined' ? self : this, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "/dist/";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 84);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports) {
var core = module.exports = { version: '2.6.1' };
if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef
/***/ }),
/* 1 */
/***/ (function(module, exports) {
module.exports = function normalizeComponent (
rawScriptExports,
compiledTemplate,
scopeId,
cssModules
) {
var esModule
var scriptExports = rawScriptExports = rawScriptExports || {}
// ES6 modules interop
var type = typeof rawScriptExports.default
if (type === 'object' || type === 'function') {
esModule = rawScriptExports
scriptExports = rawScriptExports.default
}
// Vue.extend constructor export interop
var options = typeof scriptExports === 'function'
? scriptExports.options
: scriptExports
// render functions
if (compiledTemplate) {
options.render = compiledTemplate.render
options.staticRenderFns = compiledTemplate.staticRenderFns
}
// scopedId
if (scopeId) {
options._scopeId = scopeId
}
// inject cssModules
if (cssModules) {
var computed = options.computed || (options.computed = {})
Object.keys(cssModules).forEach(function (key) {
var module = cssModules[key]
computed[key] = function () { return module }
})
}
return {
esModule: esModule,
exports: scriptExports,
options: options
}
}
/***/ }),
/* 2 */
/***/ (function(module, exports) {
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
var global = module.exports = typeof window != 'undefined' && window.Math == Math
? window : typeof self != 'undefined' && self.Math == Math ? self
// eslint-disable-next-line no-new-func
: Function('return this')();
if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef
/***/ }),
/* 3 */
/***/ (function(module, exports, __webpack_require__) {
var store = __webpack_require__(38)('wks');
var uid = __webpack_require__(27);
var Symbol = __webpack_require__(2).Symbol;
var USE_SYMBOL = typeof Symbol == 'function';
var $exports = module.exports = function (name) {
return store[name] || (store[name] =
USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));
};
$exports.store = store;
/***/ }),
/* 4 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var bind = __webpack_require__(64);
var isBuffer = __webpack_require__(110);
/*global toString:true*/
// utils is a library of generic helper functions non-specific to axios
var toString = Object.prototype.toString;
/**
* Determine if a value is an Array
*
* @param {Object} val The value to test
* @returns {boolean} True if value is an Array, otherwise false
*/
function isArray(val) {
return toString.call(val) === '[object Array]';
}
/**
* Determine if a value is an ArrayBuffer
*
* @param {Object} val The value to test
* @returns {boolean} True if value is an ArrayBuffer, otherwise false
*/
function isArrayBuffer(val) {
return toString.call(val) === '[object ArrayBuffer]';
}
/**
* Determine if a value is a FormData
*
* @param {Object} val The value to test
* @returns {boolean} True if value is an FormData, otherwise false
*/
function isFormData(val) {
return (typeof FormData !== 'undefined') && (val instanceof FormData);
}
/**
* Determine if a value is a view on an ArrayBuffer
*
* @param {Object} val The value to test
* @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
*/
function isArrayBufferView(val) {
var result;
if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
result = ArrayBuffer.isView(val);
} else {
result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
}
return result;
}
/**
* Determine if a value is a String
*
* @param {Object} val The value to test
* @returns {boolean} True if value is a String, otherwise false
*/
function isString(val) {
return typeof val === 'string';
}
/**
* Determine if a value is a Number
*
* @param {Object} val The value to test
* @returns {boolean} True if value is a Number, otherwise false
*/
function isNumber(val) {
return typeof val === 'number';
}
/**
* Determine if a value is undefined
*
* @param {Object} val The value to test
* @returns {boolean} True if the value is undefined, otherwise false
*/
function isUndefined(val) {
return typeof val === 'undefined';
}
/**
* Determine if a value is an Object
*
* @param {Object} val The value to test
* @returns {boolean} True if value is an Object, otherwise false
*/
function isObject(val) {
return val !== null && typeof val === 'object';
}
/**
* Determine if a value is a Date
*
* @param {Object} val The value to test
* @returns {boolean} True if value is a Date, otherwise false
*/
function isDate(val) {
return toString.call(val) === '[object Date]';
}
/**
* Determine if a value is a File
*
* @param {Object} val The value to test
* @returns {boolean} True if value is a File, otherwise false
*/
function isFile(val) {
return toString.call(val) === '[object File]';
}
/**
* Determine if a value is a Blob
*
* @param {Object} val The value to test
* @returns {boolean} True if value is a Blob, otherwise false
*/
function isBlob(val) {
return toString.call(val) === '[object Blob]';
}
/**
* Determine if a value is a Function
*
* @param {Object} val The value to test
* @returns {boolean} True if value is a Function, otherwise false
*/
function isFunction(val) {
return toString.call(val) === '[object Function]';
}
/**
* Determine if a value is a Stream
*
* @param {Object} val The value to test
* @returns {boolean} True if value is a Stream, otherwise false
*/
function isStream(val) {
return isObject(val) && isFunction(val.pipe);
}
/**
* Determine if a value is a URLSearchParams object
*
* @param {Object} val The value to test
* @returns {boolean} True if value is a URLSearchParams object, otherwise false
*/
function isURLSearchParams(val) {
return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
}
/**
* Trim excess whitespace off the beginning and end of a string
*
* @param {String} str The String to trim
* @returns {String} The String freed of excess whitespace
*/
function trim(str) {
return str.replace(/^\s*/, '').replace(/\s*$/, '');
}
/**
* Determine if we're running in a standard browser environment
*
* This allows axios to run in a web worker, and react-native.
* Both environments support XMLHttpRequest, but not fully standard globals.
*
* web workers:
* typeof window -> undefined
* typeof document -> undefined
*
* react-native:
* navigator.product -> 'ReactNative'
*/
function isStandardBrowserEnv() {
if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {
return false;
}
return (
typeof window !== 'undefined' &&
typeof document !== 'undefined'
);
}
/**
* Iterate over an Array or an Object invoking a function for each item.
*
* If `obj` is an Array callback will be called passing
* the value, index, and complete array for each item.
*
* If 'obj' is an Object callback will be called passing
* the value, key, and complete object for each property.
*
* @param {Object|Array} obj The object to iterate
* @param {Function} fn The callback to invoke for each item
*/
function forEach(obj, fn) {
// Don't bother if no value provided
if (obj === null || typeof obj === 'undefined') {
return;
}
// Force an array if not already something iterable
if (typeof obj !== 'object') {
/*eslint no-param-reassign:0*/
obj = [obj];
}
if (isArray(obj)) {
// Iterate over array values
for (var i = 0, l = obj.length; i < l; i++) {
fn.call(null, obj[i], i, obj);
}
} else {
// Iterate over object keys
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
fn.call(null, obj[key], key, obj);
}
}
}
}
/**
* Accepts varargs expecting each argument to be an object, then
* immutably merges the properties of each object and returns result.
*
* When multiple objects contain the same key the later object in
* the arguments list will take precedence.
*
* Example:
*
* ```js
* var result = merge({foo: 123}, {foo: 456});
* console.log(result.foo); // outputs 456
* ```
*
* @param {Object} obj1 Object to merge
* @returns {Object} Result of all merge properties
*/
function merge(/* obj1, obj2, obj3, ... */) {
var result = {};
function assignValue(val, key) {
if (typeof result[key] === 'object' && typeof val === 'object') {
result[key] = merge(result[key], val);
} else {
result[key] = val;
}
}
for (var i = 0, l = arguments.length; i < l; i++) {
forEach(arguments[i], assignValue);
}
return result;
}
/**
* Extends object a by mutably adding to it the properties of object b.
*
* @param {Object} a The object to be extended
* @param {Object} b The object to copy properties from
* @param {Object} thisArg The object to bind function to
* @return {Object} The resulting value of object a
*/
function extend(a, b, thisArg) {
forEach(b, function assignValue(val, key) {
if (thisArg && typeof val === 'function') {
a[key] = bind(val, thisArg);
} else {
a[key] = val;
}
});
return a;
}
module.exports = {
isArray: isArray,
isArrayBuffer: isArrayBuffer,
isBuffer: isBuffer,
isFormData: isFormData,
isArrayBufferView: isArrayBufferView,
isString: isString,
isNumber: isNumber,
isObject: isObject,
isUndefined: isUndefined,
isDate: isDate,
isFile: isFile,
isBlob: isBlob,
isFunction: isFunction,
isStream: isStream,
isURLSearchParams: isURLSearchParams,
isStandardBrowserEnv: isStandardBrowserEnv,
forEach: forEach,
merge: merge,
extend: extend,
trim: trim
};
/***/ }),
/* 5 */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(2);
var core = __webpack_require__(0);
var ctx = __webpack_require__(17);
var hide = __webpack_require__(13);
var has = __webpack_require__(14);
var PROTOTYPE = 'prototype';
var $export = function (type, name, source) {
var IS_FORCED = type & $export.F;
var IS_GLOBAL = type & $export.G;
var IS_STATIC = type & $export.S;
var IS_PROTO = type & $export.P;
var IS_BIND = type & $export.B;
var IS_WRAP = type & $export.W;
var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});
var expProto = exports[PROTOTYPE];
var target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE];
var key, own, out;
if (IS_GLOBAL) source = name;
for (key in source) {
// contains in native
own = !IS_FORCED && target && target[key] !== undefined;
if (own && has(exports, key)) continue;
// export native or passed
out = own ? target[key] : source[key];
// prevent global pollution for namespaces
exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
// bind timers to global for call from export context
: IS_BIND && own ? ctx(out, global)
// wrap global constructors for prevent change them in library
: IS_WRAP && target[key] == out ? (function (C) {
var F = function (a, b, c) {
if (this instanceof C) {
switch (arguments.length) {
case 0: return new C();
case 1: return new C(a);
case 2: return new C(a, b);
} return new C(a, b, c);
} return C.apply(this, arguments);
};
F[PROTOTYPE] = C[PROTOTYPE];
return F;
// make static versions for prototype methods
})(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
// export proto methods to core.%CONSTRUCTOR%.methods.%NAME%
if (IS_PROTO) {
(exports.virtual || (exports.virtual = {}))[key] = out;
// export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%
if (type & $export.R && expProto && !expProto[key]) hide(expProto, key, out);
}
}
};
// type bitmap
$export.F = 1; // forced
$export.G = 2; // global
$export.S = 4; // static
$export.P = 8; // proto
$export.B = 16; // bind
$export.W = 32; // wrap
$export.U = 64; // safe
$export.R = 128; // real proto method for `library`
module.exports = $export;
/***/ }),
/* 6 */
/***/ (function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(85), __esModule: true };
/***/ }),
/* 7 */
/***/ (function(module, exports, __webpack_require__) {
var isObject = __webpack_require__(10);
module.exports = function (it) {
if (!isObject(it)) throw TypeError(it + ' is not an object!');
return it;
};
/***/ }),
/* 8 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
exports.default = function (innerThis, boundThis) {
if (innerThis !== boundThis) {
throw new TypeError("Cannot instantiate an arrow function");
}
};
/***/ }),
/* 9 */
/***/ (function(module, exports, __webpack_require__) {
var anObject = __webpack_require__(7);
var IE8_DOM_DEFINE = __webpack_require__(49);
var toPrimitive = __webpack_require__(34);
var dP = Object.defineProperty;
exports.f = __webpack_require__(11) ? Object.defineProperty : function defineProperty(O, P, Attributes) {
anObject(O);
P = toPrimitive(P, true);
anObject(Attributes);
if (IE8_DOM_DEFINE) try {
return dP(O, P, Attributes);
} catch (e) { /* empty */ }
if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
if ('value' in Attributes) O[P] = Attributes.value;
return O;
};
/***/ }),
/* 10 */
/***/ (function(module, exports) {
module.exports = function (it) {
return typeof it === 'object' ? it !== null : typeof it === 'function';
};
/***/ }),
/* 11 */
/***/ (function(module, exports, __webpack_require__) {
// Thank's IE8 for his funny defineProperty
module.exports = !__webpack_require__(15)(function () {
return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
});
/***/ }),
/* 12 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _newArrowCheck2 = __webpack_require__(8);
var _newArrowCheck3 = _interopRequireDefault(_newArrowCheck2);
var _assign = __webpack_require__(6);
var _assign2 = _interopRequireDefault(_assign);
var _utils = __webpack_require__(21);
var _utils2 = _interopRequireDefault(_utils);
var _vaildateRules = __webpack_require__(134);
var _vaildateRules2 = _interopRequireDefault(_vaildateRules);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
test: function test() {
console.log(1);
},
beforeFindAll: [function (action, params, props) {
return params;
}],
afterFindAll: [function (result, findAction, params) {
return result.data;
}],
beforeSave: [function (action, data, model) {
return data;
}],
afterSave: [function (result, model) {
return result.data;
}],
getDictData: [function (dict, params, callback) {
var _this = this;
var filterparams = dict.params || {};
if (params !== undefined && params.key !== "") {
var newparam = {};
newparam[dict.label] = params.key;
(0, _assign2.default)(filterparams, newparam);
}
_utils2.default.Post(dict.url, { where: filterparams }).then(function (result) {
(0, _newArrowCheck3.default)(this, _this);
var datas = void 0;
try {
var root = result.data;
if (dict.root !== undefined) {
root = result.data[dict.root];
}
datas = root.map(function (item) {
(0, _newArrowCheck3.default)(this, _this);
return {
label: item[dict.label],
value: item[dict.value]
};
}.bind(this));
callback(datas);
} catch (e) {
console.error("返回数据格式有误", e, "返回结果集", result, "字典配置参数", dict);
}
}.bind(this));
}],
getDictTreeData: [function (dict, params, callback) {
var _this2 = this;
var filterparams = undefined;
if (params !== undefined && params.key !== "") {
filterparams = params;
}
_utils2.default.Post(dict.url, filterparams).then(function (result) {
(0, _newArrowCheck3.default)(this, _this2);
var datas = void 0;
try {
datas = result.data.map(function (item) {
(0, _newArrowCheck3.default)(this, _this2);
item["label"] = item[dict.label], item["value"] = item[dict.value];
return item;
}.bind(this));
datas = _utils2.default.toTreeData(datas, "", { ukey: "id", pkey: 'parentid', toCKey: 'children' });
callback(datas);
} catch (e) {
console.error(e, result);
}
}.bind(this));
}],
getDictTreeDataAsync: [function (dict, params, callback) {
var _this3 = this;
_utils2.default.Post(dict.url, { "id": params.key, "checkParent": true }).then(function (result) {
(0, _newArrowCheck3.default)(this, _this3);
var datas = void 0;
try {
datas = result.data.map(function (item) {
(0, _newArrowCheck3.default)(this, _this3);
item["label"] = item[dict.label], item["value"] = item[dict.value];
return item;
}.bind(this));
datas = _utils2.default.toTreeData(datas, "", { ukey: "id", pkey: 'parentid', toCKey: 'children' });
callback(datas);
} catch (e) {
console.error(e, result);
}
}.bind(this));
}],
currentType: undefined,
validateRules: _vaildateRules2.default,
displayFieldFormat: ""
};
/***/ }),
/* 13 */
/***/ (function(module, exports, __webpack_require__) {
var dP = __webpack_require__(9);
var createDesc = __webpack_require__(26);
module.exports = __webpack_require__(11) ? function (object, key, value) {
return dP.f(object, key, createDesc(1, value));
} : function (object, key, value) {
object[key] = value;
return object;
};
/***/ }),
/* 14 */
/***/ (function(module, exports) {
var hasOwnProperty = {}.hasOwnProperty;
module.exports = function (it, key) {
return hasOwnProperty.call(it, key);
};
/***/ }),
/* 15 */
/***/ (function(module, exports) {
module.exports = function (exec) {
try {
return !!exec();
} catch (e) {
return true;
}
};
/***/ }),
/* 16 */
/***/ (function(module, exports, __webpack_require__) {
// to indexed object, toObject with fallback for non-array-like ES3 strings
var IObject = __webpack_require__(51);
var defined = __webpack_require__(35);
module.exports = function (it) {
return IObject(defined(it));
};
/***/ }),
/* 17 */
/***/ (function(module, exports, __webpack_require__) {
// optional / simple context binding
var aFunction = __webpack_require__(25);
module.exports = function (fn, that, length) {
aFunction(fn);
if (that === undefined) return fn;
switch (length) {
case 1: return function (a) {
return fn.call(that, a);
};
case 2: return function (a, b) {
return fn.call(that, a, b);
};
case 3: return function (a, b, c) {
return fn.call(that, a, b, c);
};
}
return function (/* ...args */) {
return fn.apply(that, arguments);
};
};
/***/ }),
/* 18 */
/***/ (function(module, exports, __webpack_require__) {
// 19.1.2.14 / 15.2.3.14 Object.keys(O)
var $keys = __webpack_require__(50);
var enumBugKeys = __webpack_require__(39);
module.exports = Object.keys || function keys(O) {
return $keys(O, enumBugKeys);
};
/***/ }),
/* 19 */
/***/ (function(module, exports) {
var toString = {}.toString;
module.exports = function (it) {
return toString.call(it).slice(8, -1);
};
/***/ }),
/* 20 */
/***/ (function(module, exports) {
module.exports = true;
/***/ }),
/* 21 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _typeof2 = __webpack_require__(22);
var _typeof3 = _interopRequireDefault(_typeof2);
var _extends2 = __webpack_require__(48);
var _extends3 = _interopRequireDefault(_extends2);
var _newArrowCheck2 = __webpack_require__(8);
var _newArrowCheck3 = _interopRequireDefault(_newArrowCheck2);
var _axios = __webpack_require__(24);
var _axios2 = _interopRequireDefault(_axios);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function serialize(data) {
if (!data) return '';
var pairs = [],
value;
for (var name in data) {
if (!data.hasOwnProperty(name)) continue;
if (typeof data[name] === 'function') continue;
value = String(data[name]);
name = encodeURI(name);
value = encodeURI(value);
pairs.push(name + '=' + value);
}
if (pairs.length) {
return pairs.join('&');
} else {
return '';
}
}
var utils = {};
utils.Post = function (url) {
var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
(0, _newArrowCheck3.default)(undefined, undefined);
return (0, _axios2.default)((0, _extends3.default)({
method: 'post',
url: url,
data: data,
withCredentials: true,
headers: {
contentType: "application/json"
}
}, config));
}.bind(undefined);
utils.Get = function (url) {
var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
(0, _newArrowCheck3.default)(undefined, undefined);
return (0, _axios2.default)((0, _extends3.default)({
method: 'get',
url: url + (url.indexOf("?") > -1 ? "&" : "?") + serialize(data)
}, config));
}.bind(undefined);
utils.Delete = function (url) {
var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
(0, _newArrowCheck3.default)(undefined, undefined);
return (0, _axios2.default)((0, _extends3.default)({
method: 'delete',
url: url,
params: serialize(data)
}, config));
}.bind(undefined);
utils.getUrlParam = function (name) {
if (name === undefined) {
var url = location.search;
var theRequest = new Object();
if (url.indexOf("?") != -1) {
var str = url.substr(1);
var strs = str.split("&");
for (var i = 0; i < strs.length; i++) {
theRequest[strs[i].split("=")[0]] = decodeURIComponent(strs[i].split("=")[1]);
}
}
return theRequest;
} else {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r != null) return decodeURIComponent(r[2]);return null;
}
};
utils.setFullUrl = function (url, prefix) {
if ([".", "/"].indexOf(url.substring(0, 1)) > -1) {
return prefix + url;
} else {
return url;
}
};
utils.getContextPath = function (isFullPath) {
var pathName = window.location.pathname;
var index = pathName.substr(1).indexOf("/");
var result = pathName.substr(0, index + 1);
if (isFullPath === false) {
return result;
} else {
return window.location.protocol + "//" + window.location.host + result;
}
};
utils.cleanProps = function (data) {
for (var prop in data) {
if (data[prop] === undefined || data[prop] === null || data[prop] === "") {
delete data[prop];
}
}
return data;
};
utils.toTreeData = function (data, parent_id, options) {
var opt = options || { ukey: "id", pkey: 'parent_id', toCKey: 'children' };
var tree = [];
var temp = void 0;
var count = data.length;
for (var i = 0; i < count; i++) {
if (!data[i][opt.pkey] && data[i][opt.pkey] !== 0) {
tree.push(data[i]);
utils.addChildToTreeData(data, data[i], opt);
}
}
return tree;
};
utils.addChildToTreeData = function (allData, parentData, opt) {
var parent_id = parentData[opt.ukey];
var count = allData.length;
for (var i = 0; i < count; i++) {
if (allData[i][opt.pkey] === parent_id) {
if (!parentData[opt.toCKey]) {
parentData[opt.toCKey] = [];
}
parentData[opt.toCKey].push(allData[i]);
utils.addChildToTreeData(allData, allData[i], opt);
}
}
};
var hasOwn = Object.prototype.hasOwnProperty;
var toStr = Object.prototype.toString;
var isArray = function isArray(arr) {
if (typeof Array.isArray === 'function') {
return Array.isArray(arr);
}
return toStr.call(arr) === '[object Array]';
};
var isPlainObject = function isPlainObject(obj) {
if (!obj || toStr.call(obj) !== '[object Object]') {
return false;
}
var hasOwnConstructor = hasOwn.call(obj, 'constructor');
var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf');
if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {
return false;
}
var key;
for (key in obj) {}
return typeof key === 'undefined' || hasOwn.call(obj, key);
};
utils.extend = function extend() {
var options, name, src, copy, copyIsArray, clone;
var target = arguments[0];
var i = 1;
var length = arguments.length;
var deep = false;
if (typeof target === 'boolean') {
deep = target;
target = arguments[1] || {};
i = 2;
}
if (target == null || (typeof target === 'undefined' ? 'undefined' : (0, _typeof3.default)(target)) !== 'object' && typeof target !== 'function') {
target = {};
}
for (; i < length; ++i) {
options = arguments[i];
if (options != null) {
for (name in options) {
src = target[name];
copy = options[name];
if (target !== copy) {
if (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) {
if (copyIsArray) {
copyIsArray = false;
clone = src && isArray(src) ? src : [];
} else {
clone = src && isPlainObject(src) ? src : {};
}
target[name] = extend(deep, clone, copy);
} else if (typeof copy !== 'undefined') {
target[name] = copy;
}
}
}
}
}
return target;
};
utils.sendMessageToParent = function (data) {
var type = data.type;
var sendData = data.data;
var guid = _createGuid();
guid = '_send_message_flag_' + guid;
window[guid] = guid;
var href = window.location.href;
sendData['_send_message_href_'] = href;
sendData['_send_message_flag_'] = guid;
parent.postMessage({
type: type,
data: sendData
}, '*');
};
function _createGuid() {
var S4 = function S4() {
return ((1 + Math.random()) * 0x10000 | 0).toString(16).substring(1);
};
return S4() + S4() + "_" + S4() + "_" + S4() + "_" + S4() + "_" + S4() + S4() + S4();
}
exports.default = utils;
/***/ }),
/* 22 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
var _iterator = __webpack_require__(92);
var _iterator2 = _interopRequireDefault(_iterator);
var _symbol = __webpack_require__(100);
var _symbol2 = _interopRequireDefault(_symbol);
var _typeof = typeof _symbol2.default === "function" && typeof _iterator2.default === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj; };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = typeof _symbol2.default === "function" && _typeof(_iterator2.default) === "symbol" ? function (obj) {
return typeof obj === "undefined" ? "undefined" : _typeof(obj);
} : function (obj) {
return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof(obj);
};
/***/ }),
/* 23 */
/***/ (function(module, exports) {
module.exports = {};
/***/ }),
/* 24 */
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(109);
/***/ }),
/* 25 */
/***/ (function(module, exports) {
module.exports = function (it) {
if (typeof it != 'function') throw TypeError(it + ' is not a function!');
return it;
};
/***/ }),
/* 26 */
/***/ (function(module, exports) {
module.exports = function (bitmap, value) {
return {
enumerable: !(bitmap & 1),
configurable: !(bitmap & 2),
writable: !(bitmap & 4),
value: value
};
};
/***/ }),
/* 27 */
/***/ (function(module, exports) {
var id = 0;
var px = Math.random();
module.exports = function (key) {
return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
};
/***/ }),
/* 28 */
/***/ (function(module, exports) {
exports.f = {}.propertyIsEnumerable;
/***/ }),
/* 29 */
/***/ (function(module, exports, __webpack_require__) {
// 7.1.13 ToObject(argument)
var defined = __webpack_require__(35);
module.exports = function (it) {
return Object(defined(it));
};
/***/ }),
/* 30 */
/***/ (function(module, exports, __webpack_require__) {
var def = __webpack_require__(9).f;
var has = __webpack_require__(14);
var TAG = __webpack_require__(3)('toStringTag');
module.exports = function (it, tag, stat) {
if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag });
};
/***/ }),
/* 31 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
exports.default = function (instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
};
/***/ }),
/* 32 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
var _defineProperty = __webpack_require__(76);
var _defineProperty2 = _interopRequireDefault(_defineProperty);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
(0, _defineProperty2.default)(target, descriptor.key, descriptor);
}
}
return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);
if (staticProps) defineProperties(Constructor, staticProps);
return Constructor;
};
}();
/***/ }),
/* 33 */
/***/ (function(module, exports, __webpack_require__) {
var isObject = __webpack_require__(10);
var document = __webpack_require__(2).document;
// typeof document.createElement is 'object' in old IE
var is = isObject(document) && isObject(document.createElement);
module.exports = function (it) {
return is ? document.createElement(it) : {};
};
/***/ }),
/* 34 */
/***/ (function(module, exports, __webpack_require__) {
// 7.1.1 ToPrimitive(input [, PreferredType])
var isObject = __webpack_require__(10);
// instead of the ES6 spec version, we didn't implement @@toPrimitive case
// and the second argument - flag - preferred type is a string
module.exports = function (it, S) {
if (!isObject(it)) return it;
var fn, val;
if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;
if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
throw TypeError("Can't convert object to primitive value");
};
/***/ }),
/* 35 */
/***/ (function(module, exports) {
// 7.2.1 RequireObjectCoercible(argument)
module.exports = function (it) {
if (it == undefined) throw TypeError("Can't call method on " + it);
return it;
};
/***/ }),
/* 36 */
/***/ (function(module, exports) {
// 7.1.4 ToInteger
var ceil = Math.ceil;
var floor = Math.floor;
module.exports = function (it) {
return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
};
/***/ }),
/* 37 */
/***/ (function(module, exports, __webpack_require__) {
var shared = __webpack_require__(38)('keys');
var uid = __webpack_require__(27);
module.exports = function (key) {
return shared[key] || (shared[key] = uid(key));
};
/***/ }),
/* 38 */
/***/ (function(module, exports, __webpack_require__) {
var core = __webpack_require__(0);
var global = __webpack_require__(2);
var SHARED = '__core-js_shared__';
var store = global[SHARED] || (global[SHARED] = {});
(module.exports = function (key, value) {
return store[key] || (store[key] = value !== undefined ? value : {});
})('versions', []).push({
version: core.version,
mode: __webpack_require__(20) ? 'pure' : 'global',
copyright: '© 2018 Denis Pushkarev (zloirock.ru)'
});
/***/ }),
/* 39 */
/***/ (function(module, exports) {
// IE 8- don't enum bug keys
module.exports = (
'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
).split(',');
/***/ }),
/* 40 */
/***/ (function(module, exports) {
exports.f = Object.getOwnPropertySymbols;
/***/ }),
/* 41 */
/***/ (function(module, exports, __webpack_require__) {
// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
var anObject = __webpack_require__(7);
var dPs = __webpack_require__(96);
var enumBugKeys = __webpack_require__(39);
var IE_PROTO = __webpack_require__(37)('IE_PROTO');
var Empty = function () { /* empty */ };
var PROTOTYPE = 'prototype';
// Create object with fake `null` prototype: use iframe Object with cleared prototype
var createDict = function () {
// Thrash, waste and sodomy: IE GC bug
var iframe = __webpack_require__(33)('iframe');
var i = enumBugKeys.length;
var lt = '<';
var gt = '>';
var iframeDocument;
iframe.style.display = 'none';
__webpack_require__(58).appendChild(iframe);
iframe.src = 'javascript:'; // eslint-disable-line no-script-url
// createDict = iframe.contentWindow.Object;
// html.removeChild(iframe);
iframeDocument = iframe.contentWindow.document;
iframeDocument.open();
iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
iframeDocument.close();
createDict = iframeDocument.F;
while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]];
return createDict();
};
module.exports = Object.create || function create(O, Properties) {
var result;
if (O !== null) {
Empty[PROTOTYPE] = anObject(O);
result = new Empty();
Empty[PROTOTYPE] = null;
// add "__proto__" for Object.getPrototypeOf polyfill
result[IE_PROTO] = O;
} else result = createDict();
return Properties === undefined ? result : dPs(result, Properties);
};
/***/ }),
/* 42 */
/***/ (function(module, exports, __webpack_require__) {
exports.f = __webpack_require__(3);
/***/ }),
/* 43 */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(2);
var core = __webpack_require__(0);
var LIBRARY = __webpack_require__(20);
var wksExt = __webpack_require__(42);
var defineProperty = __webpack_require__(9).f;
module.exports = function (name) {
var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {});
if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, { value: wksExt.f(name) });
};
/***/ }),
/* 44 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(process) {
var utils = __webpack_require__(4);
var normalizeHeaderName = __webpack_require__(113);
var DEFAULT_CONTENT_TYPE = {
'Content-Type': 'application/x-www-form-urlencoded'
};
function setContentTypeIfUnset(headers, value) {
if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
headers['Content-Type'] = value;
}
}
function getDefaultAdapter() {
var adapter;
if (typeof XMLHttpRequest !== 'undefined') {
// For browsers use XHR adapter
adapter = __webpack_require__(65);
} else if (typeof process !== 'undefined') {
// For node use HTTP adapter
adapter = __webpack_require__(65);
}
return adapter;
}
var defaults = {
adapter: getDefaultAdapter(),
transformRequest: [function transformRequest(data, headers) {
normalizeHeaderName(headers, 'Content-Type');
if (utils.isFormData(data) ||
utils.isArrayBuffer(data) ||
utils.isBuffer(data) ||
utils.isStream(data) ||
utils.isFile(data) ||
utils.isBlob(data)
) {
return data;
}
if (utils.isArrayBufferView(data)) {
return data.buffer;
}
if (utils.isURLSearchParams(data)) {
setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
return data.toString();
}
if (utils.isObject(data)) {
setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
return JSON.stringify(data);
}
return data;
}],
transformResponse: [function transformResponse(data) {
/*eslint no-param-reassign:0*/
if (typeof data === 'string') {
try {
data = JSON.parse(data);
} catch (e) { /* Ignore */ }
}
return data;
}],
timeout: 0,
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
validateStatus: function validateStatus(status) {
return status >= 200 && status < 300;
}
};
defaults.headers = {
common: {
'Accept': 'application/json, text/plain, */*'
}
};
utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
defaults.headers[method] = {};
});
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
});
module.exports = defaults;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(112)))
/***/ }),
/* 45 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.QuerySettingBuilder = undefined;
var _newArrowCheck2 = __webpack_require__(8);
var _newArrowCheck3 = _interopRequireDefault(_newArrowCheck2);
var _keys = __webpack_require__(53);
var _keys2 = _interopRequireDefault(_keys);
var _stringify = __webpack_require__(75);
var _stringify2 = _interopRequireDefault(_stringify);
var _classCallCheck2 = __webpack_require__(31);
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = __webpack_require__(32);
var _createClass3 = _interopRequireDefault(_createClass2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var QuerySettingBuilder = exports.QuerySettingBuilder = function () {
function QuerySettingBuilder() {
(0, _classCallCheck3.default)(this, QuerySettingBuilder);
}
(0, _createClass3.default)(QuerySettingBuilder, null, [{
key: 'EMAP',
value: function EMAP(form_data) {
var model = this.searchDefine.meta;
var operate_blank_value = true;
var condition = [];
var text_fields = model.map(function (item) {
if (!item.xtype || item.xtype == 'text') {
return item.name;
}
});
var _loop = function _loop(k) {
if (operate_blank_value === true && form_data[k] === '') {
return 'continue';
}
if (/_DISPLAY$/.test(k)) return 'continue';
var modelItem = model.filter(function (item) {
return item.name == k;
})[0];
if (!modelItem) return 'continue';
var item_filter = {
name: k,
caption: modelItem.caption,
linkOpt: "AND",
builderList: modelItem.builderList,
builder: modelItem.defaultBuilder,
value: form_data[k]
};
if (form_data[k + '_DISPLAY'] !== undefined) {
item_filter.value_display = form_data[k + '_DISPLAY'];
}
if (operate_blank_value === true) {
item_filter.value = item_filter.value === '@__blank__value' ? '' : item_filter.value;
}
condition.push(item_filter);
};
for (var k in form_data) {
var _ret = _loop(k);
if (_ret === 'continue') continue;
}
var result = _adaptCondition(condition, model);
return (0, _stringify2.default)(result);
function _adaptCondition(condition, model) {
var resultCondition = [];
var len = condition.length;
var _loop2 = function _loop2(i) {
var condition_item = condition[i];
if (!(condition_item instanceof Array)) {
var model_item = model.filter(function (m_item) {
return m_item.name == condition_item.name;
})[0];
var attr = model_item;
if ((!attr.xtype || attr.xtype == 'text') && condition_item.value.toString().indexOf(',') > 0) {
condition_item.builder = 'm_value_include';
} else if (attr.xtype === 'buttonlist' || attr.xtype === 'multi-buttonlist') {
if (condition_item.value !== undefined && condition_item.value !== null) {
condition_item.value = condition_item.value + '';
}
} else if (attr.xtype === 'number') {
if (condition_item.value) {
condition_item.value = condition_item.value.toString().replace(/\D/g, '');
}
condition_item.value = condition_item.value === null ? '' : numVal * 1;
} else if (attr.xtype == 'multi-select2' || attr.xtype == 'checkboxlist' || attr.xtype == 'multi-buttonlist' || /multi-tree/.test(attr.xtype)) {
if (condition_item.value !== '@__blank__value' && /,/.test(condition_item.value)) {
if (condition_item.builder === 'equal' || condition_item.builder === 'include') {
condition_item.builder = 'm_value_' + condition_item.builder;
}
} else if (condition_item.value === '@__blank__value' && (condition_item.builder === 'm_value_equal' || condition_item.builder === 'm_value_include')) {
condition_item.builder = condition_item.builder.replace(/m_value_/, '');
}
} else if (attr.xtype == 'date-range' || attr.xtype == 'number-range') {
var date_value = condition_item.value;
if (date_value[0] !== "") {
condition_item.builder = 'moreEqual';
condition_item.value = date_value[0];
}
if (date_value[1] !== "" && date_value[1] !== undefined) {
resultCondition.push({
name: condition_item.name,
caption: condition_item.caption,
builder: 'lessEqual',
linkOpt: 'AND',
builderList: 'cbl_Other',
value: date_value[1]
});
}
}
}
resultCondition.push(condition_item);
};
for (var i = 0; i < len; i++) {
_loop2(i);
}
return resultCondition;
}
}
}, {
key: 'lite',
value: function lite(params) {
if ((0, _keys2.default)(params).length > 0 && !params.querySetting) {
var query = [];
for (var key in params) {
var value = params[key];
if (Array.isArray(value)) {
value = value.join(",");
}
query.push({
name: key,
value: value,
linkOpt: 'AND',
builder: 'include'
});
}
return (0, _stringify2.default)(query);
} else {
return undefined;
}
}
}, {
key: 'sequelize',
value: function sequelize(searchValues, defaultScope, ignoreEmpty) {
var _this = this;
var ie = ignoreEmpty === undefined ? true : ignoreEmpty;
var newQS = {};
newQS[defaultScope] = {};
for (var key in searchValues) {
var element = searchValues[key];
if (ie) {
if (element === "") {
continue;
} else if (element instanceof Array && !element.some(function (item) {
(0, _newArrowCheck3.default)(this, _this);
return item !== "";
}.bind(this))) {
continue;
}
}
if (key.indexOf("@") > -1) {
var newScope = key.substring(0, key.indexOf("@"));
var newKey = key.substring(key.indexOf("@") + 1, key.length);
if (newQS[newScope] === undefined) {
newQS[newScope] = {};
}
newQS[newScope][newKey] = element