@hw-component/form 0.0.6-beta-v9 → 0.0.7-beta-v2
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/Cascader/index.d.ts +7 -0
- package/es/Cascader/index.js +47 -0
- package/es/DialogForm/hooks.d.ts +1 -1
- package/es/Form/config.d.ts +2 -1
- package/es/Form/config.js +3 -1
- package/es/Form/modal.d.ts +2 -2
- package/es/index.d.ts +2 -1
- package/es/index.js +2 -1
- package/lib/Cascader/index.d.ts +7 -0
- package/lib/Cascader/index.js +50 -0
- package/lib/DialogForm/hooks.d.ts +1 -1
- package/lib/Form/config.d.ts +2 -1
- package/lib/Form/config.js +3 -1
- package/lib/Form/modal.d.ts +2 -2
- package/lib/index.d.ts +2 -1
- package/lib/index.js +2 -0
- package/package.json +1 -1
- package/src/components/Cascader/index.tsx +31 -0
- package/src/components/DialogForm/DrawerForm/index.tsx +22 -20
- package/src/components/DialogForm/ModalForm.tsx +20 -18
- package/src/components/DialogForm/hooks.ts +1 -1
- package/src/components/Form/config.ts +2 -1
- package/src/components/Form/hooks/index.ts +1 -1
- package/src/components/Form/modal.ts +9 -3
- package/src/components/index.tsx +1 -0
- package/src/pages/Form/index.tsx +13 -0
- package/src/pages/ModalForm/index.tsx +22 -18
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CascaderProps } from "antd";
|
|
2
|
+
import type { PromiseFnResult } from "../modal";
|
|
3
|
+
export type HCascaderProps = {
|
|
4
|
+
request?: PromiseFnResult<any>;
|
|
5
|
+
} & CascaderProps<any>;
|
|
6
|
+
declare const _default: ({ request, options, fieldNames: propsFieldNames, ...props }: HCascaderProps) => JSX.Element;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
|
+
import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
|
|
3
|
+
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
|
|
4
|
+
import 'core-js/modules/es.object.to-string.js';
|
|
5
|
+
import 'core-js/modules/es.promise.js';
|
|
6
|
+
import 'core-js/modules/es.object.keys.js';
|
|
7
|
+
import 'core-js/modules/es.symbol.js';
|
|
8
|
+
import 'core-js/modules/es.array.filter.js';
|
|
9
|
+
import 'core-js/modules/es.object.get-own-property-descriptor.js';
|
|
10
|
+
import 'core-js/modules/web.dom-collections.for-each.js';
|
|
11
|
+
import 'core-js/modules/es.object.get-own-property-descriptors.js';
|
|
12
|
+
import { jsx } from 'react/jsx-runtime';
|
|
13
|
+
import { Cascader as Cascader$1 } from 'antd';
|
|
14
|
+
import { useRequest } from 'ahooks';
|
|
15
|
+
import { useMatchConfigProps } from '../hooks/index.js';
|
|
16
|
+
|
|
17
|
+
var _excluded = ["request", "options", "fieldNames"];
|
|
18
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
19
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
20
|
+
var Cascader = (function (_ref) {
|
|
21
|
+
var request = _ref.request,
|
|
22
|
+
_ref$options = _ref.options,
|
|
23
|
+
options = _ref$options === void 0 ? [] : _ref$options,
|
|
24
|
+
propsFieldNames = _ref.fieldNames,
|
|
25
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
26
|
+
var _useMatchConfigProps = useMatchConfigProps({
|
|
27
|
+
fieldNames: propsFieldNames
|
|
28
|
+
}),
|
|
29
|
+
fieldNames = _useMatchConfigProps.fieldNames;
|
|
30
|
+
var _useRequest = useRequest(function () {
|
|
31
|
+
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
32
|
+
if (!request) {
|
|
33
|
+
return Promise.resolve(options);
|
|
34
|
+
}
|
|
35
|
+
return request(params);
|
|
36
|
+
}),
|
|
37
|
+
loading = _useRequest.loading,
|
|
38
|
+
data = _useRequest.data;
|
|
39
|
+
return jsx(Cascader$1, _objectSpread(_objectSpread({}, props), {}, {
|
|
40
|
+
loading: loading,
|
|
41
|
+
options: data,
|
|
42
|
+
fieldNames: fieldNames
|
|
43
|
+
}));
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
export { Cascader as default };
|
|
47
|
+
// powered by hdj
|
package/es/DialogForm/hooks.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { DialogFormProps, HDialogFormInstance, ModifyPropsModal } from "./modal";
|
|
3
|
-
export declare const useModifyProps: ({ visible, configData, initialValues, dialogForm, afterClose, params, title, onCancel }: ModifyPropsModal) => {
|
|
3
|
+
export declare const useModifyProps: ({ visible, configData, initialValues, dialogForm, afterClose, params, title, onCancel, }: ModifyPropsModal) => {
|
|
4
4
|
modalFormData: import("../Form/modal").HItemProps[];
|
|
5
5
|
modalVisible: boolean | undefined;
|
|
6
6
|
setModalVisible: import("react").Dispatch<import("react").SetStateAction<boolean | undefined>>;
|
package/es/Form/config.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ declare const componentConfig: {
|
|
|
24
24
|
urlUpload: ({ placeholder, value, onChange, mediaType, ...props }: import("../Upload/modal").IUrlUploadProps) => JSX.Element;
|
|
25
25
|
submit: ({ text, type, form, loading, position, reset, ...props }: import("../Submit").ISubmitProps) => JSX.Element;
|
|
26
26
|
textArea: ({ autoSize, ...props }: import("antd/es/input").TextAreaProps) => JSX.Element;
|
|
27
|
-
colorInput: ({ value, onChange, ...props }: import("../Input/modal").HInputProps<any>) => JSX.Element;
|
|
27
|
+
colorInput: ({ value, onChange, defaultColor, ...props }: import("../Input/modal").HInputProps<any>) => JSX.Element;
|
|
28
|
+
cascader: ({ request, options, fieldNames: propsFieldNames, ...props }: import("../Cascader").HCascaderProps) => JSX.Element;
|
|
28
29
|
};
|
|
29
30
|
export default componentConfig;
|
package/es/Form/config.js
CHANGED
|
@@ -16,6 +16,7 @@ import Index$4 from '../Upload/UrlUpload/index.js';
|
|
|
16
16
|
import HSubmit from '../Submit/index.js';
|
|
17
17
|
import TextArea from '../TextArea/index.js';
|
|
18
18
|
import ColorInput from '../Input/ColorInput/index.js';
|
|
19
|
+
import Cascader from '../Cascader/index.js';
|
|
19
20
|
|
|
20
21
|
var placeholderConfig = {
|
|
21
22
|
inputType: ["input", "inputNumber", "selectInput", "buttonInput"],
|
|
@@ -38,7 +39,8 @@ var componentConfig = {
|
|
|
38
39
|
urlUpload: Index$4,
|
|
39
40
|
submit: HSubmit,
|
|
40
41
|
textArea: TextArea,
|
|
41
|
-
colorInput: ColorInput
|
|
42
|
+
colorInput: ColorInput,
|
|
43
|
+
cascader: Cascader
|
|
42
44
|
};
|
|
43
45
|
|
|
44
46
|
export { componentConfig as default, placeholderConfig };
|
package/es/Form/modal.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FormInstance, FormItemProps, FormProps } from "antd";
|
|
1
|
+
import type { CascaderProps, FormInstance, FormItemProps, FormProps } from "antd";
|
|
2
2
|
import type { HCheckboxProps } from "../CheckboxGroup/modal";
|
|
3
3
|
import type React from "react";
|
|
4
4
|
import type { HButtonProps, HInputProps, HSelectInputProps } from "../Input/modal";
|
|
@@ -15,7 +15,7 @@ import type { PromiseFnResult, ValueCheckMapModal, ValueSwitchMapModal, DateRang
|
|
|
15
15
|
import type { ForwardedRef } from "react";
|
|
16
16
|
import type { DataFnProvider } from "../modal";
|
|
17
17
|
type RenderFun = (props: HItemProps, node: React.ReactNode, form: FormInstance) => React.ReactNode;
|
|
18
|
-
type ItemPropsType = HCheckboxProps | HInputProps | HSelectInputProps | HButtonProps | HRadioGroupProps | HSelectProps | ButtonProps | HSwitchProps | HDatePickerProps | HRangePickerProps | HTimePickerProps | TextAreaProps | IUpLoadProps
|
|
18
|
+
type ItemPropsType = HCheckboxProps | HInputProps | HSelectInputProps | HButtonProps | HRadioGroupProps | HSelectProps | ButtonProps | HSwitchProps | HDatePickerProps | HRangePickerProps | HTimePickerProps | TextAreaProps | IUpLoadProps | CascaderProps<any>;
|
|
19
19
|
export interface HoverModal {
|
|
20
20
|
text?: string;
|
|
21
21
|
icon?: React.ReactNode;
|
package/es/index.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export declare const HTimePicker: ({ value, format, onChange, disabledDate, ...p
|
|
|
21
21
|
export declare const HInputNumber: ({ style, ...props }: import("antd").InputNumberProps<string | number>) => JSX.Element;
|
|
22
22
|
export declare const HPageHandler: import("react").FC<import("./PageHandler/modal").IHPageHandler<any>>;
|
|
23
23
|
export declare const HTextArea: ({ autoSize, ...props }: import("antd/es/input").TextAreaProps) => JSX.Element;
|
|
24
|
-
export declare const HColorInput: ({ value, onChange, ...props }: import("./Input/modal").HInputProps<any>) => JSX.Element;
|
|
24
|
+
export declare const HColorInput: ({ value, onChange, defaultColor, ...props }: import("./Input/modal").HInputProps<any>) => JSX.Element;
|
|
25
25
|
export declare const HModalForm: ({ visible, title, onCancel, configData, infoRequest, request, afterClose, dialogForm, initialValues, onFinish, params, onOk, onValuesChange, ...props }: import("./DialogForm/modal").DialogFormProps<any, any>) => JSX.Element;
|
|
26
26
|
export declare const HDrawerForm: ({ visible, title, onCancel, configData, infoRequest, request, afterClose, dialogForm, closable, initialValues, labelWidth, onOk, onFinish, size, form, footer, params, onValuesChange, ...props }: import("./DialogForm/modal").DialogFormProps<any, any>) => JSX.Element;
|
|
27
|
+
export declare const HCascader: ({ request, options, fieldNames: propsFieldNames, ...props }: import("./Cascader").HCascaderProps) => JSX.Element;
|
package/es/index.js
CHANGED
|
@@ -28,6 +28,7 @@ var HTextArea = componentConfig.textArea;
|
|
|
28
28
|
var HColorInput = componentConfig.colorInput;
|
|
29
29
|
var HModalForm = ModalForm;
|
|
30
30
|
var HDrawerForm = DrawerForm;
|
|
31
|
+
var HCascader = componentConfig.cascader;
|
|
31
32
|
|
|
32
|
-
export { HButtonInput, HCheckBox, HCheckboxGroup, HColorInput, HDatePicker, HDrawerForm, HInput, HInputNumber, HModalForm, HPageHandler, HRadioGroup, HRangePicker, HSelect, HSelectInput, HSwitch, HTextArea, HTimePicker, HUpload, HUrlUpload };
|
|
33
|
+
export { HButtonInput, HCascader, HCheckBox, HCheckboxGroup, HColorInput, HDatePicker, HDrawerForm, HInput, HInputNumber, HModalForm, HPageHandler, HRadioGroup, HRangePicker, HSelect, HSelectInput, HSwitch, HTextArea, HTimePicker, HUpload, HUrlUpload };
|
|
33
34
|
// powered by hdj
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CascaderProps } from "antd";
|
|
2
|
+
import type { PromiseFnResult } from "../modal";
|
|
3
|
+
export type HCascaderProps = {
|
|
4
|
+
request?: PromiseFnResult<any>;
|
|
5
|
+
} & CascaderProps<any>;
|
|
6
|
+
declare const _default: ({ request, options, fieldNames: propsFieldNames, ...props }: HCascaderProps) => JSX.Element;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
6
|
+
var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
7
|
+
require('core-js/modules/es.object.to-string.js');
|
|
8
|
+
require('core-js/modules/es.promise.js');
|
|
9
|
+
require('core-js/modules/es.object.keys.js');
|
|
10
|
+
require('core-js/modules/es.symbol.js');
|
|
11
|
+
require('core-js/modules/es.array.filter.js');
|
|
12
|
+
require('core-js/modules/es.object.get-own-property-descriptor.js');
|
|
13
|
+
require('core-js/modules/web.dom-collections.for-each.js');
|
|
14
|
+
require('core-js/modules/es.object.get-own-property-descriptors.js');
|
|
15
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
16
|
+
var antd = require('antd');
|
|
17
|
+
var ahooks = require('ahooks');
|
|
18
|
+
var index = require('../hooks/index.js');
|
|
19
|
+
|
|
20
|
+
var _excluded = ["request", "options", "fieldNames"];
|
|
21
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
22
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
23
|
+
var Cascader = (function (_ref) {
|
|
24
|
+
var request = _ref.request,
|
|
25
|
+
_ref$options = _ref.options,
|
|
26
|
+
options = _ref$options === void 0 ? [] : _ref$options,
|
|
27
|
+
propsFieldNames = _ref.fieldNames,
|
|
28
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
29
|
+
var _useMatchConfigProps = index.useMatchConfigProps({
|
|
30
|
+
fieldNames: propsFieldNames
|
|
31
|
+
}),
|
|
32
|
+
fieldNames = _useMatchConfigProps.fieldNames;
|
|
33
|
+
var _useRequest = ahooks.useRequest(function () {
|
|
34
|
+
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
35
|
+
if (!request) {
|
|
36
|
+
return Promise.resolve(options);
|
|
37
|
+
}
|
|
38
|
+
return request(params);
|
|
39
|
+
}),
|
|
40
|
+
loading = _useRequest.loading,
|
|
41
|
+
data = _useRequest.data;
|
|
42
|
+
return jsxRuntime.jsx(antd.Cascader, _objectSpread(_objectSpread({}, props), {}, {
|
|
43
|
+
loading: loading,
|
|
44
|
+
options: data,
|
|
45
|
+
fieldNames: fieldNames
|
|
46
|
+
}));
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
exports.default = Cascader;
|
|
50
|
+
// powered by h
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { DialogFormProps, HDialogFormInstance, ModifyPropsModal } from "./modal";
|
|
3
|
-
export declare const useModifyProps: ({ visible, configData, initialValues, dialogForm, afterClose, params, title, onCancel }: ModifyPropsModal) => {
|
|
3
|
+
export declare const useModifyProps: ({ visible, configData, initialValues, dialogForm, afterClose, params, title, onCancel, }: ModifyPropsModal) => {
|
|
4
4
|
modalFormData: import("../Form/modal").HItemProps[];
|
|
5
5
|
modalVisible: boolean | undefined;
|
|
6
6
|
setModalVisible: import("react").Dispatch<import("react").SetStateAction<boolean | undefined>>;
|
package/lib/Form/config.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ declare const componentConfig: {
|
|
|
24
24
|
urlUpload: ({ placeholder, value, onChange, mediaType, ...props }: import("../Upload/modal").IUrlUploadProps) => JSX.Element;
|
|
25
25
|
submit: ({ text, type, form, loading, position, reset, ...props }: import("../Submit").ISubmitProps) => JSX.Element;
|
|
26
26
|
textArea: ({ autoSize, ...props }: import("antd/es/input").TextAreaProps) => JSX.Element;
|
|
27
|
-
colorInput: ({ value, onChange, ...props }: import("../Input/modal").HInputProps<any>) => JSX.Element;
|
|
27
|
+
colorInput: ({ value, onChange, defaultColor, ...props }: import("../Input/modal").HInputProps<any>) => JSX.Element;
|
|
28
|
+
cascader: ({ request, options, fieldNames: propsFieldNames, ...props }: import("../Cascader").HCascaderProps) => JSX.Element;
|
|
28
29
|
};
|
|
29
30
|
export default componentConfig;
|
package/lib/Form/config.js
CHANGED
|
@@ -19,6 +19,7 @@ var index$8 = require('../Upload/UrlUpload/index.js');
|
|
|
19
19
|
var index$9 = require('../Submit/index.js');
|
|
20
20
|
var index$a = require('../TextArea/index.js');
|
|
21
21
|
var index$b = require('../Input/ColorInput/index.js');
|
|
22
|
+
var index$c = require('../Cascader/index.js');
|
|
22
23
|
|
|
23
24
|
var placeholderConfig = {
|
|
24
25
|
inputType: ["input", "inputNumber", "selectInput", "buttonInput"],
|
|
@@ -41,7 +42,8 @@ var componentConfig = {
|
|
|
41
42
|
urlUpload: index$8.default,
|
|
42
43
|
submit: index$9.default,
|
|
43
44
|
textArea: index$a.default,
|
|
44
|
-
colorInput: index$b.default
|
|
45
|
+
colorInput: index$b.default,
|
|
46
|
+
cascader: index$c.default
|
|
45
47
|
};
|
|
46
48
|
|
|
47
49
|
exports.default = componentConfig;
|
package/lib/Form/modal.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FormInstance, FormItemProps, FormProps } from "antd";
|
|
1
|
+
import type { CascaderProps, FormInstance, FormItemProps, FormProps } from "antd";
|
|
2
2
|
import type { HCheckboxProps } from "../CheckboxGroup/modal";
|
|
3
3
|
import type React from "react";
|
|
4
4
|
import type { HButtonProps, HInputProps, HSelectInputProps } from "../Input/modal";
|
|
@@ -15,7 +15,7 @@ import type { PromiseFnResult, ValueCheckMapModal, ValueSwitchMapModal, DateRang
|
|
|
15
15
|
import type { ForwardedRef } from "react";
|
|
16
16
|
import type { DataFnProvider } from "../modal";
|
|
17
17
|
type RenderFun = (props: HItemProps, node: React.ReactNode, form: FormInstance) => React.ReactNode;
|
|
18
|
-
type ItemPropsType = HCheckboxProps | HInputProps | HSelectInputProps | HButtonProps | HRadioGroupProps | HSelectProps | ButtonProps | HSwitchProps | HDatePickerProps | HRangePickerProps | HTimePickerProps | TextAreaProps | IUpLoadProps
|
|
18
|
+
type ItemPropsType = HCheckboxProps | HInputProps | HSelectInputProps | HButtonProps | HRadioGroupProps | HSelectProps | ButtonProps | HSwitchProps | HDatePickerProps | HRangePickerProps | HTimePickerProps | TextAreaProps | IUpLoadProps | CascaderProps<any>;
|
|
19
19
|
export interface HoverModal {
|
|
20
20
|
text?: string;
|
|
21
21
|
icon?: React.ReactNode;
|
package/lib/index.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export declare const HTimePicker: ({ value, format, onChange, disabledDate, ...p
|
|
|
21
21
|
export declare const HInputNumber: ({ style, ...props }: import("antd").InputNumberProps<string | number>) => JSX.Element;
|
|
22
22
|
export declare const HPageHandler: import("react").FC<import("./PageHandler/modal").IHPageHandler<any>>;
|
|
23
23
|
export declare const HTextArea: ({ autoSize, ...props }: import("antd/es/input").TextAreaProps) => JSX.Element;
|
|
24
|
-
export declare const HColorInput: ({ value, onChange, ...props }: import("./Input/modal").HInputProps<any>) => JSX.Element;
|
|
24
|
+
export declare const HColorInput: ({ value, onChange, defaultColor, ...props }: import("./Input/modal").HInputProps<any>) => JSX.Element;
|
|
25
25
|
export declare const HModalForm: ({ visible, title, onCancel, configData, infoRequest, request, afterClose, dialogForm, initialValues, onFinish, params, onOk, onValuesChange, ...props }: import("./DialogForm/modal").DialogFormProps<any, any>) => JSX.Element;
|
|
26
26
|
export declare const HDrawerForm: ({ visible, title, onCancel, configData, infoRequest, request, afterClose, dialogForm, closable, initialValues, labelWidth, onOk, onFinish, size, form, footer, params, onValuesChange, ...props }: import("./DialogForm/modal").DialogFormProps<any, any>) => JSX.Element;
|
|
27
|
+
export declare const HCascader: ({ request, options, fieldNames: propsFieldNames, ...props }: import("./Cascader").HCascaderProps) => JSX.Element;
|
package/lib/index.js
CHANGED
|
@@ -29,6 +29,7 @@ var HTextArea = config.default.textArea;
|
|
|
29
29
|
var HColorInput = config.default.colorInput;
|
|
30
30
|
var HModalForm = ModalForm.default;
|
|
31
31
|
var HDrawerForm = index$2.default;
|
|
32
|
+
var HCascader = config.default.cascader;
|
|
32
33
|
|
|
33
34
|
exports.HForm = index.default;
|
|
34
35
|
exports.useHForm = useHForm.default;
|
|
@@ -36,6 +37,7 @@ exports.useHDialogForm = hooks.useHDialogForm;
|
|
|
36
37
|
exports.HFormConnect = HFormConnect.default;
|
|
37
38
|
exports.HFormConfigProvider = FormConfigProvider.default;
|
|
38
39
|
exports.HButtonInput = HButtonInput;
|
|
40
|
+
exports.HCascader = HCascader;
|
|
39
41
|
exports.HCheckBox = HCheckBox;
|
|
40
42
|
exports.HCheckboxGroup = HCheckboxGroup;
|
|
41
43
|
exports.HColorInput = HColorInput;
|
package/package.json
CHANGED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { CascaderProps } from "antd";
|
|
2
|
+
import { Cascader } from "antd";
|
|
3
|
+
import { useRequest } from "ahooks";
|
|
4
|
+
import { useMatchConfigProps } from "../hooks";
|
|
5
|
+
import type { PromiseFnResult } from "../modal";
|
|
6
|
+
export type HCascaderProps={
|
|
7
|
+
request?: PromiseFnResult<any>;
|
|
8
|
+
}&CascaderProps<any>
|
|
9
|
+
|
|
10
|
+
export default ({
|
|
11
|
+
request,
|
|
12
|
+
options = [],
|
|
13
|
+
fieldNames: propsFieldNames,
|
|
14
|
+
...props
|
|
15
|
+
}: HCascaderProps) => {
|
|
16
|
+
const { fieldNames } = useMatchConfigProps({ fieldNames: propsFieldNames });
|
|
17
|
+
const { loading, data } = useRequest((params = {}) => {
|
|
18
|
+
if (!request) {
|
|
19
|
+
return Promise.resolve(options);
|
|
20
|
+
}
|
|
21
|
+
return request(params);
|
|
22
|
+
});
|
|
23
|
+
return (
|
|
24
|
+
<Cascader
|
|
25
|
+
{...props}
|
|
26
|
+
loading={loading}
|
|
27
|
+
options={data}
|
|
28
|
+
fieldNames={fieldNames}
|
|
29
|
+
/>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
@@ -4,7 +4,9 @@ import { useCurrentForm, useModifyProps, useSub } from "../hooks";
|
|
|
4
4
|
import HForm from "../../Form";
|
|
5
5
|
import Title from "./Title";
|
|
6
6
|
import Footer from "./Footer";
|
|
7
|
-
import FormConfigProvider,{
|
|
7
|
+
import FormConfigProvider, {
|
|
8
|
+
useFormConfigContext,
|
|
9
|
+
} from "../../Form/Context/FormConfigProvider";
|
|
8
10
|
export default ({
|
|
9
11
|
visible,
|
|
10
12
|
title,
|
|
@@ -27,7 +29,7 @@ export default ({
|
|
|
27
29
|
...props
|
|
28
30
|
}: DialogFormProps) => {
|
|
29
31
|
const currentForm = useCurrentForm(dialogForm);
|
|
30
|
-
const providerConfig=useFormConfigContext();
|
|
32
|
+
const providerConfig = useFormConfigContext();
|
|
31
33
|
const {
|
|
32
34
|
modalVisible,
|
|
33
35
|
modalFormData,
|
|
@@ -35,7 +37,7 @@ export default ({
|
|
|
35
37
|
initValue,
|
|
36
38
|
onAfterClose,
|
|
37
39
|
formParams,
|
|
38
|
-
title:modalTitle
|
|
40
|
+
title: modalTitle,
|
|
39
41
|
} = useModifyProps({
|
|
40
42
|
configData,
|
|
41
43
|
visible,
|
|
@@ -43,7 +45,7 @@ export default ({
|
|
|
43
45
|
dialogForm: currentForm,
|
|
44
46
|
params,
|
|
45
47
|
title,
|
|
46
|
-
onCancel
|
|
48
|
+
onCancel,
|
|
47
49
|
});
|
|
48
50
|
const cancel = () => {
|
|
49
51
|
onAfterClose();
|
|
@@ -79,22 +81,22 @@ export default ({
|
|
|
79
81
|
>
|
|
80
82
|
<FormConfigProvider {...providerConfig}>
|
|
81
83
|
<HForm
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
84
|
+
configData={modalFormData}
|
|
85
|
+
initialValues={initValue}
|
|
86
|
+
onValuesChange={onValuesChange}
|
|
87
|
+
{...props}
|
|
88
|
+
form={currentForm}
|
|
89
|
+
params={formParams}
|
|
90
|
+
onFinish={async (values, subParams) => {
|
|
91
|
+
const result = await run(values, subParams);
|
|
92
|
+
const close = onOk?.(result, subParams);
|
|
93
|
+
if (close === false) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
cancel();
|
|
97
|
+
}}
|
|
98
|
+
infoRequest={infoRequest}
|
|
99
|
+
labelWidth={labelWidth}
|
|
98
100
|
/>
|
|
99
101
|
</FormConfigProvider>
|
|
100
102
|
</Drawer>
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { Modal } from "antd";
|
|
2
2
|
import type { DialogFormProps } from "./modal";
|
|
3
3
|
import HForm from "../Form";
|
|
4
|
-
import FormConfigProvider, {
|
|
4
|
+
import FormConfigProvider, {
|
|
5
|
+
useFormConfigContext,
|
|
6
|
+
} from "../Form/Context/FormConfigProvider";
|
|
5
7
|
import { useCurrentForm, useModifyProps, useSub } from "./hooks";
|
|
6
8
|
export default ({
|
|
7
9
|
visible,
|
|
@@ -20,7 +22,7 @@ export default ({
|
|
|
20
22
|
...props
|
|
21
23
|
}: DialogFormProps) => {
|
|
22
24
|
const currentForm = useCurrentForm(dialogForm);
|
|
23
|
-
const providerConfig=useFormConfigContext();
|
|
25
|
+
const providerConfig = useFormConfigContext();
|
|
24
26
|
const {
|
|
25
27
|
modalVisible,
|
|
26
28
|
modalFormData,
|
|
@@ -35,7 +37,7 @@ export default ({
|
|
|
35
37
|
dialogForm: currentForm,
|
|
36
38
|
params,
|
|
37
39
|
title,
|
|
38
|
-
onCancel
|
|
40
|
+
onCancel,
|
|
39
41
|
});
|
|
40
42
|
const cancel = () => {
|
|
41
43
|
if (onCancel) {
|
|
@@ -60,21 +62,21 @@ export default ({
|
|
|
60
62
|
>
|
|
61
63
|
<FormConfigProvider {...providerConfig}>
|
|
62
64
|
<HForm
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
65
|
+
configData={modalFormData}
|
|
66
|
+
initialValues={initValue}
|
|
67
|
+
onValuesChange={onValuesChange}
|
|
68
|
+
onFinish={async (values, outParams) => {
|
|
69
|
+
const result = await run(values, outParams);
|
|
70
|
+
const close = onOk?.(result, outParams);
|
|
71
|
+
if (close === false) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
cancel();
|
|
75
|
+
}}
|
|
76
|
+
{...props}
|
|
77
|
+
params={formParams}
|
|
78
|
+
form={currentForm}
|
|
79
|
+
infoRequest={infoRequest}
|
|
78
80
|
/>
|
|
79
81
|
</FormConfigProvider>
|
|
80
82
|
</Modal>
|
|
@@ -15,7 +15,7 @@ import HUrlUpload from "../Upload/UrlUpload";
|
|
|
15
15
|
import HSubmit from "../Submit";
|
|
16
16
|
import TextArea from "../TextArea";
|
|
17
17
|
import ColorInput from "../Input/ColorInput";
|
|
18
|
-
|
|
18
|
+
import Cascader from "../Cascader";
|
|
19
19
|
export const placeholderConfig = {
|
|
20
20
|
inputType: ["input", "inputNumber", "selectInput", "buttonInput"],
|
|
21
21
|
selectType: ["select", "datePicker", "timePicker", "colorInput"],
|
|
@@ -38,6 +38,7 @@ const componentConfig = {
|
|
|
38
38
|
submit: HSubmit,
|
|
39
39
|
textArea: TextArea,
|
|
40
40
|
colorInput: ColorInput,
|
|
41
|
+
cascader: Cascader,
|
|
41
42
|
};
|
|
42
43
|
|
|
43
44
|
export default componentConfig;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
CascaderProps,
|
|
3
|
+
FormInstance,
|
|
4
|
+
FormItemProps,
|
|
5
|
+
FormProps,
|
|
6
|
+
} from "antd";
|
|
2
7
|
import type { HCheckboxProps } from "../CheckboxGroup/modal";
|
|
3
8
|
import type React from "react";
|
|
4
9
|
import type {
|
|
@@ -46,7 +51,8 @@ type ItemPropsType =
|
|
|
46
51
|
| HRangePickerProps
|
|
47
52
|
| HTimePickerProps
|
|
48
53
|
| TextAreaProps
|
|
49
|
-
| IUpLoadProps
|
|
54
|
+
| IUpLoadProps
|
|
55
|
+
| CascaderProps<any>;
|
|
50
56
|
|
|
51
57
|
export interface HoverModal {
|
|
52
58
|
text?: string;
|
|
@@ -147,7 +153,7 @@ export interface HFormInstance extends FormInstance {
|
|
|
147
153
|
addDispatchListener: AddDispatchListenerFn;
|
|
148
154
|
removeDispatchListener: (action?: ActionModal, fn?: argsFn) => void;
|
|
149
155
|
reload: PromiseFnResult;
|
|
150
|
-
clear:VoidFunction;
|
|
156
|
+
clear: VoidFunction;
|
|
151
157
|
}
|
|
152
158
|
|
|
153
159
|
export interface ConnectConfigModal {
|
package/src/components/index.tsx
CHANGED
package/src/pages/Form/index.tsx
CHANGED
|
@@ -128,6 +128,19 @@ const formData = (options) => {
|
|
|
128
128
|
label: "测试",
|
|
129
129
|
type: "test",
|
|
130
130
|
},
|
|
131
|
+
{
|
|
132
|
+
label: "多级",
|
|
133
|
+
type: "cascader",
|
|
134
|
+
name: "cascader",
|
|
135
|
+
itemProps: {
|
|
136
|
+
options: [
|
|
137
|
+
{
|
|
138
|
+
value: "多选1",
|
|
139
|
+
key: 1,
|
|
140
|
+
},
|
|
141
|
+
],
|
|
142
|
+
},
|
|
143
|
+
},
|
|
131
144
|
{
|
|
132
145
|
type: "submit",
|
|
133
146
|
},
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { Button } from "antd";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import {
|
|
3
|
+
HModalForm,
|
|
4
|
+
useHDialogForm,
|
|
5
|
+
HFormConfigProvider,
|
|
6
|
+
} from "../../components";
|
|
7
|
+
import { useState } from "react";
|
|
8
|
+
import { ShowParamsModal } from "@/components/DialogForm/modal";
|
|
5
9
|
const data = [
|
|
6
10
|
{
|
|
7
11
|
label: "输入框",
|
|
@@ -120,8 +124,6 @@ const data = [
|
|
|
120
124
|
let num = 0;
|
|
121
125
|
export default () => {
|
|
122
126
|
const modalForm = useHDialogForm();
|
|
123
|
-
const [testModal,setTestModal]=useState<ShowParamsModal>({});
|
|
124
|
-
const {visible,params}=testModal;
|
|
125
127
|
return (
|
|
126
128
|
<>
|
|
127
129
|
<Button
|
|
@@ -151,21 +153,23 @@ export default () => {
|
|
|
151
153
|
宣誓
|
|
152
154
|
</Button>
|
|
153
155
|
<HFormConfigProvider
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
156
|
+
uploadProps={{
|
|
157
|
+
request: () => {
|
|
158
|
+
console.log("request,request,request,request");
|
|
159
|
+
return Promise.resolve({
|
|
160
|
+
url: "https://gw.alicdn.com/imgextra/i2/O1CN01MYuwJQ1GXVBWryCFJ_!!6000000000632-2-tps-1125-570.png_468x468q75.jpg_.webp",
|
|
161
|
+
});
|
|
162
|
+
},
|
|
163
|
+
}}
|
|
160
164
|
>
|
|
161
165
|
<HModalForm
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
166
|
+
configData={data}
|
|
167
|
+
labelWidth={88}
|
|
168
|
+
request={(val, params) => {
|
|
169
|
+
console.log(val, params);
|
|
170
|
+
}}
|
|
171
|
+
dialogForm={modalForm}
|
|
172
|
+
title="测试"
|
|
169
173
|
/>
|
|
170
174
|
</HFormConfigProvider>
|
|
171
175
|
</>
|