@hw-component/form 1.9.46 → 1.9.47
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/.eslintcache +1 -1
- package/es/DialogForm/DrawerForm/Footer.js +5 -4
- package/es/DialogForm/DrawerForm/index.js +8 -16
- package/es/DialogForm/hooks.d.ts +5 -4
- package/es/DialogForm/hooks.js +13 -3
- package/es/DialogForm/modal.d.ts +1 -1
- package/es/Form/config.d.ts +1 -1
- package/es/Form/modal.d.ts +1 -1
- package/es/Input/ButtonInput.js +5 -5
- package/es/Input/SelectInput.js +1 -0
- package/es/PageHandler/ErrorComponent.js +3 -2
- package/es/Select/TreeSelect.d.ts +2 -2
- package/es/Select/components/NotFoundContent.js +3 -2
- package/es/Submit/components.js +3 -3
- package/es/Switch/index.d.ts +1 -1
- package/es/Text/index.d.ts +1 -1
- package/es/index.css +8 -8
- package/es/index.d.ts +1 -1
- package/lib/DialogForm/DrawerForm/Footer.js +4 -3
- package/lib/DialogForm/DrawerForm/index.js +7 -15
- package/lib/DialogForm/hooks.d.ts +5 -4
- package/lib/DialogForm/hooks.js +13 -3
- package/lib/DialogForm/modal.d.ts +1 -1
- package/lib/Form/config.d.ts +1 -1
- package/lib/Form/modal.d.ts +1 -1
- package/lib/Input/ButtonInput.js +4 -4
- package/lib/Input/SelectInput.js +1 -0
- package/lib/PageHandler/ErrorComponent.js +2 -1
- package/lib/Select/TreeSelect.d.ts +2 -2
- package/lib/Select/components/NotFoundContent.js +2 -1
- package/lib/Submit/components.js +3 -3
- package/lib/Switch/index.d.ts +1 -1
- package/lib/Text/index.d.ts +1 -1
- package/lib/index.css +8 -8
- package/lib/index.d.ts +1 -1
- package/package.json +5 -3
- package/src/components/CheckboxGroup/index.tsx +3 -3
- package/src/components/DialogForm/DrawerForm/Footer.tsx +7 -5
- package/src/components/DialogForm/DrawerForm/index.tsx +10 -21
- package/src/components/DialogForm/ModalForm.tsx +2 -2
- package/src/components/DialogForm/{hooks.ts → hooks.tsx} +17 -4
- package/src/components/DialogForm/modal.ts +1 -1
- package/src/components/Form/Basic.tsx +2 -2
- package/src/components/Form/HFormConnect.tsx +3 -3
- package/src/components/Form/config.ts +1 -1
- package/src/components/Form/hooks/index.ts +9 -9
- package/src/components/Form/hooks/useInitConfigData.tsx +3 -3
- package/src/components/Form/index.tsx +0 -1
- package/src/components/Form/modal.ts +6 -6
- package/src/components/Input/ButtonInput.tsx +27 -25
- package/src/components/Input/InputNumberGroup.tsx +4 -4
- package/src/components/Input/SelectInput.tsx +3 -2
- package/src/components/Input/TrimInput.tsx +3 -3
- package/src/components/Input/index.less +1 -1
- package/src/components/Input/modal.ts +1 -1
- package/src/components/PageHandler/ErrorComponent.tsx +4 -3
- package/src/components/PageHandler/index.tsx +0 -1
- package/src/components/PageHandler/modal.ts +1 -1
- package/src/components/Select/TreeSelect.tsx +51 -35
- package/src/components/Select/components/NotFoundContent.tsx +4 -3
- package/src/components/Select/index.less +18 -18
- package/src/components/Select/index.tsx +84 -75
- package/src/components/Select/modal.ts +2 -2
- package/src/components/Submit/components.tsx +5 -5
- package/src/components/Switch/index.tsx +16 -13
- package/src/components/TDPicker/RangePicker.tsx +2 -2
- package/src/components/Text/index.tsx +5 -5
- package/src/components/TextArea/TrimTextArea.tsx +3 -3
- package/src/components/Upload/MediaTypeEle/TypeEle.tsx +7 -1
- package/src/components/Upload/UrlUpload/index.tsx +1 -1
- package/src/components/Upload/index.tsx +4 -4
- package/src/components/index.tsx +1 -1
- package/src/components/styles/index.less +2 -2
- package/src/index.less +1 -0
- package/src/index.tsx +1 -0
- package/src/pages/DrawerForm/index.tsx +0 -3
- package/src/pages/Form/index.tsx +146 -77
- package/src/pages/Input/index.tsx +1 -1
- package/src/pages/ModalForm/index.tsx +3 -4
- package/src/pages/Switch/index.tsx +11 -11
- package/src/pages/Upload/index.tsx +6 -2
package/es/DialogForm/hooks.js
CHANGED
|
@@ -3,9 +3,11 @@ import _asyncToGenerator from '@babel/runtime-corejs3/helpers/asyncToGenerator';
|
|
|
3
3
|
import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
|
|
4
4
|
import _slicedToArray from '@babel/runtime-corejs3/helpers/slicedToArray';
|
|
5
5
|
import _regeneratorRuntime from '@babel/runtime-corejs3/regenerator';
|
|
6
|
+
import { jsx } from 'react/jsx-runtime';
|
|
6
7
|
import { useMemo, useState, useEffect } from 'react';
|
|
7
8
|
import useHForm from '../Form/hooks/useHForm.js';
|
|
8
9
|
import { useRequest } from 'ahooks';
|
|
10
|
+
import Footer from './DrawerForm/Footer.js';
|
|
9
11
|
|
|
10
12
|
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
13
|
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; }
|
|
@@ -154,13 +156,21 @@ var useFooterRender = function useFooterRender(_ref4) {
|
|
|
154
156
|
confirmLoading = _ref4.confirmLoading,
|
|
155
157
|
dialogForm = _ref4.dialogForm,
|
|
156
158
|
params = _ref4.params;
|
|
157
|
-
if (
|
|
158
|
-
return
|
|
159
|
+
if (footer === null) {
|
|
160
|
+
return null;
|
|
159
161
|
}
|
|
160
162
|
if (typeof footer === "function") {
|
|
161
163
|
return footer(dialogForm, confirmLoading, params);
|
|
162
164
|
}
|
|
163
|
-
return footer
|
|
165
|
+
return footer || jsx(Footer, {
|
|
166
|
+
onCancel: function onCancel() {
|
|
167
|
+
dialogForm === null || dialogForm === void 0 || dialogForm.hide();
|
|
168
|
+
},
|
|
169
|
+
onOk: function onOk() {
|
|
170
|
+
dialogForm === null || dialogForm === void 0 || dialogForm.submit();
|
|
171
|
+
},
|
|
172
|
+
confirmLoading: confirmLoading
|
|
173
|
+
});
|
|
164
174
|
};
|
|
165
175
|
|
|
166
176
|
export { useCurrentForm, useFooterRender, useHDialogForm, useModifyProps, useSub };
|
package/es/DialogForm/modal.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ export interface HDialogFormInstance<P = any, T = any> extends HFormInstance {
|
|
|
26
26
|
show: (data?: ShowParamsModal<P, T>) => void;
|
|
27
27
|
hide: VoidFunction;
|
|
28
28
|
}
|
|
29
|
-
type FooterRender = (dialogForm?: HDialogFormInstance, loading?: boolean, params?: Record<string, any>) => React.ReactNode;
|
|
29
|
+
export type FooterRender = (dialogForm?: HDialogFormInstance, loading?: boolean, params?: Record<string, any>) => React.ReactNode;
|
|
30
30
|
export interface DialogFormProps<P = any, T = any> extends Omit<RootProps, "onFinish" | "onCancel" | "onOk" | "infoRequest" | "title" | "footer"> {
|
|
31
31
|
dialogForm?: HDialogFormInstance;
|
|
32
32
|
onFinish?: (values: T, params: P) => Promise<any>;
|
package/es/Form/config.d.ts
CHANGED
|
@@ -36,6 +36,6 @@ declare const componentConfig: {
|
|
|
36
36
|
placeholder: ({ label }: import("./modal").HItemProps) => string[];
|
|
37
37
|
};
|
|
38
38
|
treeSelect: ({ request, onlyCheckChild, multiple, treeCheckable, treeData, fieldNames, ...props }: import("../Select/TreeSelect").HTreeSelectProps) => JSX.Element;
|
|
39
|
-
text: ({ value }: import("
|
|
39
|
+
text: ({ value }: import("./modal").HFormItemProps) => JSX.Element;
|
|
40
40
|
};
|
|
41
41
|
export default componentConfig;
|
package/es/Form/modal.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ import type { DataFnProvider } from "../modal";
|
|
|
17
17
|
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
|
-
import { BaseOptions } from "@ahooksjs/use-request/lib/types";
|
|
20
|
+
import type { BaseOptions } from "@ahooksjs/use-request/lib/types";
|
|
21
21
|
type RenderFun = (props: HItemProps, node: React.ReactNode, form: FormInstance) => React.ReactNode;
|
|
22
22
|
export type ItemPropsType = HCheckboxProps | HInputProps | HSelectInputProps | HButtonProps | HRadioGroupProps | HSelectProps | ButtonProps | HSwitchProps | HDatePickerProps | HRangePickerProps | HTimePickerProps | TextAreaProps | IUpLoadProps | CascaderProps<any> | IUrlUploadProps;
|
|
23
23
|
export interface HoverModal {
|
package/es/Input/ButtonInput.js
CHANGED
|
@@ -4,8 +4,9 @@ import _asyncToGenerator from '@babel/runtime-corejs3/helpers/asyncToGenerator';
|
|
|
4
4
|
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
|
|
5
5
|
import _regeneratorRuntime from '@babel/runtime-corejs3/regenerator';
|
|
6
6
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
7
|
-
import { Input
|
|
7
|
+
import { Input } from 'antd';
|
|
8
8
|
import { useRequest } from 'ahooks';
|
|
9
|
+
import { HJBtn } from '@hw-component/hj';
|
|
9
10
|
|
|
10
11
|
var _excluded = ["buttonProps", "value", "onChange", "children", "request", "layType"],
|
|
11
12
|
_excluded2 = ["onClick", "type", "ghost", "loading"];
|
|
@@ -68,7 +69,7 @@ var Index = function Index(_ref) {
|
|
|
68
69
|
}();
|
|
69
70
|
if (layType === "text") {
|
|
70
71
|
return jsx(Input, _objectSpread(_objectSpread({}, props), {}, {
|
|
71
|
-
suffix: jsx(
|
|
72
|
+
suffix: jsx(HJBtn, _objectSpread(_objectSpread({
|
|
72
73
|
type: btnType,
|
|
73
74
|
onClick: click,
|
|
74
75
|
size: "small",
|
|
@@ -90,13 +91,12 @@ var Index = function Index(_ref) {
|
|
|
90
91
|
},
|
|
91
92
|
value: value,
|
|
92
93
|
onChange: change
|
|
93
|
-
})), jsx(
|
|
94
|
+
})), jsx(HJBtn, _objectSpread(_objectSpread({
|
|
94
95
|
type: btnType,
|
|
95
96
|
onClick: click,
|
|
96
97
|
loading: loading || btnLoading,
|
|
97
98
|
style: {
|
|
98
|
-
marginLeft: 8
|
|
99
|
-
borderRadius: 4
|
|
99
|
+
marginLeft: 8
|
|
100
100
|
},
|
|
101
101
|
ghost: ghost
|
|
102
102
|
}, oProps), {}, {
|
package/es/Input/SelectInput.js
CHANGED
|
@@ -53,6 +53,7 @@ var Index = function Index(_ref) {
|
|
|
53
53
|
Object.values(valueName).forEach(function (key) {
|
|
54
54
|
resultObj[key] = initValue[key];
|
|
55
55
|
});
|
|
56
|
+
console.log(item, valueName);
|
|
56
57
|
return _defineProperty({}, name, resultObj);
|
|
57
58
|
},
|
|
58
59
|
outputValue: function outputValue(item, _outputValue) {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// welcome to hoo hoo hoo
|
|
2
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
-
import { Typography, Row, Space
|
|
3
|
+
import { Typography, Row, Space } from 'antd';
|
|
4
4
|
import { ExclamationCircleOutlined } from '@ant-design/icons';
|
|
5
|
+
import { HJBtn } from '@hw-component/hj';
|
|
5
6
|
|
|
6
7
|
var Text = Typography.Text;
|
|
7
8
|
var ErrorComponent = (function (_ref) {
|
|
@@ -24,7 +25,7 @@ var ErrorComponent = (function (_ref) {
|
|
|
24
25
|
}), jsx(Text, {
|
|
25
26
|
type: "danger",
|
|
26
27
|
children: error === null || error === void 0 ? void 0 : error.message
|
|
27
|
-
}), jsx(
|
|
28
|
+
}), jsx(HJBtn, {
|
|
28
29
|
type: "primary",
|
|
29
30
|
size: "small",
|
|
30
31
|
onClick: reload,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TreeSelectProps } from "antd/lib/tree-select";
|
|
2
|
-
import { PromiseFnResult } from "../modal";
|
|
1
|
+
import type { TreeSelectProps } from "antd/lib/tree-select";
|
|
2
|
+
import type { PromiseFnResult } from "../modal";
|
|
3
3
|
export interface HTreeSelectProps extends TreeSelectProps {
|
|
4
4
|
request?: PromiseFnResult;
|
|
5
5
|
onlyCheckChild?: boolean;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// welcome to hoo hoo hoo
|
|
2
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
-
import { Typography, Row, Space,
|
|
3
|
+
import { Typography, Row, Space, Empty } from 'antd';
|
|
4
4
|
import { ExclamationCircleOutlined } from '@ant-design/icons';
|
|
5
|
+
import { HJBtn } from '@hw-component/hj';
|
|
5
6
|
|
|
6
7
|
var Text = Typography.Text;
|
|
7
8
|
var NotFoundContent = (function (_ref) {
|
|
@@ -25,7 +26,7 @@ var NotFoundContent = (function (_ref) {
|
|
|
25
26
|
}), jsx(Text, {
|
|
26
27
|
type: "danger",
|
|
27
28
|
children: error.message
|
|
28
|
-
}), jsx(
|
|
29
|
+
}), jsx(HJBtn, {
|
|
29
30
|
type: "primary",
|
|
30
31
|
size: "small",
|
|
31
32
|
onClick: reload,
|
package/es/Submit/components.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
|
|
3
3
|
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
|
|
4
4
|
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
5
|
-
import { Button } from 'antd';
|
|
6
5
|
import { useFormContext } from '../Form/Context/index.js';
|
|
7
6
|
import React from 'react';
|
|
7
|
+
import { HJBtn } from '@hw-component/hj';
|
|
8
8
|
|
|
9
9
|
var _excluded = ["form", "style"],
|
|
10
10
|
_excluded2 = ["type", "form", "text", "loading", "style"],
|
|
@@ -18,7 +18,7 @@ function ResetBtn(_ref) {
|
|
|
18
18
|
borderRadius: 4
|
|
19
19
|
} : _ref$style,
|
|
20
20
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
21
|
-
return jsx(
|
|
21
|
+
return jsx(HJBtn, _objectSpread(_objectSpread({}, props), {}, {
|
|
22
22
|
style: style,
|
|
23
23
|
onClick: function onClick() {
|
|
24
24
|
form.resetFields();
|
|
@@ -41,7 +41,7 @@ function SubBtn(_ref2) {
|
|
|
41
41
|
var _useFormContext = useFormContext(),
|
|
42
42
|
_useFormContext$loadi = _useFormContext.loading,
|
|
43
43
|
formSubLoading = _useFormContext$loadi === void 0 ? loading : _useFormContext$loadi;
|
|
44
|
-
return jsx(
|
|
44
|
+
return jsx(HJBtn, _objectSpread(_objectSpread({}, props), {}, {
|
|
45
45
|
type: type,
|
|
46
46
|
onClick: form.submit,
|
|
47
47
|
loading: formSubLoading,
|
package/es/Switch/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { SwitchProps } from "antd";
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
import type { ValueSwitchMapModal } from "../modal";
|
|
4
4
|
import type { addFormatItemModal } from "../Form/modal";
|
|
5
|
-
import { PromiseFnResult } from "../modal";
|
|
5
|
+
import type { PromiseFnResult } from "../modal";
|
|
6
6
|
export interface HSwitchProps extends Omit<SwitchProps, "onChange"> {
|
|
7
7
|
valueMap?: ValueSwitchMapModal;
|
|
8
8
|
value?: any;
|
package/es/Text/index.d.ts
CHANGED
package/es/index.css
CHANGED
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
flex-direction: row;
|
|
20
20
|
}
|
|
21
21
|
.ant-hw-select-box .ant-hw-group-addon-before {
|
|
22
|
-
border-
|
|
22
|
+
border-right: 0;
|
|
23
23
|
border-top-left-radius: 2px;
|
|
24
|
-
border-
|
|
24
|
+
border-bottom-left-radius: 2px;
|
|
25
25
|
}
|
|
26
26
|
.ant-hw-select-box .ant-select {
|
|
27
27
|
-webkit-box-flex: 1;
|
|
@@ -30,17 +30,17 @@
|
|
|
30
30
|
flex: 1;
|
|
31
31
|
}
|
|
32
32
|
.ant-hw-select-box .ant-hw-group-addon-after {
|
|
33
|
-
border-
|
|
33
|
+
border-left: 0;
|
|
34
34
|
border-top-right-radius: 2px;
|
|
35
|
-
border-
|
|
35
|
+
border-bottom-right-radius: 2px;
|
|
36
36
|
}
|
|
37
37
|
.ant-hw-select-box-addon-before .ant-select .ant-select-selector {
|
|
38
|
-
border-
|
|
39
|
-
border-
|
|
38
|
+
border-top-left-radius: 0 !important;
|
|
39
|
+
border-bottom-left-radius: 0 !important;
|
|
40
40
|
}
|
|
41
41
|
.ant-hw-select-box-addon-after .ant-select .ant-select-selector {
|
|
42
|
-
border-
|
|
43
|
-
border-
|
|
42
|
+
border-top-right-radius: 0 !important;
|
|
43
|
+
border-bottom-right-radius: 0 !important;
|
|
44
44
|
}
|
|
45
45
|
.ant-hw-form-item-colon:after {
|
|
46
46
|
position: relative;
|
package/es/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./styles/index.less";
|
|
2
2
|
export { default as HForm } from "./Form";
|
|
3
3
|
export { default as useHForm } from "./Form/hooks/useHForm";
|
|
4
|
-
export { useHDialogForm } from "
|
|
4
|
+
export { useHDialogForm } from "@/components/DialogForm/hooks";
|
|
5
5
|
export { default as HFormConnect } from "./Form/HFormConnect";
|
|
6
6
|
export { default as HFormConfigProvider } from "./Form/Context/FormConfigProvider";
|
|
7
7
|
export { default as HBasicForm } from "./Form/Basic";
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var antd = require('antd');
|
|
7
|
+
var hj = require('@hw-component/hj');
|
|
7
8
|
|
|
8
9
|
var Footer = (function (_ref) {
|
|
9
10
|
var onCancel = _ref.onCancel,
|
|
@@ -12,11 +13,11 @@ var Footer = (function (_ref) {
|
|
|
12
13
|
return jsxRuntime.jsx(antd.Row, {
|
|
13
14
|
justify: "end",
|
|
14
15
|
children: jsxRuntime.jsxs(antd.Space, {
|
|
15
|
-
size: "
|
|
16
|
-
children: [jsxRuntime.jsx(
|
|
16
|
+
size: "small",
|
|
17
|
+
children: [jsxRuntime.jsx(hj.HJBtn, {
|
|
17
18
|
onClick: onCancel,
|
|
18
19
|
children: "\u5173\u95ED"
|
|
19
|
-
}), jsxRuntime.jsx(
|
|
20
|
+
}), jsxRuntime.jsx(hj.HJBtn, {
|
|
20
21
|
type: "primary",
|
|
21
22
|
onClick: onOk,
|
|
22
23
|
loading: confirmLoading,
|
|
@@ -11,7 +11,6 @@ var antd = require('antd');
|
|
|
11
11
|
var hooks = require('../hooks.js');
|
|
12
12
|
var index = require('../../Form/index.js');
|
|
13
13
|
var Title = require('./Title.js');
|
|
14
|
-
var Footer = require('./Footer.js');
|
|
15
14
|
var FormConfigProvider = require('../../Form/Context/FormConfigProvider.js');
|
|
16
15
|
var ChildComponent = require('../ChildComponent.js');
|
|
17
16
|
|
|
@@ -76,19 +75,12 @@ var Index = function Index(_ref) {
|
|
|
76
75
|
}),
|
|
77
76
|
loading = _useSub.loading,
|
|
78
77
|
run = _useSub.run;
|
|
79
|
-
var
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
return footer || jsxRuntime.jsx(Footer.default, {
|
|
87
|
-
onCancel: cancel,
|
|
88
|
-
onOk: currentForm.submit,
|
|
89
|
-
confirmLoading: loading
|
|
90
|
-
});
|
|
91
|
-
};
|
|
78
|
+
var defaultFooter = hooks.useFooterRender({
|
|
79
|
+
dialogForm: dialogForm,
|
|
80
|
+
footer: footer,
|
|
81
|
+
confirmLoading: loading,
|
|
82
|
+
params: formParams
|
|
83
|
+
});
|
|
92
84
|
var node = jsxRuntime.jsx(index.default, _objectSpread(_objectSpread({
|
|
93
85
|
configData: modalFormData,
|
|
94
86
|
initialValues: initValue,
|
|
@@ -139,7 +131,7 @@ var Index = function Index(_ref) {
|
|
|
139
131
|
onClose: cancel,
|
|
140
132
|
closable: false,
|
|
141
133
|
destroyOnClose: true,
|
|
142
|
-
footer:
|
|
134
|
+
footer: defaultFooter,
|
|
143
135
|
children: jsxRuntime.jsx(FormConfigProvider.default, _objectSpread(_objectSpread({}, providerConfig), {}, {
|
|
144
136
|
children: jsxRuntime.jsx(ChildComponent.default, {
|
|
145
137
|
dialogForm: currentForm,
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import type { DialogFormProps, HDialogFormInstance, ModifyPropsModal } from "./modal";
|
|
2
3
|
export declare const useModifyProps: ({ visible, configData, initialValues, dialogForm, afterClose, params, title, onCancel, autoClear, }: ModifyPropsModal) => {
|
|
3
4
|
modalFormData: import("../Form/modal").HItemProps[];
|
|
4
5
|
modalVisible: boolean | undefined;
|
|
5
|
-
setModalVisible:
|
|
6
|
-
setModalFormData:
|
|
6
|
+
setModalVisible: React.Dispatch<React.SetStateAction<boolean | undefined>>;
|
|
7
|
+
setModalFormData: React.Dispatch<React.SetStateAction<import("../Form/modal").HItemProps[]>>;
|
|
7
8
|
initValue: Record<string, any> | undefined;
|
|
8
|
-
setInitValue:
|
|
9
|
+
setInitValue: React.Dispatch<React.SetStateAction<Record<string, any> | undefined>>;
|
|
9
10
|
onAfterClose: () => void;
|
|
10
11
|
formParams: any;
|
|
11
|
-
title: string | number | boolean | {} |
|
|
12
|
+
title: string | number | boolean | {} | React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ReactNodeArray | React.ReactPortal | null | undefined;
|
|
12
13
|
};
|
|
13
14
|
export declare const useHDialogForm: () => HDialogFormInstance<any, any>;
|
|
14
15
|
export declare const useCurrentForm: (hDialogForm?: HDialogFormInstance) => HDialogFormInstance<any, any>;
|
package/lib/DialogForm/hooks.js
CHANGED
|
@@ -4,9 +4,11 @@ var _asyncToGenerator = require('@babel/runtime-corejs3/helpers/asyncToGenerator
|
|
|
4
4
|
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
5
5
|
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
6
6
|
var _regeneratorRuntime = require('@babel/runtime-corejs3/regenerator');
|
|
7
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
8
|
var React = require('react');
|
|
8
9
|
var useHForm = require('../Form/hooks/useHForm.js');
|
|
9
10
|
var ahooks = require('ahooks');
|
|
11
|
+
var Footer = require('./DrawerForm/Footer.js');
|
|
10
12
|
|
|
11
13
|
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
14
|
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; }
|
|
@@ -155,13 +157,21 @@ var useFooterRender = function useFooterRender(_ref4) {
|
|
|
155
157
|
confirmLoading = _ref4.confirmLoading,
|
|
156
158
|
dialogForm = _ref4.dialogForm,
|
|
157
159
|
params = _ref4.params;
|
|
158
|
-
if (
|
|
159
|
-
return
|
|
160
|
+
if (footer === null) {
|
|
161
|
+
return null;
|
|
160
162
|
}
|
|
161
163
|
if (typeof footer === "function") {
|
|
162
164
|
return footer(dialogForm, confirmLoading, params);
|
|
163
165
|
}
|
|
164
|
-
return footer
|
|
166
|
+
return footer || jsxRuntime.jsx(Footer.default, {
|
|
167
|
+
onCancel: function onCancel() {
|
|
168
|
+
dialogForm === null || dialogForm === void 0 || dialogForm.hide();
|
|
169
|
+
},
|
|
170
|
+
onOk: function onOk() {
|
|
171
|
+
dialogForm === null || dialogForm === void 0 || dialogForm.submit();
|
|
172
|
+
},
|
|
173
|
+
confirmLoading: confirmLoading
|
|
174
|
+
});
|
|
165
175
|
};
|
|
166
176
|
|
|
167
177
|
exports.useCurrentForm = useCurrentForm;
|
|
@@ -26,7 +26,7 @@ export interface HDialogFormInstance<P = any, T = any> extends HFormInstance {
|
|
|
26
26
|
show: (data?: ShowParamsModal<P, T>) => void;
|
|
27
27
|
hide: VoidFunction;
|
|
28
28
|
}
|
|
29
|
-
type FooterRender = (dialogForm?: HDialogFormInstance, loading?: boolean, params?: Record<string, any>) => React.ReactNode;
|
|
29
|
+
export type FooterRender = (dialogForm?: HDialogFormInstance, loading?: boolean, params?: Record<string, any>) => React.ReactNode;
|
|
30
30
|
export interface DialogFormProps<P = any, T = any> extends Omit<RootProps, "onFinish" | "onCancel" | "onOk" | "infoRequest" | "title" | "footer"> {
|
|
31
31
|
dialogForm?: HDialogFormInstance;
|
|
32
32
|
onFinish?: (values: T, params: P) => Promise<any>;
|
package/lib/Form/config.d.ts
CHANGED
|
@@ -36,6 +36,6 @@ declare const componentConfig: {
|
|
|
36
36
|
placeholder: ({ label }: import("./modal").HItemProps) => string[];
|
|
37
37
|
};
|
|
38
38
|
treeSelect: ({ request, onlyCheckChild, multiple, treeCheckable, treeData, fieldNames, ...props }: import("../Select/TreeSelect").HTreeSelectProps) => JSX.Element;
|
|
39
|
-
text: ({ value }: import("
|
|
39
|
+
text: ({ value }: import("./modal").HFormItemProps) => JSX.Element;
|
|
40
40
|
};
|
|
41
41
|
export default componentConfig;
|
package/lib/Form/modal.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ import type { DataFnProvider } from "../modal";
|
|
|
17
17
|
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
|
-
import { BaseOptions } from "@ahooksjs/use-request/lib/types";
|
|
20
|
+
import type { BaseOptions } from "@ahooksjs/use-request/lib/types";
|
|
21
21
|
type RenderFun = (props: HItemProps, node: React.ReactNode, form: FormInstance) => React.ReactNode;
|
|
22
22
|
export type ItemPropsType = HCheckboxProps | HInputProps | HSelectInputProps | HButtonProps | HRadioGroupProps | HSelectProps | ButtonProps | HSwitchProps | HDatePickerProps | HRangePickerProps | HTimePickerProps | TextAreaProps | IUpLoadProps | CascaderProps<any> | IUrlUploadProps;
|
|
23
23
|
export interface HoverModal {
|
package/lib/Input/ButtonInput.js
CHANGED
|
@@ -9,6 +9,7 @@ var _regeneratorRuntime = require('@babel/runtime-corejs3/regenerator');
|
|
|
9
9
|
var jsxRuntime = require('react/jsx-runtime');
|
|
10
10
|
var antd = require('antd');
|
|
11
11
|
var ahooks = require('ahooks');
|
|
12
|
+
var hj = require('@hw-component/hj');
|
|
12
13
|
|
|
13
14
|
var _excluded = ["buttonProps", "value", "onChange", "children", "request", "layType"],
|
|
14
15
|
_excluded2 = ["onClick", "type", "ghost", "loading"];
|
|
@@ -71,7 +72,7 @@ var Index = function Index(_ref) {
|
|
|
71
72
|
}();
|
|
72
73
|
if (layType === "text") {
|
|
73
74
|
return jsxRuntime.jsx(antd.Input, _objectSpread(_objectSpread({}, props), {}, {
|
|
74
|
-
suffix: jsxRuntime.jsx(
|
|
75
|
+
suffix: jsxRuntime.jsx(hj.HJBtn, _objectSpread(_objectSpread({
|
|
75
76
|
type: btnType,
|
|
76
77
|
onClick: click,
|
|
77
78
|
size: "small",
|
|
@@ -93,13 +94,12 @@ var Index = function Index(_ref) {
|
|
|
93
94
|
},
|
|
94
95
|
value: value,
|
|
95
96
|
onChange: change
|
|
96
|
-
})), jsxRuntime.jsx(
|
|
97
|
+
})), jsxRuntime.jsx(hj.HJBtn, _objectSpread(_objectSpread({
|
|
97
98
|
type: btnType,
|
|
98
99
|
onClick: click,
|
|
99
100
|
loading: loading || btnLoading,
|
|
100
101
|
style: {
|
|
101
|
-
marginLeft: 8
|
|
102
|
-
borderRadius: 4
|
|
102
|
+
marginLeft: 8
|
|
103
103
|
},
|
|
104
104
|
ghost: ghost
|
|
105
105
|
}, oProps), {}, {
|
package/lib/Input/SelectInput.js
CHANGED
|
@@ -56,6 +56,7 @@ var Index = function Index(_ref) {
|
|
|
56
56
|
Object.values(valueName).forEach(function (key) {
|
|
57
57
|
resultObj[key] = initValue[key];
|
|
58
58
|
});
|
|
59
|
+
console.log(item, valueName);
|
|
59
60
|
return _defineProperty({}, name, resultObj);
|
|
60
61
|
},
|
|
61
62
|
outputValue: function outputValue(item, _outputValue) {
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var antd = require('antd');
|
|
7
7
|
var icons = require('@ant-design/icons');
|
|
8
|
+
var hj = require('@hw-component/hj');
|
|
8
9
|
|
|
9
10
|
var Text = antd.Typography.Text;
|
|
10
11
|
var ErrorComponent = (function (_ref) {
|
|
@@ -27,7 +28,7 @@ var ErrorComponent = (function (_ref) {
|
|
|
27
28
|
}), jsxRuntime.jsx(Text, {
|
|
28
29
|
type: "danger",
|
|
29
30
|
children: error === null || error === void 0 ? void 0 : error.message
|
|
30
|
-
}), jsxRuntime.jsx(
|
|
31
|
+
}), jsxRuntime.jsx(hj.HJBtn, {
|
|
31
32
|
type: "primary",
|
|
32
33
|
size: "small",
|
|
33
34
|
onClick: reload,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TreeSelectProps } from "antd/lib/tree-select";
|
|
2
|
-
import { PromiseFnResult } from "../modal";
|
|
1
|
+
import type { TreeSelectProps } from "antd/lib/tree-select";
|
|
2
|
+
import type { PromiseFnResult } from "../modal";
|
|
3
3
|
export interface HTreeSelectProps extends TreeSelectProps {
|
|
4
4
|
request?: PromiseFnResult;
|
|
5
5
|
onlyCheckChild?: boolean;
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var antd = require('antd');
|
|
7
7
|
var icons = require('@ant-design/icons');
|
|
8
|
+
var hj = require('@hw-component/hj');
|
|
8
9
|
|
|
9
10
|
var Text = antd.Typography.Text;
|
|
10
11
|
var NotFoundContent = (function (_ref) {
|
|
@@ -28,7 +29,7 @@ var NotFoundContent = (function (_ref) {
|
|
|
28
29
|
}), jsxRuntime.jsx(Text, {
|
|
29
30
|
type: "danger",
|
|
30
31
|
children: error.message
|
|
31
|
-
}), jsxRuntime.jsx(
|
|
32
|
+
}), jsxRuntime.jsx(hj.HJBtn, {
|
|
32
33
|
type: "primary",
|
|
33
34
|
size: "small",
|
|
34
35
|
onClick: reload,
|
package/lib/Submit/components.js
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
4
4
|
var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
-
var antd = require('antd');
|
|
7
6
|
var index = require('../Form/Context/index.js');
|
|
8
7
|
var React = require('react');
|
|
8
|
+
var hj = require('@hw-component/hj');
|
|
9
9
|
|
|
10
10
|
var _excluded = ["form", "style"],
|
|
11
11
|
_excluded2 = ["type", "form", "text", "loading", "style"],
|
|
@@ -19,7 +19,7 @@ function ResetBtn(_ref) {
|
|
|
19
19
|
borderRadius: 4
|
|
20
20
|
} : _ref$style,
|
|
21
21
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
22
|
-
return jsxRuntime.jsx(
|
|
22
|
+
return jsxRuntime.jsx(hj.HJBtn, _objectSpread(_objectSpread({}, props), {}, {
|
|
23
23
|
style: style,
|
|
24
24
|
onClick: function onClick() {
|
|
25
25
|
form.resetFields();
|
|
@@ -42,7 +42,7 @@ function SubBtn(_ref2) {
|
|
|
42
42
|
var _useFormContext = index.useFormContext(),
|
|
43
43
|
_useFormContext$loadi = _useFormContext.loading,
|
|
44
44
|
formSubLoading = _useFormContext$loadi === void 0 ? loading : _useFormContext$loadi;
|
|
45
|
-
return jsxRuntime.jsx(
|
|
45
|
+
return jsxRuntime.jsx(hj.HJBtn, _objectSpread(_objectSpread({}, props), {}, {
|
|
46
46
|
type: type,
|
|
47
47
|
onClick: form.submit,
|
|
48
48
|
loading: formSubLoading,
|
package/lib/Switch/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { SwitchProps } from "antd";
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
import type { ValueSwitchMapModal } from "../modal";
|
|
4
4
|
import type { addFormatItemModal } from "../Form/modal";
|
|
5
|
-
import { PromiseFnResult } from "../modal";
|
|
5
|
+
import type { PromiseFnResult } from "../modal";
|
|
6
6
|
export interface HSwitchProps extends Omit<SwitchProps, "onChange"> {
|
|
7
7
|
valueMap?: ValueSwitchMapModal;
|
|
8
8
|
value?: any;
|
package/lib/Text/index.d.ts
CHANGED
package/lib/index.css
CHANGED
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
flex-direction: row;
|
|
20
20
|
}
|
|
21
21
|
.ant-hw-select-box .ant-hw-group-addon-before {
|
|
22
|
-
border-
|
|
22
|
+
border-right: 0;
|
|
23
23
|
border-top-left-radius: 2px;
|
|
24
|
-
border-
|
|
24
|
+
border-bottom-left-radius: 2px;
|
|
25
25
|
}
|
|
26
26
|
.ant-hw-select-box .ant-select {
|
|
27
27
|
-webkit-box-flex: 1;
|
|
@@ -30,17 +30,17 @@
|
|
|
30
30
|
flex: 1;
|
|
31
31
|
}
|
|
32
32
|
.ant-hw-select-box .ant-hw-group-addon-after {
|
|
33
|
-
border-
|
|
33
|
+
border-left: 0;
|
|
34
34
|
border-top-right-radius: 2px;
|
|
35
|
-
border-
|
|
35
|
+
border-bottom-right-radius: 2px;
|
|
36
36
|
}
|
|
37
37
|
.ant-hw-select-box-addon-before .ant-select .ant-select-selector {
|
|
38
|
-
border-
|
|
39
|
-
border-
|
|
38
|
+
border-top-left-radius: 0 !important;
|
|
39
|
+
border-bottom-left-radius: 0 !important;
|
|
40
40
|
}
|
|
41
41
|
.ant-hw-select-box-addon-after .ant-select .ant-select-selector {
|
|
42
|
-
border-
|
|
43
|
-
border-
|
|
42
|
+
border-top-right-radius: 0 !important;
|
|
43
|
+
border-bottom-right-radius: 0 !important;
|
|
44
44
|
}
|
|
45
45
|
.ant-hw-form-item-colon:after {
|
|
46
46
|
position: relative;
|
package/lib/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./styles/index.less";
|
|
2
2
|
export { default as HForm } from "./Form";
|
|
3
3
|
export { default as useHForm } from "./Form/hooks/useHForm";
|
|
4
|
-
export { useHDialogForm } from "
|
|
4
|
+
export { useHDialogForm } from "@/components/DialogForm/hooks";
|
|
5
5
|
export { default as HFormConnect } from "./Form/HFormConnect";
|
|
6
6
|
export { default as HFormConfigProvider } from "./Form/Context/FormConfigProvider";
|
|
7
7
|
export { default as HBasicForm } from "./Form/Basic";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hw-component/form",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.47",
|
|
4
4
|
"description": "基于antd二次开发",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -85,13 +85,15 @@
|
|
|
85
85
|
"webpack": "^5.83.1",
|
|
86
86
|
"webpack-cli": "^5.1.1",
|
|
87
87
|
"webpack-dev-server": "^4.15.0",
|
|
88
|
-
"webpackbar": "^5.0.2"
|
|
88
|
+
"webpackbar": "^5.0.2",
|
|
89
|
+
"@hw-component/hj": "0.9.0"
|
|
89
90
|
},
|
|
90
91
|
"peerDependencies": {
|
|
91
92
|
"@ant-design/icons": "4.6.2",
|
|
92
93
|
"antd": "4.20.7",
|
|
93
94
|
"react": "17.0.0",
|
|
94
|
-
"react-dom": "17.0.2"
|
|
95
|
+
"react-dom": "17.0.2",
|
|
96
|
+
"@hw-component/hj": "0.9.0"
|
|
95
97
|
},
|
|
96
98
|
"cssPrefix": "hw"
|
|
97
99
|
}
|
|
@@ -43,15 +43,15 @@ const Index = ({
|
|
|
43
43
|
resultObj[key] = initValue[key];
|
|
44
44
|
});
|
|
45
45
|
return {
|
|
46
|
-
[
|
|
46
|
+
[name as string]: resultObj,
|
|
47
47
|
};
|
|
48
48
|
},
|
|
49
49
|
outputValue: (item, outputValue) => {
|
|
50
50
|
const { name = "" } = item;
|
|
51
|
-
const { [
|
|
51
|
+
const { [name as string]: itemVal = {} } = outputValue;
|
|
52
52
|
if (Array.isArray(itemVal)) {
|
|
53
53
|
return {
|
|
54
|
-
[
|
|
54
|
+
[name as string]: itemVal,
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
57
|
return {
|