ztxkui 2.3.4 → 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 +1 -1
- package/dist/App.js +9 -225
- package/dist/Demo.js +3 -3
- package/dist/DemoCom/FormDemo.d.ts +3 -0
- package/dist/DemoCom/FormDemo.js +173 -0
- package/dist/components/business/DetailList/index.js +2 -0
- package/dist/components/business/SearchContainer/search-item.d.ts +4 -0
- package/dist/components/business/SearchContainer/search-left.d.ts +1 -0
- package/dist/components/business/SearchContainer/search-left.js +53 -2
- package/dist/index.js +4 -0
- package/package.json +1 -1
package/README.md
CHANGED
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([]),
|
|
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
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
}, []);
|
|
1337
|
-
|
|
1338
|
-
|
|
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
|
@@ -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([]),
|
|
17
|
+
var _b = useState([]), setDefaultList = _b[1];
|
|
18
18
|
var _c = useState(''), value = _c[0], setValue = _c[1];
|
|
19
|
-
var
|
|
19
|
+
var params = useState({
|
|
20
20
|
tenantId: '000000',
|
|
21
21
|
isCreateUser: 0,
|
|
22
|
-
})
|
|
22
|
+
})[0];
|
|
23
23
|
// 模拟接口请求
|
|
24
24
|
useEffect(function () {
|
|
25
25
|
var timeoutId = setTimeout(function () {
|
|
@@ -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;
|
|
@@ -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;
|
|
@@ -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
|
-
:
|
|
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>
|