@huibo-ui/react-antd 1.0.10 → 1.0.11

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.
Files changed (49) hide show
  1. package/lib/components/Affix.js +1 -1
  2. package/lib/components/Alert.js +1 -1
  3. package/lib/components/Avatar.js +1 -1
  4. package/lib/components/BackTop.js +1 -1
  5. package/lib/components/Badge.js +1 -1
  6. package/lib/components/Breadcrumb.js +4 -2
  7. package/lib/components/Card.js +1 -1
  8. package/lib/components/Checkbox.js +2 -2
  9. package/lib/components/Collapse.js +4 -2
  10. package/lib/components/Descriptions.js +3 -5
  11. package/lib/components/Divider.js +1 -1
  12. package/lib/components/Drawer.js +1 -1
  13. package/lib/components/Dropdown.js +1 -1
  14. package/lib/components/FloatButton.js +1 -1
  15. package/lib/components/Form.js +34 -23
  16. package/lib/components/Image.js +1 -1
  17. package/lib/components/InputNumber.js +1 -1
  18. package/lib/components/Layout.js +3 -3
  19. package/lib/components/Menu.js +2 -2
  20. package/lib/components/Modal.js +5 -3
  21. package/lib/components/PageHeader.js +1 -1
  22. package/lib/components/Pagination.js +1 -1
  23. package/lib/components/Popconfirm.js +1 -1
  24. package/lib/components/Popover.js +1 -1
  25. package/lib/components/Progress.js +1 -1
  26. package/lib/components/Radio.js +2 -2
  27. package/lib/components/Rate.js +1 -1
  28. package/lib/components/Result.js +1 -1
  29. package/lib/components/Segmented.js +1 -1
  30. package/lib/components/Select.js +1 -1
  31. package/lib/components/Slider.js +1 -1
  32. package/lib/components/Space.js +1 -1
  33. package/lib/components/Spin.js +1 -1
  34. package/lib/components/Statistic.js +1 -1
  35. package/lib/components/Steps.js +4 -2
  36. package/lib/components/Switch.js +1 -1
  37. package/lib/components/Table.js +68 -12
  38. package/lib/components/Tabs.js +1 -1
  39. package/lib/components/Tag.js +12 -2
  40. package/lib/components/TimePicker.js +1 -1
  41. package/lib/components/Tooltip.js +1 -1
  42. package/lib/components/Tree.js +2 -4
  43. package/lib/components/TreeSelect.js +1 -1
  44. package/lib/components/Typography.js +5 -1
  45. package/lib/components/Upload.js +1 -1
  46. package/lib/components/Watermark.js +1 -1
  47. package/lib/components/message.js +4 -3
  48. package/lib/components/notification.js +3 -1
  49. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { HbAffix } from '@huibo-ui/react';
3
3
  export function Affix(props) {
4
- return _jsx(HbAffix, { top: props.offsetTop, bottom: props.offsetBottom, children: props.children });
4
+ return (_jsx(HbAffix, { top: props.offsetTop, bottom: props.offsetBottom, children: props.children }));
5
5
  }
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { HbAlert } from '@huibo-ui/react';
3
3
  export function Alert(props) {
4
- return _jsx(HbAlert, { type: props.type, title: typeof props.message === 'string' ? props.message : '', closable: props.closable, showIcon: props.showIcon ?? true, onHbClose: () => props.onClose?.(), style: props.style });
4
+ return (_jsx(HbAlert, { type: props.type, title: typeof props.message === 'string' ? props.message : '', closable: props.closable, showIcon: props.showIcon ?? true, onHbClose: () => props.onClose?.(), style: props.style }));
5
5
  }
@@ -2,5 +2,5 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { HbAvatar } from '@huibo-ui/react';
3
3
  export function Avatar(props) {
4
4
  const sz = props.size === 'middle' ? 'default' : props.size;
5
- return _jsx(HbAvatar, { size: sz, shape: props.shape, style: props.style, children: props.src ? null : props.children });
5
+ return (_jsx(HbAvatar, { size: sz, shape: props.shape, style: props.style, children: props.src ? null : props.children }));
6
6
  }
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { HbBacktop } from '@huibo-ui/react';
3
3
  export function BackTop(props) {
4
- return _jsx(HbBacktop, { visibilityHeight: props.visibilityHeight, onHbClick: () => props.onClick?.(), children: props.children });
4
+ return (_jsx(HbBacktop, { visibilityHeight: props.visibilityHeight, onHbClick: () => props.onClick?.(), children: props.children }));
5
5
  }
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { HbBadge } from '@huibo-ui/react';
3
3
  export function Badge(props) {
4
- return _jsx(HbBadge, { value: props.count ?? 0, max: props.overflowCount ?? 99, type: props.status, dot: props.dot, showZero: props.showZero, children: props.children });
4
+ return (_jsx(HbBadge, { value: props.count ?? 0, max: props.overflowCount ?? 99, type: props.status, dot: props.dot, showZero: props.showZero, children: props.children }));
5
5
  }
@@ -3,8 +3,10 @@ import React from 'react';
3
3
  import { HbBreadcrumb, HbBreadcrumbItem } from '@huibo-ui/react';
4
4
  export function Breadcrumb(props) {
5
5
  if (props.items) {
6
- return _jsx(HbBreadcrumb, { separator: props.separator, children: props.items.map((item, i) => React.createElement(HbBreadcrumbItem, { key: i, href: item.href }, item.title)) });
6
+ return (_jsx(HbBreadcrumb, { separator: props.separator, children: props.items.map((item, i) => React.createElement(HbBreadcrumbItem, { key: i, href: item.href }, item.title)) }));
7
7
  }
8
8
  return _jsx(HbBreadcrumb, { children: props.children });
9
9
  }
10
- Breadcrumb.Item = function BreadcrumbItem(props) { return React.createElement(HbBreadcrumbItem, props); };
10
+ Breadcrumb.Item = function BreadcrumbItem(props) {
11
+ return React.createElement(HbBreadcrumbItem, props);
12
+ };
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { HbCard } from '@huibo-ui/react';
3
3
  export function Card(props) {
4
- return _jsx(HbCard, { header: typeof props.title === 'string' ? props.title : '', border: props.bordered ?? true, bodyStyle: props.bodyStyle, style: props.style, children: props.children });
4
+ return (_jsx(HbCard, { header: typeof props.title === 'string' ? props.title : '', border: props.bordered ?? true, bodyStyle: props.bodyStyle, style: props.style, children: props.children }));
5
5
  }
@@ -1,10 +1,10 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { HbCheckbox, HbCheckboxGroup } from '@huibo-ui/react';
3
3
  export function Checkbox(props) {
4
- return _jsx(HbCheckbox, { checked: props.checked ?? false, disabled: props.disabled, label: props.children, onHbChange: (e) => props.onChange?.({ target: { checked: e.detail } }), children: props.children });
4
+ return (_jsx(HbCheckbox, { checked: props.checked ?? false, disabled: props.disabled, label: props.children, onHbChange: (e) => props.onChange?.({ target: { checked: e.detail } }), children: props.children }));
5
5
  }
6
6
  export function CheckboxGroup(props) {
7
- return _jsx(HbCheckboxGroup, { modelValue: props.value ?? [], options: props.options || [], disabled: props.disabled, onHbChange: (e) => props.onChange?.(e.detail), children: props.children });
7
+ return (_jsx(HbCheckboxGroup, { modelValue: props.value ?? [], options: props.options || [], disabled: props.disabled, onHbChange: (e) => props.onChange?.(e.detail), children: props.children }));
8
8
  }
9
9
  // antd 静态子组件:Checkbox.Group
10
10
  Checkbox.Group = CheckboxGroup;
@@ -2,6 +2,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import React from 'react';
3
3
  import { HbCollapse, HbCollapseItem } from '@huibo-ui/react';
4
4
  export function Collapse(props) {
5
- return _jsx(HbCollapse, { modelValue: Array.isArray(props.activeKey) ? props.activeKey : props.activeKey ? [props.activeKey] : [], accordion: props.accordion, style: props.style, children: props.children });
5
+ return (_jsx(HbCollapse, { modelValue: Array.isArray(props.activeKey) ? props.activeKey : props.activeKey ? [props.activeKey] : [], accordion: props.accordion, style: props.style, children: props.children }));
6
6
  }
7
- Collapse.Panel = function Panel(props) { return React.createElement(HbCollapseItem, { header: props.header, name: props.key }, props.children); };
7
+ Collapse.Panel = function Panel(props) {
8
+ return React.createElement(HbCollapseItem, { header: props.header, name: props.key }, props.children);
9
+ };
@@ -19,10 +19,8 @@ function itemsFromChildren(children) {
19
19
  return out;
20
20
  }
21
21
  export function Descriptions(props) {
22
- const { title, bordered = false, column = 3, colon = true, items, contentStyle, labelStyle, children, style, className, } = props;
23
- const resolved = items && items.length > 0
24
- ? items.map(it => ({ label: it.label, value: it.children, span: SPAN(it.span) }))
25
- : itemsFromChildren(children);
22
+ const { title, bordered = false, column = 3, colon = true, items, contentStyle, labelStyle, children, style, className } = props;
23
+ const resolved = items && items.length > 0 ? items.map(it => ({ label: it.label, value: it.children, span: SPAN(it.span) })) : itemsFromChildren(children);
26
24
  const cols = column > 0 ? Math.floor(column) : 3;
27
25
  // 按列数把 items 切成行(span 累计超过列数则换行),用于 bordered 表格渲染
28
26
  const rows = [];
@@ -44,7 +42,7 @@ export function Descriptions(props) {
44
42
  const LABEL_COLOR = 'rgba(0,0,0,0.88)';
45
43
  const VALUE_COLOR = 'rgba(0,0,0,0.88)';
46
44
  const PAD = 16;
47
- const titleNode = title != null ? (_jsx("div", { style: { fontSize: 16, fontWeight: 500, color: LABEL_COLOR, marginBottom: 12 }, children: title })) : null;
45
+ const titleNode = title != null ? _jsx("div", { style: { fontSize: 16, fontWeight: 500, color: LABEL_COLOR, marginBottom: 12 }, children: title }) : null;
48
46
  let body;
49
47
  if (bordered) {
50
48
  body = (_jsx("table", { style: { borderCollapse: 'collapse', width: '100%', tableLayout: 'fixed', fontSize: 14 }, children: _jsx("tbody", { children: rows.map((row, ri) => (_jsx("tr", { children: row.flatMap((it, ci) => [
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { HbDivider } from '@huibo-ui/react';
3
3
  export function Divider(props) {
4
- return _jsx(HbDivider, { direction: props.type, contentPosition: props.orientation, dashed: props.dashed, style: props.style, children: props.children });
4
+ return (_jsx(HbDivider, { direction: props.type, contentPosition: props.orientation, dashed: props.dashed, style: props.style, children: props.children }));
5
5
  }
@@ -2,5 +2,5 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { HbDrawer } from '@huibo-ui/react';
3
3
  export function Drawer(props) {
4
4
  const dirMap = { left: 'ltr', right: 'rtl', top: 'ttb', bottom: 'btt' };
5
- return _jsx(HbDrawer, { modelValue: props.open ?? false, title: typeof props.title === 'string' ? props.title : '', direction: dirMap[props.placement || 'right'], size: props.width ? String(props.width) : undefined, closeOnClickModal: props.maskClosable ?? true, onHbClose: () => props.onClose?.(), children: props.children });
5
+ return (_jsx(HbDrawer, { modelValue: props.open ?? false, title: typeof props.title === 'string' ? props.title : '', direction: dirMap[props.placement || 'right'], size: props.width ? String(props.width) : undefined, closeOnClickModal: props.maskClosable ?? true, onHbClose: () => props.onClose?.(), children: props.children }));
6
6
  }
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { HbDropdown } from '@huibo-ui/react';
3
3
  export function Dropdown(props) {
4
- return _jsx(HbDropdown, { items: props.menu?.items || [], trigger: (props.trigger?.[0] || 'hover'), placement: props.placement, children: props.children });
4
+ return (_jsx(HbDropdown, { items: props.menu?.items || [], trigger: (props.trigger?.[0] || 'hover'), placement: props.placement, children: props.children }));
5
5
  }
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { HbFloatButton } from '@huibo-ui/react';
3
3
  export function FloatButton(props) {
4
- return _jsx(HbFloatButton, { type: props.type, icon: props.icon, shape: props.shape, onHbClick: () => props.onClick?.(), children: props.children });
4
+ return (_jsx(HbFloatButton, { type: props.type, icon: props.icon, shape: props.shape, onHbClick: () => props.onClick?.(), children: props.children }));
5
5
  }
@@ -18,12 +18,14 @@ function createFormInstance() {
18
18
  });
19
19
  };
20
20
  const inst = {
21
- getFieldValue: (name) => values[name],
22
- getFieldsValue: (nameList) => {
21
+ getFieldValue: name => values[name],
22
+ getFieldsValue: nameList => {
23
23
  if (nameList && nameList.length > 0) {
24
24
  const picked = {};
25
- nameList.forEach(n => { if (n in values)
26
- picked[n] = values[n]; });
25
+ nameList.forEach(n => {
26
+ if (n in values)
27
+ picked[n] = values[n];
28
+ });
27
29
  return picked;
28
30
  }
29
31
  return { ...values };
@@ -32,26 +34,36 @@ function createFormInstance() {
32
34
  values[name] = value;
33
35
  void run(el => el.setFieldValueMethod(name, value));
34
36
  },
35
- setFieldsValue: (vals) => {
37
+ setFieldsValue: vals => {
36
38
  if (vals)
37
39
  Object.assign(values, vals);
38
40
  void run(el => el.setFieldsValue(vals));
39
41
  },
40
- resetFields: (nameList) => {
42
+ resetFields: nameList => {
41
43
  if (nameList && nameList.length > 0) {
42
- nameList.forEach(n => { delete values[n]; });
44
+ nameList.forEach(n => {
45
+ delete values[n];
46
+ });
43
47
  }
44
48
  else {
45
- Object.keys(values).forEach(k => { delete values[k]; });
49
+ Object.keys(values).forEach(k => {
50
+ delete values[k];
51
+ });
46
52
  }
47
53
  void run(el => el.resetFields(nameList));
48
54
  },
49
- validateFields: (nameList) => run(el => el.validateFields(nameList)).then(() => ({ ...values })),
50
- validate: (nameList) => run(el => (nameList ? el.validate(nameList) : el.validate())),
51
- submit: () => { void run(async (el) => { try {
52
- await el.validateFields();
53
- }
54
- catch { /* 校验失败由 FormItem 展示 */ } }); },
55
+ validateFields: nameList => run(el => el.validateFields(nameList)).then(() => ({ ...values })),
56
+ validate: nameList => run(el => (nameList ? el.validate(nameList) : el.validate())),
57
+ submit: () => {
58
+ void run(async (el) => {
59
+ try {
60
+ await el.validateFields();
61
+ }
62
+ catch {
63
+ /* 校验失败由 FormItem 展示 */
64
+ }
65
+ });
66
+ },
55
67
  scrollToField: () => { },
56
68
  getFieldsError: () => [],
57
69
  getFieldError: () => [],
@@ -59,12 +71,14 @@ function createFormInstance() {
59
71
  };
60
72
  // 内部钩子:Form 组件挂
61
73
  inst.__setRef = bind;
62
- inst.__syncValue = (prop, value) => { if (prop)
63
- values[prop] = value; };
74
+ inst.__syncValue = (prop, value) => {
75
+ if (prop)
76
+ values[prop] = value;
77
+ };
64
78
  return inst;
65
79
  }
66
80
  export const Form = React.forwardRef(function Form(props, ref) {
67
- const { form: formProp, initialValues, onFinish, onFinishFailed, onValuesChange, layout, labelCol, children, style, className, } = props;
81
+ const { form: formProp, initialValues, onFinish, onFinishFailed, onValuesChange, layout, labelCol, children, style, className } = props;
68
82
  const [innerForm] = React.useState(() => formProp || createFormInstance());
69
83
  const form = formProp || innerForm;
70
84
  React.useImperativeHandle(ref, () => form, [form]);
@@ -73,7 +87,6 @@ export const Form = React.forwardRef(function Form(props, ref) {
73
87
  if (initialValues) {
74
88
  void form.setFieldsValue(initialValues);
75
89
  }
76
- // eslint-disable-next-line react-hooks/exhaustive-deps
77
90
  }, []);
78
91
  const labelPosition = layout === 'vertical' ? 'top' : layout === 'inline' ? 'left' : 'right';
79
92
  const elRef = React.useRef(null);
@@ -90,9 +103,7 @@ export const Form = React.forwardRef(function Form(props, ref) {
90
103
  if (!el)
91
104
  return;
92
105
  el.onFinish = onFinish;
93
- el.onFinishFailed = onFinishFailed
94
- ? (errors) => onFinishFailed({ errorFields: errors, values: {} })
95
- : undefined;
106
+ el.onFinishFailed = onFinishFailed ? (errors) => onFinishFailed({ errorFields: errors, values: {} }) : undefined;
96
107
  el.onValuesChange = (info) => {
97
108
  const prop = info?.prop;
98
109
  if (prop)
@@ -117,8 +128,8 @@ Form.useWatch = function useWatch(namePath, form) {
117
128
  }, [form, name]);
118
129
  return val;
119
130
  };
120
- Form.List = (({ children }) => children || null);
121
- Form.Provider = (({ children }) => children || null);
131
+ Form.List = ({ children }) => children || null;
132
+ Form.Provider = ({ children }) => children || null;
122
133
  export function FormItem(props) {
123
134
  const { name, label, rules, required, labelCol, noStyle, children, style, className } = props;
124
135
  const propName = Array.isArray(name) ? name.join('.') : name;
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { HbImage } from '@huibo-ui/react';
3
3
  export function Image(props) {
4
- return _jsx(HbImage, { src: props.src || '', width: props.width ? String(props.width) : undefined, height: props.height ? String(props.height) : undefined, preview: props.preview, alt: props.alt, style: props.style });
4
+ return (_jsx(HbImage, { src: props.src || '', width: props.width ? String(props.width) : undefined, height: props.height ? String(props.height) : undefined, preview: props.preview, alt: props.alt, style: props.style }));
5
5
  }
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { HbInputNumber } from '@huibo-ui/react';
3
3
  export function InputNumber(props) {
4
- return _jsx(HbInputNumber, { modelValue: props.value ?? 0, min: props.min, max: props.max, step: props.step, precision: props.precision, disabled: props.disabled, size: props.size === 'middle' ? 'default' : props.size, placeholder: props.placeholder, style: props.style, onHbChange: (e) => props.onChange?.(e.detail) });
4
+ return (_jsx(HbInputNumber, { modelValue: props.value ?? 0, min: props.min, max: props.max, step: props.step, precision: props.precision, disabled: props.disabled, size: props.size === 'middle' ? 'default' : props.size, placeholder: props.placeholder, style: props.style, onHbChange: (e) => props.onChange?.(e.detail) }));
5
5
  }
@@ -45,9 +45,9 @@ export function Row(props) {
45
45
  const gutter = Array.isArray(props.gutter) ? props.gutter[0] : props.gutter;
46
46
  const gap = gutter ? `${gutter}px` : undefined;
47
47
  const justifyMap = {
48
- start: 'flex-start',
49
- end: 'flex-end',
50
- center: 'center',
48
+ 'start': 'flex-start',
49
+ 'end': 'flex-end',
50
+ 'center': 'center',
51
51
  'space-between': 'space-between',
52
52
  'space-around': 'space-around',
53
53
  };
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import React from 'react';
3
3
  const PRIMARY = 'var(--hb-color-primary, #ff6700)';
4
4
  export function Menu(props) {
5
- const { items, mode = 'vertical', selectedKeys, openKeys, theme = 'light', inlineCollapsed, onClick, onOpenChange, onSelect, style, className, children, } = props;
5
+ const { items, mode = 'vertical', selectedKeys, openKeys, theme = 'light', inlineCollapsed, onClick, onOpenChange, onSelect, style, className, children } = props;
6
6
  const horizontal = mode === 'horizontal';
7
7
  const dark = theme === 'dark';
8
8
  const [internalOpen, setInternalOpen] = React.useState(openKeys ?? []);
@@ -22,7 +22,7 @@ export function Menu(props) {
22
22
  setInternalOpen(next);
23
23
  onOpenChange?.(next);
24
24
  };
25
- const Icon = ({ icon }) => icon ? (_jsx("span", { style: { display: 'inline-flex', alignItems: 'center', marginRight: 8, width: 16, height: 16 }, children: icon })) : null;
25
+ const Icon = ({ icon }) => icon ? _jsx("span", { style: { display: 'inline-flex', alignItems: 'center', marginRight: 8, width: 16, height: 16 }, children: icon }) : null;
26
26
  const textColor = dark ? 'rgba(255,255,255,0.85)' : 'rgba(0,0,0,0.88)';
27
27
  const disabledColor = dark ? 'rgba(255,255,255,0.25)' : 'rgba(0,0,0,0.25)';
28
28
  const renderItem = (item, keyPath) => {
@@ -4,13 +4,15 @@ import { HbDialog } from '@huibo-ui/react';
4
4
  export function Modal(props) {
5
5
  const { open, title, width, onCancel, onOk, confirmLoading, okText, cancelText, maskClosable = true, keyboard = true, destroyOnClose, footer, children } = props;
6
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 || '确定') })] }));
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
8
  const resolvedFooter = footer === undefined ? defaultFooter : footer;
9
9
  // antd width 默认 520(number);hb-dialog width 是 string,number 必须补 px 否则是非法 CSS 被忽略
10
10
  const resolvedWidth = width == null ? undefined : typeof width === 'number' ? `${width}px` : String(width);
11
11
  const wrapClassName = props.wrapClassName;
12
- return (_jsxs(HbDialog, { modelValue: open || false, title: typeof title === 'string' ? title : '', width: resolvedWidth, closeOnClickModal: maskClosable, closeOnPressEscape: keyboard, destroyOnClose: destroyOnClose, showClose: true, style: props.style, className: [props.className, wrapClassName].filter(Boolean).join(' ') || undefined, onHbClose: () => { if (onCancel)
13
- onCancel({}); }, children: [children, resolvedFooter !== null && resolvedFooter !== undefined ? resolvedFooter : null] }));
12
+ return (_jsxs(HbDialog, { modelValue: open || false, title: typeof title === 'string' ? title : '', width: resolvedWidth, closeOnClickModal: maskClosable, closeOnPressEscape: keyboard, destroyOnClose: destroyOnClose, showClose: true, style: props.style, className: [props.className, wrapClassName].filter(Boolean).join(' ') || undefined, onHbClose: () => {
13
+ if (onCancel)
14
+ onCancel({});
15
+ }, children: [children, resolvedFooter !== null && resolvedFooter !== undefined ? resolvedFooter : null] }));
14
16
  }
15
17
  function imperative(opts) {
16
18
  const div = document.createElement('div');
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { HbPageHeader } from '@huibo-ui/react';
3
3
  export function PageHeader(props) {
4
- return _jsx(HbPageHeader, { title: typeof props.title === 'string' ? props.title : '', subtitle: typeof props.subTitle === 'string' ? props.subTitle : '', extra: props.extra, showBack: !!props.onBack });
4
+ return (_jsx(HbPageHeader, { title: typeof props.title === 'string' ? props.title : '', subtitle: typeof props.subTitle === 'string' ? props.subTitle : '', extra: props.extra, showBack: !!props.onBack }));
5
5
  }
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { HbPagination } from '@huibo-ui/react';
3
3
  export function Pagination(props) {
4
- return _jsx(HbPagination, { "current-page": props.current ?? 1, "page-size": props.pageSize ?? 10, total: props.total ?? 0, "show-page-size": props.showSizeChanger, "page-sizes": props.pageSizeOptions?.map(Number), onHbCurrentChange: (e) => props.onChange?.(e.detail, props.pageSize ?? 10), style: props.style });
4
+ return (_jsx(HbPagination, { "current-page": props.current ?? 1, "page-size": props.pageSize ?? 10, total: props.total ?? 0, "show-page-size": props.showSizeChanger, "page-sizes": props.pageSizeOptions?.map(Number), onHbCurrentChange: (e) => props.onChange?.(e.detail, props.pageSize ?? 10), style: props.style }));
5
5
  }
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { HbPopconfirm } from '@huibo-ui/react';
3
3
  export function Popconfirm(props) {
4
- return _jsx(HbPopconfirm, { title: typeof props.title === 'string' ? props.title : '', confirmText: props.okText, cancelText: props.cancelText, position: (props.placement || 'top'), onHbConfirm: () => props.onConfirm?.(), onHbCancel: () => props.onCancel?.(), children: props.children });
4
+ return (_jsx(HbPopconfirm, { title: typeof props.title === 'string' ? props.title : '', confirmText: props.okText, cancelText: props.cancelText, position: (props.placement || 'top'), onHbConfirm: () => props.onConfirm?.(), onHbCancel: () => props.onCancel?.(), children: props.children }));
5
5
  }
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { HbPopover } from '@huibo-ui/react';
3
3
  export function Popover(props) {
4
- return _jsx(HbPopover, { content: props.content, title: typeof props.title === 'string' ? props.title : '', position: (props.placement || 'top'), trigger: (props.trigger || 'hover'), children: props.children });
4
+ return (_jsx(HbPopover, { content: props.content, title: typeof props.title === 'string' ? props.title : '', position: (props.placement || 'top'), trigger: (props.trigger || 'hover'), children: props.children }));
5
5
  }
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { HbProgress } from '@huibo-ui/react';
3
3
  export function Progress(props) {
4
- return _jsx(HbProgress, { percentage: props.percent ?? 0, type: props.type, status: props.status, showText: props.showInfo ?? true, strokeColor: props.strokeColor, strokeWidth: props.strokeWidth, style: props.style });
4
+ return (_jsx(HbProgress, { percentage: props.percent ?? 0, type: props.type, status: props.status, showText: props.showInfo ?? true, strokeColor: props.strokeColor, strokeWidth: props.strokeWidth, style: props.style }));
5
5
  }
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { HbRadio } from '@huibo-ui/react';
3
3
  export function Radio(props) {
4
- return _jsx(HbRadio, { value: props.value, checked: props.checked, disabled: props.disabled, label: props.children, onHbChange: (e) => props.onChange?.({ target: { value: e.detail } }), children: props.children });
4
+ return (_jsx(HbRadio, { value: props.value, checked: props.checked, disabled: props.disabled, label: props.children, onHbChange: (e) => props.onChange?.({ target: { value: e.detail } }), children: props.children }));
5
5
  }
6
6
  // RadioGroup:huibo-ui 无独立 hb-radio-group 组件,用 div + 多个 hb-radio 实现
7
7
  export function RadioGroup(props) {
@@ -10,7 +10,7 @@ export function RadioGroup(props) {
10
10
  return (_jsx("div", { style: props.style, children: options.map((opt, i) => (_jsx(HbRadio, { value: opt.value, checked: value === opt.value, disabled: disabled || opt.disabled, label: opt.label, onHbChange: (e) => onChange?.(e.detail) }, i))) }));
11
11
  }
12
12
  // children 模式:透传(用户自己用 <Radio> 子元素)
13
- return _jsx("div", { style: props.style, "data-value": value, children: props.children });
13
+ return (_jsx("div", { style: props.style, "data-value": value, children: props.children }));
14
14
  }
15
15
  // 挂上 antd 静态子组件(Radio.Group / Radio.Button)
16
16
  Radio.Group = RadioGroup;
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { HbRate } from '@huibo-ui/react';
3
3
  export function Rate(props) {
4
- return _jsx(HbRate, { modelValue: props.value ?? 0, max: props.count ?? 5, allowHalf: props.allowHalf, disabled: props.disabled, onHbChange: (e) => props.onChange?.(e.detail), style: props.style });
4
+ return (_jsx(HbRate, { modelValue: props.value ?? 0, max: props.count ?? 5, allowHalf: props.allowHalf, disabled: props.disabled, onHbChange: (e) => props.onChange?.(e.detail), style: props.style }));
5
5
  }
@@ -1,5 +1,5 @@
1
1
  import { jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { HbResult } from '@huibo-ui/react';
3
3
  export function Result(props) {
4
- return _jsxs(HbResult, { status: props.status, title: typeof props.title === 'string' ? props.title : '', subTitle: typeof props.subTitle === 'string' ? props.subTitle : '', children: [props.extra, props.children] });
4
+ return (_jsxs(HbResult, { status: props.status, title: typeof props.title === 'string' ? props.title : '', subTitle: typeof props.subTitle === 'string' ? props.subTitle : '', children: [props.extra, props.children] }));
5
5
  }
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { HbSegmented } from '@huibo-ui/react';
3
3
  export function Segmented(props) {
4
- return _jsx(HbSegmented, { options: props.options, modelValue: props.value, block: props.block, size: props.size === 'middle' ? 'default' : props.size, onHbChange: (e) => props.onChange?.(e.detail) });
4
+ return (_jsx(HbSegmented, { options: props.options, modelValue: props.value, block: props.block, size: props.size === 'middle' ? 'default' : props.size, onHbChange: (e) => props.onChange?.(e.detail) }));
5
5
  }
@@ -27,7 +27,7 @@ function SelectOptionComponent(_props) {
27
27
  return null;
28
28
  }
29
29
  export function Select(props) {
30
- const { value, onChange, options, mode, placeholder, disabled, size, allowClear, showSearch, virtual, style, children, } = props;
30
+ const { value, onChange, options, mode, placeholder, disabled, size, allowClear, showSearch, virtual, style, children } = props;
31
31
  // antd maxTagCount:多选时折叠超出数量的 tag。映射到 hb-select 的 collapseTags + maxCollapseTags
32
32
  const maxTagCount = props.maxTagCount;
33
33
  // antd fieldNames:自定义 option 字段名(如 {label:'nickName', value:'id'})。
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { HbSlider } from '@huibo-ui/react';
3
3
  export function Slider(props) {
4
- return _jsx(HbSlider, { modelValue: props.value ?? 0, min: props.min ?? 0, max: props.max ?? 100, step: props.step ?? 1, disabled: props.disabled, vertical: props.vertical, onHbChange: (e) => props.onChange?.(e.detail), style: props.style });
4
+ return (_jsx(HbSlider, { modelValue: props.value ?? 0, min: props.min ?? 0, max: props.max ?? 100, step: props.step ?? 1, disabled: props.disabled, vertical: props.vertical, onHbChange: (e) => props.onChange?.(e.detail), style: props.style }));
5
5
  }
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { HbSpace } from '@huibo-ui/react';
3
3
  export function Space(props) {
4
- return _jsx(HbSpace, { size: props.size === 'middle' ? 'default' : props.size, direction: props.direction, align: props.align, wrap: props.wrap, style: props.style, children: props.children });
4
+ return (_jsx(HbSpace, { size: props.size === 'middle' ? 'default' : props.size, direction: props.direction, align: props.align, wrap: props.wrap, style: props.style, children: props.children }));
5
5
  }
6
6
  /**
7
7
  * Space.Compact —— 紧凑布局(antd 子组件)。huibo 无对应形态,
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { HbLoading } from '@huibo-ui/react';
3
3
  export function Spin(props) {
4
4
  if (props.children) {
5
- return _jsxs("div", { style: { position: 'relative' }, children: [props.spinning && _jsx(HbLoading, { size: props.size === 'middle' ? 'default' : props.size, fullscreen: false }), props.children] });
5
+ return (_jsxs("div", { style: { position: 'relative' }, children: [props.spinning && _jsx(HbLoading, { size: props.size === 'middle' ? 'default' : props.size, fullscreen: false }), props.children] }));
6
6
  }
7
7
  return _jsx(HbLoading, { size: props.size === 'middle' ? 'default' : props.size });
8
8
  }
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { HbStatistic } from '@huibo-ui/react';
3
3
  export function Statistic(props) {
4
- return _jsx(HbStatistic, { title: typeof props.title === 'string' ? props.title : '', value: props.value ?? 0, precision: props.precision, prefix: props.prefix, suffix: props.suffix, style: props.style });
4
+ return (_jsx(HbStatistic, { title: typeof props.title === 'string' ? props.title : '', value: props.value ?? 0, precision: props.precision, prefix: props.prefix, suffix: props.suffix, style: props.style }));
5
5
  }
@@ -2,6 +2,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import React from 'react';
3
3
  import { HbSteps, HbStep } from '@huibo-ui/react';
4
4
  export function Steps(props) {
5
- return _jsx(HbSteps, { active: props.current ?? 0, items: props.items, direction: props.direction, type: props.type, processStatus: props.status, size: props.size, children: props.children });
5
+ return (_jsx(HbSteps, { active: props.current ?? 0, items: props.items, direction: props.direction, type: props.type, processStatus: props.status, size: props.size, children: props.children }));
6
6
  }
7
- Steps.Step = function Step(props) { return React.createElement(HbStep, { title: props.title, description: props.description, status: props.status }, props.children); };
7
+ Steps.Step = function Step(props) {
8
+ return React.createElement(HbStep, { title: props.title, description: props.description, status: props.status }, props.children);
9
+ };
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { HbSwitch } from '@huibo-ui/react';
3
3
  export function Switch(props) {
4
- return _jsx(HbSwitch, { modelValue: props.checked ?? false, disabled: props.disabled, size: props.size === 'middle' ? 'default' : props.size, activeText: props.checkedChildren, inactiveText: props.unCheckedChildren, onHbChange: (e) => props.onChange?.(e.detail) });
4
+ return (_jsx(HbSwitch, { modelValue: props.checked ?? false, disabled: props.disabled, size: props.size === 'middle' ? 'default' : props.size, activeText: props.checkedChildren, inactiveText: props.unCheckedChildren, onHbChange: (e) => props.onChange?.(e.detail) }));
5
5
  }
@@ -30,6 +30,53 @@ function renderToHtml(node) {
30
30
  return '';
31
31
  }
32
32
  }
33
+ /**
34
+ * 自动建树:当 dataSource 是「扁平数据(每行带 parentId/parentKey 等父级标识字段,
35
+ * 且自身无 children 嵌套)」时,按父级关系构建出树形结构,让 hb-table 以树形渲染。
36
+ *
37
+ * 背景:antd 项目里常见的树形表格用法是——后端返回扁平数据(id + parentId),
38
+ * 应用层(getDataList / 拦截器 / 工具函数)把它转成树形(children 嵌套)再喂给表格。
39
+ * 迁移到 huibo-ui 时,部分页面丢失了这层转换,导致扁平数据被表格当成普通行全部展开。
40
+ * 在此兼容层统一兜底,避免要求每个业务页面都改回「转树形」逻辑。
41
+ *
42
+ * 触发条件(同时满足才转,避免误伤已经是树形的数据):
43
+ * 1. dataSource 是非空数组
44
+ * 2. 至少有一行的「父级字段」(默认 parentId) 有值(指向另一行)
45
+ * 3. 所有行自身都没有 children 数组(说明不是已经建好的树)
46
+ *
47
+ * 字段名可通过 props.treeBuild({ idKey, parentIdKey })覆盖,默认 idKey='id', parentIdKey='parentId'。
48
+ */
49
+ function buildTreeFromFlat(list, opts = {}) {
50
+ const idKey = opts.idKey || 'id';
51
+ const parentIdKey = opts.parentIdKey || 'parentId';
52
+ if (!Array.isArray(list) || list.length === 0)
53
+ return list;
54
+ // 触发条件校验:必须有人在引用父级,且没人已经有 children
55
+ const hasParentRef = list.some(row => row[parentIdKey] != null && row[parentIdKey] !== '' && row[parentIdKey] !== 0 && row[parentIdKey] !== '0');
56
+ const hasExistingChildren = list.some(row => Array.isArray(row.children) && row.children.length > 0);
57
+ if (!hasParentRef || hasExistingChildren)
58
+ return list;
59
+ const map = new Map();
60
+ const roots = [];
61
+ // 第一遍:建索引(浅拷贝,避免污染调用方数据)
62
+ list.forEach(row => map.set(row[idKey], { ...row }));
63
+ // 第二遍:挂子节点。找不到父节点的当根节点。
64
+ list.forEach(row => {
65
+ const pid = row[parentIdKey];
66
+ const node = map.get(row[idKey]);
67
+ const parent = map.get(pid);
68
+ if (parent) {
69
+ if (!parent.children)
70
+ parent.children = [];
71
+ parent.children.push(node);
72
+ }
73
+ else {
74
+ roots.push(node);
75
+ }
76
+ });
77
+ // 根节点为 0 时(即整棵树只有一层,没有真正的父子关系)直接返回原数据
78
+ return roots.length > 0 ? roots : list;
79
+ }
33
80
  export function Table(props) {
34
81
  const { dataSource = [], columns = [], rowKey, loading, size, bordered, pagination, rowSelection, scroll, onChange } = props;
35
82
  // antd columns → huibo columns
@@ -56,18 +103,24 @@ export function Table(props) {
56
103
  // rowKey 函数 → 字符串
57
104
  const huiboRowKey = typeof rowKey === 'string' ? rowKey : '';
58
105
  // pagination 适配
59
- const huiboPagination = pagination === false ? undefined : pagination ? {
60
- current: pagination.current,
61
- pageSize: pagination.pageSize,
62
- pageSizes: pagination.pageSizeOptions?.map((s) => parseInt(s)),
63
- showTotal: !!pagination.showTotal,
64
- } : undefined;
106
+ const huiboPagination = pagination === false
107
+ ? undefined
108
+ : pagination
109
+ ? {
110
+ current: pagination.current,
111
+ pageSize: pagination.pageSize,
112
+ pageSizes: pagination.pageSizeOptions?.map((s) => parseInt(s)),
113
+ showTotal: !!pagination.showTotal,
114
+ }
115
+ : undefined;
65
116
  // rowSelection 适配
66
- const huiboRowSelection = rowSelection ? {
67
- type: rowSelection.type || 'checkbox',
68
- selectedRowKeys: rowSelection.selectedRowKeys,
69
- getCheckboxProps: rowSelection.getCheckboxProps,
70
- } : undefined;
117
+ const huiboRowSelection = rowSelection
118
+ ? {
119
+ type: rowSelection.type || 'checkbox',
120
+ selectedRowKeys: rowSelection.selectedRowKeys,
121
+ getCheckboxProps: rowSelection.getCheckboxProps,
122
+ }
123
+ : undefined;
71
124
  // ===== 单元格 portal:把含交互内容的单元格用 React createRoot 挂进 hb-table 的 sentinel span =====
72
125
  // 用 callback ref 稳定拿到 hb-table CE 节点(输出目标 forwardRef 模板兼容)。
73
126
  const tableHostRef = React.useRef(null);
@@ -171,7 +224,10 @@ export function Table(props) {
171
224
  cellRootsRef.current.clear();
172
225
  };
173
226
  }, []);
174
- return (_jsx(HbTable, { ref: setTableHost, data: dataSource, columns: huiboColumns, rowKey: huiboRowKey, loading: loading, size: size === 'middle' ? 'default' : size || 'default', border: bordered, stripe: false, pagination: huiboPagination, rowSelection: huiboRowSelection, tableScroll: scroll ? { x: scroll.x ? String(scroll.x) : undefined, y: scroll.y ? String(scroll.y) : undefined } : undefined, onHbPageChange: (e) => {
227
+ // 自动建树兜底:扁平数据(带 parentId children)→ 树形结构
228
+ // 让 hb-table 以树形渲染,对齐 antd 表格在应用层已转树形后的效果。
229
+ const treeData = React.useMemo(() => buildTreeFromFlat(dataSource, props.treeBuild), [dataSource, props.treeBuild]);
230
+ return (_jsx(HbTable, { ref: setTableHost, data: treeData, columns: huiboColumns, rowKey: huiboRowKey, loading: loading, size: size === 'middle' ? 'default' : size || 'default', border: bordered, stripe: false, pagination: huiboPagination, rowSelection: huiboRowSelection, tableScroll: scroll ? { x: scroll.x ? String(scroll.x) : undefined, y: scroll.y ? String(scroll.y) : undefined } : undefined, onHbPageChange: (e) => {
175
231
  if (pagination && pagination.onChange)
176
232
  pagination.onChange(e.detail.current, e.detail.pageSize);
177
233
  }, onHbSelectionChange: (e) => {
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import React from 'react';
3
3
  const PRIMARY = 'var(--hb-color-primary, #ff6700)';
4
4
  export function Tabs(props) {
5
- const { items, activeKey, defaultActiveKey, onChange, type = 'line', size = 'middle', tabPosition = 'top', destroyInactiveTabPane = false, style, className, children, } = props;
5
+ const { items, activeKey, defaultActiveKey, onChange, type = 'line', size = 'middle', tabPosition = 'top', destroyInactiveTabPane = false, style, className, children } = props;
6
6
  const list = items && items.length > 0 ? items : [];
7
7
  const [internal, setInternal] = React.useState(activeKey ?? defaultActiveKey ?? list[0]?.key ?? '');
8
8
  const current = activeKey !== undefined ? activeKey : internal;
@@ -1,6 +1,16 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { HbTag } from '@huibo-ui/react';
3
- const colorMap = { success: 'success', processing: 'info', error: 'danger', default: 'info', warning: 'warning', blue: 'primary', green: 'success', red: 'danger', orange: 'warning' };
3
+ const colorMap = {
4
+ success: 'success',
5
+ processing: 'info',
6
+ error: 'danger',
7
+ default: 'info',
8
+ warning: 'warning',
9
+ blue: 'primary',
10
+ green: 'success',
11
+ red: 'danger',
12
+ orange: 'warning',
13
+ };
4
14
  export function Tag(props) {
5
- return _jsx(HbTag, { type: (colorMap[props.color || 'default'] || 'default'), closable: props.closable, onHbClose: () => props.onClose?.(), style: props.style, children: props.children });
15
+ return (_jsx(HbTag, { type: (colorMap[props.color || 'default'] || 'default'), closable: props.closable, onHbClose: () => props.onClose?.(), style: props.style, children: props.children }));
6
16
  }
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { HbTimePicker } from '@huibo-ui/react';
3
3
  export function TimePicker(props) {
4
- return _jsx(HbTimePicker, { modelValue: props.value, format: props.format, clearable: props.allowClear, disabled: props.disabled, size: props.size === 'middle' ? 'default' : props.size, placeholder: props.placeholder, style: props.style, onHbChange: (e) => props.onChange?.(e.detail) });
4
+ return (_jsx(HbTimePicker, { modelValue: props.value, format: props.format, clearable: props.allowClear, disabled: props.disabled, size: props.size === 'middle' ? 'default' : props.size, placeholder: props.placeholder, style: props.style, onHbChange: (e) => props.onChange?.(e.detail) }));
5
5
  }
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { HbTooltip } from '@huibo-ui/react';
3
3
  export function Tooltip(props) {
4
- return _jsx(HbTooltip, { content: typeof props.title === 'string' ? props.title : '', position: (props.placement || 'top'), children: props.children });
4
+ return (_jsx(HbTooltip, { content: typeof props.title === 'string' ? props.title : '', position: (props.placement || 'top'), children: props.children }));
5
5
  }
@@ -18,9 +18,7 @@ const titleToText = (title) => {
18
18
  if (typeof child === 'number')
19
19
  return String(child);
20
20
  if (Array.isArray(child)) {
21
- return child
22
- .map((c) => (typeof c === 'string' || typeof c === 'number' ? String(c) : ''))
23
- .join('');
21
+ return child.map((c) => (typeof c === 'string' || typeof c === 'number' ? String(c) : '')).join('');
24
22
  }
25
23
  return '';
26
24
  }
@@ -33,7 +31,7 @@ export function Tree(props) {
33
31
  const childField = fieldNames?.children || 'children';
34
32
  // 1) 适配 fieldNames;2) 把 title(含 React 元素)统一转成字符串,避免 hb-tree 渲染冻结对象
35
33
  const normalizedData = React.useMemo(() => {
36
- const walk = (nodes) => (nodes || []).map((n) => ({
34
+ const walk = (nodes) => (nodes || []).map(n => ({
37
35
  key: String(n[keyField]),
38
36
  title: titleToText(n[titleField]),
39
37
  disabled: !!n.disabled,
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { HbTreeSelect } from '@huibo-ui/react';
3
3
  export function TreeSelect(props) {
4
- return _jsx(HbTreeSelect, { data: props.treeData || [], modelValue: props.value, multiple: props.multiple || props.treeCheckable, checkable: props.treeCheckable, placeholder: props.placeholder, disabled: props.disabled, onHbChange: (e) => props.onChange?.(e.detail), style: props.style });
4
+ return (_jsx(HbTreeSelect, { data: props.treeData || [], modelValue: props.value, multiple: props.multiple || props.treeCheckable, checkable: props.treeCheckable, placeholder: props.placeholder, disabled: props.disabled, onHbChange: (e) => props.onChange?.(e.detail), style: props.style }));
5
5
  }
@@ -15,5 +15,9 @@ Typography.Link = function Link(props) {
15
15
  return _jsx(HbLink, { href: props.href, children: props.children });
16
16
  };
17
17
  Typography.Text = function Text(props) {
18
- return _jsx("span", { style: { fontWeight: props.strong ? 'bold' : undefined, fontStyle: props.italic ? 'italic' : undefined, textDecoration: props.delete ? 'line-through' : props.underline ? 'underline' : undefined }, children: props.children });
18
+ return (_jsx("span", { style: {
19
+ fontWeight: props.strong ? 'bold' : undefined,
20
+ fontStyle: props.italic ? 'italic' : undefined,
21
+ textDecoration: props.delete ? 'line-through' : props.underline ? 'underline' : undefined,
22
+ }, children: props.children }));
19
23
  };
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { HbUpload } from '@huibo-ui/react';
3
3
  export function Upload(props) {
4
- return _jsx(HbUpload, { action: props.action, multiple: props.multiple, accept: props.accept, limit: props.maxCount, fileList: props.fileList || [], beforeUpload: props.beforeUpload, customRequest: props.customRequest, listType: props.listType || 'text', disabled: props.disabled, onHbChange: (e) => props.onChange?.({ fileList: e.detail }), style: props.style, children: props.children });
4
+ return (_jsx(HbUpload, { action: props.action, multiple: props.multiple, accept: props.accept, limit: props.maxCount, fileList: props.fileList || [], beforeUpload: props.beforeUpload, customRequest: props.customRequest, listType: props.listType || 'text', disabled: props.disabled, onHbChange: (e) => props.onChange?.({ fileList: e.detail }), style: props.style, children: props.children }));
5
5
  }
6
6
  /**
7
7
  * Upload.Dragger —— 拖拽上传(antd 子组件)。huibo hb-upload 无 drag 形态,
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { HbWatermark } from '@huibo-ui/react';
3
3
  export function Watermark(props) {
4
- return _jsx(HbWatermark, { content: props.content || '', width: props.width, height: props.height, gap: Array.isArray(props.gap) ? props.gap[0] : props.gap, rotate: props.rotate, fontColor: props.font?.color, fontSize: props.font?.fontSize, children: props.children });
4
+ return (_jsx(HbWatermark, { content: props.content || '', width: props.width, height: props.height, gap: Array.isArray(props.gap) ? props.gap[0] : props.gap, rotate: props.rotate, fontColor: props.font?.color, fontSize: props.font?.fontSize, children: props.children }));
5
5
  }
@@ -14,8 +14,7 @@ function getMessageContainer() {
14
14
  container = document.createElement('div');
15
15
  container.id = 'hb-message-container';
16
16
  container.style.cssText =
17
- 'position:fixed;top:20px;left:50%;transform:translateX(-50%);z-index:1100;' +
18
- 'display:flex;flex-direction:column;align-items:center;gap:8px;pointer-events:none;';
17
+ 'position:fixed;top:20px;left:50%;transform:translateX(-50%);z-index:1100;' + 'display:flex;flex-direction:column;align-items:center;gap:8px;pointer-events:none;';
19
18
  document.body.appendChild(container);
20
19
  }
21
20
  return container;
@@ -33,7 +32,9 @@ function showMessage(type, content, duration) {
33
32
  el.closable = false;
34
33
  div.appendChild(el);
35
34
  // 等动画结束后移除
36
- setTimeout(() => { div.remove(); }, (duration ?? 3000) + 500);
35
+ setTimeout(() => {
36
+ div.remove();
37
+ }, (duration ?? 3000) + 500);
37
38
  return { close: () => div.remove() };
38
39
  }
39
40
  export const message = {
@@ -12,7 +12,9 @@ function showNotification(type, props) {
12
12
  el.duration = props.duration ?? 4500;
13
13
  el.position = 'top-right';
14
14
  div.appendChild(el);
15
- setTimeout(() => { div.remove(); }, (props.duration ?? 4500) + 500);
15
+ setTimeout(() => {
16
+ div.remove();
17
+ }, (props.duration ?? 4500) + 500);
16
18
  return { close: () => div.remove() };
17
19
  }
18
20
  export const notification = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@huibo-ui/react-antd",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "description": "antd 兼容层 — 接收 antd 原生 props,内部转换为 huibo-ui,实现丝滑平替",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",