maishu-toolkit
Advanced tools
Comparing version 1.11.1 to 1.12.6
/*! | ||
* ~ | ||
* maishu-toolkit v1.10.0 | ||
* maishu-toolkit v1.12.5 | ||
* https://github.com/ansiboy/toolkit | ||
@@ -117,2 +117,9 @@ * | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.withOptions = exports.objectAssignDeepInto = exports.objectAssignDeep = void 0; | ||
/* | ||
@@ -127,11 +134,2 @@ * OBJECT ASSIGN DEEP | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.objectAssignDeep = objectAssignDeep; | ||
exports.objectAssignDeepInto = objectAssignDeepInto; | ||
exports.withOptions = void 0; | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function getTypeOf(input) { | ||
@@ -260,2 +258,3 @@ if (input === null) { | ||
exports.objectAssignDeep = objectAssignDeep; | ||
; | ||
@@ -274,2 +273,3 @@ /* | ||
exports.objectAssignDeepInto = objectAssignDeepInto; | ||
; | ||
@@ -300,7 +300,2 @@ /* | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.Callback = void 0; | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -312,2 +307,7 @@ | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.Callback = void 0; | ||
var Callback = /*#__PURE__*/function () { | ||
@@ -365,2 +365,8 @@ function Callback() { | ||
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; } | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -371,13 +377,7 @@ value: true | ||
var _errors = __webpack_require__(/*! ./errors */ "./out-es5/errors.js"); | ||
var errors_js_1 = __webpack_require__(/*! ./errors.js */ "./out-es5/errors.js"); | ||
var _callback = __webpack_require__(/*! ./callback */ "./out-es5/callback.js"); | ||
var callback_js_1 = __webpack_require__(/*! ./callback.js */ "./out-es5/callback.js"); | ||
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 errors = Object.assign(_errors.errors, { | ||
var errors = Object.assign(errors_js_1.errors, { | ||
dataSourceCanntInsert: function dataSourceCanntInsert() { | ||
@@ -406,15 +406,15 @@ return new Error("DataSource can not insert."); | ||
this.inserting = new _callback.Callback(); //callbacks1<DataSource<T>, T, number>(); | ||
this.inserting = new callback_js_1.Callback(); //callbacks1<DataSource<T>, T, number>(); | ||
this.inserted = new _callback.Callback(); | ||
this.deleting = new _callback.Callback(); //callbacks<DataSource<T>, T>(); | ||
this.inserted = new callback_js_1.Callback(); | ||
this.deleting = new callback_js_1.Callback(); //callbacks<DataSource<T>, T>(); | ||
this.deleted = new _callback.Callback(); //callbacks<DataSource<T>, T>(); | ||
this.deleted = new callback_js_1.Callback(); //callbacks<DataSource<T>, T>(); | ||
this.updating = new _callback.Callback(); | ||
this.updated = new _callback.Callback(); | ||
this.selecting = new _callback.Callback(); | ||
this.selected = new _callback.Callback(); //callbacks<DataSource<T>, DataSourceSelectResult<T>>(); | ||
this.updating = new callback_js_1.Callback(); | ||
this.updated = new callback_js_1.Callback(); | ||
this.selecting = new callback_js_1.Callback(); | ||
this.selected = new callback_js_1.Callback(); //callbacks<DataSource<T>, DataSourceSelectResult<T>>(); | ||
this.error = new _callback.Callback(); //callbacks<this, DataSourceError>(); | ||
this.error = new callback_js_1.Callback(); //callbacks<this, DataSourceError>(); | ||
@@ -673,9 +673,9 @@ this.args = args; | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.deepEqual = deepEqual; | ||
exports.deepEqual = void 0; | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function deepEqual(x, y) { | ||
@@ -700,2 +700,4 @@ if (x === y) { | ||
} | ||
exports.deepEqual = deepEqual; | ||
//# sourceMappingURL=deep-equal.js.map | ||
@@ -716,7 +718,2 @@ | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.errors = exports.Errors = void 0; | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -728,2 +725,7 @@ | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.errors = exports.Errors = void 0; | ||
var Errors = /*#__PURE__*/function () { | ||
@@ -784,4 +786,3 @@ function Errors() { | ||
exports.Errors = Errors; | ||
var errors = new Errors(); | ||
exports.errors = errors; | ||
exports.errors = new Errors(); | ||
//# sourceMappingURL=errors.js.map | ||
@@ -805,4 +806,3 @@ | ||
}); | ||
exports.formatDate = formatDate; | ||
exports.formatString = formatString; | ||
exports.format = exports.formatString = exports.formatDate = void 0; | ||
@@ -814,3 +814,3 @@ function formatDate(date, showHourMinutes, showSeconds) { | ||
if (showHourMinutes) { | ||
var str = "".concat(d.getFullYear(), "-").concat(d.getMonth(), "-").concat(d.getDate(), " ").concat(d.getHours(), ":").concat(d.getMinutes()); | ||
var str = "".concat(d.getFullYear(), "-").concat(d.getMonth() + 1, "-").concat(d.getDate(), " ").concat(d.getHours(), ":").concat(d.getMinutes()); | ||
if (showSeconds) str = "".concat(str, ":").concat(d.getSeconds()); | ||
@@ -820,5 +820,7 @@ return str; | ||
return "".concat(d.getFullYear(), "-").concat(d.getMonth(), "-").concat(d.getDate()); | ||
return "".concat(d.getFullYear(), "-").concat(d.getMonth() + 1, "-").concat(d.getDate()); | ||
} | ||
exports.formatDate = formatDate; | ||
function formatString(pattern) { | ||
@@ -837,2 +839,104 @@ var a = pattern; | ||
} | ||
exports.formatString = formatString; | ||
function format(value, format) { | ||
if (!format) return "".concat(value); | ||
var result = ''; | ||
for (var i = 0;;) { | ||
var open = format.indexOf('{', i); | ||
var close = format.indexOf('}', i); | ||
if (open < 0 && close < 0) { | ||
result += format.slice(i); | ||
break; | ||
} | ||
if (close > 0 && (close < open || open < 0)) { | ||
if (format.charAt(close + 1) !== '}') { | ||
throw new Error('Sys.Res.stringFormatBraceMismatch'); | ||
} | ||
result += format.slice(i, close + 1); | ||
i = close + 2; | ||
continue; | ||
} | ||
result += format.slice(i, open); | ||
i = open + 1; | ||
if (format.charAt(i) === '{') { | ||
result += '{'; | ||
i++; | ||
continue; | ||
} | ||
if (close < 0) throw new Error('Sys.Res.stringFormatBraceMismatch'); | ||
var brace = format.substring(i, close); | ||
var argFormat = brace; | ||
if (typeof value === "undefined" || value === null) { | ||
value = ''; | ||
} | ||
if (value instanceof Date) result = result + formatDate1(value, argFormat);else if (value instanceof Number || typeof value == 'number') result = result + formatNumber(value, argFormat);else result = result + value.toString(); | ||
i = close + 1; | ||
} | ||
return result; | ||
} | ||
exports.format = format; | ||
function formatDate1(value, format) { | ||
var y = value.getFullYear(); | ||
var m = value.getMonth() + 1; | ||
var d = value.getDate(); | ||
var h = value.getHours(); | ||
var M = value.getMinutes(); | ||
var s = value.getSeconds(); | ||
var twoDigit = function twoDigit(value) { | ||
var TEN = 10; | ||
if (value < TEN) return "0" + value; | ||
return value.toString(); | ||
}; | ||
switch (format) { | ||
case 'd': | ||
return "".concat(y, "-").concat(m, "-").concat(d); | ||
case 'g': | ||
return "".concat(y, "-").concat(m, "-").concat(d, " ").concat(h, ":").concat(M); | ||
case 'gg': | ||
return "".concat(y, "-").concat(twoDigit(m), "-").concat(twoDigit(d), " ").concat(twoDigit(h), ":").concat(twoDigit(M)); | ||
case 'G': | ||
return "".concat(y, "-").concat(m, "-").concat(d, " ").concat(h, ":").concat(M, ":").concat(s); | ||
case 'GG': | ||
return "".concat(y, "-").concat(twoDigit(m), "-").concat(twoDigit(d), " ").concat(twoDigit(h), ":").concat(twoDigit(M), ":").concat(twoDigit(s)); | ||
case 't': | ||
return "".concat(h, ":").concat(M); | ||
case 'T': | ||
return "".concat(h, ":").concat(M, ":").concat(s); | ||
} | ||
return value.toString(); | ||
} | ||
function formatNumber(value, format) { | ||
var reg = new RegExp('^C[0-9]+'); | ||
if (reg.test(format)) { | ||
var num = format.substr(1); | ||
return value.toFixed(num); | ||
} | ||
return value.toString(); | ||
} | ||
//# sourceMappingURL=format.js.map | ||
@@ -856,3 +960,3 @@ | ||
}); | ||
exports.guid = guid; | ||
exports.guid = void 0; | ||
@@ -866,2 +970,4 @@ function guid() { | ||
} | ||
exports.guid = guid; | ||
//# sourceMappingURL=guid.js.map | ||
@@ -882,2 +988,8 @@ | ||
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; } | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -888,10 +1000,4 @@ value: true | ||
var _errors = __webpack_require__(/*! ./errors */ "./out-es5/errors.js"); | ||
var errors_js_1 = __webpack_require__(/*! ./errors.js */ "./out-es5/errors.js"); | ||
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 HTML = /*#__PURE__*/function () { | ||
@@ -905,4 +1011,4 @@ function HTML() { | ||
value: function addClassName(element, addonClassName) { | ||
if (element == null) throw _errors.errors.argumentNull('element'); | ||
if (!addonClassName) throw _errors.errors.argumentNull('addonClassName'); | ||
if (element == null) throw errors_js_1.errors.argumentNull('element'); | ||
if (!addonClassName) throw errors_js_1.errors.argumentNull('addonClassName'); | ||
var sourceClassName; | ||
@@ -953,18 +1059,28 @@ if (typeof element == 'string') sourceClassName = element;else sourceClassName = element.className; | ||
}); | ||
exports.SingleInvoke = exports.ValueStore = exports.HTML = exports.format = exports.formatString = exports.formatDate = exports.objectAssignDeep = exports.deepEqual = exports.parseUrl = exports.DataSourceSelectArguments = exports.DataSource = exports.Callback = exports.errors = exports.Errors = exports.pathConcat = exports.guid = void 0; | ||
var guid_js_1 = __webpack_require__(/*! ./guid.js */ "./out-es5/guid.js"); | ||
Object.defineProperty(exports, "guid", { | ||
enumerable: true, | ||
get: function get() { | ||
return _guid.guid; | ||
return guid_js_1.guid; | ||
} | ||
}); | ||
var path_js_1 = __webpack_require__(/*! ./path.js */ "./out-es5/path.js"); | ||
Object.defineProperty(exports, "pathConcat", { | ||
enumerable: true, | ||
get: function get() { | ||
return _path.pathConcat; | ||
return path_js_1.pathConcat; | ||
} | ||
}); | ||
var errors_js_1 = __webpack_require__(/*! ./errors.js */ "./out-es5/errors.js"); | ||
Object.defineProperty(exports, "Errors", { | ||
enumerable: true, | ||
get: function get() { | ||
return _errors.Errors; | ||
return errors_js_1.Errors; | ||
} | ||
@@ -975,15 +1091,21 @@ }); | ||
get: function get() { | ||
return _errors.errors; | ||
return errors_js_1.errors; | ||
} | ||
}); | ||
var callback_js_1 = __webpack_require__(/*! ./callback.js */ "./out-es5/callback.js"); | ||
Object.defineProperty(exports, "Callback", { | ||
enumerable: true, | ||
get: function get() { | ||
return _callback.Callback; | ||
return callback_js_1.Callback; | ||
} | ||
}); | ||
var data_js_1 = __webpack_require__(/*! ./data.js */ "./out-es5/data.js"); | ||
Object.defineProperty(exports, "DataSource", { | ||
enumerable: true, | ||
get: function get() { | ||
return _data.DataSource; | ||
return data_js_1.DataSource; | ||
} | ||
@@ -994,27 +1116,39 @@ }); | ||
get: function get() { | ||
return _data.DataSourceSelectArguments; | ||
return data_js_1.DataSourceSelectArguments; | ||
} | ||
}); | ||
var url_js_1 = __webpack_require__(/*! ./url.js */ "./out-es5/url.js"); | ||
Object.defineProperty(exports, "parseUrl", { | ||
enumerable: true, | ||
get: function get() { | ||
return _url.parseUrl; | ||
return url_js_1.parseUrl; | ||
} | ||
}); | ||
var deep_equal_js_1 = __webpack_require__(/*! ./deep-equal.js */ "./out-es5/deep-equal.js"); | ||
Object.defineProperty(exports, "deepEqual", { | ||
enumerable: true, | ||
get: function get() { | ||
return _deepEqual.deepEqual; | ||
return deep_equal_js_1.deepEqual; | ||
} | ||
}); | ||
var assign_deep_js_1 = __webpack_require__(/*! ./assign-deep.js */ "./out-es5/assign-deep.js"); | ||
Object.defineProperty(exports, "objectAssignDeep", { | ||
enumerable: true, | ||
get: function get() { | ||
return _assignDeep.objectAssignDeep; | ||
return assign_deep_js_1.objectAssignDeep; | ||
} | ||
}); | ||
var format_js_1 = __webpack_require__(/*! ./format.js */ "./out-es5/format.js"); | ||
Object.defineProperty(exports, "formatDate", { | ||
enumerable: true, | ||
get: function get() { | ||
return _format.formatDate; | ||
return format_js_1.formatDate; | ||
} | ||
@@ -1025,47 +1159,38 @@ }); | ||
get: function get() { | ||
return _format.formatString; | ||
return format_js_1.formatString; | ||
} | ||
}); | ||
Object.defineProperty(exports, "format", { | ||
enumerable: true, | ||
get: function get() { | ||
return format_js_1.format; | ||
} | ||
}); | ||
var html_js_1 = __webpack_require__(/*! ./html.js */ "./out-es5/html.js"); | ||
Object.defineProperty(exports, "HTML", { | ||
enumerable: true, | ||
get: function get() { | ||
return _html.HTML; | ||
return html_js_1.HTML; | ||
} | ||
}); | ||
var value_store_js_1 = __webpack_require__(/*! ./value-store.js */ "./out-es5/value-store.js"); | ||
Object.defineProperty(exports, "ValueStore", { | ||
enumerable: true, | ||
get: function get() { | ||
return _valueStore.ValueStore; | ||
return value_store_js_1.ValueStore; | ||
} | ||
}); | ||
var single_inoke_js_1 = __webpack_require__(/*! ./single-inoke.js */ "./out-es5/single-inoke.js"); | ||
Object.defineProperty(exports, "SingleInvoke", { | ||
enumerable: true, | ||
get: function get() { | ||
return _singleInoke.SingleInvoke; | ||
return single_inoke_js_1.SingleInvoke; | ||
} | ||
}); | ||
var _guid = __webpack_require__(/*! ./guid */ "./out-es5/guid.js"); | ||
var _path = __webpack_require__(/*! ./path */ "./out-es5/path.js"); | ||
var _errors = __webpack_require__(/*! ./errors */ "./out-es5/errors.js"); | ||
var _callback = __webpack_require__(/*! ./callback */ "./out-es5/callback.js"); | ||
var _data = __webpack_require__(/*! ./data */ "./out-es5/data.js"); | ||
var _url = __webpack_require__(/*! ./url */ "./out-es5/url.js"); | ||
var _deepEqual = __webpack_require__(/*! ./deep-equal */ "./out-es5/deep-equal.js"); | ||
var _assignDeep = __webpack_require__(/*! ./assign-deep */ "./out-es5/assign-deep.js"); | ||
var _format = __webpack_require__(/*! ./format */ "./out-es5/format.js"); | ||
var _html = __webpack_require__(/*! ./html */ "./out-es5/html.js"); | ||
var _valueStore = __webpack_require__(/*! ./value-store */ "./out-es5/value-store.js"); | ||
var _singleInoke = __webpack_require__(/*! ./single-inoke */ "./out-es5/single-inoke.js"); | ||
//# sourceMappingURL=index.js.map | ||
@@ -1086,10 +1211,2 @@ | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.pathConcat = pathConcat; | ||
exports.partConcat2 = partConcat2; | ||
var _errors = __webpack_require__(/*! ./errors */ "./out-es5/errors.js"); | ||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } | ||
@@ -1103,4 +1220,13 @@ | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.partConcat2 = exports.pathConcat = void 0; | ||
var errors_js_1 = __webpack_require__(/*! ./errors.js */ "./out-es5/errors.js"); | ||
/** 连接多个路径 */ | ||
function pathConcat(path) { | ||
if (!path) throw errors_js_1.errors.argumentNull("path"); | ||
var prefix = ""; | ||
@@ -1118,5 +1244,7 @@ if (path.startsWith("http://")) prefix = "http://";else if (path.startsWith("https://")) prefix = "https://"; | ||
exports.pathConcat = pathConcat; | ||
function partConcat2(path1, path2) { | ||
if (path1.startsWith("http://") || path1.startsWith("https://")) throw _errors.errors.pathStartsHttp(path1); | ||
if (path2.startsWith("http://") || path2.startsWith("https://")) throw _errors.errors.pathStartsHttp(path2); | ||
if (path1.startsWith("http://") || path1.startsWith("https://")) throw errors_js_1.errors.pathStartsHttp(path1); | ||
if (path2.startsWith("http://") || path2.startsWith("https://")) throw errors_js_1.errors.pathStartsHttp(path2); | ||
path1 = path1.replace(/(\/+\\*|\\+\/*)/g, '/'); | ||
@@ -1150,2 +1278,4 @@ path2 = path2.replace(/(\/+\\*|\\+\/*)/g, '/'); | ||
} | ||
exports.partConcat2 = partConcat2; | ||
//# sourceMappingURL=path.js.map | ||
@@ -1166,2 +1296,8 @@ | ||
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; } | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -1172,10 +1308,4 @@ value: true | ||
var _valueStore = __webpack_require__(/*! ./value-store */ "./out-es5/value-store.js"); | ||
var value_store_js_1 = __webpack_require__(/*! ./value-store.js */ "./out-es5/value-store.js"); | ||
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 SingleInvoke = /*#__PURE__*/function () { | ||
@@ -1185,4 +1315,4 @@ function SingleInvoke(func) { | ||
this.result = new _valueStore.ValueStore(undefined); | ||
this.error = new _valueStore.ValueStore(undefined); | ||
this.result = new value_store_js_1.ValueStore(undefined); | ||
this.error = new value_store_js_1.ValueStore(undefined); | ||
this.executing = false; | ||
@@ -1195,4 +1325,4 @@ this.func = func; | ||
value: function clear() { | ||
this.result = new _valueStore.ValueStore(undefined); | ||
this.error = new _valueStore.ValueStore(undefined); | ||
this.result = new value_store_js_1.ValueStore(undefined); | ||
this.error = new value_store_js_1.ValueStore(undefined); | ||
} | ||
@@ -1257,3 +1387,3 @@ }, { | ||
}); | ||
exports.parseUrl = parseUrl; | ||
exports.parseUrl = void 0; | ||
@@ -1267,2 +1397,4 @@ function parseUrl(url) { | ||
exports.parseUrl = parseUrl; | ||
function pareeUrlQuery(query) { | ||
@@ -1300,7 +1432,2 @@ var match, | ||
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"); } } | ||
@@ -1312,5 +1439,10 @@ | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.ValueStore = void 0; | ||
/** | ||
* 实现数据的存储,以及数据修改的通知 | ||
*/ | ||
var ValueStore = /*#__PURE__*/function () { | ||
@@ -1317,0 +1449,0 @@ function ValueStore(value) { |
/*! | ||
* ~ | ||
* maishu-toolkit v1.10.0 | ||
* maishu-toolkit v1.12.5 | ||
* 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=3)}([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}},{key:"pathStartsHttp",value:function(e){var t="Path ".concat(e," start with http or https."),r=new Error(t);return r.name="pathStartsHttp",r}}])&&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";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 this._value},set:function(e){this._value=e,this.fire(e)}}])&&n(t.prototype,r),o&&n(t,o),e}();t.ValueStore=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,"pathConcat",{enumerable:!0,get:function(){return o.pathConcat}}),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,"formatString",{enumerable:!0,get:function(){return f.formatString}}),Object.defineProperty(t,"HTML",{enumerable:!0,get:function(){return h.HTML}}),Object.defineProperty(t,"ValueStore",{enumerable:!0,get:function(){return y.ValueStore}}),Object.defineProperty(t,"SingleInvoke",{enumerable:!0,get:function(){return d.SingleInvoke}});var n=r(4),o=r(5),u=r(0),a=r(1),i=r(6),c=r(7),l=r(8),s=r(9),f=r(10),h=r(11),y=r(2),d=r(12)},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.pathConcat=function(e){var t="";e.startsWith("http://")?t="http://":e.startsWith("https://")&&(t="https://");e=e.substring(t.length);for(var r=0;r<(arguments.length<=1?0:arguments.length-1);r++)e=u(e,r+1<1||arguments.length<=r+1?void 0:arguments[r+1]);return e=t+e},t.partConcat2=u;var n=r(0);function o(e){return function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function u(e,t){if(e.startsWith("http://")||e.startsWith("https://"))throw n.errors.pathStartsHttp(e);if(t.startsWith("http://")||t.startsWith("https://"))throw n.errors.pathStartsHttp(t);e=e.replace(/(\/+\\*|\\+\/*)/g,"/"),t=t.replace(/(\/+\\*|\\+\/*)/g,"/");var r=e.split("/").filter((function(e){return e})),u=t.split("/").filter((function(e){return e}));for("/"==e[0]&&r.unshift("");"."==u[0]||".."==u[0];)".."==u[0]&&r.length>0&&""!=r[r.length-1]&&r.pop(),u.shift();return 1==r.length&&""==r[0]&&0==u.length?"/":[].concat(o(r),o(u)).join("/")}},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),h=0;h<f.length;h++){var y=f[h],d=s[y],p=o(d),v=o(u[y]);if("object"===p)if("undefined"!==v){var m="object"===v?u[y]:{};u[y]=c({},[m,i(d)],r)}else u[y]=i(d);else if("array"===p)if("array"===v){var b=a(d);u[y]="merge"===r.arrayBehaviour?u[y].concat(b):b}else u[y]=a(d);else u[y]=d}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,r){if("string"==typeof e)return e;var n=e;if(t){var o="".concat(n.getFullYear(),"-").concat(n.getMonth(),"-").concat(n.getDate()," ").concat(n.getHours(),":").concat(n.getMinutes());return r&&(o="".concat(o,":").concat(n.getSeconds())),o}return"".concat(n.getFullYear(),"-").concat(n.getMonth(),"-").concat(n.getDate())},t.formatString=function(e){for(var t=e,r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];for(var u in n)t=t.replace("{"+u+"}",n[u]);return t}},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";Object.defineProperty(t,"__esModule",{value:!0}),t.SingleInvoke=void 0;var n=r(2);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(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.result=new n.ValueStore(void 0),this.error=new n.ValueStore(void 0),this.executing=!1,this.func=t}var t,r,u;return t=e,(r=[{key:"clear",value:function(){this.result=new n.ValueStore(void 0),this.error=new n.ValueStore(void 0)}},{key:"execute",value:function(){var e=this;return void 0!==this.result.value?Promise.resolve(this.result.value):this.executing?new Promise((function(t,r){e.result.add((function(e){t(e)})),e.error.add((function(e){r(e)}))})):(this.executing=!0,new Promise((function(t,r){e.func().then((function(r){e.result.value=r||null,e.executing=!1,t(r)})).catch((function(t){e.error=t,e.executing=!1,r(t)}))})))}}])&&o(t.prototype,r),u&&o(t,u),e}();t.SingleInvoke=u}])})); | ||
!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=3)}([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}},{key:"pathStartsHttp",value:function(e){var t="Path ".concat(e," start with http or https."),r=new Error(t);return r.name="pathStartsHttp",r}}])&&n(t.prototype,r),o&&n(t,o),e}();t.Errors=o,t.errors=new o},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";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 this._value},set:function(e){this._value=e,this.fire(e)}}])&&n(t.prototype,r),o&&n(t,o),e}();t.ValueStore=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SingleInvoke=t.ValueStore=t.HTML=t.format=t.formatString=t.formatDate=t.objectAssignDeep=t.deepEqual=t.parseUrl=t.DataSourceSelectArguments=t.DataSource=t.Callback=t.errors=t.Errors=t.pathConcat=t.guid=void 0;var n=r(4);Object.defineProperty(t,"guid",{enumerable:!0,get:function(){return n.guid}});var o=r(5);Object.defineProperty(t,"pathConcat",{enumerable:!0,get:function(){return o.pathConcat}});var a=r(0);Object.defineProperty(t,"Errors",{enumerable:!0,get:function(){return a.Errors}}),Object.defineProperty(t,"errors",{enumerable:!0,get:function(){return a.errors}});var u=r(1);Object.defineProperty(t,"Callback",{enumerable:!0,get:function(){return u.Callback}});var i=r(6);Object.defineProperty(t,"DataSource",{enumerable:!0,get:function(){return i.DataSource}}),Object.defineProperty(t,"DataSourceSelectArguments",{enumerable:!0,get:function(){return i.DataSourceSelectArguments}});var c=r(7);Object.defineProperty(t,"parseUrl",{enumerable:!0,get:function(){return c.parseUrl}});var l=r(8);Object.defineProperty(t,"deepEqual",{enumerable:!0,get:function(){return l.deepEqual}});var s=r(9);Object.defineProperty(t,"objectAssignDeep",{enumerable:!0,get:function(){return s.objectAssignDeep}});var f=r(10);Object.defineProperty(t,"formatDate",{enumerable:!0,get:function(){return f.formatDate}}),Object.defineProperty(t,"formatString",{enumerable:!0,get:function(){return f.formatString}}),Object.defineProperty(t,"format",{enumerable:!0,get:function(){return f.format}});var h=r(11);Object.defineProperty(t,"HTML",{enumerable:!0,get:function(){return h.HTML}});var d=r(2);Object.defineProperty(t,"ValueStore",{enumerable:!0,get:function(){return d.ValueStore}});var y=r(12);Object.defineProperty(t,"SingleInvoke",{enumerable:!0,get:function(){return y.SingleInvoke}})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.guid=void 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(e){return function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}Object.defineProperty(t,"__esModule",{value:!0}),t.partConcat2=t.pathConcat=void 0;var o=r(0);function a(e,t){if(e.startsWith("http://")||e.startsWith("https://"))throw o.errors.pathStartsHttp(e);if(t.startsWith("http://")||t.startsWith("https://"))throw o.errors.pathStartsHttp(t);e=e.replace(/(\/+\\*|\\+\/*)/g,"/"),t=t.replace(/(\/+\\*|\\+\/*)/g,"/");var r=e.split("/").filter((function(e){return e})),a=t.split("/").filter((function(e){return e}));for("/"==e[0]&&r.unshift("");"."==a[0]||".."==a[0];)".."==a[0]&&r.length>0&&""!=r[r.length-1]&&r.pop(),a.shift();return 1==r.length&&""==r[0]&&0==a.length?"/":[].concat(n(r),n(a)).join("/")}t.pathConcat=function(e){if(!e)throw o.errors.argumentNull("path");var t="";e.startsWith("http://")?t="http://":e.startsWith("https://")&&(t="https://"),e=e.substring(t.length);for(var r=0;r<(arguments.length<=1?0:arguments.length-1);r++)e=a(e,r+1<1||arguments.length<=r+1?void 0:arguments[r+1]);return e=t+e},t.partConcat2=a},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}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)}}Object.defineProperty(t,"__esModule",{value:!0}),t.DataSourceSelectArguments=t.DataSource=void 0;var a=r(0),u=r(1),i=Object.assign(a.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){n(this,e),this.inserting=new u.Callback,this.inserted=new u.Callback,this.deleting=new u.Callback,this.deleted=new u.Callback,this.updating=new u.Callback,this.updated=new u.Callback,this.selecting=new u.Callback,this.selected=new u.Callback,this.error=new u.Callback,this.args=t,this.primaryKeys=t.primaryKeys||[]}var t,r,a;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}}])&&o(t.prototype,r),a&&o(t,a),e}();t.DataSource=c;t.DataSourceSelectArguments=function e(){n(this,e),this.startRowIndex=0,this.maximumRows=2147483647}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parseUrl=void 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=void 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),h=0;h<f.length;h++){var d=f[h],y=s[d],p=o(y),v=o(a[d]);if("object"===p)if("undefined"!==v){var g="object"===v?a[d]:{};a[d]=c({},[g,i(y)],r)}else a[d]=i(y);else if("array"===p)if("array"===v){var m=u(y);a[d]="merge"===r.arrayBehaviour?a[d].concat(m):m}else a[d]=u(y);else a[d]=y}return a}Object.defineProperty(t,"__esModule",{value:!0}),t.withOptions=t.objectAssignDeepInto=t.objectAssignDeep=void 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=function(e,t,r){return c(e,t,r)}},function(e,t,r){"use strict";function n(e,t){var r=e.getFullYear(),n=e.getMonth()+1,o=e.getDate(),a=e.getHours(),u=e.getMinutes(),i=e.getSeconds(),c=function(e){return e<10?"0"+e:e.toString()};switch(t){case"d":return"".concat(r,"-").concat(n,"-").concat(o);case"g":return"".concat(r,"-").concat(n,"-").concat(o," ").concat(a,":").concat(u);case"gg":return"".concat(r,"-").concat(c(n),"-").concat(c(o)," ").concat(c(a),":").concat(c(u));case"G":return"".concat(r,"-").concat(n,"-").concat(o," ").concat(a,":").concat(u,":").concat(i);case"GG":return"".concat(r,"-").concat(c(n),"-").concat(c(o)," ").concat(c(a),":").concat(c(u),":").concat(c(i));case"t":return"".concat(a,":").concat(u);case"T":return"".concat(a,":").concat(u,":").concat(i)}return e.toString()}function o(e,t){if(new RegExp("^C[0-9]+").test(t)){var r=t.substr(1);return e.toFixed(r)}return e.toString()}Object.defineProperty(t,"__esModule",{value:!0}),t.format=t.formatString=t.formatDate=void 0,t.formatDate=function(e,t,r){if("string"==typeof e)return e;var n=e;if(t){var o="".concat(n.getFullYear(),"-").concat(n.getMonth()+1,"-").concat(n.getDate()," ").concat(n.getHours(),":").concat(n.getMinutes());return r&&(o="".concat(o,":").concat(n.getSeconds())),o}return"".concat(n.getFullYear(),"-").concat(n.getMonth()+1,"-").concat(n.getDate())},t.formatString=function(e){for(var t=e,r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];for(var a in n)t=t.replace("{"+a+"}",n[a]);return t},t.format=function(e,t){if(!t)return"".concat(e);for(var r="",a=0;;){var u=t.indexOf("{",a),i=t.indexOf("}",a);if(u<0&&i<0){r+=t.slice(a);break}if(i>0&&(i<u||u<0)){if("}"!==t.charAt(i+1))throw new Error("Sys.Res.stringFormatBraceMismatch");r+=t.slice(a,i+1),a=i+2}else if(r+=t.slice(a,u),a=u+1,"{"!==t.charAt(a)){if(i<0)throw new Error("Sys.Res.stringFormatBraceMismatch");var c=t.substring(a,i);null==e&&(e=""),e instanceof Date?r+=n(e,c):r+=e instanceof Number||"number"==typeof e?o(e,c):e.toString(),a=i+1}else r+="{",a++}return r}},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.HTML=void 0;var o=r(0),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 o.errors.argumentNull("element");if(!t)throw o.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 n="".concat(r," ").concat(t);return"string"!=typeof e&&(e.className=n),n}},{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)&&n(t.prototype,r),a&&n(t,a),e}();t.HTML=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.SingleInvoke=void 0;var o=r(2),a=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.result=new o.ValueStore(void 0),this.error=new o.ValueStore(void 0),this.executing=!1,this.func=t}var t,r,a;return t=e,(r=[{key:"clear",value:function(){this.result=new o.ValueStore(void 0),this.error=new o.ValueStore(void 0)}},{key:"execute",value:function(){var e=this;return void 0!==this.result.value?Promise.resolve(this.result.value):this.executing?new Promise((function(t,r){e.result.add((function(e){t(e)})),e.error.add((function(e){r(e)}))})):(this.executing=!0,new Promise((function(t,r){e.func().then((function(r){e.result.value=r||null,e.executing=!1,t(r)})).catch((function(t){e.error=t,e.executing=!1,r(t)}))})))}}])&&n(t.prototype,r),a&&n(t,a),e}();t.SingleInvoke=a}])})); | ||
//# sourceMappingURL=index.es5.min.js.map |
/*! | ||
* ~ | ||
* maishu-toolkit v1.10.0 | ||
* maishu-toolkit v1.12.5 | ||
* https://github.com/ansiboy/toolkit | ||
@@ -112,11 +112,9 @@ * | ||
\****************************/ | ||
/*! exports provided: objectAssignDeep, objectAssignDeepInto, withOptions */ | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
/*! no static exports found */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "objectAssignDeep", function() { return objectAssignDeep; }); | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "objectAssignDeepInto", function() { return objectAssignDeepInto; }); | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "withOptions", function() { return withOptions; }); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.withOptions = exports.objectAssignDeepInto = exports.objectAssignDeep = void 0; | ||
/* | ||
@@ -228,2 +226,3 @@ * OBJECT ASSIGN DEEP | ||
} | ||
exports.objectAssignDeep = objectAssignDeep; | ||
; | ||
@@ -236,2 +235,3 @@ /* | ||
} | ||
exports.objectAssignDeepInto = objectAssignDeepInto; | ||
; | ||
@@ -244,2 +244,3 @@ /* | ||
}; | ||
exports.withOptions = withOptions; | ||
@@ -253,8 +254,9 @@ | ||
\*************************/ | ||
/*! exports provided: Callback */ | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
/*! no static exports found */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Callback", function() { return Callback; }); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Callback = void 0; | ||
class Callback { | ||
@@ -277,2 +279,3 @@ constructor() { | ||
} | ||
exports.Callback = Callback; | ||
@@ -286,14 +289,12 @@ | ||
\*********************/ | ||
/*! exports provided: DataSource, DataSourceSelectArguments */ | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
/*! no static exports found */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DataSource", function() { return DataSource; }); | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DataSourceSelectArguments", function() { return DataSourceSelectArguments; }); | ||
/* harmony import */ var _errors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./errors */ "./out/errors.js"); | ||
/* harmony import */ var _callback__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./callback */ "./out/callback.js"); | ||
let errors = Object.assign(_errors__WEBPACK_IMPORTED_MODULE_0__["errors"], { | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DataSourceSelectArguments = exports.DataSource = void 0; | ||
const errors_js_1 = __webpack_require__(/*! ./errors.js */ "./out/errors.js"); | ||
const callback_js_1 = __webpack_require__(/*! ./callback.js */ "./out/callback.js"); | ||
let errors = Object.assign(errors_js_1.errors, { | ||
dataSourceCanntInsert() { | ||
@@ -319,11 +320,11 @@ return new Error("DataSource can not insert."); | ||
constructor(args) { | ||
this.inserting = new _callback__WEBPACK_IMPORTED_MODULE_1__["Callback"](); //callbacks1<DataSource<T>, T, number>(); | ||
this.inserted = new _callback__WEBPACK_IMPORTED_MODULE_1__["Callback"](); | ||
this.deleting = new _callback__WEBPACK_IMPORTED_MODULE_1__["Callback"](); //callbacks<DataSource<T>, T>(); | ||
this.deleted = new _callback__WEBPACK_IMPORTED_MODULE_1__["Callback"](); //callbacks<DataSource<T>, T>(); | ||
this.updating = new _callback__WEBPACK_IMPORTED_MODULE_1__["Callback"](); | ||
this.updated = new _callback__WEBPACK_IMPORTED_MODULE_1__["Callback"](); | ||
this.selecting = new _callback__WEBPACK_IMPORTED_MODULE_1__["Callback"](); | ||
this.selected = new _callback__WEBPACK_IMPORTED_MODULE_1__["Callback"](); //callbacks<DataSource<T>, DataSourceSelectResult<T>>(); | ||
this.error = new _callback__WEBPACK_IMPORTED_MODULE_1__["Callback"](); //callbacks<this, DataSourceError>(); | ||
this.inserting = new callback_js_1.Callback(); //callbacks1<DataSource<T>, T, number>(); | ||
this.inserted = new callback_js_1.Callback(); | ||
this.deleting = new callback_js_1.Callback(); //callbacks<DataSource<T>, T>(); | ||
this.deleted = new callback_js_1.Callback(); //callbacks<DataSource<T>, T>(); | ||
this.updating = new callback_js_1.Callback(); | ||
this.updated = new callback_js_1.Callback(); | ||
this.selecting = new callback_js_1.Callback(); | ||
this.selected = new callback_js_1.Callback(); //callbacks<DataSource<T>, DataSourceSelectResult<T>>(); | ||
this.error = new callback_js_1.Callback(); //callbacks<this, DataSourceError>(); | ||
this.args = args; | ||
@@ -458,2 +459,3 @@ this.primaryKeys = args.primaryKeys || []; | ||
} | ||
exports.DataSource = DataSource; | ||
class DataSourceSelectArguments { | ||
@@ -465,2 +467,3 @@ constructor() { | ||
} | ||
exports.DataSourceSelectArguments = DataSourceSelectArguments; | ||
@@ -474,8 +477,9 @@ | ||
\***************************/ | ||
/*! exports provided: deepEqual */ | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
/*! no static exports found */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "deepEqual", function() { return deepEqual; }); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.deepEqual = void 0; | ||
function deepEqual(x, y) { | ||
@@ -500,2 +504,3 @@ if (x === y) { | ||
} | ||
exports.deepEqual = deepEqual; | ||
@@ -509,9 +514,9 @@ | ||
\***********************/ | ||
/*! exports provided: Errors, errors */ | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
/*! no static exports found */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Errors", function() { return Errors; }); | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "errors", function() { return errors; }); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.errors = exports.Errors = void 0; | ||
class Errors { | ||
@@ -553,3 +558,4 @@ argumentNull(argumentName) { | ||
} | ||
let errors = new Errors(); | ||
exports.Errors = Errors; | ||
exports.errors = new Errors(); | ||
@@ -563,9 +569,9 @@ | ||
\***********************/ | ||
/*! exports provided: formatDate, formatString */ | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
/*! no static exports found */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "formatDate", function() { return formatDate; }); | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "formatString", function() { return formatString; }); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.format = exports.formatString = exports.formatDate = void 0; | ||
function formatDate(date, showHourMinutes, showSeconds) { | ||
@@ -576,3 +582,3 @@ if (typeof date == "string") | ||
if (showHourMinutes) { | ||
let str = `${d.getFullYear()}-${d.getMonth()}-${d.getDate()} ${d.getHours()}:${d.getMinutes()}`; | ||
let str = `${d.getFullYear()}-${d.getMonth() + 1}-${d.getDate()} ${d.getHours()}:${d.getMinutes()}`; | ||
if (showSeconds) | ||
@@ -582,4 +588,5 @@ str = `${str}:${d.getSeconds()}`; | ||
} | ||
return `${d.getFullYear()}-${d.getMonth()}-${d.getDate()}`; | ||
return `${d.getFullYear()}-${d.getMonth() + 1}-${d.getDate()}`; | ||
} | ||
exports.formatDate = formatDate; | ||
function formatString(pattern, ...args) { | ||
@@ -592,2 +599,86 @@ let a = pattern; | ||
} | ||
exports.formatString = formatString; | ||
function format(value, format) { | ||
if (!format) | ||
return `${value}`; | ||
var result = ''; | ||
for (var i = 0;;) { | ||
var open = format.indexOf('{', i); | ||
var close = format.indexOf('}', i); | ||
if ((open < 0) && (close < 0)) { | ||
result += format.slice(i); | ||
break; | ||
} | ||
if ((close > 0) && ((close < open) || (open < 0))) { | ||
if (format.charAt(close + 1) !== '}') { | ||
throw new Error('Sys.Res.stringFormatBraceMismatch'); | ||
} | ||
result += format.slice(i, close + 1); | ||
i = close + 2; | ||
continue; | ||
} | ||
result += format.slice(i, open); | ||
i = open + 1; | ||
if (format.charAt(i) === '{') { | ||
result += '{'; | ||
i++; | ||
continue; | ||
} | ||
if (close < 0) | ||
throw new Error('Sys.Res.stringFormatBraceMismatch'); | ||
var brace = format.substring(i, close); | ||
var argFormat = brace; | ||
if (typeof (value) === "undefined" || value === null) { | ||
value = ''; | ||
} | ||
if (value instanceof Date) | ||
result = result + formatDate1(value, argFormat); | ||
else if (value instanceof Number || typeof value == 'number') | ||
result = result + formatNumber(value, argFormat); | ||
else | ||
result = result + value.toString(); | ||
i = close + 1; | ||
} | ||
return result; | ||
} | ||
exports.format = format; | ||
function formatDate1(value, format) { | ||
let y = value.getFullYear(); | ||
let m = value.getMonth() + 1; | ||
let d = value.getDate(); | ||
let h = value.getHours(); | ||
let M = value.getMinutes(); | ||
let s = value.getSeconds(); | ||
let twoDigit = function (value) { | ||
const TEN = 10; | ||
if (value < TEN) | ||
return `0` + value; | ||
return value.toString(); | ||
}; | ||
switch (format) { | ||
case 'd': | ||
return `${y}-${m}-${d}`; | ||
case 'g': | ||
return `${y}-${m}-${d} ${h}:${M}`; | ||
case 'gg': | ||
return `${y}-${twoDigit(m)}-${twoDigit(d)} ${twoDigit(h)}:${twoDigit(M)}`; | ||
case 'G': | ||
return `${y}-${m}-${d} ${h}:${M}:${s}`; | ||
case 'GG': | ||
return `${y}-${twoDigit(m)}-${twoDigit(d)} ${twoDigit(h)}:${twoDigit(M)}:${twoDigit(s)}`; | ||
case 't': | ||
return `${h}:${M}`; | ||
case 'T': | ||
return `${h}:${M}:${s}`; | ||
} | ||
return value.toString(); | ||
} | ||
function formatNumber(value, format) { | ||
let reg = new RegExp('^C[0-9]+'); | ||
if (reg.test(format)) { | ||
let num = format.substr(1); | ||
return value.toFixed(num); | ||
} | ||
return value.toString(); | ||
} | ||
@@ -601,8 +692,9 @@ | ||
\*********************/ | ||
/*! exports provided: guid */ | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
/*! no static exports found */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "guid", function() { return guid; }); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.guid = void 0; | ||
function guid() { | ||
@@ -617,2 +709,3 @@ function s4() { | ||
} | ||
exports.guid = guid; | ||
@@ -626,16 +719,16 @@ | ||
\*********************/ | ||
/*! exports provided: HTML */ | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
/*! no static exports found */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HTML", function() { return HTML; }); | ||
/* harmony import */ var _errors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./errors */ "./out/errors.js"); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.HTML = void 0; | ||
const errors_js_1 = __webpack_require__(/*! ./errors.js */ "./out/errors.js"); | ||
class HTML { | ||
static addClassName(element, addonClassName) { | ||
if (element == null) | ||
throw _errors__WEBPACK_IMPORTED_MODULE_0__["errors"].argumentNull('element'); | ||
throw errors_js_1.errors.argumentNull('element'); | ||
if (!addonClassName) | ||
throw _errors__WEBPACK_IMPORTED_MODULE_0__["errors"].argumentNull('addonClassName'); | ||
throw errors_js_1.errors.argumentNull('addonClassName'); | ||
let sourceClassName; | ||
@@ -671,2 +764,3 @@ if (typeof element == 'string') | ||
} | ||
exports.HTML = HTML; | ||
@@ -680,63 +774,39 @@ | ||
\**********************/ | ||
/*! exports provided: guid, pathConcat, Errors, errors, Callback, DataSource, DataSourceSelectArguments, parseUrl, deepEqual, objectAssignDeep, formatDate, formatString, HTML, ValueStore, SingleInvoke */ | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
/*! no static exports found */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony import */ var _guid__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./guid */ "./out/guid.js"); | ||
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "guid", function() { return _guid__WEBPACK_IMPORTED_MODULE_0__["guid"]; }); | ||
/* harmony import */ var _path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./path */ "./out/path.js"); | ||
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "pathConcat", function() { return _path__WEBPACK_IMPORTED_MODULE_1__["pathConcat"]; }); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SingleInvoke = exports.ValueStore = exports.HTML = exports.format = exports.formatString = exports.formatDate = exports.objectAssignDeep = exports.deepEqual = exports.parseUrl = exports.DataSourceSelectArguments = exports.DataSource = exports.Callback = exports.errors = exports.Errors = exports.pathConcat = exports.guid = void 0; | ||
var guid_js_1 = __webpack_require__(/*! ./guid.js */ "./out/guid.js"); | ||
Object.defineProperty(exports, "guid", { enumerable: true, get: function () { return guid_js_1.guid; } }); | ||
var path_js_1 = __webpack_require__(/*! ./path.js */ "./out/path.js"); | ||
Object.defineProperty(exports, "pathConcat", { enumerable: true, get: function () { return path_js_1.pathConcat; } }); | ||
var errors_js_1 = __webpack_require__(/*! ./errors.js */ "./out/errors.js"); | ||
Object.defineProperty(exports, "Errors", { enumerable: true, get: function () { return errors_js_1.Errors; } }); | ||
Object.defineProperty(exports, "errors", { enumerable: true, get: function () { return errors_js_1.errors; } }); | ||
var callback_js_1 = __webpack_require__(/*! ./callback.js */ "./out/callback.js"); | ||
Object.defineProperty(exports, "Callback", { enumerable: true, get: function () { return callback_js_1.Callback; } }); | ||
var data_js_1 = __webpack_require__(/*! ./data.js */ "./out/data.js"); | ||
Object.defineProperty(exports, "DataSource", { enumerable: true, get: function () { return data_js_1.DataSource; } }); | ||
Object.defineProperty(exports, "DataSourceSelectArguments", { enumerable: true, get: function () { return data_js_1.DataSourceSelectArguments; } }); | ||
var url_js_1 = __webpack_require__(/*! ./url.js */ "./out/url.js"); | ||
Object.defineProperty(exports, "parseUrl", { enumerable: true, get: function () { return url_js_1.parseUrl; } }); | ||
var deep_equal_js_1 = __webpack_require__(/*! ./deep-equal.js */ "./out/deep-equal.js"); | ||
Object.defineProperty(exports, "deepEqual", { enumerable: true, get: function () { return deep_equal_js_1.deepEqual; } }); | ||
var assign_deep_js_1 = __webpack_require__(/*! ./assign-deep.js */ "./out/assign-deep.js"); | ||
Object.defineProperty(exports, "objectAssignDeep", { enumerable: true, get: function () { return assign_deep_js_1.objectAssignDeep; } }); | ||
var format_js_1 = __webpack_require__(/*! ./format.js */ "./out/format.js"); | ||
Object.defineProperty(exports, "formatDate", { enumerable: true, get: function () { return format_js_1.formatDate; } }); | ||
Object.defineProperty(exports, "formatString", { enumerable: true, get: function () { return format_js_1.formatString; } }); | ||
Object.defineProperty(exports, "format", { enumerable: true, get: function () { return format_js_1.format; } }); | ||
var html_js_1 = __webpack_require__(/*! ./html.js */ "./out/html.js"); | ||
Object.defineProperty(exports, "HTML", { enumerable: true, get: function () { return html_js_1.HTML; } }); | ||
var value_store_js_1 = __webpack_require__(/*! ./value-store.js */ "./out/value-store.js"); | ||
Object.defineProperty(exports, "ValueStore", { enumerable: true, get: function () { return value_store_js_1.ValueStore; } }); | ||
var single_inoke_js_1 = __webpack_require__(/*! ./single-inoke.js */ "./out/single-inoke.js"); | ||
Object.defineProperty(exports, "SingleInvoke", { enumerable: true, get: function () { return single_inoke_js_1.SingleInvoke; } }); | ||
/* harmony import */ var _errors__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./errors */ "./out/errors.js"); | ||
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Errors", function() { return _errors__WEBPACK_IMPORTED_MODULE_2__["Errors"]; }); | ||
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "errors", function() { return _errors__WEBPACK_IMPORTED_MODULE_2__["errors"]; }); | ||
/* harmony import */ var _callback__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./callback */ "./out/callback.js"); | ||
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Callback", function() { return _callback__WEBPACK_IMPORTED_MODULE_3__["Callback"]; }); | ||
/* harmony import */ var _data__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./data */ "./out/data.js"); | ||
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DataSource", function() { return _data__WEBPACK_IMPORTED_MODULE_4__["DataSource"]; }); | ||
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DataSourceSelectArguments", function() { return _data__WEBPACK_IMPORTED_MODULE_4__["DataSourceSelectArguments"]; }); | ||
/* harmony import */ var _url__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./url */ "./out/url.js"); | ||
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "parseUrl", function() { return _url__WEBPACK_IMPORTED_MODULE_5__["parseUrl"]; }); | ||
/* harmony import */ var _deep_equal__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./deep-equal */ "./out/deep-equal.js"); | ||
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "deepEqual", function() { return _deep_equal__WEBPACK_IMPORTED_MODULE_6__["deepEqual"]; }); | ||
/* harmony import */ var _assign_deep__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./assign-deep */ "./out/assign-deep.js"); | ||
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "objectAssignDeep", function() { return _assign_deep__WEBPACK_IMPORTED_MODULE_7__["objectAssignDeep"]; }); | ||
/* harmony import */ var _format__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./format */ "./out/format.js"); | ||
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "formatDate", function() { return _format__WEBPACK_IMPORTED_MODULE_8__["formatDate"]; }); | ||
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "formatString", function() { return _format__WEBPACK_IMPORTED_MODULE_8__["formatString"]; }); | ||
/* harmony import */ var _html__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./html */ "./out/html.js"); | ||
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "HTML", function() { return _html__WEBPACK_IMPORTED_MODULE_9__["HTML"]; }); | ||
/* 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"]; }); | ||
/* harmony import */ var _single_inoke__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./single-inoke */ "./out/single-inoke.js"); | ||
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SingleInvoke", function() { return _single_inoke__WEBPACK_IMPORTED_MODULE_11__["SingleInvoke"]; }); | ||
/***/ }), | ||
@@ -748,13 +818,14 @@ | ||
\*********************/ | ||
/*! exports provided: pathConcat, partConcat2 */ | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
/*! no static exports found */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
__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__, "partConcat2", function() { return partConcat2; }); | ||
/* harmony import */ var _errors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./errors */ "./out/errors.js"); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.partConcat2 = exports.pathConcat = void 0; | ||
const errors_js_1 = __webpack_require__(/*! ./errors.js */ "./out/errors.js"); | ||
/** 连接多个路径 */ | ||
function pathConcat(path, ...otherPaths) { | ||
if (!path) | ||
throw errors_js_1.errors.argumentNull("path"); | ||
let prefix = ""; | ||
@@ -772,7 +843,8 @@ if (path.startsWith("http://")) | ||
} | ||
exports.pathConcat = pathConcat; | ||
function partConcat2(path1, path2) { | ||
if (path1.startsWith("http://") || path1.startsWith("https://")) | ||
throw _errors__WEBPACK_IMPORTED_MODULE_0__["errors"].pathStartsHttp(path1); | ||
throw errors_js_1.errors.pathStartsHttp(path1); | ||
if (path2.startsWith("http://") || path2.startsWith("https://")) | ||
throw _errors__WEBPACK_IMPORTED_MODULE_0__["errors"].pathStartsHttp(path2); | ||
throw errors_js_1.errors.pathStartsHttp(path2); | ||
path1 = path1.replace(/(\/+\\*|\\+\/*)/g, '/'); | ||
@@ -797,2 +869,3 @@ path2 = path2.replace(/(\/+\\*|\\+\/*)/g, '/'); | ||
} | ||
exports.partConcat2 = partConcat2; | ||
@@ -806,14 +879,14 @@ | ||
\*****************************/ | ||
/*! exports provided: SingleInvoke */ | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
/*! no static exports found */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SingleInvoke", function() { return SingleInvoke; }); | ||
/* harmony import */ var _value_store__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./value-store */ "./out/value-store.js"); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SingleInvoke = void 0; | ||
const value_store_js_1 = __webpack_require__(/*! ./value-store.js */ "./out/value-store.js"); | ||
class SingleInvoke { | ||
constructor(func) { | ||
this.result = new _value_store__WEBPACK_IMPORTED_MODULE_0__["ValueStore"](undefined); | ||
this.error = new _value_store__WEBPACK_IMPORTED_MODULE_0__["ValueStore"](undefined); | ||
this.result = new value_store_js_1.ValueStore(undefined); | ||
this.error = new value_store_js_1.ValueStore(undefined); | ||
this.executing = false; | ||
@@ -823,4 +896,4 @@ this.func = func; | ||
clear() { | ||
this.result = new _value_store__WEBPACK_IMPORTED_MODULE_0__["ValueStore"](undefined); | ||
this.error = new _value_store__WEBPACK_IMPORTED_MODULE_0__["ValueStore"](undefined); | ||
this.result = new value_store_js_1.ValueStore(undefined); | ||
this.error = new value_store_js_1.ValueStore(undefined); | ||
} | ||
@@ -855,2 +928,3 @@ execute() { | ||
} | ||
exports.SingleInvoke = SingleInvoke; | ||
@@ -864,8 +938,9 @@ | ||
\********************/ | ||
/*! exports provided: parseUrl */ | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
/*! no static exports found */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseUrl", function() { return parseUrl; }); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.parseUrl = void 0; | ||
function parseUrl(url) { | ||
@@ -878,2 +953,3 @@ let i = url.indexOf("?"); | ||
} | ||
exports.parseUrl = parseUrl; | ||
function pareeUrlQuery(query) { | ||
@@ -897,8 +973,9 @@ let match, pl = /\+/g, // Regex for replacing addition symbol with a space | ||
\****************************/ | ||
/*! exports provided: ValueStore */ | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
/*! no static exports found */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ValueStore", function() { return ValueStore; }); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ValueStore = void 0; | ||
/** | ||
@@ -936,2 +1013,3 @@ * 实现数据的存储,以及数据修改的通知 | ||
} | ||
exports.ValueStore = ValueStore; | ||
@@ -938,0 +1016,0 @@ |
/*! | ||
* ~ | ||
* maishu-toolkit v1.10.0 | ||
* maishu-toolkit v1.12.5 | ||
* 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 s=t[n]={i:n,l:!1,exports:{}};return e[n].call(s.exports,s,s.exports,r),s.l=!0,s.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 s in e)r.d(n,s,function(t){return e[t]}.bind(null,s));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);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}pathStartsHttp(e){let t=new Error(`Path ${e} start with http or https.`);return t.name="pathStartsHttp",t}}let i=new s;function u(e,...t){let r="";e.startsWith("http://")?r="http://":e.startsWith("https://")&&(r="https://"),e=e.substring(r.length);for(let r=0;r<t.length;r++)e=a(e,t[r]);return e=r+e}function a(e,t){if(e.startsWith("http://")||e.startsWith("https://"))throw i.pathStartsHttp(e);if(t.startsWith("http://")||t.startsWith("https://"))throw i.pathStartsHttp(t);e=e.replace(/(\/+\\*|\\+\/*)/g,"/"),t=t.replace(/(\/+\\*|\\+\/*)/g,"/");let r=e.split("/").filter(e=>e),n=t.split("/").filter(e=>e);for("/"==e[0]&&r.unshift("");"."==n[0]||".."==n[0];)".."==n[0]&&r.length>0&&""!=r[r.length-1]&&r.pop(),n.shift();return 1==r.length&&""==r[0]&&0==n.length?"/":[...r,...n].join("/")}class o{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 o}}let l=Object.assign(i,{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 c{constructor(e){this.inserting=new o,this.inserted=new o,this.deleting=new o,this.deleted=new o,this.updating=new o,this.updated=new o,this.selecting=new o,this.selected=new o,this.error=new o,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 l.dataSourceCanntInsert();if(!e)throw l.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 l.dataSourceCanntDelete();if(!e)throw l.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 l.dataSourceCanntUpdate();if(!e)throw l.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 l.argumentNull("theItem");if(null==t)throw l.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 l.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 l.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 h{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,s=function(e){return decodeURIComponent(e.replace(r," "))},i={};for(;t=n.exec(e);)i[s(t[1])]=s(t[2]);return i}(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 p(e){return null===e?"null":void 0===e?"undefined":"object"==typeof e?Array.isArray(e)?"array":"object":typeof e}function m(e){return"object"===p(e)?y(e):"array"===p(e)?g(e):e}function g(e){return e.map(m)}function y(e){const t={};for(const r in e)e.hasOwnProperty(r)&&(t[r]=m(e[r]));return t}function w(e,t=[],r={}){const n={arrayBehaviour:r.arrayBehaviour||"replace"},s=t.map(e=>e||{}),i=e||{};for(let e=0;e<s.length;e++){const t=s[e],r=Object.keys(t);for(let e=0;e<r.length;e++){const s=r[e],u=t[s],a=p(u),o=p(i[s]);if("object"===a)if("undefined"!==o){const e="object"===o?i[s]:{};i[s]=w({},[e,y(u)],n)}else i[s]=y(u);else if("array"===a)if("array"===o){const e=g(u);i[s]="merge"===n.arrayBehaviour?i[s].concat(e):e}else i[s]=g(u);else i[s]=u}}return i}function b(e,...t){return w(e,t)}function v(e,t,r){if("string"==typeof e)return e;let n=e;if(t){let e=`${n.getFullYear()}-${n.getMonth()}-${n.getDate()} ${n.getHours()}:${n.getMinutes()}`;return r&&(e=`${e}:${n.getSeconds()}`),e}return`${n.getFullYear()}-${n.getMonth()}-${n.getDate()}`}function x(e,...t){let r=e;for(let e in t)r=r.replace("{"+e+"}",t[e]);return r}class S{static addClassName(e,t){if(null==e)throw i.argumentNull("element");if(!t)throw i.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 j{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 this._value}set value(e){this._value=e,this.fire(e)}}class I{constructor(e){this.result=new j(void 0),this.error=new j(void 0),this.executing=!1,this.func=e}clear(){this.result=new j(void 0),this.error=new j(void 0)}execute(){return void 0!==this.result.value?Promise.resolve(this.result.value):this.executing?new Promise((e,t)=>{this.result.add(t=>{e(t)}),this.error.add(e=>{t(e)})}):(this.executing=!0,new Promise((e,t)=>{this.func().then(t=>{this.result.value=t||null,this.executing=!1,e(t)}).catch(e=>{this.error=e,this.executing=!1,t(e)})}))}}r.d(t,"guid",(function(){return n})),r.d(t,"pathConcat",(function(){return u})),r.d(t,"Errors",(function(){return s})),r.d(t,"errors",(function(){return i})),r.d(t,"Callback",(function(){return o})),r.d(t,"DataSource",(function(){return c})),r.d(t,"DataSourceSelectArguments",(function(){return h})),r.d(t,"parseUrl",(function(){return f})),r.d(t,"deepEqual",(function(){return d})),r.d(t,"objectAssignDeep",(function(){return b})),r.d(t,"formatDate",(function(){return v})),r.d(t,"formatString",(function(){return x})),r.d(t,"HTML",(function(){return S})),r.d(t,"ValueStore",(function(){return j})),r.d(t,"SingleInvoke",(function(){return I}))}])})); | ||
!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=3)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.errors=t.Errors=void 0;class n{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}pathStartsHttp(e){let t=new Error(`Path ${e} start with http or https.`);return t.name="pathStartsHttp",t}}t.Errors=n,t.errors=new n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Callback=void 0;class n{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 n}}t.Callback=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ValueStore=void 0;t.ValueStore=class{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 this._value}set value(e){this._value=e,this.fire(e)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SingleInvoke=t.ValueStore=t.HTML=t.format=t.formatString=t.formatDate=t.objectAssignDeep=t.deepEqual=t.parseUrl=t.DataSourceSelectArguments=t.DataSource=t.Callback=t.errors=t.Errors=t.pathConcat=t.guid=void 0;var n=r(4);Object.defineProperty(t,"guid",{enumerable:!0,get:function(){return n.guid}});var i=r(5);Object.defineProperty(t,"pathConcat",{enumerable:!0,get:function(){return i.pathConcat}});var s=r(0);Object.defineProperty(t,"Errors",{enumerable:!0,get:function(){return s.Errors}}),Object.defineProperty(t,"errors",{enumerable:!0,get:function(){return s.errors}});var a=r(1);Object.defineProperty(t,"Callback",{enumerable:!0,get:function(){return a.Callback}});var o=r(6);Object.defineProperty(t,"DataSource",{enumerable:!0,get:function(){return o.DataSource}}),Object.defineProperty(t,"DataSourceSelectArguments",{enumerable:!0,get:function(){return o.DataSourceSelectArguments}});var u=r(7);Object.defineProperty(t,"parseUrl",{enumerable:!0,get:function(){return u.parseUrl}});var l=r(8);Object.defineProperty(t,"deepEqual",{enumerable:!0,get:function(){return l.deepEqual}});var c=r(9);Object.defineProperty(t,"objectAssignDeep",{enumerable:!0,get:function(){return c.objectAssignDeep}});var f=r(10);Object.defineProperty(t,"formatDate",{enumerable:!0,get:function(){return f.formatDate}}),Object.defineProperty(t,"formatString",{enumerable:!0,get:function(){return f.formatString}}),Object.defineProperty(t,"format",{enumerable:!0,get:function(){return f.format}});var d=r(11);Object.defineProperty(t,"HTML",{enumerable:!0,get:function(){return d.HTML}});var h=r(2);Object.defineProperty(t,"ValueStore",{enumerable:!0,get:function(){return h.ValueStore}});var p=r(12);Object.defineProperty(t,"SingleInvoke",{enumerable:!0,get:function(){return p.SingleInvoke}})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.guid=void 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.partConcat2=t.pathConcat=void 0;const n=r(0);function i(e,t){if(e.startsWith("http://")||e.startsWith("https://"))throw n.errors.pathStartsHttp(e);if(t.startsWith("http://")||t.startsWith("https://"))throw n.errors.pathStartsHttp(t);e=e.replace(/(\/+\\*|\\+\/*)/g,"/"),t=t.replace(/(\/+\\*|\\+\/*)/g,"/");let r=e.split("/").filter(e=>e),i=t.split("/").filter(e=>e);for("/"==e[0]&&r.unshift("");"."==i[0]||".."==i[0];)".."==i[0]&&r.length>0&&""!=r[r.length-1]&&r.pop(),i.shift();return 1==r.length&&""==r[0]&&0==i.length?"/":[...r,...i].join("/")}t.pathConcat=function(e,...t){if(!e)throw n.errors.argumentNull("path");let r="";e.startsWith("http://")?r="http://":e.startsWith("https://")&&(r="https://"),e=e.substring(r.length);for(let r=0;r<t.length;r++)e=i(e,t[r]);return e=r+e},t.partConcat2=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DataSourceSelectArguments=t.DataSource=void 0;const n=r(0),i=r(1);let s=Object.assign(n.errors,{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.")});t.DataSource=class{constructor(e){this.inserting=new i.Callback,this.inserted=new i.Callback,this.deleting=new i.Callback,this.deleted=new i.Callback,this.updating=new i.Callback,this.updated=new i.Callback,this.selecting=new i.Callback,this.selected=new i.Callback,this.error=new i.Callback,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 s.dataSourceCanntInsert();if(!e)throw s.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 s.dataSourceCanntDelete();if(!e)throw s.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 s.dataSourceCanntUpdate();if(!e)throw s.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 s.argumentNull("theItem");if(null==t)throw s.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 s.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 s.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}};t.DataSourceSelectArguments=class{constructor(){this.startRowIndex=0,this.maximumRows=2147483647}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parseUrl=void 0,t.parseUrl=function(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(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.deepEqual=void 0,t.deepEqual=function e(t,r){if(t===r)return!0;if("object"==typeof t&&null!=t&&"object"==typeof r&&null!=r){if(Object.keys(t).length!=Object.keys(r).length)return!1;for(var n in t){if(!r.hasOwnProperty(n))return!1;if(!e(t[n],r[n]))return!1}return!0}return!1}},function(e,t,r){"use strict";function n(e){return null===e?"null":void 0===e?"undefined":"object"==typeof e?Array.isArray(e)?"array":"object":typeof e}function i(e){return"object"===n(e)?a(e):"array"===n(e)?s(e):e}function s(e){return e.map(i)}function a(e){const t={};for(const r in e)e.hasOwnProperty(r)&&(t[r]=i(e[r]));return t}function o(e,t=[],r={}){const i={arrayBehaviour:r.arrayBehaviour||"replace"},u=t.map(e=>e||{}),l=e||{};for(let e=0;e<u.length;e++){const t=u[e],r=Object.keys(t);for(let e=0;e<r.length;e++){const u=r[e],c=t[u],f=n(c),d=n(l[u]);if("object"===f)if("undefined"!==d){const e="object"===d?l[u]:{};l[u]=o({},[e,a(c)],i)}else l[u]=a(c);else if("array"===f)if("array"===d){const e=s(c);l[u]="merge"===i.arrayBehaviour?l[u].concat(e):e}else l[u]=s(c);else l[u]=c}}return l}Object.defineProperty(t,"__esModule",{value:!0}),t.withOptions=t.objectAssignDeepInto=t.objectAssignDeep=void 0,t.objectAssignDeep=function(e,...t){return o(e,t)},t.objectAssignDeepInto=function(...e){return o({},e)};t.withOptions=function(e,t,r){return o(e,t,r)}},function(e,t,r){"use strict";function n(e,t){let r=e.getFullYear(),n=e.getMonth()+1,i=e.getDate(),s=e.getHours(),a=e.getMinutes(),o=e.getSeconds(),u=function(e){return e<10?"0"+e:e.toString()};switch(t){case"d":return`${r}-${n}-${i}`;case"g":return`${r}-${n}-${i} ${s}:${a}`;case"gg":return`${r}-${u(n)}-${u(i)} ${u(s)}:${u(a)}`;case"G":return`${r}-${n}-${i} ${s}:${a}:${o}`;case"GG":return`${r}-${u(n)}-${u(i)} ${u(s)}:${u(a)}:${u(o)}`;case"t":return`${s}:${a}`;case"T":return`${s}:${a}:${o}`}return e.toString()}function i(e,t){if(new RegExp("^C[0-9]+").test(t)){let r=t.substr(1);return e.toFixed(r)}return e.toString()}Object.defineProperty(t,"__esModule",{value:!0}),t.format=t.formatString=t.formatDate=void 0,t.formatDate=function(e,t,r){if("string"==typeof e)return e;let n=e;if(t){let e=`${n.getFullYear()}-${n.getMonth()+1}-${n.getDate()} ${n.getHours()}:${n.getMinutes()}`;return r&&(e=`${e}:${n.getSeconds()}`),e}return`${n.getFullYear()}-${n.getMonth()+1}-${n.getDate()}`},t.formatString=function(e,...t){let r=e;for(let e in t)r=r.replace("{"+e+"}",t[e]);return r},t.format=function(e,t){if(!t)return`${e}`;for(var r="",s=0;;){var a=t.indexOf("{",s),o=t.indexOf("}",s);if(a<0&&o<0){r+=t.slice(s);break}if(o>0&&(o<a||a<0)){if("}"!==t.charAt(o+1))throw new Error("Sys.Res.stringFormatBraceMismatch");r+=t.slice(s,o+1),s=o+2}else if(r+=t.slice(s,a),s=a+1,"{"!==t.charAt(s)){if(o<0)throw new Error("Sys.Res.stringFormatBraceMismatch");var u=t.substring(s,o);null==e&&(e=""),e instanceof Date?r+=n(e,u):r+=e instanceof Number||"number"==typeof e?i(e,u):e.toString(),s=o+1}else r+="{",s++}return r}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HTML=void 0;const n=r(0);t.HTML=class{static addClassName(e,t){if(null==e)throw n.errors.argumentNull("element");if(!t)throw n.errors.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 i=`${r} ${t}`;return"string"!=typeof e&&(e.className=i),i}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)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SingleInvoke=void 0;const n=r(2);t.SingleInvoke=class{constructor(e){this.result=new n.ValueStore(void 0),this.error=new n.ValueStore(void 0),this.executing=!1,this.func=e}clear(){this.result=new n.ValueStore(void 0),this.error=new n.ValueStore(void 0)}execute(){return void 0!==this.result.value?Promise.resolve(this.result.value):this.executing?new Promise((e,t)=>{this.result.add(t=>{e(t)}),this.error.add(e=>{t(e)})}):(this.executing=!0,new Promise((e,t)=>{this.func().then(t=>{this.result.value=t||null,this.executing=!1,e(t)}).catch(e=>{this.error=e,this.executing=!1,t(e)})}))}}}])})); | ||
//# sourceMappingURL=index.min.js.map |
'use strict'; | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.withOptions = exports.objectAssignDeepInto = exports.objectAssignDeep = void 0; | ||
/* | ||
@@ -11,11 +18,2 @@ * OBJECT ASSIGN DEEP | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.objectAssignDeep = objectAssignDeep; | ||
exports.objectAssignDeepInto = objectAssignDeepInto; | ||
exports.withOptions = void 0; | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function getTypeOf(input) { | ||
@@ -144,2 +142,3 @@ if (input === null) { | ||
exports.objectAssignDeep = objectAssignDeep; | ||
; | ||
@@ -158,2 +157,3 @@ /* | ||
exports.objectAssignDeepInto = objectAssignDeepInto; | ||
; | ||
@@ -160,0 +160,0 @@ /* |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.Callback = void 0; | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -14,2 +9,7 @@ | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.Callback = void 0; | ||
var Callback = /*#__PURE__*/function () { | ||
@@ -16,0 +16,0 @@ function Callback() { |
"use strict"; | ||
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; } | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -8,13 +14,7 @@ value: true | ||
var _errors = require("./errors"); | ||
var errors_js_1 = require("./errors.js"); | ||
var _callback = require("./callback"); | ||
var callback_js_1 = require("./callback.js"); | ||
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 errors = Object.assign(_errors.errors, { | ||
var errors = Object.assign(errors_js_1.errors, { | ||
dataSourceCanntInsert: function dataSourceCanntInsert() { | ||
@@ -43,15 +43,15 @@ return new Error("DataSource can not insert."); | ||
this.inserting = new _callback.Callback(); //callbacks1<DataSource<T>, T, number>(); | ||
this.inserting = new callback_js_1.Callback(); //callbacks1<DataSource<T>, T, number>(); | ||
this.inserted = new _callback.Callback(); | ||
this.deleting = new _callback.Callback(); //callbacks<DataSource<T>, T>(); | ||
this.inserted = new callback_js_1.Callback(); | ||
this.deleting = new callback_js_1.Callback(); //callbacks<DataSource<T>, T>(); | ||
this.deleted = new _callback.Callback(); //callbacks<DataSource<T>, T>(); | ||
this.deleted = new callback_js_1.Callback(); //callbacks<DataSource<T>, T>(); | ||
this.updating = new _callback.Callback(); | ||
this.updated = new _callback.Callback(); | ||
this.selecting = new _callback.Callback(); | ||
this.selected = new _callback.Callback(); //callbacks<DataSource<T>, DataSourceSelectResult<T>>(); | ||
this.updating = new callback_js_1.Callback(); | ||
this.updated = new callback_js_1.Callback(); | ||
this.selecting = new callback_js_1.Callback(); | ||
this.selected = new callback_js_1.Callback(); //callbacks<DataSource<T>, DataSourceSelectResult<T>>(); | ||
this.error = new _callback.Callback(); //callbacks<this, DataSourceError>(); | ||
this.error = new callback_js_1.Callback(); //callbacks<this, DataSourceError>(); | ||
@@ -58,0 +58,0 @@ this.args = args; |
"use strict"; | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.deepEqual = deepEqual; | ||
exports.deepEqual = void 0; | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function deepEqual(x, y) { | ||
@@ -29,2 +29,4 @@ if (x === y) { | ||
} | ||
exports.deepEqual = deepEqual; | ||
//# sourceMappingURL=deep-equal.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.errors = exports.Errors = void 0; | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -14,2 +9,7 @@ | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.errors = exports.Errors = void 0; | ||
var Errors = /*#__PURE__*/function () { | ||
@@ -70,4 +70,3 @@ function Errors() { | ||
exports.Errors = Errors; | ||
var errors = new Errors(); | ||
exports.errors = errors; | ||
exports.errors = new Errors(); | ||
//# sourceMappingURL=errors.js.map |
@@ -6,4 +6,3 @@ "use strict"; | ||
}); | ||
exports.formatDate = formatDate; | ||
exports.formatString = formatString; | ||
exports.format = exports.formatString = exports.formatDate = void 0; | ||
@@ -15,3 +14,3 @@ function formatDate(date, showHourMinutes, showSeconds) { | ||
if (showHourMinutes) { | ||
var str = "".concat(d.getFullYear(), "-").concat(d.getMonth(), "-").concat(d.getDate(), " ").concat(d.getHours(), ":").concat(d.getMinutes()); | ||
var str = "".concat(d.getFullYear(), "-").concat(d.getMonth() + 1, "-").concat(d.getDate(), " ").concat(d.getHours(), ":").concat(d.getMinutes()); | ||
if (showSeconds) str = "".concat(str, ":").concat(d.getSeconds()); | ||
@@ -21,5 +20,7 @@ return str; | ||
return "".concat(d.getFullYear(), "-").concat(d.getMonth(), "-").concat(d.getDate()); | ||
return "".concat(d.getFullYear(), "-").concat(d.getMonth() + 1, "-").concat(d.getDate()); | ||
} | ||
exports.formatDate = formatDate; | ||
function formatString(pattern) { | ||
@@ -38,2 +39,104 @@ var a = pattern; | ||
} | ||
exports.formatString = formatString; | ||
function format(value, format) { | ||
if (!format) return "".concat(value); | ||
var result = ''; | ||
for (var i = 0;;) { | ||
var open = format.indexOf('{', i); | ||
var close = format.indexOf('}', i); | ||
if (open < 0 && close < 0) { | ||
result += format.slice(i); | ||
break; | ||
} | ||
if (close > 0 && (close < open || open < 0)) { | ||
if (format.charAt(close + 1) !== '}') { | ||
throw new Error('Sys.Res.stringFormatBraceMismatch'); | ||
} | ||
result += format.slice(i, close + 1); | ||
i = close + 2; | ||
continue; | ||
} | ||
result += format.slice(i, open); | ||
i = open + 1; | ||
if (format.charAt(i) === '{') { | ||
result += '{'; | ||
i++; | ||
continue; | ||
} | ||
if (close < 0) throw new Error('Sys.Res.stringFormatBraceMismatch'); | ||
var brace = format.substring(i, close); | ||
var argFormat = brace; | ||
if (typeof value === "undefined" || value === null) { | ||
value = ''; | ||
} | ||
if (value instanceof Date) result = result + formatDate1(value, argFormat);else if (value instanceof Number || typeof value == 'number') result = result + formatNumber(value, argFormat);else result = result + value.toString(); | ||
i = close + 1; | ||
} | ||
return result; | ||
} | ||
exports.format = format; | ||
function formatDate1(value, format) { | ||
var y = value.getFullYear(); | ||
var m = value.getMonth() + 1; | ||
var d = value.getDate(); | ||
var h = value.getHours(); | ||
var M = value.getMinutes(); | ||
var s = value.getSeconds(); | ||
var twoDigit = function twoDigit(value) { | ||
var TEN = 10; | ||
if (value < TEN) return "0" + value; | ||
return value.toString(); | ||
}; | ||
switch (format) { | ||
case 'd': | ||
return "".concat(y, "-").concat(m, "-").concat(d); | ||
case 'g': | ||
return "".concat(y, "-").concat(m, "-").concat(d, " ").concat(h, ":").concat(M); | ||
case 'gg': | ||
return "".concat(y, "-").concat(twoDigit(m), "-").concat(twoDigit(d), " ").concat(twoDigit(h), ":").concat(twoDigit(M)); | ||
case 'G': | ||
return "".concat(y, "-").concat(m, "-").concat(d, " ").concat(h, ":").concat(M, ":").concat(s); | ||
case 'GG': | ||
return "".concat(y, "-").concat(twoDigit(m), "-").concat(twoDigit(d), " ").concat(twoDigit(h), ":").concat(twoDigit(M), ":").concat(twoDigit(s)); | ||
case 't': | ||
return "".concat(h, ":").concat(M); | ||
case 'T': | ||
return "".concat(h, ":").concat(M, ":").concat(s); | ||
} | ||
return value.toString(); | ||
} | ||
function formatNumber(value, format) { | ||
var reg = new RegExp('^C[0-9]+'); | ||
if (reg.test(format)) { | ||
var num = format.substr(1); | ||
return value.toFixed(num); | ||
} | ||
return value.toString(); | ||
} | ||
//# sourceMappingURL=format.js.map |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.guid = guid; | ||
exports.guid = void 0; | ||
@@ -16,2 +16,4 @@ function guid() { | ||
} | ||
exports.guid = guid; | ||
//# sourceMappingURL=guid.js.map |
"use strict"; | ||
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; } | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -8,10 +14,4 @@ value: true | ||
var _errors = require("./errors"); | ||
var errors_js_1 = require("./errors.js"); | ||
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 HTML = /*#__PURE__*/function () { | ||
@@ -25,4 +25,4 @@ function HTML() { | ||
value: function addClassName(element, addonClassName) { | ||
if (element == null) throw _errors.errors.argumentNull('element'); | ||
if (!addonClassName) throw _errors.errors.argumentNull('addonClassName'); | ||
if (element == null) throw errors_js_1.errors.argumentNull('element'); | ||
if (!addonClassName) throw errors_js_1.errors.argumentNull('addonClassName'); | ||
var sourceClassName; | ||
@@ -29,0 +29,0 @@ if (typeof element == 'string') sourceClassName = element;else sourceClassName = element.className; |
@@ -6,18 +6,28 @@ "use strict"; | ||
}); | ||
exports.SingleInvoke = exports.ValueStore = exports.HTML = exports.format = exports.formatString = exports.formatDate = exports.objectAssignDeep = exports.deepEqual = exports.parseUrl = exports.DataSourceSelectArguments = exports.DataSource = exports.Callback = exports.errors = exports.Errors = exports.pathConcat = exports.guid = void 0; | ||
var guid_js_1 = require("./guid.js"); | ||
Object.defineProperty(exports, "guid", { | ||
enumerable: true, | ||
get: function get() { | ||
return _guid.guid; | ||
return guid_js_1.guid; | ||
} | ||
}); | ||
var path_js_1 = require("./path.js"); | ||
Object.defineProperty(exports, "pathConcat", { | ||
enumerable: true, | ||
get: function get() { | ||
return _path.pathConcat; | ||
return path_js_1.pathConcat; | ||
} | ||
}); | ||
var errors_js_1 = require("./errors.js"); | ||
Object.defineProperty(exports, "Errors", { | ||
enumerable: true, | ||
get: function get() { | ||
return _errors.Errors; | ||
return errors_js_1.Errors; | ||
} | ||
@@ -28,15 +38,21 @@ }); | ||
get: function get() { | ||
return _errors.errors; | ||
return errors_js_1.errors; | ||
} | ||
}); | ||
var callback_js_1 = require("./callback.js"); | ||
Object.defineProperty(exports, "Callback", { | ||
enumerable: true, | ||
get: function get() { | ||
return _callback.Callback; | ||
return callback_js_1.Callback; | ||
} | ||
}); | ||
var data_js_1 = require("./data.js"); | ||
Object.defineProperty(exports, "DataSource", { | ||
enumerable: true, | ||
get: function get() { | ||
return _data.DataSource; | ||
return data_js_1.DataSource; | ||
} | ||
@@ -47,27 +63,39 @@ }); | ||
get: function get() { | ||
return _data.DataSourceSelectArguments; | ||
return data_js_1.DataSourceSelectArguments; | ||
} | ||
}); | ||
var url_js_1 = require("./url.js"); | ||
Object.defineProperty(exports, "parseUrl", { | ||
enumerable: true, | ||
get: function get() { | ||
return _url.parseUrl; | ||
return url_js_1.parseUrl; | ||
} | ||
}); | ||
var deep_equal_js_1 = require("./deep-equal.js"); | ||
Object.defineProperty(exports, "deepEqual", { | ||
enumerable: true, | ||
get: function get() { | ||
return _deepEqual.deepEqual; | ||
return deep_equal_js_1.deepEqual; | ||
} | ||
}); | ||
var assign_deep_js_1 = require("./assign-deep.js"); | ||
Object.defineProperty(exports, "objectAssignDeep", { | ||
enumerable: true, | ||
get: function get() { | ||
return _assignDeep.objectAssignDeep; | ||
return assign_deep_js_1.objectAssignDeep; | ||
} | ||
}); | ||
var format_js_1 = require("./format.js"); | ||
Object.defineProperty(exports, "formatDate", { | ||
enumerable: true, | ||
get: function get() { | ||
return _format.formatDate; | ||
return format_js_1.formatDate; | ||
} | ||
@@ -78,47 +106,38 @@ }); | ||
get: function get() { | ||
return _format.formatString; | ||
return format_js_1.formatString; | ||
} | ||
}); | ||
Object.defineProperty(exports, "format", { | ||
enumerable: true, | ||
get: function get() { | ||
return format_js_1.format; | ||
} | ||
}); | ||
var html_js_1 = require("./html.js"); | ||
Object.defineProperty(exports, "HTML", { | ||
enumerable: true, | ||
get: function get() { | ||
return _html.HTML; | ||
return html_js_1.HTML; | ||
} | ||
}); | ||
var value_store_js_1 = require("./value-store.js"); | ||
Object.defineProperty(exports, "ValueStore", { | ||
enumerable: true, | ||
get: function get() { | ||
return _valueStore.ValueStore; | ||
return value_store_js_1.ValueStore; | ||
} | ||
}); | ||
var single_inoke_js_1 = require("./single-inoke.js"); | ||
Object.defineProperty(exports, "SingleInvoke", { | ||
enumerable: true, | ||
get: function get() { | ||
return _singleInoke.SingleInvoke; | ||
return single_inoke_js_1.SingleInvoke; | ||
} | ||
}); | ||
var _guid = require("./guid"); | ||
var _path = require("./path"); | ||
var _errors = require("./errors"); | ||
var _callback = require("./callback"); | ||
var _data = require("./data"); | ||
var _url = require("./url"); | ||
var _deepEqual = require("./deep-equal"); | ||
var _assignDeep = require("./assign-deep"); | ||
var _format = require("./format"); | ||
var _html = require("./html"); | ||
var _valueStore = require("./value-store"); | ||
var _singleInoke = require("./single-inoke"); | ||
//# sourceMappingURL=index.js.map |
"use strict"; | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } | ||
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.loadModule = loadModule; | ||
exports.loadModule = void 0; | ||
var fs = _interopRequireWildcard(require("fs")); | ||
var fs = require("fs"); | ||
var path = _interopRequireWildcard(require("path")); | ||
var path = require("path"); | ||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } | ||
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } | ||
function loadModule(_x) { | ||
@@ -114,2 +108,4 @@ return _loadModule.apply(this, arguments); | ||
} | ||
exports.loadModule = loadModule; | ||
//# sourceMappingURL=load-module.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.pathConcat = pathConcat; | ||
exports.partConcat2 = partConcat2; | ||
var _errors = require("./errors"); | ||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } | ||
@@ -19,4 +11,13 @@ | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.partConcat2 = exports.pathConcat = void 0; | ||
var errors_js_1 = require("./errors.js"); | ||
/** 连接多个路径 */ | ||
function pathConcat(path) { | ||
if (!path) throw errors_js_1.errors.argumentNull("path"); | ||
var prefix = ""; | ||
@@ -34,5 +35,7 @@ if (path.startsWith("http://")) prefix = "http://";else if (path.startsWith("https://")) prefix = "https://"; | ||
exports.pathConcat = pathConcat; | ||
function partConcat2(path1, path2) { | ||
if (path1.startsWith("http://") || path1.startsWith("https://")) throw _errors.errors.pathStartsHttp(path1); | ||
if (path2.startsWith("http://") || path2.startsWith("https://")) throw _errors.errors.pathStartsHttp(path2); | ||
if (path1.startsWith("http://") || path1.startsWith("https://")) throw errors_js_1.errors.pathStartsHttp(path1); | ||
if (path2.startsWith("http://") || path2.startsWith("https://")) throw errors_js_1.errors.pathStartsHttp(path2); | ||
path1 = path1.replace(/(\/+\\*|\\+\/*)/g, '/'); | ||
@@ -66,2 +69,4 @@ path2 = path2.replace(/(\/+\\*|\\+\/*)/g, '/'); | ||
} | ||
exports.partConcat2 = partConcat2; | ||
//# sourceMappingURL=path.js.map |
"use strict"; | ||
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; } | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -8,10 +14,4 @@ value: true | ||
var _valueStore = require("./value-store"); | ||
var value_store_js_1 = require("./value-store.js"); | ||
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 SingleInvoke = /*#__PURE__*/function () { | ||
@@ -21,4 +21,4 @@ function SingleInvoke(func) { | ||
this.result = new _valueStore.ValueStore(undefined); | ||
this.error = new _valueStore.ValueStore(undefined); | ||
this.result = new value_store_js_1.ValueStore(undefined); | ||
this.error = new value_store_js_1.ValueStore(undefined); | ||
this.executing = false; | ||
@@ -31,4 +31,4 @@ this.func = func; | ||
value: function clear() { | ||
this.result = new _valueStore.ValueStore(undefined); | ||
this.error = new _valueStore.ValueStore(undefined); | ||
this.result = new value_store_js_1.ValueStore(undefined); | ||
this.error = new value_store_js_1.ValueStore(undefined); | ||
} | ||
@@ -35,0 +35,0 @@ }, { |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.parseUrl = parseUrl; | ||
exports.parseUrl = void 0; | ||
@@ -16,2 +16,4 @@ function parseUrl(url) { | ||
exports.parseUrl = parseUrl; | ||
function pareeUrlQuery(query) { | ||
@@ -18,0 +20,0 @@ var match, |
"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"); } } | ||
@@ -14,5 +9,10 @@ | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.ValueStore = void 0; | ||
/** | ||
* 实现数据的存储,以及数据修改的通知 | ||
*/ | ||
var ValueStore = /*#__PURE__*/function () { | ||
@@ -19,0 +19,0 @@ function ValueStore(value) { |
@@ -1,2 +0,2 @@ | ||
import { Callback } from "./callback"; | ||
import { Callback } from "./callback.js"; | ||
export interface DataSourceSelectResult<T> { | ||
@@ -77,2 +77,3 @@ totalRowCount: number; | ||
filter?: string | Partial<T>; | ||
selection?: string; | ||
constructor(); | ||
@@ -79,0 +80,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DataSourceSelectArguments = exports.DataSource = void 0; | ||
const errors_1 = require("./errors"); | ||
const callback_1 = require("./callback"); | ||
let errors = Object.assign(errors_1.errors, { | ||
const errors_js_1 = require("./errors.js"); | ||
const callback_js_1 = require("./callback.js"); | ||
let errors = Object.assign(errors_js_1.errors, { | ||
dataSourceCanntInsert() { | ||
@@ -27,11 +27,11 @@ return new Error("DataSource can not insert."); | ||
constructor(args) { | ||
this.inserting = new callback_1.Callback(); //callbacks1<DataSource<T>, T, number>(); | ||
this.inserted = new callback_1.Callback(); | ||
this.deleting = new callback_1.Callback(); //callbacks<DataSource<T>, T>(); | ||
this.deleted = new callback_1.Callback(); //callbacks<DataSource<T>, T>(); | ||
this.updating = new callback_1.Callback(); | ||
this.updated = new callback_1.Callback(); | ||
this.selecting = new callback_1.Callback(); | ||
this.selected = new callback_1.Callback(); //callbacks<DataSource<T>, DataSourceSelectResult<T>>(); | ||
this.error = new callback_1.Callback(); //callbacks<this, DataSourceError>(); | ||
this.inserting = new callback_js_1.Callback(); //callbacks1<DataSource<T>, T, number>(); | ||
this.inserted = new callback_js_1.Callback(); | ||
this.deleting = new callback_js_1.Callback(); //callbacks<DataSource<T>, T>(); | ||
this.deleted = new callback_js_1.Callback(); //callbacks<DataSource<T>, T>(); | ||
this.updating = new callback_js_1.Callback(); | ||
this.updated = new callback_js_1.Callback(); | ||
this.selecting = new callback_js_1.Callback(); | ||
this.selected = new callback_js_1.Callback(); //callbacks<DataSource<T>, DataSourceSelectResult<T>>(); | ||
this.error = new callback_js_1.Callback(); //callbacks<this, DataSourceError>(); | ||
this.args = args; | ||
@@ -38,0 +38,0 @@ this.primaryKeys = args.primaryKeys || []; |
export declare function formatDate(date: Date | string, showHourMinutes?: boolean, showSeconds?: boolean): string; | ||
export declare function formatString(pattern: string, ...args: string[]): string; | ||
export declare function format(value: any, format?: string): string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.formatString = exports.formatDate = void 0; | ||
exports.format = exports.formatString = exports.formatDate = void 0; | ||
function formatDate(date, showHourMinutes, showSeconds) { | ||
@@ -9,3 +9,3 @@ if (typeof date == "string") | ||
if (showHourMinutes) { | ||
let str = `${d.getFullYear()}-${d.getMonth()}-${d.getDate()} ${d.getHours()}:${d.getMinutes()}`; | ||
let str = `${d.getFullYear()}-${d.getMonth() + 1}-${d.getDate()} ${d.getHours()}:${d.getMinutes()}`; | ||
if (showSeconds) | ||
@@ -15,3 +15,3 @@ str = `${str}:${d.getSeconds()}`; | ||
} | ||
return `${d.getFullYear()}-${d.getMonth()}-${d.getDate()}`; | ||
return `${d.getFullYear()}-${d.getMonth() + 1}-${d.getDate()}`; | ||
} | ||
@@ -27,1 +27,84 @@ exports.formatDate = formatDate; | ||
exports.formatString = formatString; | ||
function format(value, format) { | ||
if (!format) | ||
return `${value}`; | ||
var result = ''; | ||
for (var i = 0;;) { | ||
var open = format.indexOf('{', i); | ||
var close = format.indexOf('}', i); | ||
if ((open < 0) && (close < 0)) { | ||
result += format.slice(i); | ||
break; | ||
} | ||
if ((close > 0) && ((close < open) || (open < 0))) { | ||
if (format.charAt(close + 1) !== '}') { | ||
throw new Error('Sys.Res.stringFormatBraceMismatch'); | ||
} | ||
result += format.slice(i, close + 1); | ||
i = close + 2; | ||
continue; | ||
} | ||
result += format.slice(i, open); | ||
i = open + 1; | ||
if (format.charAt(i) === '{') { | ||
result += '{'; | ||
i++; | ||
continue; | ||
} | ||
if (close < 0) | ||
throw new Error('Sys.Res.stringFormatBraceMismatch'); | ||
var brace = format.substring(i, close); | ||
var argFormat = brace; | ||
if (typeof (value) === "undefined" || value === null) { | ||
value = ''; | ||
} | ||
if (value instanceof Date) | ||
result = result + formatDate1(value, argFormat); | ||
else if (value instanceof Number || typeof value == 'number') | ||
result = result + formatNumber(value, argFormat); | ||
else | ||
result = result + value.toString(); | ||
i = close + 1; | ||
} | ||
return result; | ||
} | ||
exports.format = format; | ||
function formatDate1(value, format) { | ||
let y = value.getFullYear(); | ||
let m = value.getMonth() + 1; | ||
let d = value.getDate(); | ||
let h = value.getHours(); | ||
let M = value.getMinutes(); | ||
let s = value.getSeconds(); | ||
let twoDigit = function (value) { | ||
const TEN = 10; | ||
if (value < TEN) | ||
return `0` + value; | ||
return value.toString(); | ||
}; | ||
switch (format) { | ||
case 'd': | ||
return `${y}-${m}-${d}`; | ||
case 'g': | ||
return `${y}-${m}-${d} ${h}:${M}`; | ||
case 'gg': | ||
return `${y}-${twoDigit(m)}-${twoDigit(d)} ${twoDigit(h)}:${twoDigit(M)}`; | ||
case 'G': | ||
return `${y}-${m}-${d} ${h}:${M}:${s}`; | ||
case 'GG': | ||
return `${y}-${twoDigit(m)}-${twoDigit(d)} ${twoDigit(h)}:${twoDigit(M)}:${twoDigit(s)}`; | ||
case 't': | ||
return `${h}:${M}`; | ||
case 'T': | ||
return `${h}:${M}:${s}`; | ||
} | ||
return value.toString(); | ||
} | ||
function formatNumber(value, format) { | ||
let reg = new RegExp('^C[0-9]+'); | ||
if (reg.test(format)) { | ||
let num = format.substr(1); | ||
return value.toFixed(num); | ||
} | ||
return value.toString(); | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.HTML = void 0; | ||
const errors_1 = require("./errors"); | ||
const errors_js_1 = require("./errors.js"); | ||
class HTML { | ||
static addClassName(element, addonClassName) { | ||
if (element == null) | ||
throw errors_1.errors.argumentNull('element'); | ||
throw errors_js_1.errors.argumentNull('element'); | ||
if (!addonClassName) | ||
throw errors_1.errors.argumentNull('addonClassName'); | ||
throw errors_js_1.errors.argumentNull('addonClassName'); | ||
let sourceClassName; | ||
@@ -12,0 +12,0 @@ if (typeof element == 'string') |
@@ -1,12 +0,12 @@ | ||
export { guid } from "./guid"; | ||
export { pathConcat } from "./path"; | ||
export { Errors, errors } from "./errors"; | ||
export { Callback } from "./callback"; | ||
export { DataSource, DataSourceSelectArguments, DataSourceSelectResult, DataSourceArguments } from "./data"; | ||
export { parseUrl } from "./url"; | ||
export { deepEqual } from "./deep-equal"; | ||
export { objectAssignDeep } from "./assign-deep"; | ||
export { formatDate, formatString } from "./format"; | ||
export { HTML } from "./html"; | ||
export { ValueStore, ValueChangedCallback } from "./value-store"; | ||
export { SingleInvoke } from "./single-inoke"; | ||
export { guid } from "./guid.js"; | ||
export { pathConcat } from "./path.js"; | ||
export { Errors, errors } from "./errors.js"; | ||
export { Callback } from "./callback.js"; | ||
export { DataSource, DataSourceSelectArguments, DataSourceSelectResult, DataSourceArguments } from "./data.js"; | ||
export { parseUrl } from "./url.js"; | ||
export { deepEqual } from "./deep-equal.js"; | ||
export { objectAssignDeep } from "./assign-deep.js"; | ||
export { formatDate, formatString, format } from "./format.js"; | ||
export { HTML } from "./html.js"; | ||
export { ValueStore, ValueChangedCallback } from "./value-store.js"; | ||
export { SingleInvoke } from "./single-inoke.js"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SingleInvoke = exports.ValueStore = exports.HTML = exports.formatString = exports.formatDate = exports.objectAssignDeep = exports.deepEqual = exports.parseUrl = exports.DataSourceSelectArguments = exports.DataSource = exports.Callback = exports.errors = exports.Errors = exports.pathConcat = exports.guid = void 0; | ||
var guid_1 = require("./guid"); | ||
Object.defineProperty(exports, "guid", { enumerable: true, get: function () { return guid_1.guid; } }); | ||
var path_1 = require("./path"); | ||
Object.defineProperty(exports, "pathConcat", { enumerable: true, get: function () { return path_1.pathConcat; } }); | ||
var errors_1 = require("./errors"); | ||
Object.defineProperty(exports, "Errors", { enumerable: true, get: function () { return errors_1.Errors; } }); | ||
Object.defineProperty(exports, "errors", { enumerable: true, get: function () { return errors_1.errors; } }); | ||
var callback_1 = require("./callback"); | ||
Object.defineProperty(exports, "Callback", { enumerable: true, get: function () { return callback_1.Callback; } }); | ||
var data_1 = require("./data"); | ||
Object.defineProperty(exports, "DataSource", { enumerable: true, get: function () { return data_1.DataSource; } }); | ||
Object.defineProperty(exports, "DataSourceSelectArguments", { enumerable: true, get: function () { return data_1.DataSourceSelectArguments; } }); | ||
var url_1 = require("./url"); | ||
Object.defineProperty(exports, "parseUrl", { enumerable: true, get: function () { return url_1.parseUrl; } }); | ||
var deep_equal_1 = require("./deep-equal"); | ||
Object.defineProperty(exports, "deepEqual", { enumerable: true, get: function () { return deep_equal_1.deepEqual; } }); | ||
var assign_deep_1 = require("./assign-deep"); | ||
Object.defineProperty(exports, "objectAssignDeep", { enumerable: true, get: function () { return assign_deep_1.objectAssignDeep; } }); | ||
var format_1 = require("./format"); | ||
Object.defineProperty(exports, "formatDate", { enumerable: true, get: function () { return format_1.formatDate; } }); | ||
Object.defineProperty(exports, "formatString", { enumerable: true, get: function () { return format_1.formatString; } }); | ||
var html_1 = require("./html"); | ||
Object.defineProperty(exports, "HTML", { enumerable: true, get: function () { return html_1.HTML; } }); | ||
var value_store_1 = require("./value-store"); | ||
Object.defineProperty(exports, "ValueStore", { enumerable: true, get: function () { return value_store_1.ValueStore; } }); | ||
var single_inoke_1 = require("./single-inoke"); | ||
Object.defineProperty(exports, "SingleInvoke", { enumerable: true, get: function () { return single_inoke_1.SingleInvoke; } }); | ||
exports.SingleInvoke = exports.ValueStore = exports.HTML = exports.format = exports.formatString = exports.formatDate = exports.objectAssignDeep = exports.deepEqual = exports.parseUrl = exports.DataSourceSelectArguments = exports.DataSource = exports.Callback = exports.errors = exports.Errors = exports.pathConcat = exports.guid = void 0; | ||
var guid_js_1 = require("./guid.js"); | ||
Object.defineProperty(exports, "guid", { enumerable: true, get: function () { return guid_js_1.guid; } }); | ||
var path_js_1 = require("./path.js"); | ||
Object.defineProperty(exports, "pathConcat", { enumerable: true, get: function () { return path_js_1.pathConcat; } }); | ||
var errors_js_1 = require("./errors.js"); | ||
Object.defineProperty(exports, "Errors", { enumerable: true, get: function () { return errors_js_1.Errors; } }); | ||
Object.defineProperty(exports, "errors", { enumerable: true, get: function () { return errors_js_1.errors; } }); | ||
var callback_js_1 = require("./callback.js"); | ||
Object.defineProperty(exports, "Callback", { enumerable: true, get: function () { return callback_js_1.Callback; } }); | ||
var data_js_1 = require("./data.js"); | ||
Object.defineProperty(exports, "DataSource", { enumerable: true, get: function () { return data_js_1.DataSource; } }); | ||
Object.defineProperty(exports, "DataSourceSelectArguments", { enumerable: true, get: function () { return data_js_1.DataSourceSelectArguments; } }); | ||
var url_js_1 = require("./url.js"); | ||
Object.defineProperty(exports, "parseUrl", { enumerable: true, get: function () { return url_js_1.parseUrl; } }); | ||
var deep_equal_js_1 = require("./deep-equal.js"); | ||
Object.defineProperty(exports, "deepEqual", { enumerable: true, get: function () { return deep_equal_js_1.deepEqual; } }); | ||
var assign_deep_js_1 = require("./assign-deep.js"); | ||
Object.defineProperty(exports, "objectAssignDeep", { enumerable: true, get: function () { return assign_deep_js_1.objectAssignDeep; } }); | ||
var format_js_1 = require("./format.js"); | ||
Object.defineProperty(exports, "formatDate", { enumerable: true, get: function () { return format_js_1.formatDate; } }); | ||
Object.defineProperty(exports, "formatString", { enumerable: true, get: function () { return format_js_1.formatString; } }); | ||
Object.defineProperty(exports, "format", { enumerable: true, get: function () { return format_js_1.format; } }); | ||
var html_js_1 = require("./html.js"); | ||
Object.defineProperty(exports, "HTML", { enumerable: true, get: function () { return html_js_1.HTML; } }); | ||
var value_store_js_1 = require("./value-store.js"); | ||
Object.defineProperty(exports, "ValueStore", { enumerable: true, get: function () { return value_store_js_1.ValueStore; } }); | ||
var single_inoke_js_1 = require("./single-inoke.js"); | ||
Object.defineProperty(exports, "SingleInvoke", { enumerable: true, get: function () { return single_inoke_js_1.SingleInvoke; } }); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.partConcat2 = exports.pathConcat = void 0; | ||
const errors_1 = require("./errors"); | ||
const errors_js_1 = require("./errors.js"); | ||
/** 连接多个路径 */ | ||
function pathConcat(path, ...otherPaths) { | ||
if (!path) | ||
throw errors_js_1.errors.argumentNull("path"); | ||
let prefix = ""; | ||
@@ -22,5 +24,5 @@ if (path.startsWith("http://")) | ||
if (path1.startsWith("http://") || path1.startsWith("https://")) | ||
throw errors_1.errors.pathStartsHttp(path1); | ||
throw errors_js_1.errors.pathStartsHttp(path1); | ||
if (path2.startsWith("http://") || path2.startsWith("https://")) | ||
throw errors_1.errors.pathStartsHttp(path2); | ||
throw errors_js_1.errors.pathStartsHttp(path2); | ||
path1 = path1.replace(/(\/+\\*|\\+\/*)/g, '/'); | ||
@@ -27,0 +29,0 @@ path2 = path2.replace(/(\/+\\*|\\+\/*)/g, '/'); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SingleInvoke = void 0; | ||
const value_store_1 = require("./value-store"); | ||
const value_store_js_1 = require("./value-store.js"); | ||
class SingleInvoke { | ||
constructor(func) { | ||
this.result = new value_store_1.ValueStore(undefined); | ||
this.error = new value_store_1.ValueStore(undefined); | ||
this.result = new value_store_js_1.ValueStore(undefined); | ||
this.error = new value_store_js_1.ValueStore(undefined); | ||
this.executing = false; | ||
@@ -13,4 +13,4 @@ this.func = func; | ||
clear() { | ||
this.result = new value_store_1.ValueStore(undefined); | ||
this.error = new value_store_1.ValueStore(undefined); | ||
this.result = new value_store_js_1.ValueStore(undefined); | ||
this.error = new value_store_js_1.ValueStore(undefined); | ||
} | ||
@@ -17,0 +17,0 @@ execute() { |
{ | ||
"name": "maishu-toolkit", | ||
"version": "1.11.1", | ||
"version": "1.12.6", | ||
"main": "./dist/index.js", | ||
@@ -5,0 +5,0 @@ "types": "./out/index.d.ts", |
@@ -1,3 +0,3 @@ | ||
import { errors as baseErrors } from "./errors"; | ||
import { Callback } from "./callback"; | ||
import { errors as baseErrors } from "./errors.js"; | ||
import { Callback } from "./callback.js"; | ||
@@ -205,2 +205,3 @@ let errors = Object.assign(baseErrors, { | ||
filter?: string | Partial<T>; | ||
selection?: string; | ||
@@ -207,0 +208,0 @@ constructor() { |
@@ -9,3 +9,3 @@ export class Errors { | ||
routeDataFieldNull<T>(fieldName: keyof T): Error { | ||
let msg = `The ${fieldName} field of route data cannt be null.`; | ||
let msg = `The ${fieldName as string} field of route data cannt be null.`; | ||
let error = new Error(msg); | ||
@@ -17,3 +17,3 @@ let name: keyof Errors = "routeDataFieldNull"; | ||
argumentFieldNull<T>(fieldName: keyof T, argumentName: string): Error { | ||
let msg = `The ${fieldName} field of ${argumentName} cannt be null.`; | ||
let msg = `The ${fieldName as string} field of ${argumentName} cannt be null.`; | ||
let error = new Error(msg); | ||
@@ -20,0 +20,0 @@ let name: keyof Errors = "argumentFieldNull"; |
@@ -7,3 +7,3 @@ export function formatDate(date: Date | string, showHourMinutes?: boolean, showSeconds?: boolean): string { | ||
if (showHourMinutes) { | ||
let str = `${d.getFullYear()}-${d.getMonth()}-${d.getDate()} ${d.getHours()}:${d.getMinutes()}`; | ||
let str = `${d.getFullYear()}-${d.getMonth() + 1}-${d.getDate()} ${d.getHours()}:${d.getMinutes()}`; | ||
if (showSeconds) | ||
@@ -15,3 +15,3 @@ str = `${str}:${d.getSeconds()}`; | ||
return `${d.getFullYear()}-${d.getMonth()}-${d.getDate()}`; | ||
return `${d.getFullYear()}-${d.getMonth() + 1}-${d.getDate()}`; | ||
} | ||
@@ -26,2 +26,101 @@ | ||
return a; | ||
} | ||
export function format(value: any, format?: string): string {//...args | ||
if (!format) | ||
return `${value}`; | ||
var result = ''; | ||
for (var i = 0; ;) { | ||
var open = format.indexOf('{', i); | ||
var close = format.indexOf('}', i); | ||
if ((open < 0) && (close < 0)) { | ||
result += format.slice(i); | ||
break; | ||
} | ||
if ((close > 0) && ((close < open) || (open < 0))) { | ||
if (format.charAt(close + 1) !== '}') { | ||
throw new Error('Sys.Res.stringFormatBraceMismatch'); | ||
} | ||
result += format.slice(i, close + 1); | ||
i = close + 2; | ||
continue; | ||
} | ||
result += format.slice(i, open); | ||
i = open + 1; | ||
if (format.charAt(i) === '{') { | ||
result += '{'; | ||
i++; | ||
continue; | ||
} | ||
if (close < 0) | ||
throw new Error('Sys.Res.stringFormatBraceMismatch'); | ||
var brace = format.substring(i, close); | ||
var argFormat = brace; | ||
if (typeof (value) === "undefined" || value === null) { | ||
value = ''; | ||
} | ||
if (value instanceof Date) | ||
result = result + formatDate1(value, argFormat); | ||
else if (value instanceof Number || typeof value == 'number') | ||
result = result + formatNumber(value, argFormat); | ||
else | ||
result = result + value.toString(); | ||
i = close + 1; | ||
} | ||
return result; | ||
} | ||
function formatDate1(value: Date, format: string): string { | ||
let y = value.getFullYear() | ||
let m = value.getMonth() + 1 | ||
let d = value.getDate() | ||
let h = value.getHours() | ||
let M = value.getMinutes() | ||
let s = value.getSeconds() | ||
let twoDigit = function (value: number): string { | ||
const TEN = 10 | ||
if (value < TEN) | ||
return `0` + value | ||
return value.toString() | ||
} | ||
switch (format) { | ||
case 'd': | ||
return `${y}-${m}-${d}`; | ||
case 'g': | ||
return `${y}-${m}-${d} ${h}:${M}`; | ||
case 'gg': | ||
return `${y}-${twoDigit(m)}-${twoDigit(d)} ${twoDigit(h)}:${twoDigit(M)}`; | ||
case 'G': | ||
return `${y}-${m}-${d} ${h}:${M}:${s}`; | ||
case 'GG': | ||
return `${y}-${twoDigit(m)}-${twoDigit(d)} ${twoDigit(h)}:${twoDigit(M)}:${twoDigit(s)}`; | ||
case 't': | ||
return `${h}:${M}`; | ||
case 'T': | ||
return `${h}:${M}:${s}`; | ||
} | ||
return value.toString(); | ||
} | ||
function formatNumber(value: Number, format: string): string { | ||
let reg = new RegExp('^C[0-9]+'); | ||
if (reg.test(format)) { | ||
let num: any = format.substr(1); | ||
return value.toFixed(num); | ||
} | ||
return value.toString(); | ||
} |
@@ -1,2 +0,2 @@ | ||
import { errors } from "./errors" | ||
import { errors } from "./errors.js" | ||
@@ -3,0 +3,0 @@ export class HTML { |
@@ -1,12 +0,12 @@ | ||
export { guid } from "./guid"; | ||
export { pathConcat } from "./path"; | ||
export { Errors, errors } from "./errors"; | ||
export { Callback } from "./callback"; | ||
export { DataSource, DataSourceSelectArguments, DataSourceSelectResult, DataSourceArguments } from "./data"; | ||
export { parseUrl } from "./url"; | ||
export { deepEqual } from "./deep-equal"; | ||
export { objectAssignDeep } from "./assign-deep"; | ||
export { formatDate, formatString } from "./format"; | ||
export { HTML } from "./html"; | ||
export { ValueStore, ValueChangedCallback } from "./value-store"; | ||
export { SingleInvoke } from "./single-inoke"; | ||
export { guid } from "./guid.js"; | ||
export { pathConcat } from "./path.js"; | ||
export { Errors, errors } from "./errors.js"; | ||
export { Callback } from "./callback.js"; | ||
export { DataSource, DataSourceSelectArguments, DataSourceSelectResult, DataSourceArguments } from "./data.js"; | ||
export { parseUrl } from "./url.js"; | ||
export { deepEqual } from "./deep-equal.js"; | ||
export { objectAssignDeep } from "./assign-deep.js"; | ||
export { formatDate, formatString, format } from "./format.js"; | ||
export { HTML } from "./html.js"; | ||
export { ValueStore, ValueChangedCallback } from "./value-store.js"; | ||
export { SingleInvoke } from "./single-inoke.js"; |
@@ -1,5 +0,7 @@ | ||
import { errors } from "./errors"; | ||
import { errors } from "./errors.js"; | ||
/** 连接多个路径 */ | ||
export function pathConcat(path: string, ...otherPaths: string[]) { | ||
if (!path) | ||
throw errors.argumentNull("path"); | ||
@@ -6,0 +8,0 @@ let prefix = ""; |
@@ -1,2 +0,2 @@ | ||
import { ValueStore } from "./value-store"; | ||
import { ValueStore } from "./value-store.js"; | ||
@@ -3,0 +3,0 @@ export class SingleInvoke<T> { |
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
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
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
512626
5445
96