@ajaxjs/ui 1.3.8 → 1.3.10

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