@sia.soul/sia-react-ui 0.1.14 → 0.1.15

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.
@@ -76,6 +76,7 @@ function Tag({
76
76
  variant = "soft",
77
77
  icon,
78
78
  closable = false,
79
+ closeOnHover = false,
79
80
  disabled = false,
80
81
  onClose,
81
82
  className = "",
@@ -85,7 +86,7 @@ function Tag({
85
86
  return /* @__PURE__ */ jsxs2(
86
87
  "span",
87
88
  {
88
- className: `sia-tag sia-tag--${status} sia-tag--${variant}${compact ? " sia-tag--compact" : ""}${disabled ? " sia-tag--disabled" : ""} ${className}`.trim(),
89
+ className: `sia-tag${closable && closeOnHover ? " sia-tag--close-on-hover" : ""} sia-tag--${status} sia-tag--${variant}${compact ? " sia-tag--compact" : ""}${disabled ? " sia-tag--disabled" : ""} ${className}`.trim(),
89
90
  "aria-disabled": disabled || void 0,
90
91
  ...props,
91
92
  children: [
@@ -300,10 +300,12 @@ interface TagProps extends HTMLAttributes<HTMLSpanElement> {
300
300
  variant?: TagVariant;
301
301
  icon?: ReactNode;
302
302
  closable?: boolean;
303
+ /** 悬停或键盘聚焦时展开关闭按钮。 */
304
+ closeOnHover?: boolean;
303
305
  disabled?: boolean;
304
306
  onClose?: (event: MouseEvent<HTMLButtonElement>) => void;
305
307
  }
306
- declare function Tag({ status, compact, variant, icon, closable, disabled, onClose, className, children, ...props }: TagProps): react.JSX.Element;
308
+ declare function Tag({ status, compact, variant, icon, closable, closeOnHover, disabled, onClose, className, children, ...props }: TagProps): react.JSX.Element;
307
309
 
308
310
  type MenuMode = "vertical" | "horizontal" | "inline";
309
311
  type MenuTheme = "light" | "dark";
@@ -1077,4 +1079,4 @@ declare const FloatButton: react.ForwardRefExoticComponent<FloatButtonProps & re
1077
1079
  BackTop: typeof FloatButtonBackTop;
1078
1080
  };
1079
1081
 
1080
- export { Menu as $, type DropdownProps as A, type ButtonProps as B, Calendar as C, Dropdown as D, type DropdownTrigger as E, FILLED_ICON_NAMES as F, type FilledIconName as G, FloatButton as H, type FloatButtonBackTopProps as I, type FloatButtonGroupProps as J, type FloatButtonProps as K, type FloatButtonShape as L, type FloatingPlacement as M, type FloatingTrigger as N, type OverlayContainer as O, ICON_NAMES as P, Icon as Q, type IconName as R, type IconProps as S, type IconVariant as T, Image as U, ImagePreview as V, type ImagePreviewConfig as W, type ImagePreviewProps as X, type ImageProps as Y, Input as Z, type InputProps as _, type OverlayApiHandle as a, type TypographyTitleProps as a$, type MenuClickInfo as a0, type MenuItem as a1, type MenuMode as a2, type MenuProps as a3, type MenuTheme as a4, type MessageConfig as a5, type MessageHandle as a6, type MessageKey as a7, type MessageType as a8, Modal as a9, type TabItem as aA, Tabs as aB, type TabsContextMenuClickInfo as aC, type TabsOrientation as aD, type TabsPosition as aE, type TabsProps as aF, type TabsType as aG, Tag as aH, type TagProps as aI, type TagStatus as aJ, type TagVariant as aK, Timeline as aL, type TimelineItem as aM, type TimelineProps as aN, Tooltip as aO, type TooltipProps as aP, Tour as aQ, type TourProps as aR, type TourStep as aS, Tree as aT, type TreeDropPosition as aU, type TreeKey as aV, type TreeNode as aW, type TreeProps as aX, Typography as aY, type TypographyLinkProps as aZ, type TypographyProps as a_, type ModalActionResult as aa, type ModalOpenConfig as ab, type ModalProps as ac, type ModalType as ad, type NotificationConfig as ae, type NotificationPlacement as af, type NotificationType as ag, Popconfirm as ah, type PopconfirmProps as ai, Popover as aj, type PopoverProps as ak, Progress as al, type ProgressProps as am, type ProgressStatus as an, Rate as ao, type RateProps as ap, Segmented as aq, type SegmentedOption as ar, type SegmentedProps as as, type SegmentedValue as at, Spin as au, type SpinProps as av, type StepItem as aw, type StepStatus as ax, Steps as ay, type StepsProps as az, Badge as b, type TypographyType as b0, Upload as b1, type UploadChangeInfo as b2, type UploadDraggerProps as b3, type UploadFile as b4, type UploadFileStatus as b5, type UploadProps as b6, type UploadRequestOptions as b7, Watermark as b8, type WatermarkFont as b9, type WatermarkProps as ba, message as bb, notification as bc, type BadgeProps as c, type BadgeRibbonProps as d, type BadgeStatus as e, Breadcrumb as f, type BreadcrumbItem as g, type BreadcrumbProps as h, Button as i, type ButtonSize as j, type ButtonVariant as k, type CalendarProps as l, Card as m, type CardAccent as n, type CardProps as o, Carousel as p, type CarouselProps as q, type CarouselRef as r, Collapse as s, type CollapseItem as t, type CollapseKey as u, type CollapseProps as v, type DropdownButtonProps as w, type DropdownMenuProps as x, type DropdownOpenSource as y, type DropdownPlacement as z };
1082
+ export { type InputProps as $, type DropdownProps as A, type ButtonProps as B, Calendar as C, Dropdown as D, type DropdownTrigger as E, FILLED_ICON_NAMES as F, type FilledIconName as G, FloatButton as H, type FloatButtonBackTopProps as I, type FloatButtonGroupProps as J, type FloatButtonProps as K, type FloatButtonShape as L, type FloatingPlacement as M, type FloatingTrigger as N, type OverlayContainer as O, ICON_NAMES as P, Icon as Q, type IconName as R, type IconProps as S, type TagStatus as T, type IconVariant as U, Image as V, ImagePreview as W, type ImagePreviewConfig as X, type ImagePreviewProps as Y, type ImageProps as Z, Input as _, type OverlayApiHandle as a, type TypographyTitleProps as a$, Menu as a0, type MenuClickInfo as a1, type MenuItem as a2, type MenuMode as a3, type MenuProps as a4, type MenuTheme as a5, type MessageConfig as a6, type MessageHandle as a7, type MessageKey as a8, type MessageType as a9, type StepsProps as aA, type TabItem as aB, Tabs as aC, type TabsContextMenuClickInfo as aD, type TabsOrientation as aE, type TabsPosition as aF, type TabsProps as aG, type TabsType as aH, Tag as aI, type TagProps as aJ, type TagVariant as aK, Timeline as aL, type TimelineItem as aM, type TimelineProps as aN, Tooltip as aO, type TooltipProps as aP, Tour as aQ, type TourProps as aR, type TourStep as aS, Tree as aT, type TreeDropPosition as aU, type TreeKey as aV, type TreeNode as aW, type TreeProps as aX, Typography as aY, type TypographyLinkProps as aZ, type TypographyProps as a_, Modal as aa, type ModalActionResult as ab, type ModalOpenConfig as ac, type ModalProps as ad, type ModalType as ae, type NotificationConfig as af, type NotificationPlacement as ag, type NotificationType as ah, Popconfirm as ai, type PopconfirmProps as aj, Popover as ak, type PopoverProps as al, Progress as am, type ProgressProps as an, type ProgressStatus as ao, Rate as ap, type RateProps as aq, Segmented as ar, type SegmentedOption as as, type SegmentedProps as at, type SegmentedValue as au, Spin as av, type SpinProps as aw, type StepItem as ax, type StepStatus as ay, Steps as az, type ButtonSize as b, type TypographyType as b0, Upload as b1, type UploadChangeInfo as b2, type UploadDraggerProps as b3, type UploadFile as b4, type UploadFileStatus as b5, type UploadProps as b6, type UploadRequestOptions as b7, Watermark as b8, type WatermarkFont as b9, type WatermarkProps as ba, message as bb, notification as bc, type BadgeProps as c, Badge as d, type BadgeRibbonProps as e, type BadgeStatus as f, Breadcrumb as g, type BreadcrumbItem as h, type BreadcrumbProps as i, Button as j, type ButtonVariant as k, type CalendarProps as l, Card as m, type CardAccent as n, type CardProps as o, Carousel as p, type CarouselProps as q, type CarouselRef as r, Collapse as s, type CollapseItem as t, type CollapseKey as u, type CollapseProps as v, type DropdownButtonProps as w, type DropdownMenuProps as x, type DropdownOpenSource as y, type DropdownPlacement as z };
@@ -300,10 +300,12 @@ interface TagProps extends HTMLAttributes<HTMLSpanElement> {
300
300
  variant?: TagVariant;
301
301
  icon?: ReactNode;
302
302
  closable?: boolean;
303
+ /** 悬停或键盘聚焦时展开关闭按钮。 */
304
+ closeOnHover?: boolean;
303
305
  disabled?: boolean;
304
306
  onClose?: (event: MouseEvent<HTMLButtonElement>) => void;
305
307
  }
306
- declare function Tag({ status, compact, variant, icon, closable, disabled, onClose, className, children, ...props }: TagProps): react.JSX.Element;
308
+ declare function Tag({ status, compact, variant, icon, closable, closeOnHover, disabled, onClose, className, children, ...props }: TagProps): react.JSX.Element;
307
309
 
308
310
  type MenuMode = "vertical" | "horizontal" | "inline";
309
311
  type MenuTheme = "light" | "dark";
@@ -1077,4 +1079,4 @@ declare const FloatButton: react.ForwardRefExoticComponent<FloatButtonProps & re
1077
1079
  BackTop: typeof FloatButtonBackTop;
1078
1080
  };
1079
1081
 
1080
- export { Menu as $, type DropdownProps as A, type ButtonProps as B, Calendar as C, Dropdown as D, type DropdownTrigger as E, FILLED_ICON_NAMES as F, type FilledIconName as G, FloatButton as H, type FloatButtonBackTopProps as I, type FloatButtonGroupProps as J, type FloatButtonProps as K, type FloatButtonShape as L, type FloatingPlacement as M, type FloatingTrigger as N, type OverlayContainer as O, ICON_NAMES as P, Icon as Q, type IconName as R, type IconProps as S, type IconVariant as T, Image as U, ImagePreview as V, type ImagePreviewConfig as W, type ImagePreviewProps as X, type ImageProps as Y, Input as Z, type InputProps as _, type OverlayApiHandle as a, type TypographyTitleProps as a$, type MenuClickInfo as a0, type MenuItem as a1, type MenuMode as a2, type MenuProps as a3, type MenuTheme as a4, type MessageConfig as a5, type MessageHandle as a6, type MessageKey as a7, type MessageType as a8, Modal as a9, type TabItem as aA, Tabs as aB, type TabsContextMenuClickInfo as aC, type TabsOrientation as aD, type TabsPosition as aE, type TabsProps as aF, type TabsType as aG, Tag as aH, type TagProps as aI, type TagStatus as aJ, type TagVariant as aK, Timeline as aL, type TimelineItem as aM, type TimelineProps as aN, Tooltip as aO, type TooltipProps as aP, Tour as aQ, type TourProps as aR, type TourStep as aS, Tree as aT, type TreeDropPosition as aU, type TreeKey as aV, type TreeNode as aW, type TreeProps as aX, Typography as aY, type TypographyLinkProps as aZ, type TypographyProps as a_, type ModalActionResult as aa, type ModalOpenConfig as ab, type ModalProps as ac, type ModalType as ad, type NotificationConfig as ae, type NotificationPlacement as af, type NotificationType as ag, Popconfirm as ah, type PopconfirmProps as ai, Popover as aj, type PopoverProps as ak, Progress as al, type ProgressProps as am, type ProgressStatus as an, Rate as ao, type RateProps as ap, Segmented as aq, type SegmentedOption as ar, type SegmentedProps as as, type SegmentedValue as at, Spin as au, type SpinProps as av, type StepItem as aw, type StepStatus as ax, Steps as ay, type StepsProps as az, Badge as b, type TypographyType as b0, Upload as b1, type UploadChangeInfo as b2, type UploadDraggerProps as b3, type UploadFile as b4, type UploadFileStatus as b5, type UploadProps as b6, type UploadRequestOptions as b7, Watermark as b8, type WatermarkFont as b9, type WatermarkProps as ba, message as bb, notification as bc, type BadgeProps as c, type BadgeRibbonProps as d, type BadgeStatus as e, Breadcrumb as f, type BreadcrumbItem as g, type BreadcrumbProps as h, Button as i, type ButtonSize as j, type ButtonVariant as k, type CalendarProps as l, Card as m, type CardAccent as n, type CardProps as o, Carousel as p, type CarouselProps as q, type CarouselRef as r, Collapse as s, type CollapseItem as t, type CollapseKey as u, type CollapseProps as v, type DropdownButtonProps as w, type DropdownMenuProps as x, type DropdownOpenSource as y, type DropdownPlacement as z };
1082
+ export { type InputProps as $, type DropdownProps as A, type ButtonProps as B, Calendar as C, Dropdown as D, type DropdownTrigger as E, FILLED_ICON_NAMES as F, type FilledIconName as G, FloatButton as H, type FloatButtonBackTopProps as I, type FloatButtonGroupProps as J, type FloatButtonProps as K, type FloatButtonShape as L, type FloatingPlacement as M, type FloatingTrigger as N, type OverlayContainer as O, ICON_NAMES as P, Icon as Q, type IconName as R, type IconProps as S, type TagStatus as T, type IconVariant as U, Image as V, ImagePreview as W, type ImagePreviewConfig as X, type ImagePreviewProps as Y, type ImageProps as Z, Input as _, type OverlayApiHandle as a, type TypographyTitleProps as a$, Menu as a0, type MenuClickInfo as a1, type MenuItem as a2, type MenuMode as a3, type MenuProps as a4, type MenuTheme as a5, type MessageConfig as a6, type MessageHandle as a7, type MessageKey as a8, type MessageType as a9, type StepsProps as aA, type TabItem as aB, Tabs as aC, type TabsContextMenuClickInfo as aD, type TabsOrientation as aE, type TabsPosition as aF, type TabsProps as aG, type TabsType as aH, Tag as aI, type TagProps as aJ, type TagVariant as aK, Timeline as aL, type TimelineItem as aM, type TimelineProps as aN, Tooltip as aO, type TooltipProps as aP, Tour as aQ, type TourProps as aR, type TourStep as aS, Tree as aT, type TreeDropPosition as aU, type TreeKey as aV, type TreeNode as aW, type TreeProps as aX, Typography as aY, type TypographyLinkProps as aZ, type TypographyProps as a_, Modal as aa, type ModalActionResult as ab, type ModalOpenConfig as ac, type ModalProps as ad, type ModalType as ae, type NotificationConfig as af, type NotificationPlacement as ag, type NotificationType as ah, Popconfirm as ai, type PopconfirmProps as aj, Popover as ak, type PopoverProps as al, Progress as am, type ProgressProps as an, type ProgressStatus as ao, Rate as ap, type RateProps as aq, Segmented as ar, type SegmentedOption as as, type SegmentedProps as at, type SegmentedValue as au, Spin as av, type SpinProps as aw, type StepItem as ax, type StepStatus as ay, Steps as az, type ButtonSize as b, type TypographyType as b0, Upload as b1, type UploadChangeInfo as b2, type UploadDraggerProps as b3, type UploadFile as b4, type UploadFileStatus as b5, type UploadProps as b6, type UploadRequestOptions as b7, Watermark as b8, type WatermarkFont as b9, type WatermarkProps as ba, message as bb, notification as bc, type BadgeProps as c, Badge as d, type BadgeRibbonProps as e, type BadgeStatus as f, Breadcrumb as g, type BreadcrumbItem as h, type BreadcrumbProps as i, Button as j, type ButtonVariant as k, type CalendarProps as l, Card as m, type CardAccent as n, type CardProps as o, Carousel as p, type CarouselProps as q, type CarouselRef as r, Collapse as s, type CollapseItem as t, type CollapseKey as u, type CollapseProps as v, type DropdownButtonProps as w, type DropdownMenuProps as x, type DropdownOpenSource as y, type DropdownPlacement as z };
package/dist/core.cjs CHANGED
@@ -989,6 +989,7 @@ function Tag({
989
989
  variant = "soft",
990
990
  icon,
991
991
  closable = false,
992
+ closeOnHover = false,
992
993
  disabled = false,
993
994
  onClose,
994
995
  className = "",
@@ -998,7 +999,7 @@ function Tag({
998
999
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
999
1000
  "span",
1000
1001
  {
1001
- className: `sia-tag sia-tag--${status} sia-tag--${variant}${compact ? " sia-tag--compact" : ""}${disabled ? " sia-tag--disabled" : ""} ${className}`.trim(),
1002
+ className: `sia-tag${closable && closeOnHover ? " sia-tag--close-on-hover" : ""} sia-tag--${status} sia-tag--${variant}${compact ? " sia-tag--compact" : ""}${disabled ? " sia-tag--disabled" : ""} ${className}`.trim(),
1002
1003
  "aria-disabled": disabled || void 0,
1003
1004
  ...props,
1004
1005
  children: [
package/dist/core.css CHANGED
@@ -4729,6 +4729,145 @@ fieldset:disabled .sia-input-number__floating-placeholder {
4729
4729
  transition: none;
4730
4730
  }
4731
4731
  }
4732
+ .sia-query-form {
4733
+ min-width: 0;
4734
+ width: 100%;
4735
+ }
4736
+ .sia-query-form__fields {
4737
+ display: flex;
4738
+ flex-wrap: wrap;
4739
+ align-items: center;
4740
+ gap: 12px;
4741
+ padding-top: 8px;
4742
+ }
4743
+ .sia-query-form__field {
4744
+ flex: 0 1 var(--sia-query-field-width, 220px);
4745
+ width: var(--sia-query-field-width, 220px);
4746
+ min-width: 0;
4747
+ max-width: 100%;
4748
+ }
4749
+ .sia-query-form__field[hidden] {
4750
+ display: none;
4751
+ }
4752
+ .sia-query-form__field > .sia-input-control,
4753
+ .sia-query-form__field > .sia-select,
4754
+ .sia-query-form__field > .sia-picker,
4755
+ .sia-query-form__field > .sia-input-number,
4756
+ .sia-query-form__field > .sia-cascader,
4757
+ .sia-query-form__field > .sia-tree-select,
4758
+ .sia-query-form__field > .sia-select-date-range {
4759
+ width: 100%;
4760
+ }
4761
+ .sia-query-form__field > .sia-space-compact {
4762
+ width: 100%;
4763
+ }
4764
+ .sia-query-form__field > .sia-space-compact > .sia-select {
4765
+ flex: 1;
4766
+ min-width: 0;
4767
+ width: 0;
4768
+ }
4769
+ .sia-query-form__actions {
4770
+ display: flex;
4771
+ align-items: center;
4772
+ flex-wrap: wrap;
4773
+ gap: 6px;
4774
+ }
4775
+ .sia-query-form__quick,
4776
+ .sia-query-form__saved {
4777
+ display: flex;
4778
+ flex-wrap: wrap;
4779
+ align-items: center;
4780
+ gap: 8px;
4781
+ }
4782
+ .sia-query-form__quick {
4783
+ margin-bottom: 8px;
4784
+ }
4785
+ .sia-query-form__saved {
4786
+ margin-top: 10px;
4787
+ }
4788
+ .sia-query-form__saved > .sia-tag {
4789
+ cursor: pointer;
4790
+ }
4791
+ .sia-query-form__saved > .sia-tag.is-active {
4792
+ outline: 1px solid currentColor;
4793
+ }
4794
+ .sia-query-form__saved > .sia-tag:focus-visible {
4795
+ outline: 2px solid var(--sia-color-primary);
4796
+ outline-offset: 2px;
4797
+ }
4798
+ .sia-query-form__saved > .sia-tag--disabled {
4799
+ cursor: not-allowed;
4800
+ }
4801
+ .sia-query-form__error {
4802
+ margin: 8px 0 0;
4803
+ color: var(--sia-color-error);
4804
+ font-size: 13px;
4805
+ }
4806
+ @media (max-width: 600px) {
4807
+ .sia-query-form__field {
4808
+ flex-basis: 100% !important;
4809
+ width: 100% !important;
4810
+ }
4811
+ .sia-query-form__actions {
4812
+ width: 100%;
4813
+ }
4814
+ }
4815
+ .sia-query-form__fields.is-collapsed {
4816
+ flex-wrap: nowrap;
4817
+ overflow-x: auto;
4818
+ padding-bottom: 2px;
4819
+ }
4820
+ .sia-query-form__fields.is-collapsed > .sia-query-form__field {
4821
+ flex: 0 0 auto;
4822
+ }
4823
+ .sia-query-form__fields.is-collapsed > .sia-query-form__actions {
4824
+ flex: 0 0 auto;
4825
+ flex-wrap: nowrap;
4826
+ width: max-content;
4827
+ }
4828
+ @media (max-width: 600px) {
4829
+ .sia-query-form__fields.is-collapsed > .sia-query-form__field {
4830
+ flex-basis: auto !important;
4831
+ width: var(--sia-query-field-width, 220px) !important;
4832
+ }
4833
+ }
4834
+ .sia-query-form__quick > .sia-badge:has(.sia-badge__count) {
4835
+ margin: 5px 12px 2px 0;
4836
+ }
4837
+ .sia-tag--close-on-hover > .sia-tag__close {
4838
+ flex-shrink: 0;
4839
+ width: 0;
4840
+ margin-left: -4px;
4841
+ margin-right: 0;
4842
+ overflow: hidden;
4843
+ opacity: 0;
4844
+ pointer-events: none;
4845
+ transition:
4846
+ width 180ms ease,
4847
+ margin 180ms ease,
4848
+ opacity 180ms ease;
4849
+ }
4850
+ .sia-tag--close-on-hover:not(.sia-tag--disabled):is(:hover, :focus-within) > .sia-tag__close {
4851
+ width: 16px;
4852
+ margin-left: 0;
4853
+ margin-right: -4px;
4854
+ opacity: 1;
4855
+ pointer-events: auto;
4856
+ }
4857
+ @media (hover: none) {
4858
+ .sia-tag--close-on-hover:not(.sia-tag--disabled) > .sia-tag__close {
4859
+ width: 16px;
4860
+ margin-left: 0;
4861
+ margin-right: -4px;
4862
+ opacity: 1;
4863
+ pointer-events: auto;
4864
+ }
4865
+ }
4866
+ @media (prefers-reduced-motion: reduce) {
4867
+ .sia-tag--close-on-hover > .sia-tag__close {
4868
+ transition: none;
4869
+ }
4870
+ }
4732
4871
 
4733
4872
  /* src/components-extra.css */
4734
4873
  .sia-flex {
package/dist/core.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export { f as Breadcrumb, g as BreadcrumbItem, h as BreadcrumbProps, i as Button, B as ButtonProps, j as ButtonSize, k as ButtonVariant, m as Card, n as CardAccent, o as CardProps, s as Collapse, t as CollapseItem, u as CollapseKey, v as CollapseProps, G as FilledIconName, H as FloatButton, I as FloatButtonBackTopProps, J as FloatButtonGroupProps, K as FloatButtonProps, L as FloatButtonShape, Q as Icon, R as IconName, S as IconProps, T as IconVariant, Z as Input, _ as InputProps, a5 as MessageConfig, a6 as MessageHandle, a7 as MessageKey, a8 as MessageType, a9 as Modal, aa as ModalActionResult, ab as ModalOpenConfig, ac as ModalProps, ad as ModalType, a as OverlayApiHandle, al as Progress, am as ProgressProps, an as ProgressStatus, aq as Segmented, ar as SegmentedOption, as as SegmentedProps, at as SegmentedValue, aA as TabItem, aB as Tabs, aD as TabsOrientation, aE as TabsPosition, aF as TabsProps, aG as TabsType, aH as Tag, aI as TagProps, aJ as TagStatus, aK as TagVariant, aY as Typography, aZ as TypographyLinkProps, a_ as TypographyProps, a$ as TypographyTitleProps, b0 as TypographyType, b1 as Upload, b2 as UploadChangeInfo, b3 as UploadDraggerProps, b4 as UploadFile, b5 as UploadFileStatus, b6 as UploadProps, b7 as UploadRequestOptions, bb as message } from './core-BK8AXc12.cjs';
1
+ export { g as Breadcrumb, h as BreadcrumbItem, i as BreadcrumbProps, j as Button, B as ButtonProps, b as ButtonSize, k as ButtonVariant, m as Card, n as CardAccent, o as CardProps, s as Collapse, t as CollapseItem, u as CollapseKey, v as CollapseProps, G as FilledIconName, H as FloatButton, I as FloatButtonBackTopProps, J as FloatButtonGroupProps, K as FloatButtonProps, L as FloatButtonShape, Q as Icon, R as IconName, S as IconProps, U as IconVariant, _ as Input, $ as InputProps, a6 as MessageConfig, a7 as MessageHandle, a8 as MessageKey, a9 as MessageType, aa as Modal, ab as ModalActionResult, ac as ModalOpenConfig, ad as ModalProps, ae as ModalType, a as OverlayApiHandle, am as Progress, an as ProgressProps, ao as ProgressStatus, ar as Segmented, as as SegmentedOption, at as SegmentedProps, au as SegmentedValue, aB as TabItem, aC as Tabs, aE as TabsOrientation, aF as TabsPosition, aG as TabsProps, aH as TabsType, aI as Tag, aJ as TagProps, T as TagStatus, aK as TagVariant, aY as Typography, aZ as TypographyLinkProps, a_ as TypographyProps, a$ as TypographyTitleProps, b0 as TypographyType, b1 as Upload, b2 as UploadChangeInfo, b3 as UploadDraggerProps, b4 as UploadFile, b5 as UploadFileStatus, b6 as UploadProps, b7 as UploadRequestOptions, bb as message } from './core-AeKYVPDZ.cjs';
2
2
  export { S as Select, c as SelectOption, d as SelectProps, e as SelectValue } from './Select-CVvF4mcy.cjs';
3
3
  import 'react';
4
4
  import './shared-DAYZvZVu.cjs';
package/dist/core.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { f as Breadcrumb, g as BreadcrumbItem, h as BreadcrumbProps, i as Button, B as ButtonProps, j as ButtonSize, k as ButtonVariant, m as Card, n as CardAccent, o as CardProps, s as Collapse, t as CollapseItem, u as CollapseKey, v as CollapseProps, G as FilledIconName, H as FloatButton, I as FloatButtonBackTopProps, J as FloatButtonGroupProps, K as FloatButtonProps, L as FloatButtonShape, Q as Icon, R as IconName, S as IconProps, T as IconVariant, Z as Input, _ as InputProps, a5 as MessageConfig, a6 as MessageHandle, a7 as MessageKey, a8 as MessageType, a9 as Modal, aa as ModalActionResult, ab as ModalOpenConfig, ac as ModalProps, ad as ModalType, a as OverlayApiHandle, al as Progress, am as ProgressProps, an as ProgressStatus, aq as Segmented, ar as SegmentedOption, as as SegmentedProps, at as SegmentedValue, aA as TabItem, aB as Tabs, aD as TabsOrientation, aE as TabsPosition, aF as TabsProps, aG as TabsType, aH as Tag, aI as TagProps, aJ as TagStatus, aK as TagVariant, aY as Typography, aZ as TypographyLinkProps, a_ as TypographyProps, a$ as TypographyTitleProps, b0 as TypographyType, b1 as Upload, b2 as UploadChangeInfo, b3 as UploadDraggerProps, b4 as UploadFile, b5 as UploadFileStatus, b6 as UploadProps, b7 as UploadRequestOptions, bb as message } from './core-CJK3_KTQ.js';
1
+ export { g as Breadcrumb, h as BreadcrumbItem, i as BreadcrumbProps, j as Button, B as ButtonProps, b as ButtonSize, k as ButtonVariant, m as Card, n as CardAccent, o as CardProps, s as Collapse, t as CollapseItem, u as CollapseKey, v as CollapseProps, G as FilledIconName, H as FloatButton, I as FloatButtonBackTopProps, J as FloatButtonGroupProps, K as FloatButtonProps, L as FloatButtonShape, Q as Icon, R as IconName, S as IconProps, U as IconVariant, _ as Input, $ as InputProps, a6 as MessageConfig, a7 as MessageHandle, a8 as MessageKey, a9 as MessageType, aa as Modal, ab as ModalActionResult, ac as ModalOpenConfig, ad as ModalProps, ae as ModalType, a as OverlayApiHandle, am as Progress, an as ProgressProps, ao as ProgressStatus, ar as Segmented, as as SegmentedOption, at as SegmentedProps, au as SegmentedValue, aB as TabItem, aC as Tabs, aE as TabsOrientation, aF as TabsPosition, aG as TabsProps, aH as TabsType, aI as Tag, aJ as TagProps, T as TagStatus, aK as TagVariant, aY as Typography, aZ as TypographyLinkProps, a_ as TypographyProps, a$ as TypographyTitleProps, b0 as TypographyType, b1 as Upload, b2 as UploadChangeInfo, b3 as UploadDraggerProps, b4 as UploadFile, b5 as UploadFileStatus, b6 as UploadProps, b7 as UploadRequestOptions, bb as message } from './core-DcSXqSRs.js';
2
2
  export { S as Select, c as SelectOption, d as SelectProps, e as SelectValue } from './Select-Ce2Irbpt.js';
3
3
  import 'react';
4
4
  import './shared-DAYZvZVu.js';
package/dist/core.js CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  Typography,
10
10
  Upload,
11
11
  message
12
- } from "./chunk-K3XRTEIO.js";
12
+ } from "./chunk-E7F47Z2C.js";
13
13
  import "./chunk-YT6E3X2K.js";
14
14
  import {
15
15
  Modal,
package/dist/index.cjs CHANGED
@@ -101,6 +101,7 @@ __export(index_exports, {
101
101
  Popconfirm: () => Popconfirm,
102
102
  Popover: () => Popover,
103
103
  Progress: () => Progress,
104
+ QueryForm: () => QueryForm,
104
105
  RadarChart: () => RadarChart,
105
106
  Radio: () => Radio2,
106
107
  Rate: () => Rate,
@@ -9585,6 +9586,7 @@ function Tag({
9585
9586
  variant = "soft",
9586
9587
  icon,
9587
9588
  closable = false,
9589
+ closeOnHover = false,
9588
9590
  disabled = false,
9589
9591
  onClose,
9590
9592
  className = "",
@@ -9594,7 +9596,7 @@ function Tag({
9594
9596
  return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
9595
9597
  "span",
9596
9598
  {
9597
- className: `sia-tag sia-tag--${status} sia-tag--${variant}${compact ? " sia-tag--compact" : ""}${disabled ? " sia-tag--disabled" : ""} ${className}`.trim(),
9599
+ className: `sia-tag${closable && closeOnHover ? " sia-tag--close-on-hover" : ""} sia-tag--${status} sia-tag--${variant}${compact ? " sia-tag--compact" : ""}${disabled ? " sia-tag--disabled" : ""} ${className}`.trim(),
9598
9600
  "aria-disabled": disabled || void 0,
9599
9601
  ...props,
9600
9602
  children: [
@@ -20893,6 +20895,293 @@ var InputSelect = (0, import_react86.forwardRef)(function InputSelect2({
20893
20895
  )
20894
20896
  ] });
20895
20897
  });
20898
+
20899
+ // src/components/QueryForm.tsx
20900
+ var import_react87 = require("react");
20901
+ var import_jsx_runtime87 = require("react/jsx-runtime");
20902
+ function QueryForm({
20903
+ fields,
20904
+ children,
20905
+ form: providedForm,
20906
+ onSearch,
20907
+ loading = false,
20908
+ fieldWidth = 220,
20909
+ collapsible = true,
20910
+ collapsed: controlledCollapsed,
20911
+ defaultCollapsed = false,
20912
+ collapsedCount = 3,
20913
+ onCollapsedChange,
20914
+ quickQueries = [],
20915
+ quickQuerySize = "small",
20916
+ savedQueries = [],
20917
+ shortcutsLoading = false,
20918
+ onSaveQuery,
20919
+ onRemoveQuery,
20920
+ onError,
20921
+ searchText = "\u67E5\u8BE2",
20922
+ resetText = "\u91CD\u7F6E",
20923
+ saveText = "\u53E6\u5B58\u4E3A\u5FEB\u6377\u67E5\u8BE2",
20924
+ resetSearch = true,
20925
+ actionsExtra,
20926
+ disabled = false,
20927
+ className = "",
20928
+ placeholderMode = "floating",
20929
+ onValuesChange,
20930
+ onFinishFailed,
20931
+ ...formProps
20932
+ }) {
20933
+ const [form] = useForm(providedForm);
20934
+ const [internalCollapsed, setInternalCollapsed] = (0, import_react87.useState)(defaultCollapsed);
20935
+ const collapsed = collapsible && (controlledCollapsed ?? internalCollapsed);
20936
+ const [searching, setSearching] = (0, import_react87.useState)(false);
20937
+ const [saving, setSaving] = (0, import_react87.useState)(false);
20938
+ const [removing, setRemoving] = (0, import_react87.useState)(false);
20939
+ const [saveOpen, setSaveOpen] = (0, import_react87.useState)(false);
20940
+ const [saveName, setSaveName] = (0, import_react87.useState)("");
20941
+ const [saveError, setSaveError] = (0, import_react87.useState)("");
20942
+ const [error, setError] = (0, import_react87.useState)("");
20943
+ const [activeShortcut, setActiveShortcut] = (0, import_react87.useState)("");
20944
+ const source = (0, import_react87.useRef)({ source: "submit" });
20945
+ const searchLock = (0, import_react87.useRef)(false);
20946
+ const saveLock = (0, import_react87.useRef)(false);
20947
+ const removeLock = (0, import_react87.useRef)(false);
20948
+ const snapshot = (0, import_react87.useRef)();
20949
+ const busy = disabled || loading || searching;
20950
+ const shortcutBusy = busy || shortcutsLoading || saving || removing;
20951
+ const entries = fields ? fields.map(({ key, width, ...item }) => ({ key, width, content: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(Form.Item, { noStyle: true, ...item }) })) : import_react87.Children.toArray(children).map((content, index) => ({ key: String(index), width: void 0, content }));
20952
+ const limit = Math.max(1, Math.floor(collapsedCount));
20953
+ const rowRef = (0, import_react87.useRef)(null);
20954
+ const actionsRef = (0, import_react87.useRef)(null);
20955
+ const [fittingCount, setFittingCount] = (0, import_react87.useState)(limit);
20956
+ (0, import_react87.useLayoutEffect)(() => {
20957
+ if (!collapsed) return;
20958
+ const row = rowRef.current;
20959
+ const actions = actionsRef.current;
20960
+ if (!row || !actions) return;
20961
+ function measure() {
20962
+ if (!row || !actions) return;
20963
+ const gap = parseFloat(getComputedStyle(row).columnGap) || 0;
20964
+ let remaining = row.clientWidth - actions.getBoundingClientRect().width;
20965
+ let count = 0;
20966
+ for (const field of Array.from(row.querySelectorAll(":scope > .sia-query-form__field")).slice(0, limit)) {
20967
+ const width = parseFloat(getComputedStyle(field).width) || 220;
20968
+ if (remaining + 0.5 < width + gap) break;
20969
+ remaining -= width + gap;
20970
+ count++;
20971
+ }
20972
+ setFittingCount(count);
20973
+ }
20974
+ measure();
20975
+ const observer = new ResizeObserver(measure);
20976
+ observer.observe(row);
20977
+ observer.observe(actions);
20978
+ row.querySelectorAll(":scope > .sia-query-form__field").forEach((field) => observer.observe(field));
20979
+ return () => observer.disconnect();
20980
+ }, [collapsed, limit, fieldWidth, fields, children]);
20981
+ async function search(values) {
20982
+ const info = source.current;
20983
+ source.current = { source: "submit" };
20984
+ if (searchLock.current || disabled || loading) return;
20985
+ searchLock.current = true;
20986
+ setSearching(true);
20987
+ setError("");
20988
+ try {
20989
+ await onSearch(values, info);
20990
+ } catch (reason) {
20991
+ setError(reason instanceof Error ? reason.message : "\u67E5\u8BE2\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5");
20992
+ onError?.(reason, "search");
20993
+ } finally {
20994
+ searchLock.current = false;
20995
+ setSearching(false);
20996
+ }
20997
+ }
20998
+ function applyShortcut(query, kind) {
20999
+ if (shortcutBusy || query.disabled) return;
21000
+ form.resetFields();
21001
+ form.setFieldsValue(query.values);
21002
+ source.current = { source: kind, shortcutKey: query.key };
21003
+ setActiveShortcut(`${kind}:${query.key}`);
21004
+ form.submit();
21005
+ }
21006
+ function reset() {
21007
+ if (busy) return;
21008
+ form.resetFields();
21009
+ setActiveShortcut("");
21010
+ setError("");
21011
+ if (resetSearch) {
21012
+ source.current = { source: "reset" };
21013
+ form.submit();
21014
+ }
21015
+ }
21016
+ async function save() {
21017
+ if (!onSaveQuery || saveLock.current) return false;
21018
+ const name = saveName.trim();
21019
+ if (!name) {
21020
+ setSaveError("\u8BF7\u8F93\u5165\u5FEB\u6377\u67E5\u8BE2\u540D\u79F0");
21021
+ return false;
21022
+ }
21023
+ if (!snapshot.current) return false;
21024
+ saveLock.current = true;
21025
+ setSaving(true);
21026
+ setSaveError("");
21027
+ try {
21028
+ await onSaveQuery({ name, values: snapshot.current });
21029
+ setSaveOpen(false);
21030
+ } catch (reason) {
21031
+ setSaveError(reason instanceof Error ? reason.message : "\u4FDD\u5B58\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5");
21032
+ onError?.(reason, "save");
21033
+ return false;
21034
+ } finally {
21035
+ saveLock.current = false;
21036
+ setSaving(false);
21037
+ }
21038
+ }
21039
+ async function remove(query) {
21040
+ if (!onRemoveQuery || shortcutBusy || removeLock.current) return;
21041
+ removeLock.current = true;
21042
+ setRemoving(true);
21043
+ setError("");
21044
+ try {
21045
+ await onRemoveQuery(query);
21046
+ if (activeShortcut === `saved:${query.key}`) setActiveShortcut("");
21047
+ } catch (reason) {
21048
+ setError(reason instanceof Error ? reason.message : "\u5220\u9664\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5");
21049
+ onError?.(reason, "remove");
21050
+ } finally {
21051
+ removeLock.current = false;
21052
+ setRemoving(false);
21053
+ }
21054
+ }
21055
+ return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: `sia-query-form ${className}`.trim(), children: [
21056
+ /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(
21057
+ Form,
21058
+ {
21059
+ ...formProps,
21060
+ form,
21061
+ placeholderMode,
21062
+ disabled,
21063
+ onFinish: (values) => {
21064
+ void search(values);
21065
+ },
21066
+ onFinishFailed: (info) => {
21067
+ source.current = { source: "submit" };
21068
+ onFinishFailed?.(info);
21069
+ },
21070
+ onValuesChange: (changed, values) => {
21071
+ setActiveShortcut("");
21072
+ onValuesChange?.(changed, values);
21073
+ },
21074
+ children: [
21075
+ quickQueries.length ? /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: "sia-query-form__quick", "aria-label": "\u9884\u8BBE\u5FEB\u6377\u67E5\u8BE2", children: [
21076
+ quickQueries.map((query) => /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(Badge, { className: "sia-query-form__quick-badge", showZero: true, size: "small", title: query.count === void 0 ? void 0 : `\u5171 ${query.count} \u6761`, ...query.badgeProps, count: query.count, children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
21077
+ Button,
21078
+ {
21079
+ size: query.size ?? quickQuerySize,
21080
+ "aria-pressed": activeShortcut === `quick:${query.key}`,
21081
+ variant: activeShortcut === `quick:${query.key}` ? "primary" : "default",
21082
+ disabled: shortcutBusy || query.disabled,
21083
+ onClick: () => applyShortcut(query, "quick"),
21084
+ children: query.label
21085
+ }
21086
+ ) }, query.key)),
21087
+ " "
21088
+ ] }) : null,
21089
+ /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { ref: rowRef, className: `sia-query-form__fields${collapsed ? " is-collapsed" : ""}`, style: { "--sia-query-field-width": typeof fieldWidth === "number" ? `${fieldWidth}px` : fieldWidth }, children: [
21090
+ entries.map((entry, index) => /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
21091
+ "div",
21092
+ {
21093
+ className: "sia-query-form__field",
21094
+ hidden: collapsed && index >= Math.min(limit, fittingCount),
21095
+ style: entry.width !== void 0 ? { flexBasis: entry.width, width: entry.width } : void 0,
21096
+ children: entry.content
21097
+ },
21098
+ entry.key
21099
+ )),
21100
+ /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { ref: actionsRef, className: "sia-query-form__actions", children: [
21101
+ /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(Space.Compact, { children: [
21102
+ /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(Button, { type: "submit", variant: "primary", loading: loading || searching, disabled, children: searchText }),
21103
+ /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(Button, { disabled: busy, onClick: reset, children: resetText }),
21104
+ onSaveQuery ? /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(Button, { disabled: shortcutBusy, onClick: () => {
21105
+ snapshot.current = form.getFieldsValue();
21106
+ setSaveName("");
21107
+ setSaveError("");
21108
+ setSaveOpen(true);
21109
+ }, children: saveText }) : null
21110
+ ] }),
21111
+ collapsible && entries.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
21112
+ Button,
21113
+ {
21114
+ variant: "link",
21115
+ "aria-expanded": !collapsed,
21116
+ icon: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(Icon, { name: collapsed ? "chevron-down" : "chevron-up" }),
21117
+ iconPosition: "end",
21118
+ onClick: () => {
21119
+ setInternalCollapsed(!collapsed);
21120
+ onCollapsedChange?.(!collapsed);
21121
+ },
21122
+ children: collapsed ? "\u5C55\u5F00" : "\u6536\u8D77"
21123
+ }
21124
+ ) : null,
21125
+ actionsExtra
21126
+ ] })
21127
+ ] }),
21128
+ savedQueries.length && !collapsed ? /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: "sia-query-form__saved", "aria-label": "\u5DF2\u4FDD\u5B58\u5FEB\u6377\u67E5\u8BE2", children: [
21129
+ savedQueries.map((query, index) => /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
21130
+ Tag,
21131
+ {
21132
+ status: query.status ?? ["processing", "success", "warning", "error"][index % 4],
21133
+ variant: "soft",
21134
+ disabled: shortcutBusy || query.disabled,
21135
+ tabIndex: shortcutBusy || query.disabled ? -1 : 0,
21136
+ className: activeShortcut === `saved:${query.key}` ? "is-active" : "",
21137
+ closable: Boolean(onRemoveQuery),
21138
+ closeOnHover: true,
21139
+ onClose: () => {
21140
+ void remove(query);
21141
+ },
21142
+ onClick: () => applyShortcut(query, "saved"),
21143
+ onKeyDown: (event) => {
21144
+ if (event.target === event.currentTarget && (event.key === "Enter" || event.key === " ")) {
21145
+ event.preventDefault();
21146
+ applyShortcut(query, "saved");
21147
+ }
21148
+ },
21149
+ children: query.label
21150
+ },
21151
+ query.key
21152
+ )),
21153
+ " "
21154
+ ] }) : null,
21155
+ error ? /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("p", { className: "sia-query-form__error", role: "alert", children: error }) : null
21156
+ ]
21157
+ }
21158
+ ),
21159
+ /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(Modal2, { open: saveOpen, title: "\u53E6\u5B58\u4E3A\u5FEB\u6377\u67E5\u8BE2", width: 420, confirmLoading: saving, onOk: save, onOpenChange: (next) => {
21160
+ if (!saveLock.current) setSaveOpen(next);
21161
+ }, children: [
21162
+ /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
21163
+ Input,
21164
+ {
21165
+ autoFocus: true,
21166
+ "aria-label": "\u5FEB\u6377\u67E5\u8BE2\u540D\u79F0",
21167
+ placeholder: "\u5FEB\u6377\u67E5\u8BE2\u540D\u79F0",
21168
+ value: saveName,
21169
+ maxLength: 80,
21170
+ disabled: saving,
21171
+ status: saveError ? "error" : "default",
21172
+ onChange: (event) => setSaveName(event.target.value),
21173
+ onKeyDown: (event) => {
21174
+ if (event.key === "Enter") {
21175
+ event.preventDefault();
21176
+ void save();
21177
+ }
21178
+ }
21179
+ }
21180
+ ),
21181
+ saveError ? /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("p", { className: "sia-query-form__error", role: "alert", children: saveError }) : null
21182
+ ] })
21183
+ ] });
21184
+ }
20896
21185
  // Annotate the CommonJS export names for ESM import in node:
20897
21186
  0 && (module.exports = {
20898
21187
  Alert,
@@ -20966,6 +21255,7 @@ var InputSelect = (0, import_react86.forwardRef)(function InputSelect2({
20966
21255
  Popconfirm,
20967
21256
  Popover,
20968
21257
  Progress,
21258
+ QueryForm,
20969
21259
  RadarChart,
20970
21260
  Radio,
20971
21261
  Rate,
package/dist/index.css CHANGED
@@ -4729,6 +4729,145 @@ fieldset:disabled .sia-input-number__floating-placeholder {
4729
4729
  transition: none;
4730
4730
  }
4731
4731
  }
4732
+ .sia-query-form {
4733
+ min-width: 0;
4734
+ width: 100%;
4735
+ }
4736
+ .sia-query-form__fields {
4737
+ display: flex;
4738
+ flex-wrap: wrap;
4739
+ align-items: center;
4740
+ gap: 12px;
4741
+ padding-top: 8px;
4742
+ }
4743
+ .sia-query-form__field {
4744
+ flex: 0 1 var(--sia-query-field-width, 220px);
4745
+ width: var(--sia-query-field-width, 220px);
4746
+ min-width: 0;
4747
+ max-width: 100%;
4748
+ }
4749
+ .sia-query-form__field[hidden] {
4750
+ display: none;
4751
+ }
4752
+ .sia-query-form__field > .sia-input-control,
4753
+ .sia-query-form__field > .sia-select,
4754
+ .sia-query-form__field > .sia-picker,
4755
+ .sia-query-form__field > .sia-input-number,
4756
+ .sia-query-form__field > .sia-cascader,
4757
+ .sia-query-form__field > .sia-tree-select,
4758
+ .sia-query-form__field > .sia-select-date-range {
4759
+ width: 100%;
4760
+ }
4761
+ .sia-query-form__field > .sia-space-compact {
4762
+ width: 100%;
4763
+ }
4764
+ .sia-query-form__field > .sia-space-compact > .sia-select {
4765
+ flex: 1;
4766
+ min-width: 0;
4767
+ width: 0;
4768
+ }
4769
+ .sia-query-form__actions {
4770
+ display: flex;
4771
+ align-items: center;
4772
+ flex-wrap: wrap;
4773
+ gap: 6px;
4774
+ }
4775
+ .sia-query-form__quick,
4776
+ .sia-query-form__saved {
4777
+ display: flex;
4778
+ flex-wrap: wrap;
4779
+ align-items: center;
4780
+ gap: 8px;
4781
+ }
4782
+ .sia-query-form__quick {
4783
+ margin-bottom: 8px;
4784
+ }
4785
+ .sia-query-form__saved {
4786
+ margin-top: 10px;
4787
+ }
4788
+ .sia-query-form__saved > .sia-tag {
4789
+ cursor: pointer;
4790
+ }
4791
+ .sia-query-form__saved > .sia-tag.is-active {
4792
+ outline: 1px solid currentColor;
4793
+ }
4794
+ .sia-query-form__saved > .sia-tag:focus-visible {
4795
+ outline: 2px solid var(--sia-color-primary);
4796
+ outline-offset: 2px;
4797
+ }
4798
+ .sia-query-form__saved > .sia-tag--disabled {
4799
+ cursor: not-allowed;
4800
+ }
4801
+ .sia-query-form__error {
4802
+ margin: 8px 0 0;
4803
+ color: var(--sia-color-error);
4804
+ font-size: 13px;
4805
+ }
4806
+ @media (max-width: 600px) {
4807
+ .sia-query-form__field {
4808
+ flex-basis: 100% !important;
4809
+ width: 100% !important;
4810
+ }
4811
+ .sia-query-form__actions {
4812
+ width: 100%;
4813
+ }
4814
+ }
4815
+ .sia-query-form__fields.is-collapsed {
4816
+ flex-wrap: nowrap;
4817
+ overflow-x: auto;
4818
+ padding-bottom: 2px;
4819
+ }
4820
+ .sia-query-form__fields.is-collapsed > .sia-query-form__field {
4821
+ flex: 0 0 auto;
4822
+ }
4823
+ .sia-query-form__fields.is-collapsed > .sia-query-form__actions {
4824
+ flex: 0 0 auto;
4825
+ flex-wrap: nowrap;
4826
+ width: max-content;
4827
+ }
4828
+ @media (max-width: 600px) {
4829
+ .sia-query-form__fields.is-collapsed > .sia-query-form__field {
4830
+ flex-basis: auto !important;
4831
+ width: var(--sia-query-field-width, 220px) !important;
4832
+ }
4833
+ }
4834
+ .sia-query-form__quick > .sia-badge:has(.sia-badge__count) {
4835
+ margin: 5px 12px 2px 0;
4836
+ }
4837
+ .sia-tag--close-on-hover > .sia-tag__close {
4838
+ flex-shrink: 0;
4839
+ width: 0;
4840
+ margin-left: -4px;
4841
+ margin-right: 0;
4842
+ overflow: hidden;
4843
+ opacity: 0;
4844
+ pointer-events: none;
4845
+ transition:
4846
+ width 180ms ease,
4847
+ margin 180ms ease,
4848
+ opacity 180ms ease;
4849
+ }
4850
+ .sia-tag--close-on-hover:not(.sia-tag--disabled):is(:hover, :focus-within) > .sia-tag__close {
4851
+ width: 16px;
4852
+ margin-left: 0;
4853
+ margin-right: -4px;
4854
+ opacity: 1;
4855
+ pointer-events: auto;
4856
+ }
4857
+ @media (hover: none) {
4858
+ .sia-tag--close-on-hover:not(.sia-tag--disabled) > .sia-tag__close {
4859
+ width: 16px;
4860
+ margin-left: 0;
4861
+ margin-right: -4px;
4862
+ opacity: 1;
4863
+ pointer-events: auto;
4864
+ }
4865
+ }
4866
+ @media (prefers-reduced-motion: reduce) {
4867
+ .sia-tag--close-on-hover > .sia-tag__close {
4868
+ transition: none;
4869
+ }
4870
+ }
4732
4871
 
4733
4872
  /* src/components-extra.css */
4734
4873
  .sia-flex {
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { HTMLAttributes, ReactNode, CSSProperties, ElementType, FormHTMLAttributes, InputHTMLAttributes, ChangeEvent, TextareaHTMLAttributes, MouseEvent, Key, PointerEvent, Ref, ReactElement, ButtonHTMLAttributes } from 'react';
3
- import { O as OverlayContainer, a as OverlayApiHandle, B as ButtonProps } from './core-BK8AXc12.cjs';
4
- export { b as Badge, c as BadgeProps, d as BadgeRibbonProps, e as BadgeStatus, f as Breadcrumb, g as BreadcrumbItem, h as BreadcrumbProps, i as Button, j as ButtonSize, k as ButtonVariant, C as Calendar, l as CalendarProps, m as Card, n as CardAccent, o as CardProps, p as Carousel, q as CarouselProps, r as CarouselRef, s as Collapse, t as CollapseItem, u as CollapseKey, v as CollapseProps, D as Dropdown, w as DropdownButtonProps, x as DropdownMenuProps, y as DropdownOpenSource, z as DropdownPlacement, A as DropdownProps, E as DropdownTrigger, F as FILLED_ICON_NAMES, G as FilledIconName, H as FloatButton, I as FloatButtonBackTopProps, J as FloatButtonGroupProps, K as FloatButtonProps, L as FloatButtonShape, M as FloatingPlacement, N as FloatingTrigger, P as ICON_NAMES, Q as Icon, R as IconName, S as IconProps, T as IconVariant, U as Image, V as ImagePreview, W as ImagePreviewConfig, X as ImagePreviewProps, Y as ImageProps, Z as Input, _ as InputProps, $ as Menu, a0 as MenuClickInfo, a1 as MenuItem, a2 as MenuMode, a3 as MenuProps, a4 as MenuTheme, a5 as MessageConfig, a6 as MessageHandle, a7 as MessageKey, a8 as MessageType, a9 as Modal, aa as ModalActionResult, ab as ModalOpenConfig, ac as ModalProps, ad as ModalType, ae as NotificationConfig, af as NotificationPlacement, ag as NotificationType, ah as Popconfirm, ai as PopconfirmProps, aj as Popover, ak as PopoverProps, al as Progress, am as ProgressProps, an as ProgressStatus, ao as Rate, ap as RateProps, aq as Segmented, ar as SegmentedOption, as as SegmentedProps, at as SegmentedValue, au as Spin, av as SpinProps, aw as StepItem, ax as StepStatus, ay as Steps, az as StepsProps, aA as TabItem, aB as Tabs, aC as TabsContextMenuClickInfo, aD as TabsOrientation, aE as TabsPosition, aF as TabsProps, aG as TabsType, aH as Tag, aI as TagProps, aJ as TagStatus, aK as TagVariant, aL as Timeline, aM as TimelineItem, aN as TimelineProps, aO as Tooltip, aP as TooltipProps, aQ as Tour, aR as TourProps, aS as TourStep, aT as Tree, aU as TreeDropPosition, aV as TreeKey, aW as TreeNode, aX as TreeProps, aY as Typography, aZ as TypographyLinkProps, a_ as TypographyProps, a$ as TypographyTitleProps, b0 as TypographyType, b1 as Upload, b2 as UploadChangeInfo, b3 as UploadDraggerProps, b4 as UploadFile, b5 as UploadFileStatus, b6 as UploadProps, b7 as UploadRequestOptions, b8 as Watermark, b9 as WatermarkFont, ba as WatermarkProps, bb as message, bc as notification } from './core-BK8AXc12.cjs';
3
+ import { O as OverlayContainer, a as OverlayApiHandle, B as ButtonProps, T as TagStatus, b as ButtonSize, c as BadgeProps } from './core-AeKYVPDZ.cjs';
4
+ export { d as Badge, e as BadgeRibbonProps, f as BadgeStatus, g as Breadcrumb, h as BreadcrumbItem, i as BreadcrumbProps, j as Button, k as ButtonVariant, C as Calendar, l as CalendarProps, m as Card, n as CardAccent, o as CardProps, p as Carousel, q as CarouselProps, r as CarouselRef, s as Collapse, t as CollapseItem, u as CollapseKey, v as CollapseProps, D as Dropdown, w as DropdownButtonProps, x as DropdownMenuProps, y as DropdownOpenSource, z as DropdownPlacement, A as DropdownProps, E as DropdownTrigger, F as FILLED_ICON_NAMES, G as FilledIconName, H as FloatButton, I as FloatButtonBackTopProps, J as FloatButtonGroupProps, K as FloatButtonProps, L as FloatButtonShape, M as FloatingPlacement, N as FloatingTrigger, P as ICON_NAMES, Q as Icon, R as IconName, S as IconProps, U as IconVariant, V as Image, W as ImagePreview, X as ImagePreviewConfig, Y as ImagePreviewProps, Z as ImageProps, _ as Input, $ as InputProps, a0 as Menu, a1 as MenuClickInfo, a2 as MenuItem, a3 as MenuMode, a4 as MenuProps, a5 as MenuTheme, a6 as MessageConfig, a7 as MessageHandle, a8 as MessageKey, a9 as MessageType, aa as Modal, ab as ModalActionResult, ac as ModalOpenConfig, ad as ModalProps, ae as ModalType, af as NotificationConfig, ag as NotificationPlacement, ah as NotificationType, ai as Popconfirm, aj as PopconfirmProps, ak as Popover, al as PopoverProps, am as Progress, an as ProgressProps, ao as ProgressStatus, ap as Rate, aq as RateProps, ar as Segmented, as as SegmentedOption, at as SegmentedProps, au as SegmentedValue, av as Spin, aw as SpinProps, ax as StepItem, ay as StepStatus, az as Steps, aA as StepsProps, aB as TabItem, aC as Tabs, aD as TabsContextMenuClickInfo, aE as TabsOrientation, aF as TabsPosition, aG as TabsProps, aH as TabsType, aI as Tag, aJ as TagProps, aK as TagVariant, aL as Timeline, aM as TimelineItem, aN as TimelineProps, aO as Tooltip, aP as TooltipProps, aQ as Tour, aR as TourProps, aS as TourStep, aT as Tree, aU as TreeDropPosition, aV as TreeKey, aW as TreeNode, aX as TreeProps, aY as Typography, aZ as TypographyLinkProps, a_ as TypographyProps, a$ as TypographyTitleProps, b0 as TypographyType, b1 as Upload, b2 as UploadChangeInfo, b3 as UploadDraggerProps, b4 as UploadFile, b5 as UploadFileStatus, b6 as UploadProps, b7 as UploadRequestOptions, b8 as Watermark, b9 as WatermarkFont, ba as WatermarkProps, bb as message, bc as notification } from './core-AeKYVPDZ.cjs';
5
5
  import { C as ControlSize, I as InputPlaceholderMode, a as ControlStatus } from './shared-DAYZvZVu.cjs';
6
6
  export { D as DatePicker, a as DatePickerDisabledInfo, b as DatePickerPreset, c as DatePickerProps, d as DatePickerShowTime, e as DatePickerType, f as DatePickerValue, g as DateRangePickerPreset, h as DateRangePickerProps, S as SelectDateRange, i as SelectDateRangeProps, j as SelectDateRangeValue } from './select-date-range-shDQ5uJA.cjs';
7
7
  export { RichTextContent, RichTextContentFormat, RichTextContentProps, RichTextEditor, RichTextEditorProps, RichTextImagePasteHandler, RichTextToolbar } from './rich-text-editor.cjs';
@@ -1365,4 +1365,56 @@ interface InputSelectProps {
1365
1365
  }
1366
1366
  declare const InputSelect: react.ForwardRefExoticComponent<InputSelectProps & react.RefAttributes<HTMLInputElement>>;
1367
1367
 
1368
- export { Alert, type AlertProps, type AlertStatus, type AnyTablePlugin, ButtonProps, Cascader, type CascaderFieldNames, type CascaderOption, type CascaderProps, type CascaderValue, Checkbox, type CheckboxGroupProps, type CheckboxOption, type CheckboxProps, type CheckboxValue, Col, type ColProps, type ColSize, ColorPicker, type ColorPickerMode, type ColorPickerPreset, type ColorPickerProps, ControlSize, ControlStatus, DEFAULT_PAGE_SIZE_OPTIONS, Divider, type DividerProps, Drawer, type DrawerOpenConfig, type DrawerPlacement, type DrawerProps, type DrawerPush, type DrawerPushConfig, Editor, type EditorCommand, type EditorCompletionContext, type EditorCompletionItem, type EditorCompletionItemKind, type EditorCompletionProvider, type EditorContextMenuItem, type EditorHandle, type EditorKeyDownEvent, type EditorLanguage, type EditorMarker, type EditorProps, type EditorRange, type EditorSelectionChange, type EditorTheme, type FlatTreeNode, type FlatTreeOptions, Flex, type FlexProps, FloatingScrollbarProvider, type FloatingScrollbarProviderProps, Form, type FormErrorField, type FormInstance, type FormItemProps, type FormListField, type FormListOperation, type FormListProps, type FormProps, type FormRule, type FormValues, type GridBreakpoint, InputNumber, type InputNumberProps, InputPlaceholderMode, InputSelect, type InputSelectProps, type LayoutGap, Markdown, type MarkdownProps, type NamePath, OverlayApiHandle, Pagination, type PaginationProps, Radio, type RadioGroupProps, type RadioOption, type RadioProps, type RadioValue, Row, type RowProps, SIA_THEME, type SelectionOption, SelectionPanel, type SelectionPanelProps, type SelectionValue, type SiaThemeMode, Slider, type SliderMark, type SliderProps, type SliderValue, Space, type SpaceCompactProps, type SpaceProps, Splitter, type SplitterPanelProps, type SplitterProps, Switch, type SwitchProps, type SwitchVariant, Table, type TableAlign, type TableCellAddress, type TableCellRange, type TableCellRenderInfo, type TableCellSelectionApi, type TableCellSelectionPluginOptions, type TableColumn, type TableColumnSettingApi, type TableColumnSettingItem, type TableColumnSettingPluginOptions, type TableColumnTransformPluginOptions, type TableEditableApi, type TableEditableCellConfig, type TableEditableCellType, type TableEditablePluginOptions, type TableExportApi, type TableExportPluginOptions, type TableExportScope, type TableFilterApi, type TableFilterPluginOptions, type TableFilterValues, type TableFixed, type TableHighlightPluginOptions, type TableHighlightValue, type TableIndexPluginOptions, type TableKey, type TableMergeStickyConfig, type TablePageParams, type TablePaginationApi, type TablePaginationPluginOptions, type TablePlugin, type TablePluginCellProps, type TablePluginContext, type TablePluginEvent, type TableProps, type TableRef, type TableResizeApi, type TableResizePluginOptions, type TableRow, type TableRowSpanPluginOptions, type TableSelectedCell, type TableSelectionApi, type TableSelectionMode, type TableSelectionPluginOptions, type TableSettingsAdapter, type TableSettingsSnapshot, type TableSize, type TableSortApi, type TableSortInfo, type TableSortPluginOptions, type TableSummaryPluginOptions, type TableSummaryRow, type TableToolbarItem, type TableToolbarPluginOptions, type TableTreeApi, type TableTreePluginOptions, TextArea, type TextAreaProps, ThemeSwitch, type ThemeSwitchProps, TimePicker, type TimePickerProps, type TimeRangePickerProps, ToolPanel, type ToolPanelItem, type ToolPanelPlacement, type ToolPanelProps, TreeSelect, type TreeSelectNode, type TreeSelectProps, type TreeSelectValue, Treemap, type TreemapNode, type TreemapNodeClickInfo, type TreemapNodeKind, type TreemapProps, type WindowAction, type WindowActionHandler, type WindowControlAction, type WindowControlLabels, WindowControls, type WindowControlsProps, WindowFrame, type WindowFrameProps, WindowTitleBar, type WindowTitleBarActionsAlign, type WindowTitleBarProps, applySiaTheme, buildFlatTree, createCellSelectionPlugin, createColumnSettingPlugin, createColumnTransformPlugin, createEditablePlugin, createExportPlugin, createFilterPlugin, createHighlightPlugin, createIndexPlugin, createLocalStorageTableSettingsAdapter, createPaginationPlugin, createResizePlugin, createRowSpanPlugin, createSelectionPlugin, createSortPlugin, createSummaryPlugin, createToolbarPlugin, createTreePlugin, useForm };
1368
+ interface QueryFormField extends FormItemProps {
1369
+ key: string;
1370
+ /** 字段占用宽度,默认由 fieldWidth 控制;组合字段可指定更大的宽度。 */
1371
+ width?: number | string;
1372
+ }
1373
+ interface QueryFormShortcut<T extends FormValues = FormValues> {
1374
+ key: string;
1375
+ label: ReactNode;
1376
+ values: Partial<T>;
1377
+ disabled?: boolean;
1378
+ status?: TagStatus;
1379
+ /** 顶部快捷查询按钮尺寸,优先于 quickQuerySize。 */
1380
+ size?: ButtonSize;
1381
+ /** 该快捷查询对应的数据总量,由业务接口提供。 */
1382
+ count?: number;
1383
+ badgeProps?: Omit<BadgeProps, "children" | "count">;
1384
+ }
1385
+ interface QueryFormSearchInfo {
1386
+ source: "submit" | "reset" | "quick" | "saved";
1387
+ shortcutKey?: string;
1388
+ }
1389
+ interface QueryFormProps<T extends FormValues = FormValues> extends Omit<FormProps, "onFinish" | "children" | "onError"> {
1390
+ fields?: readonly QueryFormField[];
1391
+ /** 也可直接放入 Form.Item 或 Space.Compact,每个直接子项视为一个查询字段。 */
1392
+ children?: ReactNode;
1393
+ onSearch: (values: T, info: QueryFormSearchInfo) => void | Promise<void>;
1394
+ loading?: boolean;
1395
+ fieldWidth?: number | string;
1396
+ collapsible?: boolean;
1397
+ collapsed?: boolean;
1398
+ defaultCollapsed?: boolean;
1399
+ collapsedCount?: number;
1400
+ onCollapsedChange?: (collapsed: boolean) => void;
1401
+ quickQueries?: readonly QueryFormShortcut<T>[];
1402
+ quickQuerySize?: ButtonSize;
1403
+ savedQueries?: readonly QueryFormShortcut<T>[];
1404
+ shortcutsLoading?: boolean;
1405
+ onSaveQuery?: (query: {
1406
+ name: string;
1407
+ values: T;
1408
+ }) => void | Promise<void>;
1409
+ onRemoveQuery?: (query: QueryFormShortcut<T>) => void | Promise<void>;
1410
+ onError?: (error: unknown, operation: "search" | "save" | "remove") => void;
1411
+ searchText?: ReactNode;
1412
+ resetText?: ReactNode;
1413
+ saveText?: ReactNode;
1414
+ resetSearch?: boolean;
1415
+ actionsExtra?: ReactNode;
1416
+ }
1417
+ /** 可复用的业务查询表单;快捷查询的存储和结果数据由业务方管理。 */
1418
+ declare function QueryForm<T extends FormValues = FormValues>({ fields, children, form: providedForm, onSearch, loading, fieldWidth, collapsible, collapsed: controlledCollapsed, defaultCollapsed, collapsedCount, onCollapsedChange, quickQueries, quickQuerySize, savedQueries, shortcutsLoading, onSaveQuery, onRemoveQuery, onError, searchText, resetText, saveText, resetSearch, actionsExtra, disabled, className, placeholderMode, onValuesChange, onFinishFailed, ...formProps }: QueryFormProps<T>): react.JSX.Element;
1419
+
1420
+ export { Alert, type AlertProps, type AlertStatus, type AnyTablePlugin, BadgeProps, ButtonProps, ButtonSize, Cascader, type CascaderFieldNames, type CascaderOption, type CascaderProps, type CascaderValue, Checkbox, type CheckboxGroupProps, type CheckboxOption, type CheckboxProps, type CheckboxValue, Col, type ColProps, type ColSize, ColorPicker, type ColorPickerMode, type ColorPickerPreset, type ColorPickerProps, ControlSize, ControlStatus, DEFAULT_PAGE_SIZE_OPTIONS, Divider, type DividerProps, Drawer, type DrawerOpenConfig, type DrawerPlacement, type DrawerProps, type DrawerPush, type DrawerPushConfig, Editor, type EditorCommand, type EditorCompletionContext, type EditorCompletionItem, type EditorCompletionItemKind, type EditorCompletionProvider, type EditorContextMenuItem, type EditorHandle, type EditorKeyDownEvent, type EditorLanguage, type EditorMarker, type EditorProps, type EditorRange, type EditorSelectionChange, type EditorTheme, type FlatTreeNode, type FlatTreeOptions, Flex, type FlexProps, FloatingScrollbarProvider, type FloatingScrollbarProviderProps, Form, type FormErrorField, type FormInstance, type FormItemProps, type FormListField, type FormListOperation, type FormListProps, type FormProps, type FormRule, type FormValues, type GridBreakpoint, InputNumber, type InputNumberProps, InputPlaceholderMode, InputSelect, type InputSelectProps, type LayoutGap, Markdown, type MarkdownProps, type NamePath, OverlayApiHandle, Pagination, type PaginationProps, QueryForm, type QueryFormField, type QueryFormProps, type QueryFormSearchInfo, type QueryFormShortcut, Radio, type RadioGroupProps, type RadioOption, type RadioProps, type RadioValue, Row, type RowProps, SIA_THEME, type SelectionOption, SelectionPanel, type SelectionPanelProps, type SelectionValue, type SiaThemeMode, Slider, type SliderMark, type SliderProps, type SliderValue, Space, type SpaceCompactProps, type SpaceProps, Splitter, type SplitterPanelProps, type SplitterProps, Switch, type SwitchProps, type SwitchVariant, Table, type TableAlign, type TableCellAddress, type TableCellRange, type TableCellRenderInfo, type TableCellSelectionApi, type TableCellSelectionPluginOptions, type TableColumn, type TableColumnSettingApi, type TableColumnSettingItem, type TableColumnSettingPluginOptions, type TableColumnTransformPluginOptions, type TableEditableApi, type TableEditableCellConfig, type TableEditableCellType, type TableEditablePluginOptions, type TableExportApi, type TableExportPluginOptions, type TableExportScope, type TableFilterApi, type TableFilterPluginOptions, type TableFilterValues, type TableFixed, type TableHighlightPluginOptions, type TableHighlightValue, type TableIndexPluginOptions, type TableKey, type TableMergeStickyConfig, type TablePageParams, type TablePaginationApi, type TablePaginationPluginOptions, type TablePlugin, type TablePluginCellProps, type TablePluginContext, type TablePluginEvent, type TableProps, type TableRef, type TableResizeApi, type TableResizePluginOptions, type TableRow, type TableRowSpanPluginOptions, type TableSelectedCell, type TableSelectionApi, type TableSelectionMode, type TableSelectionPluginOptions, type TableSettingsAdapter, type TableSettingsSnapshot, type TableSize, type TableSortApi, type TableSortInfo, type TableSortPluginOptions, type TableSummaryPluginOptions, type TableSummaryRow, type TableToolbarItem, type TableToolbarPluginOptions, type TableTreeApi, type TableTreePluginOptions, TagStatus, TextArea, type TextAreaProps, ThemeSwitch, type ThemeSwitchProps, TimePicker, type TimePickerProps, type TimeRangePickerProps, ToolPanel, type ToolPanelItem, type ToolPanelPlacement, type ToolPanelProps, TreeSelect, type TreeSelectNode, type TreeSelectProps, type TreeSelectValue, Treemap, type TreemapNode, type TreemapNodeClickInfo, type TreemapNodeKind, type TreemapProps, type WindowAction, type WindowActionHandler, type WindowControlAction, type WindowControlLabels, WindowControls, type WindowControlsProps, WindowFrame, type WindowFrameProps, WindowTitleBar, type WindowTitleBarActionsAlign, type WindowTitleBarProps, applySiaTheme, buildFlatTree, createCellSelectionPlugin, createColumnSettingPlugin, createColumnTransformPlugin, createEditablePlugin, createExportPlugin, createFilterPlugin, createHighlightPlugin, createIndexPlugin, createLocalStorageTableSettingsAdapter, createPaginationPlugin, createResizePlugin, createRowSpanPlugin, createSelectionPlugin, createSortPlugin, createSummaryPlugin, createToolbarPlugin, createTreePlugin, useForm };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { HTMLAttributes, ReactNode, CSSProperties, ElementType, FormHTMLAttributes, InputHTMLAttributes, ChangeEvent, TextareaHTMLAttributes, MouseEvent, Key, PointerEvent, Ref, ReactElement, ButtonHTMLAttributes } from 'react';
3
- import { O as OverlayContainer, a as OverlayApiHandle, B as ButtonProps } from './core-CJK3_KTQ.js';
4
- export { b as Badge, c as BadgeProps, d as BadgeRibbonProps, e as BadgeStatus, f as Breadcrumb, g as BreadcrumbItem, h as BreadcrumbProps, i as Button, j as ButtonSize, k as ButtonVariant, C as Calendar, l as CalendarProps, m as Card, n as CardAccent, o as CardProps, p as Carousel, q as CarouselProps, r as CarouselRef, s as Collapse, t as CollapseItem, u as CollapseKey, v as CollapseProps, D as Dropdown, w as DropdownButtonProps, x as DropdownMenuProps, y as DropdownOpenSource, z as DropdownPlacement, A as DropdownProps, E as DropdownTrigger, F as FILLED_ICON_NAMES, G as FilledIconName, H as FloatButton, I as FloatButtonBackTopProps, J as FloatButtonGroupProps, K as FloatButtonProps, L as FloatButtonShape, M as FloatingPlacement, N as FloatingTrigger, P as ICON_NAMES, Q as Icon, R as IconName, S as IconProps, T as IconVariant, U as Image, V as ImagePreview, W as ImagePreviewConfig, X as ImagePreviewProps, Y as ImageProps, Z as Input, _ as InputProps, $ as Menu, a0 as MenuClickInfo, a1 as MenuItem, a2 as MenuMode, a3 as MenuProps, a4 as MenuTheme, a5 as MessageConfig, a6 as MessageHandle, a7 as MessageKey, a8 as MessageType, a9 as Modal, aa as ModalActionResult, ab as ModalOpenConfig, ac as ModalProps, ad as ModalType, ae as NotificationConfig, af as NotificationPlacement, ag as NotificationType, ah as Popconfirm, ai as PopconfirmProps, aj as Popover, ak as PopoverProps, al as Progress, am as ProgressProps, an as ProgressStatus, ao as Rate, ap as RateProps, aq as Segmented, ar as SegmentedOption, as as SegmentedProps, at as SegmentedValue, au as Spin, av as SpinProps, aw as StepItem, ax as StepStatus, ay as Steps, az as StepsProps, aA as TabItem, aB as Tabs, aC as TabsContextMenuClickInfo, aD as TabsOrientation, aE as TabsPosition, aF as TabsProps, aG as TabsType, aH as Tag, aI as TagProps, aJ as TagStatus, aK as TagVariant, aL as Timeline, aM as TimelineItem, aN as TimelineProps, aO as Tooltip, aP as TooltipProps, aQ as Tour, aR as TourProps, aS as TourStep, aT as Tree, aU as TreeDropPosition, aV as TreeKey, aW as TreeNode, aX as TreeProps, aY as Typography, aZ as TypographyLinkProps, a_ as TypographyProps, a$ as TypographyTitleProps, b0 as TypographyType, b1 as Upload, b2 as UploadChangeInfo, b3 as UploadDraggerProps, b4 as UploadFile, b5 as UploadFileStatus, b6 as UploadProps, b7 as UploadRequestOptions, b8 as Watermark, b9 as WatermarkFont, ba as WatermarkProps, bb as message, bc as notification } from './core-CJK3_KTQ.js';
3
+ import { O as OverlayContainer, a as OverlayApiHandle, B as ButtonProps, T as TagStatus, b as ButtonSize, c as BadgeProps } from './core-DcSXqSRs.js';
4
+ export { d as Badge, e as BadgeRibbonProps, f as BadgeStatus, g as Breadcrumb, h as BreadcrumbItem, i as BreadcrumbProps, j as Button, k as ButtonVariant, C as Calendar, l as CalendarProps, m as Card, n as CardAccent, o as CardProps, p as Carousel, q as CarouselProps, r as CarouselRef, s as Collapse, t as CollapseItem, u as CollapseKey, v as CollapseProps, D as Dropdown, w as DropdownButtonProps, x as DropdownMenuProps, y as DropdownOpenSource, z as DropdownPlacement, A as DropdownProps, E as DropdownTrigger, F as FILLED_ICON_NAMES, G as FilledIconName, H as FloatButton, I as FloatButtonBackTopProps, J as FloatButtonGroupProps, K as FloatButtonProps, L as FloatButtonShape, M as FloatingPlacement, N as FloatingTrigger, P as ICON_NAMES, Q as Icon, R as IconName, S as IconProps, U as IconVariant, V as Image, W as ImagePreview, X as ImagePreviewConfig, Y as ImagePreviewProps, Z as ImageProps, _ as Input, $ as InputProps, a0 as Menu, a1 as MenuClickInfo, a2 as MenuItem, a3 as MenuMode, a4 as MenuProps, a5 as MenuTheme, a6 as MessageConfig, a7 as MessageHandle, a8 as MessageKey, a9 as MessageType, aa as Modal, ab as ModalActionResult, ac as ModalOpenConfig, ad as ModalProps, ae as ModalType, af as NotificationConfig, ag as NotificationPlacement, ah as NotificationType, ai as Popconfirm, aj as PopconfirmProps, ak as Popover, al as PopoverProps, am as Progress, an as ProgressProps, ao as ProgressStatus, ap as Rate, aq as RateProps, ar as Segmented, as as SegmentedOption, at as SegmentedProps, au as SegmentedValue, av as Spin, aw as SpinProps, ax as StepItem, ay as StepStatus, az as Steps, aA as StepsProps, aB as TabItem, aC as Tabs, aD as TabsContextMenuClickInfo, aE as TabsOrientation, aF as TabsPosition, aG as TabsProps, aH as TabsType, aI as Tag, aJ as TagProps, aK as TagVariant, aL as Timeline, aM as TimelineItem, aN as TimelineProps, aO as Tooltip, aP as TooltipProps, aQ as Tour, aR as TourProps, aS as TourStep, aT as Tree, aU as TreeDropPosition, aV as TreeKey, aW as TreeNode, aX as TreeProps, aY as Typography, aZ as TypographyLinkProps, a_ as TypographyProps, a$ as TypographyTitleProps, b0 as TypographyType, b1 as Upload, b2 as UploadChangeInfo, b3 as UploadDraggerProps, b4 as UploadFile, b5 as UploadFileStatus, b6 as UploadProps, b7 as UploadRequestOptions, b8 as Watermark, b9 as WatermarkFont, ba as WatermarkProps, bb as message, bc as notification } from './core-DcSXqSRs.js';
5
5
  import { C as ControlSize, I as InputPlaceholderMode, a as ControlStatus } from './shared-DAYZvZVu.js';
6
6
  export { D as DatePicker, a as DatePickerDisabledInfo, b as DatePickerPreset, c as DatePickerProps, d as DatePickerShowTime, e as DatePickerType, f as DatePickerValue, g as DateRangePickerPreset, h as DateRangePickerProps, S as SelectDateRange, i as SelectDateRangeProps, j as SelectDateRangeValue } from './select-date-range-Bdb-hi9c.js';
7
7
  export { RichTextContent, RichTextContentFormat, RichTextContentProps, RichTextEditor, RichTextEditorProps, RichTextImagePasteHandler, RichTextToolbar } from './rich-text-editor.js';
@@ -1365,4 +1365,56 @@ interface InputSelectProps {
1365
1365
  }
1366
1366
  declare const InputSelect: react.ForwardRefExoticComponent<InputSelectProps & react.RefAttributes<HTMLInputElement>>;
1367
1367
 
1368
- export { Alert, type AlertProps, type AlertStatus, type AnyTablePlugin, ButtonProps, Cascader, type CascaderFieldNames, type CascaderOption, type CascaderProps, type CascaderValue, Checkbox, type CheckboxGroupProps, type CheckboxOption, type CheckboxProps, type CheckboxValue, Col, type ColProps, type ColSize, ColorPicker, type ColorPickerMode, type ColorPickerPreset, type ColorPickerProps, ControlSize, ControlStatus, DEFAULT_PAGE_SIZE_OPTIONS, Divider, type DividerProps, Drawer, type DrawerOpenConfig, type DrawerPlacement, type DrawerProps, type DrawerPush, type DrawerPushConfig, Editor, type EditorCommand, type EditorCompletionContext, type EditorCompletionItem, type EditorCompletionItemKind, type EditorCompletionProvider, type EditorContextMenuItem, type EditorHandle, type EditorKeyDownEvent, type EditorLanguage, type EditorMarker, type EditorProps, type EditorRange, type EditorSelectionChange, type EditorTheme, type FlatTreeNode, type FlatTreeOptions, Flex, type FlexProps, FloatingScrollbarProvider, type FloatingScrollbarProviderProps, Form, type FormErrorField, type FormInstance, type FormItemProps, type FormListField, type FormListOperation, type FormListProps, type FormProps, type FormRule, type FormValues, type GridBreakpoint, InputNumber, type InputNumberProps, InputPlaceholderMode, InputSelect, type InputSelectProps, type LayoutGap, Markdown, type MarkdownProps, type NamePath, OverlayApiHandle, Pagination, type PaginationProps, Radio, type RadioGroupProps, type RadioOption, type RadioProps, type RadioValue, Row, type RowProps, SIA_THEME, type SelectionOption, SelectionPanel, type SelectionPanelProps, type SelectionValue, type SiaThemeMode, Slider, type SliderMark, type SliderProps, type SliderValue, Space, type SpaceCompactProps, type SpaceProps, Splitter, type SplitterPanelProps, type SplitterProps, Switch, type SwitchProps, type SwitchVariant, Table, type TableAlign, type TableCellAddress, type TableCellRange, type TableCellRenderInfo, type TableCellSelectionApi, type TableCellSelectionPluginOptions, type TableColumn, type TableColumnSettingApi, type TableColumnSettingItem, type TableColumnSettingPluginOptions, type TableColumnTransformPluginOptions, type TableEditableApi, type TableEditableCellConfig, type TableEditableCellType, type TableEditablePluginOptions, type TableExportApi, type TableExportPluginOptions, type TableExportScope, type TableFilterApi, type TableFilterPluginOptions, type TableFilterValues, type TableFixed, type TableHighlightPluginOptions, type TableHighlightValue, type TableIndexPluginOptions, type TableKey, type TableMergeStickyConfig, type TablePageParams, type TablePaginationApi, type TablePaginationPluginOptions, type TablePlugin, type TablePluginCellProps, type TablePluginContext, type TablePluginEvent, type TableProps, type TableRef, type TableResizeApi, type TableResizePluginOptions, type TableRow, type TableRowSpanPluginOptions, type TableSelectedCell, type TableSelectionApi, type TableSelectionMode, type TableSelectionPluginOptions, type TableSettingsAdapter, type TableSettingsSnapshot, type TableSize, type TableSortApi, type TableSortInfo, type TableSortPluginOptions, type TableSummaryPluginOptions, type TableSummaryRow, type TableToolbarItem, type TableToolbarPluginOptions, type TableTreeApi, type TableTreePluginOptions, TextArea, type TextAreaProps, ThemeSwitch, type ThemeSwitchProps, TimePicker, type TimePickerProps, type TimeRangePickerProps, ToolPanel, type ToolPanelItem, type ToolPanelPlacement, type ToolPanelProps, TreeSelect, type TreeSelectNode, type TreeSelectProps, type TreeSelectValue, Treemap, type TreemapNode, type TreemapNodeClickInfo, type TreemapNodeKind, type TreemapProps, type WindowAction, type WindowActionHandler, type WindowControlAction, type WindowControlLabels, WindowControls, type WindowControlsProps, WindowFrame, type WindowFrameProps, WindowTitleBar, type WindowTitleBarActionsAlign, type WindowTitleBarProps, applySiaTheme, buildFlatTree, createCellSelectionPlugin, createColumnSettingPlugin, createColumnTransformPlugin, createEditablePlugin, createExportPlugin, createFilterPlugin, createHighlightPlugin, createIndexPlugin, createLocalStorageTableSettingsAdapter, createPaginationPlugin, createResizePlugin, createRowSpanPlugin, createSelectionPlugin, createSortPlugin, createSummaryPlugin, createToolbarPlugin, createTreePlugin, useForm };
1368
+ interface QueryFormField extends FormItemProps {
1369
+ key: string;
1370
+ /** 字段占用宽度,默认由 fieldWidth 控制;组合字段可指定更大的宽度。 */
1371
+ width?: number | string;
1372
+ }
1373
+ interface QueryFormShortcut<T extends FormValues = FormValues> {
1374
+ key: string;
1375
+ label: ReactNode;
1376
+ values: Partial<T>;
1377
+ disabled?: boolean;
1378
+ status?: TagStatus;
1379
+ /** 顶部快捷查询按钮尺寸,优先于 quickQuerySize。 */
1380
+ size?: ButtonSize;
1381
+ /** 该快捷查询对应的数据总量,由业务接口提供。 */
1382
+ count?: number;
1383
+ badgeProps?: Omit<BadgeProps, "children" | "count">;
1384
+ }
1385
+ interface QueryFormSearchInfo {
1386
+ source: "submit" | "reset" | "quick" | "saved";
1387
+ shortcutKey?: string;
1388
+ }
1389
+ interface QueryFormProps<T extends FormValues = FormValues> extends Omit<FormProps, "onFinish" | "children" | "onError"> {
1390
+ fields?: readonly QueryFormField[];
1391
+ /** 也可直接放入 Form.Item 或 Space.Compact,每个直接子项视为一个查询字段。 */
1392
+ children?: ReactNode;
1393
+ onSearch: (values: T, info: QueryFormSearchInfo) => void | Promise<void>;
1394
+ loading?: boolean;
1395
+ fieldWidth?: number | string;
1396
+ collapsible?: boolean;
1397
+ collapsed?: boolean;
1398
+ defaultCollapsed?: boolean;
1399
+ collapsedCount?: number;
1400
+ onCollapsedChange?: (collapsed: boolean) => void;
1401
+ quickQueries?: readonly QueryFormShortcut<T>[];
1402
+ quickQuerySize?: ButtonSize;
1403
+ savedQueries?: readonly QueryFormShortcut<T>[];
1404
+ shortcutsLoading?: boolean;
1405
+ onSaveQuery?: (query: {
1406
+ name: string;
1407
+ values: T;
1408
+ }) => void | Promise<void>;
1409
+ onRemoveQuery?: (query: QueryFormShortcut<T>) => void | Promise<void>;
1410
+ onError?: (error: unknown, operation: "search" | "save" | "remove") => void;
1411
+ searchText?: ReactNode;
1412
+ resetText?: ReactNode;
1413
+ saveText?: ReactNode;
1414
+ resetSearch?: boolean;
1415
+ actionsExtra?: ReactNode;
1416
+ }
1417
+ /** 可复用的业务查询表单;快捷查询的存储和结果数据由业务方管理。 */
1418
+ declare function QueryForm<T extends FormValues = FormValues>({ fields, children, form: providedForm, onSearch, loading, fieldWidth, collapsible, collapsed: controlledCollapsed, defaultCollapsed, collapsedCount, onCollapsedChange, quickQueries, quickQuerySize, savedQueries, shortcutsLoading, onSaveQuery, onRemoveQuery, onError, searchText, resetText, saveText, resetSearch, actionsExtra, disabled, className, placeholderMode, onValuesChange, onFinishFailed, ...formProps }: QueryFormProps<T>): react.JSX.Element;
1419
+
1420
+ export { Alert, type AlertProps, type AlertStatus, type AnyTablePlugin, BadgeProps, ButtonProps, ButtonSize, Cascader, type CascaderFieldNames, type CascaderOption, type CascaderProps, type CascaderValue, Checkbox, type CheckboxGroupProps, type CheckboxOption, type CheckboxProps, type CheckboxValue, Col, type ColProps, type ColSize, ColorPicker, type ColorPickerMode, type ColorPickerPreset, type ColorPickerProps, ControlSize, ControlStatus, DEFAULT_PAGE_SIZE_OPTIONS, Divider, type DividerProps, Drawer, type DrawerOpenConfig, type DrawerPlacement, type DrawerProps, type DrawerPush, type DrawerPushConfig, Editor, type EditorCommand, type EditorCompletionContext, type EditorCompletionItem, type EditorCompletionItemKind, type EditorCompletionProvider, type EditorContextMenuItem, type EditorHandle, type EditorKeyDownEvent, type EditorLanguage, type EditorMarker, type EditorProps, type EditorRange, type EditorSelectionChange, type EditorTheme, type FlatTreeNode, type FlatTreeOptions, Flex, type FlexProps, FloatingScrollbarProvider, type FloatingScrollbarProviderProps, Form, type FormErrorField, type FormInstance, type FormItemProps, type FormListField, type FormListOperation, type FormListProps, type FormProps, type FormRule, type FormValues, type GridBreakpoint, InputNumber, type InputNumberProps, InputPlaceholderMode, InputSelect, type InputSelectProps, type LayoutGap, Markdown, type MarkdownProps, type NamePath, OverlayApiHandle, Pagination, type PaginationProps, QueryForm, type QueryFormField, type QueryFormProps, type QueryFormSearchInfo, type QueryFormShortcut, Radio, type RadioGroupProps, type RadioOption, type RadioProps, type RadioValue, Row, type RowProps, SIA_THEME, type SelectionOption, SelectionPanel, type SelectionPanelProps, type SelectionValue, type SiaThemeMode, Slider, type SliderMark, type SliderProps, type SliderValue, Space, type SpaceCompactProps, type SpaceProps, Splitter, type SplitterPanelProps, type SplitterProps, Switch, type SwitchProps, type SwitchVariant, Table, type TableAlign, type TableCellAddress, type TableCellRange, type TableCellRenderInfo, type TableCellSelectionApi, type TableCellSelectionPluginOptions, type TableColumn, type TableColumnSettingApi, type TableColumnSettingItem, type TableColumnSettingPluginOptions, type TableColumnTransformPluginOptions, type TableEditableApi, type TableEditableCellConfig, type TableEditableCellType, type TableEditablePluginOptions, type TableExportApi, type TableExportPluginOptions, type TableExportScope, type TableFilterApi, type TableFilterPluginOptions, type TableFilterValues, type TableFixed, type TableHighlightPluginOptions, type TableHighlightValue, type TableIndexPluginOptions, type TableKey, type TableMergeStickyConfig, type TablePageParams, type TablePaginationApi, type TablePaginationPluginOptions, type TablePlugin, type TablePluginCellProps, type TablePluginContext, type TablePluginEvent, type TableProps, type TableRef, type TableResizeApi, type TableResizePluginOptions, type TableRow, type TableRowSpanPluginOptions, type TableSelectedCell, type TableSelectionApi, type TableSelectionMode, type TableSelectionPluginOptions, type TableSettingsAdapter, type TableSettingsSnapshot, type TableSize, type TableSortApi, type TableSortInfo, type TableSortPluginOptions, type TableSummaryPluginOptions, type TableSummaryRow, type TableToolbarItem, type TableToolbarPluginOptions, type TableTreeApi, type TableTreePluginOptions, TagStatus, TextArea, type TextAreaProps, ThemeSwitch, type ThemeSwitchProps, TimePicker, type TimePickerProps, type TimeRangePickerProps, ToolPanel, type ToolPanelItem, type ToolPanelPlacement, type ToolPanelProps, TreeSelect, type TreeSelectNode, type TreeSelectProps, type TreeSelectValue, Treemap, type TreemapNode, type TreemapNodeClickInfo, type TreemapNodeKind, type TreemapProps, type WindowAction, type WindowActionHandler, type WindowControlAction, type WindowControlLabels, WindowControls, type WindowControlsProps, WindowFrame, type WindowFrameProps, WindowTitleBar, type WindowTitleBarActionsAlign, type WindowTitleBarProps, applySiaTheme, buildFlatTree, createCellSelectionPlugin, createColumnSettingPlugin, createColumnTransformPlugin, createEditablePlugin, createExportPlugin, createFilterPlugin, createHighlightPlugin, createIndexPlugin, createLocalStorageTableSettingsAdapter, createPaginationPlugin, createResizePlugin, createRowSpanPlugin, createSelectionPlugin, createSortPlugin, createSummaryPlugin, createToolbarPlugin, createTreePlugin, useForm };
package/dist/index.js CHANGED
@@ -79,7 +79,7 @@ import {
79
79
  Watermark,
80
80
  message,
81
81
  notification
82
- } from "./chunk-K3XRTEIO.js";
82
+ } from "./chunk-E7F47Z2C.js";
83
83
  import {
84
84
  TextArea
85
85
  } from "./chunk-YT6E3X2K.js";
@@ -7547,6 +7547,293 @@ var InputSelect = forwardRef7(function InputSelect2({
7547
7547
  )
7548
7548
  ] });
7549
7549
  });
7550
+
7551
+ // src/components/QueryForm.tsx
7552
+ import { Children as Children4, useLayoutEffect as useLayoutEffect3, useRef as useRef17, useState as useState19 } from "react";
7553
+ import { jsx as jsx24, jsxs as jsxs23 } from "react/jsx-runtime";
7554
+ function QueryForm({
7555
+ fields,
7556
+ children,
7557
+ form: providedForm,
7558
+ onSearch,
7559
+ loading = false,
7560
+ fieldWidth = 220,
7561
+ collapsible = true,
7562
+ collapsed: controlledCollapsed,
7563
+ defaultCollapsed = false,
7564
+ collapsedCount = 3,
7565
+ onCollapsedChange,
7566
+ quickQueries = [],
7567
+ quickQuerySize = "small",
7568
+ savedQueries = [],
7569
+ shortcutsLoading = false,
7570
+ onSaveQuery,
7571
+ onRemoveQuery,
7572
+ onError,
7573
+ searchText = "\u67E5\u8BE2",
7574
+ resetText = "\u91CD\u7F6E",
7575
+ saveText = "\u53E6\u5B58\u4E3A\u5FEB\u6377\u67E5\u8BE2",
7576
+ resetSearch = true,
7577
+ actionsExtra,
7578
+ disabled = false,
7579
+ className = "",
7580
+ placeholderMode = "floating",
7581
+ onValuesChange,
7582
+ onFinishFailed,
7583
+ ...formProps
7584
+ }) {
7585
+ const [form] = useForm(providedForm);
7586
+ const [internalCollapsed, setInternalCollapsed] = useState19(defaultCollapsed);
7587
+ const collapsed = collapsible && (controlledCollapsed ?? internalCollapsed);
7588
+ const [searching, setSearching] = useState19(false);
7589
+ const [saving, setSaving] = useState19(false);
7590
+ const [removing, setRemoving] = useState19(false);
7591
+ const [saveOpen, setSaveOpen] = useState19(false);
7592
+ const [saveName, setSaveName] = useState19("");
7593
+ const [saveError, setSaveError] = useState19("");
7594
+ const [error, setError] = useState19("");
7595
+ const [activeShortcut, setActiveShortcut] = useState19("");
7596
+ const source = useRef17({ source: "submit" });
7597
+ const searchLock = useRef17(false);
7598
+ const saveLock = useRef17(false);
7599
+ const removeLock = useRef17(false);
7600
+ const snapshot = useRef17();
7601
+ const busy = disabled || loading || searching;
7602
+ const shortcutBusy = busy || shortcutsLoading || saving || removing;
7603
+ const entries = fields ? fields.map(({ key, width, ...item }) => ({ key, width, content: /* @__PURE__ */ jsx24(Form.Item, { noStyle: true, ...item }) })) : Children4.toArray(children).map((content, index) => ({ key: String(index), width: void 0, content }));
7604
+ const limit = Math.max(1, Math.floor(collapsedCount));
7605
+ const rowRef = useRef17(null);
7606
+ const actionsRef = useRef17(null);
7607
+ const [fittingCount, setFittingCount] = useState19(limit);
7608
+ useLayoutEffect3(() => {
7609
+ if (!collapsed) return;
7610
+ const row = rowRef.current;
7611
+ const actions = actionsRef.current;
7612
+ if (!row || !actions) return;
7613
+ function measure() {
7614
+ if (!row || !actions) return;
7615
+ const gap = parseFloat(getComputedStyle(row).columnGap) || 0;
7616
+ let remaining = row.clientWidth - actions.getBoundingClientRect().width;
7617
+ let count = 0;
7618
+ for (const field of Array.from(row.querySelectorAll(":scope > .sia-query-form__field")).slice(0, limit)) {
7619
+ const width = parseFloat(getComputedStyle(field).width) || 220;
7620
+ if (remaining + 0.5 < width + gap) break;
7621
+ remaining -= width + gap;
7622
+ count++;
7623
+ }
7624
+ setFittingCount(count);
7625
+ }
7626
+ measure();
7627
+ const observer = new ResizeObserver(measure);
7628
+ observer.observe(row);
7629
+ observer.observe(actions);
7630
+ row.querySelectorAll(":scope > .sia-query-form__field").forEach((field) => observer.observe(field));
7631
+ return () => observer.disconnect();
7632
+ }, [collapsed, limit, fieldWidth, fields, children]);
7633
+ async function search(values) {
7634
+ const info = source.current;
7635
+ source.current = { source: "submit" };
7636
+ if (searchLock.current || disabled || loading) return;
7637
+ searchLock.current = true;
7638
+ setSearching(true);
7639
+ setError("");
7640
+ try {
7641
+ await onSearch(values, info);
7642
+ } catch (reason) {
7643
+ setError(reason instanceof Error ? reason.message : "\u67E5\u8BE2\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5");
7644
+ onError?.(reason, "search");
7645
+ } finally {
7646
+ searchLock.current = false;
7647
+ setSearching(false);
7648
+ }
7649
+ }
7650
+ function applyShortcut(query, kind) {
7651
+ if (shortcutBusy || query.disabled) return;
7652
+ form.resetFields();
7653
+ form.setFieldsValue(query.values);
7654
+ source.current = { source: kind, shortcutKey: query.key };
7655
+ setActiveShortcut(`${kind}:${query.key}`);
7656
+ form.submit();
7657
+ }
7658
+ function reset() {
7659
+ if (busy) return;
7660
+ form.resetFields();
7661
+ setActiveShortcut("");
7662
+ setError("");
7663
+ if (resetSearch) {
7664
+ source.current = { source: "reset" };
7665
+ form.submit();
7666
+ }
7667
+ }
7668
+ async function save() {
7669
+ if (!onSaveQuery || saveLock.current) return false;
7670
+ const name = saveName.trim();
7671
+ if (!name) {
7672
+ setSaveError("\u8BF7\u8F93\u5165\u5FEB\u6377\u67E5\u8BE2\u540D\u79F0");
7673
+ return false;
7674
+ }
7675
+ if (!snapshot.current) return false;
7676
+ saveLock.current = true;
7677
+ setSaving(true);
7678
+ setSaveError("");
7679
+ try {
7680
+ await onSaveQuery({ name, values: snapshot.current });
7681
+ setSaveOpen(false);
7682
+ } catch (reason) {
7683
+ setSaveError(reason instanceof Error ? reason.message : "\u4FDD\u5B58\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5");
7684
+ onError?.(reason, "save");
7685
+ return false;
7686
+ } finally {
7687
+ saveLock.current = false;
7688
+ setSaving(false);
7689
+ }
7690
+ }
7691
+ async function remove(query) {
7692
+ if (!onRemoveQuery || shortcutBusy || removeLock.current) return;
7693
+ removeLock.current = true;
7694
+ setRemoving(true);
7695
+ setError("");
7696
+ try {
7697
+ await onRemoveQuery(query);
7698
+ if (activeShortcut === `saved:${query.key}`) setActiveShortcut("");
7699
+ } catch (reason) {
7700
+ setError(reason instanceof Error ? reason.message : "\u5220\u9664\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5");
7701
+ onError?.(reason, "remove");
7702
+ } finally {
7703
+ removeLock.current = false;
7704
+ setRemoving(false);
7705
+ }
7706
+ }
7707
+ return /* @__PURE__ */ jsxs23("div", { className: `sia-query-form ${className}`.trim(), children: [
7708
+ /* @__PURE__ */ jsxs23(
7709
+ Form,
7710
+ {
7711
+ ...formProps,
7712
+ form,
7713
+ placeholderMode,
7714
+ disabled,
7715
+ onFinish: (values) => {
7716
+ void search(values);
7717
+ },
7718
+ onFinishFailed: (info) => {
7719
+ source.current = { source: "submit" };
7720
+ onFinishFailed?.(info);
7721
+ },
7722
+ onValuesChange: (changed, values) => {
7723
+ setActiveShortcut("");
7724
+ onValuesChange?.(changed, values);
7725
+ },
7726
+ children: [
7727
+ quickQueries.length ? /* @__PURE__ */ jsxs23("div", { className: "sia-query-form__quick", "aria-label": "\u9884\u8BBE\u5FEB\u6377\u67E5\u8BE2", children: [
7728
+ quickQueries.map((query) => /* @__PURE__ */ jsx24(Badge, { className: "sia-query-form__quick-badge", showZero: true, size: "small", title: query.count === void 0 ? void 0 : `\u5171 ${query.count} \u6761`, ...query.badgeProps, count: query.count, children: /* @__PURE__ */ jsx24(
7729
+ Button,
7730
+ {
7731
+ size: query.size ?? quickQuerySize,
7732
+ "aria-pressed": activeShortcut === `quick:${query.key}`,
7733
+ variant: activeShortcut === `quick:${query.key}` ? "primary" : "default",
7734
+ disabled: shortcutBusy || query.disabled,
7735
+ onClick: () => applyShortcut(query, "quick"),
7736
+ children: query.label
7737
+ }
7738
+ ) }, query.key)),
7739
+ " "
7740
+ ] }) : null,
7741
+ /* @__PURE__ */ jsxs23("div", { ref: rowRef, className: `sia-query-form__fields${collapsed ? " is-collapsed" : ""}`, style: { "--sia-query-field-width": typeof fieldWidth === "number" ? `${fieldWidth}px` : fieldWidth }, children: [
7742
+ entries.map((entry, index) => /* @__PURE__ */ jsx24(
7743
+ "div",
7744
+ {
7745
+ className: "sia-query-form__field",
7746
+ hidden: collapsed && index >= Math.min(limit, fittingCount),
7747
+ style: entry.width !== void 0 ? { flexBasis: entry.width, width: entry.width } : void 0,
7748
+ children: entry.content
7749
+ },
7750
+ entry.key
7751
+ )),
7752
+ /* @__PURE__ */ jsxs23("div", { ref: actionsRef, className: "sia-query-form__actions", children: [
7753
+ /* @__PURE__ */ jsxs23(Space.Compact, { children: [
7754
+ /* @__PURE__ */ jsx24(Button, { type: "submit", variant: "primary", loading: loading || searching, disabled, children: searchText }),
7755
+ /* @__PURE__ */ jsx24(Button, { disabled: busy, onClick: reset, children: resetText }),
7756
+ onSaveQuery ? /* @__PURE__ */ jsx24(Button, { disabled: shortcutBusy, onClick: () => {
7757
+ snapshot.current = form.getFieldsValue();
7758
+ setSaveName("");
7759
+ setSaveError("");
7760
+ setSaveOpen(true);
7761
+ }, children: saveText }) : null
7762
+ ] }),
7763
+ collapsible && entries.length > 0 ? /* @__PURE__ */ jsx24(
7764
+ Button,
7765
+ {
7766
+ variant: "link",
7767
+ "aria-expanded": !collapsed,
7768
+ icon: /* @__PURE__ */ jsx24(Icon, { name: collapsed ? "chevron-down" : "chevron-up" }),
7769
+ iconPosition: "end",
7770
+ onClick: () => {
7771
+ setInternalCollapsed(!collapsed);
7772
+ onCollapsedChange?.(!collapsed);
7773
+ },
7774
+ children: collapsed ? "\u5C55\u5F00" : "\u6536\u8D77"
7775
+ }
7776
+ ) : null,
7777
+ actionsExtra
7778
+ ] })
7779
+ ] }),
7780
+ savedQueries.length && !collapsed ? /* @__PURE__ */ jsxs23("div", { className: "sia-query-form__saved", "aria-label": "\u5DF2\u4FDD\u5B58\u5FEB\u6377\u67E5\u8BE2", children: [
7781
+ savedQueries.map((query, index) => /* @__PURE__ */ jsx24(
7782
+ Tag,
7783
+ {
7784
+ status: query.status ?? ["processing", "success", "warning", "error"][index % 4],
7785
+ variant: "soft",
7786
+ disabled: shortcutBusy || query.disabled,
7787
+ tabIndex: shortcutBusy || query.disabled ? -1 : 0,
7788
+ className: activeShortcut === `saved:${query.key}` ? "is-active" : "",
7789
+ closable: Boolean(onRemoveQuery),
7790
+ closeOnHover: true,
7791
+ onClose: () => {
7792
+ void remove(query);
7793
+ },
7794
+ onClick: () => applyShortcut(query, "saved"),
7795
+ onKeyDown: (event) => {
7796
+ if (event.target === event.currentTarget && (event.key === "Enter" || event.key === " ")) {
7797
+ event.preventDefault();
7798
+ applyShortcut(query, "saved");
7799
+ }
7800
+ },
7801
+ children: query.label
7802
+ },
7803
+ query.key
7804
+ )),
7805
+ " "
7806
+ ] }) : null,
7807
+ error ? /* @__PURE__ */ jsx24("p", { className: "sia-query-form__error", role: "alert", children: error }) : null
7808
+ ]
7809
+ }
7810
+ ),
7811
+ /* @__PURE__ */ jsxs23(Modal, { open: saveOpen, title: "\u53E6\u5B58\u4E3A\u5FEB\u6377\u67E5\u8BE2", width: 420, confirmLoading: saving, onOk: save, onOpenChange: (next) => {
7812
+ if (!saveLock.current) setSaveOpen(next);
7813
+ }, children: [
7814
+ /* @__PURE__ */ jsx24(
7815
+ Input,
7816
+ {
7817
+ autoFocus: true,
7818
+ "aria-label": "\u5FEB\u6377\u67E5\u8BE2\u540D\u79F0",
7819
+ placeholder: "\u5FEB\u6377\u67E5\u8BE2\u540D\u79F0",
7820
+ value: saveName,
7821
+ maxLength: 80,
7822
+ disabled: saving,
7823
+ status: saveError ? "error" : "default",
7824
+ onChange: (event) => setSaveName(event.target.value),
7825
+ onKeyDown: (event) => {
7826
+ if (event.key === "Enter") {
7827
+ event.preventDefault();
7828
+ void save();
7829
+ }
7830
+ }
7831
+ }
7832
+ ),
7833
+ saveError ? /* @__PURE__ */ jsx24("p", { className: "sia-query-form__error", role: "alert", children: saveError }) : null
7834
+ ] })
7835
+ ] });
7836
+ }
7550
7837
  export {
7551
7838
  Alert,
7552
7839
  Badge,
@@ -7619,6 +7906,7 @@ export {
7619
7906
  Popconfirm,
7620
7907
  Popover,
7621
7908
  Progress,
7909
+ QueryForm,
7622
7910
  RadarChart,
7623
7911
  Radio2 as Radio,
7624
7912
  Rate,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sia.soul/sia-react-ui",
3
- "version": "0.1.14",
3
+ "version": "0.1.15",
4
4
  "description": "Sia Design components and tokens for React",
5
5
  "publishConfig": {
6
6
  "access": "public",