@indfnd/utils 0.0.34 → 0.0.36
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 +17 -0
- package/dist/ind-utils.es.js +80 -15
- package/dist/ind-utils.umd.cjs +12 -12
- package/package.json +1 -1
- package/src/api/platform/oss.ts +53 -3
- package/src/utils/blob.ts +27 -0
- package/src/utils/event.ts +21 -2
- package/src/utils/index.ts +1 -0
- package/src/utils/request/content-type.ts +1 -1
- package/src/utils/request/interceptors.ts +1 -2
- package/src/utils/table.ts +26 -11
- package/types/api/platform/oss.d.ts +36 -1
- package/types/api/platform/oss.d.ts.map +1 -1
- package/types/utils/blob.d.ts +9 -0
- package/types/utils/blob.d.ts.map +1 -0
- package/types/utils/event.d.ts +10 -2
- package/types/utils/event.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 -1
- package/types/utils/request/interceptors.d.ts.map +1 -1
- package/types/utils/table.d.ts +3 -1
- package/types/utils/table.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,23 @@
|
|
|
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.36](http://git.inspur.com/imp-ec/ind-front/ind-utils/compare/v0.0.35...v0.0.36) (2024-03-01)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **api:** 增加文档中心上传接口 ([17a8174](http://git.inspur.com/imp-ec/ind-front/ind-utils/commit/17a8174e4ce0bcb8baffd9a1ac697587d2e60604))
|
|
11
|
+
* **blob:** 增加base64转blob方法 ([9d860c1](http://git.inspur.com/imp-ec/ind-front/ind-utils/commit/9d860c15520288f22d04a255bc63b1ff8cd698b8))
|
|
12
|
+
* **event:** 增加阻止事件默认行为和冒泡的方法 ([6f27ffa](http://git.inspur.com/imp-ec/ind-front/ind-utils/commit/6f27ffa1fa72da6d32bf1047f9c4988129125beb))
|
|
13
|
+
* **table:** 行转列增加动态列排序相关配置 ([e26e9c2](http://git.inspur.com/imp-ec/ind-front/ind-utils/commit/e26e9c29720d8f1beeacdd5d14e077d8d1c58d2a))
|
|
14
|
+
|
|
15
|
+
### [0.0.35](http://git.inspur.com/imp-ec/ind-front/ind-utils/compare/v0.0.34...v0.0.35) (2024-02-22)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* **request:** 修改超时时的报错 ([72f729b](http://git.inspur.com/imp-ec/ind-front/ind-utils/commit/72f729bbd56f7bc1a5773b2ed4af86602de372d4))
|
|
21
|
+
|
|
5
22
|
### [0.0.34](http://git.inspur.com/imp-ec/ind-front/ind-utils/compare/v0.0.33...v0.0.34) (2024-02-22)
|
|
6
23
|
|
|
7
24
|
|
package/dist/ind-utils.es.js
CHANGED
|
@@ -3164,7 +3164,7 @@ function setContentType(headers, type) {
|
|
|
3164
3164
|
}
|
|
3165
3165
|
const CONTENT_TYPE = {
|
|
3166
3166
|
form: "application/x-www-form-urlencoded",
|
|
3167
|
-
|
|
3167
|
+
multiForm: "multipart/form-data",
|
|
3168
3168
|
body: "application/json",
|
|
3169
3169
|
os: "application/octet-stream"
|
|
3170
3170
|
};
|
|
@@ -3319,10 +3319,10 @@ function responseInterceptors(response) {
|
|
|
3319
3319
|
return Promise.reject(data);
|
|
3320
3320
|
}
|
|
3321
3321
|
function inspectorError(error) {
|
|
3322
|
+
var _a;
|
|
3322
3323
|
if ((error == null ? void 0 : error.code) === "ECONNABORTED") {
|
|
3323
3324
|
window.apiErrorHandler && window.apiErrorHandler("\u8BF7\u6C42\u8D85\u65F6\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5");
|
|
3324
|
-
}
|
|
3325
|
-
if (error.response.status !== 200) {
|
|
3325
|
+
} else if (((_a = error == null ? void 0 : error.response) == null ? void 0 : _a.status) !== 200) {
|
|
3326
3326
|
window.apiErrorHandler && window.apiErrorHandler("\u8BF7\u6C42\u51FA\u9519\u4E86");
|
|
3327
3327
|
}
|
|
3328
3328
|
return Promise.reject(error);
|
|
@@ -3730,6 +3730,24 @@ const cryptor = {
|
|
|
3730
3730
|
return s + "{1#2$3%4(5)6@7!poeeww$3%4(5)djjkkldss}";
|
|
3731
3731
|
}
|
|
3732
3732
|
};
|
|
3733
|
+
function base64ToBlob(base64Data, contentType) {
|
|
3734
|
+
contentType = contentType || "";
|
|
3735
|
+
const sliceSize = 1024;
|
|
3736
|
+
const byteCharacters = atob(base64Data);
|
|
3737
|
+
const bytesLength = byteCharacters.length;
|
|
3738
|
+
const slicesCount = Math.ceil(bytesLength / sliceSize);
|
|
3739
|
+
const byteArrays = new Array(slicesCount);
|
|
3740
|
+
for (let sliceIndex = 0; sliceIndex < slicesCount; ++sliceIndex) {
|
|
3741
|
+
const begin = sliceIndex * sliceSize;
|
|
3742
|
+
const end = Math.min(begin + sliceSize, bytesLength);
|
|
3743
|
+
const bytes = new Array(end - begin);
|
|
3744
|
+
for (let offset = begin, i = 0; offset < end; ++i, ++offset) {
|
|
3745
|
+
bytes[i] = byteCharacters[offset].charCodeAt(0);
|
|
3746
|
+
}
|
|
3747
|
+
byteArrays[sliceIndex] = new Uint8Array(bytes);
|
|
3748
|
+
}
|
|
3749
|
+
return new Blob(byteArrays, { type: contentType });
|
|
3750
|
+
}
|
|
3733
3751
|
var dayjs_min = { exports: {} };
|
|
3734
3752
|
(function(module, exports) {
|
|
3735
3753
|
!function(t, e) {
|
|
@@ -10202,6 +10220,15 @@ function off(element, event, handler) {
|
|
|
10202
10220
|
fn(element, event, handler);
|
|
10203
10221
|
return fn;
|
|
10204
10222
|
}
|
|
10223
|
+
const stopPropagation = (event) => event.stopPropagation();
|
|
10224
|
+
function preventDefault(event, isStopPropagation) {
|
|
10225
|
+
if (typeof event.cancelable !== "boolean" || event.cancelable) {
|
|
10226
|
+
event.preventDefault();
|
|
10227
|
+
}
|
|
10228
|
+
if (isStopPropagation) {
|
|
10229
|
+
stopPropagation(event);
|
|
10230
|
+
}
|
|
10231
|
+
}
|
|
10205
10232
|
function getHalfYear(date) {
|
|
10206
10233
|
if (!date || date.length < 6) {
|
|
10207
10234
|
return "";
|
|
@@ -10471,16 +10498,34 @@ function getQuarterEndMonth(quarter) {
|
|
|
10471
10498
|
const GROUP_SEP = "__";
|
|
10472
10499
|
const VALUE_SEP = "--";
|
|
10473
10500
|
function renderColumnTree(data, columnGroup, option = {}) {
|
|
10474
|
-
const _a = columnGroup, {
|
|
10475
|
-
|
|
10476
|
-
|
|
10477
|
-
|
|
10478
|
-
|
|
10479
|
-
|
|
10480
|
-
|
|
10501
|
+
const _a = columnGroup, {
|
|
10502
|
+
key,
|
|
10503
|
+
keyProp,
|
|
10504
|
+
title,
|
|
10505
|
+
titleProp,
|
|
10506
|
+
titleFormatter,
|
|
10507
|
+
sortProp = keyProp,
|
|
10508
|
+
sortOrder = "asc",
|
|
10509
|
+
keyLastSuffix,
|
|
10510
|
+
children
|
|
10511
|
+
} = _a, args = __objRest(_a, [
|
|
10512
|
+
"key",
|
|
10513
|
+
"keyProp",
|
|
10514
|
+
"title",
|
|
10515
|
+
"titleProp",
|
|
10516
|
+
"titleFormatter",
|
|
10517
|
+
"sortProp",
|
|
10518
|
+
"sortOrder",
|
|
10519
|
+
"keyLastSuffix",
|
|
10520
|
+
"children"
|
|
10521
|
+
]);
|
|
10522
|
+
const { keyPropName = "key", titlePropName = "title", keyPrefix = "" } = option;
|
|
10481
10523
|
if (keyProp) {
|
|
10482
|
-
|
|
10483
|
-
|
|
10524
|
+
let columnGroupData = _.uniqBy(data, columnGroup.keyProp) || [];
|
|
10525
|
+
const unSortData = columnGroupData.filter((item) => isNil(item[sortProp]));
|
|
10526
|
+
const sortData = columnGroupData.filter((item) => !isNil(item[sortProp]));
|
|
10527
|
+
const sortedData = _.orderBy(sortData, [sortProp], [sortOrder]).concat(unSortData);
|
|
10528
|
+
return sortedData.map((item) => {
|
|
10484
10529
|
const columnTitle = titleFormatter ? titleFormatter(item[titleProp]) : item[titleProp];
|
|
10485
10530
|
if (children && children.length) {
|
|
10486
10531
|
const prefix = `${keyPrefix}${keyProp}${VALUE_SEP}${item[keyProp]}${GROUP_SEP}`;
|
|
@@ -10809,8 +10854,28 @@ function getMaxTabNumValueApi() {
|
|
|
10809
10854
|
return instance.get(`${CONTEXT$4}/ipm/bc/basic/item/getMaxTabNum`);
|
|
10810
10855
|
}
|
|
10811
10856
|
const CONTEXT$3 = config.ossServerContext;
|
|
10812
|
-
function
|
|
10813
|
-
return
|
|
10857
|
+
function getOssFileUrl(fileId = "") {
|
|
10858
|
+
return `${CONTEXT$3}/oss/file/get/${fileId}`;
|
|
10859
|
+
}
|
|
10860
|
+
function putOssFileUrl() {
|
|
10861
|
+
return `${CONTEXT$3}/oss/file/put`;
|
|
10862
|
+
}
|
|
10863
|
+
function getOssFileApi(fileId, responseType) {
|
|
10864
|
+
const config2 = {};
|
|
10865
|
+
if (responseType) {
|
|
10866
|
+
config2.responseType = responseType;
|
|
10867
|
+
}
|
|
10868
|
+
return instance.get(getOssFileUrl(fileId), config2);
|
|
10869
|
+
}
|
|
10870
|
+
function putOssFileApi(filename, blob) {
|
|
10871
|
+
let formData = new FormData();
|
|
10872
|
+
formData.append("file", blob, filename);
|
|
10873
|
+
return instance({
|
|
10874
|
+
method: "post",
|
|
10875
|
+
url: putOssFileUrl(),
|
|
10876
|
+
headers: { "Content-Type": CONTENT_TYPE.multiForm },
|
|
10877
|
+
data: formData
|
|
10878
|
+
});
|
|
10814
10879
|
}
|
|
10815
10880
|
const CONTEXT$2 = config.authServerContext;
|
|
10816
10881
|
function loginApi({ userName, password, validCodeId, validCodeInput }) {
|
|
@@ -10853,4 +10918,4 @@ const UC_CONTEXT = config.ucExtServerContext;
|
|
|
10853
10918
|
function listUserTreeApi(params) {
|
|
10854
10919
|
return instance.get(`${UC_CONTEXT}/tree/uc-user/listUserTree`, { params });
|
|
10855
10920
|
}
|
|
10856
|
-
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, 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, getPermissionApi, getPermissionCache, getPriceCode, getPriceSeg, 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, listItemTreeApi, listUserTreeApi, loginApi, logoutApi, menuHistoryApi, numToChineseNumerals, numToDX, off, on, quarter2Chinese, removeLocalStorage, removeMenuCollectApi, removeSessionStorage, renderColumnEnums, renderEnumData, renderEnumList, renderFieldEnums, responseInterceptors, round, row2column, setContentType, setLocalStorage, setPermissionCache, setSessionStorage, setToken, setUserInfoCache, str2Date, toChies, toFixed, toThousands, updatePasswordApi, useConfig, uuid };
|
|
10921
|
+
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, getPriceCode, getPriceSeg, 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, listItemTreeApi, listUserTreeApi, loginApi, logoutApi, menuHistoryApi, numToChineseNumerals, numToDX, off, on, preventDefault, putOssFileApi, putOssFileUrl, quarter2Chinese, removeLocalStorage, removeMenuCollectApi, removeSessionStorage, renderColumnEnums, renderEnumData, renderEnumList, renderFieldEnums, responseInterceptors, round, row2column, setContentType, setLocalStorage, setPermissionCache, setSessionStorage, setToken, setUserInfoCache, stopPropagation, str2Date, toChies, toFixed, toThousands, updatePasswordApi, useConfig, uuid };
|