@hw-component/form 1.10.96 → 1.11.0

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.
@@ -198,7 +198,18 @@ var useHForm = (function () {
198
198
  keys.forEach(function (key) {
199
199
  newVale[key] = undefined;
200
200
  });
201
- form.setFieldsValue(_objectSpread(_objectSpread(_objectSpread({}, newVale), initSaveValue), values));
201
+ var allValue = _objectSpread(_objectSpread(_objectSpread({}, newVale), initSaveValue), values);
202
+ var valueKeys = Object.keys(allValue);
203
+ var names = valueKeys.map(function (key) {
204
+ var val = allValue[key];
205
+ return {
206
+ name: key,
207
+ touched: false,
208
+ value: val,
209
+ errors: []
210
+ };
211
+ });
212
+ form.setFields(names);
202
213
  },
203
214
  resetFieldsValues: function resetFieldsValues() {
204
215
  var values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
@@ -27,6 +27,7 @@ var Index = function Index(_ref) {
27
27
  addFormat = _ref.addFormat;
28
28
  _ref.addDispatchListener;
29
29
  var props = _objectWithoutProperties(_ref, _excluded);
30
+ console.log(props, "ppppppp");
30
31
  var _valueName$input = valueName.input,
31
32
  input = _valueName$input === void 0 ? "" : _valueName$input,
32
33
  _valueName$select = valueName.select,
@@ -145,6 +145,11 @@ var Index = function Index(_ref) {
145
145
  optionFilterProp: optionFilterProp,
146
146
  filterOption: selfFilterOption,
147
147
  showSearch: mathShowSearch,
148
+ onBlur: function onBlur() {
149
+ if (serviceSearch && onSearch) {
150
+ onSearch("");
151
+ }
152
+ },
148
153
  labelInValue: true,
149
154
  onPopupScroll: propsOnPopupScroll || onPopupScroll,
150
155
  getPopupContainer: selfPopupContainer ? function () {
@@ -201,7 +201,18 @@ var useHForm = (function () {
201
201
  keys.forEach(function (key) {
202
202
  newVale[key] = undefined;
203
203
  });
204
- form.setFieldsValue(_objectSpread(_objectSpread(_objectSpread({}, newVale), initSaveValue), values));
204
+ var allValue = _objectSpread(_objectSpread(_objectSpread({}, newVale), initSaveValue), values);
205
+ var valueKeys = Object.keys(allValue);
206
+ var names = valueKeys.map(function (key) {
207
+ var val = allValue[key];
208
+ return {
209
+ name: key,
210
+ touched: false,
211
+ value: val,
212
+ errors: []
213
+ };
214
+ });
215
+ form.setFields(names);
205
216
  },
206
217
  resetFieldsValues: function resetFieldsValues() {
207
218
  var values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
@@ -30,6 +30,7 @@ var Index = function Index(_ref) {
30
30
  addFormat = _ref.addFormat;
31
31
  _ref.addDispatchListener;
32
32
  var props = _objectWithoutProperties(_ref, _excluded);
33
+ console.log(props, "ppppppp");
33
34
  var _valueName$input = valueName.input,
34
35
  input = _valueName$input === void 0 ? "" : _valueName$input,
35
36
  _valueName$select = valueName.select,
@@ -148,6 +148,11 @@ var Index = function Index(_ref) {
148
148
  optionFilterProp: optionFilterProp,
149
149
  filterOption: selfFilterOption,
150
150
  showSearch: mathShowSearch,
151
+ onBlur: function onBlur() {
152
+ if (serviceSearch && onSearch) {
153
+ onSearch("");
154
+ }
155
+ },
151
156
  labelInValue: true,
152
157
  onPopupScroll: propsOnPopupScroll || onPopupScroll,
153
158
  getPopupContainer: selfPopupContainer ? function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hw-component/form",
3
- "version": "1.10.96",
3
+ "version": "1.11.0",
4
4
  "description": "基于antd二次开发",
5
5
  "repository": {
6
6
  "type": "git",
@@ -183,11 +183,22 @@ export default () => {
183
183
  keys.forEach((key) => {
184
184
  newVale[key] = undefined;
185
185
  });
186
- form.setFieldsValue({
186
+ const allValue={
187
187
  ...newVale,
188
188
  ...initSaveValue,
189
189
  ...values,
190
+ }
191
+ const valueKeys=Object.keys(allValue);
192
+ const names=valueKeys.map(key => {
193
+ const val=allValue[key];
194
+ return {
195
+ name:key,
196
+ touched:false,
197
+ value: val,
198
+ errors:[]
199
+ }
190
200
  });
201
+ form.setFields(names)
191
202
  },
192
203
  resetFieldsValues: (values = {}) => {
193
204
  const oldValue = form.getFieldsValue(true);
@@ -16,6 +16,7 @@ export const Index = ({
16
16
  addDispatchListener,
17
17
  ...props
18
18
  }: HSelectInputProps) => {
19
+ console.log(props,"ppppppp");
19
20
  const { input = "", select = "" } = valueName;
20
21
  const { [input]: inputVal, [select]: selectVal } = value;
21
22
  const {
@@ -130,6 +130,11 @@ const Index: React.FC<HSelectProps> = ({
130
130
  optionFilterProp={optionFilterProp}
131
131
  filterOption={selfFilterOption}
132
132
  showSearch={mathShowSearch}
133
+ onBlur={()=>{
134
+ if (serviceSearch&&onSearch){
135
+ onSearch("");
136
+ }
137
+ }}
133
138
  labelInValue={true}
134
139
  onPopupScroll={propsOnPopupScroll || onPopupScroll}
135
140
  getPopupContainer={
@@ -226,6 +226,7 @@ export default () => {
226
226
  label: "你好啊",
227
227
  type: "rangePicker",
228
228
  hover: ["123123213", "22222"],
229
+ rules:[{required: true, message: "Please input your password!", }],
229
230
  itemProps: {
230
231
  valueMap: {
231
232
  start: "start",
@@ -236,43 +237,14 @@ export default () => {
236
237
  {
237
238
  name: "num1",
238
239
  label: "必填",
240
+ rules:[{required: true, message: "Please input your password!", }],
239
241
  dependencies: ["num"],
240
- // hidden: () => {
241
- // return !form.getFieldValue("num");
242
- // },
243
- rules: [
244
- {
245
- required: true,
246
- message: "Please confirm your password!",
247
- },
248
- {
249
- validator(_, value) {
250
- console.log("ffff");
251
- return Promise.reject(
252
- new Error(
253
- "The two passwords that you entered do not match!"
254
- )
255
- );
256
- },
257
- },
258
- ],
259
242
  },
260
243
  ]}
261
244
  dismissOnPressEnter={false}
262
245
  form={form}
263
246
  initialValues={{
264
- deviceType: 1,
265
- tt: {
266
- select: "test",
267
- time: {
268
- EndTime: null,
269
- StartTime: null,
270
- },
271
- },
272
- selectInput: {
273
- select: "1",
274
- input: "",
275
- },
247
+ num1:"23123"
276
248
  }}
277
249
  labelAlign={"top"}
278
250
  onValuesChange={(val) => {
@@ -18,7 +18,7 @@ export default () => {
18
18
  <HSelect
19
19
  placeholder="分页"
20
20
  serviceSearch
21
- addonBefore="你好"
21
+ addonBefore="你好111"
22
22
  allowClear={true}
23
23
  labelInValue
24
24
  fieldNames={{