@hw-component/form 0.0.3-beta-v2 → 0.0.3-beta-v4
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/hooks/useInitConfigData.js +5 -2
- package/es/Form/modal.d.ts +1 -1
- package/es/index.d.ts +3 -2
- package/es/index.js +1 -0
- package/lib/Form/hooks/useInitConfigData.js +5 -2
- package/lib/Form/modal.d.ts +1 -1
- package/lib/index.d.ts +3 -2
- package/lib/index.js +2 -0
- package/package.json +1 -1
- package/src/components/Form/hooks/useInitConfigData.tsx +3 -2
- package/src/components/Form/modal.ts +1 -1
- package/src/components/index.tsx +2 -0
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
// welcome to hoo hoo hoo
|
|
2
|
-
import React, { useMemo } from 'react';
|
|
3
2
|
import _Object$keys from '@babel/runtime-corejs3/core-js/object/keys';
|
|
4
3
|
import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js/object/get-own-property-symbols';
|
|
5
4
|
import _filterInstanceProperty from '@babel/runtime-corejs3/core-js/instance/filter';
|
|
@@ -13,6 +12,7 @@ import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWitho
|
|
|
13
12
|
import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
|
|
14
13
|
import _mapInstanceProperty from '@babel/runtime-corejs3/core-js/instance/map';
|
|
15
14
|
import _indexOfInstanceProperty from '@babel/runtime-corejs3/core-js/instance/index-of';
|
|
15
|
+
import React, { useMemo } from 'react';
|
|
16
16
|
import FormConfig, { placeholderConfig } from '../config.js';
|
|
17
17
|
|
|
18
18
|
var _excluded = ["render", "type", "itemProps"],
|
|
@@ -83,7 +83,10 @@ var defaultRenderMaker = function defaultRenderMaker(props) {
|
|
|
83
83
|
form: form
|
|
84
84
|
}));
|
|
85
85
|
if (render) {
|
|
86
|
-
|
|
86
|
+
var resultNode = render(props, node, form);
|
|
87
|
+
return /*#__PURE__*/React.cloneElement(resultNode, _objectSpread(_objectSpread(_objectSpread({}, componentProps), itemProps), {}, {
|
|
88
|
+
form: form
|
|
89
|
+
}));
|
|
87
90
|
}
|
|
88
91
|
return node;
|
|
89
92
|
};
|
package/es/Form/modal.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ import type { SelectProps } from "antd";
|
|
|
13
13
|
import type { RangePickerProps } from "antd/es/date-picker";
|
|
14
14
|
import type { PromiseFnResult, ValueCheckMapModal, ValueSwitchMapModal, DateRangePickerValueMapModal } from "../modal";
|
|
15
15
|
import type { ForwardedRef } from "react";
|
|
16
|
-
type RenderFun = (props: HItemProps, node: React.ReactNode, form: FormInstance) =>
|
|
16
|
+
type RenderFun = (props: HItemProps, node: React.ReactNode, form: FormInstance) => React.ReactNode;
|
|
17
17
|
type ItemPropsType = HCheckboxProps | HInputProps | HSelectInputProps | HButtonProps | HRadioGroupProps | HSelectProps | ButtonProps | HSwitchProps | HDatePickerProps | HRangePickerProps | HTimePickerProps | TextAreaProps | IUpLoadProps;
|
|
18
18
|
export interface HoverModal {
|
|
19
19
|
text?: string;
|
package/es/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import "./styles/index.less";
|
|
|
3
3
|
export { default as HForm } from "./Form";
|
|
4
4
|
export { default as useHForm } from "./Form/hooks/useHForm";
|
|
5
5
|
export { useHDialogForm } from "./DialogForm/hooks";
|
|
6
|
+
export { default as HFormConnect } from "./Form/HFormConnect";
|
|
6
7
|
export declare const HSelect: ({ style, mode, options, modeConfig, value, onChange, fieldNames: propsFieldNames, request, manual, optionLabelProp, filterProvider, optionFilterProp, serviceSearch, onSearch: propsOnSearch, filterOption, showSearch, labelInValue, noMatchItemRender, allSelect, ...props }: import("./Select/modal").HSelectProps) => JSX.Element;
|
|
7
8
|
export declare const HInput: ({ ...props }: import("antd").InputProps) => JSX.Element;
|
|
8
9
|
export declare const HSelectInput: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
@@ -20,5 +21,5 @@ export declare const HInputNumber: ({ style, ...props }: import("antd").InputNum
|
|
|
20
21
|
export declare const HPageHandler: import("react").FC<import("./PageHandler/modal").IHPageHandler<any>>;
|
|
21
22
|
export declare const HFormConfigProvider: import("react").FC<import("./Form/modal").IFormConfigContextProps>;
|
|
22
23
|
export declare const HTextArea: ({ autoSize, ...props }: import("antd/es/input").TextAreaProps) => JSX.Element;
|
|
23
|
-
export declare const HModalForm: ({ visible, title, onCancel, configData, infoRequest, request, afterClose, dialogForm, initialValues, onFinish, ...props }: import("./DialogForm/modal").DialogFormProps) => JSX.Element;
|
|
24
|
-
export declare const HDrawerForm: ({ visible, title, onCancel, configData, infoRequest, request, afterClose, dialogForm, closable, initialValues, labelWidth, onOk, onFinish, size, form, footer, ...props }: import("./DialogForm/modal").DialogFormProps) => JSX.Element;
|
|
24
|
+
export declare const HModalForm: ({ visible, title, onCancel, configData, infoRequest, request, afterClose, dialogForm, initialValues, onFinish, params, onOk, ...props }: import("./DialogForm/modal").DialogFormProps<any, any>) => JSX.Element;
|
|
25
|
+
export declare const HDrawerForm: ({ visible, title, onCancel, configData, infoRequest, request, afterClose, dialogForm, closable, initialValues, labelWidth, onOk, onFinish, size, form, footer, params, ...props }: import("./DialogForm/modal").DialogFormProps<any, any>) => JSX.Element;
|
package/es/index.js
CHANGED
|
@@ -4,6 +4,7 @@ import Index from './PageHandler/index.js';
|
|
|
4
4
|
export { default as HForm } from './Form/index.js';
|
|
5
5
|
export { default as useHForm } from './Form/hooks/useHForm.js';
|
|
6
6
|
export { useHDialogForm } from './DialogForm/hooks.js';
|
|
7
|
+
export { default as HFormConnect } from './Form/HFormConnect.js';
|
|
7
8
|
import ModalForm from './DialogForm/ModalForm.js';
|
|
8
9
|
import DrawerForm from './DialogForm/DrawerForm/index.js';
|
|
9
10
|
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var React = require('react');
|
|
6
5
|
var _Object$keys = require('@babel/runtime-corejs3/core-js/object/keys');
|
|
7
6
|
var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js/object/get-own-property-symbols');
|
|
8
7
|
var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/filter');
|
|
@@ -16,6 +15,7 @@ var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWit
|
|
|
16
15
|
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
17
16
|
var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/map');
|
|
18
17
|
var _indexOfInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/index-of');
|
|
18
|
+
var React = require('react');
|
|
19
19
|
var config = require('../config.js');
|
|
20
20
|
|
|
21
21
|
var _excluded = ["render", "type", "itemProps"],
|
|
@@ -86,7 +86,10 @@ var defaultRenderMaker = function defaultRenderMaker(props) {
|
|
|
86
86
|
form: form
|
|
87
87
|
}));
|
|
88
88
|
if (render) {
|
|
89
|
-
|
|
89
|
+
var resultNode = render(props, node, form);
|
|
90
|
+
return /*#__PURE__*/React.cloneElement(resultNode, _objectSpread(_objectSpread(_objectSpread({}, componentProps), itemProps), {}, {
|
|
91
|
+
form: form
|
|
92
|
+
}));
|
|
90
93
|
}
|
|
91
94
|
return node;
|
|
92
95
|
};
|
package/lib/Form/modal.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ import type { SelectProps } from "antd";
|
|
|
13
13
|
import type { RangePickerProps } from "antd/es/date-picker";
|
|
14
14
|
import type { PromiseFnResult, ValueCheckMapModal, ValueSwitchMapModal, DateRangePickerValueMapModal } from "../modal";
|
|
15
15
|
import type { ForwardedRef } from "react";
|
|
16
|
-
type RenderFun = (props: HItemProps, node: React.ReactNode, form: FormInstance) =>
|
|
16
|
+
type RenderFun = (props: HItemProps, node: React.ReactNode, form: FormInstance) => React.ReactNode;
|
|
17
17
|
type ItemPropsType = HCheckboxProps | HInputProps | HSelectInputProps | HButtonProps | HRadioGroupProps | HSelectProps | ButtonProps | HSwitchProps | HDatePickerProps | HRangePickerProps | HTimePickerProps | TextAreaProps | IUpLoadProps;
|
|
18
18
|
export interface HoverModal {
|
|
19
19
|
text?: string;
|
package/lib/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import "./styles/index.less";
|
|
|
3
3
|
export { default as HForm } from "./Form";
|
|
4
4
|
export { default as useHForm } from "./Form/hooks/useHForm";
|
|
5
5
|
export { useHDialogForm } from "./DialogForm/hooks";
|
|
6
|
+
export { default as HFormConnect } from "./Form/HFormConnect";
|
|
6
7
|
export declare const HSelect: ({ style, mode, options, modeConfig, value, onChange, fieldNames: propsFieldNames, request, manual, optionLabelProp, filterProvider, optionFilterProp, serviceSearch, onSearch: propsOnSearch, filterOption, showSearch, labelInValue, noMatchItemRender, allSelect, ...props }: import("./Select/modal").HSelectProps) => JSX.Element;
|
|
7
8
|
export declare const HInput: ({ ...props }: import("antd").InputProps) => JSX.Element;
|
|
8
9
|
export declare const HSelectInput: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
@@ -20,5 +21,5 @@ export declare const HInputNumber: ({ style, ...props }: import("antd").InputNum
|
|
|
20
21
|
export declare const HPageHandler: import("react").FC<import("./PageHandler/modal").IHPageHandler<any>>;
|
|
21
22
|
export declare const HFormConfigProvider: import("react").FC<import("./Form/modal").IFormConfigContextProps>;
|
|
22
23
|
export declare const HTextArea: ({ autoSize, ...props }: import("antd/es/input").TextAreaProps) => JSX.Element;
|
|
23
|
-
export declare const HModalForm: ({ visible, title, onCancel, configData, infoRequest, request, afterClose, dialogForm, initialValues, onFinish, ...props }: import("./DialogForm/modal").DialogFormProps) => JSX.Element;
|
|
24
|
-
export declare const HDrawerForm: ({ visible, title, onCancel, configData, infoRequest, request, afterClose, dialogForm, closable, initialValues, labelWidth, onOk, onFinish, size, form, footer, ...props }: import("./DialogForm/modal").DialogFormProps) => JSX.Element;
|
|
24
|
+
export declare const HModalForm: ({ visible, title, onCancel, configData, infoRequest, request, afterClose, dialogForm, initialValues, onFinish, params, onOk, ...props }: import("./DialogForm/modal").DialogFormProps<any, any>) => JSX.Element;
|
|
25
|
+
export declare const HDrawerForm: ({ visible, title, onCancel, configData, infoRequest, request, afterClose, dialogForm, closable, initialValues, labelWidth, onOk, onFinish, size, form, footer, params, ...props }: import("./DialogForm/modal").DialogFormProps<any, any>) => JSX.Element;
|
package/lib/index.js
CHANGED
|
@@ -5,6 +5,7 @@ var index$1 = require('./PageHandler/index.js');
|
|
|
5
5
|
var index = require('./Form/index.js');
|
|
6
6
|
var useHForm = require('./Form/hooks/useHForm.js');
|
|
7
7
|
var hooks = require('./DialogForm/hooks.js');
|
|
8
|
+
var HFormConnect = require('./Form/HFormConnect.js');
|
|
8
9
|
var ModalForm = require('./DialogForm/ModalForm.js');
|
|
9
10
|
var index$2 = require('./DialogForm/DrawerForm/index.js');
|
|
10
11
|
|
|
@@ -31,6 +32,7 @@ var HDrawerForm = index$2.default;
|
|
|
31
32
|
exports.HForm = index.default;
|
|
32
33
|
exports.useHForm = useHForm.default;
|
|
33
34
|
exports.useHDialogForm = hooks.useHDialogForm;
|
|
35
|
+
exports.HFormConnect = HFormConnect.default;
|
|
34
36
|
exports.HButtonInput = HButtonInput;
|
|
35
37
|
exports.HCheckBox = HCheckBox;
|
|
36
38
|
exports.HCheckboxGroup = HCheckboxGroup;
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useMemo } from "react";
|
|
1
|
+
import React, { useMemo } from "react";
|
|
2
2
|
import type {
|
|
3
3
|
FormItemWithRender,
|
|
4
4
|
HFormItemProps,
|
|
@@ -62,7 +62,8 @@ const defaultRenderMaker = (props: HFormItemProps) => {
|
|
|
62
62
|
<Component {...componentProps} {...itemProps} form={form} />
|
|
63
63
|
);
|
|
64
64
|
if (render) {
|
|
65
|
-
|
|
65
|
+
const resultNode=render(props, node, form);
|
|
66
|
+
return React.cloneElement<any>((resultNode as any),{...componentProps,...itemProps,form})
|
|
66
67
|
}
|
|
67
68
|
return node;
|
|
68
69
|
};
|
package/src/components/index.tsx
CHANGED
|
@@ -4,6 +4,8 @@ import PageHandler from "./PageHandler";
|
|
|
4
4
|
export { default as HForm } from "./Form";
|
|
5
5
|
export { default as useHForm } from "./Form/hooks/useHForm";
|
|
6
6
|
export { useHDialogForm } from "./DialogForm/hooks";
|
|
7
|
+
export { default as HFormConnect } from "./Form/HFormConnect";
|
|
8
|
+
|
|
7
9
|
import ModalForm from "./DialogForm/ModalForm";
|
|
8
10
|
import DrawerForm from "./DialogForm/DrawerForm";
|
|
9
11
|
export const HSelect = FormConfig.select;
|