@hw-component/form 1.1.6 → 1.1.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.
@@ -1,8 +1,8 @@
1
1
  import type { HFormInstance } from "../Form/modal";
2
- import type { InputProps } from "antd";
3
- export interface HVerificationCodeInputProps extends Omit<InputProps, "form"> {
2
+ import { HButtonInputProps } from "@/components/Input/modal";
3
+ export interface HVerificationCodeInputProps extends Omit<HButtonInputProps, "form"> {
4
4
  request?: (value: any) => Promise<any>;
5
5
  form?: HFormInstance;
6
6
  }
7
- declare const _default: ({ value, request, form, onChange, ...props }: HVerificationCodeInputProps) => JSX.Element;
7
+ declare const _default: ({ value, request, form, onChange, buttonProps, ...props }: HVerificationCodeInputProps) => JSX.Element;
8
8
  export default _default;
@@ -17,7 +17,7 @@ import { useState, useMemo, useCallback, useEffect } from 'react';
17
17
  import Index from './ButtonInput.js';
18
18
  import { useRequest } from 'ahooks';
19
19
 
20
- var _excluded = ["value", "request", "form", "onChange"];
20
+ var _excluded = ["value", "request", "form", "onChange", "buttonProps"];
21
21
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
22
22
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
23
23
  var VerificationCodeInput = (function (_ref) {
@@ -25,6 +25,8 @@ var VerificationCodeInput = (function (_ref) {
25
25
  request = _ref.request,
26
26
  form = _ref.form,
27
27
  onChange = _ref.onChange,
28
+ _ref$buttonProps = _ref.buttonProps,
29
+ buttonProps = _ref$buttonProps === void 0 ? {} : _ref$buttonProps,
28
30
  props = _objectWithoutProperties(_ref, _excluded);
29
31
  var _useState = useState(0),
30
32
  _useState2 = _slicedToArray(_useState, 2),
@@ -93,14 +95,15 @@ var VerificationCodeInput = (function (_ref) {
93
95
  }
94
96
  return "".concat(countdownStr, "\u79D2\u540E\u91CD\u65B0\u83B7\u53D6");
95
97
  };
98
+ var defaultButtonProps = {
99
+ onClick: run,
100
+ loading: loading,
101
+ disabled: !!countdown
102
+ };
96
103
  return jsx(Index, _objectSpread(_objectSpread({
97
104
  value: value,
98
105
  onChange: onChange,
99
- buttonProps: {
100
- onClick: run,
101
- loading: loading,
102
- disabled: !!countdown
103
- }
106
+ buttonProps: _objectSpread(_objectSpread({}, defaultButtonProps), buttonProps)
104
107
  }, props), {}, {
105
108
  children: text()
106
109
  }));
@@ -25,7 +25,7 @@ export interface HSelectInputProps extends Omit<HInputProps, "value" | "onChange
25
25
  subParams?: (formatValue: Record<string, any>) => any;
26
26
  }
27
27
  export interface HButtonProps extends Omit<ButtonProps, "onClick"> {
28
- onClick: (value: string | readonly string[] | number | undefined, onChange?: (val: any) => void) => void;
28
+ onClick?: (value: string | readonly string[] | number | undefined, onChange?: (val: any) => void) => void;
29
29
  }
30
30
  export interface HButtonInputProps extends HInputProps {
31
31
  buttonProps?: HButtonProps;
package/es/index.css CHANGED
@@ -38,9 +38,6 @@
38
38
  .ant-hw-form-base-item-top-left .ant-hw-form-label-item {
39
39
  position: relative;
40
40
  }
41
- .ant-hw-form-base-item-left .ant-form-item-label > label {
42
- height: 32px;
43
- }
44
41
  .ant-hw-form-base-item-top-right .ant-form-item-label > label {
45
42
  height: auto;
46
43
  }
@@ -53,6 +50,9 @@
53
50
  .ant-hw-form-base-item-right .ant-hw-form-item-colon {
54
51
  text-align: right;
55
52
  }
53
+ .ant-hw-form-base-item-right .ant-form-item-label > label {
54
+ height: 32px;
55
+ }
56
56
  .ant-hw-form-base-item-left .ant-hw-form-item-colon {
57
57
  text-align: left;
58
58
  }
@@ -64,6 +64,9 @@
64
64
  .ant-hw-form-base-item-left .ant-hw-form-label-item {
65
65
  position: relative;
66
66
  }
67
+ .ant-hw-form-base-item-left .ant-form-item-label > label {
68
+ height: 32px;
69
+ }
67
70
  .ant-hw-form-item-no-required {
68
71
  display: none;
69
72
  }
@@ -1,8 +1,8 @@
1
1
  import type { HFormInstance } from "../Form/modal";
2
- import type { InputProps } from "antd";
3
- export interface HVerificationCodeInputProps extends Omit<InputProps, "form"> {
2
+ import { HButtonInputProps } from "@/components/Input/modal";
3
+ export interface HVerificationCodeInputProps extends Omit<HButtonInputProps, "form"> {
4
4
  request?: (value: any) => Promise<any>;
5
5
  form?: HFormInstance;
6
6
  }
7
- declare const _default: ({ value, request, form, onChange, ...props }: HVerificationCodeInputProps) => JSX.Element;
7
+ declare const _default: ({ value, request, form, onChange, buttonProps, ...props }: HVerificationCodeInputProps) => JSX.Element;
8
8
  export default _default;
@@ -20,7 +20,7 @@ var React = require('react');
20
20
  var ButtonInput = require('./ButtonInput.js');
21
21
  var ahooks = require('ahooks');
22
22
 
23
- var _excluded = ["value", "request", "form", "onChange"];
23
+ var _excluded = ["value", "request", "form", "onChange", "buttonProps"];
24
24
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
25
25
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
26
26
  var VerificationCodeInput = (function (_ref) {
@@ -28,6 +28,8 @@ var VerificationCodeInput = (function (_ref) {
28
28
  request = _ref.request,
29
29
  form = _ref.form,
30
30
  onChange = _ref.onChange,
31
+ _ref$buttonProps = _ref.buttonProps,
32
+ buttonProps = _ref$buttonProps === void 0 ? {} : _ref$buttonProps,
31
33
  props = _objectWithoutProperties(_ref, _excluded);
32
34
  var _useState = React.useState(0),
33
35
  _useState2 = _slicedToArray(_useState, 2),
@@ -96,14 +98,15 @@ var VerificationCodeInput = (function (_ref) {
96
98
  }
97
99
  return "".concat(countdownStr, "\u79D2\u540E\u91CD\u65B0\u83B7\u53D6");
98
100
  };
101
+ var defaultButtonProps = {
102
+ onClick: run,
103
+ loading: loading,
104
+ disabled: !!countdown
105
+ };
99
106
  return jsxRuntime.jsx(ButtonInput.default, _objectSpread(_objectSpread({
100
107
  value: value,
101
108
  onChange: onChange,
102
- buttonProps: {
103
- onClick: run,
104
- loading: loading,
105
- disabled: !!countdown
106
- }
109
+ buttonProps: _objectSpread(_objectSpread({}, defaultButtonProps), buttonProps)
107
110
  }, props), {}, {
108
111
  children: text()
109
112
  }));
@@ -25,7 +25,7 @@ export interface HSelectInputProps extends Omit<HInputProps, "value" | "onChange
25
25
  subParams?: (formatValue: Record<string, any>) => any;
26
26
  }
27
27
  export interface HButtonProps extends Omit<ButtonProps, "onClick"> {
28
- onClick: (value: string | readonly string[] | number | undefined, onChange?: (val: any) => void) => void;
28
+ onClick?: (value: string | readonly string[] | number | undefined, onChange?: (val: any) => void) => void;
29
29
  }
30
30
  export interface HButtonInputProps extends HInputProps {
31
31
  buttonProps?: HButtonProps;
package/lib/index.css CHANGED
@@ -38,9 +38,6 @@
38
38
  .ant-hw-form-base-item-top-left .ant-hw-form-label-item {
39
39
  position: relative;
40
40
  }
41
- .ant-hw-form-base-item-left .ant-form-item-label > label {
42
- height: 32px;
43
- }
44
41
  .ant-hw-form-base-item-top-right .ant-form-item-label > label {
45
42
  height: auto;
46
43
  }
@@ -53,6 +50,9 @@
53
50
  .ant-hw-form-base-item-right .ant-hw-form-item-colon {
54
51
  text-align: right;
55
52
  }
53
+ .ant-hw-form-base-item-right .ant-form-item-label > label {
54
+ height: 32px;
55
+ }
56
56
  .ant-hw-form-base-item-left .ant-hw-form-item-colon {
57
57
  text-align: left;
58
58
  }
@@ -64,6 +64,9 @@
64
64
  .ant-hw-form-base-item-left .ant-hw-form-label-item {
65
65
  position: relative;
66
66
  }
67
+ .ant-hw-form-base-item-left .ant-form-item-label > label {
68
+ height: 32px;
69
+ }
67
70
  .ant-hw-form-item-no-required {
68
71
  display: none;
69
72
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hw-component/form",
3
- "version": "1.1.6",
3
+ "version": "1.1.8",
4
4
  "description": "基于antd二次开发",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,11 +26,6 @@
26
26
  position: relative;
27
27
  }
28
28
  }
29
- .@{ant-prefix}-hw-form-base-item-left {
30
- .@{ant-prefix}-form-item-label > label {
31
- height: 32px;
32
- }
33
- }
34
29
  .@{ant-prefix}-hw-form-base-item-top-right {
35
30
  .@{ant-prefix}-form-item-label > label {
36
31
  height: auto;
@@ -48,6 +43,9 @@
48
43
  .@{ant-prefix}-hw-form-item-colon {
49
44
  text-align: right;
50
45
  }
46
+ .@{ant-prefix}-form-item-label > label {
47
+ height: 32px;
48
+ }
51
49
  }
52
50
 
53
51
  .@{ant-prefix}-hw-form-base-item-left {
@@ -62,6 +60,9 @@
62
60
  .@{ant-prefix}-hw-form-label-item{
63
61
  position: relative;
64
62
  }
63
+ .@{ant-prefix}-form-item-label > label {
64
+ height: 32px;
65
+ }
65
66
  }
66
67
 
67
68
  .@{ant-prefix}-hw-form-item-no-required{
@@ -2,8 +2,8 @@ import React, { useCallback, useEffect, useMemo, useState } from "react";
2
2
  import ButtonInput from "./ButtonInput";
3
3
  import { useRequest } from "ahooks";
4
4
  import type { HFormInstance } from "../Form/modal";
5
- import type { InputProps } from "antd";
6
- export interface HVerificationCodeInputProps extends Omit<InputProps, "form"> {
5
+ import {HButtonInputProps} from "@/components/Input/modal";
6
+ export interface HVerificationCodeInputProps extends Omit<HButtonInputProps, "form"> {
7
7
  request?: (value: any) => Promise<any>;
8
8
  form?: HFormInstance;
9
9
  }
@@ -12,6 +12,7 @@ export default ({
12
12
  request,
13
13
  form,
14
14
  onChange,
15
+ buttonProps={},
15
16
  ...props
16
17
  }: HVerificationCodeInputProps) => {
17
18
  const [countdown, setCountdown] = useState<number>(0);
@@ -61,11 +62,16 @@ export default ({
61
62
  }
62
63
  return `${countdownStr}秒后重新获取`;
63
64
  };
65
+ const defaultButtonProps={
66
+ onClick: run,
67
+ loading,
68
+ disabled: !!countdown
69
+ }
64
70
  return (
65
71
  <ButtonInput
66
72
  value={value}
67
73
  onChange={onChange}
68
- buttonProps={{ onClick: run, loading, disabled: !!countdown }}
74
+ buttonProps={{...defaultButtonProps,...buttonProps}}
69
75
  {...props}
70
76
  >
71
77
  {text()}
@@ -29,7 +29,7 @@ export interface HSelectInputProps
29
29
  subParams?: (formatValue: Record<string, any>) => any;
30
30
  }
31
31
  export interface HButtonProps extends Omit<ButtonProps, "onClick"> {
32
- onClick: (
32
+ onClick?: (
33
33
  value: string | readonly string[] | number | undefined,
34
34
  onChange?: (val: any) => void
35
35
  ) => void;
@@ -1,5 +1,6 @@
1
1
  import { HForm, HFormConfigProvider, useHForm } from "../../components";
2
2
  import { Button, Form, Input } from "antd";
3
+ import React from "react";
3
4
 
4
5
  const formData = () => {
5
6
  return [
@@ -73,6 +74,26 @@ const formData = () => {
73
74
  ],
74
75
  },
75
76
  },
77
+ {
78
+ type: "verificationCodeInput",
79
+ name:"verificationCodeInput",
80
+ label:"验证码",
81
+ shouldUpdate:(prevValue,curValue)=>{
82
+ return prevValue.switch!==curValue.switch;
83
+ },
84
+ itemProps: {
85
+ request:()=>{
86
+ return Promise.resolve({});
87
+ }
88
+ },
89
+ render:(item,node,form)=>{
90
+ const phone=form.getFieldValue("switch");
91
+ if (!phone){
92
+ return React.cloneElement(node,{buttonProps:{ghost: true,disabled:true}});
93
+ }
94
+ return React.cloneElement(node,{buttonProps:{ghost:true}})
95
+ }
96
+ },
76
97
  {
77
98
  type: "submit",
78
99
  itemProps: {