@sia.soul/sia-react-ui 0.1.49 → 0.1.51

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.
@@ -467,7 +467,7 @@ type MenuItem = {
467
467
  icon?: ReactNode;
468
468
  /** 主体之外的补充内容或操作区。 */
469
469
  extra?: ReactNode;
470
- /** 标题内容,可传入文本或 React 节点。 */
470
+ /** 菜单项的悬停提示文字,停留 600ms 后显示,禁用项同样支持;收起的图标菜单未设置时使用纯文本 label。 */
471
471
  title?: string;
472
472
  /** 是否禁用交互。 */
473
473
  disabled?: boolean;
@@ -467,7 +467,7 @@ type MenuItem = {
467
467
  icon?: ReactNode;
468
468
  /** 主体之外的补充内容或操作区。 */
469
469
  extra?: ReactNode;
470
- /** 标题内容,可传入文本或 React 节点。 */
470
+ /** 菜单项的悬停提示文字,停留 600ms 后显示,禁用项同样支持;收起的图标菜单未设置时使用纯文本 label。 */
471
471
  title?: string;
472
472
  /** 是否禁用交互。 */
473
473
  disabled?: boolean;
package/dist/core.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export { d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, h as Card, i as CardAccent, j as CardProps, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, K as Icon, L as IconName, M as IconProps, N as IconVariant, U as Input, V as InputProps, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ag as Segmented, ah as SegmentedOption, ai as SegmentedProps, aj as SegmentedValue, aq as TabItem, ar as Tabs, at as TabsOrientation, au as TabsPosition, av as TabsProps, aw as TabsType, ax as Tag, ay as TagProps, az as TagSize, T as TagStatus, aA as TagVariant, aE as Toolbar, aF as ToolbarItem, aG as ToolbarProps, aR as Typography, aS as TypographyLinkProps, aT as TypographyProps, aU as TypographyTitleProps, aV as TypographyType, aW as Upload, aX as UploadChangeInfo, aY as UploadDraggerProps, aZ as UploadFile, a_ as UploadFileStatus, b1 as UploadProps, b5 as UploadRequestOptions, b9 as message } from './core-D2IjiQhj.cjs';
1
+ export { d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, h as Card, i as CardAccent, j as CardProps, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, K as Icon, L as IconName, M as IconProps, N as IconVariant, U as Input, V as InputProps, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ag as Segmented, ah as SegmentedOption, ai as SegmentedProps, aj as SegmentedValue, aq as TabItem, ar as Tabs, at as TabsOrientation, au as TabsPosition, av as TabsProps, aw as TabsType, ax as Tag, ay as TagProps, az as TagSize, T as TagStatus, aA as TagVariant, aE as Toolbar, aF as ToolbarItem, aG as ToolbarProps, aR as Typography, aS as TypographyLinkProps, aT as TypographyProps, aU as TypographyTitleProps, aV as TypographyType, aW as Upload, aX as UploadChangeInfo, aY as UploadDraggerProps, aZ as UploadFile, a_ as UploadFileStatus, b1 as UploadProps, b5 as UploadRequestOptions, b9 as message } from './core-KIaXZ4_O.cjs';
2
2
  export { f as Button, B as ButtonProps, e as ButtonSize, g as ButtonVariant, h as Modal, d as ModalActionResult, M as ModalOpenConfig, i as ModalProps, j as ModalType, a as OverlayApiHandle, k as Select, S as SelectOption, c as SelectProps, m as SelectValue } from './Select-YJbT-MF1.cjs';
3
3
  import 'react';
4
4
  import './shared-Bx4B28Wh.cjs';
package/dist/core.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, h as Card, i as CardAccent, j as CardProps, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, K as Icon, L as IconName, M as IconProps, N as IconVariant, U as Input, V as InputProps, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ag as Segmented, ah as SegmentedOption, ai as SegmentedProps, aj as SegmentedValue, aq as TabItem, ar as Tabs, at as TabsOrientation, au as TabsPosition, av as TabsProps, aw as TabsType, ax as Tag, ay as TagProps, az as TagSize, T as TagStatus, aA as TagVariant, aE as Toolbar, aF as ToolbarItem, aG as ToolbarProps, aR as Typography, aS as TypographyLinkProps, aT as TypographyProps, aU as TypographyTitleProps, aV as TypographyType, aW as Upload, aX as UploadChangeInfo, aY as UploadDraggerProps, aZ as UploadFile, a_ as UploadFileStatus, b1 as UploadProps, b5 as UploadRequestOptions, b9 as message } from './core-Bb0160em.js';
1
+ export { d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, h as Card, i as CardAccent, j as CardProps, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, K as Icon, L as IconName, M as IconProps, N as IconVariant, U as Input, V as InputProps, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ag as Segmented, ah as SegmentedOption, ai as SegmentedProps, aj as SegmentedValue, aq as TabItem, ar as Tabs, at as TabsOrientation, au as TabsPosition, av as TabsProps, aw as TabsType, ax as Tag, ay as TagProps, az as TagSize, T as TagStatus, aA as TagVariant, aE as Toolbar, aF as ToolbarItem, aG as ToolbarProps, aR as Typography, aS as TypographyLinkProps, aT as TypographyProps, aU as TypographyTitleProps, aV as TypographyType, aW as Upload, aX as UploadChangeInfo, aY as UploadDraggerProps, aZ as UploadFile, a_ as UploadFileStatus, b1 as UploadProps, b5 as UploadRequestOptions, b9 as message } from './core-murmERqF.js';
2
2
  export { f as Button, B as ButtonProps, e as ButtonSize, g as ButtonVariant, h as Modal, d as ModalActionResult, M as ModalOpenConfig, i as ModalProps, j as ModalType, a as OverlayApiHandle, k as Select, S as SelectOption, c as SelectProps, m as SelectValue } from './Select-CCrPqULn.js';
3
3
  import 'react';
4
4
  import './shared-Bx4B28Wh.js';
package/dist/index.cjs CHANGED
@@ -14386,6 +14386,8 @@ function createColumnSettingPlugin(options = {}) {
14386
14386
  ...customItems.map((item) => ({
14387
14387
  key: "custom:" + item.key,
14388
14388
  label: item.label,
14389
+ // 设置菜单复用菜单项提示,禁用操作也需说明不可用原因。
14390
+ title: item.title,
14389
14391
  icon: item.icon,
14390
14392
  danger: item.danger,
14391
14393
  disabled: item.disabled === true || typeof item.disabled === "function" && item.disabled(context)
@@ -14481,6 +14483,7 @@ function ToolbarItems({
14481
14483
  {
14482
14484
  size: "small",
14483
14485
  danger: item.danger,
14486
+ title: item.title,
14484
14487
  icon: item.icon,
14485
14488
  disabled,
14486
14489
  onClick: () => void item.onClick?.(context),
@@ -23333,7 +23336,8 @@ function QueryForm({
23333
23336
  }) {
23334
23337
  const [form] = useForm(providedForm);
23335
23338
  const [internalCollapsed, setInternalCollapsed] = (0, import_react93.useState)(defaultCollapsed);
23336
- const collapsed = collapsible && (controlledCollapsed ?? internalCollapsed);
23339
+ const [needsCollapse, setNeedsCollapse] = (0, import_react93.useState)(false);
23340
+ const collapsed = collapsible && needsCollapse && (controlledCollapsed ?? internalCollapsed);
23337
23341
  const [searching, setSearching] = (0, import_react93.useState)(false);
23338
23342
  const [saving, setSaving] = (0, import_react93.useState)(false);
23339
23343
  const [removing, setRemoving] = (0, import_react93.useState)(false);
@@ -23353,15 +23357,33 @@ function QueryForm({
23353
23357
  const limit = Math.max(1, Math.floor(collapsedCount));
23354
23358
  const rowRef = (0, import_react93.useRef)(null);
23355
23359
  const actionsRef = (0, import_react93.useRef)(null);
23360
+ const toggleRef = (0, import_react93.useRef)(null);
23356
23361
  const [fittingCount, setFittingCount] = (0, import_react93.useState)(limit);
23357
23362
  (0, import_react93.useLayoutEffect)(() => {
23358
- if (!collapsed) return;
23359
23363
  const row = rowRef.current;
23360
23364
  const actions = actionsRef.current;
23361
23365
  if (!row || !actions) return;
23362
23366
  function measure() {
23363
23367
  if (!row || !actions) return;
23364
23368
  const gap = parseFloat(getComputedStyle(row).columnGap) || 0;
23369
+ const allFields = Array.from(row.querySelectorAll(":scope > .sia-query-form__field"));
23370
+ const hiddenFields = allFields.filter((field) => field.hidden);
23371
+ const wasCollapsed = row.classList.contains("is-collapsed");
23372
+ const toggle = toggleRef.current;
23373
+ const toggleHidden = toggle?.hidden;
23374
+ row.classList.remove("is-collapsed");
23375
+ hiddenFields.forEach((field) => {
23376
+ field.hidden = false;
23377
+ });
23378
+ if (toggle) toggle.hidden = true;
23379
+ const requiredWidth = allFields.reduce((total, field) => total + field.getBoundingClientRect().width + gap, actions.getBoundingClientRect().width);
23380
+ setNeedsCollapse(allFields.length > 0 && requiredWidth > row.clientWidth + 0.5);
23381
+ if (toggle) toggle.hidden = Boolean(toggleHidden);
23382
+ hiddenFields.forEach((field) => {
23383
+ field.hidden = true;
23384
+ });
23385
+ row.classList.toggle("is-collapsed", wasCollapsed);
23386
+ if (!collapsed) return;
23365
23387
  let remaining = row.clientWidth - actions.getBoundingClientRect().width;
23366
23388
  let count = 0;
23367
23389
  for (const field of Array.from(row.querySelectorAll(":scope > .sia-query-form__field")).slice(0, limit)) {
@@ -23378,7 +23400,7 @@ function QueryForm({
23378
23400
  observer.observe(actions);
23379
23401
  row.querySelectorAll(":scope > .sia-query-form__field").forEach((field) => observer.observe(field));
23380
23402
  return () => observer.disconnect();
23381
- }, [collapsed, limit, fieldWidth, fields, children]);
23403
+ }, [collapsed, needsCollapse, collapsible, limit, fieldWidth, fields, children, actionsExtra, onSaveQuery, searchText, resetText, saveText]);
23382
23404
  async function search(values) {
23383
23405
  const info = source.current;
23384
23406
  source.current = { source: "submit" };
@@ -23509,7 +23531,7 @@ function QueryForm({
23509
23531
  setSaveOpen(true);
23510
23532
  }, children: saveText }) : null
23511
23533
  ] }),
23512
- collapsible && entries.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
23534
+ collapsible && entries.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { ref: toggleRef, hidden: !needsCollapse, children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
23513
23535
  Button,
23514
23536
  {
23515
23537
  variant: "link",
@@ -23522,7 +23544,7 @@ function QueryForm({
23522
23544
  },
23523
23545
  children: collapsed ? "\u5C55\u5F00" : "\u6536\u8D77"
23524
23546
  }
23525
- ) : null,
23547
+ ) }) : null,
23526
23548
  actionsExtra
23527
23549
  ] })
23528
23550
  ] }),
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { T as TagStatus, B as BadgeProps } from './core-D2IjiQhj.cjs';
2
- export { a as Badge, b as BadgeRibbonProps, c as BadgeStatus, d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, C as Calendar, g as CalendarProps, h as Card, i as CardAccent, j as CardProps, k as Carousel, l as CarouselProps, m as CarouselRef, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, D as Dropdown, r as DropdownButtonProps, s as DropdownMenuProps, t as DropdownOpenSource, u as DropdownPlacement, v as DropdownProps, w as DropdownTrigger, F as FILLED_ICON_NAMES, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, H as FloatingPlacement, I as FloatingTrigger, J as ICON_NAMES, K as Icon, L as IconName, M as IconProps, N as IconVariant, O as Image, P as ImagePreview, Q as ImagePreviewConfig, R as ImagePreviewProps, S as ImageProps, U as Input, V as InputProps, W as Menu, X as MenuClickInfo, Y as MenuItem, Z as MenuMode, _ as MenuProps, $ as MenuTheme, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, a4 as NotificationConfig, a5 as NotificationPlacement, a6 as NotificationType, a7 as Popconfirm, a8 as PopconfirmProps, a9 as Popover, aa as PopoverProps, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ae as Rate, af as RateProps, ag as Segmented, ah as SegmentedOption, ai as SegmentedProps, aj as SegmentedValue, ak as Spin, al as SpinProps, am as StepItem, an as StepStatus, ao as Steps, ap as StepsProps, aq as TabItem, ar as Tabs, as as TabsContextMenuClickInfo, at as TabsOrientation, au as TabsPosition, av as TabsProps, aw as TabsType, ax as Tag, ay as TagProps, az as TagSize, aA as TagVariant, aB as Timeline, aC as TimelineItem, aD as TimelineProps, aE as Toolbar, aF as ToolbarItem, aG as ToolbarProps, aH as Tooltip, aI as TooltipProps, aJ as Tour, aK as TourProps, aL as TourStep, aM as Tree, aN as TreeDropPosition, aO as TreeKey, aP as TreeNode, aQ as TreeProps, aR as Typography, aS as TypographyLinkProps, aT as TypographyProps, aU as TypographyTitleProps, aV as TypographyType, aW as Upload, aX as UploadChangeInfo, aY as UploadDraggerProps, aZ as UploadFile, a_ as UploadFileStatus, a$ as UploadHttpRequest, b0 as UploadItemActions, b1 as UploadProps, b2 as UploadRef, b3 as UploadRejectInfo, b4 as UploadRequestHandle, b5 as UploadRequestOptions, b6 as Watermark, b7 as WatermarkFont, b8 as WatermarkProps, b9 as message, ba as notification } from './core-D2IjiQhj.cjs';
1
+ import { T as TagStatus, B as BadgeProps } from './core-KIaXZ4_O.cjs';
2
+ export { a as Badge, b as BadgeRibbonProps, c as BadgeStatus, d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, C as Calendar, g as CalendarProps, h as Card, i as CardAccent, j as CardProps, k as Carousel, l as CarouselProps, m as CarouselRef, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, D as Dropdown, r as DropdownButtonProps, s as DropdownMenuProps, t as DropdownOpenSource, u as DropdownPlacement, v as DropdownProps, w as DropdownTrigger, F as FILLED_ICON_NAMES, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, H as FloatingPlacement, I as FloatingTrigger, J as ICON_NAMES, K as Icon, L as IconName, M as IconProps, N as IconVariant, O as Image, P as ImagePreview, Q as ImagePreviewConfig, R as ImagePreviewProps, S as ImageProps, U as Input, V as InputProps, W as Menu, X as MenuClickInfo, Y as MenuItem, Z as MenuMode, _ as MenuProps, $ as MenuTheme, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, a4 as NotificationConfig, a5 as NotificationPlacement, a6 as NotificationType, a7 as Popconfirm, a8 as PopconfirmProps, a9 as Popover, aa as PopoverProps, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ae as Rate, af as RateProps, ag as Segmented, ah as SegmentedOption, ai as SegmentedProps, aj as SegmentedValue, ak as Spin, al as SpinProps, am as StepItem, an as StepStatus, ao as Steps, ap as StepsProps, aq as TabItem, ar as Tabs, as as TabsContextMenuClickInfo, at as TabsOrientation, au as TabsPosition, av as TabsProps, aw as TabsType, ax as Tag, ay as TagProps, az as TagSize, aA as TagVariant, aB as Timeline, aC as TimelineItem, aD as TimelineProps, aE as Toolbar, aF as ToolbarItem, aG as ToolbarProps, aH as Tooltip, aI as TooltipProps, aJ as Tour, aK as TourProps, aL as TourStep, aM as Tree, aN as TreeDropPosition, aO as TreeKey, aP as TreeNode, aQ as TreeProps, aR as Typography, aS as TypographyLinkProps, aT as TypographyProps, aU as TypographyTitleProps, aV as TypographyType, aW as Upload, aX as UploadChangeInfo, aY as UploadDraggerProps, aZ as UploadFile, a_ as UploadFileStatus, a$ as UploadHttpRequest, b0 as UploadItemActions, b1 as UploadProps, b2 as UploadRef, b3 as UploadRejectInfo, b4 as UploadRequestHandle, b5 as UploadRequestOptions, b6 as Watermark, b7 as WatermarkFont, b8 as WatermarkProps, b9 as message, ba as notification } from './core-KIaXZ4_O.cjs';
3
3
  import * as react from 'react';
4
4
  import { HTMLAttributes, ReactNode, CSSProperties, ElementType, FormHTMLAttributes, InputHTMLAttributes, ChangeEvent, TextareaHTMLAttributes, MouseEvent, Key, PointerEvent, Ref, ReactElement, ButtonHTMLAttributes, RefObject } from 'react';
5
5
  import { C as ControlSize, I as InputPlaceholderMode, a as ControlStatus } from './shared-Bx4B28Wh.cjs';
@@ -2733,6 +2733,8 @@ interface TableToolbarItem<T> {
2733
2733
  key: string;
2734
2734
  /** 展示给用户的名称,可传入文本或 React 节点。 */
2735
2735
  label: ReactNode;
2736
+ /** 操作的悬停提示文字;普通工具栏按钮和设置菜单项均支持,禁用时仍可显示,停留 600ms 后出现。 */
2737
+ title?: string;
2736
2738
  /** 显示在内容旁的图标节点,建议使用 Icon 组件。 */
2737
2739
  icon?: ReactNode;
2738
2740
  /** 显示位置或定位配置。 */
@@ -3099,11 +3101,11 @@ interface QueryFormProps<T extends FormValues = FormValues> extends Omit<FormPro
3099
3101
  */
3100
3102
  fieldWidth?: number | string;
3101
3103
  /**
3102
- 是否显示展开和收起入口;false 时始终展示全部字段。
3104
+ * 是否允许展开和收起;仅全部字段与操作区无法在一行内显示时提供入口,false 时始终展示全部字段。
3103
3105
  * @defaultValue true
3104
3106
  */
3105
3107
  collapsible?: boolean;
3106
- /** 受控收起状态,需在 onCollapsedChange 中更新。收起时保留字段挂载和值,只隐藏放不下的字段和底部快捷标签。 */
3108
+ /** 受控收起状态,需在 onCollapsedChange 中更新;全部字段能单行显示时不执行收起。收起时保留字段挂载和值,只隐藏放不下的字段和底部快捷标签。 */
3107
3109
  collapsed?: boolean;
3108
3110
  /**
3109
3111
  * 非受控模式的初始收起状态。
@@ -3111,7 +3113,7 @@ interface QueryFormProps<T extends FormValues = FormValues> extends Omit<FormPro
3111
3113
  */
3112
3114
  defaultCollapsed?: boolean;
3113
3115
  /**
3114
- * 收起时最多保留的字段数;实际数量会根据可用宽度减少,以保持单行。
3116
+ * 需要折叠时最多保留的字段数;实际数量会根据可用宽度减少,以保持单行。全部字段能单行显示时不限制字段数。
3115
3117
  * @defaultValue 3
3116
3118
  */
3117
3119
  collapsedCount?: number;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { T as TagStatus, B as BadgeProps } from './core-Bb0160em.js';
2
- export { a as Badge, b as BadgeRibbonProps, c as BadgeStatus, d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, C as Calendar, g as CalendarProps, h as Card, i as CardAccent, j as CardProps, k as Carousel, l as CarouselProps, m as CarouselRef, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, D as Dropdown, r as DropdownButtonProps, s as DropdownMenuProps, t as DropdownOpenSource, u as DropdownPlacement, v as DropdownProps, w as DropdownTrigger, F as FILLED_ICON_NAMES, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, H as FloatingPlacement, I as FloatingTrigger, J as ICON_NAMES, K as Icon, L as IconName, M as IconProps, N as IconVariant, O as Image, P as ImagePreview, Q as ImagePreviewConfig, R as ImagePreviewProps, S as ImageProps, U as Input, V as InputProps, W as Menu, X as MenuClickInfo, Y as MenuItem, Z as MenuMode, _ as MenuProps, $ as MenuTheme, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, a4 as NotificationConfig, a5 as NotificationPlacement, a6 as NotificationType, a7 as Popconfirm, a8 as PopconfirmProps, a9 as Popover, aa as PopoverProps, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ae as Rate, af as RateProps, ag as Segmented, ah as SegmentedOption, ai as SegmentedProps, aj as SegmentedValue, ak as Spin, al as SpinProps, am as StepItem, an as StepStatus, ao as Steps, ap as StepsProps, aq as TabItem, ar as Tabs, as as TabsContextMenuClickInfo, at as TabsOrientation, au as TabsPosition, av as TabsProps, aw as TabsType, ax as Tag, ay as TagProps, az as TagSize, aA as TagVariant, aB as Timeline, aC as TimelineItem, aD as TimelineProps, aE as Toolbar, aF as ToolbarItem, aG as ToolbarProps, aH as Tooltip, aI as TooltipProps, aJ as Tour, aK as TourProps, aL as TourStep, aM as Tree, aN as TreeDropPosition, aO as TreeKey, aP as TreeNode, aQ as TreeProps, aR as Typography, aS as TypographyLinkProps, aT as TypographyProps, aU as TypographyTitleProps, aV as TypographyType, aW as Upload, aX as UploadChangeInfo, aY as UploadDraggerProps, aZ as UploadFile, a_ as UploadFileStatus, a$ as UploadHttpRequest, b0 as UploadItemActions, b1 as UploadProps, b2 as UploadRef, b3 as UploadRejectInfo, b4 as UploadRequestHandle, b5 as UploadRequestOptions, b6 as Watermark, b7 as WatermarkFont, b8 as WatermarkProps, b9 as message, ba as notification } from './core-Bb0160em.js';
1
+ import { T as TagStatus, B as BadgeProps } from './core-murmERqF.js';
2
+ export { a as Badge, b as BadgeRibbonProps, c as BadgeStatus, d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, C as Calendar, g as CalendarProps, h as Card, i as CardAccent, j as CardProps, k as Carousel, l as CarouselProps, m as CarouselRef, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, D as Dropdown, r as DropdownButtonProps, s as DropdownMenuProps, t as DropdownOpenSource, u as DropdownPlacement, v as DropdownProps, w as DropdownTrigger, F as FILLED_ICON_NAMES, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, H as FloatingPlacement, I as FloatingTrigger, J as ICON_NAMES, K as Icon, L as IconName, M as IconProps, N as IconVariant, O as Image, P as ImagePreview, Q as ImagePreviewConfig, R as ImagePreviewProps, S as ImageProps, U as Input, V as InputProps, W as Menu, X as MenuClickInfo, Y as MenuItem, Z as MenuMode, _ as MenuProps, $ as MenuTheme, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, a4 as NotificationConfig, a5 as NotificationPlacement, a6 as NotificationType, a7 as Popconfirm, a8 as PopconfirmProps, a9 as Popover, aa as PopoverProps, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ae as Rate, af as RateProps, ag as Segmented, ah as SegmentedOption, ai as SegmentedProps, aj as SegmentedValue, ak as Spin, al as SpinProps, am as StepItem, an as StepStatus, ao as Steps, ap as StepsProps, aq as TabItem, ar as Tabs, as as TabsContextMenuClickInfo, at as TabsOrientation, au as TabsPosition, av as TabsProps, aw as TabsType, ax as Tag, ay as TagProps, az as TagSize, aA as TagVariant, aB as Timeline, aC as TimelineItem, aD as TimelineProps, aE as Toolbar, aF as ToolbarItem, aG as ToolbarProps, aH as Tooltip, aI as TooltipProps, aJ as Tour, aK as TourProps, aL as TourStep, aM as Tree, aN as TreeDropPosition, aO as TreeKey, aP as TreeNode, aQ as TreeProps, aR as Typography, aS as TypographyLinkProps, aT as TypographyProps, aU as TypographyTitleProps, aV as TypographyType, aW as Upload, aX as UploadChangeInfo, aY as UploadDraggerProps, aZ as UploadFile, a_ as UploadFileStatus, a$ as UploadHttpRequest, b0 as UploadItemActions, b1 as UploadProps, b2 as UploadRef, b3 as UploadRejectInfo, b4 as UploadRequestHandle, b5 as UploadRequestOptions, b6 as Watermark, b7 as WatermarkFont, b8 as WatermarkProps, b9 as message, ba as notification } from './core-murmERqF.js';
3
3
  import * as react from 'react';
4
4
  import { HTMLAttributes, ReactNode, CSSProperties, ElementType, FormHTMLAttributes, InputHTMLAttributes, ChangeEvent, TextareaHTMLAttributes, MouseEvent, Key, PointerEvent, Ref, ReactElement, ButtonHTMLAttributes, RefObject } from 'react';
5
5
  import { C as ControlSize, I as InputPlaceholderMode, a as ControlStatus } from './shared-Bx4B28Wh.js';
@@ -2733,6 +2733,8 @@ interface TableToolbarItem<T> {
2733
2733
  key: string;
2734
2734
  /** 展示给用户的名称,可传入文本或 React 节点。 */
2735
2735
  label: ReactNode;
2736
+ /** 操作的悬停提示文字;普通工具栏按钮和设置菜单项均支持,禁用时仍可显示,停留 600ms 后出现。 */
2737
+ title?: string;
2736
2738
  /** 显示在内容旁的图标节点,建议使用 Icon 组件。 */
2737
2739
  icon?: ReactNode;
2738
2740
  /** 显示位置或定位配置。 */
@@ -3099,11 +3101,11 @@ interface QueryFormProps<T extends FormValues = FormValues> extends Omit<FormPro
3099
3101
  */
3100
3102
  fieldWidth?: number | string;
3101
3103
  /**
3102
- 是否显示展开和收起入口;false 时始终展示全部字段。
3104
+ * 是否允许展开和收起;仅全部字段与操作区无法在一行内显示时提供入口,false 时始终展示全部字段。
3103
3105
  * @defaultValue true
3104
3106
  */
3105
3107
  collapsible?: boolean;
3106
- /** 受控收起状态,需在 onCollapsedChange 中更新。收起时保留字段挂载和值,只隐藏放不下的字段和底部快捷标签。 */
3108
+ /** 受控收起状态,需在 onCollapsedChange 中更新;全部字段能单行显示时不执行收起。收起时保留字段挂载和值,只隐藏放不下的字段和底部快捷标签。 */
3107
3109
  collapsed?: boolean;
3108
3110
  /**
3109
3111
  * 非受控模式的初始收起状态。
@@ -3111,7 +3113,7 @@ interface QueryFormProps<T extends FormValues = FormValues> extends Omit<FormPro
3111
3113
  */
3112
3114
  defaultCollapsed?: boolean;
3113
3115
  /**
3114
- * 收起时最多保留的字段数;实际数量会根据可用宽度减少,以保持单行。
3116
+ * 需要折叠时最多保留的字段数;实际数量会根据可用宽度减少,以保持单行。全部字段能单行显示时不限制字段数。
3115
3117
  * @defaultValue 3
3116
3118
  */
3117
3119
  collapsedCount?: number;
package/dist/index.js CHANGED
@@ -7136,6 +7136,8 @@ function createColumnSettingPlugin(options = {}) {
7136
7136
  ...customItems.map((item) => ({
7137
7137
  key: "custom:" + item.key,
7138
7138
  label: item.label,
7139
+ // 设置菜单复用菜单项提示,禁用操作也需说明不可用原因。
7140
+ title: item.title,
7139
7141
  icon: item.icon,
7140
7142
  danger: item.danger,
7141
7143
  disabled: item.disabled === true || typeof item.disabled === "function" && item.disabled(context)
@@ -7231,6 +7233,7 @@ function ToolbarItems({
7231
7233
  {
7232
7234
  size: "small",
7233
7235
  danger: item.danger,
7236
+ title: item.title,
7234
7237
  icon: item.icon,
7235
7238
  disabled,
7236
7239
  onClick: () => void item.onClick?.(context),
@@ -8502,7 +8505,8 @@ function QueryForm({
8502
8505
  }) {
8503
8506
  const [form] = useForm(providedForm);
8504
8507
  const [internalCollapsed, setInternalCollapsed] = useState20(defaultCollapsed);
8505
- const collapsed = collapsible && (controlledCollapsed ?? internalCollapsed);
8508
+ const [needsCollapse, setNeedsCollapse] = useState20(false);
8509
+ const collapsed = collapsible && needsCollapse && (controlledCollapsed ?? internalCollapsed);
8506
8510
  const [searching, setSearching] = useState20(false);
8507
8511
  const [saving, setSaving] = useState20(false);
8508
8512
  const [removing, setRemoving] = useState20(false);
@@ -8522,15 +8526,33 @@ function QueryForm({
8522
8526
  const limit = Math.max(1, Math.floor(collapsedCount));
8523
8527
  const rowRef = useRef18(null);
8524
8528
  const actionsRef = useRef18(null);
8529
+ const toggleRef = useRef18(null);
8525
8530
  const [fittingCount, setFittingCount] = useState20(limit);
8526
8531
  useLayoutEffect5(() => {
8527
- if (!collapsed) return;
8528
8532
  const row = rowRef.current;
8529
8533
  const actions = actionsRef.current;
8530
8534
  if (!row || !actions) return;
8531
8535
  function measure() {
8532
8536
  if (!row || !actions) return;
8533
8537
  const gap = parseFloat(getComputedStyle(row).columnGap) || 0;
8538
+ const allFields = Array.from(row.querySelectorAll(":scope > .sia-query-form__field"));
8539
+ const hiddenFields = allFields.filter((field) => field.hidden);
8540
+ const wasCollapsed = row.classList.contains("is-collapsed");
8541
+ const toggle = toggleRef.current;
8542
+ const toggleHidden = toggle?.hidden;
8543
+ row.classList.remove("is-collapsed");
8544
+ hiddenFields.forEach((field) => {
8545
+ field.hidden = false;
8546
+ });
8547
+ if (toggle) toggle.hidden = true;
8548
+ const requiredWidth = allFields.reduce((total, field) => total + field.getBoundingClientRect().width + gap, actions.getBoundingClientRect().width);
8549
+ setNeedsCollapse(allFields.length > 0 && requiredWidth > row.clientWidth + 0.5);
8550
+ if (toggle) toggle.hidden = Boolean(toggleHidden);
8551
+ hiddenFields.forEach((field) => {
8552
+ field.hidden = true;
8553
+ });
8554
+ row.classList.toggle("is-collapsed", wasCollapsed);
8555
+ if (!collapsed) return;
8534
8556
  let remaining = row.clientWidth - actions.getBoundingClientRect().width;
8535
8557
  let count = 0;
8536
8558
  for (const field of Array.from(row.querySelectorAll(":scope > .sia-query-form__field")).slice(0, limit)) {
@@ -8547,7 +8569,7 @@ function QueryForm({
8547
8569
  observer.observe(actions);
8548
8570
  row.querySelectorAll(":scope > .sia-query-form__field").forEach((field) => observer.observe(field));
8549
8571
  return () => observer.disconnect();
8550
- }, [collapsed, limit, fieldWidth, fields, children]);
8572
+ }, [collapsed, needsCollapse, collapsible, limit, fieldWidth, fields, children, actionsExtra, onSaveQuery, searchText, resetText, saveText]);
8551
8573
  async function search(values) {
8552
8574
  const info = source.current;
8553
8575
  source.current = { source: "submit" };
@@ -8678,7 +8700,7 @@ function QueryForm({
8678
8700
  setSaveOpen(true);
8679
8701
  }, children: saveText }) : null
8680
8702
  ] }),
8681
- collapsible && entries.length > 0 ? /* @__PURE__ */ jsx26(
8703
+ collapsible && entries.length > 0 ? /* @__PURE__ */ jsx26("span", { ref: toggleRef, hidden: !needsCollapse, children: /* @__PURE__ */ jsx26(
8682
8704
  Button,
8683
8705
  {
8684
8706
  variant: "link",
@@ -8691,7 +8713,7 @@ function QueryForm({
8691
8713
  },
8692
8714
  children: collapsed ? "\u5C55\u5F00" : "\u6536\u8D77"
8693
8715
  }
8694
- ) : null,
8716
+ ) }) : null,
8695
8717
  actionsExtra
8696
8718
  ] })
8697
8719
  ] }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sia.soul/sia-react-ui",
3
- "version": "0.1.49",
3
+ "version": "0.1.51",
4
4
  "description": "Sia Design components and tokens for React",
5
5
  "publishConfig": {
6
6
  "access": "public",