zmdms-webui 1.0.7 → 1.0.9

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.
@@ -40,13 +40,21 @@ var Button = function (props) {
40
40
  _a.sent();
41
41
  _a.label = 3;
42
42
  case 3:
43
- setLoading(false);
44
- currentBtn.current.canClick = true;
43
+ // 防止onClick内部没有开启微任务
44
+ // 当连续点击三次按钮:创建了三个任务在队列中
45
+ // 如果点击事件中,有同步任务阻塞,但是没有异步任务,那么点击的三个任务还是会依次执行(导致重复点击)
46
+ // 此时执行完onClick后 再开启一个宏任务,可以先执行排队中的三个任务,这样 canClick还是false,不会重复执行点击事件
47
+ setTimeout(function () {
48
+ setLoading(false);
49
+ currentBtn.current.canClick = true;
50
+ });
45
51
  return [3 /*break*/, 5];
46
52
  case 4:
47
53
  err_1 = _a.sent();
48
- setLoading(false);
49
- currentBtn.current.canClick = true;
54
+ setTimeout(function () {
55
+ setLoading(false);
56
+ currentBtn.current.canClick = true;
57
+ });
50
58
  throw err_1;
51
59
  case 5: return [2 /*return*/];
52
60
  }
@@ -84,6 +84,6 @@ var ButtonExport = function (props) {
84
84
  }); };
85
85
  return (jsx(ButtonCom, __assign({ type: "default", loading: loading, onClick: onClickHandle }, resetProps)));
86
86
  };
87
- ButtonExport.displayName = "ZTXK_WEBUI_ButtonExport";
87
+ ButtonExport.displayName = "ZTXK_WEBUI_Button.Export";
88
88
 
89
89
  export { ButtonExport as default };
@@ -29,6 +29,6 @@ var ButtonPreview = function (props) {
29
29
  }); };
30
30
  return jsx(ButtonCom, __assign({ type: "link", onClick: onClickHandle }, resetProps));
31
31
  };
32
- ButtonPreview.displayName = "ZTXK_WEBUI_ButtonPreview";
32
+ ButtonPreview.displayName = "ZTXK_WEBUI_Button.Preview";
33
33
 
34
34
  export { ButtonPreview as default };
@@ -34,8 +34,12 @@ var concatHandle = function (arr1, _a) {
34
34
  });
35
35
  };
36
36
  function createRenderItem(item, options) {
37
- var _a = options.dataKey, dataKey = _a === void 0 ? "id" : _a, _b = options.titleKey, titleKey = _b === void 0 ? "name" : _b, joinKey = options.joinKey, _c = options.joinStr, joinStr = _c === void 0 ? "-" : _c, lineFeedKey = options.lineFeedKey, _d = options.lineFeedStr, lineFeedStr = _d === void 0 ? "-" : _d;
38
- var key = item[dataKey];
37
+ var _a = options.dataKey, dataKey = _a === void 0 ? "id" : _a, _b = options.titleKey, titleKey = _b === void 0 ? "name" : _b, joinKey = options.joinKey, _c = options.joinStr, joinStr = _c === void 0 ? "-" : _c, lineFeedKey = options.lineFeedKey, _d = options.lineFeedStr, lineFeedStr = _d === void 0 ? "-" : _d, createKey = options.createKey, createId = options.createId, index = options.index;
38
+ // 自定义id值
39
+ if (createId) {
40
+ item[dataKey] = createId(item, index);
41
+ }
42
+ var key = createKey ? createKey(item, index) : item[dataKey];
39
43
  var value = item[dataKey];
40
44
  var title = unescapeString(item[titleKey]);
41
45
  // 处理拼接展示的数据
@@ -74,7 +78,7 @@ function createRenderItem(item, options) {
74
78
  };
75
79
  }
76
80
  function useRenderChildren(props) {
77
- var list = props.list, defaultList = props.defaultList, _a = props.dataKey, dataKey = _a === void 0 ? "id" : _a, _b = props.titleKey, titleKey = _b === void 0 ? "name" : _b, joinKey = props.joinKey, joinStr = props.joinStr, lineFeedKey = props.lineFeedKey, lineFeedStr = props.lineFeedStr, showAll = props.showAll, children = props.children, disabledValues = props.disabledValues;
81
+ var list = props.list, defaultList = props.defaultList, _a = props.dataKey, dataKey = _a === void 0 ? "id" : _a, _b = props.titleKey, titleKey = _b === void 0 ? "name" : _b, joinKey = props.joinKey, joinStr = props.joinStr, lineFeedKey = props.lineFeedKey, lineFeedStr = props.lineFeedStr, showAll = props.showAll, children = props.children, disabledValues = props.disabledValues, createKey = props.createKey, createId = props.createId;
78
82
  var resultList = useMemo(function () {
79
83
  return concatHandle(list, {
80
84
  arr2: defaultList,
@@ -99,6 +103,9 @@ function useRenderChildren(props) {
99
103
  joinStr: joinStr,
100
104
  lineFeedKey: lineFeedKey,
101
105
  lineFeedStr: lineFeedStr,
106
+ createKey: createKey,
107
+ createId: createId,
108
+ index: index,
102
109
  }), key = _a.key, value = _a.value, title = _a.title, joinTitleStr = _a.joinTitleStr, resultTitle = _a.resultTitle, linefeedTitle = _a.linefeedTitle;
103
110
  // 处理是否禁用
104
111
  var disabled = item === null || item === void 0 ? void 0 : item.disabled;
@@ -106,11 +113,11 @@ function useRenderChildren(props) {
106
113
  disabledValues.includes(value)) {
107
114
  disabled = true;
108
115
  }
109
- return (jsxs(MemoSelect.Option
110
- // key={`${key}${index}`}
111
- , __assign({ value: value,
116
+ return (jsxs(MemoSelect.Option, __assign({
117
+ // key={key}
118
+ value: value,
112
119
  // 原本传入需要显示的title
113
- oldTitle: title, joinTitle: joinTitleStr, title: resultTitle, disabled: disabled }, { children: [resultTitle, Array.isArray(linefeedTitle) && linefeedTitle.length > 0 ? (jsx("div", __assign({ className: "ztxk-select--feed-item" }, { children: linefeedTitle === null || linefeedTitle === void 0 ? void 0 : linefeedTitle.join(lineFeedStr) }))) : ("")] }), key));
120
+ oldTitle: title, joinTitle: joinTitleStr, title: resultTitle, disabled: disabled }, { children: [resultTitle, Array.isArray(linefeedTitle) && linefeedTitle.length > 0 ? (jsx("div", __assign({ className: "ztxk-select--feed-item" }, { children: linefeedTitle === null || linefeedTitle === void 0 ? void 0 : linefeedTitle.join(lineFeedStr) }))) : ("")] }), "".concat(key).concat(index)));
114
121
  })] }));
115
122
  }
116
123
  return null;
@@ -11,6 +11,14 @@ interface ISelectProps extends SelectProps {
11
11
  * 默认渲染的列表
12
12
  */
13
13
  defaultList?: any[];
14
+ /**
15
+ * 遍历数据的key值
16
+ */
17
+ createKey?: (data: any, index?: number) => string;
18
+ /**
19
+ * 自定义id键值
20
+ */
21
+ createId?: (data: any, index?: number) => string;
14
22
  /**
15
23
  * data key
16
24
  */
@@ -24,7 +24,7 @@ function textContent(children) {
24
24
  return "";
25
25
  }
26
26
  var Select = function (props, ref) {
27
- var list = props.list, defaultList = props.defaultList, _a = props.dataKey, dataKey = _a === void 0 ? "id" : _a, _b = props.titleKey, titleKey = _b === void 0 ? "name" : _b, joinKey = props.joinKey, _c = props.joinStr, joinStr = _c === void 0 ? "-" : _c, lineFeedKey = props.lineFeedKey, _d = props.lineFeedStr, lineFeedStr = _d === void 0 ? "-" : _d, showAll = props.showAll, children = props.children, disabledValues = props.disabledValues, _e = props.dropdownMatchSelectWidth, dropdownMatchSelectWidth = _e === void 0 ? 100 : _e, onChange = props.onChange, onSearch = props.onSearch, isRemoteSearch = props.isRemoteSearch, dropdownButton = props.dropdownButton, dropdownRender = props.dropdownRender, resetProps = __rest(props, ["list", "defaultList", "dataKey", "titleKey", "joinKey", "joinStr", "lineFeedKey", "lineFeedStr", "showAll", "children", "disabledValues", "dropdownMatchSelectWidth", "onChange", "onSearch", "isRemoteSearch", "dropdownButton", "dropdownRender"]);
27
+ var list = props.list, defaultList = props.defaultList, createKey = props.createKey, createId = props.createId, _a = props.dataKey, dataKey = _a === void 0 ? "id" : _a, _b = props.titleKey, titleKey = _b === void 0 ? "name" : _b, joinKey = props.joinKey, _c = props.joinStr, joinStr = _c === void 0 ? "-" : _c, lineFeedKey = props.lineFeedKey, _d = props.lineFeedStr, lineFeedStr = _d === void 0 ? "-" : _d, showAll = props.showAll, children = props.children, disabledValues = props.disabledValues, _e = props.dropdownMatchSelectWidth, dropdownMatchSelectWidth = _e === void 0 ? 100 : _e, onChange = props.onChange, onSearch = props.onSearch, isRemoteSearch = props.isRemoteSearch, dropdownButton = props.dropdownButton, dropdownRender = props.dropdownRender, resetProps = __rest(props, ["list", "defaultList", "createKey", "createId", "dataKey", "titleKey", "joinKey", "joinStr", "lineFeedKey", "lineFeedStr", "showAll", "children", "disabledValues", "dropdownMatchSelectWidth", "onChange", "onSearch", "isRemoteSearch", "dropdownButton", "dropdownRender"]);
28
28
  // 记录当前选中项 只有当多选模式下 才需要用到这个选项
29
29
  var _f = useRemeberCheckedValues(), parseCheckedValues = _f.parseCheckedValues, currentCheckedValuesRef = _f.currentCheckedValuesRef;
30
30
  /**
@@ -44,6 +44,8 @@ var Select = function (props, ref) {
44
44
  disabledValues: disabledValues,
45
45
  value: resetProps.value,
46
46
  mode: resetProps.mode,
47
+ createKey: createKey,
48
+ createId: createId,
47
49
  }), renderChildren = _g.renderChildren, resultList = _g.resultList;
48
50
  // 非change触发记录下选中项
49
51
  var _h = useInitRemeberCheckedValues({
@@ -295,7 +295,7 @@ interface ITableProps<RecordType> extends Omit<TableProps<RecordType>, "columns"
295
295
  innerPaginationPageSize?: number;
296
296
  innerPaginationPosition?: string[];
297
297
  innerPaginationPageSizeOptions?: TablePaginationConfig["pageSizeOptions"];
298
- innerPaginationConfig?: Omit<TablePaginationConfig, "pageSizeOptions" | "pageSize" | "position">;
298
+ innerPaginationConfig?: TablePaginationConfig;
299
299
  tableRefHandle?: React.MutableRefObject<ITableRefHandel>;
300
300
  /**
301
301
  * 表格的名字 一个页面存在多个表格时 发起表格验证时,可以提示哪个表格出现问题
@@ -52,7 +52,7 @@ function useInnerPagination(isInnerPagination, innerPaginationPageSize, options)
52
52
  }
53
53
  }
54
54
  }, [dataSource, isInnerPagination]);
55
- var paginationConfig = useMemo(function () { return (__assign(__assign({}, innerPaginationConfig), { className: "ztxk-pagination ztxk-table-pagination", current: current, pageSize: pageSize, onChange: function (page, pageSize) {
55
+ var paginationConfig = useMemo(function () { return (__assign({ className: "ztxk-pagination ztxk-table-pagination", current: current, pageSize: pageSize, onChange: function (page, pageSize) {
56
56
  if (isInnerPagination) {
57
57
  setCurrent(page);
58
58
  setPageSize(pageSize);
@@ -62,7 +62,7 @@ function useInnerPagination(isInnerPagination, innerPaginationPageSize, options)
62
62
  pageSize: Number(pageSize),
63
63
  };
64
64
  }
65
- }, hideOnSinglePage: true, position: innerPaginationPosition, defaultPageSize: pageSize, pageSizeOptions: innerPaginationPageSizeOptions })); }, [
65
+ }, hideOnSinglePage: true, position: innerPaginationPosition, defaultPageSize: pageSize, pageSizeOptions: innerPaginationPageSizeOptions }, innerPaginationConfig)); }, [
66
66
  isInnerPagination,
67
67
  current,
68
68
  pageSize,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zmdms-webui",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "private": false,
5
5
  "main": "dist/index.es.js",
6
6
  "module": "dist/index.es.js",