@teamix/pro 1.3.9 → 1.3.10

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/dist/pro.js CHANGED
@@ -69288,7 +69288,7 @@ _teamix_icon__WEBPACK_IMPORTED_MODULE_15__/* ["default"].setConfig */ .Z.setConf
69288
69288
  // export * from './sidebar';
69289
69289
 
69290
69290
 
69291
- var version = '1.3.9';
69291
+ var version = '1.3.10';
69292
69292
 
69293
69293
 
69294
69294
  /***/ }),
@@ -69869,33 +69869,23 @@ var ProBaseInfo = function ProBaseInfo(props) {
69869
69869
  var formItemLayout = JSON.parse(JSON.stringify(defaultLayout.formItemLayout)); // 自定义布局
69870
69870
 
69871
69871
  if (layout) {
69872
- var _layout$labelCol, _layout$wrapperCol, _layout$span;
69872
+ var _layout$labelCol, _layout$wrapperCol;
69873
69873
 
69874
69874
  var labelCol = (_layout$labelCol = layout == null ? void 0 : layout.labelCol) != null ? _layout$labelCol : defaultLayout.formItemLayout.labelCol;
69875
69875
  var wrapperCol = (_layout$wrapperCol = layout == null ? void 0 : layout.wrapperCol) != null ? _layout$wrapperCol : defaultLayout.formItemLayout.wrapperCol;
69876
- var span = (_layout$span = layout == null ? void 0 : layout.span) != null ? _layout$span : defaultLayout.span;
69877
-
69878
- if (layout != null && layout.colNum && layout.colNum > 0 && layout.colNum <= 4) {
69879
- span = 24 / layout.colNum;
69880
- }
69881
-
69882
- formItemLayout.span = span;
69883
69876
  formItemLayout.labelCol = labelCol;
69884
69877
  formItemLayout.wrapperCol = wrapperCol;
69885
69878
  }
69886
69879
 
69887
- var newSpan = formItemLayout.span;
69888
69880
  var newLabelSpan = formItemLayout.labelCol.span;
69889
69881
  var newWrapperSpan = formItemLayout.wrapperCol.span; // 计算合并列情况。label与wrapper需要重新计算
69890
69882
 
69891
69883
  if (colspan) {
69892
- newSpan = newSpan * (colspan != null ? colspan : 1);
69893
69884
  newLabelSpan = newLabelSpan / colspan;
69894
69885
  newWrapperSpan = newWrapperSpan + (formItemLayout.labelCol.span - newLabelSpan);
69895
69886
  }
69896
69887
 
69897
69888
  var newFormItemLayout = {
69898
- span: newSpan,
69899
69889
  labelCol: {
69900
69890
  span: newLabelSpan
69901
69891
  },
@@ -69908,10 +69898,12 @@ var ProBaseInfo = function ProBaseInfo(props) {
69908
69898
 
69909
69899
  var renderContent = function renderContent() {
69910
69900
  return columns.map(function (item, index) {
69911
- var _getFormItemLayout, _item$colSpan, _item$title, _item$valueType, _ref, _item$colSpan2;
69901
+ var _layout$span, _layout$span2, _item$title, _item$valueType, _ref, _item$colSpan;
69912
69902
 
69903
+ var span = item.colSpan ? defaultLayout.span * item.colSpan : defaultLayout.span;
69904
+ var layoutSpan = item.colSpan ? ((_layout$span = layout == null ? void 0 : layout.span) != null ? _layout$span : span) * item.colSpan : (_layout$span2 = layout == null ? void 0 : layout.span) != null ? _layout$span2 : span;
69913
69905
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(Col, {
69914
- span: (_getFormItemLayout = getFormItemLayout((_item$colSpan = item == null ? void 0 : item.colSpan) != null ? _item$colSpan : 0)) == null ? void 0 : _getFormItemLayout.span,
69906
+ span: layoutSpan,
69915
69907
  key: index
69916
69908
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(_ProInfoItem__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, {
69917
69909
  label: (_item$title = item == null ? void 0 : item.title) != null ? _item$title : '',
@@ -69927,7 +69919,7 @@ var ProBaseInfo = function ProBaseInfo(props) {
69927
69919
  context: context,
69928
69920
  props: item.props
69929
69921
  }),
69930
- baseInfoLayout: getFormItemLayout((_item$colSpan2 = item == null ? void 0 : item.colSpan) != null ? _item$colSpan2 : 0),
69922
+ baseInfoLayout: getFormItemLayout((_item$colSpan = item == null ? void 0 : item.colSpan) != null ? _item$colSpan : 0),
69931
69923
  tooltip: item.tooltip,
69932
69924
  tooltipIcon: item.tooltipIcon
69933
69925
  }));
@@ -79401,6 +79393,31 @@ function getCookie(name) {
79401
79393
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
79402
79394
  /* harmony export */ "M": () => (/* binding */ autoWidth)
79403
79395
  /* harmony export */ });
79396
+ /**
79397
+ * 获取某个宽度在宽度集中的无效空间
79398
+ * @param array 宽度集
79399
+ * @param used 使用此宽度计算宽度集无效空间
79400
+ * @returns 使用此宽度的闲置空间和溢出空间
79401
+ */
79402
+ var getInvalidSpace = function getInvalidSpace(array, used) {
79403
+ return array.reduce(function (prev, current) {
79404
+ if (used > current) {
79405
+ prev[0] += used - current; // 闲置值
79406
+ }
79407
+
79408
+ if (used < current) {
79409
+ prev[1] += current - used; // 溢出值
79410
+ }
79411
+
79412
+ return prev;
79413
+ }, [0, 0]);
79414
+ };
79415
+
79416
+ /**
79417
+ * 根据宽度集获取合适的宽度
79418
+ * @param array
79419
+ * @returns
79420
+ */
79404
79421
  var autoWidth = function autoWidth(array) {
79405
79422
  var consoleArray = []; // 日志记录
79406
79423
 
@@ -79408,56 +79425,30 @@ var autoWidth = function autoWidth(array) {
79408
79425
 
79409
79426
  var expectedWidth = 0; // 期望宽度
79410
79427
 
79411
- var getInvalidSpace = function getInvalidSpace(value) {
79412
- var idleflowRate = 0.7; // 闲置宽度权重,越大则内容紧密性越好,反之信息呈现性越好。
79413
-
79414
- var overflowRate = 2; // 溢出宽度权重,越大则信息呈现性越好,反之内容紧密性越好。
79415
-
79416
- var idleSpace = 0; // 空间闲置总量
79417
-
79418
- var overflowSpace = 0; // 空间溢出总量
79419
-
79420
- array.forEach(function (width) {
79421
- if (value > width) {
79422
- idleSpace += (value - width) * idleflowRate; // 闲置值
79423
- }
79424
-
79425
- if (value < width) {
79426
- overflowSpace += (width - value) * overflowRate; // 溢出值
79427
- }
79428
- });
79429
- return {
79430
- idleSpace: idleSpace,
79431
- // 闲置空间
79432
- overflowSpace: overflowSpace,
79433
- // 溢出空间
79434
- invalidSpace: idleSpace + overflowSpace // 无效空间
79435
-
79436
- };
79437
- };
79438
-
79439
79428
  array == null ? void 0 : array.forEach(function (width, index) {
79440
- var _getInvalidSpace = getInvalidSpace(width),
79441
- idleSpace = _getInvalidSpace.idleSpace,
79442
- overflowSpace = _getInvalidSpace.overflowSpace,
79443
- invalidSpace = _getInvalidSpace.invalidSpace;
79429
+ var _getInvalidSpace = getInvalidSpace(array, width),
79430
+ idleSpace = _getInvalidSpace[0],
79431
+ overflowSpace = _getInvalidSpace[1];
79444
79432
 
79445
- consoleArray.push({
79446
- width: Math.ceil(width),
79447
- idleSpace: idleSpace,
79448
- overflowSpace: overflowSpace,
79449
- invalidSpace: invalidSpace
79450
- });
79433
+ var invalidSpace = idleSpace + overflowSpace; // 使用第一个作为比对基准
79451
79434
 
79452
79435
  if (index === 0) {
79453
79436
  minInvalidSpace = invalidSpace;
79454
79437
  expectedWidth = width;
79455
- }
79438
+ } // 如果新宽度的无效空间小于等于缓存基准,则使用新的。
79439
+
79456
79440
 
79457
79441
  if (invalidSpace <= minInvalidSpace) {
79458
79442
  minInvalidSpace = invalidSpace;
79459
79443
  expectedWidth = width;
79460
79444
  }
79445
+
79446
+ consoleArray.push({
79447
+ width: Math.ceil(width),
79448
+ idleSpace: idleSpace,
79449
+ overflowSpace: overflowSpace,
79450
+ invalidSpace: invalidSpace
79451
+ });
79461
79452
  });
79462
79453
  return {
79463
79454
  expectedWidth: Math.ceil(expectedWidth),