zmdms-webui 0.0.83 → 0.0.86

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.
@@ -1,6 +1,6 @@
1
1
  import { __assign } from '../_virtual/_tslib.js';
2
2
  import { jsx, jsxs } from 'react/jsx-runtime';
3
- import { memo } from 'react';
3
+ import React__default, { memo } from 'react';
4
4
  import classNames from '../node_modules/classnames/index.js';
5
5
  import ButtonCom from '../button/button.js';
6
6
  import Pagination from '../pagination/pagination.js';
@@ -26,7 +26,7 @@ var Footer = function (props) {
26
26
  return (jsx(Pagination, { total: total, pageSize: pageSize, current: current, onChange: onChange, onShowSizeChange: onShowSizeChange, showTotal: function (total) { return "\u5171".concat(total, "\u6761"); }, showSizeChanger: true, pageSizeOptions: pageSizeOptions ? pageSizeOptions : defaultPageSizeOptions }, index));
27
27
  }
28
28
  if (render) {
29
- return render();
29
+ return jsx(React__default.Fragment, { children: render() }, index);
30
30
  }
31
31
  return null;
32
32
  }), children] }))) : null })));
@@ -37,9 +37,12 @@ var EnhanceCell = function (props) {
37
37
  if (typeof editable === "function" ? editable(record) : editable) {
38
38
  var _d = editableConfig || {
39
39
  type: "input",
40
- }, type = _d.type, max = _d.max, min = _d.min, maxHandle = _d.maxHandle, minHandle = _d.minHandle, resetEditableConfigProps = __rest(_d, ["type", "max", "min", "maxHandle", "minHandle"]);
40
+ }, type = _d.type, max = _d.max, min = _d.min, maxHandle = _d.maxHandle, minHandle = _d.minHandle, disabled = _d.disabled, disabledHandle = _d.disabledHandle, resetEditableConfigProps = __rest(_d, ["type", "max", "min", "maxHandle", "minHandle", "disabled", "disabledHandle"]);
41
41
  var CurrentReactNode = null;
42
42
  var newChildren = children;
43
+ var resultDisabled = disabledHandle
44
+ ? disabledHandle(record)
45
+ : disabled;
43
46
  // 输入框处理
44
47
  if (type === "input") {
45
48
  CurrentReactNode = (jsx(MemoInput, __assign({ value: val, onChange: function (e) {
@@ -47,7 +50,7 @@ var EnhanceCell = function (props) {
47
50
  if (isValidate) {
48
51
  removeErrorClass();
49
52
  }
50
- }, onPressEnter: onSave, onBlur: onSave, ref: iptRef }, resetEditableConfigProps)));
53
+ }, onPressEnter: onSave, onBlur: onSave, ref: iptRef, disabled: resultDisabled }, resetEditableConfigProps)));
51
54
  }
52
55
  // 数字输入框处理
53
56
  if (type === "inputNumber") {
@@ -71,7 +74,7 @@ var EnhanceCell = function (props) {
71
74
  if (isValidate) {
72
75
  removeErrorClass();
73
76
  }
74
- }, onPressEnter: onSave, onBlur: onSave, ref: iptRef }, resetEditableConfigProps)));
77
+ }, onPressEnter: onSave, onBlur: onSave, ref: iptRef, disabled: resultDisabled }, resetEditableConfigProps)));
75
78
  // 显示的时候 展示转换的值
76
79
  try {
77
80
  if (Array.isArray(newChildren)) {
@@ -84,7 +87,7 @@ var EnhanceCell = function (props) {
84
87
  console.error(err);
85
88
  }
86
89
  }
87
- return (jsx("td", __assign({ ref: tdRef }, resetProps, { children: editing ? (jsx("div", __assign({ className: "ztxk-table__enhance-cell" }, { children: CurrentReactNode }))) : (jsx("div", __assign({ className: "ztxk-table__enhance-cell-wrap", onClick: toggleEdit }, { children: newChildren }))) })));
90
+ return (jsx("td", __assign({ ref: tdRef }, resetProps, { children: editing ? (jsx("div", __assign({ className: "ztxk-table__enhance-cell" }, { children: CurrentReactNode }))) : (jsx("div", __assign({ className: "ztxk-table__enhance-cell-wrap ".concat(resultDisabled ? "ztxk-table__enhance-cell-wrap--disabled" : ""), onClick: resultDisabled ? undefined : toggleEdit }, { children: newChildren }))) })));
88
91
  }
89
92
  return (jsx("td", __assign({ ref: tdRef }, resetProps, { children: children })));
90
93
  };
@@ -18,6 +18,10 @@ interface IEditableConfig extends Partial<IEditableConfigOtherProps> {
18
18
  * 最大值函数
19
19
  */
20
20
  minHandle?: (record: any) => any;
21
+ /**
22
+ * 禁用方法
23
+ */
24
+ disabledHandle?: (record: any) => boolean;
21
25
  /**
22
26
  * 可以传入对应的input inputNumber的所有相关属性
23
27
  */
@@ -219,6 +219,7 @@ var Table = function (props) {
219
219
  },
220
220
  };
221
221
  });
222
+ console.log(newColumns, currentDynamicList);
222
223
  // 表格
223
224
  var SingleTable = (jsx(Table$1, __assign({ className: classes, bordered: bordered, dataSource: dataSource, columns: newColumns, components: componentsMemo, onRow: onRow, summary: getSummaryHandle, pagination: isInnerPagination
224
225
  ? pagination
@@ -70,10 +70,19 @@ function useDynamicListByColumns(columns, dynamicKey) {
70
70
  var _a = useState(function () {
71
71
  return getCurrentDynamicItems(dynamicKey, TABLE_DYNAMIC_KEY, defaultDynamicList);
72
72
  }), currentDynamicList = _a[0], setCurrentDynamicList = _a[1];
73
+ var currentDynamicListRef = useRef();
74
+ useEffect(function () {
75
+ currentDynamicListRef.current = currentDynamicList;
76
+ }, [currentDynamicList]);
73
77
  // columns发生变化时,更新数据默认配置
74
78
  useEffect(function () {
75
79
  var _a, _b;
76
80
  var defaultDynamicList = getDynamicList(dynamicKey, columns);
81
+ // 更新动态列配置信息
82
+ var newDynamicList = getCurrentDynamicItems(dynamicKey, TABLE_DYNAMIC_KEY, defaultDynamicList);
83
+ if (!isEqual(currentDynamicListRef.current, newDynamicList)) {
84
+ setCurrentDynamicList(newDynamicList);
85
+ }
77
86
  (_b = (_a = dynamicSettingRef === null || dynamicSettingRef === void 0 ? void 0 : dynamicSettingRef.current) === null || _a === void 0 ? void 0 : _a.setList) === null || _b === void 0 ? void 0 : _b.call(_a, function (preList) {
78
87
  if (isEqual(preList, defaultDynamicList)) {
79
88
  return preList;