@hw-component/form 1.9.47 → 1.9.48

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.
@@ -18,8 +18,9 @@ import type { ColProps } from "antd/lib/grid/col";
18
18
  import type { Gutter } from "antd/lib/grid/row";
19
19
  import type { IUrlUploadProps } from "../Upload/modal";
20
20
  import type { BaseOptions } from "@ahooksjs/use-request/lib/types";
21
+ import { HFormTextProps } from "../Text";
21
22
  type RenderFun = (props: HItemProps, node: React.ReactNode, form: FormInstance) => React.ReactNode;
22
- export type ItemPropsType = HCheckboxProps | HInputProps | HSelectInputProps | HButtonProps | HRadioGroupProps | HSelectProps | ButtonProps | HSwitchProps | HDatePickerProps | HRangePickerProps | HTimePickerProps | TextAreaProps | IUpLoadProps | CascaderProps<any> | IUrlUploadProps;
23
+ export type ItemPropsType = HCheckboxProps | HInputProps | HSelectInputProps | HButtonProps | HRadioGroupProps | HSelectProps | ButtonProps | HSwitchProps | HDatePickerProps | HRangePickerProps | HTimePickerProps | TextAreaProps | IUpLoadProps | CascaderProps<any> | IUrlUploadProps | HFormTextProps;
23
24
  export interface HoverModal {
24
25
  text?: string;
25
26
  icon?: React.ReactNode;
@@ -1,3 +1,9 @@
1
- import type { HFormItemProps } from "../Form/modal";
2
- declare const _default: ({ value }: HFormItemProps) => JSX.Element;
1
+ import { TextProps } from "antd/lib/typography/Text";
2
+ import React from "react";
3
+ export interface HFormTextProps<V = any> extends TextProps {
4
+ value?: V;
5
+ addonBefore?: React.ReactNode;
6
+ addonAfter?: React.ReactNode;
7
+ }
8
+ declare const _default: ({ value, addonBefore, addonAfter, ...props }: HFormTextProps) => JSX.Element;
3
9
  export default _default;
package/es/Text/index.js CHANGED
@@ -1,12 +1,29 @@
1
1
  // welcome to hoo hoo hoo
2
- import { jsx } from 'react/jsx-runtime';
3
- import { Typography } from 'antd';
2
+ import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
3
+ import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
4
+ import { jsx, jsxs } from 'react/jsx-runtime';
5
+ import { Typography, Space } from 'antd';
4
6
 
7
+ var _excluded = ["value", "addonBefore", "addonAfter"];
8
+ 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; }
9
+ 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; }
5
10
  var HText = (function (_ref) {
6
- var value = _ref.value;
7
- return jsx(Typography.Text, {
8
- children: value
9
- });
11
+ var value = _ref.value,
12
+ addonBefore = _ref.addonBefore,
13
+ addonAfter = _ref.addonAfter,
14
+ props = _objectWithoutProperties(_ref, _excluded);
15
+ return jsx(Typography.Text, _objectSpread(_objectSpread({}, props), {}, {
16
+ children: jsxs(Space, {
17
+ size: 2,
18
+ children: [jsx("div", {
19
+ children: addonBefore
20
+ }), jsx("div", {
21
+ children: value
22
+ }), jsx("div", {
23
+ children: addonAfter
24
+ })]
25
+ })
26
+ }));
10
27
  });
11
28
 
12
29
  export { HText as default };
@@ -18,8 +18,9 @@ import type { ColProps } from "antd/lib/grid/col";
18
18
  import type { Gutter } from "antd/lib/grid/row";
19
19
  import type { IUrlUploadProps } from "../Upload/modal";
20
20
  import type { BaseOptions } from "@ahooksjs/use-request/lib/types";
21
+ import { HFormTextProps } from "../Text";
21
22
  type RenderFun = (props: HItemProps, node: React.ReactNode, form: FormInstance) => React.ReactNode;
22
- export type ItemPropsType = HCheckboxProps | HInputProps | HSelectInputProps | HButtonProps | HRadioGroupProps | HSelectProps | ButtonProps | HSwitchProps | HDatePickerProps | HRangePickerProps | HTimePickerProps | TextAreaProps | IUpLoadProps | CascaderProps<any> | IUrlUploadProps;
23
+ export type ItemPropsType = HCheckboxProps | HInputProps | HSelectInputProps | HButtonProps | HRadioGroupProps | HSelectProps | ButtonProps | HSwitchProps | HDatePickerProps | HRangePickerProps | HTimePickerProps | TextAreaProps | IUpLoadProps | CascaderProps<any> | IUrlUploadProps | HFormTextProps;
23
24
  export interface HoverModal {
24
25
  text?: string;
25
26
  icon?: React.ReactNode;
@@ -1,3 +1,9 @@
1
- import type { HFormItemProps } from "../Form/modal";
2
- declare const _default: ({ value }: HFormItemProps) => JSX.Element;
1
+ import { TextProps } from "antd/lib/typography/Text";
2
+ import React from "react";
3
+ export interface HFormTextProps<V = any> extends TextProps {
4
+ value?: V;
5
+ addonBefore?: React.ReactNode;
6
+ addonAfter?: React.ReactNode;
7
+ }
8
+ declare const _default: ({ value, addonBefore, addonAfter, ...props }: HFormTextProps) => JSX.Element;
3
9
  export default _default;
package/lib/Text/index.js CHANGED
@@ -2,14 +2,31 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
6
+ var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
5
7
  var jsxRuntime = require('react/jsx-runtime');
6
8
  var antd = require('antd');
7
9
 
10
+ var _excluded = ["value", "addonBefore", "addonAfter"];
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; }
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; }
8
13
  var HText = (function (_ref) {
9
- var value = _ref.value;
10
- return jsxRuntime.jsx(antd.Typography.Text, {
11
- children: value
12
- });
14
+ var value = _ref.value,
15
+ addonBefore = _ref.addonBefore,
16
+ addonAfter = _ref.addonAfter,
17
+ props = _objectWithoutProperties(_ref, _excluded);
18
+ return jsxRuntime.jsx(antd.Typography.Text, _objectSpread(_objectSpread({}, props), {}, {
19
+ children: jsxRuntime.jsxs(antd.Space, {
20
+ size: 2,
21
+ children: [jsxRuntime.jsx("div", {
22
+ children: addonBefore
23
+ }), jsxRuntime.jsx("div", {
24
+ children: value
25
+ }), jsxRuntime.jsx("div", {
26
+ children: addonAfter
27
+ })]
28
+ })
29
+ }));
13
30
  });
14
31
 
15
32
  exports.default = HText;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hw-component/form",
3
- "version": "1.9.47",
3
+ "version": "1.9.48",
4
4
  "description": "基于antd二次开发",
5
5
  "repository": {
6
6
  "type": "git",
@@ -35,8 +35,8 @@ import type { DataFnProvider } from "../modal";
35
35
  import type { ColProps } from "antd/lib/grid/col";
36
36
  import type { Gutter } from "antd/lib/grid/row";
37
37
  import type { IUrlUploadProps } from "../Upload/modal";
38
- import { NamePath } from "rc-field-form/es/interface";
39
38
  import type { BaseOptions } from "@ahooksjs/use-request/lib/types";
39
+ import {HFormTextProps} from "../Text";
40
40
 
41
41
  type RenderFun = (
42
42
  props: HItemProps,
@@ -58,7 +58,7 @@ export type ItemPropsType =
58
58
  | TextAreaProps
59
59
  | IUpLoadProps
60
60
  | CascaderProps<any>
61
- | IUrlUploadProps;
61
+ | IUrlUploadProps|HFormTextProps;
62
62
 
63
63
  export interface HoverModal {
64
64
  text?: string;
@@ -1,6 +1,19 @@
1
- import { Typography } from "antd";
2
- import type { HFormItemProps } from "../Form/modal";
3
-
4
- export default ({ value }: HFormItemProps) => {
5
- return <Typography.Text>{value}</Typography.Text>;
1
+ import {Space, Typography} from "antd";
2
+ import {TextProps} from "antd/lib/typography/Text";
3
+ import React from "react";
4
+ export interface HFormTextProps<V=any> extends TextProps{
5
+ value?: V;
6
+ addonBefore?:React.ReactNode;
7
+ addonAfter?:React.ReactNode;
8
+ }
9
+ export default ({ value ,addonBefore,addonAfter,...props}: HFormTextProps) => {
10
+ return <Typography.Text {...props}>
11
+ <Space size={2}>
12
+ <div>
13
+ {addonBefore}
14
+ </div>
15
+ <div>{value}</div>
16
+ <div>{addonAfter}</div>
17
+ </Space>
18
+ </Typography.Text>;
6
19
  };
@@ -240,19 +240,25 @@ export default () => {
240
240
  render:()=>{
241
241
  return <div style={{width:"100%",backgroundColor:'black',height:"100%"}}></div>
242
242
  }
243
+ },{
244
+ label:"文字",
245
+ type:"text",
246
+ name:"text",
247
+ itemProps:{
248
+ addonBefore:<div style={{height:100,backgroundColor:"red"}}>nihao</div>,
249
+ addonAfter:<div style={{height:200,backgroundColor:"red"}}>wohao</div>,
250
+ }
243
251
  }]}
244
252
  dismissOnPressEnter={false}
245
253
  labelWidth={88}
246
254
  form={form}
247
- itemSpan={{
248
- span:8
249
- }}
250
255
  infoRequest={{
251
256
  request: async () => {
252
257
  if (id === 1) {
253
258
  return {
254
259
  name: "你好",
255
260
  select: 1,
261
+ text:"hdj"
256
262
  };
257
263
  }
258
264
  return {};