hys-ui 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +68 -73
  3. package/dist/components/HysAnimatedNumber/HysAnimatedNumber.vue.js +5 -41
  4. package/dist/components/HysAnimatedNumber/HysAnimatedNumber2.vue.js +146 -2
  5. package/dist/components/HysButton/HysButton.vue.js +2 -2
  6. package/dist/components/HysButton/HysButton2.vue.js +227 -60
  7. package/dist/components/HysButtonGroup/HysButtonGroup.vue.js +7 -0
  8. package/dist/components/HysButtonGroup/HysButtonGroup2.vue.js +51 -0
  9. package/dist/components/HysMention/HysMention.vue.js +1 -1
  10. package/dist/components/HysMention/HysMention2.vue.js +1092 -154
  11. package/dist/components/HysModal/HysModal.vue.js +3 -3
  12. package/dist/components/HysModal/HysModal2.vue.js +81 -80
  13. package/dist/components/HysPagination/HysPagination.vue.js +2 -2
  14. package/dist/components/HysPagination/HysPagination2.vue.js +243 -180
  15. package/dist/components/HysSearch/HysSearch.vue.js +5 -82
  16. package/dist/components/HysSearch/HysSearch2.vue.js +176 -2
  17. package/dist/components/HysSelect/HysSelect.vue.js +2 -2
  18. package/dist/components/HysSelect/HysSelect2.vue.js +472 -443
  19. package/dist/components/HysSplitPane/HysSplitPane.vue.js +315 -58
  20. package/dist/components/HysSplitPane/HysSplitPane3.vue.js +5 -0
  21. package/dist/components/HysTable/HysTable.vue.js +2 -2
  22. package/dist/components/HysTable/HysTable2.vue.js +1418 -1150
  23. package/dist/components/HysTour/HysTour.vue.js +291 -67
  24. package/dist/components/HysTour/HysTour3.vue.js +5 -0
  25. package/dist/composables/buttonGroup.js +12 -0
  26. package/dist/composables/floatingPosition.js +18 -0
  27. package/dist/composables/mentionDocument.js +79 -0
  28. package/dist/composables/mentionEditor.js +58 -0
  29. package/dist/composables/selectOptions.js +44 -38
  30. package/dist/composables/splitPaneSizes.js +58 -0
  31. package/dist/composables/table.js +128 -105
  32. package/dist/composables/useDialog.js +50 -50
  33. package/dist/composables/useFloating.js +107 -103
  34. package/dist/composables/useMentionCaret.js +81 -0
  35. package/dist/composables/useMentionList.js +81 -0
  36. package/dist/composables/useMentionModel.js +90 -0
  37. package/dist/composables/useMentionOptions.js +421 -0
  38. package/dist/composables/useSplitPaneDrag.js +52 -0
  39. package/dist/composables/useSplitPaneStorage.js +38 -0
  40. package/dist/composables/useTable.js +344 -312
  41. package/dist/composables/useTableSticky.js +79 -0
  42. package/dist/composables/useTourLayout.js +129 -0
  43. package/dist/config.js +11 -11
  44. package/dist/index.js +175 -156
  45. package/dist/internal/MultiSplitPane.vue.js +305 -0
  46. package/dist/internal/MultiSplitPane2.vue.js +4 -0
  47. package/dist/style.css +1 -1
  48. package/dist/types/components/HysAnimatedNumber/HysAnimatedNumber.vue.d.ts +61 -7
  49. package/dist/types/components/HysAutocomplete/HysAutocomplete.vue.d.ts +1 -1
  50. package/dist/types/components/HysButton/HysButton.vue.d.ts +82 -22
  51. package/dist/types/components/HysButtonGroup/HysButtonGroup.vue.d.ts +30 -0
  52. package/dist/types/components/HysCascader/HysCascaderColumn.vue.d.ts +2 -2
  53. package/dist/types/components/HysColorPicker/HysColorPicker.vue.d.ts +2 -2
  54. package/dist/types/components/HysContextMenu/HysMenuPanel.vue.d.ts +2 -2
  55. package/dist/types/components/HysDatePicker/HysDatePickerControl.vue.d.ts +2 -2
  56. package/dist/types/components/HysDrawer/HysDrawer.vue.d.ts +1 -1
  57. package/dist/types/components/HysMention/HysMention.vue.d.ts +91 -40
  58. package/dist/types/components/HysModal/HysModal.vue.d.ts +1 -1
  59. package/dist/types/components/HysNumberInput/HysNumberInput.vue.d.ts +2 -2
  60. package/dist/types/components/HysPagination/HysPagination.vue.d.ts +55 -4
  61. package/dist/types/components/HysRating/HysRating.vue.d.ts +1 -1
  62. package/dist/types/components/HysSearch/HysSearch.vue.d.ts +45 -7
  63. package/dist/types/components/HysSelect/HysSelect.vue.d.ts +6 -1
  64. package/dist/types/components/HysSplitPane/HysSplitPane.vue.d.ts +125 -14
  65. package/dist/types/components/HysSteps/HysSteps.vue.d.ts +1 -1
  66. package/dist/types/components/HysTable/HysTable.vue.d.ts +1740 -3
  67. package/dist/types/components/HysTour/HysTour.vue.d.ts +46 -9
  68. package/dist/types/composables/buttonGroup.d.ts +9 -0
  69. package/dist/types/composables/floatingPosition.d.ts +14 -0
  70. package/dist/types/composables/mention.d.ts +284 -0
  71. package/dist/types/composables/mentionDocument.d.ts +15 -0
  72. package/dist/types/composables/mentionEditor.d.ts +7 -0
  73. package/dist/types/composables/modal.d.ts +2 -0
  74. package/dist/types/composables/selectOptions.d.ts +5 -0
  75. package/dist/types/composables/splitPaneSizes.d.ts +11 -0
  76. package/dist/types/composables/table.d.ts +116 -6
  77. package/dist/types/composables/tour.d.ts +68 -0
  78. package/dist/types/composables/useFloating.d.ts +1 -1
  79. package/dist/types/composables/useMentionCaret.d.ts +6 -0
  80. package/dist/types/composables/useMentionList.d.ts +23 -0
  81. package/dist/types/composables/useMentionModel.d.ts +14 -0
  82. package/dist/types/composables/useMentionOptions.d.ts +26 -0
  83. package/dist/types/composables/useSplitPaneDrag.d.ts +14 -0
  84. package/dist/types/composables/useSplitPaneStorage.d.ts +4 -0
  85. package/dist/types/composables/useTable.d.ts +7 -3
  86. package/dist/types/composables/useTableSticky.d.ts +22 -0
  87. package/dist/types/composables/useTourLayout.d.ts +33 -0
  88. package/dist/types/config.d.ts +1 -0
  89. package/dist/types/index.d.ts +36 -1
  90. package/dist/types/internal/MultiSplitPane.vue.d.ts +54 -0
  91. package/package.json +3 -2
  92. package/dist/components/HysSplitPane/HysSplitPane2.vue.js +0 -4
  93. package/dist/components/HysTour/HysTour2.vue.js +0 -4
@@ -1,32 +1,70 @@
1
- type __VLS_Props = {
2
- modelValue: string;
1
+ import { type InputHTMLAttributes, type VNodeChild } from "vue";
2
+ export interface HysSearchProps {
3
+ modelValue?: string;
4
+ defaultValue?: string;
3
5
  placeholder?: string;
6
+ /** 输入触发模式的等待时间,单位为毫秒。 */
4
7
  delay?: number;
8
+ /** 输入时防抖搜索,或只在确认时搜索。 */
9
+ trigger?: "input" | "submit";
10
+ /** 显示搜索按钮,可传按钮文案。 */
11
+ enterButton?: boolean | string;
12
+ /** 清空后立即搜索。省略时跟随触发模式。 */
13
+ searchOnClear?: boolean;
5
14
  disabled?: boolean;
6
15
  readonly?: boolean;
7
16
  clearable?: boolean;
8
17
  loading?: boolean;
9
18
  ariaLabel?: string;
19
+ searchLabel?: string;
20
+ size?: "sm" | "md" | "lg";
21
+ inputProps?: InputHTMLAttributes;
22
+ }
23
+ export interface HysSearchButtonContext {
24
+ search: (event?: Event) => void;
25
+ disabled: boolean;
26
+ loading: boolean;
27
+ }
28
+ type __VLS_Slots = {
29
+ prefix?: () => VNodeChild;
30
+ suffix?: () => VNodeChild;
31
+ "clear-icon"?: () => VNodeChild;
32
+ "search-button"?: (context: HysSearchButtonContext) => VNodeChild;
10
33
  };
11
- declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
12
- focus: () => void | undefined;
34
+ declare function submit(event?: Event): void;
35
+ declare const __VLS_base: import("vue").DefineComponent<HysSearchProps, {
36
+ input: import("vue").Ref<HTMLInputElement | undefined, HTMLInputElement | undefined>;
37
+ search: typeof submit;
38
+ clear: () => Promise<void>;
39
+ focus: (options?: FocusOptions) => void | undefined;
13
40
  blur: () => void | undefined;
41
+ select: () => void | undefined;
14
42
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
15
43
  "update:modelValue": (value: string) => any;
16
- search: (value: string) => any;
44
+ search: (value: string, event?: Event | undefined) => any;
17
45
  clear: () => any;
18
46
  blur: (event: FocusEvent) => any;
19
47
  focus: (event: FocusEvent) => any;
20
- }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
48
+ }, string, import("vue").PublicProps, Readonly<HysSearchProps> & Readonly<{
21
49
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
22
- onSearch?: ((value: string) => any) | undefined;
50
+ onSearch?: ((value: string, event?: Event | undefined) => any) | undefined;
23
51
  onClear?: (() => any) | undefined;
24
52
  onBlur?: ((event: FocusEvent) => any) | undefined;
25
53
  onFocus?: ((event: FocusEvent) => any) | undefined;
26
54
  }>, {
55
+ trigger: "input" | "submit";
27
56
  placeholder: string;
57
+ defaultValue: string;
28
58
  clearable: boolean;
29
59
  delay: number;
60
+ searchOnClear: boolean;
61
+ searchLabel: string;
30
62
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
63
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
31
64
  declare const _default: typeof __VLS_export;
32
65
  export default _default;
66
+ type __VLS_WithSlots<T, S> = T & {
67
+ new (): {
68
+ $slots: S;
69
+ };
70
+ };
@@ -21,7 +21,10 @@ declare const __VLS_export: <T extends HysSelectModelValue = string>(__VLS_props
21
21
  filterable?: boolean;
22
22
  clearable?: boolean;
23
23
  emptyValues?: readonly unknown[];
24
- clearValue?: HysSelectValue | null;
24
+ /** 单选清空后的值,也可由函数计算。 */
25
+ clearValue?: HysSelectValue | null | (() => HysSelectValue | null);
26
+ /** 模型以 { value, label } 保存选中项,可在远程选项尚未加载时回显。 */
27
+ labelInValue?: boolean;
25
28
  fallbackOption?: false | ((value: HysSelectValue) => HysSelectOption);
26
29
  multipleLimit?: number;
27
30
  maxTagCount?: number;
@@ -44,6 +47,8 @@ declare const __VLS_export: <T extends HysSelectModelValue = string>(__VLS_props
44
47
  showOnFocus?: boolean;
45
48
  retainSearch?: boolean;
46
49
  defaultActiveFirst?: boolean;
50
+ /** 无已选项时优先高亮的可选值。 */
51
+ firstActiveValue?: HysSelectValue;
47
52
  keyboard?: boolean;
48
53
  popupMatchWidth?: boolean;
49
54
  popupWidth?: number | string;
@@ -1,33 +1,144 @@
1
- type __VLS_Props = {
1
+ export type HysSplitPaneSide = "first" | "second";
2
+ export type HysSplitPaneLength = number | `${number}px` | `${number}%`;
3
+ export interface HysSplitPanePanelOptions {
4
+ /** Panel minimum size. Numbers are pixels; strings accept px and %. */
5
+ min?: HysSplitPaneLength;
6
+ /** Panel maximum size. Numbers are pixels; strings accept px and %. */
7
+ max?: HysSplitPaneLength;
8
+ resizable?: boolean;
9
+ collapsible?: boolean;
10
+ }
11
+ export interface HysSplitPanePanel extends HysSplitPanePanelOptions {
12
+ id: string;
13
+ label?: string;
14
+ /** 初始尺寸。省略时自动分配剩余空间。 */
15
+ size?: HysSplitPaneLength;
16
+ }
17
+ export type HysSplitPaneSizes = Readonly<Record<string, HysSplitPaneLength | undefined>>;
18
+ export interface HysSplitPanePanelResize {
19
+ separator: number;
20
+ before: string;
21
+ after: string;
22
+ /** 每个面板当前或预览的像素尺寸。 */
23
+ sizes: Record<string, number>;
24
+ }
25
+ export interface HysSplitPanePanelResizeEnd extends HysSplitPanePanelResize {
26
+ cancelled: boolean;
27
+ }
28
+ export interface HysSplitPaneHandleContext {
29
+ separator: number;
30
+ before: string;
31
+ after: string;
32
+ vertical: boolean;
33
+ disabled: boolean;
34
+ resizing: boolean;
35
+ }
36
+ export interface HysSplitPaneProps {
37
+ /** 第一块面板占可用空间的百分比,支持 v-model。 */
2
38
  modelValue?: number;
39
+ /** 非受控初始比例,数字为百分比。 */
40
+ defaultValue?: number;
41
+ /** 兼容比例下限,firstPanel.min 优先。 */
3
42
  min?: number;
43
+ /** 兼容比例上限,firstPanel.max 优先。 */
4
44
  max?: number;
5
45
  vertical?: boolean;
46
+ /** 布局方向,指定时优先于 vertical。 */
47
+ layout?: "horizontal" | "vertical";
6
48
  disabled?: boolean;
49
+ /** 键盘调整的百分比步长。 */
7
50
  step?: number;
51
+ /** 拖动时移动预览线,释放后才提交 v-model。 */
52
+ lazy?: boolean;
53
+ firstPanel?: HysSplitPanePanelOptions;
54
+ secondPanel?: HysSplitPanePanelOptions;
55
+ /** 按顺序渲染的面板配置,每项以唯一 id 标识。 */
56
+ panels?: readonly HysSplitPanePanel[];
57
+ /** 多面板受控尺寸,支持 v-model:sizes。 */
58
+ sizes?: HysSplitPaneSizes;
59
+ /** 以浏览器本地存储记住非受控布局。 */
60
+ storageKey?: string;
61
+ /** 分隔条实际占用的宽度或高度,单位为像素。 */
62
+ dividerSize?: number;
63
+ /** 双击分隔条时折叠相邻面板、重置尺寸或保持原状。 */
64
+ doubleClickAction?: "none" | "collapse" | "reset";
65
+ ariaLabel?: string;
66
+ firstLabel?: string;
67
+ secondLabel?: string;
68
+ }
69
+ export interface HysSplitPaneSlotContext {
70
+ collapsed: boolean;
71
+ toggle: () => Promise<boolean>;
72
+ }
73
+ export interface HysSplitPanePanelContext extends HysSplitPaneSlotContext {
74
+ panel: HysSplitPanePanel;
75
+ index: number;
76
+ size: number;
77
+ }
78
+ export interface HysSplitPaneResizeEnd {
79
+ cancelled: boolean;
80
+ }
81
+ export interface HysSplitPaneInstance {
82
+ togglePanel: (side: HysSplitPaneSide) => Promise<boolean>;
83
+ togglePane: (id: string, separator?: number) => Promise<boolean>;
84
+ resizePane: (id: string, value: HysSplitPaneLength, separator?: number) => Promise<boolean>;
85
+ getPanelSizes: () => Record<string, number>;
86
+ getPaneElement: (id: string) => HTMLElement | undefined;
87
+ resetSizes: () => Promise<boolean>;
88
+ }
89
+ type __VLS_Slots = {
90
+ first?: (context: HysSplitPaneSlotContext) => unknown;
91
+ second?: (context: HysSplitPaneSlotContext) => unknown;
92
+ "first-collapse"?: (context: HysSplitPaneSlotContext) => unknown;
93
+ "second-collapse"?: (context: HysSplitPaneSlotContext) => unknown;
94
+ panel?: (context: HysSplitPanePanelContext) => unknown;
95
+ "panel-collapse"?: (context: HysSplitPanePanelContext & {
96
+ side: "start" | "end";
97
+ }) => unknown;
98
+ /** 自定义抓手图标。分隔条保留键盘和指针行为。 */
99
+ handle?: (context: HysSplitPaneHandleContext) => unknown;
8
100
  };
9
- declare const __VLS_template: () => {
10
- __VLS_Slots: {
11
- first?: (props: {}) => any;
12
- } & {
13
- second?: (props: {}) => any;
101
+ declare function togglePanel(side: HysSplitPaneSide): Promise<boolean>;
102
+ declare function resetSizes(): Promise<boolean>;
103
+ declare const __VLS_base: import("vue").DefineComponent<HysSplitPaneProps, {
104
+ togglePanel: typeof togglePanel;
105
+ togglePane: (id: string, separator?: number) => Promise<boolean>;
106
+ getPanelSizes: () => {
107
+ [k: string]: number;
14
108
  };
15
- };
16
- type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
17
- declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
109
+ getPaneElement: (id: string) => HTMLElement | undefined;
110
+ resizePane: (id: string, value: HysSplitPaneLength, separator?: number) => Promise<boolean>;
111
+ resetSizes: typeof resetSizes;
112
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
18
113
  "update:modelValue": (value: number) => any;
19
- resizeEnd: (value: number) => any;
114
+ collapse: (side: HysSplitPaneSide, collapsed: boolean) => any;
115
+ resize: (value: number) => any;
116
+ resizeEnd: (value: number, details: HysSplitPaneResizeEnd) => any;
20
117
  resizeStart: () => any;
21
- }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
118
+ "update:sizes": (sizes: Readonly<Record<string, HysSplitPaneLength | undefined>>) => any;
119
+ panelResizeStart: (details: HysSplitPanePanelResize) => any;
120
+ panelResize: (details: HysSplitPanePanelResize) => any;
121
+ panelResizeEnd: (details: HysSplitPanePanelResizeEnd) => any;
122
+ panelCollapse: (id: string, collapsed: boolean) => any;
123
+ }, string, import("vue").PublicProps, Readonly<HysSplitPaneProps> & Readonly<{
22
124
  "onUpdate:modelValue"?: ((value: number) => any) | undefined;
23
- onResizeEnd?: ((value: number) => any) | undefined;
125
+ onCollapse?: ((side: HysSplitPaneSide, collapsed: boolean) => any) | undefined;
126
+ onResize?: ((value: number) => any) | undefined;
127
+ onResizeEnd?: ((value: number, details: HysSplitPaneResizeEnd) => any) | undefined;
24
128
  onResizeStart?: (() => any) | undefined;
129
+ "onUpdate:sizes"?: ((sizes: Readonly<Record<string, HysSplitPaneLength | undefined>>) => any) | undefined;
130
+ onPanelResizeStart?: ((details: HysSplitPanePanelResize) => any) | undefined;
131
+ onPanelResize?: ((details: HysSplitPanePanelResize) => any) | undefined;
132
+ onPanelResizeEnd?: ((details: HysSplitPanePanelResizeEnd) => any) | undefined;
133
+ onPanelCollapse?: ((id: string, collapsed: boolean) => any) | undefined;
25
134
  }>, {
26
- modelValue: number;
27
135
  max: number;
28
136
  min: number;
29
- vertical: boolean;
137
+ ariaLabel: string;
30
138
  step: number;
139
+ defaultValue: number;
140
+ firstLabel: string;
141
+ secondLabel: string;
31
142
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
32
143
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
33
144
  declare const _default: typeof __VLS_export;
@@ -62,9 +62,9 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {},
62
62
  }>, {
63
63
  size: "sm" | "md";
64
64
  status: HysStepStatus;
65
+ responsive: boolean;
65
66
  current: number;
66
67
  labelPlacement: "right" | "bottom";
67
- responsive: boolean;
68
68
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
69
69
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
70
70
  declare const _default: typeof __VLS_export;