@zat-design/sisyphus-react 3.3.3-beta.6 → 3.3.3-beta.8

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.
@@ -20,7 +20,7 @@ interface ConfigContext {
20
20
  export declare const ProConfigContext: React.Context<ConfigContext>;
21
21
  export declare function useProConfig(): ConfigContext;
22
22
  export declare function useProConfig(name: keyof ConfigContext['state']): ConfigContext['state'][keyof ConfigContext['state']];
23
- export declare function useContextForm(): Record<string, FormInstance<any>>;
23
+ export declare function useContextForms(): Record<string, FormInstance<any>>;
24
24
  type ActionsType = 'set' | 'setProEnum' | 'setProEnumDic';
25
25
  interface Actions {
26
26
  type: ActionsType;
@@ -24,7 +24,7 @@ export function useProConfig(name) {
24
24
  var config = useContext(ProConfigContext);
25
25
  return name ? config.state[name] : config;
26
26
  }
27
- export function useContextForm() {
27
+ export function useContextForms() {
28
28
  var _config$state;
29
29
  var config = useContext(ProConfigContext);
30
30
  return (_config$state = config.state) === null || _config$state === void 0 ? void 0 : _config$state.forms;
@@ -739,6 +739,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
739
739
  visible: visible
740
740
  }, restModalProps), {}, {
741
741
  children: [_jsx(ProForm, {
742
+ submitOnEnter: true,
742
743
  form: form,
743
744
  columns: formColumns,
744
745
  onFinish: handleSearch,
@@ -20,7 +20,7 @@ import React, { forwardRef, useImperativeHandle, useMemo } from 'react';
20
20
  import { isObject, isString, merge } from 'lodash';
21
21
  import { FormFooter, InputRange, ProAddress, ProAddressBar, ProCertNo, ProCertValidity, ProCombination, ProModalSelect, ProNumberRange, ProRangeBox, ProTimeLimit, transferAddressInfoToRegion, ProUpload, ProTreeSelect, ProTreeModal, ProTree, EnumSelect } from './components';
22
22
  import RenderFields from './components/render/RenderFields';
23
- import { useProConfig, useContextForm } from '../ProConfigProvider';
23
+ import { useProConfig, useContextForms } from '../ProConfigProvider';
24
24
  import { getLayout, splitNameStr, useControlled, initialValuesToNames } from './utils/index';
25
25
  import { useForm } from './utils/useForm';
26
26
  import { useFieldProps } from './utils/useFieldProps';
@@ -310,7 +310,7 @@ var ProFormProvider = function ProFormProvider(props) {
310
310
  };
311
311
  ProFormForward.Provider = ProFormProvider; // 包装Provider
312
312
  ProFormForward.useFieldProps = useFieldProps; // 获取每个字段的其他参数 -otherProps
313
- ProFormForward.useContextForm = useContextForm; // 获取 ProConfigProvider中的表单实例map
313
+ ProFormForward.useContextForms = useContextForms; // 获取 ProConfigProvider中的表单实例map
314
314
  // 内置组合
315
315
  ProFormForward.ProAddressBar = ProAddressBar;
316
316
  ProFormForward.ProCombination = ProCombination;
@@ -56,10 +56,9 @@ var useRules = function useRules(props) {
56
56
  return Promise.resolve();
57
57
  }
58
58
  };
59
- if (type === 'Group' && Array.isArray(names) && !required) {
60
- customRequired = null;
59
+ if (!(type === 'Group' && Array.isArray(names) && !required)) {
60
+ internalRule.rules.push(customRequired);
61
61
  }
62
- internalRule.rules.push(customRequired);
63
62
  }
64
63
  }, [internalRule]);
65
64
  return internalRule;
@@ -168,10 +168,13 @@ var useShouldUpdate = function useShouldUpdate(props) {
168
168
  clearInterval(timerRef.current);
169
169
  }
170
170
  }
171
- // 当校验规则改变的时候 重新执行校验
172
- if (_required !== requiredRef.current || !isEqualWith(rulesRef.current, _rules, customEqualForFun)) {
173
- form.validateFields([name]);
174
- }
171
+ // // 当校验规则改变的时候 重新执行校验 导致: 第一次进页面直接触发校验
172
+ // if (
173
+ // _required !== requiredRef.current ||
174
+ // !isEqualWith(rulesRef.current, _rules, customEqualForFun)
175
+ // ) {
176
+ // form.validateFields([name]);
177
+ // }
175
178
  if (_show !== showRef.current || _disabled !== disabledRef.current || _required !== requiredRef.current || !isEqualWith(rulesRef.current, _rules, customEqualForFun) || !isEqualWith(fieldPropsRef.current, _fieldProps, customEqualForFun) || !isEqualWith(originComponentRef.current, _component, customEqualForFun) || equalDependencies(dependencies, prevValues, _currentValues)) {
176
179
  showRef.current = _show;
177
180
  disabledRef.current = _disabled;
@@ -20,7 +20,7 @@ interface ConfigContext {
20
20
  export declare const ProConfigContext: React.Context<ConfigContext>;
21
21
  export declare function useProConfig(): ConfigContext;
22
22
  export declare function useProConfig(name: keyof ConfigContext['state']): ConfigContext['state'][keyof ConfigContext['state']];
23
- export declare function useContextForm(): Record<string, FormInstance<any>>;
23
+ export declare function useContextForms(): Record<string, FormInstance<any>>;
24
24
  type ActionsType = 'set' | 'setProEnum' | 'setProEnumDic';
25
25
  interface Actions {
26
26
  type: ActionsType;
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.default = exports.ProConfigProvider = exports.ProConfigContext = void 0;
9
- exports.useContextForm = useContextForm;
9
+ exports.useContextForms = useContextForms;
10
10
  exports.useProConfig = useProConfig;
11
11
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
12
12
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
@@ -33,7 +33,7 @@ function useProConfig(name) {
33
33
  var config = (0, _react.useContext)(ProConfigContext);
34
34
  return name ? config.state[name] : config;
35
35
  }
36
- function useContextForm() {
36
+ function useContextForms() {
37
37
  var _config$state;
38
38
  var config = (0, _react.useContext)(ProConfigContext);
39
39
  return (_config$state = config.state) === null || _config$state === void 0 ? void 0 : _config$state.forms;
@@ -740,6 +740,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
740
740
  visible: visible
741
741
  }, restModalProps), {}, {
742
742
  children: [(0, _jsxRuntime.jsx)(_index.ProForm, {
743
+ submitOnEnter: true,
743
744
  form: form,
744
745
  columns: formColumns,
745
746
  onFinish: handleSearch,
@@ -311,7 +311,7 @@ var ProFormProvider = function ProFormProvider(props) {
311
311
  };
312
312
  ProFormForward.Provider = ProFormProvider; // 包装Provider
313
313
  ProFormForward.useFieldProps = _useFieldProps.useFieldProps; // 获取每个字段的其他参数 -otherProps
314
- ProFormForward.useContextForm = _ProConfigProvider.useContextForm; // 获取 ProConfigProvider中的表单实例map
314
+ ProFormForward.useContextForms = _ProConfigProvider.useContextForms; // 获取 ProConfigProvider中的表单实例map
315
315
  // 内置组合
316
316
  ProFormForward.ProAddressBar = _components.ProAddressBar;
317
317
  ProFormForward.ProCombination = _components.ProCombination;
@@ -63,10 +63,9 @@ var useRules = function useRules(props) {
63
63
  return Promise.resolve();
64
64
  }
65
65
  };
66
- if (type === 'Group' && Array.isArray(names) && !required) {
67
- customRequired = null;
66
+ if (!(type === 'Group' && Array.isArray(names) && !required)) {
67
+ internalRule.rules.push(customRequired);
68
68
  }
69
- internalRule.rules.push(customRequired);
70
69
  }
71
70
  }, [internalRule]);
72
71
  return internalRule;
@@ -175,10 +175,13 @@ var useShouldUpdate = function useShouldUpdate(props) {
175
175
  clearInterval(timerRef.current);
176
176
  }
177
177
  }
178
- // 当校验规则改变的时候 重新执行校验
179
- if (_required !== requiredRef.current || !(0, _lodash.isEqualWith)(rulesRef.current, _rules, _index.customEqualForFun)) {
180
- form.validateFields([name]);
181
- }
178
+ // // 当校验规则改变的时候 重新执行校验 导致: 第一次进页面直接触发校验
179
+ // if (
180
+ // _required !== requiredRef.current ||
181
+ // !isEqualWith(rulesRef.current, _rules, customEqualForFun)
182
+ // ) {
183
+ // form.validateFields([name]);
184
+ // }
182
185
  if (_show !== showRef.current || _disabled !== disabledRef.current || _required !== requiredRef.current || !(0, _lodash.isEqualWith)(rulesRef.current, _rules, _index.customEqualForFun) || !(0, _lodash.isEqualWith)(fieldPropsRef.current, _fieldProps, _index.customEqualForFun) || !(0, _lodash.isEqualWith)(originComponentRef.current, _component, _index.customEqualForFun) || (0, _index.equalDependencies)(dependencies, prevValues, _currentValues)) {
183
186
  showRef.current = _show;
184
187
  disabledRef.current = _disabled;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zat-design/sisyphus-react",
3
- "version": "3.3.3-beta.6",
3
+ "version": "3.3.3-beta.8",
4
4
  "license": "Apache-2.0",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",