maishu-toolkit
Advanced tools
Comparing version 1.4.14 to 1.5.0
/*! | ||
* ~ | ||
* maishu-toolkit v1.4.13 | ||
* maishu-toolkit v1.4.14 | ||
* https://github.com/ansiboy/toolkit | ||
@@ -979,2 +979,8 @@ * | ||
}); | ||
Object.defineProperty(exports, "ValueStore", { | ||
enumerable: true, | ||
get: function get() { | ||
return _valueStore.ValueStore; | ||
} | ||
}); | ||
@@ -1000,2 +1006,4 @@ var _guid = __webpack_require__(/*! ./guid */ "./out-es5/guid.js"); | ||
var _html = __webpack_require__(/*! ./html */ "./out-es5/html.js"); | ||
var _valueStore = __webpack_require__(/*! ./value-store */ "./out-es5/value-store.js"); | ||
//# sourceMappingURL=index.js.map | ||
@@ -1019,6 +1027,7 @@ | ||
}); | ||
exports.pathContact = pathContact; | ||
exports.pathConcat = pathConcat; | ||
exports.pathContact = void 0; | ||
/** 连接多个路径 */ | ||
function pathContact() { | ||
function pathConcat() { | ||
for (var _len = arguments.length, paths = new Array(_len), _key = 0; _key < _len; _key++) { | ||
@@ -1046,2 +1055,5 @@ paths[_key] = arguments[_key]; | ||
} | ||
var pathContact = pathConcat; | ||
exports.pathContact = pathContact; | ||
//# sourceMappingURL=path.js.map | ||
@@ -1094,2 +1106,89 @@ | ||
/***/ }), | ||
/***/ "./out-es5/value-store.js": | ||
/*!********************************!*\ | ||
!*** ./out-es5/value-store.js ***! | ||
\********************************/ | ||
/*! no static exports found */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.ValueStore = void 0; | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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; Object.defineProperty(target, descriptor.key, descriptor); } } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
/** | ||
* 实现数据的存储,以及数据修改的通知 | ||
*/ | ||
var ValueStore = | ||
/*#__PURE__*/ | ||
function () { | ||
function ValueStore(value) { | ||
_classCallCheck(this, ValueStore); | ||
this.items = new Array(); | ||
this._value = value; | ||
} | ||
_createClass(ValueStore, [{ | ||
key: "attach", | ||
value: function attach(func, sender) { | ||
if (this.value !== undefined) { | ||
func(this.value, sender); | ||
} | ||
return this.add(func, sender); | ||
} | ||
}, { | ||
key: "add", | ||
value: function add(func, sender) { | ||
this.items.push({ | ||
func: func, | ||
sender: sender | ||
}); | ||
return func; | ||
} | ||
}, { | ||
key: "remove", | ||
value: function remove(func) { | ||
this.items = this.items.filter(function (o) { | ||
return o.func != func; | ||
}); | ||
} | ||
}, { | ||
key: "fire", | ||
value: function fire(value) { | ||
this.items.forEach(function (o) { | ||
return o.func(value, o.sender); | ||
}); | ||
} | ||
}, { | ||
key: "value", | ||
get: function get() { | ||
if (this._value === undefined) return null; | ||
return this._value; | ||
}, | ||
set: function set(value) { | ||
this._value = value; | ||
this.fire(value); | ||
} | ||
}]); | ||
return ValueStore; | ||
}(); | ||
exports.ValueStore = ValueStore; | ||
//# sourceMappingURL=value-store.js.map | ||
/***/ }) | ||
@@ -1096,0 +1195,0 @@ |
/*! | ||
* ~ | ||
* maishu-toolkit v1.4.13 | ||
* maishu-toolkit v1.4.14 | ||
* https://github.com/ansiboy/toolkit | ||
@@ -10,3 +10,3 @@ * | ||
*/ | ||
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}("undefined"==typeof window?global:window,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=2)}([function(e,t,r){"use strict";function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}Object.defineProperty(t,"__esModule",{value:!0}),t.errors=t.Errors=void 0;var o=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,r,o;return t=e,(r=[{key:"argumentNull",value:function(e){var t=new Error("Argument ".concat(e," cannt be null or emtpy."));return t.name="argumentNull",t}},{key:"routeDataFieldNull",value:function(e){var t="The ".concat(e," field of route data cannt be null."),r=new Error(t);return r.name="routeDataFieldNull",r}},{key:"argumentFieldNull",value:function(e,t){var r="The ".concat(e," field of ").concat(t," cannt be null."),n=new Error(r);return n.name="argumentFieldNull",n}},{key:"argumentTypeIncorrect",value:function(e,t){var r="Argument ".concat(e," type error, expected type is ").concat(t,"."),n=new Error(r);return n.name="argumentTypeIncorrect",n}}])&&n(t.prototype,r),o&&n(t,o),e}();t.Errors=o;var a=new o;t.errors=a},function(e,t,r){"use strict";function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}Object.defineProperty(t,"__esModule",{value:!0}),t.Callback=void 0;var o=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.funcs=new Array}var t,r,o;return t=e,o=[{key:"create",value:function(){return new e}}],(r=[{key:"add",value:function(e){this.funcs.push(e)}},{key:"remove",value:function(e){this.funcs=this.funcs.filter((function(t){return t!=e}))}},{key:"fire",value:function(e){this.funcs.forEach((function(t){return t(e)}))}}])&&n(t.prototype,r),o&&n(t,o),e}();t.Callback=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"guid",{enumerable:!0,get:function(){return n.guid}}),Object.defineProperty(t,"pathContact",{enumerable:!0,get:function(){return o.pathContact}}),Object.defineProperty(t,"Errors",{enumerable:!0,get:function(){return a.Errors}}),Object.defineProperty(t,"errors",{enumerable:!0,get:function(){return a.errors}}),Object.defineProperty(t,"Callback",{enumerable:!0,get:function(){return u.Callback}}),Object.defineProperty(t,"DataSource",{enumerable:!0,get:function(){return i.DataSource}}),Object.defineProperty(t,"DataSourceSelectArguments",{enumerable:!0,get:function(){return i.DataSourceSelectArguments}}),Object.defineProperty(t,"parseUrl",{enumerable:!0,get:function(){return c.parseUrl}}),Object.defineProperty(t,"deepEqual",{enumerable:!0,get:function(){return l.deepEqual}}),Object.defineProperty(t,"objectAssignDeep",{enumerable:!0,get:function(){return s.objectAssignDeep}}),Object.defineProperty(t,"formatDate",{enumerable:!0,get:function(){return f.formatDate}}),Object.defineProperty(t,"HTML",{enumerable:!0,get:function(){return y.HTML}});var n=r(3),o=r(4),a=r(0),u=r(1),i=r(5),c=r(6),l=r(7),s=r(8),f=r(9),y=r(10)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.guid=function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.pathContact=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(0==(t=t||[]).length)return"";if(1==t.length)return t[0];var n=t.join("/");return n=(n=(n=n.replace(/(\/+|\\+)/g,"/")).replace("http:/","http://")).replace("https:/","https://")}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DataSourceSelectArguments=t.DataSource=void 0;var n=r(0),o=r(1);function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var i=Object.assign(n.errors,{dataSourceCanntInsert:function(){return new Error("DataSource can not insert.")},dataSourceCanntDelete:function(){return new Error("DataSource can not delete.")},dataSourceCanntUpdate:function(){return new Error("DataSource can not update.")},primaryKeyNull:function(e){var t="Primary key named '".concat(e,"' value is null.");return new Error(t)},queryResultTypeError:function(){return new Error("Query result type error.")}}),c=function(){function e(t){a(this,e),this.inserting=new o.Callback,this.inserted=new o.Callback,this.deleting=new o.Callback,this.deleted=new o.Callback,this.updating=new o.Callback,this.updated=new o.Callback,this.selecting=new o.Callback,this.selected=new o.Callback,this.error=new o.Callback,this.args=t,this.primaryKeys=t.primaryKeys||[]}var t,r,n;return t=e,(r=[{key:"executeInsert",value:function(e,t){return this.args.insert(e,t)}},{key:"executeDelete",value:function(e,t){return this.args.delete(e,t)}},{key:"executeUpdate",value:function(e,t){return this.args.update(e,t)}},{key:"executeSelect",value:function(e){return e=e||{},this.args.select(e)}},{key:"insert",value:function(e,t,r){var n=this;if(!this.canInsert)throw i.dataSourceCanntInsert();if(!e)throw i.argumentNull("item");return"number"==typeof t&&(r=t,t=null),this.inserting.fire({sender:this,dataItem:e,index:r}),this.executeInsert(e,t).then((function(t){return Object.assign(e,t),n.inserted.fire({sender:n,dataItem:e,index:r}),t})).catch((function(e){throw n.processError(e,"insert"),e}))}},{key:"delete",value:function(e,t){var r=this;if(!this.canDelete)throw i.dataSourceCanntDelete();if(!e)throw i.argumentNull("item");return this.checkPrimaryKeys(e),this.deleting.fire({sender:this,dataItem:e}),this.executeDelete(e,t).then((function(t){return r.deleted.fire({sender:r,dataItem:e}),t})).catch((function(e){throw r.processError(e,"delete"),e}))}},{key:"update",value:function(e,t){var r=this;if(!this.canUpdate)throw i.dataSourceCanntUpdate();if(!e)throw i.argumentNull("item");return this.checkPrimaryKeys(e),this.updating.fire({sender:this,dataItem:e}),this.executeUpdate(e,t).then((function(t){return Object.assign(e,t),r.updated.fire({sender:r,dataItem:e}),t})).catch((function(e){throw r.processError(e,"update"),e}))}},{key:"isSameItem",value:function(e,t){if(null==e)throw i.argumentNull("theItem");if(null==t)throw i.argumentNull("otherItem");if(0==this.primaryKeys.length)return e==t;this.checkPrimaryKeys(e),this.checkPrimaryKeys(t);var r=!0,n=!1,o=void 0;try{for(var a,u=this.primaryKeys[Symbol.iterator]();!(r=(a=u.next()).done);r=!0){var c=a.value;if(e[c]!=t[c])return!1}}catch(e){n=!0,o=e}finally{try{r||null==u.return||u.return()}finally{if(n)throw o}}return!0}},{key:"checkPrimaryKeys",value:function(e){for(var t in e)if(null==e[t]&&this.primaryKeys.indexOf(t)>=0)throw i.primaryKeyNull(t)}},{key:"select",value:function(e){var t=this;return e=e||{},this.selecting.fire({sender:this,selectArguments:e}),this.executeSelect(e).then((function(r){var n,o;if(Array.isArray(r))n=r,o=r.length;else{if(void 0===r.dataItems||void 0===r.totalRowCount)throw i.queryResultTypeError();n=r.dataItems,o=r.totalRowCount}return t.selected.fire({sender:t,selectResult:{totalRowCount:o,dataItems:n},selectArguments:e}),{totalRowCount:o,dataItems:n}})).catch((function(e){throw t.processError(e,"select"),e}))}},{key:"processError",value:function(e,t){if(e.method=t,this.error.fire({sender:this,error:e}),!e.handled)throw e}},{key:"canDelete",get:function(){return null!=this.args.delete&&this.primaryKeys.length>0}},{key:"canInsert",get:function(){return null!=this.args.insert&&this.primaryKeys.length>0}},{key:"canUpdate",get:function(){return null!=this.args.update&&this.primaryKeys.length>0}}])&&u(t.prototype,r),n&&u(t,n),e}();t.DataSource=c;t.DataSourceSelectArguments=function e(){a(this,e),this.startRowIndex=0,this.maximumRows=2147483647}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parseUrl=function(e){var t=e.indexOf("?");return t<0?{}:function(e){var t,r=/\+/g,n=/([^&=]+)=?([^&]*)/g,o=function(e){return decodeURIComponent(e.replace(r," "))},a={};for(;t=n.exec(e);)a[o(t[1])]=o(t[2]);return a}(e.substr(t+1))}},function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.deepEqual=function e(t,r){if(t===r)return!0;if("object"==n(t)&&null!=t&&"object"==n(r)&&null!=r){if(Object.keys(t).length!=Object.keys(r).length)return!1;for(var o in t){if(!r.hasOwnProperty(o))return!1;if(!e(t[o],r[o]))return!1}return!0}return!1}},function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e){return null===e?"null":void 0===e?"undefined":"object"===n(e)?Array.isArray(e)?"array":"object":n(e)}function a(e){return"object"===o(e)?i(e):"array"===o(e)?u(e):e}function u(e){return e.map(a)}function i(e){var t={};for(var r in e)e.hasOwnProperty(r)&&(t[r]=a(e[r]));return t}function c(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r={arrayBehaviour:(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).arrayBehaviour||"replace"},n=t.map((function(e){return e||{}})),a=e||{},l=0;l<n.length;l++)for(var s=n[l],f=Object.keys(s),y=0;y<f.length;y++){var d=f[y],p=s[d],h=o(p),m=o(a[d]);if("object"===h)if("undefined"!==m){var b="object"===m?a[d]:{};a[d]=c({},[b,i(p)],r)}else a[d]=i(p);else if("array"===h)if("array"===m){var v=u(p);a[d]="merge"===r.arrayBehaviour?a[d].concat(v):v}else a[d]=u(p);else a[d]=p}return a}Object.defineProperty(t,"__esModule",{value:!0}),t.objectAssignDeep=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return c(e,r)},t.objectAssignDeepInto=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return c({},t)},t.withOptions=void 0;t.withOptions=function(e,t,r){return c(e,t,r)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.formatDate=function(e,t){if("string"==typeof e)return e;var r=e;return t?"".concat(r.getFullYear(),"-").concat(r.getMonth(),"-").concat(r.getDate()," ").concat(r.getHours()+1,":").concat(r.getMinutes()):"".concat(r.getFullYear(),"-").concat(r.getMonth(),"-").concat(r.getDate())}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HTML=void 0;var n=r(0);function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var a=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,r,a;return t=e,a=[{key:"addClassName",value:function(e,t){if(null==e)throw n.errors.argumentNull("element");if(!t)throw n.errors.argumentNull("addonClassName");var r;if(r=(r="string"==typeof e?e:e.className)||"",console.assert(null!=t),r.indexOf(t)>=0)return r;var o="".concat(r," ").concat(t);return"string"!=typeof e&&(e.className=o),o}},{key:"removeClassName",value:function(e,t){var r;return(r="string"==typeof e?e:e.className||"").indexOf(t)<0?r:(r=(r=(r=r||"").replace(new RegExp(t,"g"),"")).trim(),"string"!=typeof e&&(e.className=r),r)}}],(r=null)&&o(t.prototype,r),a&&o(t,a),e}();t.HTML=a}])})); | ||
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}("undefined"==typeof window?global:window,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=2)}([function(e,t,r){"use strict";function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}Object.defineProperty(t,"__esModule",{value:!0}),t.errors=t.Errors=void 0;var o=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,r,o;return t=e,(r=[{key:"argumentNull",value:function(e){var t=new Error("Argument ".concat(e," cannt be null or emtpy."));return t.name="argumentNull",t}},{key:"routeDataFieldNull",value:function(e){var t="The ".concat(e," field of route data cannt be null."),r=new Error(t);return r.name="routeDataFieldNull",r}},{key:"argumentFieldNull",value:function(e,t){var r="The ".concat(e," field of ").concat(t," cannt be null."),n=new Error(r);return n.name="argumentFieldNull",n}},{key:"argumentTypeIncorrect",value:function(e,t){var r="Argument ".concat(e," type error, expected type is ").concat(t,"."),n=new Error(r);return n.name="argumentTypeIncorrect",n}}])&&n(t.prototype,r),o&&n(t,o),e}();t.Errors=o;var u=new o;t.errors=u},function(e,t,r){"use strict";function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}Object.defineProperty(t,"__esModule",{value:!0}),t.Callback=void 0;var o=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.funcs=new Array}var t,r,o;return t=e,o=[{key:"create",value:function(){return new e}}],(r=[{key:"add",value:function(e){this.funcs.push(e)}},{key:"remove",value:function(e){this.funcs=this.funcs.filter((function(t){return t!=e}))}},{key:"fire",value:function(e){this.funcs.forEach((function(t){return t(e)}))}}])&&n(t.prototype,r),o&&n(t,o),e}();t.Callback=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"guid",{enumerable:!0,get:function(){return n.guid}}),Object.defineProperty(t,"pathContact",{enumerable:!0,get:function(){return o.pathContact}}),Object.defineProperty(t,"Errors",{enumerable:!0,get:function(){return u.Errors}}),Object.defineProperty(t,"errors",{enumerable:!0,get:function(){return u.errors}}),Object.defineProperty(t,"Callback",{enumerable:!0,get:function(){return a.Callback}}),Object.defineProperty(t,"DataSource",{enumerable:!0,get:function(){return i.DataSource}}),Object.defineProperty(t,"DataSourceSelectArguments",{enumerable:!0,get:function(){return i.DataSourceSelectArguments}}),Object.defineProperty(t,"parseUrl",{enumerable:!0,get:function(){return c.parseUrl}}),Object.defineProperty(t,"deepEqual",{enumerable:!0,get:function(){return l.deepEqual}}),Object.defineProperty(t,"objectAssignDeep",{enumerable:!0,get:function(){return s.objectAssignDeep}}),Object.defineProperty(t,"formatDate",{enumerable:!0,get:function(){return f.formatDate}}),Object.defineProperty(t,"HTML",{enumerable:!0,get:function(){return y.HTML}}),Object.defineProperty(t,"ValueStore",{enumerable:!0,get:function(){return d.ValueStore}});var n=r(3),o=r(4),u=r(0),a=r(1),i=r(5),c=r(6),l=r(7),s=r(8),f=r(9),y=r(10),d=r(11)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.guid=function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()}},function(e,t,r){"use strict";function n(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(0==(t=t||[]).length)return"";if(1==t.length)return t[0];var n=t.join("/");return n=(n=(n=n.replace(/(\/+|\\+)/g,"/")).replace("http:/","http://")).replace("https:/","https://")}Object.defineProperty(t,"__esModule",{value:!0}),t.pathConcat=n,t.pathContact=void 0;var o=n;t.pathContact=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DataSourceSelectArguments=t.DataSource=void 0;var n=r(0),o=r(1);function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var i=Object.assign(n.errors,{dataSourceCanntInsert:function(){return new Error("DataSource can not insert.")},dataSourceCanntDelete:function(){return new Error("DataSource can not delete.")},dataSourceCanntUpdate:function(){return new Error("DataSource can not update.")},primaryKeyNull:function(e){var t="Primary key named '".concat(e,"' value is null.");return new Error(t)},queryResultTypeError:function(){return new Error("Query result type error.")}}),c=function(){function e(t){u(this,e),this.inserting=new o.Callback,this.inserted=new o.Callback,this.deleting=new o.Callback,this.deleted=new o.Callback,this.updating=new o.Callback,this.updated=new o.Callback,this.selecting=new o.Callback,this.selected=new o.Callback,this.error=new o.Callback,this.args=t,this.primaryKeys=t.primaryKeys||[]}var t,r,n;return t=e,(r=[{key:"executeInsert",value:function(e,t){return this.args.insert(e,t)}},{key:"executeDelete",value:function(e,t){return this.args.delete(e,t)}},{key:"executeUpdate",value:function(e,t){return this.args.update(e,t)}},{key:"executeSelect",value:function(e){return e=e||{},this.args.select(e)}},{key:"insert",value:function(e,t,r){var n=this;if(!this.canInsert)throw i.dataSourceCanntInsert();if(!e)throw i.argumentNull("item");return"number"==typeof t&&(r=t,t=null),this.inserting.fire({sender:this,dataItem:e,index:r}),this.executeInsert(e,t).then((function(t){return Object.assign(e,t),n.inserted.fire({sender:n,dataItem:e,index:r}),t})).catch((function(e){throw n.processError(e,"insert"),e}))}},{key:"delete",value:function(e,t){var r=this;if(!this.canDelete)throw i.dataSourceCanntDelete();if(!e)throw i.argumentNull("item");return this.checkPrimaryKeys(e),this.deleting.fire({sender:this,dataItem:e}),this.executeDelete(e,t).then((function(t){return r.deleted.fire({sender:r,dataItem:e}),t})).catch((function(e){throw r.processError(e,"delete"),e}))}},{key:"update",value:function(e,t){var r=this;if(!this.canUpdate)throw i.dataSourceCanntUpdate();if(!e)throw i.argumentNull("item");return this.checkPrimaryKeys(e),this.updating.fire({sender:this,dataItem:e}),this.executeUpdate(e,t).then((function(t){return Object.assign(e,t),r.updated.fire({sender:r,dataItem:e}),t})).catch((function(e){throw r.processError(e,"update"),e}))}},{key:"isSameItem",value:function(e,t){if(null==e)throw i.argumentNull("theItem");if(null==t)throw i.argumentNull("otherItem");if(0==this.primaryKeys.length)return e==t;this.checkPrimaryKeys(e),this.checkPrimaryKeys(t);var r=!0,n=!1,o=void 0;try{for(var u,a=this.primaryKeys[Symbol.iterator]();!(r=(u=a.next()).done);r=!0){var c=u.value;if(e[c]!=t[c])return!1}}catch(e){n=!0,o=e}finally{try{r||null==a.return||a.return()}finally{if(n)throw o}}return!0}},{key:"checkPrimaryKeys",value:function(e){for(var t in e)if(null==e[t]&&this.primaryKeys.indexOf(t)>=0)throw i.primaryKeyNull(t)}},{key:"select",value:function(e){var t=this;return e=e||{},this.selecting.fire({sender:this,selectArguments:e}),this.executeSelect(e).then((function(r){var n,o;if(Array.isArray(r))n=r,o=r.length;else{if(void 0===r.dataItems||void 0===r.totalRowCount)throw i.queryResultTypeError();n=r.dataItems,o=r.totalRowCount}return t.selected.fire({sender:t,selectResult:{totalRowCount:o,dataItems:n},selectArguments:e}),{totalRowCount:o,dataItems:n}})).catch((function(e){throw t.processError(e,"select"),e}))}},{key:"processError",value:function(e,t){if(e.method=t,this.error.fire({sender:this,error:e}),!e.handled)throw e}},{key:"canDelete",get:function(){return null!=this.args.delete&&this.primaryKeys.length>0}},{key:"canInsert",get:function(){return null!=this.args.insert&&this.primaryKeys.length>0}},{key:"canUpdate",get:function(){return null!=this.args.update&&this.primaryKeys.length>0}}])&&a(t.prototype,r),n&&a(t,n),e}();t.DataSource=c;t.DataSourceSelectArguments=function e(){u(this,e),this.startRowIndex=0,this.maximumRows=2147483647}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parseUrl=function(e){var t=e.indexOf("?");return t<0?{}:function(e){var t,r=/\+/g,n=/([^&=]+)=?([^&]*)/g,o=function(e){return decodeURIComponent(e.replace(r," "))},u={};for(;t=n.exec(e);)u[o(t[1])]=o(t[2]);return u}(e.substr(t+1))}},function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.deepEqual=function e(t,r){if(t===r)return!0;if("object"==n(t)&&null!=t&&"object"==n(r)&&null!=r){if(Object.keys(t).length!=Object.keys(r).length)return!1;for(var o in t){if(!r.hasOwnProperty(o))return!1;if(!e(t[o],r[o]))return!1}return!0}return!1}},function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e){return null===e?"null":void 0===e?"undefined":"object"===n(e)?Array.isArray(e)?"array":"object":n(e)}function u(e){return"object"===o(e)?i(e):"array"===o(e)?a(e):e}function a(e){return e.map(u)}function i(e){var t={};for(var r in e)e.hasOwnProperty(r)&&(t[r]=u(e[r]));return t}function c(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r={arrayBehaviour:(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).arrayBehaviour||"replace"},n=t.map((function(e){return e||{}})),u=e||{},l=0;l<n.length;l++)for(var s=n[l],f=Object.keys(s),y=0;y<f.length;y++){var d=f[y],h=s[d],p=o(h),v=o(u[d]);if("object"===p)if("undefined"!==v){var m="object"===v?u[d]:{};u[d]=c({},[m,i(h)],r)}else u[d]=i(h);else if("array"===p)if("array"===v){var b=a(h);u[d]="merge"===r.arrayBehaviour?u[d].concat(b):b}else u[d]=a(h);else u[d]=h}return u}Object.defineProperty(t,"__esModule",{value:!0}),t.objectAssignDeep=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return c(e,r)},t.objectAssignDeepInto=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return c({},t)},t.withOptions=void 0;t.withOptions=function(e,t,r){return c(e,t,r)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.formatDate=function(e,t){if("string"==typeof e)return e;var r=e;return t?"".concat(r.getFullYear(),"-").concat(r.getMonth(),"-").concat(r.getDate()," ").concat(r.getHours()+1,":").concat(r.getMinutes()):"".concat(r.getFullYear(),"-").concat(r.getMonth(),"-").concat(r.getDate())}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HTML=void 0;var n=r(0);function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var u=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,r,u;return t=e,u=[{key:"addClassName",value:function(e,t){if(null==e)throw n.errors.argumentNull("element");if(!t)throw n.errors.argumentNull("addonClassName");var r;if(r=(r="string"==typeof e?e:e.className)||"",console.assert(null!=t),r.indexOf(t)>=0)return r;var o="".concat(r," ").concat(t);return"string"!=typeof e&&(e.className=o),o}},{key:"removeClassName",value:function(e,t){var r;return(r="string"==typeof e?e:e.className||"").indexOf(t)<0?r:(r=(r=(r=r||"").replace(new RegExp(t,"g"),"")).trim(),"string"!=typeof e&&(e.className=r),r)}}],(r=null)&&o(t.prototype,r),u&&o(t,u),e}();t.HTML=u},function(e,t,r){"use strict";function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}Object.defineProperty(t,"__esModule",{value:!0}),t.ValueStore=void 0;var o=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.items=new Array,this._value=t}var t,r,o;return t=e,(r=[{key:"attach",value:function(e,t){return void 0!==this.value&&e(this.value,t),this.add(e,t)}},{key:"add",value:function(e,t){return this.items.push({func:e,sender:t}),e}},{key:"remove",value:function(e){this.items=this.items.filter((function(t){return t.func!=e}))}},{key:"fire",value:function(e){this.items.forEach((function(t){return t.func(e,t.sender)}))}},{key:"value",get:function(){return void 0===this._value?null:this._value},set:function(e){this._value=e,this.fire(e)}}])&&n(t.prototype,r),o&&n(t,o),e}();t.ValueStore=o}])})); | ||
//# sourceMappingURL=index.es5.min.js.map |
/*! | ||
* ~ | ||
* maishu-toolkit v1.4.13 | ||
* maishu-toolkit v1.4.14 | ||
* https://github.com/ansiboy/toolkit | ||
@@ -639,3 +639,3 @@ * | ||
\**********************/ | ||
/*! exports provided: guid, pathContact, Errors, errors, Callback, DataSource, DataSourceSelectArguments, parseUrl, deepEqual, objectAssignDeep, formatDate, HTML */ | ||
/*! exports provided: guid, pathContact, Errors, errors, Callback, DataSource, DataSourceSelectArguments, parseUrl, deepEqual, objectAssignDeep, formatDate, HTML, ValueStore */ | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
@@ -679,2 +679,4 @@ | ||
/* harmony import */ var _value_store__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./value-store */ "./out/value-store.js"); | ||
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ValueStore", function() { return _value_store__WEBPACK_IMPORTED_MODULE_10__["ValueStore"]; }); | ||
@@ -692,2 +694,4 @@ | ||
/***/ }), | ||
@@ -699,3 +703,3 @@ | ||
\*********************/ | ||
/*! exports provided: pathContact */ | ||
/*! exports provided: pathConcat, pathContact */ | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
@@ -705,5 +709,6 @@ | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "pathConcat", function() { return pathConcat; }); | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "pathContact", function() { return pathContact; }); | ||
/** 连接多个路径 */ | ||
function pathContact(...paths) { | ||
function pathConcat(...paths) { | ||
paths = paths || []; | ||
@@ -726,2 +731,3 @@ if (paths.length == 0) | ||
} | ||
let pathContact = pathConcat; | ||
@@ -760,2 +766,50 @@ | ||
/***/ }), | ||
/***/ "./out/value-store.js": | ||
/*!****************************!*\ | ||
!*** ./out/value-store.js ***! | ||
\****************************/ | ||
/*! exports provided: ValueStore */ | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
"use strict"; | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ValueStore", function() { return ValueStore; }); | ||
/** | ||
* 实现数据的存储,以及数据修改的通知 | ||
*/ | ||
class ValueStore { | ||
constructor(value) { | ||
this.items = new Array(); | ||
this._value = value; | ||
} | ||
attach(func, sender) { | ||
if (this.value !== undefined) { | ||
func(this.value, sender); | ||
} | ||
return this.add(func, sender); | ||
} | ||
add(func, sender) { | ||
this.items.push({ func, sender }); | ||
return func; | ||
} | ||
remove(func) { | ||
this.items = this.items.filter(o => o.func != func); | ||
} | ||
fire(value) { | ||
this.items.forEach(o => o.func(value, o.sender)); | ||
} | ||
get value() { | ||
if (this._value === undefined) | ||
return null; | ||
return this._value; | ||
} | ||
set value(value) { | ||
this._value = value; | ||
this.fire(value); | ||
} | ||
} | ||
/***/ }) | ||
@@ -762,0 +816,0 @@ |
/*! | ||
* ~ | ||
* maishu-toolkit v1.4.13 | ||
* maishu-toolkit v1.4.14 | ||
* https://github.com/ansiboy/toolkit | ||
@@ -10,3 +10,3 @@ * | ||
*/ | ||
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}("undefined"==typeof window?global:window,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){"use strict";function n(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()}function i(...e){if(0==(e=e||[]).length)return"";if(1==e.length)return e[0];let t=e.join("/");return t=t.replace(/(\/+|\\+)/g,"/"),t=t.replace("http:/","http://"),t=t.replace("https:/","https://"),t}r.r(t);class s{argumentNull(e){let t=new Error(`Argument ${e} cannt be null or emtpy.`);return t.name="argumentNull",t}routeDataFieldNull(e){let t=new Error(`The ${e} field of route data cannt be null.`);return t.name="routeDataFieldNull",t}argumentFieldNull(e,t){let r=new Error(`The ${e} field of ${t} cannt be null.`);return r.name="argumentFieldNull",r}argumentTypeIncorrect(e,t){let r=new Error(`Argument ${e} type error, expected type is ${t}.`);return r.name="argumentTypeIncorrect",r}}let u=new s;class a{constructor(){this.funcs=new Array}add(e){this.funcs.push(e)}remove(e){this.funcs=this.funcs.filter(t=>t!=e)}fire(e){this.funcs.forEach(t=>t(e))}static create(){return new a}}let o=Object.assign(u,{dataSourceCanntInsert:()=>new Error("DataSource can not insert."),dataSourceCanntDelete:()=>new Error("DataSource can not delete."),dataSourceCanntUpdate:()=>new Error("DataSource can not update."),primaryKeyNull:e=>new Error(`Primary key named '${e}' value is null.`),queryResultTypeError:()=>new Error("Query result type error.")});class l{constructor(e){this.inserting=new a,this.inserted=new a,this.deleting=new a,this.deleted=new a,this.updating=new a,this.updated=new a,this.selecting=new a,this.selected=new a,this.error=new a,this.args=e,this.primaryKeys=e.primaryKeys||[]}get canDelete(){return null!=this.args.delete&&this.primaryKeys.length>0}get canInsert(){return null!=this.args.insert&&this.primaryKeys.length>0}get canUpdate(){return null!=this.args.update&&this.primaryKeys.length>0}executeInsert(e,t){return this.args.insert(e,t)}executeDelete(e,t){return this.args.delete(e,t)}executeUpdate(e,t){return this.args.update(e,t)}executeSelect(e){return e=e||{},this.args.select(e)}insert(e,t,r){if(!this.canInsert)throw o.dataSourceCanntInsert();if(!e)throw o.argumentNull("item");return"number"==typeof t&&(r=t,t=null),this.inserting.fire({sender:this,dataItem:e,index:r}),this.executeInsert(e,t).then(t=>(Object.assign(e,t),this.inserted.fire({sender:this,dataItem:e,index:r}),t)).catch(e=>{throw this.processError(e,"insert"),e})}delete(e,t){if(!this.canDelete)throw o.dataSourceCanntDelete();if(!e)throw o.argumentNull("item");return this.checkPrimaryKeys(e),this.deleting.fire({sender:this,dataItem:e}),this.executeDelete(e,t).then(t=>(this.deleted.fire({sender:this,dataItem:e}),t)).catch(e=>{throw this.processError(e,"delete"),e})}update(e,t){if(!this.canUpdate)throw o.dataSourceCanntUpdate();if(!e)throw o.argumentNull("item");return this.checkPrimaryKeys(e),this.updating.fire({sender:this,dataItem:e}),this.executeUpdate(e,t).then(t=>(Object.assign(e,t),this.updated.fire({sender:this,dataItem:e}),t)).catch(e=>{throw this.processError(e,"update"),e})}isSameItem(e,t){if(null==e)throw o.argumentNull("theItem");if(null==t)throw o.argumentNull("otherItem");if(0==this.primaryKeys.length)return e==t;this.checkPrimaryKeys(e),this.checkPrimaryKeys(t);for(let r of this.primaryKeys)if(e[r]!=t[r])return!1;return!0}checkPrimaryKeys(e){for(let t in e)if(null==e[t]&&this.primaryKeys.indexOf(t)>=0)throw o.primaryKeyNull(t)}select(e){return e=e||{},this.selecting.fire({sender:this,selectArguments:e}),this.executeSelect(e).then(t=>{let r,n;if(Array.isArray(t))r=t,n=t.length;else{if(void 0===t.dataItems||void 0===t.totalRowCount)throw o.queryResultTypeError();r=t.dataItems,n=t.totalRowCount}return this.selected.fire({sender:this,selectResult:{totalRowCount:n,dataItems:r},selectArguments:e}),{totalRowCount:n,dataItems:r}}).catch(e=>{throw this.processError(e,"select"),e})}processError(e,t){if(e.method=t,this.error.fire({sender:this,error:e}),!e.handled)throw e}}class c{constructor(){this.startRowIndex=0,this.maximumRows=2147483647}}function f(e){let t=e.indexOf("?");return t<0?{}:function(e){let t,r=/\+/g,n=/([^&=]+)=?([^&]*)/g,i=function(e){return decodeURIComponent(e.replace(r," "))},s={};for(;t=n.exec(e);)s[i(t[1])]=i(t[2]);return s}(e.substr(t+1))}function d(e,t){if(e===t)return!0;if("object"==typeof e&&null!=e&&"object"==typeof t&&null!=t){if(Object.keys(e).length!=Object.keys(t).length)return!1;for(var r in e){if(!t.hasOwnProperty(r))return!1;if(!d(e[r],t[r]))return!1}return!0}return!1}function h(e){return null===e?"null":void 0===e?"undefined":"object"==typeof e?Array.isArray(e)?"array":"object":typeof e}function p(e){return"object"===h(e)?y(e):"array"===h(e)?m(e):e}function m(e){return e.map(p)}function y(e){const t={};for(const r in e)e.hasOwnProperty(r)&&(t[r]=p(e[r]));return t}function g(e,t=[],r={}){const n={arrayBehaviour:r.arrayBehaviour||"replace"},i=t.map(e=>e||{}),s=e||{};for(let e=0;e<i.length;e++){const t=i[e],r=Object.keys(t);for(let e=0;e<r.length;e++){const i=r[e],u=t[i],a=h(u),o=h(s[i]);if("object"===a)if("undefined"!==o){const e="object"===o?s[i]:{};s[i]=g({},[e,y(u)],n)}else s[i]=y(u);else if("array"===a)if("array"===o){const e=m(u);s[i]="merge"===n.arrayBehaviour?s[i].concat(e):e}else s[i]=m(u);else s[i]=u}}return s}function w(e,...t){return g(e,t)}function b(e,t){if("string"==typeof e)return e;let r=e;return t?`${r.getFullYear()}-${r.getMonth()}-${r.getDate()} ${r.getHours()+1}:${r.getMinutes()}`:`${r.getFullYear()}-${r.getMonth()}-${r.getDate()}`}class x{static addClassName(e,t){if(null==e)throw u.argumentNull("element");if(!t)throw u.argumentNull("addonClassName");let r;if(r="string"==typeof e?e:e.className,r=r||"",console.assert(null!=t),r.indexOf(t)>=0)return r;let n=`${r} ${t}`;return"string"!=typeof e&&(e.className=n),n}static removeClassName(e,t){let r;return r="string"==typeof e?e:e.className||"",r.indexOf(t)<0?r:(r=r||"",r=r.replace(new RegExp(t,"g"),""),r=r.trim(),"string"!=typeof e&&(e.className=r),r)}}r.d(t,"guid",(function(){return n})),r.d(t,"pathContact",(function(){return i})),r.d(t,"Errors",(function(){return s})),r.d(t,"errors",(function(){return u})),r.d(t,"Callback",(function(){return a})),r.d(t,"DataSource",(function(){return l})),r.d(t,"DataSourceSelectArguments",(function(){return c})),r.d(t,"parseUrl",(function(){return f})),r.d(t,"deepEqual",(function(){return d})),r.d(t,"objectAssignDeep",(function(){return w})),r.d(t,"formatDate",(function(){return b})),r.d(t,"HTML",(function(){return x}))}])})); | ||
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}("undefined"==typeof window?global:window,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){"use strict";function n(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()}r.r(t);let i=function(...e){if(0==(e=e||[]).length)return"";if(1==e.length)return e[0];let t=e.join("/");return t=t.replace(/(\/+|\\+)/g,"/"),t=t.replace("http:/","http://"),t=t.replace("https:/","https://"),t};class s{argumentNull(e){let t=new Error(`Argument ${e} cannt be null or emtpy.`);return t.name="argumentNull",t}routeDataFieldNull(e){let t=new Error(`The ${e} field of route data cannt be null.`);return t.name="routeDataFieldNull",t}argumentFieldNull(e,t){let r=new Error(`The ${e} field of ${t} cannt be null.`);return r.name="argumentFieldNull",r}argumentTypeIncorrect(e,t){let r=new Error(`Argument ${e} type error, expected type is ${t}.`);return r.name="argumentTypeIncorrect",r}}let u=new s;class a{constructor(){this.funcs=new Array}add(e){this.funcs.push(e)}remove(e){this.funcs=this.funcs.filter(t=>t!=e)}fire(e){this.funcs.forEach(t=>t(e))}static create(){return new a}}let o=Object.assign(u,{dataSourceCanntInsert:()=>new Error("DataSource can not insert."),dataSourceCanntDelete:()=>new Error("DataSource can not delete."),dataSourceCanntUpdate:()=>new Error("DataSource can not update."),primaryKeyNull:e=>new Error(`Primary key named '${e}' value is null.`),queryResultTypeError:()=>new Error("Query result type error.")});class l{constructor(e){this.inserting=new a,this.inserted=new a,this.deleting=new a,this.deleted=new a,this.updating=new a,this.updated=new a,this.selecting=new a,this.selected=new a,this.error=new a,this.args=e,this.primaryKeys=e.primaryKeys||[]}get canDelete(){return null!=this.args.delete&&this.primaryKeys.length>0}get canInsert(){return null!=this.args.insert&&this.primaryKeys.length>0}get canUpdate(){return null!=this.args.update&&this.primaryKeys.length>0}executeInsert(e,t){return this.args.insert(e,t)}executeDelete(e,t){return this.args.delete(e,t)}executeUpdate(e,t){return this.args.update(e,t)}executeSelect(e){return e=e||{},this.args.select(e)}insert(e,t,r){if(!this.canInsert)throw o.dataSourceCanntInsert();if(!e)throw o.argumentNull("item");return"number"==typeof t&&(r=t,t=null),this.inserting.fire({sender:this,dataItem:e,index:r}),this.executeInsert(e,t).then(t=>(Object.assign(e,t),this.inserted.fire({sender:this,dataItem:e,index:r}),t)).catch(e=>{throw this.processError(e,"insert"),e})}delete(e,t){if(!this.canDelete)throw o.dataSourceCanntDelete();if(!e)throw o.argumentNull("item");return this.checkPrimaryKeys(e),this.deleting.fire({sender:this,dataItem:e}),this.executeDelete(e,t).then(t=>(this.deleted.fire({sender:this,dataItem:e}),t)).catch(e=>{throw this.processError(e,"delete"),e})}update(e,t){if(!this.canUpdate)throw o.dataSourceCanntUpdate();if(!e)throw o.argumentNull("item");return this.checkPrimaryKeys(e),this.updating.fire({sender:this,dataItem:e}),this.executeUpdate(e,t).then(t=>(Object.assign(e,t),this.updated.fire({sender:this,dataItem:e}),t)).catch(e=>{throw this.processError(e,"update"),e})}isSameItem(e,t){if(null==e)throw o.argumentNull("theItem");if(null==t)throw o.argumentNull("otherItem");if(0==this.primaryKeys.length)return e==t;this.checkPrimaryKeys(e),this.checkPrimaryKeys(t);for(let r of this.primaryKeys)if(e[r]!=t[r])return!1;return!0}checkPrimaryKeys(e){for(let t in e)if(null==e[t]&&this.primaryKeys.indexOf(t)>=0)throw o.primaryKeyNull(t)}select(e){return e=e||{},this.selecting.fire({sender:this,selectArguments:e}),this.executeSelect(e).then(t=>{let r,n;if(Array.isArray(t))r=t,n=t.length;else{if(void 0===t.dataItems||void 0===t.totalRowCount)throw o.queryResultTypeError();r=t.dataItems,n=t.totalRowCount}return this.selected.fire({sender:this,selectResult:{totalRowCount:n,dataItems:r},selectArguments:e}),{totalRowCount:n,dataItems:r}}).catch(e=>{throw this.processError(e,"select"),e})}processError(e,t){if(e.method=t,this.error.fire({sender:this,error:e}),!e.handled)throw e}}class c{constructor(){this.startRowIndex=0,this.maximumRows=2147483647}}function f(e){let t=e.indexOf("?");return t<0?{}:function(e){let t,r=/\+/g,n=/([^&=]+)=?([^&]*)/g,i=function(e){return decodeURIComponent(e.replace(r," "))},s={};for(;t=n.exec(e);)s[i(t[1])]=i(t[2]);return s}(e.substr(t+1))}function h(e,t){if(e===t)return!0;if("object"==typeof e&&null!=e&&"object"==typeof t&&null!=t){if(Object.keys(e).length!=Object.keys(t).length)return!1;for(var r in e){if(!t.hasOwnProperty(r))return!1;if(!h(e[r],t[r]))return!1}return!0}return!1}function d(e){return null===e?"null":void 0===e?"undefined":"object"==typeof e?Array.isArray(e)?"array":"object":typeof e}function p(e){return"object"===d(e)?y(e):"array"===d(e)?m(e):e}function m(e){return e.map(p)}function y(e){const t={};for(const r in e)e.hasOwnProperty(r)&&(t[r]=p(e[r]));return t}function g(e,t=[],r={}){const n={arrayBehaviour:r.arrayBehaviour||"replace"},i=t.map(e=>e||{}),s=e||{};for(let e=0;e<i.length;e++){const t=i[e],r=Object.keys(t);for(let e=0;e<r.length;e++){const i=r[e],u=t[i],a=d(u),o=d(s[i]);if("object"===a)if("undefined"!==o){const e="object"===o?s[i]:{};s[i]=g({},[e,y(u)],n)}else s[i]=y(u);else if("array"===a)if("array"===o){const e=m(u);s[i]="merge"===n.arrayBehaviour?s[i].concat(e):e}else s[i]=m(u);else s[i]=u}}return s}function w(e,...t){return g(e,t)}function b(e,t){if("string"==typeof e)return e;let r=e;return t?`${r.getFullYear()}-${r.getMonth()}-${r.getDate()} ${r.getHours()+1}:${r.getMinutes()}`:`${r.getFullYear()}-${r.getMonth()}-${r.getDate()}`}class v{static addClassName(e,t){if(null==e)throw u.argumentNull("element");if(!t)throw u.argumentNull("addonClassName");let r;if(r="string"==typeof e?e:e.className,r=r||"",console.assert(null!=t),r.indexOf(t)>=0)return r;let n=`${r} ${t}`;return"string"!=typeof e&&(e.className=n),n}static removeClassName(e,t){let r;return r="string"==typeof e?e:e.className||"",r.indexOf(t)<0?r:(r=r||"",r=r.replace(new RegExp(t,"g"),""),r=r.trim(),"string"!=typeof e&&(e.className=r),r)}}class x{constructor(e){this.items=new Array,this._value=e}attach(e,t){return void 0!==this.value&&e(this.value,t),this.add(e,t)}add(e,t){return this.items.push({func:e,sender:t}),e}remove(e){this.items=this.items.filter(t=>t.func!=e)}fire(e){this.items.forEach(t=>t.func(e,t.sender))}get value(){return void 0===this._value?null:this._value}set value(e){this._value=e,this.fire(e)}}r.d(t,"guid",(function(){return n})),r.d(t,"pathContact",(function(){return i})),r.d(t,"Errors",(function(){return s})),r.d(t,"errors",(function(){return u})),r.d(t,"Callback",(function(){return a})),r.d(t,"DataSource",(function(){return l})),r.d(t,"DataSourceSelectArguments",(function(){return c})),r.d(t,"parseUrl",(function(){return f})),r.d(t,"deepEqual",(function(){return h})),r.d(t,"objectAssignDeep",(function(){return w})),r.d(t,"formatDate",(function(){return b})),r.d(t,"HTML",(function(){return v})),r.d(t,"ValueStore",(function(){return x}))}])})); | ||
//# sourceMappingURL=index.min.js.map |
@@ -78,2 +78,8 @@ "use strict"; | ||
}); | ||
Object.defineProperty(exports, "ValueStore", { | ||
enumerable: true, | ||
get: function get() { | ||
return _valueStore.ValueStore; | ||
} | ||
}); | ||
@@ -99,2 +105,4 @@ var _guid = require("./guid"); | ||
var _html = require("./html"); | ||
var _valueStore = require("./value-store"); | ||
//# sourceMappingURL=index.js.map |
@@ -6,6 +6,7 @@ "use strict"; | ||
}); | ||
exports.pathContact = pathContact; | ||
exports.pathConcat = pathConcat; | ||
exports.pathContact = void 0; | ||
/** 连接多个路径 */ | ||
function pathContact() { | ||
function pathConcat() { | ||
for (var _len = arguments.length, paths = new Array(_len), _key = 0; _key < _len; _key++) { | ||
@@ -33,2 +34,5 @@ paths[_key] = arguments[_key]; | ||
} | ||
var pathContact = pathConcat; | ||
exports.pathContact = pathContact; | ||
//# sourceMappingURL=path.js.map |
@@ -11,1 +11,2 @@ export { guid } from "./guid"; | ||
export { HTML } from "./html"; | ||
export { ValueStore, ValueChangedCallback } from "./value-store"; |
@@ -11,1 +11,2 @@ export { guid } from "./guid"; | ||
export { HTML } from "./html"; | ||
export { ValueStore } from "./value-store"; |
/** 连接多个路径 */ | ||
export declare function pathContact(...paths: string[]): string; | ||
export declare function pathConcat(...paths: string[]): string; | ||
export declare let pathContact: typeof pathConcat; |
/** 连接多个路径 */ | ||
export function pathContact(...paths) { | ||
export function pathConcat(...paths) { | ||
paths = paths || []; | ||
@@ -20,1 +20,2 @@ if (paths.length == 0) | ||
} | ||
export let pathContact = pathConcat; |
{ | ||
"name": "maishu-toolkit", | ||
"version": "1.4.14", | ||
"version": "1.5.0", | ||
"main": "./dist/index.js", | ||
@@ -5,0 +5,0 @@ "types": "./out/index.d.ts", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
325159
61
3279