ztxkui 2.3.1 → 2.3.5

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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # 中拓中台项目 ERP
1
+ # 前端ui库
2
2
 
3
3
  ## 关于 typescript 相关配置说明
4
4
 
package/dist/App.js CHANGED
@@ -38,225 +38,9 @@ import TransList from './components/business/List';
38
38
  import GridList from 'components/business/GridList';
39
39
  import './styles/index.scss';
40
40
  var RangePicker = DatePicker.RangePicker;
41
- var Item = Form.Item;
42
41
  var FormItem = TransList.FormItem;
43
42
  var SearchItem = SearchContainer.SearchItem, SearchLeft = SearchContainer.SearchLeft, SearchRight = SearchContainer.SearchRight;
44
43
  var OperationMiddle = Container.OperationMiddle, OperationRight = Container.OperationRight;
45
- var columns1 = [
46
- {
47
- title: '序号',
48
- width: 62,
49
- fixed: 'left',
50
- align: 'center',
51
- render: function (text, record, index) { return "" + (index + 1); },
52
- },
53
- {
54
- title: '采购订单子项号',
55
- width: 160,
56
- dataIndex: 'poSubNo',
57
- key: 'poSubNo',
58
- },
59
- {
60
- title: '品名',
61
- width: 100,
62
- dataIndex: 'brand',
63
- key: 'brand',
64
- },
65
- {
66
- title: '材质',
67
- width: 100,
68
- dataIndex: 'texture',
69
- key: 'texture',
70
- },
71
- {
72
- title: '规格',
73
- width: 100,
74
- dataIndex: 'specification',
75
- key: 'specification',
76
- },
77
- {
78
- title: '产地',
79
- width: 100,
80
- dataIndex: 'placesteel',
81
- key: 'placesteel',
82
- },
83
- {
84
- title: '质量等级',
85
- width: 100,
86
- dataIndex: 'qualityLevelName',
87
- key: 'qualityLevelName',
88
- align: 'center',
89
- },
90
- {
91
- title: '实卷标记',
92
- width: 100,
93
- dataIndex: 'realSign',
94
- key: 'realSign',
95
- required: true,
96
- },
97
- {
98
- title: '钢卷号',
99
- width: 100,
100
- dataIndex: 'steelNo',
101
- key: 'steelNo',
102
- editable: true,
103
- },
104
- {
105
- title: '入库数量',
106
- width: 100,
107
- dataIndex: 'quantity',
108
- key: 'quantity',
109
- required: true,
110
- editable: true,
111
- editableConfig: {
112
- type: 'inputNumber',
113
- min: 0,
114
- precision: 3,
115
- },
116
- },
117
- {
118
- title: '数量单位',
119
- width: 100,
120
- dataIndex: 'quantityUnit',
121
- key: 'quantityUnit',
122
- },
123
- {
124
- title: '入库件数',
125
- width: 100,
126
- dataIndex: 'number',
127
- key: 'number',
128
- required: true,
129
- editable: true,
130
- editableConfig: {
131
- type: 'inputNumber',
132
- min: 0,
133
- precision: 0,
134
- },
135
- },
136
- {
137
- title: '订单数量',
138
- width: 100,
139
- render: function (text, record, index) { return 100; },
140
- },
141
- {
142
- title: '订单件数',
143
- width: 100,
144
- render: function (text, record, index) { return 200; },
145
- },
146
- {
147
- title: '均重/吨',
148
- width: 100,
149
- dataIndex: 'avgWeight',
150
- key: 'avgWeight',
151
- editable: true,
152
- editableConfig: {
153
- type: 'inputNumber',
154
- min: 0,
155
- precision: 3,
156
- },
157
- },
158
- {
159
- title: '理计重量/吨',
160
- width: 100,
161
- dataIndex: 'calculatedWeight',
162
- key: 'calculatedWeight',
163
- editable: true,
164
- editableConfig: {
165
- type: 'inputNumber',
166
- min: 0,
167
- precision: 3,
168
- },
169
- },
170
- {
171
- title: '计重方式',
172
- width: 100,
173
- dataIndex: 'calculateTypeName',
174
- key: 'calculateTypeName',
175
- align: 'center',
176
- },
177
- {
178
- title: '订单含税单价',
179
- width: 100,
180
- dataIndex: 'unitPrice',
181
- key: 'unitPrice',
182
- render: function (text) { return 111; },
183
- },
184
- {
185
- title: '车船号',
186
- width: 100,
187
- dataIndex: 'vvNo',
188
- key: 'vvNo',
189
- editable: true,
190
- },
191
- {
192
- title: '库位',
193
- width: 100,
194
- dataIndex: 'location',
195
- key: 'location',
196
- editable: true,
197
- },
198
- {
199
- title: '货损',
200
- width: 100,
201
- dataIndex: 'damage',
202
- key: 'damage',
203
- editable: true,
204
- },
205
- {
206
- title: '包装方式',
207
- width: 100,
208
- dataIndex: 'packType',
209
- key: 'packType',
210
- editable: true,
211
- },
212
- {
213
- title: '业务性质',
214
- width: 100,
215
- dataIndex: 'busiNature',
216
- key: 'busiNature',
217
- },
218
- {
219
- title: '批次类型',
220
- width: 100,
221
- dataIndex: 'packageType',
222
- key: 'packageType',
223
- required: true,
224
- },
225
- {
226
- title: '供应商名称',
227
- width: 220,
228
- dataIndex: 'memberName',
229
- key: 'memberName',
230
- },
231
- {
232
- title: '采购合同号',
233
- width: 160,
234
- align: 'center',
235
- dataIndex: 'pcNo',
236
- key: 'pcNo',
237
- },
238
- {
239
- title: '采购合同子项号',
240
- width: 160,
241
- align: 'center',
242
- dataIndex: 'pcSubNo',
243
- key: 'pcSubNo',
244
- },
245
- {
246
- title: '采购订单号',
247
- width: 160,
248
- align: 'center',
249
- dataIndex: 'poNo',
250
- key: 'poNo',
251
- },
252
- {
253
- title: '备注',
254
- width: 220,
255
- dataIndex: 'mark',
256
- key: 'mark',
257
- editable: true,
258
- },
259
- ];
260
44
  var data = [
261
45
  {
262
46
  id: '1376442369617358850',
@@ -956,7 +740,7 @@ var inspectionDetail = [
956
740
  function App() {
957
741
  var _a = useState(data), dataSource = _a[0], setDataSource = _a[1];
958
742
  var _b = useState([]), keys = _b[0], setKeys = _b[1];
959
- var _c = useState([]), searchLayout = _c[0], setSearchLayout = _c[1];
743
+ var _c = useState([]), setSearchLayout = _c[1];
960
744
  var form = Form.useForm()[0];
961
745
  var _d = useState(originFileList), fileList = _d[0], setFileList = _d[1];
962
746
  var columns = useMemo(function () { return [
@@ -1330,13 +1114,13 @@ function App() {
1330
1114
  ]);
1331
1115
  }, 3000);
1332
1116
  }, []);
1333
- var onMoveRowHandle = useCallback(function (newDataSource) {
1334
- console.log(newDataSource);
1335
- setDataSource(newDataSource);
1336
- }, []);
1337
- var onAddAndDelHandle = useCallback(function (type, index) {
1338
- console.log(type, index);
1339
- }, []);
1117
+ // const onMoveRowHandle = useCallback((newDataSource) => {
1118
+ // console.log(newDataSource);
1119
+ // setDataSource(newDataSource);
1120
+ // }, []);
1121
+ // const onAddAndDelHandle = useCallback((type, index) => {
1122
+ // console.log(type, index);
1123
+ // }, []);
1340
1124
  var onEditableSaveHandle = useCallback(function (record, index, dataIndex) {
1341
1125
  console.log(record, dataIndex, index);
1342
1126
  if (typeof index === 'number') {
@@ -1357,7 +1141,7 @@ function App() {
1357
1141
  getCheckboxProps: function (record) {
1358
1142
  return {};
1359
1143
  },
1360
- }); }, []);
1144
+ }); }, [keys]);
1361
1145
  var onSearchLayoutChange = useCallback(function (searchLayout) {
1362
1146
  setSearchLayout(searchLayout);
1363
1147
  }, []);
package/dist/Demo.js CHANGED
@@ -6,7 +6,7 @@ var selectStyle = { width: '200px' };
6
6
  function request(options) {
7
7
  return fetch(options.url + "?" + stringify(options.params), {
8
8
  headers: {
9
- 'Zmdms-Auth': 'bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0ZW5hbnRfaWQiOiIwMDAwMDAiLCJtZW1iZXJfdHlwZSI6MSwiaGFuZGxlX2hyX3Bob25lIjpudWxsLCJyZXN1bWVfZGF0ZSI6bnVsbCwidXNlcl9uYW1lIjoiY2hlbnl4IiwiZW1wX25hbWUiOiLpmYjkuprpm4QiLCJlbXBfbnVtYmVyIjoiWUcyMTA3MDA4IiwiaW10X2lkIjpudWxsLCJyZWFsX25hbWUiOiLpmYjkuprpm4QiLCJjbGllbnRfdHlwZSI6IndlYiIsImRhdGFfcm9sZV9pZCI6IjEzNDU5Nzg1MDUzMDIwNTY5NjIsMTQxMjYxNDExMDY0NzM4NjExNCwxNDEyNjE1Njc3MTE5MjY2ODE3LDE0NDgxMjEwODY1MDQzMDA1NDYsMTQ1MjgyMDI5MzgwMjcxMzA5MCwxNDUzOTI1MDAxNTMxNDc4MDE3LDE0NTg3MTIwODIwODIzNTcyNTAsMTQ1ODgyNjIzODE4NTg4OTc5NCwxNDU4ODI3NzAxMDEyMzI0MzUzLDE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WUiOiLmtZnllYbkuK3mi5Ppm4blm6LnianmtYHnp5HmioDmnInpmZDlhazlj7giLCJkZXB0X2lkIjoiMTM5NzA4MTkzMDMyODQyNDQ0OSIsImhhbmRsZV9ocl9uYW1lIjpudWxsLCJhY2NvdW50IjoiY2hlbnl4IiwicmVzdW1lX2lkIjpudWxsfQ.FzJkqhtmGgkSsDZd6RBylQEGxBsJRslLDtX9DXgfW-M',
10
10
  },
11
11
  method: options.method,
12
12
  }).then(function (response) { return response.json(); });
@@ -14,12 +14,12 @@ function request(options) {
14
14
  function Demo() {
15
15
  console.log('rerender');
16
16
  var _a = useState([]), list = _a[0], setList = _a[1];
17
- var _b = useState([]), defaultList = _b[0], setDefaultList = _b[1];
17
+ var _b = useState([]), setDefaultList = _b[1];
18
18
  var _c = useState(''), value = _c[0], setValue = _c[1];
19
- var _d = useState({
19
+ var params = useState({
20
20
  tenantId: '000000',
21
21
  isCreateUser: 0,
22
- }), params = _d[0], setParams = _d[1];
22
+ })[0];
23
23
  // 模拟接口请求
24
24
  useEffect(function () {
25
25
  var timeoutId = setTimeout(function () {
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const FormDemo: () => JSX.Element;
3
+ export default FormDemo;
@@ -0,0 +1,173 @@
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
+ return new (P || (P = Promise))(function (resolve, reject) {
15
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
19
+ });
20
+ };
21
+ var __generator = (this && this.__generator) || function (thisArg, body) {
22
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
+ function verb(n) { return function (v) { return step([n, v]); }; }
25
+ function step(op) {
26
+ if (f) throw new TypeError("Generator is already executing.");
27
+ while (_) try {
28
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
+ if (y = 0, t) op = [op[0] & 2, t.value];
30
+ switch (op[0]) {
31
+ case 0: case 1: t = op; break;
32
+ case 4: _.label++; return { value: op[1], done: false };
33
+ case 5: _.label++; y = op[1]; op = [0]; continue;
34
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
+ default:
36
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
+ if (t[2]) _.ops.pop();
41
+ _.trys.pop(); continue;
42
+ }
43
+ op = body.call(thisArg, _);
44
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
+ }
47
+ };
48
+ import React, { useState, useMemo } from 'react';
49
+ import SearchContainer from '../components/business/SearchContainer';
50
+ import Form from '../components/Form';
51
+ import Input from '../components/Input';
52
+ import Select from '../components/Select';
53
+ import DatePicker from '../components/DatePicker';
54
+ import Checkbox from '../components/Checkbox';
55
+ import Radio from '../components/Radio';
56
+ import InputNumber from '../components/InputNumber';
57
+ var SearchItem = SearchContainer.SearchItem, SearchLeft = SearchContainer.SearchLeft;
58
+ var RangePicker = DatePicker.RangePicker;
59
+ var configInfo = {
60
+ pwNoCopy: {
61
+ isRequired: 1,
62
+ isChangeable: 1,
63
+ isDisplay: 1,
64
+ },
65
+ pwNo1: {
66
+ isRequired: 1,
67
+ isChangeable: 1,
68
+ isDisplay: 1,
69
+ },
70
+ status: {
71
+ isRequired: 1,
72
+ isChangeable: 1,
73
+ isDisplay: 1,
74
+ },
75
+ startTime: {
76
+ isRequired: 1,
77
+ isChangeable: 1,
78
+ isDisplay: 1,
79
+ },
80
+ depId: {
81
+ isRequired: 1,
82
+ isChangeable: 1,
83
+ isDisplay: 1,
84
+ },
85
+ };
86
+ var FormDemo = function () {
87
+ var form = Form.useForm()[0];
88
+ var _a = useState('1'), status = _a[0], setStatus = _a[1];
89
+ var configInfoMemo = useMemo(function () {
90
+ return __assign(__assign({}, configInfo), { startTime: __assign(__assign({}, configInfo === null || configInfo === void 0 ? void 0 : configInfo.startTime), { isDisplay: status === '1' ? true : false }) });
91
+ }, [status]);
92
+ return (React.createElement(React.Fragment, null,
93
+ React.createElement(Form, { name: "test-list", form: form },
94
+ React.createElement(SearchContainer, { dark: true },
95
+ React.createElement(SearchLeft, { configInfo: configInfoMemo },
96
+ React.createElement(SearchItem, { width: "half", name: "pwNo", configname: "pwNoCopy", label: "\u5165\u5E93\u5355\u53F7", rules: [
97
+ {
98
+ required: true,
99
+ message: '采购基本数据-请选择入库单号',
100
+ },
101
+ ] },
102
+ React.createElement(Input.TextArea, { autoSize: true, allowClear: true, disabled: true, onChange: function (e) {
103
+ console.log(e.target.value);
104
+ } })),
105
+ React.createElement(SearchItem, { width: "half", name: "pwNo1", label: "\u5165\u5E93\u5355\u53F71", rules: [
106
+ {
107
+ required: false,
108
+ message: '采购基本数据-请选择入库单号1',
109
+ },
110
+ ] },
111
+ React.createElement(Input, null)),
112
+ React.createElement(SearchItem, { width: "half", name: "status", label: "\u5355\u636E\u72B6\u6001" },
113
+ React.createElement(Select, { onChange: function (value) {
114
+ setStatus(value);
115
+ } },
116
+ React.createElement(Select.Option, { value: "1" }, "\u662F"),
117
+ React.createElement(Select.Option, { value: "0" }, "\u5426"))),
118
+ React.createElement(SearchItem, { name: "intime", configname: "startTime", label: "\u5165\u5E93\u65E5\u671F" },
119
+ React.createElement(RangePicker, null)),
120
+ React.createElement(SearchItem, { name: "warehouseId", label: "\u4ED3\u5E93\u540D\u79F0" },
121
+ React.createElement(Select, null)),
122
+ React.createElement(SearchItem, { name: "companyId", label: "\u516C\u53F8\u540D\u79F0" },
123
+ React.createElement(Select, null)),
124
+ React.createElement(SearchItem, { name: "companyId1", label: "\u516C\u53F8\u540D\u79F01" },
125
+ React.createElement(Input.TextArea, { autoSize: true })),
126
+ React.createElement(SearchItem, { name: "depId", label: "\u90E8\u95E8\u540D\u79F0", rules: [{ required: true, message: '请选择部门名称' }] },
127
+ React.createElement(Select, { allowClear: true },
128
+ React.createElement(Select.Option, { value: "1" }, "\u662F"),
129
+ React.createElement(Select.Option, { value: "0" }, "\u5426"))),
130
+ React.createElement(SearchItem, { name: "test1", label: "\u90E8\u95E8\u540D\u79F0" },
131
+ React.createElement(Checkbox.Group, null,
132
+ React.createElement(Checkbox, { value: "1" }, "\u662F"),
133
+ React.createElement(Checkbox, { value: "2" }, "\u5426"))),
134
+ React.createElement(SearchItem, { name: "test2", label: "\u90E8\u95E8\u540D\u79F0", rules: [{ required: true, message: '请选择仓库名称' }] },
135
+ React.createElement(Radio.Group, null,
136
+ React.createElement(Radio, { value: "1" }, "\u662F"),
137
+ React.createElement(Radio, { value: "2" }, "\u5426"))),
138
+ React.createElement(SearchItem, { name: "test3", label: "\u90E8\u95E8\u540D\u79F0" },
139
+ React.createElement(InputNumber, null)),
140
+ React.createElement(SearchItem, { name: "test4", label: "\u90E8\u95E8\u540D\u79F0" },
141
+ React.createElement(Input.TextArea, { autoSize: true })),
142
+ React.createElement(SearchItem, { name: "type1", width: "half", noLabel: true },
143
+ React.createElement(Select, null)),
144
+ React.createElement(SearchItem, { name: "type2", width: "half", noLabel: true },
145
+ React.createElement(Input, null)),
146
+ React.createElement(SearchItem, { name: "type3", width: "half", noLabel: true },
147
+ React.createElement(Select, null)),
148
+ React.createElement(SearchItem, { name: "type4", width: "half", noLabel: true },
149
+ React.createElement(Select, null))))),
150
+ React.createElement("button", { onClick: function () { return __awaiter(void 0, void 0, void 0, function () {
151
+ var err_1, errorFields;
152
+ return __generator(this, function (_a) {
153
+ switch (_a.label) {
154
+ case 0:
155
+ _a.trys.push([0, 2, , 3]);
156
+ return [4 /*yield*/, form.validateFields()];
157
+ case 1:
158
+ _a.sent();
159
+ console.log(form.getFieldsValue());
160
+ return [3 /*break*/, 3];
161
+ case 2:
162
+ err_1 = _a.sent();
163
+ errorFields = err_1.errorFields;
164
+ if (errorFields) {
165
+ console.log(errorFields[0].errors + '');
166
+ }
167
+ return [3 /*break*/, 3];
168
+ case 3: return [2 /*return*/];
169
+ }
170
+ });
171
+ }); } }, "\u9A8C\u8BC1")));
172
+ };
173
+ export default FormDemo;
@@ -87,6 +87,14 @@ export interface IProps<T> extends Omit<SelectProps<T>, 'onChange'> {
87
87
  * 接口数据格式转换
88
88
  */
89
89
  transformData?: (res: any) => any;
90
+ /**
91
+ * 增加必传参数组
92
+ */
93
+ mustHasParams?: string | string[];
94
+ /**
95
+ * 增加需要禁用的选项
96
+ */
97
+ disabledValues?: any[];
90
98
  }
91
99
  /**
92
100
  * 增强下拉框功能组件
@@ -103,6 +111,6 @@ export interface IProps<T> extends Omit<SelectProps<T>, 'onChange'> {
103
111
  * { code: 200, data: { records: [] } } || { status: 200, data: { code: 200, data: { records: [] } } }
104
112
  * 如果数据不能在接口层面满足以上形式,那么组件提供transformData属性,转换接口数据格式
105
113
  */
106
- declare function EnhanceSelect<VT extends SelectValue = SelectValue>({ list, defaultList, params, url, method, dataKey, componentKey, titleKey, showAll, isCatch, onCompleted, onChange, request, remoteSearch, remoteSearchKey, remoteSearchDataKey, isRemoteSearchDataKey, transformData, joinKey, joinStr, ...restProps }: IProps<VT>): JSX.Element;
114
+ declare function EnhanceSelect<VT extends SelectValue = SelectValue>({ list, defaultList, params, url, method, dataKey, componentKey, titleKey, showAll, isCatch, onCompleted, onChange, request, remoteSearch, remoteSearchKey, remoteSearchDataKey, isRemoteSearchDataKey, transformData, joinKey, joinStr, mustHasParams, disabledValues, ...restProps }: IProps<VT>): JSX.Element;
107
115
  declare const _default: React.MemoExoticComponent<typeof EnhanceSelect>;
108
116
  export default _default;
@@ -76,7 +76,7 @@ function getData(request, options) {
76
76
  * 如果数据不能在接口层面满足以上形式,那么组件提供transformData属性,转换接口数据格式
77
77
  */
78
78
  function EnhanceSelect(_a) {
79
- var list = _a.list, defaultList = _a.defaultList, params = _a.params, url = _a.url, _b = _a.method, method = _b === void 0 ? 'GET' : _b, _c = _a.dataKey, dataKey = _c === void 0 ? 'id' : _c, componentKey = _a.componentKey, _d = _a.titleKey, titleKey = _d === void 0 ? 'name' : _d, showAll = _a.showAll, isCatch = _a.isCatch, onCompleted = _a.onCompleted, onChange = _a.onChange, request = _a.request, remoteSearch = _a.remoteSearch, remoteSearchKey = _a.remoteSearchKey, remoteSearchDataKey = _a.remoteSearchDataKey, _e = _a.isRemoteSearchDataKey, isRemoteSearchDataKey = _e === void 0 ? true : _e, transformData = _a.transformData, joinKey = _a.joinKey, _f = _a.joinStr, joinStr = _f === void 0 ? '-' : _f, restProps = __rest(_a, ["list", "defaultList", "params", "url", "method", "dataKey", "componentKey", "titleKey", "showAll", "isCatch", "onCompleted", "onChange", "request", "remoteSearch", "remoteSearchKey", "remoteSearchDataKey", "isRemoteSearchDataKey", "transformData", "joinKey", "joinStr"]);
79
+ var list = _a.list, defaultList = _a.defaultList, params = _a.params, url = _a.url, _b = _a.method, method = _b === void 0 ? 'GET' : _b, _c = _a.dataKey, dataKey = _c === void 0 ? 'id' : _c, componentKey = _a.componentKey, _d = _a.titleKey, titleKey = _d === void 0 ? 'name' : _d, showAll = _a.showAll, isCatch = _a.isCatch, onCompleted = _a.onCompleted, onChange = _a.onChange, request = _a.request, remoteSearch = _a.remoteSearch, remoteSearchKey = _a.remoteSearchKey, remoteSearchDataKey = _a.remoteSearchDataKey, _e = _a.isRemoteSearchDataKey, isRemoteSearchDataKey = _e === void 0 ? true : _e, transformData = _a.transformData, joinKey = _a.joinKey, _f = _a.joinStr, joinStr = _f === void 0 ? '-' : _f, mustHasParams = _a.mustHasParams, disabledValues = _a.disabledValues, restProps = __rest(_a, ["list", "defaultList", "params", "url", "method", "dataKey", "componentKey", "titleKey", "showAll", "isCatch", "onCompleted", "onChange", "request", "remoteSearch", "remoteSearchKey", "remoteSearchDataKey", "isRemoteSearchDataKey", "transformData", "joinKey", "joinStr", "mustHasParams", "disabledValues"]);
80
80
  // 下拉数据源
81
81
  var _g = useFetchState([]), selectList = _g[0], setSelectList = _g[1];
82
82
  // 多选时,自己需要合并的数据
@@ -96,6 +96,30 @@ function EnhanceSelect(_a) {
96
96
  }, [selectList]);
97
97
  // 获取数据,并设置数据
98
98
  var getDataHandle = useCallback(function (request, options, appointObj) {
99
+ var _a;
100
+ if (mustHasParams) {
101
+ var _params_1;
102
+ if (typeof options.params === 'string') {
103
+ try {
104
+ _params_1 = JSON.parse(options.params);
105
+ }
106
+ catch (err) {
107
+ console.log(err);
108
+ }
109
+ }
110
+ if (((_a = options === null || options === void 0 ? void 0 : options.method) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === 'POST') {
111
+ _params_1 = options.params;
112
+ }
113
+ // 如果必传参数不存在
114
+ if (typeof mustHasParams === 'string' &&
115
+ _params_1[mustHasParams] == null) {
116
+ return;
117
+ }
118
+ if (Array.isArray(mustHasParams) &&
119
+ mustHasParams.find(function (key) { return _params_1[key] == null; })) {
120
+ return;
121
+ }
122
+ }
99
123
  setLoading(true);
100
124
  // 利用闭包,存到当前请求的id
101
125
  fetchId.current++;
@@ -125,7 +149,7 @@ function EnhanceSelect(_a) {
125
149
  setLoading(false);
126
150
  console.log(err);
127
151
  });
128
- }, [setSelectList, setLoading, transformData]);
152
+ }, [setSelectList, setLoading, transformData, mustHasParams]);
129
153
  // 远程搜索
130
154
  var getRemoteDataHandle = useCallback(function (value, dataKeyValue) {
131
155
  var searchKey = remoteSearchKey ? remoteSearchKey : titleKey;
@@ -357,7 +381,12 @@ function EnhanceSelect(_a) {
357
381
  else {
358
382
  joinTitle = [title];
359
383
  }
360
- return (React.createElement(Select.Option, { key: key, value: value, title: title, disabled: item === null || item === void 0 ? void 0 : item.disabled }, Array.isArray(joinTitle) ? joinTitle === null || joinTitle === void 0 ? void 0 : joinTitle.join(joinStr) : ''));
384
+ var disabled = item === null || item === void 0 ? void 0 : item.disabled;
385
+ if (Array.isArray(disabledValues) &&
386
+ disabledValues.includes(value)) {
387
+ disabled = true;
388
+ }
389
+ return (React.createElement(Select.Option, { key: key, value: value, title: title, disabled: disabled }, Array.isArray(joinTitle) ? joinTitle === null || joinTitle === void 0 ? void 0 : joinTitle.join(joinStr) : ''));
361
390
  })));
362
391
  }
363
392
  // 本地搜索
@@ -105,7 +105,7 @@ var TableEnhanceCell = memo(function (_a) {
105
105
  }
106
106
  } })));
107
107
  }
108
- var type = editableConfig.type, data = editableConfig.data, keyValue = editableConfig.keyValue, maxHandle = editableConfig.maxHandle, minHandle = editableConfig.minHandle, editableProps = __rest(editableConfig, ["type", "data", "keyValue", "maxHandle", "minHandle"]);
108
+ var type = editableConfig.type, data = editableConfig.data, keyValue = editableConfig.keyValue, maxHandle = editableConfig.maxHandle, minHandle = editableConfig.minHandle, disabledHandle = editableConfig.disabledHandle, editableProps = __rest(editableConfig, ["type", "data", "keyValue", "maxHandle", "minHandle", "disabledHandle"]);
109
109
  var selectData = data; // 下拉框使用到得数据
110
110
  // 下拉框键值对对象
111
111
  var selectKeyValue = keyValue || {
@@ -113,6 +113,7 @@ var TableEnhanceCell = memo(function (_a) {
113
113
  label: 'dictValue',
114
114
  };
115
115
  var inputNumMaxMin = {}; // 数字input框最大最小值
116
+ var disabledResult = editableProps === null || editableProps === void 0 ? void 0 : editableProps.disabled;
116
117
  if (data && data instanceof Function) {
117
118
  selectData = data();
118
119
  }
@@ -122,19 +123,22 @@ var TableEnhanceCell = memo(function (_a) {
122
123
  if (minHandle && minHandle instanceof Function) {
123
124
  inputNumMaxMin.min = minHandle(record);
124
125
  }
126
+ if (disabledHandle && disabledHandle instanceof Function) {
127
+ disabledResult = disabledHandle(record);
128
+ }
125
129
  // 处理各种类型
126
130
  if (type === 'select') {
127
131
  return (React.createElement(Form.Item, { className: "zt-table__enhance-cell", name: dataIndex },
128
- React.createElement(Select, __assign({ allowClear: true }, editableProps, { onChange: save }), Array.isArray(selectData) &&
132
+ React.createElement(Select, __assign({ allowClear: true }, editableProps, { disabled: disabledResult, onChange: save }), Array.isArray(selectData) &&
129
133
  selectData.map(function (item) { return (React.createElement(Select.Option, { key: item[selectKeyValue.key] + '', value: item[selectKeyValue === null || selectKeyValue === void 0 ? void 0 : selectKeyValue.key] }, item[selectKeyValue === null || selectKeyValue === void 0 ? void 0 : selectKeyValue.label])); }))));
130
134
  }
131
135
  else if (type === 'inputNumber') {
132
136
  return (React.createElement(Form.Item, { className: "zt-table__enhance-cell", name: dataIndex },
133
- React.createElement(InputNumber, __assign({ autoComplete: "new-password", maxLength: 50 }, inputNumMaxMin, editableProps, { onPressEnter: save, onBlur: save }))));
137
+ React.createElement(InputNumber, __assign({ autoComplete: "new-password", maxLength: 50 }, inputNumMaxMin, editableProps, { disabled: disabledResult, onPressEnter: save, onBlur: save }))));
134
138
  }
135
139
  else if (type === 'textArea') {
136
140
  return (React.createElement(Form.Item, { className: "zt-table__enhance-cell", name: dataIndex },
137
- React.createElement(Input.TextArea, __assign({ autoComplete: "new-password", maxLength: 200, autoSize: { maxRows: 3 } }, editableProps, { onPressEnter: save, onBlur: save, onChange: function (e) {
141
+ React.createElement(Input.TextArea, __assign({ autoComplete: "new-password", maxLength: 200, autoSize: { maxRows: 3 } }, editableProps, { disabled: disabledResult, onPressEnter: save, onBlur: save, onChange: function (e) {
138
142
  if (!e.target.value) {
139
143
  e.target.focus();
140
144
  }
@@ -142,7 +146,7 @@ var TableEnhanceCell = memo(function (_a) {
142
146
  }
143
147
  else {
144
148
  return (React.createElement(Form.Item, { className: "zt-table__enhance-cell", name: dataIndex },
145
- React.createElement(Input, __assign({ autoComplete: "new-password", maxLength: 50 }, editableProps, { onPressEnter: save, onBlur: save, allowClear: true, onChange: function (e) {
149
+ React.createElement(Input, __assign({ autoComplete: "new-password", maxLength: 50 }, editableProps, { disabled: disabledResult, onPressEnter: save, onBlur: save, allowClear: true, onChange: function (e) {
146
150
  if (!e.target.value) {
147
151
  e.target.focus();
148
152
  }
@@ -35,6 +35,7 @@ var DetailList = function (_a) {
35
35
  return (React.createElement(Item, { label: item === null || item === void 0 ? void 0 : item.label, key: index }, item === null || item === void 0 ? void 0 : item.content));
36
36
  }
37
37
  // 其他数据返回空
38
+ return null;
38
39
  }))),
39
40
  React.createElement(Descriptions, { bordered: true, className: "detail_list", column: 1, labelStyle: {
40
41
  height: '36px',
@@ -105,6 +106,7 @@ var DetailList = function (_a) {
105
106
  } }, "\u4E0B\u8F7D"))));
106
107
  })));
107
108
  }
109
+ return null;
108
110
  })))),
109
111
  hasSignArea && (React.createElement("div", { style: {
110
112
  width: '100%',
@@ -10,6 +10,10 @@ export interface ISearchItem extends FormItemProps {
10
10
  noBorder?: boolean;
11
11
  /**没有label */
12
12
  noLabel?: boolean;
13
+ /**配置必填、可修改、展示name */
14
+ configname?: string;
15
+ /**不需要自动配置 */
16
+ noauto?: string;
13
17
  }
14
18
  declare const SearchItem: React.FC<ISearchItem>;
15
19
  export default SearchItem;
@@ -11,6 +11,7 @@ export interface ISearchLeft {
11
11
  onChange?: (searchLayout: ISearchLayout[]) => void;
12
12
  isFlex?: boolean;
13
13
  className?: string;
14
+ configInfo?: any;
14
15
  }
15
16
  declare const SearchLeft: React.FC<ISearchLeft>;
16
17
  export default SearchLeft;
@@ -3,10 +3,20 @@ import classNames from 'classnames';
3
3
  import SearchDrawer from './search-drawer';
4
4
  import { SettingOutlined } from '@ant-design/icons';
5
5
  import useDynamic from './hooks/useDynamic';
6
+ function useConfigChildren(children) {
7
+ var _a = useState(null), configChildren = _a[0], setConfigChildren = _a[1];
8
+ useEffect(function () {
9
+ if (children) {
10
+ setConfigChildren(children);
11
+ }
12
+ }, [children]);
13
+ return { configChildren: configChildren };
14
+ }
6
15
  var SearchLeft = function (_a) {
7
- var children = _a.children, className = _a.className, isDynamic = _a.isDynamic, searchLayout = _a.searchLayout, onChange = _a.onChange, _b = _a.isFlex, isFlex = _b === void 0 ? true : _b;
16
+ var children = _a.children, className = _a.className, isDynamic = _a.isDynamic, searchLayout = _a.searchLayout, onChange = _a.onChange, _b = _a.isFlex, isFlex = _b === void 0 ? true : _b, configInfo = _a.configInfo;
8
17
  /**缓存初始化值 */
9
18
  var _c = useDynamic(children, isDynamic, searchLayout), dynamicArr = _c.dynamicArr, initDynamicArr = _c.initDynamicArr, newChildren = _c.newChildren;
19
+ var configChildren = useConfigChildren(children).configChildren;
10
20
  var classes = classNames('zt-search__left', className, {
11
21
  'zt-search__left--flex': isFlex,
12
22
  'zt-search__left--dynamic': isDynamic,
@@ -53,7 +63,48 @@ var SearchLeft = function (_a) {
53
63
  }
54
64
  return null;
55
65
  })
56
- : children,
66
+ : configInfo
67
+ ? React.Children.map(configChildren, function (childItem) {
68
+ var _a;
69
+ if (childItem === null || childItem === void 0 ? void 0 : childItem.props) {
70
+ var _b = childItem === null || childItem === void 0 ? void 0 : childItem.props, name_2 = _b.name, label = _b.label, configname = _b.configname, noauto = _b.noauto, formChildren = _b.children, rules = _b.rules;
71
+ var config = configname
72
+ ? configInfo[configname]
73
+ : configInfo[name_2];
74
+ if (config && !noauto) {
75
+ // 如果配置里面设置了required配置,那么需要覆盖
76
+ var newRules = Array.isArray(rules) ? rules.slice() : [];
77
+ var requiredIndex = newRules.findIndex(function (rule) { return (rule === null || rule === void 0 ? void 0 : rule.required) === true || (rule === null || rule === void 0 ? void 0 : rule.required) === false; });
78
+ if (requiredIndex !== -1) {
79
+ var message = (_a = newRules[requiredIndex]) === null || _a === void 0 ? void 0 : _a.message;
80
+ newRules.splice(requiredIndex, 1, {
81
+ required: !!(config === null || config === void 0 ? void 0 : config.isRequired),
82
+ message: message,
83
+ });
84
+ }
85
+ else {
86
+ newRules.unshift({
87
+ required: !!(config === null || config === void 0 ? void 0 : config.isRequired),
88
+ message: label + " \u672A\u586B!",
89
+ });
90
+ }
91
+ // 覆盖 disabled rules里面的required属性
92
+ return !!(config === null || config === void 0 ? void 0 : config.isDisplay)
93
+ ? React.cloneElement(childItem, {
94
+ disabled: !!!(config === null || config === void 0 ? void 0 : config.isChangeable),
95
+ rules: newRules,
96
+ }, React.cloneElement(formChildren, {
97
+ disabled: !!!(config === null || config === void 0 ? void 0 : config.isChangeable),
98
+ }))
99
+ : null;
100
+ }
101
+ else {
102
+ return childItem;
103
+ }
104
+ }
105
+ return childItem;
106
+ })
107
+ : children,
57
108
  Array.isArray(dynamicList) && dynamicList.length ? (React.createElement(SearchDrawer, { visible: visible, onClose: onClose, onSure: onSure, onReset: onReset, onInsideChange: onInsideChange, dynamicList: dynamicList })) : null,
58
109
  Array.isArray(dynamicList) && dynamicList.length ? (React.createElement("div", { className: "zt-search__left--setting", onClick: function () { return setVisible(true); } },
59
110
  React.createElement(SettingOutlined, { style: { fontSize: 18, color: '#768696' } }))) : null));
package/dist/index.js CHANGED
@@ -15,6 +15,7 @@
15
15
  // import WeChatDemo from './DemoCom/WechatDemo';
16
16
  // import TableDemo from './DemoCom/TableDemo';
17
17
  // import BasicDemo from './DemoCom/BasicDemo';
18
+ // import FormDemo from './DemoCom/FormDemo';
18
19
  // dayjs.locale(zhCn);
19
20
  // ReactDOM.render(
20
21
  // // <React.StrictMode>
@@ -51,6 +52,9 @@
51
52
  // <Route exact path="/basic">
52
53
  // <BasicDemo />
53
54
  // </Route>
55
+ // <Route exact path="/form">
56
+ // <FormDemo />
57
+ // </Route>
54
58
  // <Route exact path="/test">
55
59
  // <div>
56
60
  // <h1>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ztxkui",
3
- "version": "2.3.1",
3
+ "version": "2.3.5",
4
4
  "private": false,
5
5
  "description": "React components library",
6
6
  "author": "zt-front-end",