ls-pro-common 3.1.47 → 3.1.48
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.
|
@@ -14,7 +14,7 @@ export declare type InputTableProps = ProFormItemProps<InputProps> & {
|
|
|
14
14
|
/** @name 是否支持多选 */
|
|
15
15
|
multiple?: boolean;
|
|
16
16
|
/** @name 表单项name, 跟 form.item 的 name一致 */
|
|
17
|
-
name
|
|
17
|
+
name?: string;
|
|
18
18
|
/** @name 返回的值字段,表格中valueField配置的字段时返回给name */
|
|
19
19
|
valueField: string;
|
|
20
20
|
/** @name 返回输入框显示的字段,textField字段值返回给textName */
|
|
@@ -74,7 +74,7 @@ declare const InputTable: React.ForwardRefExoticComponent<{
|
|
|
74
74
|
/** @name 是否支持多选 */
|
|
75
75
|
multiple?: boolean | undefined;
|
|
76
76
|
/** @name 表单项name, 跟 form.item 的 name一致 */
|
|
77
|
-
name
|
|
77
|
+
name?: string | undefined;
|
|
78
78
|
/** @name 返回的值字段,表格中valueField配置的字段时返回给name */
|
|
79
79
|
valueField: string;
|
|
80
80
|
/** @name 返回输入框显示的字段,textField字段值返回给textName */
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import "antd/es/form/style";
|
|
2
|
+
import _Form from "antd/es/form";
|
|
1
3
|
import "antd/es/input/style";
|
|
2
4
|
import _Input from "antd/es/input";
|
|
3
5
|
import "antd/es/popover/style";
|
|
@@ -11,7 +13,7 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
|
11
13
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
12
14
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
13
15
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
14
|
-
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", "
|
|
16
|
+
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", "method", "changeOnSelect", "rowKey", "record", "id"],
|
|
15
17
|
_excluded2 = ["current", "pageSize"];
|
|
16
18
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
17
19
|
import React, { useRef, useState, useEffect, useContext, useMemo, useImperativeHandle } from 'react';
|
|
@@ -43,7 +45,7 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
43
45
|
var columns = prop.columns,
|
|
44
46
|
url = prop.url,
|
|
45
47
|
textName = prop.textName,
|
|
46
|
-
|
|
48
|
+
itemName = prop.name,
|
|
47
49
|
tableConfig = prop.tableConfig,
|
|
48
50
|
_prop$tableHeight = prop.tableHeight,
|
|
49
51
|
tableHeight = _prop$tableHeight === void 0 ? 400 : _prop$tableHeight,
|
|
@@ -80,12 +82,13 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
80
82
|
placement = _prop$placement === void 0 ? 'bottom' : _prop$placement,
|
|
81
83
|
_prop$arrowPointAtCen = prop.arrowPointAtCenter,
|
|
82
84
|
arrowPointAtCenter = _prop$arrowPointAtCen === void 0 ? true : _prop$arrowPointAtCen,
|
|
83
|
-
rowKey = prop.rowKey,
|
|
84
85
|
_prop$method = prop.method,
|
|
85
86
|
method = _prop$method === void 0 ? 'GET' : _prop$method,
|
|
86
87
|
_prop$changeOnSelect = prop.changeOnSelect,
|
|
87
88
|
changeOnSelect = _prop$changeOnSelect === void 0 ? true : _prop$changeOnSelect,
|
|
89
|
+
rowKey = prop.rowKey,
|
|
88
90
|
record = prop.record,
|
|
91
|
+
id = prop.id,
|
|
89
92
|
rest = _objectWithoutProperties(prop, _excluded);
|
|
90
93
|
if (!valueField && isDev) {
|
|
91
94
|
console.error('valueField 属性必须设置');
|
|
@@ -93,10 +96,21 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
93
96
|
if (!url && isDev) {
|
|
94
97
|
console.error('url 属性必须设置');
|
|
95
98
|
}
|
|
99
|
+
var tableKey = (tableConfig === null || tableConfig === void 0 ? void 0 : tableConfig.rowKey) || valueField || 'id';
|
|
100
|
+
// 处理表单name, 如果不传入通过id来处理。在表格中,自动会添加Id
|
|
101
|
+
var name = useMemo(function () {
|
|
102
|
+
if (itemName) return itemName;
|
|
103
|
+
if (id) {
|
|
104
|
+
if (id.includes('_')) {
|
|
105
|
+
return id.slice(id.indexOf('_') + 1);
|
|
106
|
+
}
|
|
107
|
+
return id;
|
|
108
|
+
}
|
|
109
|
+
return '';
|
|
110
|
+
}, [itemName, id]);
|
|
96
111
|
if (!name && isDev) {
|
|
97
112
|
console.error('name 属性必须设置');
|
|
98
113
|
}
|
|
99
|
-
var tableKey = (tableConfig === null || tableConfig === void 0 ? void 0 : tableConfig.rowKey) || valueField || 'id';
|
|
100
114
|
//显示输入框绑定的name,如果不设置textName,设置为$name__text
|
|
101
115
|
var textNameProp = useMemo(function () {
|
|
102
116
|
return textName ? textName : name + '__text';
|
|
@@ -120,6 +134,11 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
120
134
|
if (col) return col.searchField || col.dataIndex;
|
|
121
135
|
return textField || valueField;
|
|
122
136
|
}, [columns, searchField, valueField, textField]);
|
|
137
|
+
/**
|
|
138
|
+
* 获取表单值
|
|
139
|
+
*
|
|
140
|
+
* @returns
|
|
141
|
+
*/
|
|
123
142
|
var getFormValue = function getFormValue() {
|
|
124
143
|
var _formRef$current2, _formRef$current2$get;
|
|
125
144
|
if (rowKey) {
|
|
@@ -128,6 +147,11 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
128
147
|
}
|
|
129
148
|
return formRef === null || formRef === void 0 ? void 0 : (_formRef$current2 = formRef.current) === null || _formRef$current2 === void 0 ? void 0 : (_formRef$current2$get = _formRef$current2.getFieldsValue) === null || _formRef$current2$get === void 0 ? void 0 : _formRef$current2$get.call(_formRef$current2);
|
|
130
149
|
};
|
|
150
|
+
/**
|
|
151
|
+
* 设置表单值
|
|
152
|
+
*
|
|
153
|
+
* @param formValue
|
|
154
|
+
*/
|
|
131
155
|
var setFormValue = function setFormValue(formValue) {
|
|
132
156
|
var _prop$onChange;
|
|
133
157
|
(_prop$onChange = prop.onChange) === null || _prop$onChange === void 0 ? void 0 : _prop$onChange.call(prop, formValue[name]);
|
|
@@ -139,6 +163,12 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
139
163
|
formRef === null || formRef === void 0 ? void 0 : (_formRef$current4 = formRef.current) === null || _formRef$current4 === void 0 ? void 0 : (_formRef$current4$set = _formRef$current4.setFieldsValue) === null || _formRef$current4$set === void 0 ? void 0 : _formRef$current4$set.call(_formRef$current4, formValue);
|
|
140
164
|
}
|
|
141
165
|
};
|
|
166
|
+
/**
|
|
167
|
+
* 加载面板数据
|
|
168
|
+
*
|
|
169
|
+
* @param param
|
|
170
|
+
* @returns
|
|
171
|
+
*/
|
|
142
172
|
var loadData = /*#__PURE__*/function () {
|
|
143
173
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(param) {
|
|
144
174
|
var current, pageSize, restParams, _selectRowRef$current, _rows, data, _tableRef$current2, _tableRef$current2$cl, _param, result, rows, formValue, val, _selectRowRef$current2, arr, pageSelectedRows;
|
|
@@ -254,6 +284,13 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
254
284
|
return _ref.apply(this, arguments);
|
|
255
285
|
};
|
|
256
286
|
}();
|
|
287
|
+
/**
|
|
288
|
+
* 如果初始有值时,调用此方法初始化名称
|
|
289
|
+
*
|
|
290
|
+
* @param val
|
|
291
|
+
* @param updateTxt
|
|
292
|
+
* @returns
|
|
293
|
+
*/
|
|
257
294
|
var initName = function initName(val) {
|
|
258
295
|
var updateTxt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
259
296
|
if (!val) return;
|
|
@@ -288,6 +325,7 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
288
325
|
var formValue = getFormValue();
|
|
289
326
|
if (!formValue) return;
|
|
290
327
|
formValue[textNameProp] = txt;
|
|
328
|
+
console.log('formValue', formValue);
|
|
291
329
|
setFormValue(formValue);
|
|
292
330
|
});
|
|
293
331
|
};
|
|
@@ -433,6 +471,19 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
433
471
|
(_tableRef$current5 = tableRef.current) === null || _tableRef$current5 === void 0 ? void 0 : (_tableRef$current5$re = _tableRef$current5.reload) === null || _tableRef$current5$re === void 0 ? void 0 : _tableRef$current5$re.call(_tableRef$current5);
|
|
434
472
|
}
|
|
435
473
|
}, [visible, loadOnShow]);
|
|
474
|
+
// 处理有值时,可清空
|
|
475
|
+
useEffect(function () {
|
|
476
|
+
if (rest.disabled || (fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.disabled)) return;
|
|
477
|
+
try {
|
|
478
|
+
var el = inputRef.current.input.parentNode;
|
|
479
|
+
if (!el) return;
|
|
480
|
+
if (text) {
|
|
481
|
+
el.classList.add('ant-input-has-value');
|
|
482
|
+
} else {
|
|
483
|
+
el.classList.remove('ant-input-has-value');
|
|
484
|
+
}
|
|
485
|
+
} catch (e) {}
|
|
486
|
+
}, [text, rest, fieldProps]);
|
|
436
487
|
var tableDom = /*#__PURE__*/React.createElement(ProTable, _extends({
|
|
437
488
|
className: "ls-input-table",
|
|
438
489
|
columns: columns,
|
|
@@ -549,31 +600,26 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
549
600
|
readOnly: readonly,
|
|
550
601
|
allowClear: allowClear,
|
|
551
602
|
ref: inputRef
|
|
552
|
-
},
|
|
603
|
+
}, !rowKey ? {} : {
|
|
553
604
|
value: text
|
|
554
605
|
}, fieldProps));
|
|
555
|
-
|
|
556
|
-
useEffect(function () {
|
|
557
|
-
if (rest.disabled || (fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.disabled)) return;
|
|
558
|
-
try {
|
|
559
|
-
var el = inputRef.current.input.parentNode;
|
|
560
|
-
if (!el) return;
|
|
561
|
-
if (text) {
|
|
562
|
-
el.classList.add('ant-input-has-value');
|
|
563
|
-
} else {
|
|
564
|
-
el.classList.remove('ant-input-has-value');
|
|
565
|
-
}
|
|
566
|
-
} catch (e) {}
|
|
567
|
-
}, [text, rest, fieldProps]);
|
|
606
|
+
console.log('textNameProp', prop);
|
|
568
607
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
569
608
|
style: {
|
|
570
609
|
display: 'none'
|
|
571
610
|
}
|
|
572
611
|
}, /*#__PURE__*/React.createElement(ProFormText, {
|
|
573
|
-
name: name
|
|
574
|
-
})), /*#__PURE__*/React.createElement(ProFormText, _extends({
|
|
612
|
+
name: rowKey ? id : name
|
|
613
|
+
})), rest.label || rowKey ? /*#__PURE__*/React.createElement(ProFormText, _extends({
|
|
614
|
+
name: textNameProp
|
|
615
|
+
}, rest, rowKey ? {
|
|
616
|
+
noStyle: true
|
|
617
|
+
} : {}), InputDom) :
|
|
618
|
+
/*#__PURE__*/
|
|
619
|
+
// 在ProTable的查询面板中
|
|
620
|
+
React.createElement(_Form.Item, _extends({
|
|
575
621
|
name: textNameProp
|
|
576
|
-
}, rest,
|
|
622
|
+
}, rest, {
|
|
577
623
|
noStyle: true
|
|
578
624
|
}), InputDom));
|
|
579
625
|
});
|
|
@@ -14,7 +14,7 @@ export declare type InputTableProps = ProFormItemProps<InputProps> & {
|
|
|
14
14
|
/** @name 是否支持多选 */
|
|
15
15
|
multiple?: boolean;
|
|
16
16
|
/** @name 表单项name, 跟 form.item 的 name一致 */
|
|
17
|
-
name
|
|
17
|
+
name?: string;
|
|
18
18
|
/** @name 返回的值字段,表格中valueField配置的字段时返回给name */
|
|
19
19
|
valueField: string;
|
|
20
20
|
/** @name 返回输入框显示的字段,textField字段值返回给textName */
|
|
@@ -74,7 +74,7 @@ declare const InputTable: React.ForwardRefExoticComponent<{
|
|
|
74
74
|
/** @name 是否支持多选 */
|
|
75
75
|
multiple?: boolean | undefined;
|
|
76
76
|
/** @name 表单项name, 跟 form.item 的 name一致 */
|
|
77
|
-
name
|
|
77
|
+
name?: string | undefined;
|
|
78
78
|
/** @name 返回的值字段,表格中valueField配置的字段时返回给name */
|
|
79
79
|
valueField: string;
|
|
80
80
|
/** @name 返回输入框显示的字段,textField字段值返回给textName */
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import "antd/es/form/style";
|
|
2
|
+
import _Form from "antd/es/form";
|
|
1
3
|
import "antd/es/input/style";
|
|
2
4
|
import _Input from "antd/es/input";
|
|
3
5
|
import "antd/es/popover/style";
|
|
@@ -11,7 +13,7 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
|
11
13
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
12
14
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
13
15
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
14
|
-
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", "
|
|
16
|
+
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", "method", "changeOnSelect", "rowKey", "record", "id"],
|
|
15
17
|
_excluded2 = ["current", "pageSize"];
|
|
16
18
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
17
19
|
import React, { useRef, useState, useEffect, useContext, useMemo, useImperativeHandle } from 'react';
|
|
@@ -43,7 +45,7 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
43
45
|
var columns = prop.columns,
|
|
44
46
|
url = prop.url,
|
|
45
47
|
textName = prop.textName,
|
|
46
|
-
|
|
48
|
+
itemName = prop.name,
|
|
47
49
|
tableConfig = prop.tableConfig,
|
|
48
50
|
_prop$tableHeight = prop.tableHeight,
|
|
49
51
|
tableHeight = _prop$tableHeight === void 0 ? 400 : _prop$tableHeight,
|
|
@@ -80,12 +82,13 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
80
82
|
placement = _prop$placement === void 0 ? 'bottom' : _prop$placement,
|
|
81
83
|
_prop$arrowPointAtCen = prop.arrowPointAtCenter,
|
|
82
84
|
arrowPointAtCenter = _prop$arrowPointAtCen === void 0 ? true : _prop$arrowPointAtCen,
|
|
83
|
-
rowKey = prop.rowKey,
|
|
84
85
|
_prop$method = prop.method,
|
|
85
86
|
method = _prop$method === void 0 ? 'GET' : _prop$method,
|
|
86
87
|
_prop$changeOnSelect = prop.changeOnSelect,
|
|
87
88
|
changeOnSelect = _prop$changeOnSelect === void 0 ? true : _prop$changeOnSelect,
|
|
89
|
+
rowKey = prop.rowKey,
|
|
88
90
|
record = prop.record,
|
|
91
|
+
id = prop.id,
|
|
89
92
|
rest = _objectWithoutProperties(prop, _excluded);
|
|
90
93
|
if (!valueField && isDev) {
|
|
91
94
|
console.error('valueField 属性必须设置');
|
|
@@ -93,10 +96,21 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
93
96
|
if (!url && isDev) {
|
|
94
97
|
console.error('url 属性必须设置');
|
|
95
98
|
}
|
|
99
|
+
var tableKey = (tableConfig === null || tableConfig === void 0 ? void 0 : tableConfig.rowKey) || valueField || 'id';
|
|
100
|
+
// 处理表单name, 如果不传入通过id来处理。在表格中,自动会添加Id
|
|
101
|
+
var name = useMemo(function () {
|
|
102
|
+
if (itemName) return itemName;
|
|
103
|
+
if (id) {
|
|
104
|
+
if (id.includes('_')) {
|
|
105
|
+
return id.slice(id.indexOf('_') + 1);
|
|
106
|
+
}
|
|
107
|
+
return id;
|
|
108
|
+
}
|
|
109
|
+
return '';
|
|
110
|
+
}, [itemName, id]);
|
|
96
111
|
if (!name && isDev) {
|
|
97
112
|
console.error('name 属性必须设置');
|
|
98
113
|
}
|
|
99
|
-
var tableKey = (tableConfig === null || tableConfig === void 0 ? void 0 : tableConfig.rowKey) || valueField || 'id';
|
|
100
114
|
//显示输入框绑定的name,如果不设置textName,设置为$name__text
|
|
101
115
|
var textNameProp = useMemo(function () {
|
|
102
116
|
return textName ? textName : name + '__text';
|
|
@@ -120,6 +134,11 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
120
134
|
if (col) return col.searchField || col.dataIndex;
|
|
121
135
|
return textField || valueField;
|
|
122
136
|
}, [columns, searchField, valueField, textField]);
|
|
137
|
+
/**
|
|
138
|
+
* 获取表单值
|
|
139
|
+
*
|
|
140
|
+
* @returns
|
|
141
|
+
*/
|
|
123
142
|
var getFormValue = function getFormValue() {
|
|
124
143
|
var _formRef$current2, _formRef$current2$get;
|
|
125
144
|
if (rowKey) {
|
|
@@ -128,6 +147,11 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
128
147
|
}
|
|
129
148
|
return formRef === null || formRef === void 0 ? void 0 : (_formRef$current2 = formRef.current) === null || _formRef$current2 === void 0 ? void 0 : (_formRef$current2$get = _formRef$current2.getFieldsValue) === null || _formRef$current2$get === void 0 ? void 0 : _formRef$current2$get.call(_formRef$current2);
|
|
130
149
|
};
|
|
150
|
+
/**
|
|
151
|
+
* 设置表单值
|
|
152
|
+
*
|
|
153
|
+
* @param formValue
|
|
154
|
+
*/
|
|
131
155
|
var setFormValue = function setFormValue(formValue) {
|
|
132
156
|
var _prop$onChange;
|
|
133
157
|
(_prop$onChange = prop.onChange) === null || _prop$onChange === void 0 ? void 0 : _prop$onChange.call(prop, formValue[name]);
|
|
@@ -139,6 +163,12 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
139
163
|
formRef === null || formRef === void 0 ? void 0 : (_formRef$current4 = formRef.current) === null || _formRef$current4 === void 0 ? void 0 : (_formRef$current4$set = _formRef$current4.setFieldsValue) === null || _formRef$current4$set === void 0 ? void 0 : _formRef$current4$set.call(_formRef$current4, formValue);
|
|
140
164
|
}
|
|
141
165
|
};
|
|
166
|
+
/**
|
|
167
|
+
* 加载面板数据
|
|
168
|
+
*
|
|
169
|
+
* @param param
|
|
170
|
+
* @returns
|
|
171
|
+
*/
|
|
142
172
|
var loadData = /*#__PURE__*/function () {
|
|
143
173
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(param) {
|
|
144
174
|
var current, pageSize, restParams, _selectRowRef$current, _rows, data, _tableRef$current2, _tableRef$current2$cl, _param, result, rows, formValue, val, _selectRowRef$current2, arr, pageSelectedRows;
|
|
@@ -254,6 +284,13 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
254
284
|
return _ref.apply(this, arguments);
|
|
255
285
|
};
|
|
256
286
|
}();
|
|
287
|
+
/**
|
|
288
|
+
* 如果初始有值时,调用此方法初始化名称
|
|
289
|
+
*
|
|
290
|
+
* @param val
|
|
291
|
+
* @param updateTxt
|
|
292
|
+
* @returns
|
|
293
|
+
*/
|
|
257
294
|
var initName = function initName(val) {
|
|
258
295
|
var updateTxt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
259
296
|
if (!val) return;
|
|
@@ -288,6 +325,7 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
288
325
|
var formValue = getFormValue();
|
|
289
326
|
if (!formValue) return;
|
|
290
327
|
formValue[textNameProp] = txt;
|
|
328
|
+
console.log('formValue', formValue);
|
|
291
329
|
setFormValue(formValue);
|
|
292
330
|
});
|
|
293
331
|
};
|
|
@@ -433,6 +471,19 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
433
471
|
(_tableRef$current5 = tableRef.current) === null || _tableRef$current5 === void 0 ? void 0 : (_tableRef$current5$re = _tableRef$current5.reload) === null || _tableRef$current5$re === void 0 ? void 0 : _tableRef$current5$re.call(_tableRef$current5);
|
|
434
472
|
}
|
|
435
473
|
}, [visible, loadOnShow]);
|
|
474
|
+
// 处理有值时,可清空
|
|
475
|
+
useEffect(function () {
|
|
476
|
+
if (rest.disabled || (fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.disabled)) return;
|
|
477
|
+
try {
|
|
478
|
+
var el = inputRef.current.input.parentNode;
|
|
479
|
+
if (!el) return;
|
|
480
|
+
if (text) {
|
|
481
|
+
el.classList.add('ant-input-has-value');
|
|
482
|
+
} else {
|
|
483
|
+
el.classList.remove('ant-input-has-value');
|
|
484
|
+
}
|
|
485
|
+
} catch (e) {}
|
|
486
|
+
}, [text, rest, fieldProps]);
|
|
436
487
|
var tableDom = /*#__PURE__*/React.createElement(ProTable, _extends({
|
|
437
488
|
className: "ls-input-table",
|
|
438
489
|
columns: columns,
|
|
@@ -549,31 +600,26 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
549
600
|
readOnly: readonly,
|
|
550
601
|
allowClear: allowClear,
|
|
551
602
|
ref: inputRef
|
|
552
|
-
},
|
|
603
|
+
}, !rowKey ? {} : {
|
|
553
604
|
value: text
|
|
554
605
|
}, fieldProps));
|
|
555
|
-
|
|
556
|
-
useEffect(function () {
|
|
557
|
-
if (rest.disabled || (fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.disabled)) return;
|
|
558
|
-
try {
|
|
559
|
-
var el = inputRef.current.input.parentNode;
|
|
560
|
-
if (!el) return;
|
|
561
|
-
if (text) {
|
|
562
|
-
el.classList.add('ant-input-has-value');
|
|
563
|
-
} else {
|
|
564
|
-
el.classList.remove('ant-input-has-value');
|
|
565
|
-
}
|
|
566
|
-
} catch (e) {}
|
|
567
|
-
}, [text, rest, fieldProps]);
|
|
606
|
+
console.log('textNameProp', prop);
|
|
568
607
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
569
608
|
style: {
|
|
570
609
|
display: 'none'
|
|
571
610
|
}
|
|
572
611
|
}, /*#__PURE__*/React.createElement(ProFormText, {
|
|
573
|
-
name: name
|
|
574
|
-
})), /*#__PURE__*/React.createElement(ProFormText, _extends({
|
|
612
|
+
name: rowKey ? id : name
|
|
613
|
+
})), rest.label || rowKey ? /*#__PURE__*/React.createElement(ProFormText, _extends({
|
|
614
|
+
name: textNameProp
|
|
615
|
+
}, rest, rowKey ? {
|
|
616
|
+
noStyle: true
|
|
617
|
+
} : {}), InputDom) :
|
|
618
|
+
/*#__PURE__*/
|
|
619
|
+
// 在ProTable的查询面板中
|
|
620
|
+
React.createElement(_Form.Item, _extends({
|
|
575
621
|
name: textNameProp
|
|
576
|
-
}, rest,
|
|
622
|
+
}, rest, {
|
|
577
623
|
noStyle: true
|
|
578
624
|
}), InputDom));
|
|
579
625
|
});
|