@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.
@@ -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;
@@ -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
  }
@@ -19,6 +19,7 @@ export interface AntdThemeConfig {
19
19
  dark?: boolean;
20
20
  }
21
21
  export interface ConfigProviderProps {
22
+ [key: string]: any;
22
23
  theme?: AntdThemeConfig;
23
24
  locale?: any;
24
25
  componentSize?: 'small' | 'middle' | 'large';
@@ -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;
@@ -51,7 +51,14 @@ export interface FormProps {
51
51
  className?: string;
52
52
  [key: string]: any;
53
53
  }
54
- export declare const Form: React.ForwardRefExoticComponent<Omit<FormProps, "ref"> & React.RefAttributes<FormInstance>>;
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 {};
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  export interface InputProps {
3
+ [key: string]: any;
3
4
  value?: string;
4
5
  defaultValue?: string;
5
6
  onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
@@ -11,6 +11,7 @@ import React from 'react';
11
11
  * 且消费方的 Tailwind className(full / flex flex-col / h-full)能直接生效。
12
12
  */
13
13
  export interface LayoutProps {
14
+ [key: string]: any;
14
15
  children?: React.ReactNode;
15
16
  style?: React.CSSProperties;
16
17
  className?: string;
@@ -7,6 +7,7 @@ export interface MenuItemType {
7
7
  disabled?: boolean;
8
8
  }
9
9
  export interface MenuProps {
10
+ [key: string]: any;
10
11
  items?: MenuItemType[];
11
12
  mode?: 'horizontal' | 'vertical' | 'inline';
12
13
  selectedKeys?: string[];
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  export interface ModalProps {
3
+ [key: string]: any;
3
4
  open?: boolean;
4
5
  title?: React.ReactNode;
5
6
  width?: string | number;
@@ -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
- return (_jsxs(HbDialog, { modelValue: open || false, title: typeof title === 'string' ? title : '', width: width ? String(width) : undefined, closeOnClickModal: maskClosable, closeOnPressEscape: keyboard, showClose: true, onHbClose: () => { if (onCancel)
7
- onCancel({}); }, children: [children, props.footer !== null && props.footer !== undefined ? props.footer : null] }));
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');
@@ -5,6 +5,7 @@ export interface SelectOption {
5
5
  disabled?: boolean;
6
6
  }
7
7
  export interface SelectProps {
8
+ [key: string]: any;
8
9
  value?: string | number | (string | number)[];
9
10
  defaultValue?: string | number | (string | number)[];
10
11
  onChange?: (value: any, option: any) => void;
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  export interface TreeProps {
3
+ [key: string]: any;
3
4
  treeData?: any[];
4
5
  checkable?: boolean;
5
6
  checkStrictly?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@huibo-ui/react-antd",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "antd 兼容层 — 接收 antd 原生 props,内部转换为 huibo-ui,实现丝滑平替",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",