@huibo-ui/react-antd 1.0.2 → 1.0.4
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/lib/components/Button.d.ts +4 -1
- package/lib/components/Button.js +2 -2
- package/lib/components/ConfigProvider.d.ts +1 -0
- package/lib/components/DatePicker.d.ts +2 -0
- package/lib/components/Form.d.ts +9 -1
- package/lib/components/Input.d.ts +1 -0
- package/lib/components/Layout.d.ts +1 -0
- package/lib/components/Menu.d.ts +1 -0
- package/lib/components/Modal.d.ts +1 -0
- package/lib/components/Modal.js +7 -4
- package/lib/components/Select.d.ts +1 -0
- package/lib/components/Tree.d.ts +1 -0
- package/package.json +1 -1
|
@@ -8,7 +8,10 @@ export interface ButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonE
|
|
|
8
8
|
loading?: boolean;
|
|
9
9
|
disabled?: boolean;
|
|
10
10
|
icon?: React.ReactNode;
|
|
11
|
+
/** antd htmlType:submit/reset/button。转发到 hb-button 内部 <button type>,触发表单提交。 */
|
|
12
|
+
htmlType?: 'button' | 'submit' | 'reset';
|
|
11
13
|
children?: React.ReactNode;
|
|
12
14
|
onClick?: React.MouseEventHandler<HTMLButtonElement>;
|
|
15
|
+
[key: string]: any;
|
|
13
16
|
}
|
|
14
|
-
export declare function Button({ type, size, danger, block, loading, disabled, icon, children, onClick, ...rest }: ButtonProps): React.JSX.Element;
|
|
17
|
+
export declare function Button({ type, size, danger, block, loading, disabled, icon, htmlType, children, onClick, ...rest }: ButtonProps): React.JSX.Element;
|
package/lib/components/Button.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { HbButton } from '@huibo-ui/react';
|
|
3
|
-
export function Button({ type, size, danger, block, loading, disabled, icon, children, onClick, ...rest }) {
|
|
3
|
+
export function Button({ type, size, danger, block, loading, disabled, icon, htmlType, children, onClick, ...rest }) {
|
|
4
4
|
const huiboType = danger ? 'danger' : type || 'default';
|
|
5
5
|
const huiboSize = size === 'middle' ? 'default' : size || 'default';
|
|
6
|
-
return (_jsxs(HbButton, { type: huiboType, size: huiboSize, disabled: disabled, loading: loading, onClick: onClick, children: [icon, children] }));
|
|
6
|
+
return (_jsxs(HbButton, { type: huiboType, htmlType: htmlType || 'button', size: huiboSize, disabled: disabled, loading: loading, block: block, onClick: onClick, children: [icon, children] }));
|
|
7
7
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export interface DatePickerProps {
|
|
3
|
+
[key: string]: any;
|
|
3
4
|
value?: any;
|
|
4
5
|
onChange?: (value: any, dateString: string) => void;
|
|
5
6
|
picker?: 'date' | 'month' | 'year' | 'week' | 'quarter';
|
|
@@ -20,6 +21,7 @@ export declare namespace DatePicker {
|
|
|
20
21
|
var RangePicker: any;
|
|
21
22
|
}
|
|
22
23
|
export interface RangePickerProps {
|
|
24
|
+
[key: string]: any;
|
|
23
25
|
value?: any[];
|
|
24
26
|
onChange?: (dates: any[], dateStrings: [string, string]) => void;
|
|
25
27
|
format?: string;
|
package/lib/components/Form.d.ts
CHANGED
|
@@ -51,7 +51,14 @@ export interface FormProps {
|
|
|
51
51
|
className?: string;
|
|
52
52
|
[key: string]: any;
|
|
53
53
|
}
|
|
54
|
-
|
|
54
|
+
type FormType = React.ForwardRefExoticComponent<FormProps & React.RefAttributes<FormInstance>> & {
|
|
55
|
+
Item: any;
|
|
56
|
+
useForm: () => [FormInstance];
|
|
57
|
+
useWatch: (namePath: string | string[], form?: FormInstance) => any;
|
|
58
|
+
List: any;
|
|
59
|
+
Provider: any;
|
|
60
|
+
};
|
|
61
|
+
export declare const Form: FormType;
|
|
55
62
|
export interface FormItemProps {
|
|
56
63
|
name?: string | string[];
|
|
57
64
|
label?: React.ReactNode;
|
|
@@ -76,3 +83,4 @@ export interface FormItemProps {
|
|
|
76
83
|
[key: string]: any;
|
|
77
84
|
}
|
|
78
85
|
export declare function FormItem(props: FormItemProps): React.JSX.Element;
|
|
86
|
+
export {};
|
package/lib/components/Menu.d.ts
CHANGED
package/lib/components/Modal.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { HbDialog } from '@huibo-ui/react';
|
|
4
4
|
export function Modal(props) {
|
|
5
|
-
const { open, title, width, onCancel, maskClosable = true, keyboard = true, children } = props;
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
const { open, title, width, onCancel, onOk, confirmLoading, okText, cancelText, maskClosable = true, keyboard = true, destroyOnClose, footer, children } = props;
|
|
6
|
+
// 默认 footer:OK/Cancel 按钮(对齐 antd 默认行为)。footer=null 时无底部。
|
|
7
|
+
const defaultFooter = (_jsxs("div", { style: { textAlign: 'right', marginTop: 16, display: 'flex', justifyContent: 'flex-end', gap: 8 }, children: [_jsx("button", { type: "button", onClick: (e) => onCancel?.(e), style: { padding: '4px 15px', height: 32, borderRadius: 6, border: '1px solid #d9d9d9', background: '#fff', cursor: 'pointer' }, children: cancelText || '取消' }), _jsx("button", { type: "button", disabled: confirmLoading, onClick: (e) => onOk?.(e), style: { padding: '4px 15px', height: 32, borderRadius: 6, border: 'none', background: 'var(--hb-color-primary, #ff6700)', color: '#fff', cursor: 'pointer' }, children: confirmLoading ? '加载中...' : (okText || '确定') })] }));
|
|
8
|
+
const resolvedFooter = footer === undefined ? defaultFooter : footer;
|
|
9
|
+
return (_jsxs(HbDialog, { modelValue: open || false, title: typeof title === 'string' ? title : '', width: width ? String(width) : undefined, closeOnClickModal: maskClosable, closeOnPressEscape: keyboard, destroyOnClose: destroyOnClose, showClose: true, onHbClose: () => { if (onCancel)
|
|
10
|
+
onCancel({}); }, children: [children, resolvedFooter !== null && resolvedFooter !== undefined ? resolvedFooter : null] }));
|
|
8
11
|
}
|
|
9
12
|
function imperative(opts) {
|
|
10
13
|
const div = document.createElement('div');
|
package/lib/components/Tree.d.ts
CHANGED