ls-pro-common 3.1.53 → 3.1.55

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.
@@ -7,10 +7,10 @@ import _Popover from "antd/es/popover";
7
7
  import _extends from "@babel/runtime/helpers/esm/extends";
8
8
  import "antd/es/button/style";
9
9
  import _Button from "antd/es/button";
10
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
11
10
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
12
11
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
13
12
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
13
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
14
14
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
15
15
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
16
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"],
@@ -42,6 +42,7 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
42
42
  setText = _useState6[1];
43
43
  var inputRef = useRef();
44
44
  var initRows = useRef(null); //用于存储初始行数据
45
+ var firstMount = useRef(true);
45
46
  var columns = prop.columns,
46
47
  url = prop.url,
47
48
  textName = prop.textName,
@@ -144,7 +145,11 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
144
145
  if (!(formRef === null || formRef === void 0 ? void 0 : formRef.current) && record) return record;
145
146
  if (rowKey) {
146
147
  var _formRef$current, _formRef$current$getF, _formRef$current$getF2;
147
- return 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$getF2 = _formRef$current$getF.call(_formRef$current)) === null || _formRef$current$getF2 === void 0 ? void 0 : _formRef$current$getF2[rowKey];
148
+ if (firstMount.current && record) {
149
+ firstMount.current = false;
150
+ return record;
151
+ }
152
+ return _objectSpread(_objectSpread({}, record || {}), (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$getF2 = _formRef$current$getF.call(_formRef$current)) === null || _formRef$current$getF2 === void 0 ? void 0 : _formRef$current$getF2[rowKey]) || {});
148
153
  }
149
154
  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);
150
155
  };
@@ -154,13 +159,18 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
154
159
  * @param formValue
155
160
  */
156
161
  var setFormValue = function setFormValue(formValue) {
162
+ var _prop$onChange;
163
+ (_prop$onChange = prop.onChange) === null || _prop$onChange === void 0 ? void 0 : _prop$onChange.call(prop, formValue[name]);
164
+ for (var key in formValue) {
165
+ if (formValue[key] === null) {
166
+ formValue[key] = undefined;
167
+ }
168
+ }
157
169
  if (rowKey) {
158
- var _formRef$current3, _formRef$current3$set, _prop$onChange;
170
+ var _formRef$current3, _formRef$current3$set;
159
171
  formRef === null || formRef === void 0 ? void 0 : (_formRef$current3 = formRef.current) === null || _formRef$current3 === void 0 ? void 0 : (_formRef$current3$set = _formRef$current3.setFieldsValue) === null || _formRef$current3$set === void 0 ? void 0 : _formRef$current3$set.call(_formRef$current3, _defineProperty({}, rowKey, formValue));
160
- (_prop$onChange = prop.onChange) === null || _prop$onChange === void 0 ? void 0 : _prop$onChange.call(prop, formValue[textNameProp]);
161
172
  } else {
162
- var _prop$onChange2, _formRef$current4, _formRef$current4$set;
163
- (_prop$onChange2 = prop.onChange) === null || _prop$onChange2 === void 0 ? void 0 : _prop$onChange2.call(prop, formValue[name]);
173
+ var _formRef$current4, _formRef$current4$set;
164
174
  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);
165
175
  }
166
176
  };
@@ -7,10 +7,10 @@ import _Popover from "antd/es/popover";
7
7
  import _extends from "@babel/runtime/helpers/esm/extends";
8
8
  import "antd/es/button/style";
9
9
  import _Button from "antd/es/button";
10
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
11
10
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
12
11
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
13
12
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
13
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
14
14
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
15
15
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
16
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"],
@@ -42,6 +42,7 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
42
42
  setText = _useState6[1];
43
43
  var inputRef = useRef();
44
44
  var initRows = useRef(null); //用于存储初始行数据
45
+ var firstMount = useRef(true);
45
46
  var columns = prop.columns,
46
47
  url = prop.url,
47
48
  textName = prop.textName,
@@ -144,7 +145,11 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
144
145
  if (!(formRef === null || formRef === void 0 ? void 0 : formRef.current) && record) return record;
145
146
  if (rowKey) {
146
147
  var _formRef$current, _formRef$current$getF, _formRef$current$getF2;
147
- return 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$getF2 = _formRef$current$getF.call(_formRef$current)) === null || _formRef$current$getF2 === void 0 ? void 0 : _formRef$current$getF2[rowKey];
148
+ if (firstMount.current && record) {
149
+ firstMount.current = false;
150
+ return record;
151
+ }
152
+ return _objectSpread(_objectSpread({}, record || {}), (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$getF2 = _formRef$current$getF.call(_formRef$current)) === null || _formRef$current$getF2 === void 0 ? void 0 : _formRef$current$getF2[rowKey]) || {});
148
153
  }
149
154
  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);
150
155
  };
@@ -154,13 +159,18 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
154
159
  * @param formValue
155
160
  */
156
161
  var setFormValue = function setFormValue(formValue) {
162
+ var _prop$onChange;
163
+ (_prop$onChange = prop.onChange) === null || _prop$onChange === void 0 ? void 0 : _prop$onChange.call(prop, formValue[name]);
164
+ for (var key in formValue) {
165
+ if (formValue[key] === null) {
166
+ formValue[key] = undefined;
167
+ }
168
+ }
157
169
  if (rowKey) {
158
- var _formRef$current3, _formRef$current3$set, _prop$onChange;
170
+ var _formRef$current3, _formRef$current3$set;
159
171
  formRef === null || formRef === void 0 ? void 0 : (_formRef$current3 = formRef.current) === null || _formRef$current3 === void 0 ? void 0 : (_formRef$current3$set = _formRef$current3.setFieldsValue) === null || _formRef$current3$set === void 0 ? void 0 : _formRef$current3$set.call(_formRef$current3, _defineProperty({}, rowKey, formValue));
160
- (_prop$onChange = prop.onChange) === null || _prop$onChange === void 0 ? void 0 : _prop$onChange.call(prop, formValue[textNameProp]);
161
172
  } else {
162
- var _prop$onChange2, _formRef$current4, _formRef$current4$set;
163
- (_prop$onChange2 = prop.onChange) === null || _prop$onChange2 === void 0 ? void 0 : _prop$onChange2.call(prop, formValue[name]);
173
+ var _formRef$current4, _formRef$current4$set;
164
174
  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);
165
175
  }
166
176
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ls-pro-common",
3
- "version": "3.1.53",
3
+ "version": "3.1.55",
4
4
  "description": "ls-pro-common",
5
5
  "license": "MIT",
6
6
  "sideEffects": [