@ztocwst/rc-pro-materials 0.2.7 → 0.2.9

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.
@@ -61,10 +61,10 @@ var processInitialValue = function processInitialValue(e) {
61
61
  dependencyName = '';
62
62
  }
63
63
  var childRest = processInitialValue(child);
64
- var fieldProps = childRest.fieldProps,
64
+ var childFieldProps = childRest.fieldProps,
65
65
  childItemRest = _objectWithoutPropertiesLoose(childRest, _excluded4);
66
- var requestOptions = fieldProps.requestOptions,
67
- childRestFieldProps = _objectWithoutPropertiesLoose(fieldProps, _excluded5);
66
+ var requestOptions = childFieldProps.requestOptions,
67
+ childRestFieldProps = _objectWithoutPropertiesLoose(childFieldProps, _excluded5);
68
68
  return _extends({}, childItemRest, {
69
69
  fieldProps: _extends({}, childRestFieldProps, (childRest === null || childRest === void 0 ? void 0 : childRest.valueType) === 'asyncSelect' &&
70
70
  // 接口请求前置校验, 通过请求 asyncSelect 接口
@@ -115,7 +115,7 @@ var processInitialValue = function processInitialValue(e) {
115
115
  });
116
116
  };
117
117
  export var processFormProps = function processFormProps(props) {
118
- var _ref3;
118
+ var _ref3, _config$columns, _config$columns$filte, _Object$keys;
119
119
  var columns = props.columns,
120
120
  submitter = props.submitter,
121
121
  labelColWidth = props.labelColWidth,
@@ -132,7 +132,7 @@ export var processFormProps = function processFormProps(props) {
132
132
  formRef = props.formRef,
133
133
  currentRef = props.currentRef,
134
134
  restProps = props.restProps;
135
- return processModalSelectProps(_extends({
135
+ var config = processModalSelectProps(_extends({
136
136
  // columns只支持两级group嵌套
137
137
  columns: (_ref3 = columns || []) === null || _ref3 === void 0 ? void 0 : _ref3.filter(function (e) {
138
138
  return !!e;
@@ -179,4 +179,19 @@ export var processFormProps = function processFormProps(props) {
179
179
  span: span,
180
180
  layoutType: layoutType
181
181
  }, restProps ? processJsonOrFunctionProps(restProps) : {}));
182
+ var resetFields = config === null || config === void 0 ? void 0 : (_config$columns = config.columns) === null || _config$columns === void 0 ? void 0 : (_config$columns$filte = _config$columns.filter(function (e) {
183
+ return !(e !== null && e !== void 0 && e.initialValue);
184
+ })) === null || _config$columns$filte === void 0 ? void 0 : _config$columns$filte.reduce(function (prev, next) {
185
+ var _next$dataIndex;
186
+ // eslint-disable-next-line no-param-reassign
187
+ prev[(_next$dataIndex = next === null || next === void 0 ? void 0 : next.dataIndex) !== null && _next$dataIndex !== void 0 ? _next$dataIndex : ''] = undefined;
188
+ return prev;
189
+ }, {});
190
+
191
+ // 每次变更重置
192
+ if ((_Object$keys = Object.keys(resetFields)) !== null && _Object$keys !== void 0 && _Object$keys.length) {
193
+ var _formRef$current;
194
+ (_formRef$current = formRef.current) === null || _formRef$current === void 0 ? void 0 : _formRef$current.setFieldsValue(resetFields);
195
+ }
196
+ return config;
182
197
  };
@@ -65,10 +65,10 @@ var processInitialValue = function processInitialValue(e) {
65
65
  dependencyName = '';
66
66
  }
67
67
  var childRest = processInitialValue(child);
68
- var fieldProps = childRest.fieldProps,
68
+ var childFieldProps = childRest.fieldProps,
69
69
  childItemRest = (0, _objectWithoutPropertiesLoose2["default"])(childRest, _excluded4);
70
- var requestOptions = fieldProps.requestOptions,
71
- childRestFieldProps = (0, _objectWithoutPropertiesLoose2["default"])(fieldProps, _excluded5);
70
+ var requestOptions = childFieldProps.requestOptions,
71
+ childRestFieldProps = (0, _objectWithoutPropertiesLoose2["default"])(childFieldProps, _excluded5);
72
72
  return (0, _extends2["default"])({}, childItemRest, {
73
73
  fieldProps: (0, _extends2["default"])({}, childRestFieldProps, (childRest === null || childRest === void 0 ? void 0 : childRest.valueType) === 'asyncSelect' &&
74
74
  // 接口请求前置校验, 通过请求 asyncSelect 接口
@@ -119,7 +119,7 @@ var processInitialValue = function processInitialValue(e) {
119
119
  });
120
120
  };
121
121
  var processFormProps = function processFormProps(props) {
122
- var _ref3;
122
+ var _ref3, _config$columns, _config$columns$filte, _Object$keys;
123
123
  var columns = props.columns,
124
124
  submitter = props.submitter,
125
125
  labelColWidth = props.labelColWidth,
@@ -136,7 +136,7 @@ var processFormProps = function processFormProps(props) {
136
136
  formRef = props.formRef,
137
137
  currentRef = props.currentRef,
138
138
  restProps = props.restProps;
139
- return (0, _modalSelect.processModalSelectProps)((0, _extends2["default"])({
139
+ var config = (0, _modalSelect.processModalSelectProps)((0, _extends2["default"])({
140
140
  // columns只支持两级group嵌套
141
141
  columns: (_ref3 = columns || []) === null || _ref3 === void 0 ? void 0 : _ref3.filter(function (e) {
142
142
  return !!e;
@@ -183,5 +183,20 @@ var processFormProps = function processFormProps(props) {
183
183
  span: span,
184
184
  layoutType: layoutType
185
185
  }, restProps ? (0, _lib.processJsonOrFunctionProps)(restProps) : {}));
186
+ var resetFields = config === null || config === void 0 ? void 0 : (_config$columns = config.columns) === null || _config$columns === void 0 ? void 0 : (_config$columns$filte = _config$columns.filter(function (e) {
187
+ return !(e !== null && e !== void 0 && e.initialValue);
188
+ })) === null || _config$columns$filte === void 0 ? void 0 : _config$columns$filte.reduce(function (prev, next) {
189
+ var _next$dataIndex;
190
+ // eslint-disable-next-line no-param-reassign
191
+ prev[(_next$dataIndex = next === null || next === void 0 ? void 0 : next.dataIndex) !== null && _next$dataIndex !== void 0 ? _next$dataIndex : ''] = undefined;
192
+ return prev;
193
+ }, {});
194
+
195
+ // 每次变更重置
196
+ if ((_Object$keys = Object.keys(resetFields)) !== null && _Object$keys !== void 0 && _Object$keys.length) {
197
+ var _formRef$current;
198
+ (_formRef$current = formRef.current) === null || _formRef$current === void 0 ? void 0 : _formRef$current.setFieldsValue(resetFields);
199
+ }
200
+ return config;
186
201
  };
187
202
  exports.processFormProps = processFormProps;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ztocwst/rc-pro-materials",
3
- "version": "0.2.7",
3
+ "version": "0.2.9",
4
4
  "description": "@ztocwst/rc-pro-materials",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -71,7 +71,7 @@
71
71
  "@alifd/next": "^1.25.27",
72
72
  "@alilc/build-plugin-alt": "^1.3.3",
73
73
  "@types/antd": "^1.0.0",
74
- "@ztocwst/rc-pro": "0.4.44",
74
+ "@ztocwst/rc-pro": "0.4.45",
75
75
  "antd": "4.22.3",
76
76
  "moment": "latest",
77
77
  "prop-types": "^15.5.8",
@@ -86,9 +86,9 @@
86
86
  },
87
87
  "componentConfig": {
88
88
  "isComponentLibrary": true,
89
- "materialSchema": "https://npm.onmicrosoft.cn/@ztocwst/rc-pro-materials@0.2.7/build/lowcode/assets-prod.json"
89
+ "materialSchema": "https://npm.onmicrosoft.cn/@ztocwst/rc-pro-materials@0.2.9/build/lowcode/assets-prod.json"
90
90
  },
91
- "homepage": "https://unpkg.com/@ztocwst/rc-pro-materials@0.2.7/build/index.html",
91
+ "homepage": "https://unpkg.com/@ztocwst/rc-pro-materials@0.2.9/build/index.html",
92
92
  "publishConfig": {
93
93
  "registry": "https://registry.npmjs.org/",
94
94
  "access": "public"