@indfnd/utils 0.0.38 → 0.0.40
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.
- package/CHANGELOG.md +24 -0
- package/dist/ind-utils.es.js +165 -16
- package/dist/ind-utils.umd.cjs +20 -20
- package/package.json +1 -1
- package/src/api/item.ts +3 -9
- package/src/api/platform/user.ts +6 -3
- package/src/utils/base64.ts +124 -0
- package/src/utils/blob.ts +16 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/request/content-type.ts +8 -1
- package/src/utils/request/interceptors.ts +1 -1
- package/src/utils/table.ts +70 -9
- package/types/api/item.d.ts +1 -2
- package/types/api/item.d.ts.map +1 -1
- package/types/api/platform/user.d.ts.map +1 -1
- package/types/utils/base64.d.ts +23 -0
- package/types/utils/base64.d.ts.map +1 -0
- package/types/utils/blob.d.ts +1 -0
- package/types/utils/blob.d.ts.map +1 -1
- package/types/utils/index.d.ts +1 -0
- package/types/utils/index.d.ts.map +1 -1
- package/types/utils/request/content-type.d.ts +1 -0
- package/types/utils/request/content-type.d.ts.map +1 -1
- package/types/utils/table.d.ts +1 -1
- package/types/utils/table.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [0.0.40](http://git.inspur.com/imp-ec/ind-front/ind-utils/compare/v0.0.39...v0.0.40) (2024-03-13)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* 更新依赖 ([8f9c236](http://git.inspur.com/imp-ec/ind-front/ind-utils/commit/8f9c236a120f50fdf63aeff7a447e3ecea23ca6c))
|
|
11
|
+
* 文档中心获取图片并转base64 ([13259ad](http://git.inspur.com/imp-ec/ind-front/ind-utils/commit/13259ad7630893cec8731203a6d3c340946d9349))
|
|
12
|
+
|
|
13
|
+
### [0.0.39](http://git.inspur.com/imp-ec/ind-front/ind-utils/compare/v0.0.38...v0.0.39) (2024-03-06)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
* 登录加密参考云庭 ([c9c6649](http://git.inspur.com/imp-ec/ind-front/ind-utils/commit/c9c6649089b67720310fa69f580678fbafe1f7c9))
|
|
19
|
+
* 增加卷烟筛选条件接口 ([85ae986](http://git.inspur.com/imp-ec/ind-front/ind-utils/commit/85ae986e6abf95eb3f8ee1a849a5e7e16f7e27da))
|
|
20
|
+
* 增加卷烟筛选条件接口 ([445756b](http://git.inspur.com/imp-ec/ind-front/ind-utils/commit/445756bad5c92f77409262869c3152133ac36580))
|
|
21
|
+
* **table:** 行转列时可以设置headerTooltip ([28d17cd](http://git.inspur.com/imp-ec/ind-front/ind-utils/commit/28d17cd9c7d851576e72aea0da70255bcb7b488c))
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Bug Fixes
|
|
25
|
+
|
|
26
|
+
* 更新依赖 ([6044adf](http://git.inspur.com/imp-ec/ind-front/ind-utils/commit/6044adfb0236e379af6173d5150b3c48f4a55fb9))
|
|
27
|
+
* 接口url修改 ([fb0abd2](http://git.inspur.com/imp-ec/ind-front/ind-utils/commit/fb0abd242f0057ec4a895b655712d07432303d0d))
|
|
28
|
+
|
|
5
29
|
### [0.0.38](http://git.inspur.com/imp-ec/ind-front/ind-utils/compare/v0.0.37...v0.0.38) (2024-03-03)
|
|
6
30
|
|
|
7
31
|
|
package/dist/ind-utils.es.js
CHANGED
|
@@ -3167,7 +3167,12 @@ function getUrlParams() {
|
|
|
3167
3167
|
}
|
|
3168
3168
|
const contentTypeKey = "Content-Type";
|
|
3169
3169
|
function getContentType(config2) {
|
|
3170
|
-
|
|
3170
|
+
let type = (config2 == null ? void 0 : config2[contentTypeKey]) || (config2 == null ? void 0 : config2["content-type"]) || "";
|
|
3171
|
+
const suffixIdx = type.indexOf(";");
|
|
3172
|
+
if (suffixIdx !== -1) {
|
|
3173
|
+
type = type.substring(0, suffixIdx);
|
|
3174
|
+
}
|
|
3175
|
+
return type;
|
|
3171
3176
|
}
|
|
3172
3177
|
function setContentType(headers, type) {
|
|
3173
3178
|
headers[contentTypeKey] = type;
|
|
@@ -3176,7 +3181,8 @@ const CONTENT_TYPE = {
|
|
|
3176
3181
|
form: "application/x-www-form-urlencoded",
|
|
3177
3182
|
multiForm: "multipart/form-data",
|
|
3178
3183
|
body: "application/json",
|
|
3179
|
-
os: "application/octet-stream"
|
|
3184
|
+
os: "application/octet-stream",
|
|
3185
|
+
json: "application/json"
|
|
3180
3186
|
};
|
|
3181
3187
|
const TOKEN_KEY = "v8-token";
|
|
3182
3188
|
const TOKEN_KEY_IBP = "lambo-token";
|
|
@@ -3304,7 +3310,7 @@ function requestInterceptors(config2) {
|
|
|
3304
3310
|
function responseInterceptors(response) {
|
|
3305
3311
|
let data = response.data;
|
|
3306
3312
|
const contentType = getContentType(response.headers);
|
|
3307
|
-
if (contentType
|
|
3313
|
+
if (contentType !== CONTENT_TYPE.json) {
|
|
3308
3314
|
return data;
|
|
3309
3315
|
}
|
|
3310
3316
|
if (typeof response.data === "string") {
|
|
@@ -3740,6 +3746,92 @@ const cryptor = {
|
|
|
3740
3746
|
return s + "{1#2$3%4(5)6@7!poeeww$3%4(5)djjkkldss}";
|
|
3741
3747
|
}
|
|
3742
3748
|
};
|
|
3749
|
+
let Base64ForLogin = {
|
|
3750
|
+
Base64Chars: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@*-",
|
|
3751
|
+
encode: function(s) {
|
|
3752
|
+
if (!s || s.length == 0)
|
|
3753
|
+
return s;
|
|
3754
|
+
var d = "";
|
|
3755
|
+
var b = this.ucs2_utf8(s);
|
|
3756
|
+
var b0, b1, b2, b3;
|
|
3757
|
+
var len = b.length;
|
|
3758
|
+
var i = 0;
|
|
3759
|
+
while (i < len) {
|
|
3760
|
+
var tmp = b[i++];
|
|
3761
|
+
b0 = (tmp & 252) >> 2;
|
|
3762
|
+
b1 = (tmp & 3) << 4;
|
|
3763
|
+
if (i < len) {
|
|
3764
|
+
tmp = b[i++];
|
|
3765
|
+
b1 |= (tmp & 240) >> 4;
|
|
3766
|
+
b2 = (tmp & 15) << 2;
|
|
3767
|
+
if (i < len) {
|
|
3768
|
+
tmp = b[i++];
|
|
3769
|
+
b2 |= (tmp & 192) >> 6;
|
|
3770
|
+
b3 = tmp & 63;
|
|
3771
|
+
} else {
|
|
3772
|
+
b3 = 64;
|
|
3773
|
+
}
|
|
3774
|
+
} else {
|
|
3775
|
+
b2 = b3 = 64;
|
|
3776
|
+
}
|
|
3777
|
+
d += this.Base64Chars.charAt(b0);
|
|
3778
|
+
d += this.Base64Chars.charAt(b1);
|
|
3779
|
+
d += this.Base64Chars.charAt(b2);
|
|
3780
|
+
d += this.Base64Chars.charAt(b3);
|
|
3781
|
+
}
|
|
3782
|
+
return d;
|
|
3783
|
+
},
|
|
3784
|
+
ucs2_utf8: function(s) {
|
|
3785
|
+
if (!s)
|
|
3786
|
+
return null;
|
|
3787
|
+
var d = new Array();
|
|
3788
|
+
if (s == "")
|
|
3789
|
+
return d;
|
|
3790
|
+
var c = 0, i = 0, j = 0;
|
|
3791
|
+
var len = s.length;
|
|
3792
|
+
while (i < len) {
|
|
3793
|
+
c = s.charCodeAt(i++);
|
|
3794
|
+
if (c <= 127) {
|
|
3795
|
+
d[j++] = c;
|
|
3796
|
+
} else if (c >= 128 && c <= 2047) {
|
|
3797
|
+
d[j++] = c >> 6 & 31 | 192;
|
|
3798
|
+
d[j++] = c & 63 | 128;
|
|
3799
|
+
} else {
|
|
3800
|
+
d[j++] = c >> 12 | 224;
|
|
3801
|
+
d[j++] = c >> 6 & 63 | 128;
|
|
3802
|
+
d[j++] = c & 63 | 128;
|
|
3803
|
+
}
|
|
3804
|
+
}
|
|
3805
|
+
return d;
|
|
3806
|
+
},
|
|
3807
|
+
utf8_ucs2: function(s) {
|
|
3808
|
+
if (!s)
|
|
3809
|
+
return null;
|
|
3810
|
+
var len = s.length;
|
|
3811
|
+
if (len == 0)
|
|
3812
|
+
return "";
|
|
3813
|
+
var d = "";
|
|
3814
|
+
var c = 0, i = 0, tmp = 0;
|
|
3815
|
+
while (i < len) {
|
|
3816
|
+
c = s[i++];
|
|
3817
|
+
if ((c & 224) == 224) {
|
|
3818
|
+
tmp = (c & 15) << 12;
|
|
3819
|
+
c = s[i++];
|
|
3820
|
+
tmp |= (c & 63) << 6;
|
|
3821
|
+
c = s[i++];
|
|
3822
|
+
tmp |= c & 63;
|
|
3823
|
+
} else if ((c & 192) == 192) {
|
|
3824
|
+
tmp = (c & 31) << 6;
|
|
3825
|
+
c = s[i++];
|
|
3826
|
+
tmp |= c & 63;
|
|
3827
|
+
} else {
|
|
3828
|
+
tmp = c;
|
|
3829
|
+
}
|
|
3830
|
+
d += String.fromCharCode(tmp);
|
|
3831
|
+
}
|
|
3832
|
+
return d;
|
|
3833
|
+
}
|
|
3834
|
+
};
|
|
3743
3835
|
function base64ToBlob(base64Data, contentType) {
|
|
3744
3836
|
contentType = contentType || "";
|
|
3745
3837
|
const sliceSize = 1024;
|
|
@@ -3758,6 +3850,21 @@ function base64ToBlob(base64Data, contentType) {
|
|
|
3758
3850
|
}
|
|
3759
3851
|
return new Blob(byteArrays, { type: contentType });
|
|
3760
3852
|
}
|
|
3853
|
+
function blobToBase64(blob, hasPrefix = true) {
|
|
3854
|
+
return new Promise((resolve) => {
|
|
3855
|
+
const reader = new FileReader();
|
|
3856
|
+
reader.onload = function() {
|
|
3857
|
+
const base64Data = (reader == null ? void 0 : reader.result) || "";
|
|
3858
|
+
if (hasPrefix) {
|
|
3859
|
+
resolve(base64Data);
|
|
3860
|
+
return;
|
|
3861
|
+
}
|
|
3862
|
+
const base64WithoutPrefix = base64Data.split(",")[1];
|
|
3863
|
+
resolve(base64WithoutPrefix);
|
|
3864
|
+
};
|
|
3865
|
+
reader.readAsDataURL(blob);
|
|
3866
|
+
});
|
|
3867
|
+
}
|
|
3761
3868
|
var dayjs_min = { exports: {} };
|
|
3762
3869
|
(function(module, exports) {
|
|
3763
3870
|
!function(t, e) {
|
|
@@ -10507,6 +10614,24 @@ function getQuarterEndMonth(quarter) {
|
|
|
10507
10614
|
}
|
|
10508
10615
|
const GROUP_SEP = "__";
|
|
10509
10616
|
const VALUE_SEP = "--";
|
|
10617
|
+
function renderHeaderTooltip({
|
|
10618
|
+
tooltip,
|
|
10619
|
+
item,
|
|
10620
|
+
parents,
|
|
10621
|
+
title
|
|
10622
|
+
}) {
|
|
10623
|
+
let text = null;
|
|
10624
|
+
if (tooltip) {
|
|
10625
|
+
if (isFunction(tooltip)) {
|
|
10626
|
+
text = tooltip(item, parents);
|
|
10627
|
+
} else if (tooltip === true) {
|
|
10628
|
+
text = title;
|
|
10629
|
+
} else {
|
|
10630
|
+
text = tooltip;
|
|
10631
|
+
}
|
|
10632
|
+
}
|
|
10633
|
+
return text;
|
|
10634
|
+
}
|
|
10510
10635
|
function renderColumnTree(data, columnGroup, option = {}) {
|
|
10511
10636
|
const _a = columnGroup, {
|
|
10512
10637
|
key,
|
|
@@ -10518,6 +10643,7 @@ function renderColumnTree(data, columnGroup, option = {}) {
|
|
|
10518
10643
|
sortOrder = "asc",
|
|
10519
10644
|
keyLastSuffix,
|
|
10520
10645
|
isLimitChildren,
|
|
10646
|
+
headerTooltip,
|
|
10521
10647
|
children
|
|
10522
10648
|
} = _a, args = __objRest(_a, [
|
|
10523
10649
|
"key",
|
|
@@ -10529,9 +10655,10 @@ function renderColumnTree(data, columnGroup, option = {}) {
|
|
|
10529
10655
|
"sortOrder",
|
|
10530
10656
|
"keyLastSuffix",
|
|
10531
10657
|
"isLimitChildren",
|
|
10658
|
+
"headerTooltip",
|
|
10532
10659
|
"children"
|
|
10533
10660
|
]);
|
|
10534
|
-
const { keyPropName = "key", titlePropName = "title", keyPrefix = "" } = option;
|
|
10661
|
+
const { keyPropName = "key", titlePropName = "title", keyPrefix = "", parents = [] } = option;
|
|
10535
10662
|
if (keyProp) {
|
|
10536
10663
|
let columnUniqData = _.uniqBy(data, columnGroup.keyProp) || [];
|
|
10537
10664
|
if (sortProp) {
|
|
@@ -10545,10 +10672,19 @@ function renderColumnTree(data, columnGroup, option = {}) {
|
|
|
10545
10672
|
const prefix = `${keyPrefix}${keyProp}${VALUE_SEP}${item[keyProp]}${GROUP_SEP}`;
|
|
10546
10673
|
const columnChildren = children.map((child) => {
|
|
10547
10674
|
let nextData = isLimitChildren ? data.filter((temp) => temp[keyProp] === item[keyProp]) : data;
|
|
10548
|
-
return renderColumnTree(nextData, child, __spreadProps(__spreadValues({}, option), {
|
|
10675
|
+
return renderColumnTree(nextData, child, __spreadProps(__spreadValues({}, option), {
|
|
10676
|
+
keyPrefix: prefix,
|
|
10677
|
+
parents: [...parents, item]
|
|
10678
|
+
}));
|
|
10549
10679
|
});
|
|
10550
10680
|
return __spreadProps(__spreadValues({}, args), {
|
|
10551
10681
|
[titlePropName]: columnTitle,
|
|
10682
|
+
headerTooltip: renderHeaderTooltip({
|
|
10683
|
+
tooltip: headerTooltip,
|
|
10684
|
+
item,
|
|
10685
|
+
parents,
|
|
10686
|
+
title: columnTitle
|
|
10687
|
+
}),
|
|
10552
10688
|
children: _.flatten(columnChildren)
|
|
10553
10689
|
});
|
|
10554
10690
|
}
|
|
@@ -10559,14 +10695,28 @@ function renderColumnTree(data, columnGroup, option = {}) {
|
|
|
10559
10695
|
});
|
|
10560
10696
|
});
|
|
10561
10697
|
}
|
|
10698
|
+
const headerTooltipText = renderHeaderTooltip({
|
|
10699
|
+
tooltip: headerTooltip,
|
|
10700
|
+
item: {},
|
|
10701
|
+
parents,
|
|
10702
|
+
title
|
|
10703
|
+
});
|
|
10562
10704
|
if (children && children.length) {
|
|
10563
10705
|
const prefix = `${keyPrefix}${key}`;
|
|
10564
10706
|
const columnChildren = children.map((child) => {
|
|
10565
10707
|
return renderColumnTree(data, child, __spreadProps(__spreadValues({}, option), { keyPrefix: prefix }));
|
|
10566
10708
|
});
|
|
10567
|
-
return __spreadProps(__spreadValues({}, args), {
|
|
10709
|
+
return __spreadProps(__spreadValues({}, args), {
|
|
10710
|
+
[titlePropName]: title,
|
|
10711
|
+
headerTooltip: headerTooltipText,
|
|
10712
|
+
children: _.flatten(columnChildren)
|
|
10713
|
+
});
|
|
10568
10714
|
}
|
|
10569
|
-
return __spreadProps(__spreadValues({}, args), {
|
|
10715
|
+
return __spreadProps(__spreadValues({}, args), {
|
|
10716
|
+
[keyPropName]: `${keyPrefix}${key}`,
|
|
10717
|
+
[titlePropName]: title,
|
|
10718
|
+
headerTooltip: headerTooltipText
|
|
10719
|
+
});
|
|
10570
10720
|
}
|
|
10571
10721
|
function getLeafColumns(columns = []) {
|
|
10572
10722
|
if (!columns || !columns.length)
|
|
@@ -10894,8 +11044,10 @@ function putOssFileApi(filename, blob) {
|
|
|
10894
11044
|
}
|
|
10895
11045
|
const CONTEXT$2 = config.authServerContext;
|
|
10896
11046
|
function loginApi({ userName, password, validCodeId, validCodeInput }) {
|
|
10897
|
-
|
|
10898
|
-
|
|
11047
|
+
let upw = encodeURIComponent(password);
|
|
11048
|
+
upw = Base64ForLogin.encode(upw);
|
|
11049
|
+
const data = { usn: userName, upw, validCodeId, validCodeInput };
|
|
11050
|
+
return instance.formPost(CONTEXT$2 + "/sso/auth/login", data);
|
|
10899
11051
|
}
|
|
10900
11052
|
function getUserInfoApi() {
|
|
10901
11053
|
return instance.get(`${CONTEXT$2}/manage/user/getCurrentInfo`);
|
|
@@ -10929,17 +11081,14 @@ const CONTEXT = config.ismAmServerContext;
|
|
|
10929
11081
|
function listItemTreeApi(params) {
|
|
10930
11082
|
return instance.get(`${CONTEXT}/tree/item/listItemTree`, { params });
|
|
10931
11083
|
}
|
|
10932
|
-
function
|
|
10933
|
-
return instance.get(`${CONTEXT}/
|
|
10934
|
-
}
|
|
10935
|
-
function getPriceSeg(params) {
|
|
10936
|
-
return instance.get(`${CONTEXT}/tree/item/listComTree`, { params });
|
|
11084
|
+
function getPriceInfo() {
|
|
11085
|
+
return instance.get(`${CONTEXT}/basic/getPriceInfo`, {});
|
|
10937
11086
|
}
|
|
10938
11087
|
function getItem(params) {
|
|
10939
|
-
return instance.get(`${CONTEXT}/
|
|
11088
|
+
return instance.get(`${CONTEXT}/basic/getItem`, { params });
|
|
10940
11089
|
}
|
|
10941
11090
|
const UC_CONTEXT = config.ucExtServerContext;
|
|
10942
11091
|
function listUserTreeApi(params) {
|
|
10943
11092
|
return instance.get(`${UC_CONTEXT}/tree/uc-user/listUserTree`, { params });
|
|
10944
11093
|
}
|
|
10945
|
-
export { CONTENT_TYPE, IS_OR_NOT_ENUM, IS_OR_NOT_ENUM_KEY, IS_OR_NOT_ENUM_LIST, MIME_TYPE, UC_ENUM, addMenuCollectApi, instance as axios, base64ToBlob, checkIdCard, checkPhone, checkTel, checkVehicleNo, clearIndexDescCache, clearPermissionCache, clearSessionStorage, clearUserInfoCache, config, cryptor, deleteMenuCollectApi, deleteMenuHistoryApi, exportJsonToExcel, flattenRow2ColumnData, formatDate, formatDateChinese, formatDecimal, formatHalfYear, formatQuarter, getAppListApi, getCaptchaURL, getContentType, getDictApi, getDictMapApi, getDictsMapApi, getExcelColumnIdx, getGlobalPolicyApi, getHalfYear, getHalfYearBeginMonth, getHalfYearEndMonth, getHalfYearNum, getIndexDescCache, getItem, getLocalStorage, getMaxTabNumValueApi, getMenuCollectApi, getMenuHistoryApi, getOssFileApi, getOssFileUrl, getPermissionApi, getPermissionCache,
|
|
11094
|
+
export { Base64ForLogin, CONTENT_TYPE, IS_OR_NOT_ENUM, IS_OR_NOT_ENUM_KEY, IS_OR_NOT_ENUM_LIST, MIME_TYPE, UC_ENUM, addMenuCollectApi, instance as axios, base64ToBlob, blobToBase64, checkIdCard, checkPhone, checkTel, checkVehicleNo, clearIndexDescCache, clearPermissionCache, clearSessionStorage, clearUserInfoCache, config, cryptor, deleteMenuCollectApi, deleteMenuHistoryApi, exportJsonToExcel, flattenRow2ColumnData, formatDate, formatDateChinese, formatDecimal, formatHalfYear, formatQuarter, getAppListApi, getCaptchaURL, getContentType, getDictApi, getDictMapApi, getDictsMapApi, getExcelColumnIdx, getGlobalPolicyApi, getHalfYear, getHalfYearBeginMonth, getHalfYearEndMonth, getHalfYearNum, getIndexDescCache, getItem, getLocalStorage, getMaxTabNumValueApi, getMenuCollectApi, getMenuHistoryApi, getOssFileApi, getOssFileUrl, getPermissionApi, getPermissionCache, getPriceInfo, getQuarter, getQuarterBeginMonth, getQuarterEndMonth, getQuarterNum, getSessionStorage, getToken, getType, getUrlParams, getUserInfoApi, getUserInfoCache, guid, importJsonFromExcel, isArguments, isArray, isArrayLike, isBoolean, isDate, isDecimal, isElement, isEmpty, isEqual, isEqualWith, isError, isEven, isFinite$1 as isFinite, isFunction, isInteger, isNegative, isNil, isNull, isNumber, isNumberEqual, isObject, isObjectLike, isOdd, isPlainObject, isPositive, isPromise, isPrototype, isRegExp2 as isRegExp, isString, isType, isUndefined, listComTreeApi, listIndexDescApi, listItemTreeApi, listUserTreeApi, loginApi, logoutApi, menuHistoryApi, numToChineseNumerals, numToDX, off, on, preventDefault, putOssFileApi, putOssFileUrl, quarter2Chinese, removeLocalStorage, removeMenuCollectApi, removeSessionStorage, renderColumnEnums, renderEnumData, renderEnumList, renderFieldEnums, responseInterceptors, round, row2column, setContentType, setIndexDescCache, setLocalStorage, setPermissionCache, setSessionStorage, setToken, setUserInfoCache, stopPropagation, str2Date, toChies, toFixed, toThousands, updatePasswordApi, useConfig, uuid };
|