@oneflowui/ui 0.4.2 → 0.4.3
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.
- package/dist/_virtual/_commonjsHelpers.js +6 -0
- package/dist/_virtual/_plugin-vue_export-helper.js +9 -0
- package/dist/components/ContextMenu/index.vue.js +7 -0
- package/dist/components/ContextMenu/index.vue2.js +91 -0
- package/dist/components/Dashboard/charts/BarChart.vue.js +7 -0
- package/dist/components/Dashboard/charts/BarChart.vue2.js +43 -0
- package/dist/components/Dashboard/charts/DoughnutChart.vue.js +23 -0
- package/dist/components/Dashboard/charts/DoughnutChart.vue2.js +4 -0
- package/dist/components/Dashboard/charts/NumberCard.vue.js +7 -0
- package/dist/components/Dashboard/charts/NumberCard.vue2.js +41 -0
- package/dist/components/Dashboard/charts/PieChart.vue.js +7 -0
- package/dist/components/Dashboard/charts/PieChart.vue2.js +53 -0
- package/dist/components/Dashboard/charts/TableChart.vue.js +7 -0
- package/dist/components/Dashboard/charts/TableChart.vue2.js +50 -0
- package/dist/components/Dashboard/index.vue.js +7 -0
- package/dist/components/Dashboard/index.vue2.js +104 -0
- package/dist/components/ai/AiMessageBubble.vue.js +7 -0
- package/dist/components/ai/AiMessageBubble.vue2.js +47 -0
- package/dist/components/ai/AiMessageList.vue.js +7 -0
- package/dist/components/ai/AiMessageList.vue2.js +78 -0
- package/dist/components/ai/AiSender.vue.js +7 -0
- package/dist/components/ai/AiSender.vue2.js +86 -0
- package/dist/components/ai/AiStreamingCursor.vue.js +7 -0
- package/dist/components/ai/AiStreamingCursor.vue2.js +16 -0
- package/dist/components/ai/AiThinking.vue.js +7 -0
- package/dist/components/ai/AiThinking.vue2.js +19 -0
- package/dist/components/ai/UserMessageBubble.vue.js +7 -0
- package/dist/components/ai/UserMessageBubble.vue2.js +34 -0
- package/dist/components/auxiliary/ColorPanel.vue.js +7 -0
- package/dist/components/auxiliary/ColorPanel.vue2.js +65 -0
- package/dist/components/auxiliary/FileUpload.vue.js +7 -0
- package/dist/components/auxiliary/FileUpload.vue2.js +90 -0
- package/dist/components/auxiliary/PersonPanel.vue.js +7 -0
- package/dist/components/auxiliary/PersonPanel.vue2.js +66 -0
- package/dist/components/base/Accordion.vue.js +7 -0
- package/dist/components/base/Accordion.vue2.js +78 -0
- package/dist/components/base/AddViewBtn.vue.js +7 -0
- package/dist/components/base/AddViewBtn.vue2.js +25 -0
- package/dist/components/base/Avatar.vue.js +7 -0
- package/dist/components/base/Avatar.vue2.js +72 -0
- package/dist/components/base/Badge.vue.js +7 -0
- package/dist/components/base/Badge.vue2.js +70 -0
- package/dist/components/base/ButtonGroup.vue.js +7 -0
- package/dist/components/base/ButtonGroup.vue2.js +40 -0
- package/dist/components/base/ChainItem.vue.js +7 -0
- package/dist/components/base/ChainItem.vue2.js +68 -0
- package/dist/components/base/DescBlock.vue.js +7 -0
- package/dist/components/base/DescBlock.vue2.js +13 -0
- package/dist/components/base/DropdownMenu.vue.js +7 -0
- package/dist/components/base/DropdownMenu.vue2.js +92 -0
- package/dist/components/base/EmptyState.vue.js +7 -0
- package/dist/components/base/EmptyState.vue2.js +38 -0
- package/dist/components/base/InfoCard.vue.js +7 -0
- package/dist/components/base/InfoCard.vue2.js +167 -0
- package/dist/components/base/MonitorItem.vue.js +7 -0
- package/dist/components/base/MonitorItem.vue2.js +56 -0
- package/dist/components/base/PersonaCard.vue.js +7 -0
- package/dist/components/base/PersonaCard.vue2.js +173 -0
- package/dist/components/base/ProgressBar.vue.js +7 -0
- package/dist/components/base/ProgressBar.vue2.js +49 -0
- package/dist/components/base/RangeSlider.vue.js +7 -0
- package/dist/components/base/RangeSlider.vue2.js +35 -0
- package/dist/components/base/RefTag.vue.js +7 -0
- package/dist/components/base/RefTag.vue2.js +52 -0
- package/dist/components/base/SectionBlock.vue.js +7 -0
- package/dist/components/base/SectionBlock.vue2.js +115 -0
- package/dist/components/base/SelectBadge.vue.js +7 -0
- package/dist/components/base/SelectBadge.vue2.js +81 -0
- package/dist/components/base/StatisticCard.vue.js +7 -0
- package/dist/components/base/StatisticCard.vue2.js +57 -0
- package/dist/components/base/StatusIndicator.vue.js +7 -0
- package/dist/components/base/StatusIndicator.vue2.js +54 -0
- package/dist/components/base/StatusSummary.vue.js +7 -0
- package/dist/components/base/StatusSummary.vue2.js +64 -0
- package/dist/components/base/Stepper.vue.js +7 -0
- package/dist/components/base/Stepper.vue2.js +70 -0
- package/dist/components/base/Switch.vue.js +7 -0
- package/dist/components/base/Switch.vue2.js +43 -0
- package/dist/components/base/ToolbarBtn.vue.js +7 -0
- package/dist/components/base/ToolbarBtn.vue2.js +30 -0
- package/dist/components/base/ViewModeGroup.vue.js +7 -0
- package/dist/components/base/ViewModeGroup.vue2.js +32 -0
- package/dist/components/base/ViewSwitcher.vue.js +7 -0
- package/dist/components/base/ViewSwitcher.vue2.js +73 -0
- package/dist/components/base/ViewTab.vue.js +7 -0
- package/dist/components/base/ViewTab.vue2.js +42 -0
- package/dist/components/breadcrumb/Breadcrumb.vue.js +7 -0
- package/dist/components/breadcrumb/Breadcrumb.vue2.js +52 -0
- package/dist/components/breadcrumb/BreadcrumbItem.vue.js +7 -0
- package/dist/components/breadcrumb/BreadcrumbItem.vue2.js +35 -0
- package/dist/components/detail/CommentItem.vue.js +7 -0
- package/dist/components/detail/CommentItem.vue2.js +29 -0
- package/dist/components/detail/DetailLayout.vue.js +7 -0
- package/dist/components/detail/DetailLayout.vue2.js +118 -0
- package/dist/components/detail/PropPanel.vue.js +7 -0
- package/dist/components/detail/PropPanel.vue2.js +51 -0
- package/dist/components/detail/PropRow.vue.js +7 -0
- package/dist/components/detail/PropRow.vue2.js +51 -0
- package/dist/components/editor/BlockQuote.vue.js +7 -0
- package/dist/components/editor/BlockQuote.vue2.js +45 -0
- package/dist/components/editor/CodeBlock.vue.js +7 -0
- package/dist/components/editor/CodeBlock.vue2.js +48 -0
- package/dist/components/editor/ContentBlock.vue.js +7 -0
- package/dist/components/editor/ContentBlock.vue2.js +49 -0
- package/dist/components/editor/RefLink.vue.js +7 -0
- package/dist/components/editor/RefLink.vue2.js +37 -0
- package/dist/components/editor/RichTextEditor.vue.js +7 -0
- package/dist/components/editor/RichTextEditor.vue2.js +132 -0
- package/dist/components/field/FieldCheckbox.vue.js +7 -0
- package/dist/{FieldCheckbox-CV3QtQ4Y.js → components/field/FieldCheckbox.vue2.js} +8 -9
- package/dist/components/field/FieldDate.vue.js +7 -0
- package/dist/{FieldDate-Bljx4jb7.js → components/field/FieldDate.vue2.js} +9 -10
- package/dist/components/field/FieldDatetime.vue.js +7 -0
- package/dist/{FieldDatetime-B52GfWrK.js → components/field/FieldDatetime.vue2.js} +11 -12
- package/dist/components/field/FieldEmail.vue.js +7 -0
- package/dist/{FieldEmail-UREMoue-.js → components/field/FieldEmail.vue2.js} +12 -13
- package/dist/components/field/FieldMultiSelect.vue.js +7 -0
- package/dist/{FieldMultiSelect-Dlay1Fop.js → components/field/FieldMultiSelect.vue2.js} +32 -33
- package/dist/components/field/FieldNumber.vue.js +7 -0
- package/dist/{FieldNumber-BjhfFhs6.js → components/field/FieldNumber.vue2.js} +8 -9
- package/dist/components/field/FieldRating.vue.js +7 -0
- package/dist/components/field/FieldRating.vue2.js +31 -0
- package/dist/components/field/FieldSelect.vue.js +7 -0
- package/dist/{FieldSelect-B39Ad8VH.js → components/field/FieldSelect.vue2.js} +34 -35
- package/dist/components/field/FieldText.vue.js +7 -0
- package/dist/{FieldText-Ry7f72Ug.js → components/field/FieldText.vue2.js} +13 -14
- package/dist/components/field/FieldUrl.vue.js +7 -0
- package/dist/components/field/FieldUrl.vue2.js +33 -0
- package/dist/components/form/FormDesigner.vue.js +7 -0
- package/dist/components/form/FormDesigner.vue2.js +245 -0
- package/dist/components/gallery/GalleryCard.vue.js +7 -0
- package/dist/components/gallery/GalleryCard.vue2.js +87 -0
- package/dist/components/gallery/GalleryView.vue.js +7 -0
- package/dist/components/gallery/GalleryView.vue2.js +48 -0
- package/dist/components/kanban/KanbanBoard.vue.js +7 -0
- package/dist/components/kanban/KanbanBoard.vue2.js +86 -0
- package/dist/components/kanban/KanbanCard.vue.js +7 -0
- package/dist/components/kanban/KanbanCard.vue2.js +56 -0
- package/dist/components/kanban/KanbanColumn.vue.js +7 -0
- package/dist/components/kanban/KanbanColumn.vue2.js +103 -0
- package/dist/components/kanban/QuickAddRow.vue.js +7 -0
- package/dist/components/kanban/QuickAddRow.vue2.js +58 -0
- package/dist/components/layout/AppLayout.vue.js +7 -0
- package/dist/components/layout/AppLayout.vue2.js +98 -0
- package/dist/components/layout/Navbar.vue.js +7 -0
- package/dist/components/layout/Navbar.vue2.js +70 -0
- package/dist/components/layout/Sidebar.vue.js +7 -0
- package/dist/components/layout/Sidebar.vue2.js +88 -0
- package/dist/components/layout/StatusBar.vue.js +7 -0
- package/dist/components/layout/StatusBar.vue2.js +37 -0
- package/dist/components/mermaid/MermaidChart.vue.js +7 -0
- package/dist/components/mermaid/MermaidChart.vue2.js +75 -0
- package/dist/components/overlay/Dialog.vue.js +7 -0
- package/dist/components/overlay/Dialog.vue2.js +89 -0
- package/dist/components/overlay/Drawer.vue.js +7 -0
- package/dist/components/overlay/Drawer.vue2.js +112 -0
- package/dist/components/overlay/Modal.vue.js +7 -0
- package/dist/components/overlay/Modal.vue2.js +115 -0
- package/dist/components/overlay/SidePanel.vue.js +7 -0
- package/dist/components/overlay/SidePanel.vue2.js +137 -0
- package/dist/components/split/SplitPane.vue.js +8 -0
- package/dist/components/split/SplitPane.vue2.js +68 -0
- package/dist/components/table/DataTable.vue.js +7 -0
- package/dist/components/table/DataTable.vue2.js +234 -0
- package/dist/components/table/FieldCell.vue.js +7 -0
- package/dist/components/table/FieldCell.vue2.js +71 -0
- package/dist/components/table/NewRowBtn.vue.js +7 -0
- package/dist/components/table/NewRowBtn.vue2.js +22 -0
- package/dist/components/table/TableColumnManager.vue.js +7 -0
- package/dist/components/table/TableColumnManager.vue2.js +100 -0
- package/dist/components/table/TableDataRow.vue.js +7 -0
- package/dist/components/table/TableDataRow.vue2.js +115 -0
- package/dist/components/table/TableFilterPanel.vue.js +7 -0
- package/dist/components/table/TableFilterPanel.vue2.js +142 -0
- package/dist/components/table/TableGroupRow.vue.js +7 -0
- package/dist/components/table/TableGroupRow.vue2.js +48 -0
- package/dist/components/table/TableHeaderRow.vue.js +7 -0
- package/dist/components/table/TableHeaderRow.vue2.js +69 -0
- package/dist/components/tabs/TabPanel.vue.js +7 -0
- package/dist/components/tabs/TabPanel.vue2.js +26 -0
- package/dist/components/tabs/Tabs.vue.js +7 -0
- package/dist/components/tabs/Tabs.vue2.js +87 -0
- package/dist/components/timeline/ActivityTimeline.vue.js +7 -0
- package/dist/components/timeline/ActivityTimeline.vue2.js +104 -0
- package/dist/components/timeline/GanttRow.vue.js +7 -0
- package/dist/components/timeline/GanttRow.vue2.js +110 -0
- package/dist/components/timeline/GanttTimeline.vue.js +7 -0
- package/dist/components/timeline/GanttTimeline.vue2.js +185 -0
- package/dist/components/toast/ToastContainer.vue.js +34 -0
- package/dist/components/toast/ToastContainer.vue3.js +5 -0
- package/dist/components/toast/ToastItem.vue.js +7 -0
- package/dist/components/toast/ToastItem.vue2.js +78 -0
- package/dist/composables/useAiChat.js +103 -0
- package/dist/composables/useBadge.js +76 -0
- package/dist/composables/useBreakpoint.js +16 -0
- package/dist/composables/useInlineEdit.js +28 -0
- package/dist/composables/useMarkdown.js +69 -0
- package/dist/composables/useStream.js +80 -0
- package/dist/composables/useTable.js +115 -0
- package/dist/composables/useTableColumns.js +24 -0
- package/dist/composables/useTableData.js +16 -0
- package/dist/composables/useTableFilter.js +97 -0
- package/dist/composables/useTableGroup.js +46 -0
- package/dist/composables/useToast.js +38 -0
- package/dist/composables/useTypewriter.js +56 -0
- package/dist/composables/useVirtualList.js +117 -0
- package/dist/constants/table.js +11 -0
- package/dist/index.js +301 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/es/core.js +5 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/es/languages/bash.js +377 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/es/languages/css.js +923 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/es/languages/go.js +151 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/es/languages/java.js +240 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/es/languages/javascript.js +658 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/es/languages/json.js +38 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/es/languages/markdown.js +216 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/es/languages/plaintext.js +13 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/es/languages/python.js +399 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/es/languages/rust.js +305 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/es/languages/sql.js +615 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/es/languages/typescript.js +753 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/es/languages/xml.js +219 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/es/languages/yaml.js +183 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/core.js +1063 -0
- package/dist/style.css +1 -1
- package/dist/types/index.js +77 -0
- package/dist/utils/icon.js +15 -0
- package/package.json +13 -6
- package/dist/FieldRating-BKHUu-A1.js +0 -32
- package/dist/FieldUrl-bv0EB9sh.js +0 -34
- package/dist/index-DQph5iTq.js +0 -12936
- package/dist/oneflow-ui.js +0 -111
- package/dist/oneflow-ui.umd.cjs +0 -13
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { shallowRef as U, ref as f, computed as d, readonly as v, triggerRef as z } from "vue";
|
|
2
|
+
let b = !1;
|
|
3
|
+
function j(u = {}) {
|
|
4
|
+
const i = U(u.data ?? []), g = f(!1), S = f(null), n = f(/* @__PURE__ */ new Set()), l = f({ field: null, order: null }), a = f({
|
|
5
|
+
page: 1,
|
|
6
|
+
pageSize: u.pageSize ?? 20,
|
|
7
|
+
total: (u.data ?? []).length
|
|
8
|
+
});
|
|
9
|
+
function D(e) {
|
|
10
|
+
l.value.field === e ? (l.value.order = l.value.order === "asc" ? "desc" : l.value.order === "desc" ? null : "asc", l.value.order === null && (l.value.field = null)) : (l.value.field = e, l.value.order = "asc"), a.value.page = 1, n.value.clear(), u.serverSide && o();
|
|
11
|
+
}
|
|
12
|
+
function R(e, t) {
|
|
13
|
+
l.value = { field: e, order: t }, a.value.page = 1, n.value.clear(), u.serverSide && o();
|
|
14
|
+
}
|
|
15
|
+
function M(e) {
|
|
16
|
+
if (!l.value.field || !l.value.order) return e;
|
|
17
|
+
const t = l.value.field, r = l.value.order;
|
|
18
|
+
return [...e].sort((K, O) => {
|
|
19
|
+
const s = K[t], c = O[t];
|
|
20
|
+
if (s == null && c == null) return 0;
|
|
21
|
+
if (s == null) return 1;
|
|
22
|
+
if (c == null) return -1;
|
|
23
|
+
if (typeof s == "number" && typeof c == "number")
|
|
24
|
+
return r === "asc" ? s - c : c - s;
|
|
25
|
+
const m = String(s), y = String(c);
|
|
26
|
+
return r === "asc" ? m.localeCompare(y) : y.localeCompare(m);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function P(e) {
|
|
30
|
+
a.value.page = Math.max(1, Math.min(e, w.value)), u.serverSide && o();
|
|
31
|
+
}
|
|
32
|
+
function x(e) {
|
|
33
|
+
a.value.pageSize = e, a.value.page = 1, u.serverSide && o();
|
|
34
|
+
}
|
|
35
|
+
const w = d(
|
|
36
|
+
() => Math.max(1, Math.ceil(a.value.total / a.value.pageSize))
|
|
37
|
+
), h = d(() => {
|
|
38
|
+
if (u.serverSide) return i.value;
|
|
39
|
+
const e = M(i.value);
|
|
40
|
+
a.value.total = e.length;
|
|
41
|
+
const { page: t, pageSize: r } = a.value;
|
|
42
|
+
return e.slice((t - 1) * r, t * r);
|
|
43
|
+
});
|
|
44
|
+
function p(e, t) {
|
|
45
|
+
const r = e.id;
|
|
46
|
+
return r == null && !b && (b = !0, console.warn(
|
|
47
|
+
"[OneUI] DataTable: row is missing an `id` field. Row selection may behave incorrectly after sorting or filtering. Please ensure each row has a unique `id` property."
|
|
48
|
+
)), r ?? t;
|
|
49
|
+
}
|
|
50
|
+
function C(e, t) {
|
|
51
|
+
const r = p(e, t);
|
|
52
|
+
n.value.has(r) ? n.value.delete(r) : n.value.add(r);
|
|
53
|
+
}
|
|
54
|
+
function A(e) {
|
|
55
|
+
n.value.size === e.length ? n.value.clear() : e.forEach((t, r) => n.value.add(p(t, r)));
|
|
56
|
+
}
|
|
57
|
+
function F(e, t) {
|
|
58
|
+
return n.value.has(p(e, t));
|
|
59
|
+
}
|
|
60
|
+
function I() {
|
|
61
|
+
n.value.clear();
|
|
62
|
+
}
|
|
63
|
+
const T = d(() => n.value.size), k = d(
|
|
64
|
+
() => h.value.length > 0 && n.value.size === h.value.length
|
|
65
|
+
);
|
|
66
|
+
async function o() {
|
|
67
|
+
if (u.onFetch) {
|
|
68
|
+
g.value = !0, S.value = null;
|
|
69
|
+
try {
|
|
70
|
+
const e = await u.onFetch({
|
|
71
|
+
page: a.value.page,
|
|
72
|
+
pageSize: a.value.pageSize,
|
|
73
|
+
sort: l.value
|
|
74
|
+
});
|
|
75
|
+
i.value = e.data, z(i), a.value.total = e.total;
|
|
76
|
+
} catch (e) {
|
|
77
|
+
S.value = e;
|
|
78
|
+
} finally {
|
|
79
|
+
g.value = !1;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function q() {
|
|
84
|
+
u.serverSide ? o() : a.value.page = 1;
|
|
85
|
+
}
|
|
86
|
+
function E(e) {
|
|
87
|
+
i.value = e, z(i), a.value.page = 1, u.serverSide || (a.value.total = e.length);
|
|
88
|
+
}
|
|
89
|
+
return {
|
|
90
|
+
data: h,
|
|
91
|
+
rawData: v(i),
|
|
92
|
+
loading: v(g),
|
|
93
|
+
error: v(S),
|
|
94
|
+
sort: v(l),
|
|
95
|
+
pagination: v(a),
|
|
96
|
+
totalPages: w,
|
|
97
|
+
selectedRows: v(n),
|
|
98
|
+
selectedCount: T,
|
|
99
|
+
isAllSelected: k,
|
|
100
|
+
toggleSort: D,
|
|
101
|
+
setSort: R,
|
|
102
|
+
setPage: P,
|
|
103
|
+
setPageSize: x,
|
|
104
|
+
toggleRowSelection: C,
|
|
105
|
+
toggleSelectAll: A,
|
|
106
|
+
isRowSelected: F,
|
|
107
|
+
clearSelection: I,
|
|
108
|
+
refresh: q,
|
|
109
|
+
fetchData: o,
|
|
110
|
+
setData: E
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
export {
|
|
114
|
+
j as useTable
|
|
115
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { computed as c } from "vue";
|
|
2
|
+
import { DEFAULT_TABLE_COLUMNS as v } from "../constants/table.js";
|
|
3
|
+
function d(e) {
|
|
4
|
+
return e.type === "number" || e.type === "date" ? e.type : e.type === "select" ? "status" : "string";
|
|
5
|
+
}
|
|
6
|
+
function f(e) {
|
|
7
|
+
return {
|
|
8
|
+
key: e.id,
|
|
9
|
+
label: e.name,
|
|
10
|
+
width: e.width,
|
|
11
|
+
type: d(e)
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
function T(e) {
|
|
15
|
+
return { columns: c(() => {
|
|
16
|
+
var u, t, i, n, r, s, m, a;
|
|
17
|
+
return (t = (u = e.columns) == null ? void 0 : u.value) != null && t.length ? e.columns.value : (r = (n = (i = e.schema) == null ? void 0 : i.value) == null ? void 0 : n.fields) != null && r.length ? ((a = (m = (s = e.view) == null ? void 0 : s.value) == null ? void 0 : m.visibleFields) != null && a.length ? e.schema.value.fields.filter(
|
|
18
|
+
(l) => e.view.value.visibleFields.includes(l.id)
|
|
19
|
+
) : e.schema.value.fields).filter((l) => !l.hidden).map(f) : v;
|
|
20
|
+
}) };
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
T as useTableColumns
|
|
24
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { computed as d } from "vue";
|
|
2
|
+
function n(t) {
|
|
3
|
+
return { rows: d(() => {
|
|
4
|
+
var a, r, u;
|
|
5
|
+
return (r = (a = t.records) == null ? void 0 : a.value) != null && r.length ? t.records.value.map((e) => ({
|
|
6
|
+
id: e.id,
|
|
7
|
+
...e.fields,
|
|
8
|
+
createdAt: e.createdAt,
|
|
9
|
+
updatedAt: e.updatedAt,
|
|
10
|
+
__record: e
|
|
11
|
+
})) : ((u = t.tasks) == null ? void 0 : u.value) ?? [];
|
|
12
|
+
}) };
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
n as useTableData
|
|
16
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { shallowRef as m, ref as _, computed as p, readonly as g, triggerRef as o } from "vue";
|
|
2
|
+
const h = [
|
|
3
|
+
{ value: "contains", label: "包含" },
|
|
4
|
+
{ value: "not_contains", label: "不包含" },
|
|
5
|
+
{ value: "equals", label: "等于" },
|
|
6
|
+
{ value: "not_equals", label: "不等于" },
|
|
7
|
+
{ value: "starts_with", label: "开头是" },
|
|
8
|
+
{ value: "ends_with", label: "结尾是" },
|
|
9
|
+
{ value: "is_empty", label: "为空" },
|
|
10
|
+
{ value: "is_not_empty", label: "不为空" }
|
|
11
|
+
], y = [
|
|
12
|
+
{ value: "equals", label: "等于" },
|
|
13
|
+
{ value: "not_equals", label: "不等于" },
|
|
14
|
+
{ value: "gt", label: "大于" },
|
|
15
|
+
{ value: "gte", label: "大于等于" },
|
|
16
|
+
{ value: "lt", label: "小于" },
|
|
17
|
+
{ value: "lte", label: "小于等于" },
|
|
18
|
+
{ value: "is_empty", label: "为空" },
|
|
19
|
+
{ value: "is_not_empty", label: "不为空" }
|
|
20
|
+
];
|
|
21
|
+
function N() {
|
|
22
|
+
return Math.random().toString(36).slice(2, 8);
|
|
23
|
+
}
|
|
24
|
+
function w(n, e) {
|
|
25
|
+
const t = String(n ?? "").toLowerCase(), r = e.value.toLowerCase();
|
|
26
|
+
switch (e.operator) {
|
|
27
|
+
case "equals":
|
|
28
|
+
return t === r;
|
|
29
|
+
case "not_equals":
|
|
30
|
+
return t !== r;
|
|
31
|
+
case "contains":
|
|
32
|
+
return t.includes(r);
|
|
33
|
+
case "not_contains":
|
|
34
|
+
return !t.includes(r);
|
|
35
|
+
case "starts_with":
|
|
36
|
+
return t.startsWith(r);
|
|
37
|
+
case "ends_with":
|
|
38
|
+
return t.endsWith(r);
|
|
39
|
+
case "is_empty":
|
|
40
|
+
return t === "" || n == null;
|
|
41
|
+
case "is_not_empty":
|
|
42
|
+
return t !== "" && n != null;
|
|
43
|
+
case "gt":
|
|
44
|
+
return Number(n) > Number(e.value);
|
|
45
|
+
case "gte":
|
|
46
|
+
return Number(n) >= Number(e.value);
|
|
47
|
+
case "lt":
|
|
48
|
+
return Number(n) < Number(e.value);
|
|
49
|
+
case "lte":
|
|
50
|
+
return Number(n) <= Number(e.value);
|
|
51
|
+
default:
|
|
52
|
+
return !0;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function C(n = {}) {
|
|
56
|
+
const e = m([]), t = _("and"), r = p(() => e.value.length > 0);
|
|
57
|
+
function i(l) {
|
|
58
|
+
var u, a;
|
|
59
|
+
e.value.push({
|
|
60
|
+
id: N(),
|
|
61
|
+
field: l ?? ((a = (u = n.columns) == null ? void 0 : u[0]) == null ? void 0 : a.key) ?? "",
|
|
62
|
+
operator: "contains",
|
|
63
|
+
value: ""
|
|
64
|
+
}), o(e);
|
|
65
|
+
}
|
|
66
|
+
function c(l) {
|
|
67
|
+
e.value = e.value.filter((u) => u.id !== l), o(e);
|
|
68
|
+
}
|
|
69
|
+
function v(l, u) {
|
|
70
|
+
const a = e.value.findIndex((s) => s.id === l);
|
|
71
|
+
a !== -1 && (e.value[a] = { ...e.value[a], ...u }, o(e));
|
|
72
|
+
}
|
|
73
|
+
function b() {
|
|
74
|
+
e.value = [], o(e);
|
|
75
|
+
}
|
|
76
|
+
function d(l) {
|
|
77
|
+
return e.value.length ? l.filter((u) => {
|
|
78
|
+
const a = e.value.map((s) => s.field ? w(u[s.field], s) : !0);
|
|
79
|
+
return t.value === "and" ? a.every(Boolean) : a.some(Boolean);
|
|
80
|
+
}) : l;
|
|
81
|
+
}
|
|
82
|
+
const f = (l) => l === "number" ? y : h;
|
|
83
|
+
return {
|
|
84
|
+
conditions: g(e),
|
|
85
|
+
logic: t,
|
|
86
|
+
isActive: r,
|
|
87
|
+
addCondition: i,
|
|
88
|
+
removeCondition: c,
|
|
89
|
+
updateCondition: v,
|
|
90
|
+
clearConditions: b,
|
|
91
|
+
filterData: d,
|
|
92
|
+
operatorsFor: f
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
export {
|
|
96
|
+
C as useTableFilter
|
|
97
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ref as g, watch as w, computed as h } from "vue";
|
|
2
|
+
function y(a) {
|
|
3
|
+
const u = g(/* @__PURE__ */ new Set());
|
|
4
|
+
function l(e) {
|
|
5
|
+
const t = new Set(u.value);
|
|
6
|
+
t.has(e) ? t.delete(e) : t.add(e), u.value = t;
|
|
7
|
+
}
|
|
8
|
+
w(a.groupBy, () => {
|
|
9
|
+
u.value = /* @__PURE__ */ new Set();
|
|
10
|
+
});
|
|
11
|
+
const d = h(() => {
|
|
12
|
+
const e = a.data.value, t = a.groupBy.value;
|
|
13
|
+
if (!t)
|
|
14
|
+
return e.map((o) => ({ ...o, __type: "data-row" }));
|
|
15
|
+
const c = [], s = /* @__PURE__ */ new Map();
|
|
16
|
+
for (const o of e) {
|
|
17
|
+
const n = o[t], r = n != null ? String(n) : "";
|
|
18
|
+
s.has(r) || (c.push(r), s.set(r, [])), s.get(r).push(o);
|
|
19
|
+
}
|
|
20
|
+
const p = [], _ = u.value;
|
|
21
|
+
for (const o of c) {
|
|
22
|
+
const n = s.get(o);
|
|
23
|
+
if (p.push({
|
|
24
|
+
__type: "group-header",
|
|
25
|
+
__groupKey: o,
|
|
26
|
+
__groupCount: n.length,
|
|
27
|
+
id: `__group__${o}`
|
|
28
|
+
}), !_.has(o))
|
|
29
|
+
for (const r of n)
|
|
30
|
+
p.push({ ...r, __type: "data-row" });
|
|
31
|
+
}
|
|
32
|
+
return p;
|
|
33
|
+
});
|
|
34
|
+
function f(e) {
|
|
35
|
+
return e && e.__type === "group-header";
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
groupedItems: d,
|
|
39
|
+
collapsedGroups: u,
|
|
40
|
+
toggleGroup: l,
|
|
41
|
+
isGroupHeader: f
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export {
|
|
45
|
+
y as useTableGroup
|
|
46
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { reactive as d } from "vue";
|
|
2
|
+
const n = d([]);
|
|
3
|
+
let s = 0;
|
|
4
|
+
function u(t, e, r) {
|
|
5
|
+
const a = `toast-${Date.now()}-${s++}`, i = {
|
|
6
|
+
id: a,
|
|
7
|
+
type: t,
|
|
8
|
+
message: e,
|
|
9
|
+
title: r == null ? void 0 : r.title,
|
|
10
|
+
duration: (r == null ? void 0 : r.duration) ?? 3e3
|
|
11
|
+
};
|
|
12
|
+
return n.push(i), i.duration && i.duration > 0 && setTimeout(() => c(a), i.duration), a;
|
|
13
|
+
}
|
|
14
|
+
function c(t) {
|
|
15
|
+
const e = n.findIndex((r) => r.id === t);
|
|
16
|
+
e !== -1 && n.splice(e, 1);
|
|
17
|
+
}
|
|
18
|
+
function o() {
|
|
19
|
+
return {
|
|
20
|
+
/** 响应式 toast 列表 */
|
|
21
|
+
toasts: n,
|
|
22
|
+
/** 显示 info 类型通知 */
|
|
23
|
+
info: (t, e) => u("info", t, e),
|
|
24
|
+
/** 显示 success 类型通知 */
|
|
25
|
+
success: (t, e) => u("success", t, e),
|
|
26
|
+
/** 显示 warning 类型通知 */
|
|
27
|
+
warning: (t, e) => u("warning", t, e),
|
|
28
|
+
/** 显示 error 类型通知 */
|
|
29
|
+
error: (t, e) => u("error", t, e),
|
|
30
|
+
/** 移除指定 id 的 toast */
|
|
31
|
+
remove: c,
|
|
32
|
+
/** 清除所有 toast */
|
|
33
|
+
clear: () => n.splice(0, n.length)
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
o as useToast
|
|
38
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ref as h, readonly as g } from "vue";
|
|
2
|
+
function U(e = {}) {
|
|
3
|
+
const a = h(""), u = h(!1);
|
|
4
|
+
let f = "", r = 0, t = null, c = null;
|
|
5
|
+
const v = e.speed ?? 20;
|
|
6
|
+
function m() {
|
|
7
|
+
t !== null && (cancelAnimationFrame(t), t = null), c !== null && (clearTimeout(c), c = null);
|
|
8
|
+
}
|
|
9
|
+
function i() {
|
|
10
|
+
var l, n;
|
|
11
|
+
if (r >= f.length) {
|
|
12
|
+
u.value = !1, c = null, (l = e.onComplete) == null || l.call(e);
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
a.value = f.slice(0, ++r), (n = e.onUpdate) == null || n.call(e, a.value), u.value && (c = setTimeout(i, v));
|
|
16
|
+
}
|
|
17
|
+
function x() {
|
|
18
|
+
if (typeof document < "u" && document.hidden) {
|
|
19
|
+
i();
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
let l = 0;
|
|
23
|
+
function n(d) {
|
|
24
|
+
var T, y;
|
|
25
|
+
if (l || (l = d), d - l >= v) {
|
|
26
|
+
if (l = d, r >= f.length) {
|
|
27
|
+
u.value = !1, t = null, (T = e.onComplete) == null || T.call(e);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
a.value = f.slice(0, ++r), (y = e.onUpdate) == null || y.call(e, a.value);
|
|
31
|
+
}
|
|
32
|
+
u.value && (t = requestAnimationFrame(n));
|
|
33
|
+
}
|
|
34
|
+
t = requestAnimationFrame(n);
|
|
35
|
+
}
|
|
36
|
+
function A(l) {
|
|
37
|
+
f += l, u.value || (u.value = !0, x());
|
|
38
|
+
}
|
|
39
|
+
function C() {
|
|
40
|
+
m(), f = "", r = 0, a.value = "", u.value = !1;
|
|
41
|
+
}
|
|
42
|
+
function F() {
|
|
43
|
+
var l, n;
|
|
44
|
+
m(), a.value = f, r = f.length, u.value = !1, (l = e.onUpdate) == null || l.call(e, a.value), (n = e.onComplete) == null || n.call(e);
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
displayText: g(a),
|
|
48
|
+
isTyping: g(u),
|
|
49
|
+
append: A,
|
|
50
|
+
reset: C,
|
|
51
|
+
flush: F
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export {
|
|
55
|
+
U as useTypewriter
|
|
56
|
+
};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { ref as O, computed as f, watch as y, onUnmounted as U } from "vue";
|
|
2
|
+
function j({
|
|
3
|
+
items: l,
|
|
4
|
+
itemHeight: i,
|
|
5
|
+
overscan: E = 5,
|
|
6
|
+
containerRef: F
|
|
7
|
+
}) {
|
|
8
|
+
const o = O(0), s = O(0), h = typeof i == "number", v = Math.max(0, E);
|
|
9
|
+
let c = null, a = null;
|
|
10
|
+
const d = f(() => {
|
|
11
|
+
if (h) return [];
|
|
12
|
+
const t = new Array(l.value.length + 1).fill(0), n = i;
|
|
13
|
+
for (let e = 0; e < l.value.length; e += 1)
|
|
14
|
+
t[e + 1] = t[e] + Math.max(0, n(e));
|
|
15
|
+
return t;
|
|
16
|
+
}), M = f(() => h ? l.value.length * i : d.value[l.value.length] ?? 0);
|
|
17
|
+
function m(t) {
|
|
18
|
+
const n = Math.max(0, Math.min(t, l.value.length));
|
|
19
|
+
return h ? n * i : d.value[n] ?? 0;
|
|
20
|
+
}
|
|
21
|
+
function p(t) {
|
|
22
|
+
if (l.value.length === 0) return 0;
|
|
23
|
+
if (h) {
|
|
24
|
+
const u = i;
|
|
25
|
+
return Math.max(
|
|
26
|
+
0,
|
|
27
|
+
Math.min(l.value.length - 1, Math.floor(Math.max(0, t) / u))
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
const n = d.value;
|
|
31
|
+
let e = 0, r = l.value.length;
|
|
32
|
+
for (; e < r; ) {
|
|
33
|
+
const u = Math.floor((e + r) / 2);
|
|
34
|
+
n[u + 1] <= t ? e = u + 1 : r = u;
|
|
35
|
+
}
|
|
36
|
+
return Math.max(0, Math.min(e, l.value.length - 1));
|
|
37
|
+
}
|
|
38
|
+
const b = f(() => {
|
|
39
|
+
const t = l.value.length;
|
|
40
|
+
if (t === 0)
|
|
41
|
+
return { start: 0, end: 0 };
|
|
42
|
+
if (s.value <= 0)
|
|
43
|
+
return { start: 0, end: Math.min(t, v * 2 + 1) };
|
|
44
|
+
if (h) {
|
|
45
|
+
const x = i, C = Math.floor(o.value / x), B = Math.ceil(s.value / x), H = Math.max(0, C - v), A = Math.min(t, C + B + v);
|
|
46
|
+
return { start: H, end: A };
|
|
47
|
+
}
|
|
48
|
+
const n = Math.max(0, o.value), e = n + s.value, r = p(n), u = Math.min(t - 1, p(e));
|
|
49
|
+
return {
|
|
50
|
+
start: Math.max(0, r - v),
|
|
51
|
+
end: Math.min(t, u + v + 1)
|
|
52
|
+
};
|
|
53
|
+
}), L = f(() => m(b.value.start)), R = f(() => {
|
|
54
|
+
const { start: t, end: n } = b.value;
|
|
55
|
+
return l.value.slice(t, n).map((e, r) => ({
|
|
56
|
+
data: e,
|
|
57
|
+
index: t + r
|
|
58
|
+
}));
|
|
59
|
+
});
|
|
60
|
+
function g(t) {
|
|
61
|
+
if (!t) {
|
|
62
|
+
o.value = 0, s.value = 0;
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
o.value = t.scrollTop, s.value = t.clientHeight;
|
|
66
|
+
}
|
|
67
|
+
function T() {
|
|
68
|
+
a && (o.value = a.scrollTop);
|
|
69
|
+
}
|
|
70
|
+
function w() {
|
|
71
|
+
c == null || c.disconnect(), c = null;
|
|
72
|
+
}
|
|
73
|
+
function I(t) {
|
|
74
|
+
t && t.removeEventListener("scroll", T);
|
|
75
|
+
}
|
|
76
|
+
function S(t) {
|
|
77
|
+
if (!t) {
|
|
78
|
+
a = null, g(null);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
a = t, t.addEventListener("scroll", T, { passive: !0 }), g(t), typeof ResizeObserver < "u" && (c = new ResizeObserver(() => {
|
|
82
|
+
g(t);
|
|
83
|
+
}), c.observe(t));
|
|
84
|
+
}
|
|
85
|
+
y(
|
|
86
|
+
F,
|
|
87
|
+
(t, n) => {
|
|
88
|
+
I(n), w(), S(t);
|
|
89
|
+
},
|
|
90
|
+
{ immediate: !0 }
|
|
91
|
+
), y(l, () => {
|
|
92
|
+
const t = Math.max(0, M.value - s.value);
|
|
93
|
+
o.value > t && (o.value = t, a && (a.scrollTop = t));
|
|
94
|
+
});
|
|
95
|
+
function V(t) {
|
|
96
|
+
if (!a || l.value.length === 0) return;
|
|
97
|
+
const n = Math.max(0, Math.min(t, l.value.length - 1)), e = m(n);
|
|
98
|
+
a.scrollTop = e, o.value = e;
|
|
99
|
+
}
|
|
100
|
+
function z() {
|
|
101
|
+
if (!a) return;
|
|
102
|
+
const t = Math.max(0, M.value - a.clientHeight);
|
|
103
|
+
a.scrollTop = t, o.value = t;
|
|
104
|
+
}
|
|
105
|
+
return U(() => {
|
|
106
|
+
I(a), w(), a = null;
|
|
107
|
+
}), {
|
|
108
|
+
visibleItems: R,
|
|
109
|
+
totalHeight: M,
|
|
110
|
+
offsetY: L,
|
|
111
|
+
scrollToIndex: V,
|
|
112
|
+
scrollToBottom: z
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
export {
|
|
116
|
+
j as useVirtualList
|
|
117
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const l = [
|
|
2
|
+
{ key: "id", label: "任务ID", width: 100, align: "left" },
|
|
3
|
+
{ key: "title", label: "标题", width: "fill", minWidth: 220, align: "left" },
|
|
4
|
+
{ key: "status", label: "状态", width: 90, align: "left" },
|
|
5
|
+
{ key: "role", label: "负责角色", width: 90, align: "left" },
|
|
6
|
+
{ key: "priority", label: "优先级", width: 70, align: "left" },
|
|
7
|
+
{ key: "updatedAt", label: "更新时间", width: 100, align: "left" }
|
|
8
|
+
];
|
|
9
|
+
export {
|
|
10
|
+
l as DEFAULT_TABLE_COLUMNS
|
|
11
|
+
};
|