@indfnd/utils 0.0.35 → 0.0.37

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 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.37](http://git.inspur.com/imp-ec/ind-front/ind-utils/compare/v0.0.36...v0.0.37) (2024-03-02)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **table:** 行转列排序,上下层表头数据限制 ([24c8959](http://git.inspur.com/imp-ec/ind-front/ind-utils/commit/24c8959a34d0cb7e21646c49440bff9ee2b07862))
11
+
12
+ ### [0.0.36](http://git.inspur.com/imp-ec/ind-front/ind-utils/compare/v0.0.35...v0.0.36) (2024-03-01)
13
+
14
+
15
+ ### Features
16
+
17
+ * **api:** 增加文档中心上传接口 ([17a8174](http://git.inspur.com/imp-ec/ind-front/ind-utils/commit/17a8174e4ce0bcb8baffd9a1ac697587d2e60604))
18
+ * **blob:** 增加base64转blob方法 ([9d860c1](http://git.inspur.com/imp-ec/ind-front/ind-utils/commit/9d860c15520288f22d04a255bc63b1ff8cd698b8))
19
+ * **event:** 增加阻止事件默认行为和冒泡的方法 ([6f27ffa](http://git.inspur.com/imp-ec/ind-front/ind-utils/commit/6f27ffa1fa72da6d32bf1047f9c4988129125beb))
20
+ * **table:** 行转列增加动态列排序相关配置 ([e26e9c2](http://git.inspur.com/imp-ec/ind-front/ind-utils/commit/e26e9c29720d8f1beeacdd5d14e077d8d1c58d2a))
21
+
5
22
  ### [0.0.35](http://git.inspur.com/imp-ec/ind-front/ind-utils/compare/v0.0.34...v0.0.35) (2024-02-22)
6
23
 
7
24
 
@@ -3164,7 +3164,7 @@ function setContentType(headers, type) {
3164
3164
  }
3165
3165
  const CONTENT_TYPE = {
3166
3166
  form: "application/x-www-form-urlencoded",
3167
- "multi-form": "multipart/form-data",
3167
+ multiForm: "multipart/form-data",
3168
3168
  body: "application/json",
3169
3169
  os: "application/octet-stream"
3170
3170
  };
@@ -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,21 +10498,44 @@ function getQuarterEndMonth(quarter) {
10471
10498
  const GROUP_SEP = "__";
10472
10499
  const VALUE_SEP = "--";
10473
10500
  function renderColumnTree(data, columnGroup, option = {}) {
10474
- const _a = columnGroup, { key, keyProp, title, titleProp, titleFormatter, children } = _a, args = __objRest(_a, ["key", "keyProp", "title", "titleProp", "titleFormatter", "children"]);
10475
- const {
10476
- keyPropName = "key",
10477
- titlePropName = "title",
10478
- keyPrefix = "",
10479
- keyLastSuffix = ""
10480
- } = option;
10501
+ const _a = columnGroup, {
10502
+ key,
10503
+ keyProp,
10504
+ title,
10505
+ titleProp,
10506
+ titleFormatter,
10507
+ sortProp,
10508
+ sortOrder = "asc",
10509
+ keyLastSuffix,
10510
+ isLimitChildren,
10511
+ children
10512
+ } = _a, args = __objRest(_a, [
10513
+ "key",
10514
+ "keyProp",
10515
+ "title",
10516
+ "titleProp",
10517
+ "titleFormatter",
10518
+ "sortProp",
10519
+ "sortOrder",
10520
+ "keyLastSuffix",
10521
+ "isLimitChildren",
10522
+ "children"
10523
+ ]);
10524
+ const { keyPropName = "key", titlePropName = "title", keyPrefix = "" } = option;
10481
10525
  if (keyProp) {
10482
- const columnGroupData = _.uniqBy(data, columnGroup.keyProp);
10483
- return columnGroupData.map((item) => {
10526
+ let columnUniqData = _.uniqBy(data, columnGroup.keyProp) || [];
10527
+ if (sortProp) {
10528
+ const unSortData = columnUniqData.filter((item) => isNil(item[sortProp]));
10529
+ const sortData = columnUniqData.filter((item) => !isNil(item[sortProp]));
10530
+ columnUniqData = _.orderBy(sortData, [sortProp], [sortOrder]).concat(unSortData);
10531
+ }
10532
+ return columnUniqData.map((item) => {
10484
10533
  const columnTitle = titleFormatter ? titleFormatter(item[titleProp]) : item[titleProp];
10485
10534
  if (children && children.length) {
10486
10535
  const prefix = `${keyPrefix}${keyProp}${VALUE_SEP}${item[keyProp]}${GROUP_SEP}`;
10487
10536
  const columnChildren = children.map((child) => {
10488
- return renderColumnTree(data, child, __spreadProps(__spreadValues({}, option), { keyPrefix: prefix }));
10537
+ let nextData = isLimitChildren ? data.filter((temp) => temp[keyProp] === item[keyProp]) : data;
10538
+ return renderColumnTree(nextData, child, __spreadProps(__spreadValues({}, option), { keyPrefix: prefix }));
10489
10539
  });
10490
10540
  return __spreadProps(__spreadValues({}, args), {
10491
10541
  [titlePropName]: columnTitle,
@@ -10809,8 +10859,28 @@ function getMaxTabNumValueApi() {
10809
10859
  return instance.get(`${CONTEXT$4}/ipm/bc/basic/item/getMaxTabNum`);
10810
10860
  }
10811
10861
  const CONTEXT$3 = config.ossServerContext;
10812
- function getOssFileApi(fileId) {
10813
- return instance.get(`${CONTEXT$3}/oss/file/get/${fileId}`);
10862
+ function getOssFileUrl(fileId = "") {
10863
+ return `${CONTEXT$3}/oss/file/get/${fileId}`;
10864
+ }
10865
+ function putOssFileUrl() {
10866
+ return `${CONTEXT$3}/oss/file/put`;
10867
+ }
10868
+ function getOssFileApi(fileId, responseType) {
10869
+ const config2 = {};
10870
+ if (responseType) {
10871
+ config2.responseType = responseType;
10872
+ }
10873
+ return instance.get(getOssFileUrl(fileId), config2);
10874
+ }
10875
+ function putOssFileApi(filename, blob) {
10876
+ let formData = new FormData();
10877
+ formData.append("file", blob, filename);
10878
+ return instance({
10879
+ method: "post",
10880
+ url: putOssFileUrl(),
10881
+ headers: { "Content-Type": CONTENT_TYPE.multiForm },
10882
+ data: formData
10883
+ });
10814
10884
  }
10815
10885
  const CONTEXT$2 = config.authServerContext;
10816
10886
  function loginApi({ userName, password, validCodeId, validCodeInput }) {
@@ -10853,4 +10923,4 @@ const UC_CONTEXT = config.ucExtServerContext;
10853
10923
  function listUserTreeApi(params) {
10854
10924
  return instance.get(`${UC_CONTEXT}/tree/uc-user/listUserTree`, { params });
10855
10925
  }
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 };
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, 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 };