@ecoding/components.antd 0.4.0 → 0.4.1

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.
@@ -0,0 +1,15 @@
1
+ import React from "react";
2
+ import type { InputNumberProps } from "antd";
3
+ interface IProps extends InputNumberProps {
4
+ placeholder?: string;
5
+ value?: string;
6
+ onChange?: any;
7
+ className?: string;
8
+ style?: React.CSSProperties;
9
+ disabled?: boolean;
10
+ min?: number;
11
+ max?: number;
12
+ precision?: number;
13
+ }
14
+ declare const NumberInput: React.FC<IProps>;
15
+ export default NumberInput;
@@ -0,0 +1,20 @@
1
+ import React from "react";
2
+ import { InputNumber } from "antd";
3
+ const NumberInput = (props) => {
4
+ const { precision } = props;
5
+ const formatter = (value, precision) => {
6
+ let [start, end] = `${value}`.split('.') || [];
7
+ if (precision) {
8
+ end = (end === null || end === void 0 ? void 0 : end.substring(0, precision)) || '';
9
+ }
10
+ return `${end ? `${start}.${end}` : `${start}`}`;
11
+ };
12
+ const style = Object.assign({
13
+ width: '100%',
14
+ }, props.style ? props.style : {});
15
+ return (React.createElement(InputNumber, Object.assign({ style: style, formatter: precision ? (value) => formatter(value, precision) : undefined }, props)));
16
+ };
17
+ NumberInput.defaultProps = {
18
+ max: 30
19
+ };
20
+ export default NumberInput;
package/lib/index.d.ts CHANGED
@@ -6,6 +6,7 @@ export { default as InjectNotification } from "./core/inject-notification";
6
6
  export { default as Confirm } from "./core/confirm";
7
7
  export { default as AsyncCascader } from "./core/async-cascader";
8
8
  export { default as LengthInput } from "./core/length-input";
9
+ export { default as NumberInput } from "./core/number-input";
9
10
  export { default as LengthInputTextArea } from "./core/length-input-textarea";
10
11
  export { default as SearchInput } from "./core/search.input";
11
12
  export { default as PhoneInput } from "./core/phone-input";
package/lib/index.js CHANGED
@@ -6,6 +6,7 @@ export { default as InjectNotification } from "./core/inject-notification";
6
6
  export { default as Confirm } from "./core/confirm";
7
7
  export { default as AsyncCascader } from "./core/async-cascader";
8
8
  export { default as LengthInput } from "./core/length-input";
9
+ export { default as NumberInput } from "./core/number-input";
9
10
  export { default as LengthInputTextArea } from "./core/length-input-textarea";
10
11
  export { default as SearchInput } from "./core/search.input";
11
12
  export { default as PhoneInput } from "./core/phone-input";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecoding/components.antd",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "author": "cxc",
5
5
  "homepage": "",
6
6
  "license": "MIT",
@@ -47,5 +47,5 @@
47
47
  "antd": "5.27.0",
48
48
  "axios": "^1.1.2"
49
49
  },
50
- "gitHead": "03794f7f95481697dbad2c9868a39f8facb68c98"
50
+ "gitHead": "335bbcfb186e62a67a1d24a0c0c99e0548a82cc1"
51
51
  }