@indfnd/utils 0.0.37 → 0.0.39
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 +23 -0
- package/dist/ind-utils.es.js +160 -13
- package/dist/ind-utils.umd.cjs +20 -20
- package/package.json +1 -1
- package/src/api/index-desc.ts +14 -0
- package/src/api/index.ts +1 -0
- 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/cache/index-desc.ts +15 -0
- package/src/utils/cache/index.ts +1 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/table.ts +70 -9
- package/types/api/index-desc.d.ts +10 -0
- package/types/api/index-desc.d.ts.map +1 -0
- package/types/api/index.d.ts +1 -0
- package/types/api/index.d.ts.map +1 -1
- 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/cache/index-desc.d.ts +4 -0
- package/types/utils/cache/index-desc.d.ts.map +1 -0
- package/types/utils/cache/index.d.ts +1 -0
- package/types/utils/cache/index.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/table.d.ts +1 -1
- package/types/utils/table.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,29 @@
|
|
|
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.39](http://git.inspur.com/imp-ec/ind-front/ind-utils/compare/v0.0.38...v0.0.39) (2024-03-06)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* 登录加密参考云庭 ([c9c6649](http://git.inspur.com/imp-ec/ind-front/ind-utils/commit/c9c6649089b67720310fa69f580678fbafe1f7c9))
|
|
11
|
+
* 增加卷烟筛选条件接口 ([85ae986](http://git.inspur.com/imp-ec/ind-front/ind-utils/commit/85ae986e6abf95eb3f8ee1a849a5e7e16f7e27da))
|
|
12
|
+
* 增加卷烟筛选条件接口 ([445756b](http://git.inspur.com/imp-ec/ind-front/ind-utils/commit/445756bad5c92f77409262869c3152133ac36580))
|
|
13
|
+
* **table:** 行转列时可以设置headerTooltip ([28d17cd](http://git.inspur.com/imp-ec/ind-front/ind-utils/commit/28d17cd9c7d851576e72aea0da70255bcb7b488c))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* 更新依赖 ([6044adf](http://git.inspur.com/imp-ec/ind-front/ind-utils/commit/6044adfb0236e379af6173d5150b3c48f4a55fb9))
|
|
19
|
+
* 接口url修改 ([fb0abd2](http://git.inspur.com/imp-ec/ind-front/ind-utils/commit/fb0abd242f0057ec4a895b655712d07432303d0d))
|
|
20
|
+
|
|
21
|
+
### [0.0.38](http://git.inspur.com/imp-ec/ind-front/ind-utils/compare/v0.0.37...v0.0.38) (2024-03-03)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Features
|
|
25
|
+
|
|
26
|
+
* 增加指标描述功能 ([268d147](http://git.inspur.com/imp-ec/ind-front/ind-utils/commit/268d14778072fdc975a7cf5741e37fb56d492bf7))
|
|
27
|
+
|
|
5
28
|
### [0.0.37](http://git.inspur.com/imp-ec/ind-front/ind-utils/compare/v0.0.36...v0.0.37) (2024-03-02)
|
|
6
29
|
|
|
7
30
|
|
package/dist/ind-utils.es.js
CHANGED
|
@@ -92,6 +92,16 @@ const setLocalStorage = (key, value) => {
|
|
|
92
92
|
const removeLocalStorage = (key) => {
|
|
93
93
|
return localStorage.removeItem(key);
|
|
94
94
|
};
|
|
95
|
+
const INDEX_DESC_KEY = "indexDesc";
|
|
96
|
+
function getIndexDescCache() {
|
|
97
|
+
return getLocalStorage(INDEX_DESC_KEY);
|
|
98
|
+
}
|
|
99
|
+
function setIndexDescCache(data) {
|
|
100
|
+
setLocalStorage(INDEX_DESC_KEY, data);
|
|
101
|
+
}
|
|
102
|
+
function clearIndexDescCache() {
|
|
103
|
+
removeLocalStorage(INDEX_DESC_KEY);
|
|
104
|
+
}
|
|
95
105
|
const PERMISSION_KEY = "ibp-permission";
|
|
96
106
|
function getPermissionCache() {
|
|
97
107
|
return getSessionStorage(PERMISSION_KEY);
|
|
@@ -3730,6 +3740,92 @@ const cryptor = {
|
|
|
3730
3740
|
return s + "{1#2$3%4(5)6@7!poeeww$3%4(5)djjkkldss}";
|
|
3731
3741
|
}
|
|
3732
3742
|
};
|
|
3743
|
+
let Base64ForLogin = {
|
|
3744
|
+
Base64Chars: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@*-",
|
|
3745
|
+
encode: function(s) {
|
|
3746
|
+
if (!s || s.length == 0)
|
|
3747
|
+
return s;
|
|
3748
|
+
var d = "";
|
|
3749
|
+
var b = this.ucs2_utf8(s);
|
|
3750
|
+
var b0, b1, b2, b3;
|
|
3751
|
+
var len = b.length;
|
|
3752
|
+
var i = 0;
|
|
3753
|
+
while (i < len) {
|
|
3754
|
+
var tmp = b[i++];
|
|
3755
|
+
b0 = (tmp & 252) >> 2;
|
|
3756
|
+
b1 = (tmp & 3) << 4;
|
|
3757
|
+
if (i < len) {
|
|
3758
|
+
tmp = b[i++];
|
|
3759
|
+
b1 |= (tmp & 240) >> 4;
|
|
3760
|
+
b2 = (tmp & 15) << 2;
|
|
3761
|
+
if (i < len) {
|
|
3762
|
+
tmp = b[i++];
|
|
3763
|
+
b2 |= (tmp & 192) >> 6;
|
|
3764
|
+
b3 = tmp & 63;
|
|
3765
|
+
} else {
|
|
3766
|
+
b3 = 64;
|
|
3767
|
+
}
|
|
3768
|
+
} else {
|
|
3769
|
+
b2 = b3 = 64;
|
|
3770
|
+
}
|
|
3771
|
+
d += this.Base64Chars.charAt(b0);
|
|
3772
|
+
d += this.Base64Chars.charAt(b1);
|
|
3773
|
+
d += this.Base64Chars.charAt(b2);
|
|
3774
|
+
d += this.Base64Chars.charAt(b3);
|
|
3775
|
+
}
|
|
3776
|
+
return d;
|
|
3777
|
+
},
|
|
3778
|
+
ucs2_utf8: function(s) {
|
|
3779
|
+
if (!s)
|
|
3780
|
+
return null;
|
|
3781
|
+
var d = new Array();
|
|
3782
|
+
if (s == "")
|
|
3783
|
+
return d;
|
|
3784
|
+
var c = 0, i = 0, j = 0;
|
|
3785
|
+
var len = s.length;
|
|
3786
|
+
while (i < len) {
|
|
3787
|
+
c = s.charCodeAt(i++);
|
|
3788
|
+
if (c <= 127) {
|
|
3789
|
+
d[j++] = c;
|
|
3790
|
+
} else if (c >= 128 && c <= 2047) {
|
|
3791
|
+
d[j++] = c >> 6 & 31 | 192;
|
|
3792
|
+
d[j++] = c & 63 | 128;
|
|
3793
|
+
} else {
|
|
3794
|
+
d[j++] = c >> 12 | 224;
|
|
3795
|
+
d[j++] = c >> 6 & 63 | 128;
|
|
3796
|
+
d[j++] = c & 63 | 128;
|
|
3797
|
+
}
|
|
3798
|
+
}
|
|
3799
|
+
return d;
|
|
3800
|
+
},
|
|
3801
|
+
utf8_ucs2: function(s) {
|
|
3802
|
+
if (!s)
|
|
3803
|
+
return null;
|
|
3804
|
+
var len = s.length;
|
|
3805
|
+
if (len == 0)
|
|
3806
|
+
return "";
|
|
3807
|
+
var d = "";
|
|
3808
|
+
var c = 0, i = 0, tmp = 0;
|
|
3809
|
+
while (i < len) {
|
|
3810
|
+
c = s[i++];
|
|
3811
|
+
if ((c & 224) == 224) {
|
|
3812
|
+
tmp = (c & 15) << 12;
|
|
3813
|
+
c = s[i++];
|
|
3814
|
+
tmp |= (c & 63) << 6;
|
|
3815
|
+
c = s[i++];
|
|
3816
|
+
tmp |= c & 63;
|
|
3817
|
+
} else if ((c & 192) == 192) {
|
|
3818
|
+
tmp = (c & 31) << 6;
|
|
3819
|
+
c = s[i++];
|
|
3820
|
+
tmp |= c & 63;
|
|
3821
|
+
} else {
|
|
3822
|
+
tmp = c;
|
|
3823
|
+
}
|
|
3824
|
+
d += String.fromCharCode(tmp);
|
|
3825
|
+
}
|
|
3826
|
+
return d;
|
|
3827
|
+
}
|
|
3828
|
+
};
|
|
3733
3829
|
function base64ToBlob(base64Data, contentType) {
|
|
3734
3830
|
contentType = contentType || "";
|
|
3735
3831
|
const sliceSize = 1024;
|
|
@@ -10497,6 +10593,24 @@ function getQuarterEndMonth(quarter) {
|
|
|
10497
10593
|
}
|
|
10498
10594
|
const GROUP_SEP = "__";
|
|
10499
10595
|
const VALUE_SEP = "--";
|
|
10596
|
+
function renderHeaderTooltip({
|
|
10597
|
+
tooltip,
|
|
10598
|
+
item,
|
|
10599
|
+
parents,
|
|
10600
|
+
title
|
|
10601
|
+
}) {
|
|
10602
|
+
let text = null;
|
|
10603
|
+
if (tooltip) {
|
|
10604
|
+
if (isFunction(tooltip)) {
|
|
10605
|
+
text = tooltip(item, parents);
|
|
10606
|
+
} else if (tooltip === true) {
|
|
10607
|
+
text = title;
|
|
10608
|
+
} else {
|
|
10609
|
+
text = tooltip;
|
|
10610
|
+
}
|
|
10611
|
+
}
|
|
10612
|
+
return text;
|
|
10613
|
+
}
|
|
10500
10614
|
function renderColumnTree(data, columnGroup, option = {}) {
|
|
10501
10615
|
const _a = columnGroup, {
|
|
10502
10616
|
key,
|
|
@@ -10508,6 +10622,7 @@ function renderColumnTree(data, columnGroup, option = {}) {
|
|
|
10508
10622
|
sortOrder = "asc",
|
|
10509
10623
|
keyLastSuffix,
|
|
10510
10624
|
isLimitChildren,
|
|
10625
|
+
headerTooltip,
|
|
10511
10626
|
children
|
|
10512
10627
|
} = _a, args = __objRest(_a, [
|
|
10513
10628
|
"key",
|
|
@@ -10519,9 +10634,10 @@ function renderColumnTree(data, columnGroup, option = {}) {
|
|
|
10519
10634
|
"sortOrder",
|
|
10520
10635
|
"keyLastSuffix",
|
|
10521
10636
|
"isLimitChildren",
|
|
10637
|
+
"headerTooltip",
|
|
10522
10638
|
"children"
|
|
10523
10639
|
]);
|
|
10524
|
-
const { keyPropName = "key", titlePropName = "title", keyPrefix = "" } = option;
|
|
10640
|
+
const { keyPropName = "key", titlePropName = "title", keyPrefix = "", parents = [] } = option;
|
|
10525
10641
|
if (keyProp) {
|
|
10526
10642
|
let columnUniqData = _.uniqBy(data, columnGroup.keyProp) || [];
|
|
10527
10643
|
if (sortProp) {
|
|
@@ -10535,10 +10651,19 @@ function renderColumnTree(data, columnGroup, option = {}) {
|
|
|
10535
10651
|
const prefix = `${keyPrefix}${keyProp}${VALUE_SEP}${item[keyProp]}${GROUP_SEP}`;
|
|
10536
10652
|
const columnChildren = children.map((child) => {
|
|
10537
10653
|
let nextData = isLimitChildren ? data.filter((temp) => temp[keyProp] === item[keyProp]) : data;
|
|
10538
|
-
return renderColumnTree(nextData, child, __spreadProps(__spreadValues({}, option), {
|
|
10654
|
+
return renderColumnTree(nextData, child, __spreadProps(__spreadValues({}, option), {
|
|
10655
|
+
keyPrefix: prefix,
|
|
10656
|
+
parents: [...parents, item]
|
|
10657
|
+
}));
|
|
10539
10658
|
});
|
|
10540
10659
|
return __spreadProps(__spreadValues({}, args), {
|
|
10541
10660
|
[titlePropName]: columnTitle,
|
|
10661
|
+
headerTooltip: renderHeaderTooltip({
|
|
10662
|
+
tooltip: headerTooltip,
|
|
10663
|
+
item,
|
|
10664
|
+
parents,
|
|
10665
|
+
title: columnTitle
|
|
10666
|
+
}),
|
|
10542
10667
|
children: _.flatten(columnChildren)
|
|
10543
10668
|
});
|
|
10544
10669
|
}
|
|
@@ -10549,14 +10674,28 @@ function renderColumnTree(data, columnGroup, option = {}) {
|
|
|
10549
10674
|
});
|
|
10550
10675
|
});
|
|
10551
10676
|
}
|
|
10677
|
+
const headerTooltipText = renderHeaderTooltip({
|
|
10678
|
+
tooltip: headerTooltip,
|
|
10679
|
+
item: {},
|
|
10680
|
+
parents,
|
|
10681
|
+
title
|
|
10682
|
+
});
|
|
10552
10683
|
if (children && children.length) {
|
|
10553
10684
|
const prefix = `${keyPrefix}${key}`;
|
|
10554
10685
|
const columnChildren = children.map((child) => {
|
|
10555
10686
|
return renderColumnTree(data, child, __spreadProps(__spreadValues({}, option), { keyPrefix: prefix }));
|
|
10556
10687
|
});
|
|
10557
|
-
return __spreadProps(__spreadValues({}, args), {
|
|
10688
|
+
return __spreadProps(__spreadValues({}, args), {
|
|
10689
|
+
[titlePropName]: title,
|
|
10690
|
+
headerTooltip: headerTooltipText,
|
|
10691
|
+
children: _.flatten(columnChildren)
|
|
10692
|
+
});
|
|
10558
10693
|
}
|
|
10559
|
-
return __spreadProps(__spreadValues({}, args), {
|
|
10694
|
+
return __spreadProps(__spreadValues({}, args), {
|
|
10695
|
+
[keyPropName]: `${keyPrefix}${key}`,
|
|
10696
|
+
[titlePropName]: title,
|
|
10697
|
+
headerTooltip: headerTooltipText
|
|
10698
|
+
});
|
|
10560
10699
|
}
|
|
10561
10700
|
function getLeafColumns(columns = []) {
|
|
10562
10701
|
if (!columns || !columns.length)
|
|
@@ -10884,8 +11023,10 @@ function putOssFileApi(filename, blob) {
|
|
|
10884
11023
|
}
|
|
10885
11024
|
const CONTEXT$2 = config.authServerContext;
|
|
10886
11025
|
function loginApi({ userName, password, validCodeId, validCodeInput }) {
|
|
10887
|
-
|
|
10888
|
-
|
|
11026
|
+
let upw = encodeURIComponent(password);
|
|
11027
|
+
upw = Base64ForLogin.encode(upw);
|
|
11028
|
+
const data = { usn: userName, upw, validCodeId, validCodeInput };
|
|
11029
|
+
return instance.formPost(CONTEXT$2 + "/sso/auth/login", data);
|
|
10889
11030
|
}
|
|
10890
11031
|
function getUserInfoApi() {
|
|
10891
11032
|
return instance.get(`${CONTEXT$2}/manage/user/getCurrentInfo`);
|
|
@@ -10906,21 +11047,27 @@ const CONTEXT$1 = config.ismAmServerContext;
|
|
|
10906
11047
|
function listComTreeApi(params) {
|
|
10907
11048
|
return instance.get(`${CONTEXT$1}/tree/com/listComTree`, { params });
|
|
10908
11049
|
}
|
|
11050
|
+
config.ucExtServerContext;
|
|
11051
|
+
function listIndexDescApi(params) {
|
|
11052
|
+
return Promise.resolve({
|
|
11053
|
+
data: [
|
|
11054
|
+
{ indexCode: "comName", indexName: "\u5546\u4E1A\u516C\u53F8", indexDesc: "\u8FD9\u4E2A\u662F\u5546\u4E1A\u516C\u53F8\u7684\u63CF\u8FF0" },
|
|
11055
|
+
{ indexCode: "comSname", indexName: "\u5546\u4E1A\u516C\u53F8\u7B80\u79F0", indexDesc: "\u8FD9\u4E2A\u662F\u5546\u4E1A\u516C\u53F8\u7B80\u79F0\u7684\u63CF\u8FF0" }
|
|
11056
|
+
]
|
|
11057
|
+
});
|
|
11058
|
+
}
|
|
10909
11059
|
const CONTEXT = config.ismAmServerContext;
|
|
10910
11060
|
function listItemTreeApi(params) {
|
|
10911
11061
|
return instance.get(`${CONTEXT}/tree/item/listItemTree`, { params });
|
|
10912
11062
|
}
|
|
10913
|
-
function
|
|
10914
|
-
return instance.get(`${CONTEXT}/
|
|
10915
|
-
}
|
|
10916
|
-
function getPriceSeg(params) {
|
|
10917
|
-
return instance.get(`${CONTEXT}/tree/item/listComTree`, { params });
|
|
11063
|
+
function getPriceInfo() {
|
|
11064
|
+
return instance.get(`${CONTEXT}/basic/getPriceInfo`, {});
|
|
10918
11065
|
}
|
|
10919
11066
|
function getItem(params) {
|
|
10920
|
-
return instance.get(`${CONTEXT}/
|
|
11067
|
+
return instance.get(`${CONTEXT}/basic/getItem`, { params });
|
|
10921
11068
|
}
|
|
10922
11069
|
const UC_CONTEXT = config.ucExtServerContext;
|
|
10923
11070
|
function listUserTreeApi(params) {
|
|
10924
11071
|
return instance.get(`${UC_CONTEXT}/tree/uc-user/listUserTree`, { params });
|
|
10925
11072
|
}
|
|
10926
|
-
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, 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, getItem, getLocalStorage, getMaxTabNumValueApi, getMenuCollectApi, getMenuHistoryApi, getOssFileApi, getOssFileUrl, getPermissionApi, getPermissionCache,
|
|
11073
|
+
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, 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 };
|