@ajaxjs/ui 1.3.10 → 1.3.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -214,7 +214,7 @@ var render = function render() {
214
214
  var staticRenderFns = [];
215
215
 
216
216
  // EXTERNAL MODULE: ./node_modules/@ajaxjs/util/dist/index.esm.js
217
- var index_esm = __webpack_require__(2822);
217
+ var index_esm = __webpack_require__(2957);
218
218
  // EXTERNAL MODULE: external {"commonjs":"vue","commonjs2":"vue","root":"Vue"}
219
219
  var external_commonjs_vue_commonjs2_vue_root_Vue_ = __webpack_require__(4100);
220
220
  var external_commonjs_vue_commonjs2_vue_root_Vue_default = /*#__PURE__*/__webpack_require__.n(external_commonjs_vue_commonjs2_vue_root_Vue_);
@@ -380,7 +380,7 @@ var staticRenderFns = [];
380
380
  // EXTERNAL MODULE: ./node_modules/core-js/modules/web.dom-exception.stack.js
381
381
  var web_dom_exception_stack = __webpack_require__(4979);
382
382
  // EXTERNAL MODULE: ./node_modules/@ajaxjs/util/dist/index.esm.js
383
- var index_esm = __webpack_require__(2822);
383
+ var index_esm = __webpack_require__(2957);
384
384
  // EXTERNAL MODULE: external {"commonjs":"vue","commonjs2":"vue","root":"Vue"}
385
385
  var external_commonjs_vue_commonjs2_vue_root_Vue_ = __webpack_require__(4100);
386
386
  var external_commonjs_vue_commonjs2_vue_root_Vue_default = /*#__PURE__*/__webpack_require__.n(external_commonjs_vue_commonjs2_vue_root_Vue_);
@@ -627,7 +627,7 @@ var external_commonjs_vue_commonjs2_vue_root_Vue_default = /*#__PURE__*/__webpac
627
627
  // EXTERNAL MODULE: ./src/iview-ext/list.ts
628
628
  var list = __webpack_require__(7184);
629
629
  // EXTERNAL MODULE: ./node_modules/@ajaxjs/util/dist/index.esm.js
630
- var index_esm = __webpack_require__(2822);
630
+ var index_esm = __webpack_require__(2957);
631
631
  ;// CONCATENATED MODULE: ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js!./node_modules/ts-loader/index.js??clonedRuleSet-41.use[2]!./src/iview-ext/fast-iview-table.ts?vue&type=script&lang=ts&external
632
632
 
633
633
 
@@ -932,7 +932,7 @@ var staticRenderFns = [];
932
932
  var external_commonjs_vue_commonjs2_vue_root_Vue_ = __webpack_require__(4100);
933
933
  var external_commonjs_vue_commonjs2_vue_root_Vue_default = /*#__PURE__*/__webpack_require__.n(external_commonjs_vue_commonjs2_vue_root_Vue_);
934
934
  // EXTERNAL MODULE: ./node_modules/@ajaxjs/util/dist/index.esm.js
935
- var index_esm = __webpack_require__(2822);
935
+ var index_esm = __webpack_require__(2957);
936
936
  ;// CONCATENATED MODULE: ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/iview-ext/table-selector.vue?vue&type=script&lang=js
937
937
 
938
938
 
@@ -1289,7 +1289,7 @@ function normalizeComponent(
1289
1289
  /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
1290
1290
 
1291
1291
  "use strict";
1292
- /* harmony import */ var _ajaxjs_util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2822);
1292
+ /* harmony import */ var _ajaxjs_util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2957);
1293
1293
 
1294
1294
  /* harmony default export */ __webpack_exports__.A = ({
1295
1295
  afterDelete(cb) {
@@ -3568,7 +3568,7 @@ if (DESCRIPTORS && !('size' in URLSearchParamsPrototype)) {
3568
3568
 
3569
3569
  /***/ }),
3570
3570
 
3571
- /***/ 2822:
3571
+ /***/ 2957:
3572
3572
  /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
3573
3573
 
3574
3574
  "use strict";
@@ -3584,12 +3584,10 @@ if (DESCRIPTORS && !('size' in URLSearchParamsPrototype)) {
3584
3584
  * @returns 值
3585
3585
  */
3586
3586
  function getCookie(name) {
3587
- let arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
3588
- // @ts-ignore
3589
- if (arr = document.cookie.match(reg))
3590
- return unescape(arr[2]);
3591
- else
3592
- return null;
3587
+ let arr,
3588
+ reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
3589
+ // @ts-ignore
3590
+ if (arr = document.cookie.match(reg)) return unescape(arr[2]);else return null;
3593
3591
  }
3594
3592
  /**
3595
3593
  * 设置某个 Cookie
@@ -3598,31 +3596,31 @@ function getCookie(name) {
3598
3596
  * @param value 值
3599
3597
  */
3600
3598
  function setCookie(name, value) {
3601
- let days = 2, exp = new Date();
3602
- exp.setTime(exp.getTime() + days * 24 * 60 * 60 * 1000);
3603
- // @ts-ignore
3604
- document.cookie = name + "=" + escape(value) + ";path=/;expires=" + exp.toGMTString();
3599
+ let days = 2,
3600
+ exp = new Date();
3601
+ exp.setTime(exp.getTime() + days * 24 * 60 * 60 * 1000);
3602
+ // @ts-ignore
3603
+ document.cookie = name + "=" + escape(value) + ";path=/;expires=" + exp.toGMTString();
3605
3604
  }
3606
3605
  /**
3607
3606
  * 清空 Cookie
3608
3607
  */
3609
3608
  function delCookie() {
3610
- let keys = document.cookie.match(/[^ =;]+(?==)/g);
3611
- if (keys) {
3612
- let date = new Date(0).toUTCString();
3613
- for (let i = keys.length; i--;) {
3614
- document.cookie = keys[i] + '=0;path=/;expires=' + date; // 清除当前域名下的,例如:m.ratingdog.cn
3615
- document.cookie = keys[i] + '=0;path=/;domain=' + document.domain + ';expires=' + date; // 清除当前域名下的,例如 .m.ratingdog.cn
3616
- document.cookie = keys[i] + '=0;path=/;domain=' + location.host + ';expires=' + date; // 清除一级域名下的或指定的,例如 .ratingdog.cn
3617
- }
3609
+ let keys = document.cookie.match(/[^ =;]+(?==)/g);
3610
+ if (keys) {
3611
+ let date = new Date(0).toUTCString();
3612
+ for (let i = keys.length; i--;) {
3613
+ document.cookie = keys[i] + '=0;path=/;expires=' + date; // 清除当前域名下的,例如:m.ratingdog.cn
3614
+ document.cookie = keys[i] + '=0;path=/;domain=' + document.domain + ';expires=' + date; // 清除当前域名下的,例如 .m.ratingdog.cn
3615
+ document.cookie = keys[i] + '=0;path=/;domain=' + location.host + ';expires=' + date; // 清除一级域名下的或指定的,例如 .ratingdog.cn
3618
3616
  }
3617
+ }
3619
3618
  }
3620
-
3621
3619
  var cookies = /*#__PURE__*/Object.freeze({
3622
- __proto__: null,
3623
- delCookie: delCookie,
3624
- getCookie: getCookie,
3625
- setCookie: setCookie
3620
+ __proto__: null,
3621
+ delCookie: delCookie,
3622
+ getCookie: getCookie,
3623
+ setCookie: setCookie
3626
3624
  });
3627
3625
 
3628
3626
  /**
@@ -3634,18 +3632,15 @@ var cookies = /*#__PURE__*/Object.freeze({
3634
3632
  * @returns 目标元素,找不到为 null
3635
3633
  */
3636
3634
  function up(_el, tagName, className) {
3637
- if (tagName && className)
3638
- throw '只能任选一种参数,不能同时传';
3639
- let el = _el.parentNode;
3640
- tagName = tagName && tagName.toUpperCase();
3641
- while (el) {
3642
- if (tagName && el.tagName == tagName)
3643
- return el;
3644
- if (className && el.className && ~el.className.indexOf(className))
3645
- return el;
3646
- el = el.parentNode;
3647
- }
3648
- return null;
3635
+ if (tagName && className) throw '只能任选一种参数,不能同时传';
3636
+ let el = _el.parentNode;
3637
+ tagName = tagName && tagName.toUpperCase();
3638
+ while (el) {
3639
+ if (tagName && el.tagName == tagName) return el;
3640
+ if (className && el.className && ~el.className.indexOf(className)) return el;
3641
+ el = el.parentNode;
3642
+ }
3643
+ return null;
3649
3644
  }
3650
3645
  /**
3651
3646
  * 加载脚本
@@ -3655,19 +3650,16 @@ function up(_el, tagName, className) {
3655
3650
  * @param cb 回调函数,可选的
3656
3651
  */
3657
3652
  function loadScript(url, id, cb) {
3658
- let script = document.createElement("script");
3659
- script.src = url;
3660
- if (cb)
3661
- script.onload = cb;
3662
- if (id)
3663
- script.id = id;
3664
- document.getElementsByTagName("head")[0].appendChild(script);
3653
+ let script = document.createElement("script");
3654
+ script.src = url;
3655
+ if (cb) script.onload = cb;
3656
+ if (id) script.id = id;
3657
+ document.getElementsByTagName("head")[0].appendChild(script);
3665
3658
  }
3666
-
3667
3659
  var dom = /*#__PURE__*/Object.freeze({
3668
- __proto__: null,
3669
- loadScript: loadScript,
3670
- up: up
3660
+ __proto__: null,
3661
+ loadScript: loadScript,
3662
+ up: up
3671
3663
  });
3672
3664
 
3673
3665
  /**
@@ -3681,13 +3673,13 @@ var dom = /*#__PURE__*/Object.freeze({
3681
3673
  * @returns
3682
3674
  */
3683
3675
  function isDebug() {
3684
- // @ts-ignore
3685
- return "production" === 'development';
3676
+ // @ts-ignore
3677
+ return "production" === 'development';
3686
3678
  }
3687
3679
  function isDev() {
3688
- let currentHostname = window.location.hostname;
3689
- // 判断主机名是否是内网地址
3690
- return (currentHostname.startsWith('192.168.') || currentHostname.startsWith('10.') || currentHostname === 'localhost');
3680
+ let currentHostname = window.location.hostname;
3681
+ // 判断主机名是否是内网地址
3682
+ return currentHostname.startsWith('192.168.') || currentHostname.startsWith('10.') || currentHostname === 'localhost';
3691
3683
  }
3692
3684
  /**
3693
3685
  * 日期格式化。详见博客文章:http://blog.csdn.net/zhangxin09/archive/2011/01/01/6111294.aspx
@@ -3697,29 +3689,33 @@ function isDev() {
3697
3689
  * @return {String}
3698
3690
  */
3699
3691
  function dateFormat(format) {
3700
- let $1, o = {
3701
- "M+": this.getMonth() + 1, // 月份,从0开始算
3702
- "d+": this.getDate(), // 日期
3703
- "h+": this.getHours(), // 小时
3704
- "m+": this.getMinutes(), // 分钟
3705
- "s+": this.getSeconds(), // 秒钟
3706
- // 季度 quarter
3707
- "q+": Math.floor((this.getMonth() + 3) / 3),
3708
- "S": this.getMilliseconds() // 千秒
3692
+ let $1,
3693
+ o = {
3694
+ "M+": this.getMonth() + 1,
3695
+ // 月份,从0开始算
3696
+ "d+": this.getDate(),
3697
+ // 日期
3698
+ "h+": this.getHours(),
3699
+ // 小时
3700
+ "m+": this.getMinutes(),
3701
+ // 分钟
3702
+ "s+": this.getSeconds(),
3703
+ // 秒钟
3704
+ // 季度 quarter
3705
+ "q+": Math.floor((this.getMonth() + 3) / 3),
3706
+ "S": this.getMilliseconds() // 千秒
3709
3707
  };
3710
- if (/(y+)/.test(format))
3711
- // @ts-ignore
3712
- $1 = RegExp.$1, format = format.replace($1, String(this.getFullYear()).substr(4 - $1));
3713
- let key, value;
3714
- for (key in o) { // 如果没有指定该参数,则子字符串将延续到 stringvar 的最后。
3715
- if (new RegExp("(" + key + ")").test(format)) {
3716
- $1 = RegExp.$1,
3717
- value = String(o[key]),
3718
- value = $1.length == 1 ? value : ("00" + value).substr(value.length),
3719
- format = format.replace($1, value);
3720
- }
3708
+ if (/(y+)/.test(format))
3709
+ // @ts-ignore
3710
+ $1 = RegExp.$1, format = format.replace($1, String(this.getFullYear()).substr(4 - $1));
3711
+ let key, value;
3712
+ for (key in o) {
3713
+ // 如果没有指定该参数,则子字符串将延续到 stringvar 的最后。
3714
+ if (new RegExp("(" + key + ")").test(format)) {
3715
+ $1 = RegExp.$1, value = String(o[key]), value = $1.length == 1 ? value : ("00" + value).substr(value.length), format = format.replace($1, value);
3721
3716
  }
3722
- return format;
3717
+ }
3718
+ return format;
3723
3719
  }
3724
3720
  /**
3725
3721
  * 日期格式化
@@ -3729,24 +3725,28 @@ function dateFormat(format) {
3729
3725
  * @returns 格式化后的字符串
3730
3726
  */
3731
3727
  function dateFormat2(date, fmt) {
3732
- let o = {
3733
- "M+": date.getMonth() + 1, // 月份
3734
- "d+": date.getDate(), //
3735
- "h+": date.getHours(), // 小时
3736
- "m+": date.getMinutes(), //
3737
- "s+": date.getSeconds(), // 秒
3738
- "q+": Math.floor((date.getMonth() + 3) / 3), // 季度
3739
- "S": date.getMilliseconds() // 毫秒
3740
- };
3741
- if (/(y+)/.test(fmt))
3742
- fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
3743
- for (var k in o)
3744
- if (new RegExp("(" + k + ")").test(fmt)) {
3745
- let obj = (RegExp.$1.length == 1) ? o[k] : ("00" + o[k]).substr(("" + o[k]).length);
3746
- // @ts-ignore
3747
- fmt = fmt.replace(RegExp.$1, obj);
3748
- }
3749
- return fmt;
3728
+ let o = {
3729
+ "M+": date.getMonth() + 1,
3730
+ // 月份
3731
+ "d+": date.getDate(),
3732
+ //
3733
+ "h+": date.getHours(),
3734
+ // 小时
3735
+ "m+": date.getMinutes(),
3736
+ // 分
3737
+ "s+": date.getSeconds(),
3738
+ //
3739
+ "q+": Math.floor((date.getMonth() + 3) / 3),
3740
+ // 季度
3741
+ "S": date.getMilliseconds() // 毫秒
3742
+ };
3743
+ if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
3744
+ for (var k in o) if (new RegExp("(" + k + ")").test(fmt)) {
3745
+ let obj = RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length);
3746
+ // @ts-ignore
3747
+ fmt = fmt.replace(RegExp.$1, obj);
3748
+ }
3749
+ return fmt;
3750
3750
  }
3751
3751
  /**
3752
3752
  * 并行和串行任务
@@ -3756,28 +3756,32 @@ function dateFormat2(date, fmt) {
3756
3756
  * @param finnaly
3757
3757
  */
3758
3758
  function parallel(arr, _finally) {
3759
- let fn, index = 0;
3760
- // @ts-ignore
3761
- let statusArr = Array(arr.length).fill().map(() => ({ isActive: false, data: null }));
3762
- let isFinished = function () {
3763
- return statusArr.every((item) => item.isActive === true);
3764
- };
3765
- let resolve = function (index) {
3766
- return function (data) {
3767
- statusArr[index].data = data;
3768
- statusArr[index].isActive = true;
3769
- let isFinish = isFinished();
3770
- if (isFinish) {
3771
- let datas = statusArr.map((item) => item.data);
3772
- _finally(datas);
3773
- }
3774
- };
3759
+ let fn,
3760
+ index = 0;
3761
+ // @ts-ignore
3762
+ let statusArr = Array(arr.length).fill().map(() => ({
3763
+ isActive: false,
3764
+ data: null
3765
+ }));
3766
+ let isFinished = function () {
3767
+ return statusArr.every(item => item.isActive === true);
3768
+ };
3769
+ let resolve = function (index) {
3770
+ return function (data) {
3771
+ statusArr[index].data = data;
3772
+ statusArr[index].isActive = true;
3773
+ let isFinish = isFinished();
3774
+ if (isFinish) {
3775
+ let datas = statusArr.map(item => item.data);
3776
+ _finally(datas);
3777
+ }
3775
3778
  };
3776
- // @ts-ignore
3777
- while ((fn = arr.shift())) {
3778
- fn(resolve(index)); // 给 resolve 函数追加参数,可以使用 bind 函数实现,这里使用了柯里化
3779
- index++;
3780
- }
3779
+ };
3780
+ // @ts-ignore
3781
+ while (fn = arr.shift()) {
3782
+ fn(resolve(index)); // 给 resolve 函数追加参数,可以使用 bind 函数实现,这里使用了柯里化
3783
+ index++;
3784
+ }
3781
3785
  }
3782
3786
  /**
3783
3787
  * 函数节流
@@ -3788,23 +3792,21 @@ function parallel(arr, _finally) {
3788
3792
  * @param mustRunDelay
3789
3793
  */
3790
3794
  function throttle(fn, delay, mustRunDelay) {
3791
- var timer, t_start;
3792
- return function () {
3793
- var t_curr = +new Date();
3794
- window.clearTimeout(timer);
3795
- if (!t_start)
3796
- t_start = t_curr;
3797
- if (t_curr - t_start >= mustRunDelay) {
3798
- // @ts-ignore
3799
- fn.apply(this, arguments);
3800
- t_start = t_curr;
3801
- }
3802
- else {
3803
- var args = arguments;
3804
- // @ts-ignore
3805
- timer = window.setTimeout(() => fn.apply(this, args), delay);
3806
- }
3807
- };
3795
+ var timer, t_start;
3796
+ return function () {
3797
+ var t_curr = +new Date();
3798
+ window.clearTimeout(timer);
3799
+ if (!t_start) t_start = t_curr;
3800
+ if (t_curr - t_start >= mustRunDelay) {
3801
+ // @ts-ignore
3802
+ fn.apply(this, arguments);
3803
+ t_start = t_curr;
3804
+ } else {
3805
+ var args = arguments;
3806
+ // @ts-ignore
3807
+ timer = window.setTimeout(() => fn.apply(this, args), delay);
3808
+ }
3809
+ };
3808
3810
  }
3809
3811
  /**
3810
3812
  * 复制文字到剪切板
@@ -3812,39 +3814,37 @@ function throttle(fn, delay, mustRunDelay) {
3812
3814
  * @param {string} text
3813
3815
  */
3814
3816
  function copyToClipboard(text) {
3815
- if (navigator.clipboard)
3816
- navigator.clipboard.writeText(text); // clipboard api 复制
3817
- else {
3818
- let textarea = document.createElement('textarea');
3819
- document.body.appendChild(textarea); // 隐藏此输入框
3820
- textarea.style.position = 'fixed';
3821
- textarea.style.clip = 'rect(0 0 0 0)';
3822
- textarea.style.top = '10px';
3823
- textarea.value = text; // 赋值
3824
- textarea.select(); // 选中
3825
- document.execCommand('copy', true); // 复制
3826
- document.body.removeChild(textarea); // 移除输入框
3827
- }
3817
+ if (navigator.clipboard) navigator.clipboard.writeText(text); // clipboard api 复制
3818
+ else {
3819
+ let textarea = document.createElement('textarea');
3820
+ document.body.appendChild(textarea); // 隐藏此输入框
3821
+ textarea.style.position = 'fixed';
3822
+ textarea.style.clip = 'rect(0 0 0 0)';
3823
+ textarea.style.top = '10px';
3824
+ textarea.value = text; // 赋值
3825
+ textarea.select(); // 选中
3826
+ document.execCommand('copy', true); // 复制
3827
+ document.body.removeChild(textarea); // 移除输入框
3828
+ }
3828
3829
  }
3829
-
3830
3830
  var utils = /*#__PURE__*/Object.freeze({
3831
- __proto__: null,
3832
- copyToClipboard: copyToClipboard,
3833
- dateFormat: dateFormat,
3834
- dateFormat2: dateFormat2,
3835
- isDebug: isDebug,
3836
- isDev: isDev,
3837
- parallel: parallel,
3838
- throttle: throttle
3831
+ __proto__: null,
3832
+ copyToClipboard: copyToClipboard,
3833
+ dateFormat: dateFormat,
3834
+ dateFormat2: dateFormat2,
3835
+ isDebug: isDebug,
3836
+ isDev: isDev,
3837
+ parallel: parallel,
3838
+ throttle: throttle
3839
3839
  });
3840
3840
 
3841
3841
  /**
3842
3842
  * 默认的请求配置
3843
3843
  */
3844
3844
  const DEFAULT_XHR_CFG = {
3845
- timeout: 5000,
3846
- withCredentials: false,
3847
- parseContentType: 'json'
3845
+ timeout: 5000,
3846
+ withCredentials: false,
3847
+ parseContentType: 'json'
3848
3848
  };
3849
3849
  /**
3850
3850
  * 全局请求的 head 参数
@@ -3856,9 +3856,8 @@ let BASE_HEAD_PARAMS = null;
3856
3856
  * @param param
3857
3857
  */
3858
3858
  function setBaseHeadParams(params) {
3859
- if (BASE_HEAD_PARAMS === null)
3860
- BASE_HEAD_PARAMS = {};
3861
- Object.assign(BASE_HEAD_PARAMS, params);
3859
+ if (BASE_HEAD_PARAMS === null) BASE_HEAD_PARAMS = {};
3860
+ Object.assign(BASE_HEAD_PARAMS, params);
3862
3861
  }
3863
3862
  /**
3864
3863
  *
@@ -3869,21 +3868,18 @@ function setBaseHeadParams(params) {
3869
3868
  * @param cfg
3870
3869
  */
3871
3870
  function getOrDel(getOrDel, url, cb, params, cfg = DEFAULT_XHR_CFG) {
3872
- let xhr = initXhr(cfg);
3873
- if (params != null) {
3874
- if (url.indexOf('?') != -1)
3875
- url += '&' + toParams(params);
3876
- else
3877
- url += '?' + toParams(params);
3878
- }
3879
- xhr.open(getOrDel.toUpperCase(), url, true);
3880
- xhr.onreadystatechange = function () {
3881
- responseHandle(this, cb, cfg);
3882
- };
3883
- if (BASE_HEAD_PARAMS) // 设置自定义请求头
3884
- for (let key in BASE_HEAD_PARAMS)
3885
- xhr.setRequestHeader(key, BASE_HEAD_PARAMS[key]);
3886
- xhr.send();
3871
+ let xhr = initXhr(cfg);
3872
+ if (params != null) {
3873
+ if (url.indexOf('?') != -1) url += '&' + toParams(params);else url += '?' + toParams(params);
3874
+ }
3875
+ xhr.open(getOrDel.toUpperCase(), url, true);
3876
+ xhr.onreadystatechange = function () {
3877
+ responseHandle(this, cb, cfg);
3878
+ };
3879
+ if (BASE_HEAD_PARAMS)
3880
+ // 设置自定义请求头
3881
+ for (let key in BASE_HEAD_PARAMS) xhr.setRequestHeader(key, BASE_HEAD_PARAMS[key]);
3882
+ xhr.send();
3887
3883
  }
3888
3884
  /**
3889
3885
  *
@@ -3894,24 +3890,20 @@ function getOrDel(getOrDel, url, cb, params, cfg = DEFAULT_XHR_CFG) {
3894
3890
  * @param cfg
3895
3891
  */
3896
3892
  function postOrPut(method, url, cb, params, cfg = DEFAULT_XHR_CFG) {
3897
- let xhr = initXhr(cfg);
3898
- xhr.open(method, url, true);
3899
- xhr.onreadystatechange = function () {
3900
- responseHandle(this, cb, cfg);
3901
- };
3902
- if (BASE_HEAD_PARAMS) // 设置自定义请求头
3903
- for (let key in BASE_HEAD_PARAMS)
3904
- xhr.setRequestHeader(key, BASE_HEAD_PARAMS[key]);
3905
- // 此方法必须在 open() 方法和 send() 之间调用
3906
- if (!cfg.contentType) // 如未设置,默认为表单请求
3907
- xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
3908
- else
3909
- xhr.setRequestHeader("Content-Type", cfg.contentType);
3910
- let _params = typeof params != 'string' ? toParams(params) : params;
3911
- if (_params)
3912
- xhr.send(_params);
3913
- else
3914
- xhr.send();
3893
+ let xhr = initXhr(cfg);
3894
+ xhr.open(method, url, true);
3895
+ xhr.onreadystatechange = function () {
3896
+ responseHandle(this, cb, cfg);
3897
+ };
3898
+ if (BASE_HEAD_PARAMS)
3899
+ // 设置自定义请求头
3900
+ for (let key in BASE_HEAD_PARAMS) xhr.setRequestHeader(key, BASE_HEAD_PARAMS[key]);
3901
+ // 此方法必须在 open() 方法和 send() 之间调用
3902
+ if (!cfg.contentType)
3903
+ // 如未设置,默认为表单请求
3904
+ xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");else xhr.setRequestHeader("Content-Type", cfg.contentType);
3905
+ let _params = typeof params != 'string' ? toParams(params) : params;
3906
+ if (_params) xhr.send(_params);else xhr.send();
3915
3907
  }
3916
3908
  /**
3917
3909
  *
@@ -3921,16 +3913,16 @@ function postOrPut(method, url, cb, params, cfg = DEFAULT_XHR_CFG) {
3921
3913
  * @param cfg
3922
3914
  */
3923
3915
  function xhr_post_upload(url, cb, params, cfg = DEFAULT_XHR_CFG) {
3924
- let xhr = initXhr(cfg);
3925
- xhr.open('post', url, true);
3926
- xhr.onreadystatechange = function () {
3927
- responseHandle(this, cb, cfg);
3928
- };
3929
- if (BASE_HEAD_PARAMS) // 设置自定义请求头
3930
- for (let key in BASE_HEAD_PARAMS)
3931
- xhr.setRequestHeader(key, BASE_HEAD_PARAMS[key]);
3932
- // 什么 Content-Type 都不设置
3933
- xhr.send(params);
3916
+ let xhr = initXhr(cfg);
3917
+ xhr.open('post', url, true);
3918
+ xhr.onreadystatechange = function () {
3919
+ responseHandle(this, cb, cfg);
3920
+ };
3921
+ if (BASE_HEAD_PARAMS)
3922
+ // 设置自定义请求头
3923
+ for (let key in BASE_HEAD_PARAMS) xhr.setRequestHeader(key, BASE_HEAD_PARAMS[key]);
3924
+ // 什么 Content-Type 都不设置
3925
+ xhr.send(params);
3934
3926
  }
3935
3927
  /**
3936
3928
  * XHR GET 请求
@@ -3941,7 +3933,7 @@ function xhr_post_upload(url, cb, params, cfg = DEFAULT_XHR_CFG) {
3941
3933
  * @param cfg 配置,可选的
3942
3934
  */
3943
3935
  function xhr_get(url, cb, params, cfg = DEFAULT_XHR_CFG) {
3944
- getOrDel('get', url, cb, params, cfg);
3936
+ getOrDel('get', url, cb, params, cfg);
3945
3937
  }
3946
3938
  /**
3947
3939
  * XHR DELETE 请求
@@ -3952,7 +3944,7 @@ function xhr_get(url, cb, params, cfg = DEFAULT_XHR_CFG) {
3952
3944
  * @param cfg 配置,可选的
3953
3945
  */
3954
3946
  function xhr_del(url, cb, params, cfg = DEFAULT_XHR_CFG) {
3955
- getOrDel('delete', url, cb, params, cfg);
3947
+ getOrDel('delete', url, cb, params, cfg);
3956
3948
  }
3957
3949
  /**
3958
3950
  * XHR POST 请求
@@ -3963,7 +3955,7 @@ function xhr_del(url, cb, params, cfg = DEFAULT_XHR_CFG) {
3963
3955
  * @param cfg 配置,可选的
3964
3956
  */
3965
3957
  function xhr_post(url, cb, params, cfg = DEFAULT_XHR_CFG) {
3966
- postOrPut('post', url, cb, params, cfg);
3958
+ postOrPut('post', url, cb, params, cfg);
3967
3959
  }
3968
3960
  /**
3969
3961
  * XHR PUT 请求
@@ -3974,7 +3966,7 @@ function xhr_post(url, cb, params, cfg = DEFAULT_XHR_CFG) {
3974
3966
  * @param cfg 配置,可选的
3975
3967
  */
3976
3968
  function xhr_put(url, cb, params, cfg = DEFAULT_XHR_CFG) {
3977
- postOrPut('put', url, cb, params, cfg);
3969
+ postOrPut('put', url, cb, params, cfg);
3978
3970
  }
3979
3971
  /**
3980
3972
  * 初始化 XHR
@@ -3983,14 +3975,13 @@ function xhr_put(url, cb, params, cfg = DEFAULT_XHR_CFG) {
3983
3975
  * @returns
3984
3976
  */
3985
3977
  function initXhr(cfg) {
3986
- let xhr = new XMLHttpRequest();
3987
- if (cfg && cfg.timeout) {
3988
- xhr.timeout = cfg.timeout;
3989
- xhr.ontimeout = (e) => console.error('系统异常,XHR 连接服务超时');
3990
- }
3991
- if (cfg && cfg.withCredentials)
3992
- xhr.withCredentials = true;
3993
- return xhr;
3978
+ let xhr = new XMLHttpRequest();
3979
+ if (cfg && cfg.timeout) {
3980
+ xhr.timeout = cfg.timeout;
3981
+ xhr.ontimeout = e => console.error('系统异常,XHR 连接服务超时');
3982
+ }
3983
+ if (cfg && cfg.withCredentials) xhr.withCredentials = true;
3984
+ return xhr;
3994
3985
  }
3995
3986
  /**
3996
3987
  * 错误处理
@@ -3998,16 +3989,10 @@ function initXhr(cfg) {
3998
3989
  * @param xhr
3999
3990
  */
4000
3991
  function errHandle(xhr) {
4001
- let msg;
4002
- if (xhr.status <= 400)
4003
- msg = '请求参数错误或者权限不足。';
4004
- else if (xhr.status <= 500)
4005
- msg = '服务端异常。';
4006
- else
4007
- msg = `未知异常,HTTP code:${xhr.status}。`;
4008
- if (!xhr.responseText)
4009
- msg += " 服务端返回空的字符串!";
4010
- console.error(msg, xhr.responseText);
3992
+ let msg;
3993
+ if (xhr.status <= 400) msg = '请求参数错误或者权限不足。';else if (xhr.status <= 500) msg = '服务端异常。';else msg = `未知异常,HTTP code:${xhr.status}。`;
3994
+ if (!xhr.responseText) msg += " 服务端返回空的字符串!";
3995
+ console.error(msg, xhr.responseText);
4011
3996
  }
4012
3997
  /**
4013
3998
  * 响应处理
@@ -4017,33 +4002,29 @@ function errHandle(xhr) {
4017
4002
  * @param cfg
4018
4003
  */
4019
4004
  function responseHandle(xhr, cb, cfg) {
4020
- if (xhr.readyState == 4) {
4021
- if ((xhr.status >= 200 && xhr.status < 300) || xhr.status == 304) {
4022
- let text = xhr.responseText;
4023
- let json;
4024
- if (!text)
4025
- console.warn('服务端没有返回任何字符串');
4026
- switch (cfg.parseContentType) {
4027
- case 'text':
4028
- break;
4029
- case 'xml':
4030
- json = xhr.responseXML;
4031
- break;
4032
- case 'json':
4033
- default:
4034
- try {
4035
- json = JSON.parse(text);
4036
- }
4037
- catch (e) {
4038
- console.error('解析 JSON 时候发生错误,非法 JSON');
4039
- console.warn(e);
4040
- }
4041
- }
4042
- cb && cb(json, text);
4043
- }
4044
- else
4045
- errHandle(xhr);
4046
- }
4005
+ if (xhr.readyState == 4) {
4006
+ if (xhr.status >= 200 && xhr.status < 300 || xhr.status == 304) {
4007
+ let text = xhr.responseText;
4008
+ let json;
4009
+ if (!text) console.warn('服务端没有返回任何字符串');
4010
+ switch (cfg.parseContentType) {
4011
+ case 'text':
4012
+ break;
4013
+ case 'xml':
4014
+ json = xhr.responseXML;
4015
+ break;
4016
+ case 'json':
4017
+ default:
4018
+ try {
4019
+ json = JSON.parse(text);
4020
+ } catch (e) {
4021
+ console.error('解析 JSON 时候发生错误,非法 JSON');
4022
+ console.warn(e);
4023
+ }
4024
+ }
4025
+ cb && cb(json, text);
4026
+ } else errHandle(xhr);
4027
+ }
4047
4028
  }
4048
4029
  /**
4049
4030
  * 对象转换为 URL 参数列表,用 & 分隔
@@ -4052,12 +4033,11 @@ function responseHandle(xhr, cb, cfg) {
4052
4033
  * @returns URL 参数列表
4053
4034
  */
4054
4035
  function toParams(param) {
4055
- let result = "";
4056
- for (let name in param) {
4057
- if (typeof param[name] != "function")
4058
- result += "&" + name + "=" + encodeURIComponent(param[name]);
4059
- }
4060
- return result.substring(1);
4036
+ let result = "";
4037
+ for (let name in param) {
4038
+ if (typeof param[name] != "function") result += "&" + name + "=" + encodeURIComponent(param[name]);
4039
+ }
4040
+ return result.substring(1);
4061
4041
  }
4062
4042
  /**
4063
4043
  * 获取 QueryString 的某个参数
@@ -4066,44 +4046,38 @@ function toParams(param) {
4066
4046
  * @returns
4067
4047
  */
4068
4048
  function getQuery(val) {
4069
- const w = location.hash.indexOf('?');
4070
- const query = location.hash.substring(w + 1);
4071
- let vars = query.split('&');
4072
- for (let i = 0; i < vars.length; i++) {
4073
- const pair = vars[i].split('=');
4074
- if (pair[0] == val)
4075
- return pair[1];
4076
- }
4077
- return '';
4049
+ const w = location.hash.indexOf('?');
4050
+ const query = location.hash.substring(w + 1);
4051
+ let vars = query.split('&');
4052
+ for (let i = 0; i < vars.length; i++) {
4053
+ const pair = vars[i].split('=');
4054
+ if (pair[0] == val) return pair[1];
4055
+ }
4056
+ return '';
4078
4057
  }
4079
4058
  function getPageList(self, listArray, callback) {
4080
- return (j) => {
4081
- if (j.status) {
4082
- listArray.total = j.total;
4083
- listArray.data = j.data;
4084
- callback && callback();
4085
- }
4086
- else
4087
- self.$Message.warning(j.message || '获取数据失败');
4088
- };
4059
+ return j => {
4060
+ if (j.status) {
4061
+ listArray.total = j.total;
4062
+ listArray.data = j.data;
4063
+ callback && callback();
4064
+ } else self.$Message.warning(j.message || '获取数据失败');
4065
+ };
4089
4066
  }
4090
-
4091
4067
  var xhr = /*#__PURE__*/Object.freeze({
4092
- __proto__: null,
4093
- getPageList: getPageList,
4094
- getQuery: getQuery,
4095
- setBaseHeadParams: setBaseHeadParams,
4096
- toParams: toParams,
4097
- xhr_del: xhr_del,
4098
- xhr_get: xhr_get,
4099
- xhr_post: xhr_post,
4100
- xhr_post_upload: xhr_post_upload,
4101
- xhr_put: xhr_put
4068
+ __proto__: null,
4069
+ getPageList: getPageList,
4070
+ getQuery: getQuery,
4071
+ setBaseHeadParams: setBaseHeadParams,
4072
+ toParams: toParams,
4073
+ xhr_del: xhr_del,
4074
+ xhr_get: xhr_get,
4075
+ xhr_post: xhr_post,
4076
+ xhr_post_upload: xhr_post_upload,
4077
+ xhr_put: xhr_put
4102
4078
  });
4103
4079
 
4104
4080
 
4105
-
4106
-
4107
4081
  /***/ })
4108
4082
 
4109
4083
  /******/ });
@@ -4231,7 +4205,7 @@ var web_url_search_params_has = __webpack_require__(7566);
4231
4205
  // EXTERNAL MODULE: ./node_modules/core-js/modules/web.url-search-params.size.js
4232
4206
  var web_url_search_params_size = __webpack_require__(8721);
4233
4207
  // EXTERNAL MODULE: ./node_modules/@ajaxjs/util/dist/index.esm.js
4234
- var index_esm = __webpack_require__(2822);
4208
+ var index_esm = __webpack_require__(2957);
4235
4209
  ;// CONCATENATED MODULE: ./src/iam/iam.ts
4236
4210
 
4237
4211