@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.
@@ -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__(2822);
227
+ var index_esm = __webpack_require__(8030);
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__(2822);
393
+ var index_esm = __webpack_require__(8030);
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__(2822);
640
+ var index_esm = __webpack_require__(8030);
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__(2822);
945
+ var index_esm = __webpack_require__(8030);
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__(2822);
1302
+ /* harmony import */ var _ajaxjs_util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8030);
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
- /***/ 2822:
3581
+ /***/ 8030:
3582
3582
  /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
3583
3583
 
3584
3584
  "use strict";
@@ -3594,12 +3594,10 @@ if (DESCRIPTORS && !('size' in URLSearchParamsPrototype)) {
3594
3594
  * @returns 值
3595
3595
  */
3596
3596
  function getCookie(name) {
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;
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;
3603
3601
  }
3604
3602
  /**
3605
3603
  * 设置某个 Cookie
@@ -3608,31 +3606,31 @@ function getCookie(name) {
3608
3606
  * @param value 值
3609
3607
  */
3610
3608
  function setCookie(name, value) {
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();
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();
3615
3614
  }
3616
3615
  /**
3617
3616
  * 清空 Cookie
3618
3617
  */
3619
3618
  function delCookie() {
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
- }
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
3628
3626
  }
3627
+ }
3629
3628
  }
3630
-
3631
3629
  var cookies = /*#__PURE__*/Object.freeze({
3632
- __proto__: null,
3633
- delCookie: delCookie,
3634
- getCookie: getCookie,
3635
- setCookie: setCookie
3630
+ __proto__: null,
3631
+ delCookie: delCookie,
3632
+ getCookie: getCookie,
3633
+ setCookie: setCookie
3636
3634
  });
3637
3635
 
3638
3636
  /**
@@ -3644,18 +3642,15 @@ var cookies = /*#__PURE__*/Object.freeze({
3644
3642
  * @returns 目标元素,找不到为 null
3645
3643
  */
3646
3644
  function up(_el, tagName, className) {
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;
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;
3659
3654
  }
3660
3655
  /**
3661
3656
  * 加载脚本
@@ -3665,19 +3660,16 @@ function up(_el, tagName, className) {
3665
3660
  * @param cb 回调函数,可选的
3666
3661
  */
3667
3662
  function loadScript(url, id, cb) {
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);
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);
3675
3668
  }
3676
-
3677
3669
  var dom = /*#__PURE__*/Object.freeze({
3678
- __proto__: null,
3679
- loadScript: loadScript,
3680
- up: up
3670
+ __proto__: null,
3671
+ loadScript: loadScript,
3672
+ up: up
3681
3673
  });
3682
3674
 
3683
3675
  /**
@@ -3691,13 +3683,13 @@ var dom = /*#__PURE__*/Object.freeze({
3691
3683
  * @returns
3692
3684
  */
3693
3685
  function isDebug() {
3694
- // @ts-ignore
3695
- return "production" === 'development';
3686
+ // @ts-ignore
3687
+ return "production" === 'development';
3696
3688
  }
3697
3689
  function isDev() {
3698
- let currentHostname = window.location.hostname;
3699
- // 判断主机名是否是内网地址
3700
- return (currentHostname.startsWith('192.168.') || currentHostname.startsWith('10.') || currentHostname === 'localhost');
3690
+ let currentHostname = window.location.hostname;
3691
+ // 判断主机名是否是内网地址
3692
+ return currentHostname.startsWith('192.168.') || currentHostname.startsWith('10.') || currentHostname === 'localhost';
3701
3693
  }
3702
3694
  /**
3703
3695
  * 日期格式化。详见博客文章:http://blog.csdn.net/zhangxin09/archive/2011/01/01/6111294.aspx
@@ -3707,29 +3699,33 @@ function isDev() {
3707
3699
  * @return {String}
3708
3700
  */
3709
3701
  function dateFormat(format) {
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() // 千秒
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() // 千秒
3719
3717
  };
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
- }
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);
3731
3726
  }
3732
- return format;
3727
+ }
3728
+ return format;
3733
3729
  }
3734
3730
  /**
3735
3731
  * 日期格式化
@@ -3739,24 +3735,28 @@ function dateFormat(format) {
3739
3735
  * @returns 格式化后的字符串
3740
3736
  */
3741
3737
  function dateFormat2(date, 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;
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;
3760
3760
  }
3761
3761
  /**
3762
3762
  * 并行和串行任务
@@ -3766,28 +3766,32 @@ function dateFormat2(date, fmt) {
3766
3766
  * @param finnaly
3767
3767
  */
3768
3768
  function parallel(arr, _finally) {
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);
3774
- };
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
- };
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
+ }
3785
3788
  };
3786
- // @ts-ignore
3787
- while ((fn = arr.shift())) {
3788
- fn(resolve(index)); // 给 resolve 函数追加参数,可以使用 bind 函数实现,这里使用了柯里化
3789
- index++;
3790
- }
3789
+ };
3790
+ // @ts-ignore
3791
+ while (fn = arr.shift()) {
3792
+ fn(resolve(index)); // 给 resolve 函数追加参数,可以使用 bind 函数实现,这里使用了柯里化
3793
+ index++;
3794
+ }
3791
3795
  }
3792
3796
  /**
3793
3797
  * 函数节流
@@ -3798,23 +3802,21 @@ function parallel(arr, _finally) {
3798
3802
  * @param mustRunDelay
3799
3803
  */
3800
3804
  function throttle(fn, delay, mustRunDelay) {
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
- };
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
+ };
3818
3820
  }
3819
3821
  /**
3820
3822
  * 复制文字到剪切板
@@ -3822,39 +3824,37 @@ function throttle(fn, delay, mustRunDelay) {
3822
3824
  * @param {string} text
3823
3825
  */
3824
3826
  function copyToClipboard(text) {
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
- }
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
+ }
3838
3839
  }
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,9 +3866,8 @@ let BASE_HEAD_PARAMS = null;
3866
3866
  * @param param
3867
3867
  */
3868
3868
  function setBaseHeadParams(params) {
3869
- if (BASE_HEAD_PARAMS === null)
3870
- BASE_HEAD_PARAMS = {};
3871
- Object.assign(BASE_HEAD_PARAMS, params);
3869
+ if (BASE_HEAD_PARAMS === null) BASE_HEAD_PARAMS = {};
3870
+ Object.assign(BASE_HEAD_PARAMS, params);
3872
3871
  }
3873
3872
  /**
3874
3873
  *
@@ -3879,21 +3878,18 @@ function setBaseHeadParams(params) {
3879
3878
  * @param cfg
3880
3879
  */
3881
3880
  function getOrDel(getOrDel, url, cb, params, cfg = DEFAULT_XHR_CFG) {
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();
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();
3897
3893
  }
3898
3894
  /**
3899
3895
  *
@@ -3904,24 +3900,20 @@ function getOrDel(getOrDel, url, cb, params, cfg = DEFAULT_XHR_CFG) {
3904
3900
  * @param cfg
3905
3901
  */
3906
3902
  function postOrPut(method, url, cb, params, cfg = DEFAULT_XHR_CFG) {
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();
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();
3925
3917
  }
3926
3918
  /**
3927
3919
  *
@@ -3931,16 +3923,16 @@ function postOrPut(method, url, cb, params, cfg = DEFAULT_XHR_CFG) {
3931
3923
  * @param cfg
3932
3924
  */
3933
3925
  function xhr_post_upload(url, cb, params, cfg = DEFAULT_XHR_CFG) {
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);
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);
3944
3936
  }
3945
3937
  /**
3946
3938
  * XHR GET 请求
@@ -3951,7 +3943,7 @@ function xhr_post_upload(url, cb, params, cfg = DEFAULT_XHR_CFG) {
3951
3943
  * @param cfg 配置,可选的
3952
3944
  */
3953
3945
  function xhr_get(url, cb, params, cfg = DEFAULT_XHR_CFG) {
3954
- getOrDel('get', url, cb, params, cfg);
3946
+ getOrDel('get', url, cb, params, cfg);
3955
3947
  }
3956
3948
  /**
3957
3949
  * XHR DELETE 请求
@@ -3962,7 +3954,7 @@ function xhr_get(url, cb, params, cfg = DEFAULT_XHR_CFG) {
3962
3954
  * @param cfg 配置,可选的
3963
3955
  */
3964
3956
  function xhr_del(url, cb, params, cfg = DEFAULT_XHR_CFG) {
3965
- getOrDel('delete', url, cb, params, cfg);
3957
+ getOrDel('delete', url, cb, params, cfg);
3966
3958
  }
3967
3959
  /**
3968
3960
  * XHR POST 请求
@@ -3973,7 +3965,7 @@ function xhr_del(url, cb, params, cfg = DEFAULT_XHR_CFG) {
3973
3965
  * @param cfg 配置,可选的
3974
3966
  */
3975
3967
  function xhr_post(url, cb, params, cfg = DEFAULT_XHR_CFG) {
3976
- postOrPut('post', url, cb, params, cfg);
3968
+ postOrPut('post', url, cb, params, cfg);
3977
3969
  }
3978
3970
  /**
3979
3971
  * XHR PUT 请求
@@ -3984,7 +3976,7 @@ function xhr_post(url, cb, params, cfg = DEFAULT_XHR_CFG) {
3984
3976
  * @param cfg 配置,可选的
3985
3977
  */
3986
3978
  function xhr_put(url, cb, params, cfg = DEFAULT_XHR_CFG) {
3987
- postOrPut('put', url, cb, params, cfg);
3979
+ postOrPut('put', url, cb, params, cfg);
3988
3980
  }
3989
3981
  /**
3990
3982
  * 初始化 XHR
@@ -3993,14 +3985,13 @@ function xhr_put(url, cb, params, cfg = DEFAULT_XHR_CFG) {
3993
3985
  * @returns
3994
3986
  */
3995
3987
  function initXhr(cfg) {
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;
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;
4004
3995
  }
4005
3996
  /**
4006
3997
  * 错误处理
@@ -4008,16 +3999,10 @@ function initXhr(cfg) {
4008
3999
  * @param xhr
4009
4000
  */
4010
4001
  function errHandle(xhr) {
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);
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);
4021
4006
  }
4022
4007
  /**
4023
4008
  * 响应处理
@@ -4027,33 +4012,29 @@ function errHandle(xhr) {
4027
4012
  * @param cfg
4028
4013
  */
4029
4014
  function responseHandle(xhr, cb, cfg) {
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
- }
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
+ }
4057
4038
  }
4058
4039
  /**
4059
4040
  * 对象转换为 URL 参数列表,用 & 分隔
@@ -4062,12 +4043,11 @@ function responseHandle(xhr, cb, cfg) {
4062
4043
  * @returns URL 参数列表
4063
4044
  */
4064
4045
  function toParams(param) {
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);
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);
4071
4051
  }
4072
4052
  /**
4073
4053
  * 获取 QueryString 的某个参数
@@ -4076,44 +4056,38 @@ function toParams(param) {
4076
4056
  * @returns
4077
4057
  */
4078
4058
  function getQuery(val) {
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 '';
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 '';
4088
4067
  }
4089
4068
  function getPageList(self, listArray, callback) {
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
- };
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
+ };
4099
4076
  }
4100
-
4101
4077
  var xhr = /*#__PURE__*/Object.freeze({
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
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
4112
4088
  });
4113
4089
 
4114
4090
 
4115
-
4116
-
4117
4091
  /***/ })
4118
4092
 
4119
4093
  /******/ });
@@ -4241,7 +4215,7 @@ var web_url_search_params_has = __webpack_require__(7566);
4241
4215
  // EXTERNAL MODULE: ./node_modules/core-js/modules/web.url-search-params.size.js
4242
4216
  var web_url_search_params_size = __webpack_require__(8721);
4243
4217
  // EXTERNAL MODULE: ./node_modules/@ajaxjs/util/dist/index.esm.js
4244
- var index_esm = __webpack_require__(2822);
4218
+ var index_esm = __webpack_require__(8030);
4245
4219
  ;// CONCATENATED MODULE: ./src/iam/iam.ts
4246
4220
 
4247
4221