ztxkui 4.2.18-118 → 4.2.18-119
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/UI/Select/EmpForQuitDemo.d.ts +15 -0
- package/dist/UI/Select/EmpForQuitDemo.js +110 -0
- package/dist/UI/Select/index.js +53 -2
- package/dist/UI/Table/BusinessListDemo.d.ts +15 -0
- package/dist/UI/Table/BusinessListDemo.js +227 -0
- package/dist/UI/Table/BusinessMemberDemo.d.ts +18 -0
- package/dist/UI/Table/BusinessMemberDemo.js +181 -0
- package/dist/UI/Table/index.js +11 -1
- package/dist/components/EnhanceSelect/index.d.ts +7 -1
- package/dist/components/EnhanceSelect/index.js +28 -12
- package/dist/components/Table/table-menu.js +22 -4
- package/dist/components/Table/table.d.ts +3 -1
- package/dist/components/Table/table.js +21 -10
- package/dist/components/utils/ZtxkContext.d.ts +5 -0
- package/dist/components/utils/ZtxkContext.js +1 -0
- package/dist/components/utils/useBaseContext.d.ts +1 -0
- package/dist/index.js +5 -0
- package/package.json +1 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 业务还原:员工下拉框(发起离职申请用)
|
|
3
|
+
* 复刻 zmdms-zthr-front components/Select/components/EmpForQuitSelect.tsx 的完整配置,
|
|
4
|
+
* 仅将真实 request 替换为 mock(支持 empName 远程搜索 + current/size 分页)。
|
|
5
|
+
*
|
|
6
|
+
* 业务侧关键写法:
|
|
7
|
+
* 1. remoteSearch + remoteSearchKey="empName":输入时按 empName 字段远程搜索;
|
|
8
|
+
* 2. joinKey="fullDepName"(字符串形式):下拉项显示「姓名-部门全路径」,
|
|
9
|
+
* 部门缺失时不拼连接符;
|
|
10
|
+
* 3. params 动态 stringify,params 变化时生成时间戳 key 强制重渲染下拉框;
|
|
11
|
+
* 4. isPage:滚动到底部按 current/size 加载下一页。
|
|
12
|
+
*/
|
|
13
|
+
import React from 'react';
|
|
14
|
+
declare const _default: React.NamedExoticComponent<{}>;
|
|
15
|
+
export default _default;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* 业务还原:员工下拉框(发起离职申请用)
|
|
25
|
+
* 复刻 zmdms-zthr-front components/Select/components/EmpForQuitSelect.tsx 的完整配置,
|
|
26
|
+
* 仅将真实 request 替换为 mock(支持 empName 远程搜索 + current/size 分页)。
|
|
27
|
+
*
|
|
28
|
+
* 业务侧关键写法:
|
|
29
|
+
* 1. remoteSearch + remoteSearchKey="empName":输入时按 empName 字段远程搜索;
|
|
30
|
+
* 2. joinKey="fullDepName"(字符串形式):下拉项显示「姓名-部门全路径」,
|
|
31
|
+
* 部门缺失时不拼连接符;
|
|
32
|
+
* 3. params 动态 stringify,params 变化时生成时间戳 key 强制重渲染下拉框;
|
|
33
|
+
* 4. isPage:滚动到底部按 current/size 加载下一页。
|
|
34
|
+
*/
|
|
35
|
+
import React, { memo, useCallback, useEffect, useState } from 'react';
|
|
36
|
+
import Button from '../../components/Button';
|
|
37
|
+
import EnhanceSelect from '../../components/EnhanceSelect';
|
|
38
|
+
/** 模拟员工数据:部分员工没有部门(fullDepName 缺失),验证 joinKey 空值不拼连接符 */
|
|
39
|
+
var ALL_EMPLOYEES = Array.from({ length: 45 }, function (_, i) {
|
|
40
|
+
var no = String(i + 1).padStart(2, '0');
|
|
41
|
+
return {
|
|
42
|
+
id: String(i + 1),
|
|
43
|
+
userName: "\u5458\u5DE5" + no,
|
|
44
|
+
empName: "\u5458\u5DE5" + no,
|
|
45
|
+
// 每 5 人中有 1 人无部门
|
|
46
|
+
fullDepName: (i + 1) % 5 === 0
|
|
47
|
+
? undefined
|
|
48
|
+
: "\u4E2D\u62D3\u96C6\u56E2/\u4E8B\u4E1A\u90E8" + ((i % 3) + 1) + "/\u90E8\u95E8" + ((i % 4) + 1),
|
|
49
|
+
dept: ['人事部', '财务部', '技术部'][i % 3],
|
|
50
|
+
};
|
|
51
|
+
});
|
|
52
|
+
/**
|
|
53
|
+
* 模拟离职员工分页接口:请求参数由 EnhanceSelect 拼装
|
|
54
|
+
* { size, current, deptName(params 展开), empName: 搜索关键字 }
|
|
55
|
+
* 返回格式 { code: 200, data: { records, total } }
|
|
56
|
+
*/
|
|
57
|
+
function mockQuitPageRequest(options) {
|
|
58
|
+
var _a = (options === null || options === void 0 ? void 0 : options.params) || {}, _b = _a.current, current = _b === void 0 ? 1 : _b, _c = _a.size, size = _c === void 0 ? 10 : _c, _d = _a.empName, empName = _d === void 0 ? '' : _d, _e = _a.deptName, deptName = _e === void 0 ? '' : _e;
|
|
59
|
+
// 调试日志:观察滚动分页时是否发出 current=2 的请求
|
|
60
|
+
console.log("[mock\u79BB\u804C\u5458\u5DE5] current=" + current + " size=" + size + " empName=" + empName + " deptName=" + deptName);
|
|
61
|
+
var filtered = ALL_EMPLOYEES.filter(function (item) {
|
|
62
|
+
return item.empName.indexOf(empName) >= 0 &&
|
|
63
|
+
(!deptName || item.dept === deptName);
|
|
64
|
+
});
|
|
65
|
+
var start = (current - 1) * size;
|
|
66
|
+
var records = filtered.slice(start, start + size);
|
|
67
|
+
return new Promise(function (resolve) {
|
|
68
|
+
return setTimeout(function () { return resolve({ code: 200, data: { records: records, total: filtered.length } }); }, 300);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
/** 与业务侧 EmpForQuitSelect 结构一致的封装(request 换成 mock) */
|
|
72
|
+
var EmpForQuitSelect = function (_a) {
|
|
73
|
+
var params = _a.params, dataKey = _a.dataKey, titleKey = _a.titleKey, restProps = __rest(_a, ["params", "dataKey", "titleKey"]);
|
|
74
|
+
var _b = useState(Date.now()), key = _b[0], setKey = _b[1]; // 使用时间戳作为唯一键
|
|
75
|
+
var _c = useState(params), newParams = _c[0], setNewParams = _c[1];
|
|
76
|
+
useEffect(function () {
|
|
77
|
+
try {
|
|
78
|
+
setNewParams(JSON.stringify(__assign({}, params)));
|
|
79
|
+
}
|
|
80
|
+
catch (_a) {
|
|
81
|
+
setNewParams(params);
|
|
82
|
+
}
|
|
83
|
+
setKey(Date.now()); // params 更新时生成新的 key 强制重新渲染
|
|
84
|
+
}, [params]);
|
|
85
|
+
return (React.createElement(EnhanceSelect, __assign({ key: key, request: mockQuitPageRequest, url: "/mock/employeebaseinfo/resign-auth-page", dataKey: dataKey || 'id', titleKey: titleKey || 'userName', remoteSearch: true, remoteSearchKey: "empName", joinKey: "fullDepName", params: newParams }, restProps, { isPage: true })));
|
|
86
|
+
};
|
|
87
|
+
/** 演示:含 params 动态切换(部门过滤)的完整效果 */
|
|
88
|
+
var EmpForQuitDemo = function () {
|
|
89
|
+
var _a = useState(), value = _a[0], setValue = _a[1];
|
|
90
|
+
// 模拟业务侧动态 params:点击按钮切换部门过滤条件
|
|
91
|
+
var _b = useState(''), filterDept = _b[0], setFilterDept = _b[1];
|
|
92
|
+
var onToggleDept = useCallback(function () {
|
|
93
|
+
setFilterDept(function (prev) {
|
|
94
|
+
return prev === '' ? '技术部' : prev === '技术部' ? '人事部' : '';
|
|
95
|
+
});
|
|
96
|
+
}, []);
|
|
97
|
+
return (React.createElement("div", null,
|
|
98
|
+
React.createElement("div", { style: { marginBottom: 8 } },
|
|
99
|
+
React.createElement(Button, { onClick: onToggleDept },
|
|
100
|
+
"\u5207\u6362 params \u8FC7\u6EE4\uFF08\u5F53\u524D\uFF1A",
|
|
101
|
+
filterDept === '' ? '全部' : filterDept,
|
|
102
|
+
"\uFF09")),
|
|
103
|
+
React.createElement(EmpForQuitSelect, { style: { width: 320 }, allowClear: true, placeholder: "\u8F93\u5165\u59D3\u540D\u8FDC\u7A0B\u641C\u7D22\uFF0C\u6EDA\u52A8\u5230\u5E95\u90E8\u52A0\u8F7D\u4E0B\u4E00\u9875", params: filterDept ? { deptName: filterDept } : {},
|
|
104
|
+
// 每页条数默认 30,mock 单个部门只有 15 条,不调小的话第一页就拉完了、看不到翻页
|
|
105
|
+
currentSize: 10, value: value, onChange: function (val) { return setValue(val); } }),
|
|
106
|
+
React.createElement("div", { style: { marginTop: 4, fontSize: 12, color: '#999' } },
|
|
107
|
+
"\u5F53\u524D\u9009\u4E2D\uFF1A",
|
|
108
|
+
value || '未选择')));
|
|
109
|
+
};
|
|
110
|
+
export default memo(EmpForQuitDemo);
|
package/dist/UI/Select/index.js
CHANGED
|
@@ -16,6 +16,7 @@ import React, { useState } from 'react';
|
|
|
16
16
|
import Select from '../../components/Select';
|
|
17
17
|
import EnhanceSelect from '../../components/EnhanceSelect';
|
|
18
18
|
import FetchSelect from '../../components/FetchSelect';
|
|
19
|
+
import EmpForQuitDemo from './EmpForQuitDemo';
|
|
19
20
|
var Option = Select.Option, OptGroup = Select.OptGroup;
|
|
20
21
|
var sectionStyle = {
|
|
21
22
|
marginBottom: 24,
|
|
@@ -58,6 +59,27 @@ function mockRequest(options) {
|
|
|
58
59
|
data: { code: 200, data: { records: records } },
|
|
59
60
|
});
|
|
60
61
|
}
|
|
62
|
+
/** 分页远程搜索的模拟数据:66 条,按 currentSize=10 每页 10 条分 7 页 */
|
|
63
|
+
var ALL_PAGE_USERS = Array.from({ length: 66 }, function (_, i) { return ({
|
|
64
|
+
id: String(i + 1),
|
|
65
|
+
name: "\u6D4B\u8BD5\u4EBA\u5458" + String(i + 1).padStart(2, '0'),
|
|
66
|
+
dept: ['人事部', '财务部', '技术部'][i % 3],
|
|
67
|
+
}); });
|
|
68
|
+
/**
|
|
69
|
+
* 模拟远程分页接口:EnhanceSelect 远程搜索要求返回
|
|
70
|
+
* { code: 200, data: { records: [], total: N } }
|
|
71
|
+
* 请求参数由组件拼装:{ size: 每页条数, current: 页码, ...params, [搜索字段]: 关键字 }
|
|
72
|
+
*/
|
|
73
|
+
function mockPageRequest(options) {
|
|
74
|
+
var _a = (options === null || options === void 0 ? void 0 : options.params) || {}, _b = _a.current, current = _b === void 0 ? 1 : _b, _c = _a.size, size = _c === void 0 ? 10 : _c, _d = _a.name, name = _d === void 0 ? '' : _d;
|
|
75
|
+
var filtered = ALL_PAGE_USERS.filter(function (item) { return item.name.indexOf(name) >= 0; });
|
|
76
|
+
var start = (current - 1) * size;
|
|
77
|
+
var records = filtered.slice(start, start + size);
|
|
78
|
+
// 模拟 300ms 网络延迟,便于观察 loading 和滚动加载效果
|
|
79
|
+
return new Promise(function (resolve) {
|
|
80
|
+
return setTimeout(function () { return resolve({ code: 200, data: { records: records, total: filtered.length } }); }, 300);
|
|
81
|
+
});
|
|
82
|
+
}
|
|
61
83
|
/**
|
|
62
84
|
* 下拉框示例
|
|
63
85
|
*
|
|
@@ -71,7 +93,8 @@ var SelectDemo = function () {
|
|
|
71
93
|
var _c = useState(), enhanceSingleValue = _c[0], setEnhanceSingleValue = _c[1];
|
|
72
94
|
var _d = useState([]), enhanceMultiValue = _d[0], setEnhanceMultiValue = _d[1];
|
|
73
95
|
var _e = useState(), fetchValue = _e[0], setFetchValue = _e[1];
|
|
74
|
-
var _f = useState(),
|
|
96
|
+
var _f = useState(), pageSearchValue = _f[0], setPageSearchValue = _f[1];
|
|
97
|
+
var _g = useState(), enhanceCurrentData = _g[0], setEnhanceCurrentData = _g[1];
|
|
75
98
|
return (React.createElement("div", { style: { padding: '20px', maxWidth: 600 } },
|
|
76
99
|
React.createElement("h2", null, "\u4E0B\u62C9\u6846"),
|
|
77
100
|
React.createElement("div", { style: sectionStyle },
|
|
@@ -124,7 +147,15 @@ var SelectDemo = function () {
|
|
|
124
147
|
{ id: '3', name: '王五', code: 'A003', dept: '人事部' },
|
|
125
148
|
{ id: '3', name: '王五', code: '', dept: '人事部' },
|
|
126
149
|
], dataKey: "id", titleKey: "name", joinKey: ['code', 'dept'], joinStr: "-", showAll: true }),
|
|
127
|
-
React.createElement("div", { style: descStyle }, "showAll \u4F1A\u5728\u6700\u4E0A\u65B9\u8FFD\u52A0\u4E00\u9879 value \u4E3A\u7A7A\u5B57\u7B26\u4E32\u7684\"\u5168\u90E8\"\uFF1BjoinKey \u628A\u591A\u4E2A\u5B57\u6BB5\u7528 joinStr \u62FC\u63A5\u5C55\u793A")),
|
|
150
|
+
React.createElement("div", { style: descStyle }, "showAll \u4F1A\u5728\u6700\u4E0A\u65B9\u8FFD\u52A0\u4E00\u9879 value \u4E3A\u7A7A\u5B57\u7B26\u4E32\u7684\"\u5168\u90E8\"\uFF1BjoinKey \u628A\u591A\u4E2A\u5B57\u6BB5\u7528 joinStr \u62FC\u63A5\u5C55\u793A\uFF1B\u5B57\u6BB5\u4E0D\u5B58\u5728\u6216\u4E3A\u7A7A\u65F6\u4E0D\u4F1A\u62FC\u51FA\u591A\u4F59\u7684\u8FDE\u63A5\u7B26")),
|
|
151
|
+
React.createElement("div", { style: sectionStyle },
|
|
152
|
+
React.createElement("label", { style: labelStyle }, "\u589E\u5F3A\u4E0B\u62C9\u6846\uFF08isJoinInLabel=false\uFF0C\u9009\u4E2D\u540E\u56DE\u663E\u53EA\u663E\u793A\u4E3B\u6807\u9898\uFF09"),
|
|
153
|
+
React.createElement(EnhanceSelect, { style: { width: 360 }, allowClear: true, placeholder: "\u9009\u4E2D\u540E\u53EA\u663E\u793A\u59D3\u540D\uFF0C\u4E0D\u663E\u793A\u62FC\u63A5\u4E32", list: [
|
|
154
|
+
{ id: '1', name: '张三', code: 'A001', dept: '人事部' },
|
|
155
|
+
{ id: '2', name: '李四', code: 'A002', dept: '财务部' },
|
|
156
|
+
{ id: '3', name: '王五', code: 'A003', dept: '人事部' },
|
|
157
|
+
], dataKey: "id", titleKey: "name", joinKey: ['code', 'dept'], joinStr: "-", isJoinInLabel: false }),
|
|
158
|
+
React.createElement("div", { style: descStyle }, "\u4E0B\u62C9\u5217\u8868\u91CC\u4ECD\u663E\u793A\u300C\u5F20\u4E09-A001-\u4EBA\u4E8B\u90E8\u300D\u5B8C\u6574\u62FC\u63A5\uFF0C\u4F46\u9009\u4E2D\u540E\u8F93\u5165\u6846\u53EA\u56DE\u663E\u300C\u5F20\u4E09\u300D\uFF1B \u4E0D\u4F20\u8BE5\u5C5E\u6027\u65F6\u53D6\u5168\u5C40\u914D\u7F6E isSelectJoinInLabel\uFF08\u9ED8\u8BA4\u663E\u793A\u62FC\u63A5\u4E32\uFF09")),
|
|
128
159
|
React.createElement("div", { style: sectionStyle },
|
|
129
160
|
React.createElement("label", { style: labelStyle }, "\u589E\u5F3A\u4E0B\u62C9\u6846\uFF08\u591A\u9009 + \u4E0B\u62C9\u5E95\u90E8\u5168\u9009/\u53CD\u9009\u6309\u94AE\uFF09"),
|
|
130
161
|
React.createElement(EnhanceSelect, { style: { width: 360 }, mode: "multiple", allowClear: true, placeholder: "\u8BF7\u9009\u62E9\u591A\u4E2A", list: fruitOptions, dataKey: "id", titleKey: "name", value: enhanceMultiValue,
|
|
@@ -145,6 +176,26 @@ var SelectDemo = function () {
|
|
|
145
176
|
"\u5F53\u524D\u9009\u4E2D\uFF1A",
|
|
146
177
|
fetchValue || '未选择'),
|
|
147
178
|
React.createElement("div", { style: descStyle }, "FetchSelect \u521D\u59CB\u5316\u81EA\u52A8\u8BF7\u6C42\u4E00\u6B21\uFF0C\u8F93\u5165\u65F6 300ms \u9632\u6296\u8FDC\u7A0B\u641C\u7D22\uFF1B\u5B9E\u9645\u9879\u76EE\u4E2D request \u4E00\u822C\u4F20 axios \u5B9E\u4F8B\uFF0Curl \u4F20\u63A5\u53E3\u5730\u5740\uFF0C\u8FD4\u56DE\u683C\u5F0F\u8981\u6C42 data.records")),
|
|
179
|
+
React.createElement("div", { style: sectionStyle },
|
|
180
|
+
React.createElement("label", { style: labelStyle }, "\u8FDC\u7A0B\u641C\u7D22 + \u6EDA\u52A8\u5206\u9875\uFF08remoteSearch + isPage\uFF09"),
|
|
181
|
+
React.createElement(EnhanceSelect, { style: widthStyle, allowClear: true, placeholder: "\u8F93\u5165\u59D3\u540D\u641C\u7D22\uFF0C\u6EDA\u52A8\u5230\u5E95\u90E8\u52A0\u8F7D\u4E0B\u4E00\u9875", url: "/mock/users/page", request: mockPageRequest,
|
|
182
|
+
// remoteSearch 必须传:滚动分页的触发条件是 remoteSearch && isPage,
|
|
183
|
+
// 只传 isPage 不传 remoteSearch 时组件退化为一次性拉取 + 本地过滤,永不分页
|
|
184
|
+
remoteSearch: true,
|
|
185
|
+
// 开启滚动分页:滚到底部(距底 100px)且 selectList.length < total 时加载下一页
|
|
186
|
+
isPage: true,
|
|
187
|
+
// 每页条数,默认 30;这里设小一点方便演示滚动加载
|
|
188
|
+
currentSize: 10, dataKey: "id", titleKey: "name", value: pageSearchValue, onChange: function (value) { return setPageSearchValue(value); }, onCompleted: function (data) {
|
|
189
|
+
return console.log('已加载选项数:', data === null || data === void 0 ? void 0 : data.length);
|
|
190
|
+
} }),
|
|
191
|
+
React.createElement("div", { style: descStyle },
|
|
192
|
+
"\u5F53\u524D\u9009\u4E2D\uFF1A",
|
|
193
|
+
pageSearchValue || '未选择'),
|
|
194
|
+
React.createElement("div", { style: descStyle }, "mock \u6570\u636E\u5171 66 \u6761\u3001\u6BCF\u9875 10 \u6761\uFF1A\u6253\u5F00\u4E0B\u62C9\u5148\u52A0\u8F7D\u7B2C 1 \u9875\uFF0C\u6EDA\u52A8\u5230\u5E95\u90E8\u81EA\u52A8\u8FFD\u52A0\u4E0B\u4E00\u9875\uFF1B \u8F93\u5165\u5173\u952E\u5B57\u540E\u6309\u5173\u952E\u5B57\u8FDC\u7A0B\u641C\u7D22\uFF0Ctotal \u540C\u6B65\u7F29\u5C0F\u3002\u5206\u9875\u751F\u6548\u7684\u524D\u63D0\uFF1A \u2460 remoteSearch + isPage \u540C\u65F6\u914D\u7F6E\uFF1B\u2461 \u63A5\u53E3\u6309 current/size \u53C2\u6570\u8FD4\u56DE\u5BF9\u5E94\u9875\uFF1B\u2462 \u8FD4\u56DE\u7684 data.total \u662F\u603B\u6761\u6570\uFF08count \u53D6\u81EA res.data.total\uFF0C\u4F4D\u7F6E\u4E0D\u5BF9\u65F6\u5206\u9875\u6C38\u8FDC\u4E0D\u4F1A\u89E6\u53D1\uFF0C\u9700\u8981 transformData \u8F6C\u6362\uFF09")),
|
|
195
|
+
React.createElement("div", { style: sectionStyle },
|
|
196
|
+
React.createElement("label", { style: labelStyle }, "\u4E1A\u52A1\u8FD8\u539F\uFF1A\u5458\u5DE5\u79BB\u804C\u7533\u8BF7\u4E0B\u62C9\uFF08EmpForQuitSelect\uFF0C\u72EC\u7ACB\u7EC4\u4EF6\u6587\u4EF6\uFF09"),
|
|
197
|
+
React.createElement(EmpForQuitDemo, null),
|
|
198
|
+
React.createElement("div", { style: descStyle }, "\u590D\u523B zthr \u4E1A\u52A1\u5C01\u88C5\u7684\u5B8C\u6574\u914D\u7F6E\uFF1AremoteSearch + remoteSearchKey=\"empName\"\uFF08\u641C\u7D22\u5173\u952E\u5B57\u6309 empName \u4F20\u540E\u7AEF\uFF09\u3001 joinKey=\"fullDepName\"\uFF08\u5B57\u7B26\u4E32\u5F62\u5F0F\uFF0C\u4E0B\u62C9\u9879\u663E\u793A\u300C\u59D3\u540D-\u90E8\u95E8\u5168\u8DEF\u5F84\u300D\uFF0C\u90E8\u95E8\u7F3A\u5931\u4E0D\u62FC\u8FDE\u63A5\u7B26\uFF09\u3001 isPage \u6EDA\u52A8\u5206\u9875\u3001params \u52A8\u6001 stringify \u4E14\u53D8\u5316\u65F6\u7528\u65F6\u95F4\u6233 key \u5F3A\u5236\u91CD\u6E32\u67D3\uFF08\u70B9\u4E0A\u65B9\u6309\u94AE\u5207\u6362\u90E8\u95E8\u8FC7\u6EE4\u53EF\u9A8C\u8BC1\uFF09\u3002\u7EC4\u4EF6\u4EE3\u7801\u5728\u72EC\u7ACB\u7684 EmpForQuitDemo.tsx \u6587\u4EF6\u4E2D\u3002")),
|
|
148
199
|
React.createElement("div", { style: sectionStyle },
|
|
149
200
|
React.createElement("label", { style: labelStyle }, "\u5BF9\u6BD4\u5C0F\u7ED3"),
|
|
150
201
|
React.createElement("ul", { style: { fontSize: 13, color: '#555', lineHeight: '22px' } },
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 业务还原用例:复刻 zmdms-zthr-front 外事团组列表(groupList/List/component/TableList.tsx)的表格用法
|
|
3
|
+
*
|
|
4
|
+
* 用于复现业务反馈的「右键查看明细 / 全屏」报错问题,保持与业务侧完全一致的关键写法:
|
|
5
|
+
* 1. 序号列只有 render,没有 key/dataIndex(detail 明细会跳过该列);
|
|
6
|
+
* 2. 固定列:fixed left 的序号/编号列 + fixed right 的状态/操作列;
|
|
7
|
+
* 3. 标题列 render 返回 Button(link),状态列 render 里嵌套点击回调;
|
|
8
|
+
* 4. 操作列 key="operation" 无 dataIndex,render 返回「主按钮 + Dropdown 其他操作」;
|
|
9
|
+
* 5. Table 配置 isFlex、bordered、pagination={false}、scroll={{ x: 'max-content' }}。
|
|
10
|
+
*
|
|
11
|
+
* 使用方式:右键表格行 → 查看明细 / 全屏,观察控制台是否报错。
|
|
12
|
+
*/
|
|
13
|
+
import React from 'react';
|
|
14
|
+
declare const _default: React.NamedExoticComponent<{}>;
|
|
15
|
+
export default _default;
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 业务还原用例:复刻 zmdms-zthr-front 外事团组列表(groupList/List/component/TableList.tsx)的表格用法
|
|
3
|
+
*
|
|
4
|
+
* 用于复现业务反馈的「右键查看明细 / 全屏」报错问题,保持与业务侧完全一致的关键写法:
|
|
5
|
+
* 1. 序号列只有 render,没有 key/dataIndex(detail 明细会跳过该列);
|
|
6
|
+
* 2. 固定列:fixed left 的序号/编号列 + fixed right 的状态/操作列;
|
|
7
|
+
* 3. 标题列 render 返回 Button(link),状态列 render 里嵌套点击回调;
|
|
8
|
+
* 4. 操作列 key="operation" 无 dataIndex,render 返回「主按钮 + Dropdown 其他操作」;
|
|
9
|
+
* 5. Table 配置 isFlex、bordered、pagination={false}、scroll={{ x: 'max-content' }}。
|
|
10
|
+
*
|
|
11
|
+
* 使用方式:右键表格行 → 查看明细 / 全屏,观察控制台是否报错。
|
|
12
|
+
*/
|
|
13
|
+
import React, { memo, useCallback } from 'react';
|
|
14
|
+
import { Dropdown, Menu } from 'antd';
|
|
15
|
+
import Button from '../../components/Button';
|
|
16
|
+
import Table from '../../components/Table';
|
|
17
|
+
/** 操作码 → 操作名(与业务侧 operateCodes 对齐) */
|
|
18
|
+
var ACTION_TEXT_MAP = {
|
|
19
|
+
edit: '编辑',
|
|
20
|
+
delete: '删除',
|
|
21
|
+
submit: '发起审批',
|
|
22
|
+
revoke: '撤销审批',
|
|
23
|
+
specialistModify: '表单修改',
|
|
24
|
+
changeStatus: '状态修改',
|
|
25
|
+
};
|
|
26
|
+
/** 模拟列表数据:覆盖「有/无操作码、有/无批件号」等情况 */
|
|
27
|
+
var RECORDS = [
|
|
28
|
+
{
|
|
29
|
+
id: '1',
|
|
30
|
+
approvalNo: 'PJ2026-0001',
|
|
31
|
+
fileTitle: '关于组织赴德国参加工业展的请示',
|
|
32
|
+
applyDepName: '国际业务部',
|
|
33
|
+
flowTypeName: '出境团组',
|
|
34
|
+
abroadTaskName: '参加展会',
|
|
35
|
+
visitCountryNames: '德国',
|
|
36
|
+
teamLeaderName: '张三',
|
|
37
|
+
departureDate: '2026-03-15',
|
|
38
|
+
returnDate: '2026-03-25',
|
|
39
|
+
stayDays: 10,
|
|
40
|
+
groupStatusName: '审批中',
|
|
41
|
+
operateCodes: ['edit', 'delete', 'submit', 'revoke', 'changeStatus'],
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
id: '2',
|
|
45
|
+
fileTitle: '关于赴日本开展技术交流的申请',
|
|
46
|
+
applyDepName: '技术中心',
|
|
47
|
+
flowTypeName: '出境团组',
|
|
48
|
+
abroadTaskName: '技术交流',
|
|
49
|
+
visitCountryNames: '日本',
|
|
50
|
+
teamLeaderName: '李四',
|
|
51
|
+
departureDate: '2026-04-08',
|
|
52
|
+
returnDate: '2026-04-15',
|
|
53
|
+
stayDays: 7,
|
|
54
|
+
groupStatusName: '待提交',
|
|
55
|
+
operateCodes: ['edit', 'delete', 'submit'],
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
id: '3',
|
|
59
|
+
approvalNo: 'PJ2026-0003',
|
|
60
|
+
fileTitle: '关于赴新加坡商务考察的请示',
|
|
61
|
+
applyDepName: '市场部',
|
|
62
|
+
flowTypeName: '出境团组',
|
|
63
|
+
abroadTaskName: '商务考察',
|
|
64
|
+
visitCountryNames: '新加坡、马来西亚',
|
|
65
|
+
teamLeaderName: '王五',
|
|
66
|
+
departureDate: '2026-05-02',
|
|
67
|
+
returnDate: '2026-05-10',
|
|
68
|
+
stayDays: 8,
|
|
69
|
+
groupStatusName: '已通过',
|
|
70
|
+
// 无操作码:操作列 render 返回 null,验证明细弹框对 null render 的兜底
|
|
71
|
+
operateCodes: [],
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
id: '4',
|
|
75
|
+
approvalNo: '',
|
|
76
|
+
fileTitle: '关于赴泰国售后服务的申请',
|
|
77
|
+
applyDepName: '服务中心',
|
|
78
|
+
flowTypeName: '出境团组',
|
|
79
|
+
abroadTaskName: '售后服务',
|
|
80
|
+
visitCountryNames: '泰国',
|
|
81
|
+
teamLeaderName: '赵六',
|
|
82
|
+
departureDate: '',
|
|
83
|
+
returnDate: '',
|
|
84
|
+
stayDays: 0,
|
|
85
|
+
groupStatusName: '草稿',
|
|
86
|
+
// 未返回 operateCodes 字段(undefined):验证字段缺失时的兜底
|
|
87
|
+
},
|
|
88
|
+
];
|
|
89
|
+
/**
|
|
90
|
+
* 业务还原的列表组件(结构与业务侧 TableList.tsx 保持一致)
|
|
91
|
+
*/
|
|
92
|
+
var BusinessTableList = function (_a) {
|
|
93
|
+
var _b = _a.authMap, authMap = _b === void 0 ? {} : _b, onAction = _a.onAction, onTitleClick = _a.onTitleClick;
|
|
94
|
+
var renderOperations = useCallback(function (record) {
|
|
95
|
+
// 操作以接口返回的 operateCodes 为准
|
|
96
|
+
var actions = record.operateCodes || [];
|
|
97
|
+
if (!actions.length)
|
|
98
|
+
return null;
|
|
99
|
+
// 过滤无权限操作
|
|
100
|
+
var allowed = actions.filter(function (action) { return !authMap[action]; });
|
|
101
|
+
if (!allowed.length)
|
|
102
|
+
return null;
|
|
103
|
+
var first = allowed[0], rest = allowed.slice(1);
|
|
104
|
+
return (React.createElement(React.Fragment, null,
|
|
105
|
+
React.createElement(Button, { type: "link", style: { padding: 0 }, onClick: function () { return onAction === null || onAction === void 0 ? void 0 : onAction(first, record); } }, ACTION_TEXT_MAP[first]),
|
|
106
|
+
rest.length > 0 && (React.createElement(Dropdown, { overlay: React.createElement(Menu, { onClick: function (_a) {
|
|
107
|
+
var key = _a.key;
|
|
108
|
+
return onAction === null || onAction === void 0 ? void 0 : onAction(key, record);
|
|
109
|
+
} }, rest.map(function (action) { return (React.createElement(Menu.Item, { key: action }, ACTION_TEXT_MAP[action])); })) },
|
|
110
|
+
React.createElement(Button, { type: "link", style: { padding: 0, marginLeft: 8 } }, "\u5176\u4ED6\u64CD\u4F5C")))));
|
|
111
|
+
}, [authMap, onAction]);
|
|
112
|
+
var columns = [
|
|
113
|
+
{
|
|
114
|
+
title: '序号',
|
|
115
|
+
width: 60,
|
|
116
|
+
fixed: 'left',
|
|
117
|
+
align: 'center',
|
|
118
|
+
// 与业务一致:只有 render,没有 key/dataIndex
|
|
119
|
+
render: function (_text, _record, index) { return "" + (index + 1); },
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
title: '集团批件号',
|
|
123
|
+
dataIndex: 'approvalNo',
|
|
124
|
+
key: 'approvalNo',
|
|
125
|
+
width: 130,
|
|
126
|
+
fixed: 'left',
|
|
127
|
+
render: function (text) { return text || '— —'; },
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
title: '文件标题',
|
|
131
|
+
dataIndex: 'fileTitle',
|
|
132
|
+
key: 'fileTitle',
|
|
133
|
+
width: 260,
|
|
134
|
+
fixed: 'left',
|
|
135
|
+
render: function (text, record) { return (React.createElement(Button, { type: "link", style: { padding: 0 }, onClick: function () { return onTitleClick === null || onTitleClick === void 0 ? void 0 : onTitleClick(record); } }, text)); },
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
title: '申办单位',
|
|
139
|
+
dataIndex: 'applyDepName',
|
|
140
|
+
key: 'applyDepName',
|
|
141
|
+
width: 140,
|
|
142
|
+
fixed: 'left',
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
title: '团组类型',
|
|
146
|
+
dataIndex: 'flowTypeName',
|
|
147
|
+
key: 'flowTypeName',
|
|
148
|
+
width: 100,
|
|
149
|
+
align: 'center',
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
title: '出国(境)任务',
|
|
153
|
+
dataIndex: 'abroadTaskName',
|
|
154
|
+
key: 'abroadTaskName',
|
|
155
|
+
width: 160,
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
title: '出访国家/地区',
|
|
159
|
+
dataIndex: 'visitCountryNames',
|
|
160
|
+
key: 'visitCountryNames',
|
|
161
|
+
width: 140,
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
title: '团组负责人',
|
|
165
|
+
dataIndex: 'teamLeaderName',
|
|
166
|
+
key: 'teamLeaderName',
|
|
167
|
+
width: 100,
|
|
168
|
+
align: 'center',
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
title: '拟出发日期',
|
|
172
|
+
dataIndex: 'departureDate',
|
|
173
|
+
key: 'departureDate',
|
|
174
|
+
width: 110,
|
|
175
|
+
align: 'center',
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
title: '拟归国(境)日期',
|
|
179
|
+
dataIndex: 'returnDate',
|
|
180
|
+
key: 'returnDate',
|
|
181
|
+
width: 130,
|
|
182
|
+
align: 'center',
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
title: '停留天数',
|
|
186
|
+
dataIndex: 'stayDays',
|
|
187
|
+
key: 'stayDays',
|
|
188
|
+
width: 90,
|
|
189
|
+
align: 'center',
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
title: '状态',
|
|
193
|
+
dataIndex: 'groupStatusName',
|
|
194
|
+
key: 'groupStatusName',
|
|
195
|
+
width: 130,
|
|
196
|
+
fixed: 'right',
|
|
197
|
+
align: 'center',
|
|
198
|
+
render: function (text) {
|
|
199
|
+
// 业务侧这里会根据 processInstId 渲染可点击跳转的状态链接,demo 用普通按钮代替
|
|
200
|
+
return (React.createElement(Button, { type: "link", style: { padding: 0 } }, text));
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
title: '操作',
|
|
205
|
+
key: 'operation',
|
|
206
|
+
width: 180,
|
|
207
|
+
fixed: 'right',
|
|
208
|
+
align: 'center',
|
|
209
|
+
render: function (_text, record) { return renderOperations(record); },
|
|
210
|
+
},
|
|
211
|
+
];
|
|
212
|
+
return (React.createElement(Table, { isFlex: true, columns: columns, dataSource: RECORDS, rowKey: "id", bordered: true, pagination: false, scroll: { x: 'max-content' } }));
|
|
213
|
+
};
|
|
214
|
+
/**
|
|
215
|
+
* 业务还原用例:右键查看明细 / 全屏
|
|
216
|
+
* 操作列动作统一打印到控制台
|
|
217
|
+
*/
|
|
218
|
+
var BusinessListDemo = function () {
|
|
219
|
+
var onActionHandle = useCallback(function (action, record) {
|
|
220
|
+
console.log('业务操作:', action, record);
|
|
221
|
+
}, []);
|
|
222
|
+
var onTitleClickHandle = useCallback(function (record) {
|
|
223
|
+
console.log('打开单据:', record);
|
|
224
|
+
}, []);
|
|
225
|
+
return (React.createElement(BusinessTableList, { onAction: onActionHandle, onTitleClick: onTitleClickHandle }));
|
|
226
|
+
};
|
|
227
|
+
export default memo(BusinessListDemo);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 业务还原用例:复刻 zmdms-zthr-front 团队成员维护表(fa/apply/Making/component/MemberTable.tsx)的编辑表格用法
|
|
3
|
+
*
|
|
4
|
+
* 用于复现业务反馈的「右键查看明细,弹框没有内容」问题,保持与业务侧完全一致的关键写法:
|
|
5
|
+
* 1. 所有列都只有 title + render,没有 key/dataIndex(此前 flattenColumns
|
|
6
|
+
* 会把这类列全部跳过,导致明细弹框空白);
|
|
7
|
+
* 2. 列头用带红色 * 的 JSX 标识必填(title 是 ReactElement);
|
|
8
|
+
* 3. 单元格直接 render 受控组件(Input / 自定义输入),不传 onEditableSave、
|
|
9
|
+
* 不用 editable 配置;
|
|
10
|
+
* 4. 操作列同样没有 key,render 首行返回 null、其他行返回 Popconfirm 按钮;
|
|
11
|
+
* 5. rowKey 传函数:rowKey={(_, index) => String(index)};
|
|
12
|
+
* 6. Table 配置 bordered、pagination={false}、scroll={{ x: 'max-content' }}。
|
|
13
|
+
*
|
|
14
|
+
* 使用方式:右键表格行 → 查看明细,弹框应展示所有列的单元格内容。
|
|
15
|
+
*/
|
|
16
|
+
import React from 'react';
|
|
17
|
+
declare const _default: React.NamedExoticComponent<{}>;
|
|
18
|
+
export default _default;
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
13
|
+
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
14
|
+
to[j] = from[i];
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* 业务还原用例:复刻 zmdms-zthr-front 团队成员维护表(fa/apply/Making/component/MemberTable.tsx)的编辑表格用法
|
|
19
|
+
*
|
|
20
|
+
* 用于复现业务反馈的「右键查看明细,弹框没有内容」问题,保持与业务侧完全一致的关键写法:
|
|
21
|
+
* 1. 所有列都只有 title + render,没有 key/dataIndex(此前 flattenColumns
|
|
22
|
+
* 会把这类列全部跳过,导致明细弹框空白);
|
|
23
|
+
* 2. 列头用带红色 * 的 JSX 标识必填(title 是 ReactElement);
|
|
24
|
+
* 3. 单元格直接 render 受控组件(Input / 自定义输入),不传 onEditableSave、
|
|
25
|
+
* 不用 editable 配置;
|
|
26
|
+
* 4. 操作列同样没有 key,render 首行返回 null、其他行返回 Popconfirm 按钮;
|
|
27
|
+
* 5. rowKey 传函数:rowKey={(_, index) => String(index)};
|
|
28
|
+
* 6. Table 配置 bordered、pagination={false}、scroll={{ x: 'max-content' }}。
|
|
29
|
+
*
|
|
30
|
+
* 使用方式:右键表格行 → 查看明细,弹框应展示所有列的单元格内容。
|
|
31
|
+
*/
|
|
32
|
+
import React, { memo, useCallback, useState } from 'react';
|
|
33
|
+
import { Popconfirm } from 'antd';
|
|
34
|
+
import Button from '../../components/Button';
|
|
35
|
+
import Input from '../../components/Input';
|
|
36
|
+
import Table from '../../components/Table';
|
|
37
|
+
/** 必填列头(红色 * 前缀,与业务侧 requiredTitle 一致) */
|
|
38
|
+
var requiredTitle = function (title) { return (React.createElement("span", null,
|
|
39
|
+
React.createElement("span", { style: { color: '#ff4d4f', marginRight: 4 } }, "*"),
|
|
40
|
+
title)); };
|
|
41
|
+
var createEmptyMember = function () { return ({}); };
|
|
42
|
+
var INITIAL_MEMBERS = [
|
|
43
|
+
{
|
|
44
|
+
userId: '1',
|
|
45
|
+
userName: '张三',
|
|
46
|
+
sexName: '男',
|
|
47
|
+
birthday: '1990-05',
|
|
48
|
+
lastNameCn: '张',
|
|
49
|
+
firstNameCn: '三',
|
|
50
|
+
positionName: '项目经理',
|
|
51
|
+
mobile: '13800000001',
|
|
52
|
+
idCard: '110101199005011234',
|
|
53
|
+
unitName: '国际业务部',
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
userId: '2',
|
|
57
|
+
userName: '李四',
|
|
58
|
+
sexName: '女',
|
|
59
|
+
birthday: '1995-11',
|
|
60
|
+
lastNameCn: '李',
|
|
61
|
+
firstNameCn: '四',
|
|
62
|
+
positionName: '翻译',
|
|
63
|
+
mobile: '13800000002',
|
|
64
|
+
idCard: '310101199511022345',
|
|
65
|
+
unitName: '技术中心',
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
userId: undefined,
|
|
69
|
+
userName: undefined,
|
|
70
|
+
sexName: undefined,
|
|
71
|
+
birthday: undefined,
|
|
72
|
+
lastNameCn: undefined,
|
|
73
|
+
firstNameCn: undefined,
|
|
74
|
+
positionName: undefined,
|
|
75
|
+
mobile: undefined,
|
|
76
|
+
idCard: undefined,
|
|
77
|
+
unitName: undefined,
|
|
78
|
+
},
|
|
79
|
+
];
|
|
80
|
+
/**
|
|
81
|
+
* 业务还原的成员编辑表格(结构与业务侧 MemberTable.tsx 保持一致)
|
|
82
|
+
*/
|
|
83
|
+
var BusinessMemberDemo = function () {
|
|
84
|
+
var _a = useState(INITIAL_MEMBERS), members = _a[0], setMembers = _a[1];
|
|
85
|
+
/** 更新行字段 */
|
|
86
|
+
var updateRow = useCallback(function (index, fields) {
|
|
87
|
+
setMembers(function (prev) {
|
|
88
|
+
return prev.map(function (item, i) { return (i === index ? __assign(__assign({}, item), fields) : item); });
|
|
89
|
+
});
|
|
90
|
+
}, []);
|
|
91
|
+
/** 添加成员 */
|
|
92
|
+
var onAddHandle = useCallback(function () {
|
|
93
|
+
setMembers(function (prev) { return __spreadArray(__spreadArray([], prev), [createEmptyMember()]); });
|
|
94
|
+
}, []);
|
|
95
|
+
/** 删除成员(首行不可删) */
|
|
96
|
+
var onDeleteHandle = useCallback(function (index) {
|
|
97
|
+
setMembers(function (prev) { return prev.filter(function (_, i) { return i !== index; }); });
|
|
98
|
+
}, []);
|
|
99
|
+
var columns = [
|
|
100
|
+
{
|
|
101
|
+
title: '序号',
|
|
102
|
+
width: 55,
|
|
103
|
+
align: 'center',
|
|
104
|
+
fixed: 'left',
|
|
105
|
+
render: function (_, __, index) { return index + 1; },
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
title: requiredTitle('姓名'),
|
|
109
|
+
width: 140,
|
|
110
|
+
fixed: 'left',
|
|
111
|
+
render: function (text, record, index) { return (React.createElement(Input, { value: record === null || record === void 0 ? void 0 : record.userName, disabled: index === 0, placeholder: "\u8BF7\u9009\u62E9\u4EBA\u5458", onChange: function (e) { return updateRow(index, { userName: e.target.value }); } })); },
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
title: '性别',
|
|
115
|
+
width: 70,
|
|
116
|
+
render: function (text, record) { return (React.createElement(Input, { value: record === null || record === void 0 ? void 0 : record.sexName, disabled: true })); },
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
title: '出生年月',
|
|
120
|
+
width: 110,
|
|
121
|
+
render: function (text, record) { return (React.createElement(Input, { value: record === null || record === void 0 ? void 0 : record.birthday, disabled: true })); },
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
title: requiredTitle('中文姓'),
|
|
125
|
+
width: 90,
|
|
126
|
+
render: function (text, record, index) { return (React.createElement(Input, { value: record === null || record === void 0 ? void 0 : record.lastNameCn, onChange: function (e) {
|
|
127
|
+
return updateRow(index, { lastNameCn: e.target.value });
|
|
128
|
+
} })); },
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
title: requiredTitle('中文名'),
|
|
132
|
+
width: 90,
|
|
133
|
+
render: function (text, record, index) { return (React.createElement(Input, { value: record === null || record === void 0 ? void 0 : record.firstNameCn, onChange: function (e) {
|
|
134
|
+
return updateRow(index, { firstNameCn: e.target.value });
|
|
135
|
+
} })); },
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
title: '身份证号',
|
|
139
|
+
width: 170,
|
|
140
|
+
render: function (text, record) { return (React.createElement(Input, { value: record === null || record === void 0 ? void 0 : record.idCard, disabled: true })); },
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
title: '单位',
|
|
144
|
+
width: 150,
|
|
145
|
+
render: function (text, record) { return (React.createElement(Input, { value: record === null || record === void 0 ? void 0 : record.unitName, disabled: true })); },
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
title: requiredTitle('职务'),
|
|
149
|
+
width: 140,
|
|
150
|
+
render: function (text, record, index) { return (React.createElement(Input, { value: record === null || record === void 0 ? void 0 : record.positionName, onChange: function (e) {
|
|
151
|
+
return updateRow(index, { positionName: e.target.value });
|
|
152
|
+
} })); },
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
title: requiredTitle('手机号'),
|
|
156
|
+
width: 130,
|
|
157
|
+
render: function (text, record, index) { return (React.createElement(Input, { value: record === null || record === void 0 ? void 0 : record.mobile, maxLength: 11, onChange: function (e) { return updateRow(index, { mobile: e.target.value }); } })); },
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
title: '操作',
|
|
161
|
+
width: 70,
|
|
162
|
+
align: 'center',
|
|
163
|
+
fixed: 'right',
|
|
164
|
+
render: function (text, record, index) {
|
|
165
|
+
// 首行不可删除:render 返回 null,验证明细对 null render 的兜底
|
|
166
|
+
return index === 0 ? null : (React.createElement(Popconfirm, { title: "\u786E\u5B9A\u5220\u9664\u8BE5\u6210\u5458\u5417\uFF1F", onConfirm: function () { return onDeleteHandle(index); }, okText: "\u786E\u5B9A", cancelText: "\u53D6\u6D88" },
|
|
167
|
+
React.createElement(Button, { type: "link", size: "small" }, "\u5220\u9664")));
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
];
|
|
171
|
+
return (React.createElement("div", null,
|
|
172
|
+
React.createElement("div", { style: { marginBottom: 8 } },
|
|
173
|
+
React.createElement(Button, { type: "link", size: "small", onClick: onAddHandle }, "\uFF0B \u6DFB\u52A0\u6210\u5458")),
|
|
174
|
+
React.createElement(Table, { rowKey: function (_, index) { return String(index); }, columns: columns, dataSource: members, bordered: true, pagination: false, scroll: { x: 'max-content' },
|
|
175
|
+
// 本表格虽然没有传 onEditableSave(不算组件意义上的"编辑表格"),
|
|
176
|
+
// 但单元格实际都是输入框:全屏后 Select 等浮层挂在 body,
|
|
177
|
+
// 会被全屏的 top layer 遮挡无法显示,因此单独关闭右键全屏入口。
|
|
178
|
+
// 真编辑表格(传 onEditableSave)默认就没有全屏,无需配置
|
|
179
|
+
isContextMenuFullscreen: false })));
|
|
180
|
+
};
|
|
181
|
+
export default memo(BusinessMemberDemo);
|
package/dist/UI/Table/index.js
CHANGED
|
@@ -54,6 +54,8 @@ import EnhanceSelect from '../../components/EnhanceSelect';
|
|
|
54
54
|
import DatePicker from '../../components/DatePicker';
|
|
55
55
|
import NumberCase from '../../components/NumberCase';
|
|
56
56
|
import dayjs from 'dayjs';
|
|
57
|
+
import BusinessListDemo from './BusinessListDemo';
|
|
58
|
+
import BusinessMemberDemo from './BusinessMemberDemo';
|
|
57
59
|
var sectionStyle = { margin: '32px 0 8px' };
|
|
58
60
|
var titleStyle = { fontSize: 16, fontWeight: 600 };
|
|
59
61
|
var descStyle = {
|
|
@@ -835,6 +837,14 @@ var TableDemo = function () {
|
|
|
835
837
|
React.createElement("div", { style: sectionStyle },
|
|
836
838
|
React.createElement("div", { style: titleStyle }, "\u4E09\u3001\u5E73\u7EA7\u8868\u5934\u8868\u683C\uFF08\u6392\u5E8F + \u8FC7\u6EE4\uFF09"),
|
|
837
839
|
React.createElement("div", { style: descStyle }, "\u5217\u914D\u7F6E\u4E0D\u5199 children \u5373\u4E3A\u5E73\u7EA7\u8868\u5934\u3002\u6392\u5E8F\uFF1Asorter: true \u9ED8\u8BA4\u6BD4\u8F83\u3001sorter \u914D\u7F6E compare \u81EA\u5B9A\u4E49\u6BD4\u8F83\u51FD\u6570\u3001sorter: false \u5355\u5217\u5173\u95ED\uFF1B\u8FC7\u6EE4\uFF1A\u4F9D\u8D56\u5168\u5C40 isTableFilterEnabled\uFF0C\u5217\u914D\u7F6E isFilter: false \u5355\u5217\u5173\u95ED\uFF08\u5185\u7F6E\u8FC7\u6EE4\u652F\u6301\u6587\u672C\u5339\u914D\u3001\u5927\u4E8E/\u5C0F\u4E8E/\u7B49\u4E8E\u53CA $0 \u8868\u8FBE\u5F0F\uFF09\uFF1B\u6574\u8868\u5173\u95ED\u7528 Table props \u7684 isSort / isFilter\u3002\u6CE8\u610F\u6392\u5E8F\u56FE\u6807\u7684\u4E24\u79CD\u5F62\u6001\uFF1Asorter: true / sorter \u51FD\u6570 / \u9ED8\u8BA4\u5F00\u542F\u7684\u5217\u8D70\u5185\u7F6E TableSortTitle\uFF0C\u56FE\u6807\u60AC\u6D6E\u8868\u5934\u65F6\u624D\u663E\u793A\uFF1B sorter \u914D\u7F6E compare \u5BF9\u8C61\u7684\u5217\u8D70 antd \u539F\u751F\u6392\u5E8F\uFF0C\u56FE\u6807\u4E00\u76F4\u663E\u793A\u3002summaryConfig \u914D\u7F6E\u603B\u8BA1\u884C\uFF0C showColumnDynamic + showColumnDynamicKey \u652F\u6301\u81EA\u5B9A\u4E49\u663E\u793A\u5217\u5E76\u6301\u4E45\u5316\u3002"),
|
|
838
|
-
React.createElement(FlatTableDemo, null))
|
|
840
|
+
React.createElement(FlatTableDemo, null)),
|
|
841
|
+
React.createElement("div", { style: sectionStyle },
|
|
842
|
+
React.createElement("div", { style: titleStyle }, "\u56DB\u3001\u4E1A\u52A1\u8FD8\u539F\u7528\u4F8B\uFF08\u53F3\u952E\u67E5\u770B\u660E\u7EC6 / \u5168\u5C4F\uFF0C\u72EC\u7ACB\u7EC4\u4EF6\u6587\u4EF6\uFF09"),
|
|
843
|
+
React.createElement("div", { style: descStyle }, "\u590D\u523B\u4E1A\u52A1\u9879\u76EE\uFF08zthr \u5916\u4E8B\u56E2\u7EC4\u5217\u8868\uFF09\u7684\u8868\u683C\u7528\u6CD5\uFF0C\u7528\u4E8E\u590D\u73B0\u4E1A\u52A1\u53CD\u9988\u7684\u300C\u53F3\u952E\u67E5\u770B\u660E\u7EC6 / \u5168\u5C4F\u300D\u62A5\u9519\uFF1A\u5E8F\u53F7\u5217\u53EA\u6709 render \u6CA1\u6709 key/dataIndex\uFF1Bfixed left/right \u56FA\u5B9A\u5217\uFF1B\u6807\u9898/\u72B6\u6001\u5217 render \u8FD4\u56DE Button\uFF1B\u64CD\u4F5C\u5217 key=\"operation\" \u7684 render \u8FD4\u56DE\u300C\u4E3B\u6309\u94AE + Dropdown \u5176\u4ED6\u64CD\u4F5C\u300D\uFF0CoperateCodes \u4E3A\u7A7A\u6570\u7EC4\u6216\u7F3A\u5931\u65F6\u8FD4\u56DE null\uFF1BTable \u914D\u7F6E isFlex\u3001bordered\u3001 pagination=false\u3001scroll={{ x: 'max-content' }}\u3002 \u53F3\u952E\u8868\u683C\u884C \u2192 \u67E5\u770B\u660E\u7EC6 / \u5168\u5C4F\uFF0C\u89C2\u5BDF\u63A7\u5236\u53F0\u662F\u5426\u62A5\u9519\u3002\u7EC4\u4EF6\u4EE3\u7801\u5728\u72EC\u7ACB\u7684 BusinessListDemo.tsx \u6587\u4EF6\u4E2D\u3002"),
|
|
844
|
+
React.createElement(BusinessListDemo, null)),
|
|
845
|
+
React.createElement("div", { style: sectionStyle },
|
|
846
|
+
React.createElement("div", { style: titleStyle }, "\u4E94\u3001\u4E1A\u52A1\u8FD8\u539F\u7528\u4F8B\uFF08\u7F16\u8F91\u8868\u683C\u53F3\u952E\u67E5\u770B\u660E\u7EC6\uFF0C\u72EC\u7ACB\u7EC4\u4EF6\u6587\u4EF6\uFF09"),
|
|
847
|
+
React.createElement("div", { style: descStyle }, "\u590D\u523B\u4E1A\u52A1\u9879\u76EE\uFF08zthr \u56E2\u961F\u6210\u5458\u7EF4\u62A4\u8868\uFF09\u7684\u7F16\u8F91\u8868\u683C\u7528\u6CD5\uFF0C\u7528\u4E8E\u590D\u73B0\u4E1A\u52A1\u53CD\u9988\u7684\u300C\u53F3\u952E\u67E5\u770B\u660E\u7EC6\u5F39\u6846\u6CA1\u6709\u5185\u5BB9\u300D\uFF1A \u6240\u6709\u5217\u90FD\u53EA\u6709 title + render \u6CA1\u6709 key/dataIndex\uFF08\u6B64\u524D\u8FD9\u7C7B\u5217\u4F1A\u88AB\u660E\u7EC6\u5168\u90E8\u8DF3\u8FC7\u5BFC\u81F4\u7A7A\u767D\u5F39\u6846\uFF0C\u5DF2\u5728\u7EC4\u4EF6\u5185\u4FEE\u590D\uFF09\uFF1B \u5217\u5934\u5E26\u7EA2\u8272\u5FC5\u586B\u661F\u53F7\uFF08JSX \u6807\u9898\uFF09\uFF1B\u5355\u5143\u683C\u76F4\u63A5 render \u53D7\u63A7 Input\uFF0C\u4E0D\u4F20 onEditableSave\uFF1B\u64CD\u4F5C\u5217\u6CA1\u6709 key\uFF0C\u9996\u884C render \u8FD4\u56DE null\u3001\u5176\u4ED6\u884C\u8FD4\u56DE Popconfirm \u5220\u9664\uFF1BrowKey \u4F20\u51FD\u6570\u3001bordered\u3001pagination=false\u3001 scroll={{ x: 'max-content' }}\u3002 \u53F3\u952E\u8868\u683C\u884C \u2192 \u67E5\u770B\u660E\u7EC6\uFF0C\u5F39\u6846\u5E94\u5C55\u793A\u6240\u6709\u5217\u5185\u5BB9\u3002 \u8BE5\u8868\u683C\u5355\u5143\u683C\u5B9E\u9645\u90FD\u662F\u8F93\u5165\u6846\u4F46\u672A\u4F20 onEditableSave\uFF08\u4E0D\u7B97\u7EC4\u4EF6\u610F\u4E49\u4E0A\u7684\u7F16\u8F91\u8868\u683C\uFF09\uFF0C \u5168\u5C4F\u540E\u4E0B\u62C9\u6D6E\u5C42\u4F1A\u88AB\u906E\u6321\uFF0C\u56E0\u6B64\u901A\u8FC7 isContextMenuFullscreen=false \u5355\u72EC\u5173\u95ED\u53F3\u952E\u5168\u5C4F\u5165\u53E3\uFF08\u771F\u7F16\u8F91\u8868\u683C\u9ED8\u8BA4\u5C31\u6CA1\u6709\u5168\u5C4F\uFF09\u3002\u7EC4\u4EF6\u4EE3\u7801\u5728\u72EC\u7ACB\u7684 BusinessMemberDemo.tsx \u6587\u4EF6\u4E2D\u3002"),
|
|
848
|
+
React.createElement(BusinessMemberDemo, null))));
|
|
839
849
|
};
|
|
840
850
|
export default TableDemo;
|
|
@@ -49,6 +49,12 @@ export interface IProps<T> extends Omit<SelectProps<T>, 'onChange'> {
|
|
|
49
49
|
* 拼接形式
|
|
50
50
|
*/
|
|
51
51
|
joinStr?: string;
|
|
52
|
+
/**
|
|
53
|
+
* 选中后回显是否显示拼接后的完整内容(joinKey 拼接串),默认显示;
|
|
54
|
+
* 下拉列表中的选项展示不受该属性影响,始终显示完整拼接内容
|
|
55
|
+
* 不传时取全局配置 isSelectJoinInLabel(默认显示)
|
|
56
|
+
*/
|
|
57
|
+
isJoinInLabel?: boolean;
|
|
52
58
|
/**
|
|
53
59
|
* 换行展示的数据
|
|
54
60
|
*/
|
|
@@ -160,6 +166,6 @@ export declare function clearCatchData(url: string): void;
|
|
|
160
166
|
* { code: 200, data: { records: [] } } || { status: 200, data: { code: 200, data: { records: [] } } }
|
|
161
167
|
* 如果数据不能在接口层面满足以上形式,那么组件提供transformData属性,转换接口数据格式
|
|
162
168
|
*/
|
|
163
|
-
declare function EnhanceSelect<VT extends SelectValue = SelectValue>({ list, defaultList, params, url, method, timeout, dataKey, componentKey, titleKey, showAll, isCatch, onCompleted, onChange, onSearch, request, remoteSearch, remoteSearchKey, remoteSearchDataKey, isRemoteSearchDataKey, transformData, joinKey, joinStr, lineFeedKey, lineFeedStr, mustHasParams, disabledValues, searchDeleteKeys, isHandAddItem, isPage, currentSize, isCopy, onBlur, onFocus, isClickRequest, handleRef, isPaste, pasteRule, isPasteAddItem, ...restProps }: IProps<VT>): JSX.Element;
|
|
169
|
+
declare function EnhanceSelect<VT extends SelectValue = SelectValue>({ list, defaultList, params, url, method, timeout, dataKey, componentKey, titleKey, showAll, isCatch, onCompleted, onChange, onSearch, request, remoteSearch, remoteSearchKey, remoteSearchDataKey, isRemoteSearchDataKey, transformData, joinKey, joinStr, isJoinInLabel, lineFeedKey, lineFeedStr, mustHasParams, disabledValues, searchDeleteKeys, isHandAddItem, isPage, currentSize, isCopy, onBlur, onFocus, isClickRequest, handleRef, isPaste, pasteRule, isPasteAddItem, ...restProps }: IProps<VT>): JSX.Element;
|
|
164
170
|
declare const _default: React.MemoExoticComponent<typeof EnhanceSelect>;
|
|
165
171
|
export default _default;
|
|
@@ -36,6 +36,7 @@ import Button from '../Button';
|
|
|
36
36
|
import { useFetchState } from 'ztxkutils/dist/hooks';
|
|
37
37
|
import debounce from 'lodash/debounce';
|
|
38
38
|
import { dangerouslySetXss } from 'ztxkutils/dist/tools';
|
|
39
|
+
import useBaseContext from '../utils/useBaseContext';
|
|
39
40
|
/**
|
|
40
41
|
* 组件缓存的数据格式,在当前浏览器运行内,能保证是唯一的引用,用来缓存数据用
|
|
41
42
|
* {
|
|
@@ -165,30 +166,34 @@ function clearNullData(arr, dataKey, titleKey) {
|
|
|
165
166
|
* 如果数据不能在接口层面满足以上形式,那么组件提供transformData属性,转换接口数据格式
|
|
166
167
|
*/
|
|
167
168
|
function EnhanceSelect(_a) {
|
|
168
|
-
var
|
|
169
|
+
var _b;
|
|
170
|
+
var list = _a.list, defaultList = _a.defaultList, params = _a.params, url = _a.url, _c = _a.method, method = _c === void 0 ? 'GET' : _c, _d = _a.timeout, timeout = _d === void 0 ? 60000 : _d, _e = _a.dataKey, dataKey = _e === void 0 ? 'id' : _e, componentKey = _a.componentKey, _f = _a.titleKey, titleKey = _f === void 0 ? 'name' : _f, showAll = _a.showAll, isCatch = _a.isCatch, onCompleted = _a.onCompleted, onChange = _a.onChange, onSearch = _a.onSearch, request = _a.request, remoteSearch = _a.remoteSearch, remoteSearchKey = _a.remoteSearchKey, remoteSearchDataKey = _a.remoteSearchDataKey, _g = _a.isRemoteSearchDataKey, isRemoteSearchDataKey = _g === void 0 ? true : _g, transformData = _a.transformData, joinKey = _a.joinKey, _h = _a.joinStr, joinStr = _h === void 0 ? '-' : _h, isJoinInLabel = _a.isJoinInLabel, lineFeedKey = _a.lineFeedKey, _j = _a.lineFeedStr, lineFeedStr = _j === void 0 ? '-' : _j, mustHasParams = _a.mustHasParams, disabledValues = _a.disabledValues, searchDeleteKeys = _a.searchDeleteKeys, isHandAddItem = _a.isHandAddItem, isPage = _a.isPage, _k = _a.currentSize, currentSize = _k === void 0 ? 30 : _k, isCopy = _a.isCopy, onBlur = _a.onBlur, onFocus = _a.onFocus, isClickRequest = _a.isClickRequest, handleRef = _a.handleRef, isPaste = _a.isPaste, _l = _a.pasteRule, pasteRule = _l === void 0 ? [',', '-', '\r\n', '\r', '\n', ' '] : _l, isPasteAddItem = _a.isPasteAddItem, restProps = __rest(_a, ["list", "defaultList", "params", "url", "method", "timeout", "dataKey", "componentKey", "titleKey", "showAll", "isCatch", "onCompleted", "onChange", "onSearch", "request", "remoteSearch", "remoteSearchKey", "remoteSearchDataKey", "isRemoteSearchDataKey", "transformData", "joinKey", "joinStr", "isJoinInLabel", "lineFeedKey", "lineFeedStr", "mustHasParams", "disabledValues", "searchDeleteKeys", "isHandAddItem", "isPage", "currentSize", "isCopy", "onBlur", "onFocus", "isClickRequest", "handleRef", "isPaste", "pasteRule", "isPasteAddItem"]);
|
|
171
|
+
// 选中后回显是否显示拼接内容:组件级 isJoinInLabel 优先,其次全局 isSelectJoinInLabel,默认显示
|
|
172
|
+
var isSelectJoinInLabel = useBaseContext().isSelectJoinInLabel;
|
|
173
|
+
var joinInLabel = (_b = isJoinInLabel !== null && isJoinInLabel !== void 0 ? isJoinInLabel : isSelectJoinInLabel) !== null && _b !== void 0 ? _b : true;
|
|
169
174
|
// TODO: 注释动态设置open逻辑 start
|
|
170
175
|
// const currentClick = useRef<boolean>(true);
|
|
171
176
|
// TODO: 注释动态设置open逻辑 end
|
|
172
177
|
// 下拉数据源
|
|
173
|
-
var
|
|
178
|
+
var _m = useFetchState([]), selectList = _m[0], setSelectList = _m[1];
|
|
174
179
|
// 手动添加的数据源
|
|
175
|
-
var
|
|
180
|
+
var _o = useState([]), handleAddItems = _o[0], setHandleAddItems = _o[1];
|
|
176
181
|
// 多选时,自己需要合并的数据
|
|
177
|
-
var
|
|
178
|
-
var
|
|
182
|
+
var _p = useFetchState([]), multipleList = _p[0], setMultipleList = _p[1];
|
|
183
|
+
var _q = useFetchState(false), loading = _q[0], setLoading = _q[1];
|
|
179
184
|
var fetchId = useRef(0); // 请求Id,每次请求都会加1
|
|
180
185
|
// 是否使用过远程搜索主键key
|
|
181
|
-
var
|
|
186
|
+
var _r = useFetchState(false), firstLoading = _r[0], setFirstLoading = _r[1];
|
|
182
187
|
// 第一次清空时,才做远程查询
|
|
183
|
-
var
|
|
188
|
+
var _s = useFetchState(false), firstClearData = _s[0], setFirstClearData = _s[1];
|
|
184
189
|
// 获得焦点选中
|
|
185
|
-
var
|
|
190
|
+
var _t = useState(false), isOpen = _t[0], setIsOpen = _t[1];
|
|
186
191
|
// 当前搜索文本
|
|
187
|
-
var
|
|
192
|
+
var _u = useState(), searchValue = _u[0], setSearchValue = _u[1];
|
|
188
193
|
// 当前页
|
|
189
|
-
var
|
|
194
|
+
var _v = useState(1), currentPage = _v[0], setCurrentPage = _v[1];
|
|
190
195
|
// 总条数
|
|
191
|
-
var
|
|
196
|
+
var _w = useState(0), count = _w[0], setCount = _w[1];
|
|
192
197
|
// 是否自动请求
|
|
193
198
|
var isAutoRequest = useRef(false); // 请求过了
|
|
194
199
|
// 自动填词
|
|
@@ -319,6 +324,12 @@ function EnhanceSelect(_a) {
|
|
|
319
324
|
outParams = JSON.parse(params);
|
|
320
325
|
}
|
|
321
326
|
catch (err) { }
|
|
327
|
+
// params 未传(undefined)或 JSON.parse(null) 得到 null 时兜底为空对象,
|
|
328
|
+
// 否则翻页路径上的 outParams.defaultIds 访问会抛
|
|
329
|
+
// "Cannot read properties of undefined (reading 'defaultIds')",导致滚动分页中断
|
|
330
|
+
if (outParams == null || typeof outParams !== 'object') {
|
|
331
|
+
outParams = {};
|
|
332
|
+
}
|
|
322
333
|
setSearchValue(value);
|
|
323
334
|
setLoading(true);
|
|
324
335
|
if (otherObj === null || otherObj === void 0 ? void 0 : otherObj.currentPage) {
|
|
@@ -832,7 +843,12 @@ function EnhanceSelect(_a) {
|
|
|
832
843
|
if (resultValue != null) {
|
|
833
844
|
resultValue = (_a = resultValue === null || resultValue === void 0 ? void 0 : resultValue.toString) === null || _a === void 0 ? void 0 : _a.call(resultValue);
|
|
834
845
|
}
|
|
835
|
-
return (React.createElement(Select.Option, { key: "" + key + index, value: resultValue,
|
|
846
|
+
return (React.createElement(Select.Option, { key: "" + key + index, value: resultValue,
|
|
847
|
+
// Option 的 title 属性决定选中后输入框的回显内容(optionLabelProp="title")
|
|
848
|
+
// joinInLabel 为 false 时回显只显示主标题,下拉列表中的选项展示不受影响
|
|
849
|
+
title: joinInLabel && Array.isArray(joinTitle)
|
|
850
|
+
? joinTitle === null || joinTitle === void 0 ? void 0 : joinTitle.join(joinStr)
|
|
851
|
+
: title, disabled: disabled },
|
|
836
852
|
Array.isArray(joinTitle) ? joinTitle === null || joinTitle === void 0 ? void 0 : joinTitle.join(joinStr) : '',
|
|
837
853
|
Array.isArray(linefeedTitle) && linefeedTitle.length > 0 ? (React.createElement("div", { className: "zt-select--feed-item" }, linefeedTitle === null || linefeedTitle === void 0 ? void 0 : linefeedTitle.join(lineFeedStr))) : ('')));
|
|
838
854
|
})));
|
|
@@ -72,11 +72,23 @@ var TableMenu = forwardRef(function (_a, ref) {
|
|
|
72
72
|
result.push.apply(result, flattenColumns(item.children));
|
|
73
73
|
return;
|
|
74
74
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
if (!fieldKey || item.dataIndex === 'index') {
|
|
75
|
+
// 内部序号列(dataIndex: 'index')不进明细
|
|
76
|
+
if (item.dataIndex === 'index') {
|
|
78
77
|
return;
|
|
79
78
|
}
|
|
79
|
+
var fieldKey = item.key || item.dataIndex;
|
|
80
|
+
// 列没有 key/dataIndex 时生成兜底 key:
|
|
81
|
+
// 业务侧存在整表只用 render 渲染、列头带必填星号的编辑表格(列全部没有
|
|
82
|
+
// key/dataIndex),按原逻辑全部列会被跳过,右键查看明细弹框没有内容。
|
|
83
|
+
// 组件内部没有 key 的列(新增删除操作列/动态列配置列,title 为函数)
|
|
84
|
+
// 会被下方 function label 判断过滤,仍然不会进明细;
|
|
85
|
+
// 没有 key 也没有 render 的列什么都展示不出来,跳过
|
|
86
|
+
if (!fieldKey) {
|
|
87
|
+
if (typeof item.render !== 'function') {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
fieldKey = "__zt_detail_col_" + result.length;
|
|
91
|
+
}
|
|
80
92
|
var originItem = findOriginColumn(originColumns || [], fieldKey);
|
|
81
93
|
// 处理后的列title可能是函数(useColumns把排序/填充列包装成了标题组件),
|
|
82
94
|
// 优先取原始列的title;原始title也是函数(动态列配置图标列等)则无法展示,跳过
|
|
@@ -170,8 +182,14 @@ var TableMenu = forwardRef(function (_a, ref) {
|
|
|
170
182
|
return element;
|
|
171
183
|
var _a = element.props, children = _a.children, onBlur = _a.onBlur, onChange = _a.onChange, restProps = __rest(_a, ["children", "onBlur", "onChange"]);
|
|
172
184
|
// 递归处理子元素
|
|
185
|
+
// 注意:单个子元素必须保持单元素递归,不能用 React.Children.map——
|
|
186
|
+
// map 的返回值永远是数组,cloneElement 回填后子元素从单个变成 [单个],
|
|
187
|
+
// Dropdown 等内部用 React.Children.only 校验单 child 的组件会直接抛错
|
|
188
|
+
// (右键查看明细报错:React.Children.only expected to receive a single React element child)
|
|
173
189
|
var newChildren = children != null
|
|
174
|
-
?
|
|
190
|
+
? isValidElement(children)
|
|
191
|
+
? proxyRenderElement(children)
|
|
192
|
+
: React.Children.map(children, proxyRenderElement)
|
|
175
193
|
: children;
|
|
176
194
|
// 有onBlur且无onChange时,将onBlur替换为onChange
|
|
177
195
|
if (typeof onBlur === 'function' && typeof onChange !== 'function') {
|
|
@@ -82,7 +82,9 @@ export interface IProps<RecordType> extends Omit<TableProps<RecordType>, 'column
|
|
|
82
82
|
isNumberInputThousandth?: boolean;
|
|
83
83
|
/** 以表格配置为准,启用全局的数字右对齐 需要配置全局配置 */
|
|
84
84
|
isNumberInputAlignRight?: boolean;
|
|
85
|
-
/**
|
|
85
|
+
/** 右键是否显示全屏功能,默认开启。真编辑表格(传 onEditableSave)默认关闭;
|
|
86
|
+
* 单元格实际都是输入框(render 里直接渲染 Select 等)但没传 onEditableSave 的"伪编辑表格",
|
|
87
|
+
* 因浮层挂在 body 会被全屏 top layer 遮挡,建议单独传 false 关闭全屏 */
|
|
86
88
|
isContextMenuFullscreen?: boolean;
|
|
87
89
|
/** 是否显示右键菜单(查看明细)。不传时:列表表格取全局 isTableShowContextMenu(默认开启),编辑表格取全局 isTableEditShowContextMenu(默认关闭) */
|
|
88
90
|
isContextMenu?: boolean;
|
|
@@ -646,16 +646,27 @@ function Table(props) {
|
|
|
646
646
|
var onInnerRowHandle = useCallback(function (record, index) {
|
|
647
647
|
var moveRowObj = onMoveRow ? onRowHandle(record, index) : {};
|
|
648
648
|
var rowObj = onRow ? onRow(record, index) : {};
|
|
649
|
-
return __assign(__assign(__assign({}, moveRowObj), rowObj),
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
649
|
+
return __assign(__assign(__assign({}, moveRowObj), rowObj), (showContextMenu
|
|
650
|
+
? {
|
|
651
|
+
onContextMenuCapture: function (e) {
|
|
652
|
+
menuShow(e, {
|
|
653
|
+
props: {
|
|
654
|
+
record: record,
|
|
655
|
+
index: index,
|
|
656
|
+
currentDataSourceRef: currentDataSourceRef,
|
|
657
|
+
},
|
|
658
|
+
});
|
|
659
|
+
},
|
|
660
|
+
}
|
|
661
|
+
: {}));
|
|
662
|
+
}, [
|
|
663
|
+
onRowHandle,
|
|
664
|
+
onMoveRow,
|
|
665
|
+
onRow,
|
|
666
|
+
menuShow,
|
|
667
|
+
currentDataSourceRef,
|
|
668
|
+
showContextMenu,
|
|
669
|
+
]);
|
|
659
670
|
/** 伸缩列 */
|
|
660
671
|
var handleResize = useCallback(function (index) {
|
|
661
672
|
return function (_, _a) {
|
|
@@ -57,6 +57,11 @@ export interface IZtxkConfig {
|
|
|
57
57
|
* 表格级 isContextMenu 优先级更高,可单独覆盖
|
|
58
58
|
*/
|
|
59
59
|
isTableEditShowContextMenu?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* 增强下拉框(EnhanceSelect)选中后回显是否显示拼接后的完整内容(joinKey 拼接串),
|
|
62
|
+
* 全局默认开关,默认显示;组件级 isJoinInLabel 优先级更高,可单独覆盖
|
|
63
|
+
*/
|
|
64
|
+
isSelectJoinInLabel?: boolean;
|
|
60
65
|
}
|
|
61
66
|
declare const ZtxkContext: React.Context<IZtxkConfig>;
|
|
62
67
|
export default ZtxkContext;
|
|
@@ -18,5 +18,6 @@ export default function useBaseContext(): {
|
|
|
18
18
|
isUIWeeklyReview?: boolean;
|
|
19
19
|
isTableShowContextMenu?: boolean;
|
|
20
20
|
isTableEditShowContextMenu?: boolean;
|
|
21
|
+
isSelectJoinInLabel?: boolean;
|
|
21
22
|
};
|
|
22
23
|
export declare function useAntdContext(): import("antd/lib/config-provider").ConfigConsumerProps;
|
package/dist/index.js
CHANGED
|
@@ -160,6 +160,11 @@
|
|
|
160
160
|
// * 表格级 isContextMenu 优先级更高,可单独覆盖
|
|
161
161
|
// */
|
|
162
162
|
// isTableShowContextMenu: true,
|
|
163
|
+
// /**
|
|
164
|
+
// * 增强下拉框(EnhanceSelect)选中后回显是否显示拼接后的完整内容(joinKey 拼接串),
|
|
165
|
+
// * 全局默认开关,默认显示;组件级 isJoinInLabel 优先级更高,可单独覆盖
|
|
166
|
+
// */
|
|
167
|
+
// isSelectJoinInLabel: true, // 下拉选中后回显是否显示拼接内容,默认显示拼接串
|
|
163
168
|
// };
|
|
164
169
|
// ReactDOM.render(
|
|
165
170
|
// // <React.StrictMode>
|