ls-pro-common 3.0.4 → 3.0.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.
@@ -39,6 +39,7 @@ export declare type InputTableProps = ProFormItemProps<InputProps> & {
39
39
  loadOnShow?: boolean;
40
40
  placement?: TooltipPlacement;
41
41
  arrowPointAtCenter?: boolean;
42
+ rowKey?: any;
42
43
  /**@name 选择行事件 */
43
44
  onSelectChange?: (item: any, formRef?: any) => void;
44
45
  /**@name 加载之前事件,param为查询条件对象,可以通过此方法调整 */
@@ -93,6 +94,7 @@ declare const InputTable: React.ForwardRefExoticComponent<{
93
94
  loadOnShow?: boolean | undefined;
94
95
  placement?: TooltipPlacement | undefined;
95
96
  arrowPointAtCenter?: boolean | undefined;
97
+ rowKey?: any;
96
98
  /**@name 选择行事件 */
97
99
  onSelectChange?: ((item: any, formRef?: any) => void) | undefined;
98
100
  /**@name 加载之前事件,param为查询条件对象,可以通过此方法调整 */
@@ -6,10 +6,11 @@ import _extends from "@babel/runtime/helpers/esm/extends";
6
6
  import "antd/es/button/style";
7
7
  import _Button from "antd/es/button";
8
8
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
9
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
9
10
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
10
11
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
11
12
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
12
- var _excluded = ["columns", "url", "textName", "name", "tableConfig", "tableHeight", "tableWidth", "readonly", "multiple", "valueField", "labelWidth", "textField", "onSelectChange", "beforeLoad", "afterLoad", "isV2", "allowClear", "keepSelect", "fieldProps", "searchField", "fillMap", "loadOnShow", "triggerCheck", "getPopupContainer", "placement", "arrowPointAtCenter"],
13
+ var _excluded = ["columns", "url", "textName", "name", "tableConfig", "tableHeight", "tableWidth", "readonly", "multiple", "valueField", "labelWidth", "textField", "onSelectChange", "beforeLoad", "afterLoad", "isV2", "allowClear", "keepSelect", "fieldProps", "searchField", "fillMap", "loadOnShow", "triggerCheck", "getPopupContainer", "placement", "arrowPointAtCenter", "rowKey"],
13
14
  _excluded2 = ["current", "pageSize"];
14
15
  import _regeneratorRuntime from "@babel/runtime/regenerator";
15
16
  import React, { useRef, useState, useEffect, useContext, useMemo, useImperativeHandle } from 'react';
@@ -79,6 +80,7 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
79
80
  placement = _prop$placement === void 0 ? 'bottom' : _prop$placement,
80
81
  _prop$arrowPointAtCen = prop.arrowPointAtCenter,
81
82
  arrowPointAtCenter = _prop$arrowPointAtCen === void 0 ? true : _prop$arrowPointAtCen,
83
+ rowKey = prop.rowKey,
82
84
  rest = _objectWithoutProperties(prop, _excluded);
83
85
  //显示输入框绑定的name,如果不设置textName,设置为$name__text
84
86
  var textNameProp = useMemo(function () {
@@ -156,20 +158,35 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
156
158
  // 初始化数据
157
159
  useEffect(function () {
158
160
  setTimeout(function () {
159
- var _formRef$current, _formRef$current2;
160
- var txt = formRef === null || formRef === void 0 ? void 0 : (_formRef$current = formRef.current) === null || _formRef$current === void 0 ? void 0 : _formRef$current.getFieldValue(textNameProp);
161
- var val = formRef === null || formRef === void 0 ? void 0 : (_formRef$current2 = formRef.current) === null || _formRef$current2 === void 0 ? void 0 : _formRef$current2.getFieldValue(name);
161
+ var txt = '',
162
+ val = '';
163
+ if (rowKey) {
164
+ try {
165
+ var _formRef$current, _formRef$current$getF;
166
+ var row = formRef === null || formRef === void 0 ? void 0 : (_formRef$current = formRef.current) === null || _formRef$current === void 0 ? void 0 : (_formRef$current$getF = _formRef$current.getFieldsValue()) === null || _formRef$current$getF === void 0 ? void 0 : _formRef$current$getF[rowKey];
167
+ txt = row === null || row === void 0 ? void 0 : row[textNameProp];
168
+ val = row === null || row === void 0 ? void 0 : row[name];
169
+ } catch (_unused) {}
170
+ } else {
171
+ var _formRef$current2, _formRef$current3;
172
+ txt = formRef === null || formRef === void 0 ? void 0 : (_formRef$current2 = formRef.current) === null || _formRef$current2 === void 0 ? void 0 : _formRef$current2.getFieldValue(textNameProp);
173
+ val = formRef === null || formRef === void 0 ? void 0 : (_formRef$current3 = formRef.current) === null || _formRef$current3 === void 0 ? void 0 : _formRef$current3.getFieldValue(name);
174
+ }
162
175
  if (txt) {
163
176
  setText(txt);
164
177
  } else if (val) {
165
178
  setText(val);
166
179
  }
167
180
  }, 0);
168
- }, []);
181
+ }, [rowKey]);
169
182
  // 处理返回数据
170
183
  var handleValue = function handleValue(row) {
171
- var _formRef$current3, _formRef$current4;
172
- var formValue = formRef === null || formRef === void 0 ? void 0 : (_formRef$current3 = formRef.current) === null || _formRef$current3 === void 0 ? void 0 : _formRef$current3.getFieldsValue();
184
+ var _formRef$current4;
185
+ var formValue = formRef === null || formRef === void 0 ? void 0 : (_formRef$current4 = formRef.current) === null || _formRef$current4 === void 0 ? void 0 : _formRef$current4.getFieldsValue();
186
+ if (rowKey) {
187
+ formValue = formValue[rowKey] || {};
188
+ }
189
+ if (!formValue) return;
173
190
  var txt;
174
191
  //支持多选
175
192
  if (Array.isArray(row)) {
@@ -204,7 +221,12 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
204
221
  formValue[textNameProp] = txt;
205
222
  setText(txt);
206
223
  setVisible(false);
207
- (_formRef$current4 = formRef.current) === null || _formRef$current4 === void 0 ? void 0 : _formRef$current4.setFieldsValue(_objectSpread({}, formValue));
224
+ if (rowKey) {
225
+ formRef.current.setFieldsValue(_defineProperty({}, rowKey, formValue));
226
+ } else {
227
+ var _formRef$current5;
228
+ (_formRef$current5 = formRef.current) === null || _formRef$current5 === void 0 ? void 0 : _formRef$current5.setFieldsValue(_objectSpread({}, formValue));
229
+ }
208
230
  onSelectChange === null || onSelectChange === void 0 ? void 0 : onSelectChange(row, formRef);
209
231
  };
210
232
  // 可输入时,回车或失去焦点调接口查询数据
@@ -234,29 +256,39 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
234
256
  };
235
257
  //直接输入不回车,value 和 text 为同一个值
236
258
  var onInput = function onInput(e) {
237
- var _formRef$current5;
238
- var formValue = formRef === null || formRef === void 0 ? void 0 : (_formRef$current5 = formRef.current) === null || _formRef$current5 === void 0 ? void 0 : _formRef$current5.getFieldsValue();
259
+ var _formRef$current6;
260
+ var formValue = formRef === null || formRef === void 0 ? void 0 : (_formRef$current6 = formRef.current) === null || _formRef$current6 === void 0 ? void 0 : _formRef$current6.getFieldsValue();
261
+ if (rowKey) {
262
+ formValue = formValue[rowKey] || {};
263
+ }
239
264
  var val = e.target.value;
240
265
  formValue[name] = val;
241
266
  formValue[textNameProp] = val;
242
267
  setText(val);
243
- formRef.current.setFieldsValue(_objectSpread({}, formValue));
268
+ if (rowKey) {
269
+ formRef.current.setFieldsValue(_defineProperty({}, rowKey, formValue));
270
+ } else {
271
+ var _formRef$current7;
272
+ (_formRef$current7 = formRef.current) === null || _formRef$current7 === void 0 ? void 0 : _formRef$current7.setFieldsValue(_objectSpread({}, formValue));
273
+ }
244
274
  };
245
275
  // 当表单重置或点clear时,处理值
246
276
  var clearValue = function clearValue(e) {
247
277
  if (!e.target.value) {
248
- var _formRef$current6;
278
+ var _formRef$current8;
249
279
  setText('');
250
- var formValue = formRef === null || formRef === void 0 ? void 0 : (_formRef$current6 = formRef.current) === null || _formRef$current6 === void 0 ? void 0 : _formRef$current6.getFieldsValue();
280
+ var formValue = formRef === null || formRef === void 0 ? void 0 : (_formRef$current8 = formRef.current) === null || _formRef$current8 === void 0 ? void 0 : _formRef$current8.getFieldsValue();
281
+ if (rowKey) {
282
+ formValue = formValue[rowKey] || {};
283
+ }
251
284
  formValue[name] = '';
252
285
  formValue[textNameProp] = '';
253
- // 不处理,其它表单自己清空
254
- // if (fillMap) {
255
- // for (let key in fillMap) {
256
- // formValue[key] = '';
257
- // }
258
- // }
259
- formRef.current.setFieldsValue(_objectSpread({}, formValue));
286
+ if (rowKey) {
287
+ formRef.current.setFieldsValue(_defineProperty({}, rowKey, formValue));
288
+ } else {
289
+ var _formRef$current9;
290
+ (_formRef$current9 = formRef.current) === null || _formRef$current9 === void 0 ? void 0 : _formRef$current9.setFieldsValue(_objectSpread({}, formValue));
291
+ }
260
292
  }
261
293
  };
262
294
  useEffect(function () {
@@ -267,12 +299,18 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
267
299
  }
268
300
  }, [text]);
269
301
  var tableDom = /*#__PURE__*/React.createElement(ProTable, _extends({
302
+ className: "ls-input-table",
270
303
  columns: columns,
271
304
  request: loadData,
272
305
  manualRequest: false,
273
306
  actionRef: tableRef,
274
307
  search: {
275
- labelWidth: labelWidth
308
+ labelWidth: labelWidth,
309
+ optionRender: function optionRender(p, s, _dom) {
310
+ return _dom.filter(function (item) {
311
+ return item.key === 'submit';
312
+ });
313
+ }
276
314
  },
277
315
  options: {
278
316
  density: false,
@@ -308,7 +346,13 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
308
346
  }, "\u786E\u8BA4")];
309
347
  },
310
348
  headerTitle: "\u53CC\u51FB\u9009\u4E2D\u5F53\u524D\u884C\u6570\u636E"
311
- }, tableConfig));
349
+ }, tableConfig, {
350
+ cardProps: {
351
+ bodyStyle: {
352
+ padding: 0
353
+ }
354
+ }
355
+ }));
312
356
  // 处理有值时,可清空
313
357
  useEffect(function () {
314
358
  if (rest.disabled || (fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.disabled)) return;
@@ -341,6 +385,12 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
341
385
  }
342
386
  }, loadOnShow ? visible ? tableDom : null : tableDom),
343
387
  trigger: "click",
388
+ overlayInnerStyle: {
389
+ width: 'max-content'
390
+ },
391
+ overlayStyle: {
392
+ width: 'max-content'
393
+ },
344
394
  visible: rest.disabled || (fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.disabled) ? false : visible,
345
395
  onVisibleChange: setVisible,
346
396
  getPopupContainer: getPopupContainer,
@@ -382,6 +432,12 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
382
432
  }
383
433
  }, loadOnShow ? visible ? tableDom : null : tableDom),
384
434
  trigger: "click",
435
+ overlayInnerStyle: {
436
+ width: 'max-content'
437
+ },
438
+ overlayStyle: {
439
+ width: 'max-content'
440
+ },
385
441
  visible: rest.disabled || (fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.disabled) ? false : visible,
386
442
  onVisibleChange: setVisible,
387
443
  getPopupContainer: getPopupContainer,
@@ -1,90 +1,49 @@
1
1
  body {
2
2
 
3
- --bg-color:#F9FAFB;
4
-
5
-
6
- --ant-primary-color : #0E55CB;
7
- --ant-primary-color-hover : #3277d9;
8
- --ant-primary-color-active : #033ca6;
9
- --ant-primary-color-outline : rgba(14, 85, 203, 0.2);
10
- --ant-primary-1 : #e6f4ff;
11
- --ant-primary-2 : #b5dbff;
12
- --ant-primary-3 : #85baf2;
13
- --ant-primary-4 : #5a99e6;
14
- --ant-primary-5 : #3277d9;
15
- --ant-primary-6 : #0E55CB;
16
- --ant-primary-7 : #033ca6;
17
- --ant-primary-color-deprecated-pure : #94b9f8;
18
- --ant-primary-color-deprecated-l-35 : #94b9f8;
19
- --ant-primary-color-deprecated-l-20 : #4c8bf3;
20
- --ant-primary-color-deprecated-t-20 : #3e77d5;
21
- --ant-primary-color-deprecated-t-50 : #87aae5;
22
- --ant-primary-color-deprecated-f-12 : rgba(14, 85, 203, 0.12);
3
+ --bg-color: #F9FAFB;
4
+
5
+
6
+ --ant-primary-color: #1869ED;
7
+ --ant-primary-color-hover: #418efa;
8
+ --ant-primary-color-active: #0a4cc7;
9
+ --ant-primary-color-outline: rgba(24, 105, 237, 0.2);
10
+ --ant-primary-1: #e6f4ff;
11
+ --ant-primary-2: #bddfff;
12
+ --ant-primary-3: #94c8ff;
13
+ --ant-primary-4: #6baeff;
14
+ --ant-primary-5: #418efa;
15
+ --ant-primary-6: #1869ED;
16
+ --ant-primary-7: #0a4cc7;
17
+ --ant-primary-color-deprecated-pure: #bed5fa;
18
+ --ant-primary-color-deprecated-l-35: #bed5fa;
19
+ --ant-primary-color-deprecated-l-20: #77a6f4;
20
+ --ant-primary-color-deprecated-t-20: #4687f1;
21
+ --ant-primary-color-deprecated-t-50: #8cb4f6;
22
+ --ant-primary-color-deprecated-f-12: rgba(24, 105, 237, 0.12);
23
23
  --ant-primary-color-active-deprecated-f-30: rgba(230, 244, 255, 0.3);
24
24
  --ant-primary-color-active-deprecated-d-02: #dcf0ff;
25
- --ant-success-color : #52c41a;
26
- --ant-success-color-hover : #73d13d;
27
- --ant-success-color-active : #389e0d;
28
- --ant-success-color-outline : rgba(82, 196, 26, 0.2);
29
- --ant-success-color-deprecated-bg : #f6ffed;
30
- --ant-success-color-deprecated-border : #b7eb8f;
31
- --ant-error-color : #ff4d4f;
32
- --ant-error-color-hover : #ff7875;
33
- --ant-error-color-active : #d9363e;
34
- --ant-error-color-outline : rgba(255, 77, 79, 0.2);
35
- --ant-error-color-deprecated-bg : #fff2f0;
36
- --ant-error-color-deprecated-border : #ffccc7;
37
- --ant-warning-color : #faad14;
38
- --ant-warning-color-hover : #ffc53d;
39
- --ant-warning-color-active : #d48806;
40
- --ant-warning-color-outline : rgba(250, 173, 20, 0.2);
41
- --ant-warning-color-deprecated-bg : #fffbe6;
42
- --ant-warning-color-deprecated-border : #ffe58f;
43
- --ant-info-color : #0E55CB;
44
- --ant-info-color-deprecated-bg : #e6f4ff;
45
- --ant-info-color-deprecated-border : #85baf2;
46
-
47
-
48
- // --ant-primary-color : #4997E6;
49
- // --ant-primary-color-hover : #74b7f2;
50
- // --ant-primary-color-active : #3475bf;
51
- // --ant-primary-color-outline : rgba(73, 151, 230, 0.2);
52
- // --ant-primary-1 : #f0faff;
53
- // --ant-primary-2 : #f0f9ff;
54
- // --ant-primary-3 : #ccebff;
55
- // --ant-primary-4 : #a3d7ff;
56
- // --ant-primary-5 : #74b7f2;
57
- // --ant-primary-6 : #4997E6;
58
- // --ant-primary-7 : #3475bf;
59
- // --ant-primary-color-deprecated-pure : #e6f1fc;
60
- // --ant-primary-color-deprecated-l-35 : #e6f1fc;
61
- // --ant-primary-color-deprecated-l-20 : #a3caf2;
62
- // --ant-primary-color-deprecated-t-20 : #6daceb;
63
- // --ant-primary-color-deprecated-t-50 : #a4cbf3;
64
- // --ant-primary-color-deprecated-f-12 : rgba(73, 151, 230, 0.12);
65
- // --ant-primary-color-active-deprecated-f-30: rgba(240, 250, 255, 0.3);
66
- // --ant-primary-color-active-deprecated-d-02: #e6f7ff;
67
- // --ant-success-color : #52c41a;
68
- // --ant-success-color-hover : #73d13d;
69
- // --ant-success-color-active : #389e0d;
70
- // --ant-success-color-outline : rgba(82, 196, 26, 0.2);
71
- // --ant-success-color-deprecated-bg : #f6ffed;
72
- // --ant-success-color-deprecated-border : #b7eb8f;
73
- // --ant-error-color : #ff4d4f;
74
- // --ant-error-color-hover : #ff7875;
75
- // --ant-error-color-active : #d9363e;
76
- // --ant-error-color-outline : rgba(255, 77, 79, 0.2);
77
- // --ant-error-color-deprecated-bg : #fff2f0;
78
- // --ant-error-color-deprecated-border : #ffccc7;
79
- // --ant-warning-color : #faad14;
80
- // --ant-warning-color-hover : #ffc53d;
81
- // --ant-warning-color-active : #d48806;
82
- // --ant-warning-color-outline : rgba(250, 173, 20, 0.2);
83
- // --ant-warning-color-deprecated-bg : #fffbe6;
84
- // --ant-warning-color-deprecated-border : #ffe58f;
85
- // --ant-info-color : #4997E6;
86
- // --ant-info-color-deprecated-bg : #f0faff;
87
- // --ant-info-color-deprecated-border : #ccebff;
25
+ --ant-success-color: #52c41a;
26
+ --ant-success-color-hover: #73d13d;
27
+ --ant-success-color-active: #389e0d;
28
+ --ant-success-color-outline: rgba(82, 196, 26, 0.2);
29
+ --ant-success-color-deprecated-bg: #f6ffed;
30
+ --ant-success-color-deprecated-border: #b7eb8f;
31
+ --ant-error-color: #ff4d4f;
32
+ --ant-error-color-hover: #ff7875;
33
+ --ant-error-color-active: #d9363e;
34
+ --ant-error-color-outline: rgba(255, 77, 79, 0.2);
35
+ --ant-error-color-deprecated-bg: #fff2f0;
36
+ --ant-error-color-deprecated-border: #ffccc7;
37
+ --ant-warning-color: #faad14;
38
+ --ant-warning-color-hover: #ffc53d;
39
+ --ant-warning-color-active: #d48806;
40
+ --ant-warning-color-outline: rgba(250, 173, 20, 0.2);
41
+ --ant-warning-color-deprecated-bg: #fffbe6;
42
+ --ant-warning-color-deprecated-border: #ffe58f;
43
+ --ant-info-color: #1869ED;
44
+ --ant-info-color-deprecated-bg: #e6f4ff;
45
+ --ant-info-color-deprecated-border: #94c8ff;
46
+
88
47
  }
89
48
 
90
49
  * ::-webkit-scrollbar-thumb {
@@ -176,7 +135,7 @@ body.theme-yellow {
176
135
  left : 0;
177
136
  right : 0;
178
137
  bottom : 0;
179
- background : var(--bg-color,#f9fafb);
138
+ background : var(--bg-color, #f9fafb);
180
139
  display : flex;
181
140
  flex-direction: column;
182
141
  z-index : 50;
@@ -400,6 +359,7 @@ a:hover {
400
359
  align-items : center;
401
360
  background : #fff;
402
361
  padding-bottom: 12px;
362
+
403
363
  .ls-group-divider {
404
364
  height : 14px;
405
365
  border-right: 2px solid var(--ant-primary-color);
@@ -503,6 +463,12 @@ a:hover {
503
463
  }
504
464
  }
505
465
 
466
+ .ls-input-table {
467
+ .ant-pro-table-list-toolbar {
468
+ padding-top: 0px;
469
+ }
470
+ }
471
+
506
472
 
507
473
  @import url('./antd-custom.less');
508
474
 
@@ -585,7 +585,6 @@ function useSingle(inParam) {
585
585
  var tableTools = useMemo(function () {
586
586
  return [(toolConfig === null || toolConfig === void 0 ? void 0 : toolConfig.add) && canAdd ? /*#__PURE__*/React.createElement(_Button, {
587
587
  key: "add",
588
- type: "primary",
589
588
  onClick: function onClick() {
590
589
  return onAdd(null);
591
590
  },
@@ -39,6 +39,7 @@ export declare type InputTableProps = ProFormItemProps<InputProps> & {
39
39
  loadOnShow?: boolean;
40
40
  placement?: TooltipPlacement;
41
41
  arrowPointAtCenter?: boolean;
42
+ rowKey?: any;
42
43
  /**@name 选择行事件 */
43
44
  onSelectChange?: (item: any, formRef?: any) => void;
44
45
  /**@name 加载之前事件,param为查询条件对象,可以通过此方法调整 */
@@ -93,6 +94,7 @@ declare const InputTable: React.ForwardRefExoticComponent<{
93
94
  loadOnShow?: boolean | undefined;
94
95
  placement?: TooltipPlacement | undefined;
95
96
  arrowPointAtCenter?: boolean | undefined;
97
+ rowKey?: any;
96
98
  /**@name 选择行事件 */
97
99
  onSelectChange?: ((item: any, formRef?: any) => void) | undefined;
98
100
  /**@name 加载之前事件,param为查询条件对象,可以通过此方法调整 */
@@ -15,6 +15,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
15
15
  require("antd/es/button/style");
16
16
  var _button = _interopRequireDefault(require("antd/es/button"));
17
17
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
18
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
18
19
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
19
20
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
20
21
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
@@ -24,7 +25,7 @@ var _lsProForm = require("ls-pro-form");
24
25
  var _icons = require("@ant-design/icons");
25
26
  var _http = require("../http");
26
27
  var _utils = require("../utils");
27
- var _excluded = ["columns", "url", "textName", "name", "tableConfig", "tableHeight", "tableWidth", "readonly", "multiple", "valueField", "labelWidth", "textField", "onSelectChange", "beforeLoad", "afterLoad", "isV2", "allowClear", "keepSelect", "fieldProps", "searchField", "fillMap", "loadOnShow", "triggerCheck", "getPopupContainer", "placement", "arrowPointAtCenter"],
28
+ var _excluded = ["columns", "url", "textName", "name", "tableConfig", "tableHeight", "tableWidth", "readonly", "multiple", "valueField", "labelWidth", "textField", "onSelectChange", "beforeLoad", "afterLoad", "isV2", "allowClear", "keepSelect", "fieldProps", "searchField", "fillMap", "loadOnShow", "triggerCheck", "getPopupContainer", "placement", "arrowPointAtCenter", "rowKey"],
28
29
  _excluded2 = ["current", "pageSize"];
29
30
  var InputTable = /*#__PURE__*/_react.default.forwardRef(function (prop, ref) {
30
31
  //@ts-ignore
@@ -87,6 +88,7 @@ var InputTable = /*#__PURE__*/_react.default.forwardRef(function (prop, ref) {
87
88
  placement = _prop$placement === void 0 ? 'bottom' : _prop$placement,
88
89
  _prop$arrowPointAtCen = prop.arrowPointAtCenter,
89
90
  arrowPointAtCenter = _prop$arrowPointAtCen === void 0 ? true : _prop$arrowPointAtCen,
91
+ rowKey = prop.rowKey,
90
92
  rest = (0, _objectWithoutProperties2.default)(prop, _excluded);
91
93
  //显示输入框绑定的name,如果不设置textName,设置为$name__text
92
94
  var textNameProp = (0, _react.useMemo)(function () {
@@ -164,20 +166,35 @@ var InputTable = /*#__PURE__*/_react.default.forwardRef(function (prop, ref) {
164
166
  // 初始化数据
165
167
  (0, _react.useEffect)(function () {
166
168
  setTimeout(function () {
167
- var _formRef$current, _formRef$current2;
168
- var txt = formRef === null || formRef === void 0 ? void 0 : (_formRef$current = formRef.current) === null || _formRef$current === void 0 ? void 0 : _formRef$current.getFieldValue(textNameProp);
169
- var val = formRef === null || formRef === void 0 ? void 0 : (_formRef$current2 = formRef.current) === null || _formRef$current2 === void 0 ? void 0 : _formRef$current2.getFieldValue(name);
169
+ var txt = '',
170
+ val = '';
171
+ if (rowKey) {
172
+ try {
173
+ var _formRef$current, _formRef$current$getF;
174
+ var row = formRef === null || formRef === void 0 ? void 0 : (_formRef$current = formRef.current) === null || _formRef$current === void 0 ? void 0 : (_formRef$current$getF = _formRef$current.getFieldsValue()) === null || _formRef$current$getF === void 0 ? void 0 : _formRef$current$getF[rowKey];
175
+ txt = row === null || row === void 0 ? void 0 : row[textNameProp];
176
+ val = row === null || row === void 0 ? void 0 : row[name];
177
+ } catch (_unused) {}
178
+ } else {
179
+ var _formRef$current2, _formRef$current3;
180
+ txt = formRef === null || formRef === void 0 ? void 0 : (_formRef$current2 = formRef.current) === null || _formRef$current2 === void 0 ? void 0 : _formRef$current2.getFieldValue(textNameProp);
181
+ val = formRef === null || formRef === void 0 ? void 0 : (_formRef$current3 = formRef.current) === null || _formRef$current3 === void 0 ? void 0 : _formRef$current3.getFieldValue(name);
182
+ }
170
183
  if (txt) {
171
184
  setText(txt);
172
185
  } else if (val) {
173
186
  setText(val);
174
187
  }
175
188
  }, 0);
176
- }, []);
189
+ }, [rowKey]);
177
190
  // 处理返回数据
178
191
  var handleValue = function handleValue(row) {
179
- var _formRef$current3, _formRef$current4;
180
- var formValue = formRef === null || formRef === void 0 ? void 0 : (_formRef$current3 = formRef.current) === null || _formRef$current3 === void 0 ? void 0 : _formRef$current3.getFieldsValue();
192
+ var _formRef$current4;
193
+ var formValue = formRef === null || formRef === void 0 ? void 0 : (_formRef$current4 = formRef.current) === null || _formRef$current4 === void 0 ? void 0 : _formRef$current4.getFieldsValue();
194
+ if (rowKey) {
195
+ formValue = formValue[rowKey] || {};
196
+ }
197
+ if (!formValue) return;
181
198
  var txt;
182
199
  //支持多选
183
200
  if (Array.isArray(row)) {
@@ -212,7 +229,12 @@ var InputTable = /*#__PURE__*/_react.default.forwardRef(function (prop, ref) {
212
229
  formValue[textNameProp] = txt;
213
230
  setText(txt);
214
231
  setVisible(false);
215
- (_formRef$current4 = formRef.current) === null || _formRef$current4 === void 0 ? void 0 : _formRef$current4.setFieldsValue((0, _objectSpread2.default)({}, formValue));
232
+ if (rowKey) {
233
+ formRef.current.setFieldsValue((0, _defineProperty2.default)({}, rowKey, formValue));
234
+ } else {
235
+ var _formRef$current5;
236
+ (_formRef$current5 = formRef.current) === null || _formRef$current5 === void 0 ? void 0 : _formRef$current5.setFieldsValue((0, _objectSpread2.default)({}, formValue));
237
+ }
216
238
  onSelectChange === null || onSelectChange === void 0 ? void 0 : onSelectChange(row, formRef);
217
239
  };
218
240
  // 可输入时,回车或失去焦点调接口查询数据
@@ -242,29 +264,39 @@ var InputTable = /*#__PURE__*/_react.default.forwardRef(function (prop, ref) {
242
264
  };
243
265
  //直接输入不回车,value 和 text 为同一个值
244
266
  var onInput = function onInput(e) {
245
- var _formRef$current5;
246
- var formValue = formRef === null || formRef === void 0 ? void 0 : (_formRef$current5 = formRef.current) === null || _formRef$current5 === void 0 ? void 0 : _formRef$current5.getFieldsValue();
267
+ var _formRef$current6;
268
+ var formValue = formRef === null || formRef === void 0 ? void 0 : (_formRef$current6 = formRef.current) === null || _formRef$current6 === void 0 ? void 0 : _formRef$current6.getFieldsValue();
269
+ if (rowKey) {
270
+ formValue = formValue[rowKey] || {};
271
+ }
247
272
  var val = e.target.value;
248
273
  formValue[name] = val;
249
274
  formValue[textNameProp] = val;
250
275
  setText(val);
251
- formRef.current.setFieldsValue((0, _objectSpread2.default)({}, formValue));
276
+ if (rowKey) {
277
+ formRef.current.setFieldsValue((0, _defineProperty2.default)({}, rowKey, formValue));
278
+ } else {
279
+ var _formRef$current7;
280
+ (_formRef$current7 = formRef.current) === null || _formRef$current7 === void 0 ? void 0 : _formRef$current7.setFieldsValue((0, _objectSpread2.default)({}, formValue));
281
+ }
252
282
  };
253
283
  // 当表单重置或点clear时,处理值
254
284
  var clearValue = function clearValue(e) {
255
285
  if (!e.target.value) {
256
- var _formRef$current6;
286
+ var _formRef$current8;
257
287
  setText('');
258
- var formValue = formRef === null || formRef === void 0 ? void 0 : (_formRef$current6 = formRef.current) === null || _formRef$current6 === void 0 ? void 0 : _formRef$current6.getFieldsValue();
288
+ var formValue = formRef === null || formRef === void 0 ? void 0 : (_formRef$current8 = formRef.current) === null || _formRef$current8 === void 0 ? void 0 : _formRef$current8.getFieldsValue();
289
+ if (rowKey) {
290
+ formValue = formValue[rowKey] || {};
291
+ }
259
292
  formValue[name] = '';
260
293
  formValue[textNameProp] = '';
261
- // 不处理,其它表单自己清空
262
- // if (fillMap) {
263
- // for (let key in fillMap) {
264
- // formValue[key] = '';
265
- // }
266
- // }
267
- formRef.current.setFieldsValue((0, _objectSpread2.default)({}, formValue));
294
+ if (rowKey) {
295
+ formRef.current.setFieldsValue((0, _defineProperty2.default)({}, rowKey, formValue));
296
+ } else {
297
+ var _formRef$current9;
298
+ (_formRef$current9 = formRef.current) === null || _formRef$current9 === void 0 ? void 0 : _formRef$current9.setFieldsValue((0, _objectSpread2.default)({}, formValue));
299
+ }
268
300
  }
269
301
  };
270
302
  (0, _react.useEffect)(function () {
@@ -275,12 +307,18 @@ var InputTable = /*#__PURE__*/_react.default.forwardRef(function (prop, ref) {
275
307
  }
276
308
  }, [text]);
277
309
  var tableDom = /*#__PURE__*/_react.default.createElement(_lsProTable.default, (0, _extends2.default)({
310
+ className: "ls-input-table",
278
311
  columns: columns,
279
312
  request: loadData,
280
313
  manualRequest: false,
281
314
  actionRef: tableRef,
282
315
  search: {
283
- labelWidth: labelWidth
316
+ labelWidth: labelWidth,
317
+ optionRender: function optionRender(p, s, _dom) {
318
+ return _dom.filter(function (item) {
319
+ return item.key === 'submit';
320
+ });
321
+ }
284
322
  },
285
323
  options: {
286
324
  density: false,
@@ -316,7 +354,13 @@ var InputTable = /*#__PURE__*/_react.default.forwardRef(function (prop, ref) {
316
354
  }, "\u786E\u8BA4")];
317
355
  },
318
356
  headerTitle: "\u53CC\u51FB\u9009\u4E2D\u5F53\u524D\u884C\u6570\u636E"
319
- }, tableConfig));
357
+ }, tableConfig, {
358
+ cardProps: {
359
+ bodyStyle: {
360
+ padding: 0
361
+ }
362
+ }
363
+ }));
320
364
  // 处理有值时,可清空
321
365
  (0, _react.useEffect)(function () {
322
366
  if (rest.disabled || (fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.disabled)) return;
@@ -349,6 +393,12 @@ var InputTable = /*#__PURE__*/_react.default.forwardRef(function (prop, ref) {
349
393
  }
350
394
  }, loadOnShow ? visible ? tableDom : null : tableDom),
351
395
  trigger: "click",
396
+ overlayInnerStyle: {
397
+ width: 'max-content'
398
+ },
399
+ overlayStyle: {
400
+ width: 'max-content'
401
+ },
352
402
  visible: rest.disabled || (fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.disabled) ? false : visible,
353
403
  onVisibleChange: setVisible,
354
404
  getPopupContainer: getPopupContainer,
@@ -390,6 +440,12 @@ var InputTable = /*#__PURE__*/_react.default.forwardRef(function (prop, ref) {
390
440
  }
391
441
  }, loadOnShow ? visible ? tableDom : null : tableDom),
392
442
  trigger: "click",
443
+ overlayInnerStyle: {
444
+ width: 'max-content'
445
+ },
446
+ overlayStyle: {
447
+ width: 'max-content'
448
+ },
393
449
  visible: rest.disabled || (fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.disabled) ? false : visible,
394
450
  onVisibleChange: setVisible,
395
451
  getPopupContainer: getPopupContainer,