@oneflowui/ui 0.1.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 (127) hide show
  1. package/README.md +161 -0
  2. package/dist/FieldCheckbox-B1eVag_x.js +30 -0
  3. package/dist/FieldDate-BCitHPQn.js +34 -0
  4. package/dist/FieldDatetime-BGeyZJl-.js +34 -0
  5. package/dist/FieldEmail-Ds8lTvNh.js +34 -0
  6. package/dist/FieldMultiSelect-_cY4aZuE.js +145 -0
  7. package/dist/FieldNumber-DayaF31C.js +43 -0
  8. package/dist/FieldRating-Dw9rvhUe.js +32 -0
  9. package/dist/FieldSelect-DEVkjnNY.js +122 -0
  10. package/dist/FieldText-LzCqM7jk.js +34 -0
  11. package/dist/FieldUrl-zqYEJCPK.js +34 -0
  12. package/dist/components/ContextMenu/index.d.ts +2 -0
  13. package/dist/components/ContextMenu/index.vue.d.ts +27 -0
  14. package/dist/components/Dashboard/charts/BarChart.vue.d.ts +17 -0
  15. package/dist/components/Dashboard/charts/DoughnutChart.vue.d.ts +12 -0
  16. package/dist/components/Dashboard/charts/NumberCard.vue.d.ts +17 -0
  17. package/dist/components/Dashboard/charts/PieChart.vue.d.ts +21 -0
  18. package/dist/components/Dashboard/charts/TableChart.vue.d.ts +20 -0
  19. package/dist/components/Dashboard/index.d.ts +6 -0
  20. package/dist/components/Dashboard/index.vue.d.ts +23 -0
  21. package/dist/components/ai/AiMessageBubble.vue.d.ts +11 -0
  22. package/dist/components/ai/AiMessageList.vue.d.ts +19 -0
  23. package/dist/components/ai/AiSender.vue.d.ts +33 -0
  24. package/dist/components/ai/AiStreamingCursor.vue.d.ts +5 -0
  25. package/dist/components/ai/AiThinking.vue.d.ts +5 -0
  26. package/dist/components/ai/UserMessageBubble.vue.d.ts +7 -0
  27. package/dist/components/ai/index.d.ts +7 -0
  28. package/dist/components/auxiliary/ColorPanel.vue.d.ts +19 -0
  29. package/dist/components/auxiliary/FileUpload.vue.d.ts +24 -0
  30. package/dist/components/auxiliary/PersonPanel.vue.d.ts +24 -0
  31. package/dist/components/auxiliary/index.d.ts +3 -0
  32. package/dist/components/base/AddViewBtn.vue.d.ts +6 -0
  33. package/dist/components/base/ButtonGroup.vue.d.ts +30 -0
  34. package/dist/components/base/DropdownMenu.vue.d.ts +25 -0
  35. package/dist/components/base/EmptyState.vue.d.ts +26 -0
  36. package/dist/components/base/RangeSlider.vue.d.ts +29 -0
  37. package/dist/components/base/StatisticCard.vue.d.ts +22 -0
  38. package/dist/components/base/ToolbarBtn.vue.d.ts +11 -0
  39. package/dist/components/base/ViewTab.vue.d.ts +11 -0
  40. package/dist/components/base/index.d.ts +11 -0
  41. package/dist/components/breadcrumb/Breadcrumb.vue.d.ts +48 -0
  42. package/dist/components/breadcrumb/BreadcrumbItem.vue.d.ts +42 -0
  43. package/dist/components/breadcrumb/index.d.ts +3 -0
  44. package/dist/components/detail/CommentItem.vue.d.ts +6 -0
  45. package/dist/components/detail/DetailLayout.vue.d.ts +37 -0
  46. package/dist/components/detail/PropPanel.vue.d.ts +26 -0
  47. package/dist/components/detail/PropRow.vue.d.ts +44 -0
  48. package/dist/components/detail/index.d.ts +4 -0
  49. package/dist/components/editor/BlockQuote.vue.d.ts +13 -0
  50. package/dist/components/editor/CodeBlock.vue.d.ts +10 -0
  51. package/dist/components/editor/ContentBlock.vue.d.ts +27 -0
  52. package/dist/components/editor/RefLink.vue.d.ts +11 -0
  53. package/dist/components/editor/RichTextEditor.vue.d.ts +186 -0
  54. package/dist/components/editor/index.d.ts +5 -0
  55. package/dist/components/field/FieldCheckbox.vue.d.ts +14 -0
  56. package/dist/components/field/FieldDate.vue.d.ts +17 -0
  57. package/dist/components/field/FieldDatetime.vue.d.ts +17 -0
  58. package/dist/components/field/FieldEmail.vue.d.ts +17 -0
  59. package/dist/components/field/FieldMultiSelect.vue.d.ts +18 -0
  60. package/dist/components/field/FieldNumber.vue.d.ts +17 -0
  61. package/dist/components/field/FieldRating.vue.d.ts +15 -0
  62. package/dist/components/field/FieldSelect.vue.d.ts +18 -0
  63. package/dist/components/field/FieldText.vue.d.ts +17 -0
  64. package/dist/components/field/FieldUrl.vue.d.ts +17 -0
  65. package/dist/components/form/FormDesigner.vue.d.ts +17 -0
  66. package/dist/components/form/index.d.ts +1 -0
  67. package/dist/components/gallery/GalleryCard.vue.d.ts +10 -0
  68. package/dist/components/gallery/GalleryView.vue.d.ts +24 -0
  69. package/dist/components/gallery/index.d.ts +2 -0
  70. package/dist/components/kanban/KanbanBoard.vue.d.ts +26 -0
  71. package/dist/components/kanban/KanbanCard.vue.d.ts +23 -0
  72. package/dist/components/kanban/KanbanColumn.vue.d.ts +25 -0
  73. package/dist/components/kanban/QuickAddRow.vue.d.ts +13 -0
  74. package/dist/components/kanban/index.d.ts +4 -0
  75. package/dist/components/layout/AppLayout.vue.d.ts +20 -0
  76. package/dist/components/layout/Navbar.vue.d.ts +34 -0
  77. package/dist/components/layout/Sidebar.vue.d.ts +26 -0
  78. package/dist/components/layout/StatusBar.vue.d.ts +11 -0
  79. package/dist/components/layout/index.d.ts +4 -0
  80. package/dist/components/mermaid/MermaidChart.vue.d.ts +46 -0
  81. package/dist/components/mermaid/index.d.ts +1 -0
  82. package/dist/components/overlay/Dialog.vue.d.ts +69 -0
  83. package/dist/components/overlay/Modal.vue.d.ts +59 -0
  84. package/dist/components/overlay/index.d.ts +2 -0
  85. package/dist/components/split/SplitPane.vue.d.ts +41 -0
  86. package/dist/components/split/index.d.ts +1 -0
  87. package/dist/components/table/DataTable.vue.d.ts +43 -0
  88. package/dist/components/table/FieldCell.vue.d.ts +33 -0
  89. package/dist/components/table/NewRowBtn.vue.d.ts +6 -0
  90. package/dist/components/table/TableColumnManager.vue.d.ts +13 -0
  91. package/dist/components/table/TableDataRow.vue.d.ts +47 -0
  92. package/dist/components/table/TableFilterPanel.vue.d.ts +24 -0
  93. package/dist/components/table/TableHeaderRow.vue.d.ts +23 -0
  94. package/dist/components/table/index.d.ts +8 -0
  95. package/dist/components/tabs/TabPanel.vue.d.ts +38 -0
  96. package/dist/components/tabs/Tabs.vue.d.ts +60 -0
  97. package/dist/components/tabs/index.d.ts +3 -0
  98. package/dist/components/timeline/GanttRow.vue.d.ts +42 -0
  99. package/dist/components/timeline/GanttTimeline.vue.d.ts +46 -0
  100. package/dist/components/timeline/index.d.ts +2 -0
  101. package/dist/components/toast/ToastContainer.vue.d.ts +2 -0
  102. package/dist/components/toast/ToastItem.vue.d.ts +16 -0
  103. package/dist/components/toast/index.d.ts +2 -0
  104. package/dist/composables/index.d.ts +16 -0
  105. package/dist/composables/useAiChat.d.ts +45 -0
  106. package/dist/composables/useBadge.d.ts +27 -0
  107. package/dist/composables/useInlineEdit.d.ts +17 -0
  108. package/dist/composables/useMarkdown.d.ts +16 -0
  109. package/dist/composables/useStream.d.ts +15 -0
  110. package/dist/composables/useTable.d.ts +62 -0
  111. package/dist/composables/useTableFilter.d.ts +36 -0
  112. package/dist/composables/useToast.d.ts +63 -0
  113. package/dist/composables/useTypewriter.d.ts +11 -0
  114. package/dist/dev/App.vue.d.ts +2 -0
  115. package/dist/dev/main.d.ts +0 -0
  116. package/dist/index-B9LF7Kv4.js +10661 -0
  117. package/dist/index.d.ts +45 -0
  118. package/dist/oneflow-ui.js +84 -0
  119. package/dist/oneflow-ui.umd.cjs +13 -0
  120. package/dist/style.css +1 -0
  121. package/dist/tests/gantt.integration.spec.d.ts +1 -0
  122. package/dist/tests/table-detail.integration.spec.d.ts +1 -0
  123. package/dist/tests/three-layer-model.integration.spec.d.ts +1 -0
  124. package/dist/types/index.d.ts +161 -0
  125. package/dist/utils/icon.d.ts +7 -0
  126. package/dist/utils/index.d.ts +1 -0
  127. package/package.json +62 -0
@@ -0,0 +1,60 @@
1
+ import { Component } from 'vue';
2
+ /**
3
+ * TabItem 接口 - 单个标签页定义
4
+ */
5
+ export interface TabItem {
6
+ /** 唯一标识符,对应 TabPanel 的 name */
7
+ key: string;
8
+ /** 显示文字 */
9
+ label: string;
10
+ /** 图标:lucide icon name(kebab-case)或 Vue 组件 */
11
+ icon?: string | Component;
12
+ /** 是否禁用 */
13
+ disabled?: boolean;
14
+ /** 角标,如未读数 */
15
+ badge?: string | number;
16
+ }
17
+ /**
18
+ * Tabs 组件 - 标签页切换
19
+ *
20
+ * @example
21
+ * <Tabs v-model="activeTab" :tabs="tabs" variant="line">
22
+ * <TabPanel name="tab1">内容1</TabPanel>
23
+ * <TabPanel name="tab2">内容2</TabPanel>
24
+ * </Tabs>
25
+ */
26
+ type __VLS_Props = {
27
+ /** 当前激活的 tab key(v-model 受控模式) */
28
+ modelValue?: string;
29
+ /** 初始激活的 tab key(非受控模式) */
30
+ defaultValue?: string;
31
+ /** 变体:line 下划线 | card 卡片 */
32
+ variant?: "line" | "card";
33
+ /** 尺寸 */
34
+ size?: "sm" | "md" | "lg";
35
+ /** tab 列表配置 */
36
+ tabs: TabItem[];
37
+ };
38
+ declare function __VLS_template(): {
39
+ attrs: Partial<{}>;
40
+ slots: {
41
+ default?(_: {}): any;
42
+ };
43
+ refs: {};
44
+ rootEl: HTMLDivElement;
45
+ };
46
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
47
+ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
48
+ "update:modelValue": (key: string) => any;
49
+ change: (key: string) => any;
50
+ }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
51
+ "onUpdate:modelValue"?: ((key: string) => any) | undefined;
52
+ onChange?: ((key: string) => any) | undefined;
53
+ }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
54
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
55
+ export default _default;
56
+ type __VLS_WithTemplateSlots<T, S> = T & {
57
+ new (): {
58
+ $slots: S;
59
+ };
60
+ };
@@ -0,0 +1,3 @@
1
+ export { default as Tabs } from './Tabs.vue';
2
+ export { default as TabPanel } from './TabPanel.vue';
3
+ export type { TabItem } from './Tabs.vue';
@@ -0,0 +1,42 @@
1
+ import { ColorMap } from '../../types';
2
+ interface GanttRowItem {
3
+ id: string;
4
+ title: string;
5
+ status?: string;
6
+ priority?: string;
7
+ startDate: string;
8
+ endDate: string;
9
+ barColor?: string;
10
+ }
11
+ type __VLS_Props = {
12
+ item: GanttRowItem;
13
+ dayWidth: number;
14
+ offsetDays: number;
15
+ durationDays: number;
16
+ totalDays: number;
17
+ readonly?: boolean;
18
+ priorityColorMap?: ColorMap;
19
+ statusColorMap?: ColorMap;
20
+ };
21
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
22
+ click: (item: GanttRowItem) => any;
23
+ change: (payload: {
24
+ id: string;
25
+ offsetDays: number;
26
+ durationDays: number;
27
+ startDate: string;
28
+ endDate: string;
29
+ }) => any;
30
+ }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
31
+ onClick?: ((item: GanttRowItem) => any) | undefined;
32
+ onChange?: ((payload: {
33
+ id: string;
34
+ offsetDays: number;
35
+ durationDays: number;
36
+ startDate: string;
37
+ endDate: string;
38
+ }) => any) | undefined;
39
+ }>, {
40
+ readonly: boolean;
41
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
42
+ export default _default;
@@ -0,0 +1,46 @@
1
+ import { DataRecord, GanttItem, TableSchema, Task, ViewConfig } from '../../types';
2
+ interface TimelineRow {
3
+ id: string;
4
+ title: string;
5
+ status?: string;
6
+ priority?: string;
7
+ startDate: string;
8
+ endDate: string;
9
+ barColor?: string;
10
+ sourceRecordId?: string;
11
+ }
12
+ type __VLS_Props = {
13
+ records?: DataRecord[];
14
+ schema?: TableSchema;
15
+ viewConfig?: ViewConfig;
16
+ startFieldId?: string;
17
+ endFieldId?: string;
18
+ labelFieldId?: string;
19
+ items?: GanttItem[];
20
+ data?: Task[];
21
+ startDate?: string;
22
+ days?: number;
23
+ };
24
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
25
+ "row-click": (item: TimelineRow) => any;
26
+ "record-change": (payload: {
27
+ recordId: string;
28
+ startDate: string;
29
+ endDate: string;
30
+ }) => any;
31
+ "update:records": (records: DataRecord[]) => any;
32
+ }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
33
+ "onRow-click"?: ((item: TimelineRow) => any) | undefined;
34
+ "onRecord-change"?: ((payload: {
35
+ recordId: string;
36
+ startDate: string;
37
+ endDate: string;
38
+ }) => any) | undefined;
39
+ "onUpdate:records"?: ((records: DataRecord[]) => any) | undefined;
40
+ }>, {
41
+ startFieldId: string;
42
+ endFieldId: string;
43
+ labelFieldId: string;
44
+ days: number;
45
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
46
+ export default _default;
@@ -0,0 +1,2 @@
1
+ export { default as GanttRow } from './GanttRow.vue';
2
+ export { default as GanttTimeline } from './GanttTimeline.vue';
@@ -0,0 +1,2 @@
1
+ declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
2
+ export default _default;
@@ -0,0 +1,16 @@
1
+ import { ToastItem } from '../../composables/useToast';
2
+ /**
3
+ * ToastItem - 单个 Toast 通知项组件
4
+ *
5
+ * @prop toast - Toast 数据对象
6
+ * @emit close - 点击关闭按钮时触发
7
+ */
8
+ type __VLS_Props = {
9
+ toast: ToastItem;
10
+ };
11
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
12
+ close: () => any;
13
+ }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
14
+ onClose?: (() => any) | undefined;
15
+ }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
16
+ export default _default;
@@ -0,0 +1,2 @@
1
+ export { default as ToastContainer } from './ToastContainer.vue';
2
+ export { default as ToastItem } from './ToastItem.vue';
@@ -0,0 +1,16 @@
1
+ export { useBadge, resolveBadge, mergeColorMap, DEFAULT_PRIORITY_MAP, DEFAULT_STATUS_MAP, } from './useBadge';
2
+ export type { ResolvedBadge } from './useBadge';
3
+ export { useStream } from './useStream';
4
+ export type { UseStreamOptions, StreamMode } from './useStream';
5
+ export { useTypewriter } from './useTypewriter';
6
+ export type { UseTypewriterOptions } from './useTypewriter';
7
+ export { useAiChat } from './useAiChat';
8
+ export type { ChatMessage, UseAiChatOptions } from './useAiChat';
9
+ export { useTableFilter } from './useTableFilter';
10
+ export type { FilterCondition, FilterLogic, FilterOperator } from './useTableFilter';
11
+ export { useTable } from './useTable';
12
+ export type { SortState, PaginationState, UseTableOptions } from './useTable';
13
+ export { useMarkdown } from './useMarkdown';
14
+ export type { UseMarkdownOptions } from './useMarkdown';
15
+ export { useInlineEdit } from './useInlineEdit';
16
+ export type { EditingCell } from './useInlineEdit';
@@ -0,0 +1,45 @@
1
+ export interface ChatMessage {
2
+ id: string;
3
+ role: "ai" | "user";
4
+ content: string;
5
+ isStreaming?: boolean;
6
+ timestamp?: string;
7
+ error?: boolean;
8
+ }
9
+ export interface UseAiChatOptions {
10
+ /**
11
+ * 发送消息的函数,返回 ReadableStream 或 Response
12
+ * 业务层自己实现具体的 API 调用
13
+ */
14
+ sendRequest: (content: string, history: ChatMessage[]) => Promise<ReadableStream<Uint8Array> | Response>;
15
+ /**
16
+ * SSE 模式下解析每条 data 并返回文本增量,返回 null 则跳过
17
+ */
18
+ parseChunk?: (data: unknown) => string | null;
19
+ /** 是否启用打字机效果,默认 false(直接追加) */
20
+ typewriter?: boolean;
21
+ typewriterSpeed?: number;
22
+ onError?: (error: Error) => void;
23
+ }
24
+ export declare function useAiChat(options: UseAiChatOptions): {
25
+ messages: Readonly<import('vue').Ref<readonly {
26
+ readonly id: string;
27
+ readonly role: "ai" | "user";
28
+ readonly content: string;
29
+ readonly isStreaming?: boolean | undefined;
30
+ readonly timestamp?: string | undefined;
31
+ readonly error?: boolean | undefined;
32
+ }[], readonly {
33
+ readonly id: string;
34
+ readonly role: "ai" | "user";
35
+ readonly content: string;
36
+ readonly isStreaming?: boolean | undefined;
37
+ readonly timestamp?: string | undefined;
38
+ readonly error?: boolean | undefined;
39
+ }[]>>;
40
+ isGenerating: Readonly<import('vue').Ref<boolean, boolean>>;
41
+ isStreaming: Readonly<import('vue').Ref<boolean, boolean>>;
42
+ send: (content: string) => Promise<void>;
43
+ cancel: () => void;
44
+ clear: () => void;
45
+ };
@@ -0,0 +1,27 @@
1
+ import { ColorMap } from '../types';
2
+ export declare const DEFAULT_PRIORITY_MAP: ColorMap;
3
+ export declare const DEFAULT_STATUS_MAP: ColorMap;
4
+ export interface ResolvedBadge {
5
+ style: {
6
+ color: string;
7
+ background: string;
8
+ };
9
+ label: string;
10
+ dot?: string;
11
+ }
12
+ /**
13
+ * 从 colorMap 中查找 value 对应的徽章配置。
14
+ * - 找到:使用 map 中的配置(label 不存在时回退到 value 本身)
15
+ * - 找不到:使用灰色兜底,label = value 原始值
16
+ */
17
+ export declare function resolveBadge(value: string, colorMap: ColorMap): ResolvedBadge;
18
+ /**
19
+ * 合并外部传入的 colorMap 与默认 map(外部优先)
20
+ */
21
+ export declare function mergeColorMap(defaultMap: ColorMap, overrides?: ColorMap): ColorMap;
22
+ export declare function useBadge(): {
23
+ DEFAULT_PRIORITY_MAP: ColorMap;
24
+ DEFAULT_STATUS_MAP: ColorMap;
25
+ resolveBadge: typeof resolveBadge;
26
+ mergeColorMap: typeof mergeColorMap;
27
+ };
@@ -0,0 +1,17 @@
1
+ export interface EditingCell {
2
+ rowId: string;
3
+ fieldId: string;
4
+ }
5
+ export declare function useInlineEdit(): {
6
+ editingCell: Readonly<import('vue').Ref<{
7
+ readonly rowId: string;
8
+ readonly fieldId: string;
9
+ } | null, {
10
+ readonly rowId: string;
11
+ readonly fieldId: string;
12
+ } | null>>;
13
+ activate: (rowId: string, fieldId: string) => void;
14
+ commit: (rowId: string, fieldId: string, value: unknown) => unknown;
15
+ cancel: () => void;
16
+ isEditing: (rowId: string, fieldId: string) => boolean;
17
+ };
@@ -0,0 +1,16 @@
1
+ /**
2
+ * useMarkdown - 可复用的 Markdown 渲染逻辑
3
+ *
4
+ * 用于在不同系统中渲染 Markdown 内容,支持代码高亮和复制按钮
5
+ *
6
+ * @example
7
+ * const { renderMarkdown } = useMarkdown({ showCopyButton: true })
8
+ * const html = renderMarkdown('# Hello\n\n```js\ncode\n```')
9
+ */
10
+ export interface UseMarkdownOptions {
11
+ showCopyButton?: boolean;
12
+ t?: (key: string) => string;
13
+ }
14
+ export declare function useMarkdown(options?: UseMarkdownOptions): {
15
+ renderMarkdown: (content: string) => string;
16
+ };
@@ -0,0 +1,15 @@
1
+ export type StreamMode = "raw" | "sse";
2
+ export interface UseStreamOptions {
3
+ mode?: StreamMode;
4
+ onChunk?: (text: string) => void;
5
+ onData?: (parsed: unknown) => void;
6
+ onDone?: () => void;
7
+ onError?: (error: Error) => void;
8
+ }
9
+ export declare function useStream(options?: UseStreamOptions): {
10
+ isStreaming: Readonly<import('vue').Ref<boolean, boolean>>;
11
+ isLoading: Readonly<import('vue').Ref<boolean, boolean>>;
12
+ error: Readonly<import('vue').Ref<Error | null, Error | null>>;
13
+ start: (readableStream: ReadableStream<Uint8Array>) => Promise<void>;
14
+ cancel: () => void;
15
+ };
@@ -0,0 +1,62 @@
1
+ export type SortOrder = "asc" | "desc" | null;
2
+ export interface SortState {
3
+ field: string | null;
4
+ order: SortOrder;
5
+ }
6
+ export interface PaginationState {
7
+ page: number;
8
+ pageSize: number;
9
+ total: number;
10
+ }
11
+ export interface UseTableOptions<T> {
12
+ data?: T[];
13
+ pageSize?: number;
14
+ /** 服务端分页模式:开启后 filterData/sortData 不在客户端处理 */
15
+ serverSide?: boolean;
16
+ /** 服务端模式下,分页/排序变化时回调 */
17
+ onFetch?: (params: {
18
+ page: number;
19
+ pageSize: number;
20
+ sort: SortState;
21
+ }) => Promise<{
22
+ data: T[];
23
+ total: number;
24
+ }>;
25
+ }
26
+ export declare function useTable<T extends Record<string, unknown>>(options?: UseTableOptions<T>): {
27
+ data: import('vue').ComputedRef<T[]>;
28
+ rawData: Readonly<import('vue').Ref<readonly import('vue').DeepReadonly<import('@vue/reactivity').UnwrapRefSimple<T>>[], readonly import('vue').DeepReadonly<import('@vue/reactivity').UnwrapRefSimple<T>>[]>>;
29
+ loading: Readonly<import('vue').Ref<boolean, boolean>>;
30
+ error: Readonly<import('vue').Ref<Error | null, Error | null>>;
31
+ sort: Readonly<import('vue').Ref<{
32
+ readonly field: string | null;
33
+ readonly order: SortOrder;
34
+ }, {
35
+ readonly field: string | null;
36
+ readonly order: SortOrder;
37
+ }>>;
38
+ pagination: Readonly<import('vue').Ref<{
39
+ readonly page: number;
40
+ readonly pageSize: number;
41
+ readonly total: number;
42
+ }, {
43
+ readonly page: number;
44
+ readonly pageSize: number;
45
+ readonly total: number;
46
+ }>>;
47
+ totalPages: import('vue').ComputedRef<number>;
48
+ selectedRows: Readonly<import('vue').Ref<ReadonlySet<string | number>, ReadonlySet<string | number>>>;
49
+ selectedCount: import('vue').ComputedRef<number>;
50
+ isAllSelected: import('vue').ComputedRef<boolean>;
51
+ toggleSort: (field: string) => void;
52
+ setSort: (field: string, order: SortOrder) => void;
53
+ setPage: (page: number) => void;
54
+ setPageSize: (size: number) => void;
55
+ toggleRowSelection: (row: T, index: number) => void;
56
+ toggleSelectAll: (allRows: T[]) => void;
57
+ isRowSelected: (row: T, index: number) => boolean;
58
+ clearSelection: () => void;
59
+ refresh: () => void;
60
+ fetchData: () => Promise<void>;
61
+ setData: (data: T[]) => void;
62
+ };
@@ -0,0 +1,36 @@
1
+ import { TableColumn } from '../types';
2
+ export type FilterOperator = "equals" | "not_equals" | "contains" | "not_contains" | "starts_with" | "ends_with" | "gt" | "gte" | "lt" | "lte" | "is_empty" | "is_not_empty";
3
+ export type FilterLogic = "and" | "or";
4
+ export interface FilterCondition {
5
+ id: string;
6
+ field: string;
7
+ operator: FilterOperator;
8
+ value: string;
9
+ }
10
+ export interface UseTableFilterOptions {
11
+ columns?: TableColumn[];
12
+ }
13
+ export declare function useTableFilter<T extends Record<string, unknown>>(options?: UseTableFilterOptions): {
14
+ conditions: Readonly<import('vue').Ref<readonly {
15
+ readonly id: string;
16
+ readonly field: string;
17
+ readonly operator: FilterOperator;
18
+ readonly value: string;
19
+ }[], readonly {
20
+ readonly id: string;
21
+ readonly field: string;
22
+ readonly operator: FilterOperator;
23
+ readonly value: string;
24
+ }[]>>;
25
+ logic: import('vue').Ref<FilterLogic, FilterLogic>;
26
+ isActive: import('vue').ComputedRef<boolean>;
27
+ addCondition: (field?: string) => void;
28
+ removeCondition: (id: string) => void;
29
+ updateCondition: (id: string, update: Partial<FilterCondition>) => void;
30
+ clearConditions: () => void;
31
+ filterData: (data: T[]) => T[];
32
+ operatorsFor: (colType?: string) => {
33
+ value: FilterOperator;
34
+ label: string;
35
+ }[];
36
+ };
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Toast 通知类型
3
+ */
4
+ export type ToastType = "info" | "success" | "warning" | "error";
5
+ /**
6
+ * Toast 数据项接口
7
+ */
8
+ export interface ToastItem {
9
+ id: string;
10
+ type: ToastType;
11
+ message: string;
12
+ /** 持续时间(毫秒),0 表示不自动关闭 */
13
+ duration?: number;
14
+ title?: string;
15
+ }
16
+ /**
17
+ * useToast 配置项
18
+ */
19
+ export interface UseToastOptions {
20
+ /** 持续时间(毫秒),默认 3000,0 表示不自动关闭 */
21
+ duration?: number;
22
+ title?: string;
23
+ }
24
+ /**
25
+ * 移除指定 id 的 Toast
26
+ */
27
+ declare function remove(id: string): void;
28
+ /**
29
+ * useToast composable
30
+ *
31
+ * 全局单例模式,所有调用共享同一个 toast 列表。
32
+ *
33
+ * @example
34
+ * ```ts
35
+ * const toast = useToast()
36
+ * toast.success('操作成功')
37
+ * toast.error('操作失败', { title: '错误', duration: 5000 })
38
+ * toast.info('提示信息', { duration: 0 }) // 不自动关闭
39
+ * ```
40
+ */
41
+ export declare function useToast(): {
42
+ /** 响应式 toast 列表 */
43
+ toasts: import('vue').Reactive<ToastItem[]>;
44
+ /** 显示 info 类型通知 */
45
+ info: (message: string, options?: UseToastOptions) => string;
46
+ /** 显示 success 类型通知 */
47
+ success: (message: string, options?: UseToastOptions) => string;
48
+ /** 显示 warning 类型通知 */
49
+ warning: (message: string, options?: UseToastOptions) => string;
50
+ /** 显示 error 类型通知 */
51
+ error: (message: string, options?: UseToastOptions) => string;
52
+ /** 移除指定 id 的 toast */
53
+ remove: typeof remove;
54
+ /** 清除所有 toast */
55
+ clear: () => {
56
+ id: string;
57
+ type: ToastType;
58
+ message: string;
59
+ duration?: number | undefined;
60
+ title?: string | undefined;
61
+ }[];
62
+ };
63
+ export {};
@@ -0,0 +1,11 @@
1
+ export interface UseTypewriterOptions {
2
+ speed?: number;
3
+ onComplete?: () => void;
4
+ }
5
+ export declare function useTypewriter(options?: UseTypewriterOptions): {
6
+ displayText: Readonly<import('vue').Ref<string, string>>;
7
+ isTyping: Readonly<import('vue').Ref<boolean, boolean>>;
8
+ append: (text: string) => void;
9
+ reset: () => void;
10
+ flush: () => void;
11
+ };
@@ -0,0 +1,2 @@
1
+ declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
2
+ export default _default;
File without changes