@hw-component/form 1.9.94 → 1.9.98

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,2 +1,3 @@
1
- declare const _default: import("react").ForwardRefExoticComponent<import("../Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
1
+ import React from "react";
2
+ declare const _default: React.ForwardRefExoticComponent<import("../Form/modal").HFormItemProps & React.RefAttributes<any>>;
2
3
  export default _default;
@@ -1,12 +1,13 @@
1
1
  // welcome to hoo hoo hoo
2
2
  import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
3
3
  import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
4
- import { jsx } from 'react/jsx-runtime';
5
- import { TimePicker } from 'antd';
4
+ import { jsxs, jsx } from 'react/jsx-runtime';
5
+ import { Input, TimePicker } from 'antd';
6
6
  import { useTimePickerValue, useTimePickerChange } from './hooks.js';
7
7
  import HFormConnect from '../Form/HFormConnect.js';
8
+ import { useClassName } from '../hooks/index.js';
8
9
 
9
- var _excluded = ["value", "format", "onChange", "addFormat", "disabledDate"];
10
+ var _excluded = ["value", "format", "onChange", "addFormat", "disabledDate", "addonBefore", "style", "addonAfter"];
10
11
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
11
12
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
12
13
  var Index = function Index(_ref) {
@@ -16,6 +17,9 @@ var Index = function Index(_ref) {
16
17
  onChange = _ref.onChange,
17
18
  addFormat = _ref.addFormat,
18
19
  _disabledDate = _ref.disabledDate,
20
+ addonBefore = _ref.addonBefore,
21
+ style = _ref.style,
22
+ addonAfter = _ref.addonAfter,
19
23
  props = _objectWithoutProperties(_ref, _excluded);
20
24
  addFormat === null || addFormat === void 0 || addFormat({});
21
25
  var timeVal = useTimePickerValue({
@@ -27,16 +31,29 @@ var Index = function Index(_ref) {
27
31
  format: format,
28
32
  onChange: onChange
29
33
  });
30
- return jsx(TimePicker, _objectSpread({
31
- value: timeVal,
32
- onChange: change,
33
- disabledDate: function disabledDate(currentDate) {
34
- return !!(_disabledDate !== null && _disabledDate !== void 0 && _disabledDate(currentDate, timeVal));
35
- },
36
- style: {
37
- width: "100%"
38
- }
39
- }, props));
34
+ var addonClassName = useClassName("hw-addon");
35
+ return jsxs(Input.Group, {
36
+ compact: true,
37
+ style: _objectSpread({
38
+ display: "flex"
39
+ }, style),
40
+ children: [addonBefore ? jsx("div", {
41
+ className: addonClassName,
42
+ children: addonBefore
43
+ }) : null, jsx(TimePicker, _objectSpread({
44
+ value: timeVal,
45
+ onChange: change,
46
+ disabledDate: function disabledDate(currentDate) {
47
+ return !!(_disabledDate !== null && _disabledDate !== void 0 && _disabledDate(currentDate, timeVal));
48
+ },
49
+ style: {
50
+ flex: 1
51
+ }
52
+ }, props)), addonAfter ? jsx("div", {
53
+ className: addonClassName,
54
+ children: addonAfter
55
+ }) : null]
56
+ });
40
57
  };
41
58
  var HTimePicker = HFormConnect(Index);
42
59
 
@@ -38,6 +38,8 @@ export interface HTimePickerProps extends Omit<TimePickerProps, "onChange" | "fo
38
38
  format?: DurationInputArg2 | string;
39
39
  disabledDate?: DisabledDateFnModal;
40
40
  addFormat?: (config: Record<string, addFormatItemModal>) => void;
41
+ addonBefore?: React.ReactNode;
42
+ addonAfter?: React.ReactNode;
41
43
  }
42
44
  export interface HTimeRangePickerProps extends Omit<TimeRangePickerProps, "format"> {
43
45
  valueMap?: {
@@ -1,2 +1,3 @@
1
- declare const _default: import("react").ForwardRefExoticComponent<import("../Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
1
+ import React from "react";
2
+ declare const _default: React.ForwardRefExoticComponent<import("../Form/modal").HFormItemProps & React.RefAttributes<any>>;
2
3
  export default _default;
@@ -8,8 +8,9 @@ var jsxRuntime = require('react/jsx-runtime');
8
8
  var antd = require('antd');
9
9
  var hooks = require('./hooks.js');
10
10
  var HFormConnect = require('../Form/HFormConnect.js');
11
+ var index = require('../hooks/index.js');
11
12
 
12
- var _excluded = ["value", "format", "onChange", "addFormat", "disabledDate"];
13
+ var _excluded = ["value", "format", "onChange", "addFormat", "disabledDate", "addonBefore", "style", "addonAfter"];
13
14
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
14
15
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
15
16
  var Index = function Index(_ref) {
@@ -19,6 +20,9 @@ var Index = function Index(_ref) {
19
20
  onChange = _ref.onChange,
20
21
  addFormat = _ref.addFormat,
21
22
  _disabledDate = _ref.disabledDate,
23
+ addonBefore = _ref.addonBefore,
24
+ style = _ref.style,
25
+ addonAfter = _ref.addonAfter,
22
26
  props = _objectWithoutProperties(_ref, _excluded);
23
27
  addFormat === null || addFormat === void 0 || addFormat({});
24
28
  var timeVal = hooks.useTimePickerValue({
@@ -30,16 +34,29 @@ var Index = function Index(_ref) {
30
34
  format: format,
31
35
  onChange: onChange
32
36
  });
33
- return jsxRuntime.jsx(antd.TimePicker, _objectSpread({
34
- value: timeVal,
35
- onChange: change,
36
- disabledDate: function disabledDate(currentDate) {
37
- return !!(_disabledDate !== null && _disabledDate !== void 0 && _disabledDate(currentDate, timeVal));
38
- },
39
- style: {
40
- width: "100%"
41
- }
42
- }, props));
37
+ var addonClassName = index.useClassName("hw-addon");
38
+ return jsxRuntime.jsxs(antd.Input.Group, {
39
+ compact: true,
40
+ style: _objectSpread({
41
+ display: "flex"
42
+ }, style),
43
+ children: [addonBefore ? jsxRuntime.jsx("div", {
44
+ className: addonClassName,
45
+ children: addonBefore
46
+ }) : null, jsxRuntime.jsx(antd.TimePicker, _objectSpread({
47
+ value: timeVal,
48
+ onChange: change,
49
+ disabledDate: function disabledDate(currentDate) {
50
+ return !!(_disabledDate !== null && _disabledDate !== void 0 && _disabledDate(currentDate, timeVal));
51
+ },
52
+ style: {
53
+ flex: 1
54
+ }
55
+ }, props)), addonAfter ? jsxRuntime.jsx("div", {
56
+ className: addonClassName,
57
+ children: addonAfter
58
+ }) : null]
59
+ });
43
60
  };
44
61
  var HTimePicker = HFormConnect.default(Index);
45
62
 
@@ -38,6 +38,8 @@ export interface HTimePickerProps extends Omit<TimePickerProps, "onChange" | "fo
38
38
  format?: DurationInputArg2 | string;
39
39
  disabledDate?: DisabledDateFnModal;
40
40
  addFormat?: (config: Record<string, addFormatItemModal>) => void;
41
+ addonBefore?: React.ReactNode;
42
+ addonAfter?: React.ReactNode;
41
43
  }
42
44
  export interface HTimeRangePickerProps extends Omit<TimeRangePickerProps, "format"> {
43
45
  valueMap?: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hw-component/form",
3
- "version": "1.9.94",
3
+ "version": "1.9.98",
4
4
  "description": "基于antd二次开发",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,7 +1,9 @@
1
- import { TimePicker } from "antd";
1
+ import { TimePicker ,Input} from "antd";
2
2
  import type { HTimePickerProps } from "./modal";
3
3
  import { useTimePickerChange, useTimePickerValue } from "./hooks";
4
4
  import HFormConnect from "../Form/HFormConnect";
5
+ import React from "react";
6
+ import {useClassName} from "@/components/hooks";
5
7
 
6
8
  const Index = ({
7
9
  value,
@@ -9,13 +11,19 @@ const Index = ({
9
11
  onChange,
10
12
  addFormat,
11
13
  disabledDate,
14
+ addonBefore,
15
+ style,
16
+ addonAfter,
12
17
  ...props
13
18
  }: HTimePickerProps) => {
14
19
  addFormat?.({});
15
20
  const timeVal = useTimePickerValue({ value, format });
16
21
  const change = useTimePickerChange({ value, format, onChange });
22
+ const addonClassName=useClassName("hw-addon")
17
23
 
18
24
  return (
25
+ <Input.Group compact style={{display:"flex",...style}}>
26
+ {addonBefore? <div className={addonClassName}>{addonBefore}</div>:null}
19
27
  <TimePicker
20
28
  value={timeVal}
21
29
  onChange={change}
@@ -23,10 +31,12 @@ const Index = ({
23
31
  return !!disabledDate?.(currentDate, timeVal);
24
32
  }}
25
33
  style={{
26
- width: "100%",
34
+ flex:1
27
35
  }}
28
36
  {...props}
29
37
  />
38
+ {addonAfter? <div className={addonClassName}>{addonAfter}</div>:null}
39
+ </Input.Group>
30
40
  );
31
41
  };
32
42
  export default HFormConnect(Index);
@@ -50,6 +50,8 @@ export interface HTimePickerProps
50
50
  format?: DurationInputArg2 | string;
51
51
  disabledDate?: DisabledDateFnModal;
52
52
  addFormat?: (config: Record<string, addFormatItemModal>) => void;
53
+ addonBefore?:React.ReactNode;
54
+ addonAfter?:React.ReactNode;
53
55
  }
54
56
 
55
57
  export interface HTimeRangePickerProps extends Omit<TimeRangePickerProps, "format">{
@@ -30,6 +30,8 @@ export default () => {
30
30
  />
31
31
  <HTimePicker
32
32
  value={55135}
33
+ addonBefore="你好"
34
+ addonAfter="我很好"
33
35
  onChange={(val) => {
34
36
  console.log(val);
35
37
  }}