ztxkui 2.3.3 → 2.3.7

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;
@@ -195,7 +195,17 @@ var TableDemo = function () {
195
195
  },
196
196
  editableConfig: {
197
197
  type: 'inputNumber',
198
- min: 0,
198
+ // min: 0,
199
+ minHandle: function (record) {
200
+ return {
201
+ number: 0,
202
+ };
203
+ },
204
+ maxHandle: function (record) {
205
+ return {
206
+ number: 10,
207
+ };
208
+ },
199
209
  precision: 3,
200
210
  },
201
211
  },
@@ -1,10 +1,48 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __generator = (this && this.__generator) || function (thisArg, body) {
11
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
12
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
+ function verb(n) { return function (v) { return step([n, v]); }; }
14
+ function step(op) {
15
+ if (f) throw new TypeError("Generator is already executing.");
16
+ while (_) try {
17
+ 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;
18
+ if (y = 0, t) op = [op[0] & 2, t.value];
19
+ switch (op[0]) {
20
+ case 0: case 1: t = op; break;
21
+ case 4: _.label++; return { value: op[1], done: false };
22
+ case 5: _.label++; y = op[1]; op = [0]; continue;
23
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
+ default:
25
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
+ if (t[2]) _.ops.pop();
30
+ _.trys.pop(); continue;
31
+ }
32
+ op = body.call(thisArg, _);
33
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
+ }
36
+ };
1
37
  import { Link } from 'react-router-dom';
2
38
  import Upload from 'components/Upload';
3
- import { useState, useEffect, useCallback } from 'react';
39
+ import { useState, useEffect, useCallback, useRef } from 'react';
4
40
  var originFileList = [];
5
- var token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0ZW5hbnRfaWQiOiIwMDAwMDAiLCJtZW1iZXJfdHlwZSI6MSwiaGFuZGxlX2hyX3Bob25lIjpudWxsLCJyZXN1bWVfZGF0ZSI6bnVsbCwidXNlcl9uYW1lIjoiY2hlbnl4IiwiZW1wX25hbWUiOiLpmYjkuprpm4QiLCJlbXBfbnVtYmVyIjoiWUcyMTA3MDA4IiwiaW10X2lkIjpudWxsLCJyZWFsX25hbWUiOiLpmYjkuprpm4QiLCJjbGllbnRfdHlwZSI6IndlYiIsImRhdGFfcm9sZV9pZCI6IjEzNDU5Nzg1MDUzMDIwNTY5NjIsMTQxMjYxNDExMDY0NzM4NjExNCwxNDEyNjE1Njc3MTE5MjY2ODE3LDE0NDgxMjEwODY1MDQzMDA1NDYsMTQ1MjgyMDI5MzgwMjcxMzA5MCwxNDUzOTI1MDAxNTMxNDc4MDE3LDE0NTg3MTIwODIwODIzNTcyNTAsMTQ1ODgyNjIzODE4NTg4OTc5NCwxNDU4ODI3NzAxMDEyMzI0MzUzLDE0NTg4MjgzNjA4MDE1MDkzNzcsMTQ2MDA4OTI2MjAxMjAzMDk3NywxNDYxMTM3Nzg4NjQ1MTI2MTQ2IiwiY2xpZW50X2lkIjoic3dvcmQiLCJ1c2VyX3R5cGUiOiJ3ZWIiLCJyb2xlX2lkIjoiMTQxMjYwODc0Mjk1MzI4NzY4MiwxNDM4MzIyNTQzMjk1OTI2Mjc0LDE0NDM0NzU0NzU5NzI3MzQ5NzcsMTQ0NjgxOTQ2MzY5Mzg0NDQ4MiwxNDYwMDg1NDI2ODE1OTUwODQ5LDE0NjI2MjI5OTIzNzUyMDk5ODYiLCJwb3N0X25hbWUiOm51bGwsInNjb3BlIjpbImFsbCJdLCJpbnRlcnZpZXdfaWQiOm51bGwsIm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1ZWNlMDgyN2QiLCJtZW1iZXJfaWQiOjE0MTI5NTMyMDUyNjk1MTYyOTAsImNvbXBhbnlfaWQiOjEzOTcwNzQ2MDU0MTI2OTYwNjYsInN5c3RlbV9pZCI6bnVsbCwiZGVwdF9uYW1lIjoi5Lia5Yqh5LiA6YOoIiwiYXZhdGFyIjoiIiwiZGF0YV9yb2xlX25hbWUiOiJhZG1pbix1c2VyLHVzZXIsYWRtaW4sYWRtaW4sdXNlcix1c2VyLHVzZXIsdXNlcix1c2VyLHVzZXIsdXNlciIsImF1dGhvcml0aWVzIjpbImFkbWluIiwidXNlciIsImFkbWluaXN0cmF0b3IiXSwicm9sZV9uYW1lIjoidXNlcixhZG1pbmlzdHJhdG9yLGFkbWluLGFkbWluaXN0cmF0b3IsdXNlcix1c2VyIiwicmVzdW1lX3RlbXBsYXRlIjpudWxsLCJsaWNlbnNlIjoicG93ZXJlZCBieSB6bWRtcyIsInBvc3RfaWQiOiIiLCJ1c2VyX2lkIjoiMTQxMjk1MzgwNDMzMzU1NTcxNCIsIm9yZ19pZCI6MTQ1NzUyNzc2NTkxODUxNTUzNSwibmlja19uYW1lIjoi6ZmI5Lqa6ZuEIiwiY29tcGFueV9uYW1lIjoi5rWZ5ZWG5Lit5ouT6ZuG5Zui54mp5rWB56eR5oqA5pyJ6ZmQ5YWs5Y-4IiwiZGVwdF9pZCI6IjEzOTcwODE5MzAzMjg0MjQ0NDkiLCJoYW5kbGVfaHJfbmFtZSI6bnVsbCwiYWNjb3VudCI6ImNoZW55eCIsInJlc3VtZV9pZCI6bnVsbH0.wr6BV61OVYd-o9kccJJhWBGWzqyYyMTqdwd5qUxZlhM";
6
42
  function UploadDemo() {
43
+ var _this = this;
7
44
  var _a = useState(originFileList), fileList = _a[0], setFileList = _a[1];
45
+ var upload = useRef();
8
46
  useEffect(function () {
9
47
  setTimeout(function () {
10
48
  setFileList([
@@ -15,6 +53,27 @@ function UploadDemo() {
15
53
  // percent: 100,
16
54
  // status: 'done',
17
55
  },
56
+ {
57
+ attachId: '123',
58
+ attachName: '123.jpg',
59
+ fileSize: 36742,
60
+ percent: 80,
61
+ status: 'uploading',
62
+ },
63
+ {
64
+ attachId: '1491978407680376833',
65
+ attachName: '260929616_640_640.jpg',
66
+ fileSize: 36742,
67
+ percent: 80,
68
+ status: 'error',
69
+ },
70
+ {
71
+ attachId: '1492035772232466434',
72
+ attachName: '260929610_640_640.jpg',
73
+ fileSize: 36742,
74
+ // percent: 100,
75
+ // status: 'error',
76
+ },
18
77
  // {
19
78
  // // uid可不传,这个应该时组件需要一个内部id,可以同attachId
20
79
  // uid: '1418469936545132546',
@@ -80,6 +139,29 @@ function UploadDemo() {
80
139
  setFileList(filelist);
81
140
  }
82
141
  }, []);
142
+ var checkHandle = function () { return __awaiter(_this, void 0, void 0, function () {
143
+ var err_1, errorFields;
144
+ var _a, _b;
145
+ return __generator(this, function (_c) {
146
+ switch (_c.label) {
147
+ case 0:
148
+ _c.trys.push([0, 2, , 3]);
149
+ return [4 /*yield*/, ((_b = (_a = upload.current) === null || _a === void 0 ? void 0 : _a.validate) === null || _b === void 0 ? void 0 : _b.call(_a, { title: '测试下面的', isError: true }))];
150
+ case 1:
151
+ _c.sent();
152
+ return [3 /*break*/, 3];
153
+ case 2:
154
+ err_1 = _c.sent();
155
+ console.log(err_1);
156
+ errorFields = err_1.errorFields;
157
+ if (errorFields) {
158
+ console.log(errorFields[0].errors + '');
159
+ }
160
+ return [2 /*return*/];
161
+ case 3: return [2 /*return*/];
162
+ }
163
+ });
164
+ }); };
83
165
  return (React.createElement("div", null,
84
166
  React.createElement(Link, { to: "/test" }, "test"),
85
167
  React.createElement(Upload, { method: "post", headers: {
@@ -96,7 +178,7 @@ function UploadDemo() {
96
178
  system: '2',
97
179
  }, apiBaseUrl: "http://192.168.0.83:8888", fileBaseUrl: "http://192.168.0.83:88", originFileList: fileList, callback: uploadCallbackFn, onDeleteCallback: function (index, file) {
98
180
  console.log(index, file);
99
- } }),
181
+ }, upload: upload }),
100
182
  React.createElement(Upload, { maxSize: 200 * 1024, ztAccept: ['.jpg', '.jpeg', '.png', '.bmp', '.gif'], listType: "picture-card", method: "post", headers: {
101
183
  'Zmdms-Auth': token,
102
184
  }, showUploadList: {
@@ -105,6 +187,7 @@ function UploadDemo() {
105
187
  showRemoveIcon: true,
106
188
  }, apiBaseUrl: "http://192.168.0.83:8888", fileBaseUrl: "http://192.168.0.83:88", showTable: false, showTip: false, originFileList: fileList, maxCount: 1, callback: uploadCallbackFn, onDeleteCallback: function (index, file) {
107
189
  console.log(index, file);
108
- }, authToken: token })));
190
+ }, authToken: token }),
191
+ React.createElement("button", { onClick: checkHandle }, "\u68C0\u67E5")));
109
192
  }
110
193
  export default UploadDemo;
@@ -91,6 +91,10 @@ export interface IProps<T> extends Omit<SelectProps<T>, 'onChange'> {
91
91
  * 增加必传参数组
92
92
  */
93
93
  mustHasParams?: string | string[];
94
+ /**
95
+ * 增加需要禁用的选项
96
+ */
97
+ disabledValues?: any[];
94
98
  }
95
99
  /**
96
100
  * 增强下拉框功能组件
@@ -107,6 +111,6 @@ export interface IProps<T> extends Omit<SelectProps<T>, 'onChange'> {
107
111
  * { code: 200, data: { records: [] } } || { status: 200, data: { code: 200, data: { records: [] } } }
108
112
  * 如果数据不能在接口层面满足以上形式,那么组件提供transformData属性,转换接口数据格式
109
113
  */
110
- 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, ...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;
111
115
  declare const _default: React.MemoExoticComponent<typeof EnhanceSelect>;
112
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, mustHasParams = _a.mustHasParams, restProps = __rest(_a, ["list", "defaultList", "params", "url", "method", "dataKey", "componentKey", "titleKey", "showAll", "isCatch", "onCompleted", "onChange", "request", "remoteSearch", "remoteSearchKey", "remoteSearchDataKey", "isRemoteSearchDataKey", "transformData", "joinKey", "joinStr", "mustHasParams"]);
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
  // 多选时,自己需要合并的数据
@@ -381,7 +381,12 @@ function EnhanceSelect(_a) {
381
381
  else {
382
382
  joinTitle = [title];
383
383
  }
384
- 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) : ''));
385
390
  })));
386
391
  }
387
392
  // 本地搜索
@@ -8,8 +8,10 @@ export interface IEditableConfig {
8
8
  key: string;
9
9
  label: string;
10
10
  };
11
- maxHandle?: (record: any) => number;
12
- minHandle?: (record: any) => number;
11
+ maxHandle?: (record: any) => any;
12
+ minHandle?: (record: any) => any;
13
+ /**是否禁用 */
14
+ disabledHandle?: (record: any) => boolean;
13
15
  /**数字输入框的转换类型:内置 货币和百分比 */
14
16
  formatterType?: IFormatterType;
15
17
  /**货币的前缀 可以为 $ 或 ¥ */
@@ -58,7 +58,7 @@ var __rest = (this && this.__rest) || function (s, e) {
58
58
  };
59
59
  import React, { useContext, useEffect, memo } from 'react';
60
60
  import { EditableContext } from './table-enhance-row';
61
- import { Form, Input, InputNumber, Select } from '../../index';
61
+ import { Form, Input, InputNumber, Select, message } from '../../index';
62
62
  var TableEnhanceCell = memo(function (_a) {
63
63
  var title = _a.title, index = _a.index, editable = _a.editable, editableConfig = _a.editableConfig, children = _a.children, dataIndex = _a.dataIndex, record = _a.record, handleSave = _a.handleSave, restProps = __rest(_a, ["title", "index", "editable", "editableConfig", "children", "dataIndex", "record", "handleSave"]);
64
64
  var form = useContext(EditableContext);
@@ -71,22 +71,41 @@ var TableEnhanceCell = memo(function (_a) {
71
71
  /**
72
72
  * @description 保存事件
73
73
  */
74
- var save = function () { return __awaiter(void 0, void 0, void 0, function () {
75
- var values, err_1;
76
- return __generator(this, function (_a) {
77
- switch (_a.label) {
74
+ var save = function (info) { return __awaiter(void 0, void 0, void 0, function () {
75
+ var values, result, currentInputNumberValue, result, currentInputNumberValue, err_1;
76
+ var _a, _b;
77
+ return __generator(this, function (_c) {
78
+ switch (_c.label) {
78
79
  case 0:
79
- _a.trys.push([0, 2, , 3]);
80
+ _c.trys.push([0, 2, , 3]);
80
81
  return [4 /*yield*/, (form === null || form === void 0 ? void 0 : form.validateFields())];
81
82
  case 1:
82
- values = _a.sent();
83
+ values = _c.sent();
83
84
  if (!handleSave) {
84
85
  console.error('Table props onEditableSave is not a function');
85
86
  }
87
+ if (info && info.maxResult) {
88
+ result = info.maxResult;
89
+ currentInputNumberValue = values[dataIndex];
90
+ if (currentInputNumberValue > (result === null || result === void 0 ? void 0 : result.number)) {
91
+ message.warning((result.tableName ? "\u60A8\u4FEE\u6539" + result.tableName + "\u8868\u683C\u7684" : '表格') + " \u7B2C" + (typeof index === 'number' ? index + 1 : index) + "\u884C \u7684" + title + "\u5B57\u6BB5\uFF0C\u8F93\u5165\u7684\u6570\u503C\uFF0C\u5DF2\u8D85\u8FC7\u6700\u5927\u503C\uFF0C\u5DF2\u5E2E\u60A8\u4FEE\u6539\u4E3A\u6700\u5927\u503C!");
92
+ handleSave(__assign(__assign(__assign({}, record), values), (_a = {}, _a[dataIndex] = result === null || result === void 0 ? void 0 : result.number, _a)), index, dataIndex);
93
+ return [2 /*return*/];
94
+ }
95
+ }
96
+ if (info && info.minResult) {
97
+ result = info.minResult;
98
+ currentInputNumberValue = values[dataIndex];
99
+ if (currentInputNumberValue < (result === null || result === void 0 ? void 0 : result.number)) {
100
+ message.warning((result.tableName ? "\u60A8\u4FEE\u6539" + result.tableName + "\u8868\u683C\u7684" : '表格') + " \u7B2C" + (index ? index + 1 : index) + "\u884C \u7684" + title + "\u5B57\u6BB5\uFF0C\u8F93\u5165\u7684\u6570\u503C\uFF0C\u5DF2\u4F4E\u4E8E\u6700\u5C0F\u503C\uFF0C\u5DF2\u5E2E\u60A8\u4FEE\u6539\u4E3A\u6700\u5C0F\u503C!");
101
+ handleSave(__assign(__assign(__assign({}, record), values), (_b = {}, _b[dataIndex] = result === null || result === void 0 ? void 0 : result.number, _b)), index, dataIndex);
102
+ return [2 /*return*/];
103
+ }
104
+ }
86
105
  handleSave(__assign(__assign({}, record), values), index, dataIndex);
87
106
  return [3 /*break*/, 3];
88
107
  case 2:
89
- err_1 = _a.sent();
108
+ err_1 = _c.sent();
90
109
  console.error('Save failed:', err_1);
91
110
  return [3 /*break*/, 3];
92
111
  case 3: return [2 /*return*/];
@@ -113,15 +132,29 @@ var TableEnhanceCell = memo(function (_a) {
113
132
  label: 'dictValue',
114
133
  };
115
134
  var inputNumMaxMin = {}; // 数字input框最大最小值
135
+ var maxResult = {};
136
+ var minResult = {};
116
137
  var disabledResult = editableProps === null || editableProps === void 0 ? void 0 : editableProps.disabled;
117
138
  if (data && data instanceof Function) {
118
139
  selectData = data();
119
140
  }
120
141
  if (maxHandle && maxHandle instanceof Function) {
121
- inputNumMaxMin.max = maxHandle(record);
142
+ var result = maxHandle(record);
143
+ if (typeof result === 'number') {
144
+ inputNumMaxMin.max = result;
145
+ }
146
+ else {
147
+ maxResult = result;
148
+ }
122
149
  }
123
150
  if (minHandle && minHandle instanceof Function) {
124
- inputNumMaxMin.min = minHandle(record);
151
+ var result = minHandle(record);
152
+ if (typeof result === 'number') {
153
+ inputNumMaxMin.min = result;
154
+ }
155
+ else {
156
+ minResult = result;
157
+ }
125
158
  }
126
159
  if (disabledHandle && disabledHandle instanceof Function) {
127
160
  disabledResult = disabledHandle(record);
@@ -134,7 +167,7 @@ var TableEnhanceCell = memo(function (_a) {
134
167
  }
135
168
  else if (type === 'inputNumber') {
136
169
  return (React.createElement(Form.Item, { className: "zt-table__enhance-cell", name: dataIndex },
137
- React.createElement(InputNumber, __assign({ autoComplete: "new-password", maxLength: 50 }, inputNumMaxMin, editableProps, { disabled: disabledResult, onPressEnter: save, onBlur: save }))));
170
+ React.createElement(InputNumber, __assign({ autoComplete: "new-password", maxLength: 50 }, inputNumMaxMin, editableProps, { disabled: disabledResult, onPressEnter: function () { return save({ maxResult: maxResult, minResult: minResult }); }, onBlur: function () { return save({ maxResult: maxResult, minResult: minResult }); } }))));
138
171
  }
139
172
  else if (type === 'textArea') {
140
173
  return (React.createElement(Form.Item, { className: "zt-table__enhance-cell", name: dataIndex },
@@ -1,6 +1,9 @@
1
1
  import React from 'react';
2
2
  import { UploadProps } from 'antd/lib/upload';
3
3
  import { UploadFile } from './';
4
+ export interface IUploadRef {
5
+ validate?: (info?: any) => any;
6
+ }
4
7
  export interface IProps extends UploadProps {
5
8
  /**是否显示上传表格 */
6
9
  showTable?: boolean;
@@ -57,6 +60,8 @@ export interface IProps extends UploadProps {
57
60
  otherColumns?: any;
58
61
  /**是否直接替换 */
59
62
  isDirect?: boolean;
63
+ /**附件上传对象 */
64
+ upload?: any;
60
65
  }
61
66
  declare const Upload: React.FC<IProps>;
62
67
  export default Upload;
@@ -9,6 +9,42 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
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
+ };
12
48
  var __rest = (this && this.__rest) || function (s, e) {
13
49
  var t = {};
14
50
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -44,9 +80,58 @@ var _accept = [
44
80
  '.gif',
45
81
  ];
46
82
  var Upload = function (props) {
47
- var children = props.children, className = props.className, _a = props.showTip, showTip = _a === void 0 ? true : _a, _b = props.showUploadBtn, showUploadBtn = _b === void 0 ? true : _b, _c = props.showDeleteBtn, showDeleteBtn = _c === void 0 ? true : _c, onDownLoadCallbackBefore = props.onDownLoadCallbackBefore, _d = props.showDownloadBtn, showDownloadBtn = _d === void 0 ? true : _d, onDownLoadCallbackAfter = props.onDownLoadCallbackAfter, _e = props.showPreviewBtn, showPreviewBtn = _e === void 0 ? true : _e, onPreviewCallbackBefore = props.onPreviewCallbackBefore, _f = props.showTable, showTable = _f === void 0 ? true : _f, showUploadList = props.showUploadList, onChange = props.onChange, beforeUpload = props.beforeUpload, multiple = props.multiple, ztAccept = props.ztAccept, ztShowTipText = props.ztShowTipText, maxCount = props.maxCount, maxSize = props.maxSize, maxSizeStr = props.maxSizeStr, action = props.action, headers = props.headers, method = props.method, uploadUser = props.uploadUser, originFileList = props.originFileList, callback = props.callback, onDeleteCallback = props.onDeleteCallback, isAutoDelete = props.isAutoDelete, apiBaseUrl = props.apiBaseUrl, _g = props.fileBaseUrl, fileBaseUrl = _g === void 0 ? '' : _g, fileBtnText = props.fileBtnText, data = props.data, authToken = props.authToken, listType = props.listType, isPublic = props.isPublic, startColumns = props.startColumns, otherColumns = props.otherColumns, _h = props.isDirect, isDirect = _h === void 0 ? false : _h, restProps = __rest(props, ["children", "className", "showTip", "showUploadBtn", "showDeleteBtn", "onDownLoadCallbackBefore", "showDownloadBtn", "onDownLoadCallbackAfter", "showPreviewBtn", "onPreviewCallbackBefore", "showTable", "showUploadList", "onChange", "beforeUpload", "multiple", "ztAccept", "ztShowTipText", "maxCount", "maxSize", "maxSizeStr", "action", "headers", "method", "uploadUser", "originFileList", "callback", "onDeleteCallback", "isAutoDelete", "apiBaseUrl", "fileBaseUrl", "fileBtnText", "data", "authToken", "listType", "isPublic", "startColumns", "otherColumns", "isDirect"]);
83
+ var children = props.children, className = props.className, _a = props.showTip, showTip = _a === void 0 ? true : _a, _b = props.showUploadBtn, showUploadBtn = _b === void 0 ? true : _b, _c = props.showDeleteBtn, showDeleteBtn = _c === void 0 ? true : _c, onDownLoadCallbackBefore = props.onDownLoadCallbackBefore, _d = props.showDownloadBtn, showDownloadBtn = _d === void 0 ? true : _d, onDownLoadCallbackAfter = props.onDownLoadCallbackAfter, _e = props.showPreviewBtn, showPreviewBtn = _e === void 0 ? true : _e, onPreviewCallbackBefore = props.onPreviewCallbackBefore, _f = props.showTable, showTable = _f === void 0 ? true : _f, showUploadList = props.showUploadList, onChange = props.onChange, beforeUpload = props.beforeUpload, multiple = props.multiple, ztAccept = props.ztAccept, ztShowTipText = props.ztShowTipText, maxCount = props.maxCount, maxSize = props.maxSize, maxSizeStr = props.maxSizeStr, action = props.action, headers = props.headers, method = props.method, uploadUser = props.uploadUser, originFileList = props.originFileList, callback = props.callback, onDeleteCallback = props.onDeleteCallback, isAutoDelete = props.isAutoDelete, apiBaseUrl = props.apiBaseUrl, _g = props.fileBaseUrl, fileBaseUrl = _g === void 0 ? '' : _g, fileBtnText = props.fileBtnText, data = props.data, authToken = props.authToken, listType = props.listType, isPublic = props.isPublic, startColumns = props.startColumns, otherColumns = props.otherColumns, _h = props.isDirect, isDirect = _h === void 0 ? false : _h, upload = props.upload, restProps = __rest(props, ["children", "className", "showTip", "showUploadBtn", "showDeleteBtn", "onDownLoadCallbackBefore", "showDownloadBtn", "onDownLoadCallbackAfter", "showPreviewBtn", "onPreviewCallbackBefore", "showTable", "showUploadList", "onChange", "beforeUpload", "multiple", "ztAccept", "ztShowTipText", "maxCount", "maxSize", "maxSizeStr", "action", "headers", "method", "uploadUser", "originFileList", "callback", "onDeleteCallback", "isAutoDelete", "apiBaseUrl", "fileBaseUrl", "fileBtnText", "data", "authToken", "listType", "isPublic", "startColumns", "otherColumns", "isDirect", "upload"]);
48
84
  var _j = useState(originFileList || []), fileList = _j[0], setFileList = _j[1];
49
85
  var _k = useState('20M'), maxSizeTransStr = _k[0], setMaxSizeTransStr = _k[1];
86
+ useEffect(function () {
87
+ if (upload) {
88
+ upload.current = upload.current ? upload.current : {};
89
+ upload.current.validate = function (info) {
90
+ if (info === void 0) { info = { title: '', isError: false }; }
91
+ return __awaiter(this, void 0, void 0, function () {
92
+ var i, fileItem;
93
+ return __generator(this, function (_a) {
94
+ switch (_a.label) {
95
+ case 0:
96
+ if (!Array.isArray(fileList)) return [3 /*break*/, 6];
97
+ i = 0;
98
+ _a.label = 1;
99
+ case 1:
100
+ if (!(i < fileList.length)) return [3 /*break*/, 6];
101
+ fileItem = fileList[i];
102
+ if (!(fileItem.status !== 'done' && fileItem.status !== 'error')) return [3 /*break*/, 3];
103
+ return [4 /*yield*/, Promise.reject({
104
+ errorFields: [
105
+ {
106
+ errors: (info.title || '') + " \u7B2C" + (i + 1) + "\u4E2A\u9644\u4EF6\u8FD8\u5728\u4E0A\u4F20\u4E2D\uFF0C\u8BF7\u7A0D\u7B49...",
107
+ },
108
+ ],
109
+ })];
110
+ case 2:
111
+ _a.sent();
112
+ _a.label = 3;
113
+ case 3:
114
+ if (!(info.isError && fileItem.status === 'error')) return [3 /*break*/, 5];
115
+ return [4 /*yield*/, Promise.reject({
116
+ errorFields: [
117
+ {
118
+ errors: (info.title || '') + " \u7B2C" + (i + 1) + "\u4E2A\u9644\u4EF6\u4E0A\u4F20\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5",
119
+ },
120
+ ],
121
+ })];
122
+ case 4:
123
+ _a.sent();
124
+ _a.label = 5;
125
+ case 5:
126
+ i++;
127
+ return [3 /*break*/, 1];
128
+ case 6: return [2 /*return*/];
129
+ }
130
+ });
131
+ });
132
+ };
133
+ }
134
+ }, [fileList, upload]);
50
135
  useEffect(function () {
51
136
  var MAXSIZE = maxSize ? maxSize : 1024 * 1024 * 100;
52
137
  var MAXSIZESTR = maxSizeStr ? maxSizeStr : transformFileSize(MAXSIZE);
@@ -58,14 +143,14 @@ var Upload = function (props) {
58
143
  if (listType === 'text') {
59
144
  setFileList(originFileList.map(function (item) {
60
145
  var _a, _b, _c, _d;
61
- var attachId = item.attachId, name = item.name, attachName = item.attachName, fileSize = item.fileSize, size = item.size, response = item.response;
146
+ var attachId = item.attachId, name = item.name, attachName = item.attachName, fileSize = item.fileSize, size = item.size, response = item.response, percent = item.percent, status = item.status;
62
147
  return __assign(__assign({}, item), { uid: attachId ? attachId : (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.attachId, size: fileSize ? fileSize : size, name: name
63
148
  ? name
64
149
  : attachName
65
150
  ? attachName
66
151
  : ((_b = response === null || response === void 0 ? void 0 : response.data) === null || _b === void 0 ? void 0 : _b.attachName)
67
152
  ? (_c = response === null || response === void 0 ? void 0 : response.data) === null || _c === void 0 ? void 0 : _c.attachName
68
- : (_d = response === null || response === void 0 ? void 0 : response.data) === null || _d === void 0 ? void 0 : _d.originalName, percent: 100, status: 'done', response: response
153
+ : (_d = response === null || response === void 0 ? void 0 : response.data) === null || _d === void 0 ? void 0 : _d.originalName, percent: typeof percent === 'number' ? percent : 100, status: status ? status : 'done', response: response
69
154
  ? response
70
155
  : {
71
156
  code: 200,
@@ -78,7 +163,7 @@ var Upload = function (props) {
78
163
  else {
79
164
  setFileList(originFileList.map(function (item) {
80
165
  var _a, _b, _c, _d, _e;
81
- var attachId = item.attachId, name = item.name, attachName = item.attachName, fileSize = item.fileSize, size = item.size, response = item.response;
166
+ var attachId = item.attachId, name = item.name, attachName = item.attachName, fileSize = item.fileSize, size = item.size, response = item.response, percent = item.percent, status = item.status;
82
167
  var fileId = response ? (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.attachId : null;
83
168
  return __assign(__assign({}, item), { uid: attachId ? attachId : (_b = response === null || response === void 0 ? void 0 : response.data) === null || _b === void 0 ? void 0 : _b.attachId, size: fileSize ? fileSize : size, name: name
84
169
  ? name
@@ -86,7 +171,7 @@ var Upload = function (props) {
86
171
  ? attachName
87
172
  : ((_c = response === null || response === void 0 ? void 0 : response.data) === null || _c === void 0 ? void 0 : _c.attachName)
88
173
  ? (_d = response === null || response === void 0 ? void 0 : response.data) === null || _d === void 0 ? void 0 : _d.attachName
89
- : (_e = response === null || response === void 0 ? void 0 : response.data) === null || _e === void 0 ? void 0 : _e.originalName, percent: 100, status: 'done', response: response
174
+ : (_e = response === null || response === void 0 ? void 0 : response.data) === null || _e === void 0 ? void 0 : _e.originalName, percent: typeof percent === 'number' ? percent : 100, status: status ? status : 'done', response: response
90
175
  ? response
91
176
  : {
92
177
  code: 200,
@@ -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.3",
3
+ "version": "2.3.7",
4
4
  "private": false,
5
5
  "description": "React components library",
6
6
  "author": "zt-front-end",