@hw-component/form 1.7.5 → 1.7.7
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.
- package/es/Form/FormItem/BasicItem.js +3 -3
- package/es/Form/FormItem/RegularFormItem.js +0 -1
- package/es/Form/FormItem/hooks.d.ts +2 -1
- package/es/Form/FormItem/hooks.js +4 -1
- package/es/Form/modal.d.ts +2 -1
- package/es/TDPicker/hooks.js +0 -1
- package/lib/Form/FormItem/BasicItem.js +2 -2
- package/lib/Form/FormItem/RegularFormItem.js +0 -1
- package/lib/Form/FormItem/hooks.d.ts +2 -1
- package/lib/Form/FormItem/hooks.js +4 -0
- package/lib/Form/modal.d.ts +2 -1
- package/lib/TDPicker/hooks.js +0 -1
- package/package.json +1 -1
- package/src/components/Form/FormItem/BasicItem.tsx +3 -3
- package/src/components/Form/FormItem/RegularFormItem.tsx +0 -1
- package/src/components/Form/FormItem/hooks.tsx +8 -1
- package/src/components/Form/modal.ts +2 -1
- package/src/components/TDPicker/hooks.ts +0 -1
- package/src/pages/Form/index.tsx +6 -0
|
@@ -15,7 +15,7 @@ import { Col, Form, Space } from 'antd';
|
|
|
15
15
|
import React from 'react';
|
|
16
16
|
import Index$2 from './Helper.js';
|
|
17
17
|
import { useClassName } from '../../hooks/index.js';
|
|
18
|
-
import { usePositionClassName, useHide, useFormItemLabel } from './hooks.js';
|
|
18
|
+
import { usePositionClassName, useHide, useFormItemLabel, useFormItemHover } from './hooks.js';
|
|
19
19
|
import { useFormContext } from '../Context/index.js';
|
|
20
20
|
import { useDefaultRender } from '../hooks/useDefaultRender.js';
|
|
21
21
|
import { useDefaultComponents } from '../hooks/index.js';
|
|
@@ -93,16 +93,16 @@ var Index = function Index(props) {
|
|
|
93
93
|
form: form
|
|
94
94
|
});
|
|
95
95
|
var formItemLabel = useFormItemLabel(form, label);
|
|
96
|
+
var itemHover = useFormItemHover(form, hover);
|
|
96
97
|
if (hideItem) {
|
|
97
98
|
return null;
|
|
98
99
|
}
|
|
99
|
-
console.log(colon, align, "lllll", className);
|
|
100
100
|
return jsx(Col, _objectSpread(_objectSpread({}, itemSpan), {}, {
|
|
101
101
|
className: "".concat(colClassName, " ").concat(itemClassName),
|
|
102
102
|
children: jsx(Form.Item, _objectSpread(_objectSpread({
|
|
103
103
|
className: className,
|
|
104
104
|
label: !hideLabel && jsx(Index$1, {
|
|
105
|
-
hover:
|
|
105
|
+
hover: itemHover,
|
|
106
106
|
labelWidth: labelWidth,
|
|
107
107
|
required: required,
|
|
108
108
|
colon: colon,
|
|
@@ -16,7 +16,6 @@ var RegularFormItem = (function (props) {
|
|
|
16
16
|
var type = props.type,
|
|
17
17
|
colon = props.colon,
|
|
18
18
|
itemSpan = props.itemSpan;
|
|
19
|
-
console.log(props, "....pppp");
|
|
20
19
|
return jsx(Index, _objectSpread(_objectSpread({}, props), {}, {
|
|
21
20
|
itemSpan: itemSpan,
|
|
22
21
|
colon: type === "submit" ? false : colon
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type React from "react";
|
|
2
|
-
import type { HFormInstance, HItemProps } from "../modal";
|
|
2
|
+
import type { HFormInstance, HItemProps, HoverFn, HoverModal } from "../modal";
|
|
3
3
|
import type { LabelAlignModal } from "../modal";
|
|
4
4
|
import type { HelperModal } from "../modal";
|
|
5
5
|
export declare const useFormItemDomControl: ({ shouldUpdate, hide, dependencies, }: HItemProps) => ({ shouldUpdate, dependencies, hide, itemSpan, ...props }: import("../modal").HFormItemProps) => JSX.Element;
|
|
@@ -10,4 +10,5 @@ export declare const useShouldUpdate: ({ hide, shouldUpdate, }: Omit<HItemProps,
|
|
|
10
10
|
export declare const useHide: ({ hide, form }: UseHideUpItemModal) => boolean;
|
|
11
11
|
export declare const usePositionClassName: (position: LabelAlignModal) => string;
|
|
12
12
|
export declare const useFormItemLabel: (form: HFormInstance, label?: React.ReactNode | HelperModal) => any;
|
|
13
|
+
export declare const useFormItemHover: (form: HFormInstance, hover?: string | HoverModal | HoverFn) => string | HoverModal | undefined;
|
|
13
14
|
export {};
|
|
@@ -48,6 +48,9 @@ var usePositionClassName = function usePositionClassName(position) {
|
|
|
48
48
|
var useFormItemLabel = function useFormItemLabel(form, label) {
|
|
49
49
|
return typeof label === "function" ? label(form) : label;
|
|
50
50
|
};
|
|
51
|
+
var useFormItemHover = function useFormItemHover(form, hover) {
|
|
52
|
+
return typeof hover === "function" ? hover(form) : hover;
|
|
53
|
+
};
|
|
51
54
|
|
|
52
|
-
export { useFormItemDomControl, useFormItemLabel, useHide, usePositionClassName, useShouldUpdate };
|
|
55
|
+
export { useFormItemDomControl, useFormItemHover, useFormItemLabel, useHide, usePositionClassName, useShouldUpdate };
|
|
53
56
|
// powered by hdj
|
package/es/Form/modal.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export interface HoverModal {
|
|
|
23
23
|
text?: string;
|
|
24
24
|
icon?: React.ReactNode;
|
|
25
25
|
}
|
|
26
|
+
export type HoverFn = (form: HFormInstance) => string | HoverModal;
|
|
26
27
|
export type HelperModal = (form: HFormInstance) => React.ReactNode | string;
|
|
27
28
|
export type HideModal = (form: HFormInstance) => boolean;
|
|
28
29
|
export type AddDispatchListenerFn = (action: ActionModal, fn: argsFn) => void;
|
|
@@ -39,7 +40,7 @@ export interface HItemProps extends Omit<FormItemProps, "name" | "labelAlign" |
|
|
|
39
40
|
itemProps?: ItemPropsType;
|
|
40
41
|
render?: RenderFun;
|
|
41
42
|
helper?: HelperModal | React.ReactNode;
|
|
42
|
-
hover?: string | HoverModal;
|
|
43
|
+
hover?: string | HoverModal | HoverFn;
|
|
43
44
|
labelWidth?: number;
|
|
44
45
|
hide?: boolean | HideModal;
|
|
45
46
|
placeholder?: string | string[];
|
package/es/TDPicker/hooks.js
CHANGED
|
@@ -96,16 +96,16 @@ var Index = function Index(props) {
|
|
|
96
96
|
form: form
|
|
97
97
|
});
|
|
98
98
|
var formItemLabel = hooks.useFormItemLabel(form, label);
|
|
99
|
+
var itemHover = hooks.useFormItemHover(form, hover);
|
|
99
100
|
if (hideItem) {
|
|
100
101
|
return null;
|
|
101
102
|
}
|
|
102
|
-
console.log(colon, align, "lllll", className);
|
|
103
103
|
return jsxRuntime.jsx(antd.Col, _objectSpread(_objectSpread({}, itemSpan), {}, {
|
|
104
104
|
className: "".concat(colClassName, " ").concat(itemClassName),
|
|
105
105
|
children: jsxRuntime.jsx(antd.Form.Item, _objectSpread(_objectSpread({
|
|
106
106
|
className: className,
|
|
107
107
|
label: !hideLabel && jsxRuntime.jsx(Label.default, {
|
|
108
|
-
hover:
|
|
108
|
+
hover: itemHover,
|
|
109
109
|
labelWidth: labelWidth,
|
|
110
110
|
required: required,
|
|
111
111
|
colon: colon,
|
|
@@ -19,7 +19,6 @@ var RegularFormItem = (function (props) {
|
|
|
19
19
|
var type = props.type,
|
|
20
20
|
colon = props.colon,
|
|
21
21
|
itemSpan = props.itemSpan;
|
|
22
|
-
console.log(props, "....pppp");
|
|
23
22
|
return jsxRuntime.jsx(BasicItem.default, _objectSpread(_objectSpread({}, props), {}, {
|
|
24
23
|
itemSpan: itemSpan,
|
|
25
24
|
colon: type === "submit" ? false : colon
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type React from "react";
|
|
2
|
-
import type { HFormInstance, HItemProps } from "../modal";
|
|
2
|
+
import type { HFormInstance, HItemProps, HoverFn, HoverModal } from "../modal";
|
|
3
3
|
import type { LabelAlignModal } from "../modal";
|
|
4
4
|
import type { HelperModal } from "../modal";
|
|
5
5
|
export declare const useFormItemDomControl: ({ shouldUpdate, hide, dependencies, }: HItemProps) => ({ shouldUpdate, dependencies, hide, itemSpan, ...props }: import("../modal").HFormItemProps) => JSX.Element;
|
|
@@ -10,4 +10,5 @@ export declare const useShouldUpdate: ({ hide, shouldUpdate, }: Omit<HItemProps,
|
|
|
10
10
|
export declare const useHide: ({ hide, form }: UseHideUpItemModal) => boolean;
|
|
11
11
|
export declare const usePositionClassName: (position: LabelAlignModal) => string;
|
|
12
12
|
export declare const useFormItemLabel: (form: HFormInstance, label?: React.ReactNode | HelperModal) => any;
|
|
13
|
+
export declare const useFormItemHover: (form: HFormInstance, hover?: string | HoverModal | HoverFn) => string | HoverModal | undefined;
|
|
13
14
|
export {};
|
|
@@ -49,8 +49,12 @@ var usePositionClassName = function usePositionClassName(position) {
|
|
|
49
49
|
var useFormItemLabel = function useFormItemLabel(form, label) {
|
|
50
50
|
return typeof label === "function" ? label(form) : label;
|
|
51
51
|
};
|
|
52
|
+
var useFormItemHover = function useFormItemHover(form, hover) {
|
|
53
|
+
return typeof hover === "function" ? hover(form) : hover;
|
|
54
|
+
};
|
|
52
55
|
|
|
53
56
|
exports.useFormItemDomControl = useFormItemDomControl;
|
|
57
|
+
exports.useFormItemHover = useFormItemHover;
|
|
54
58
|
exports.useFormItemLabel = useFormItemLabel;
|
|
55
59
|
exports.useHide = useHide;
|
|
56
60
|
exports.usePositionClassName = usePositionClassName;
|
package/lib/Form/modal.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export interface HoverModal {
|
|
|
23
23
|
text?: string;
|
|
24
24
|
icon?: React.ReactNode;
|
|
25
25
|
}
|
|
26
|
+
export type HoverFn = (form: HFormInstance) => string | HoverModal;
|
|
26
27
|
export type HelperModal = (form: HFormInstance) => React.ReactNode | string;
|
|
27
28
|
export type HideModal = (form: HFormInstance) => boolean;
|
|
28
29
|
export type AddDispatchListenerFn = (action: ActionModal, fn: argsFn) => void;
|
|
@@ -39,7 +40,7 @@ export interface HItemProps extends Omit<FormItemProps, "name" | "labelAlign" |
|
|
|
39
40
|
itemProps?: ItemPropsType;
|
|
40
41
|
render?: RenderFun;
|
|
41
42
|
helper?: HelperModal | React.ReactNode;
|
|
42
|
-
hover?: string | HoverModal;
|
|
43
|
+
hover?: string | HoverModal | HoverFn;
|
|
43
44
|
labelWidth?: number;
|
|
44
45
|
hide?: boolean | HideModal;
|
|
45
46
|
placeholder?: string | string[];
|
package/lib/TDPicker/hooks.js
CHANGED
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@ import { Form, Space, Col } from "antd";
|
|
|
3
3
|
import React from "react";
|
|
4
4
|
import Helper from "./Helper";
|
|
5
5
|
import { useClassName } from "../../hooks";
|
|
6
|
-
import { useFormItemLabel, useHide, usePositionClassName
|
|
6
|
+
import {useFormItemHover, useFormItemLabel, useHide, usePositionClassName} from "./hooks";
|
|
7
7
|
import { useFormContext } from "../Context";
|
|
8
8
|
import type { HItemProps } from "../modal";
|
|
9
9
|
import { useDefaultRender } from "../hooks/useDefaultRender";
|
|
@@ -68,10 +68,10 @@ const Index: React.FC<HFormItemProps> = (props) => {
|
|
|
68
68
|
const className = usePositionClassName(align);
|
|
69
69
|
const hideItem = useHide({ hide, form });
|
|
70
70
|
const formItemLabel = useFormItemLabel(form, label);
|
|
71
|
+
const itemHover=useFormItemHover(form,hover)
|
|
71
72
|
if (hideItem) {
|
|
72
73
|
return null;
|
|
73
74
|
}
|
|
74
|
-
console.log(colon,align,"lllll",className)
|
|
75
75
|
return (
|
|
76
76
|
<Col {...itemSpan} className={`${colClassName} ${itemClassName}`}>
|
|
77
77
|
<Form.Item
|
|
@@ -79,7 +79,7 @@ const Index: React.FC<HFormItemProps> = (props) => {
|
|
|
79
79
|
label={
|
|
80
80
|
!hideLabel && (
|
|
81
81
|
<Label
|
|
82
|
-
hover={
|
|
82
|
+
hover={itemHover}
|
|
83
83
|
labelWidth={labelWidth}
|
|
84
84
|
required={required}
|
|
85
85
|
colon={colon}
|
|
@@ -2,7 +2,7 @@ import UpFormItem from "./UpFormItem";
|
|
|
2
2
|
import RegularFormItem from "./RegularFormItem";
|
|
3
3
|
import type React from "react";
|
|
4
4
|
import { useMemo } from "react";
|
|
5
|
-
import type {
|
|
5
|
+
import type {HFormInstance, HItemProps, HoverFn, HoverModal} from "../modal";
|
|
6
6
|
import type { LabelAlignModal } from "../modal";
|
|
7
7
|
import { useClassName } from "../../hooks";
|
|
8
8
|
import type { HelperModal } from "../modal";
|
|
@@ -61,3 +61,10 @@ export const useFormItemLabel = (
|
|
|
61
61
|
) => {
|
|
62
62
|
return typeof label === "function" ? label(form) : label;
|
|
63
63
|
};
|
|
64
|
+
|
|
65
|
+
export const useFormItemHover = (
|
|
66
|
+
form: HFormInstance,
|
|
67
|
+
hover?:string|HoverModal|HoverFn
|
|
68
|
+
) => {
|
|
69
|
+
return typeof hover === "function" ? hover(form) : hover;
|
|
70
|
+
};
|
|
@@ -62,6 +62,7 @@ export interface HoverModal {
|
|
|
62
62
|
text?: string;
|
|
63
63
|
icon?: React.ReactNode;
|
|
64
64
|
}
|
|
65
|
+
export type HoverFn=(form: HFormInstance)=>string|HoverModal
|
|
65
66
|
export type HelperModal = (form: HFormInstance) => React.ReactNode | string;
|
|
66
67
|
|
|
67
68
|
export type HideModal = (form: HFormInstance) => boolean;
|
|
@@ -85,7 +86,7 @@ export interface HItemProps
|
|
|
85
86
|
itemProps?: ItemPropsType;
|
|
86
87
|
render?: RenderFun;
|
|
87
88
|
helper?: HelperModal | React.ReactNode;
|
|
88
|
-
hover?: string | HoverModal;
|
|
89
|
+
hover?: string | HoverModal|HoverFn;
|
|
89
90
|
// formItems?: HItemProps[]; 保留感觉没必要
|
|
90
91
|
labelWidth?: number;
|
|
91
92
|
hide?: boolean | HideModal;
|
|
@@ -151,7 +151,6 @@ export const useRangePickerTimeVal = ({
|
|
|
151
151
|
if (!Array.isArray(value)) {
|
|
152
152
|
const { start, end } = valueMap;
|
|
153
153
|
if (!start || !end) {
|
|
154
|
-
console.error("日期value格式错误!");
|
|
155
154
|
return;
|
|
156
155
|
}
|
|
157
156
|
const { [start as string]: startTime, [end as string]: endTime } = value;
|
package/src/pages/Form/index.tsx
CHANGED