@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,185 @@
|
|
|
1
|
+
import { defineComponent as Y, computed as o, ref as G, watch as N, openBlock as d, createElementBlock as f, normalizeStyle as _, createElementVNode as w, Fragment as M, renderList as T, normalizeClass as A, toDisplayString as W, createCommentVNode as R, createBlock as j } from "vue";
|
|
2
|
+
import q from "./GanttRow.vue.js";
|
|
3
|
+
import { taskToDataRecord as J } from "../../types/index.js";
|
|
4
|
+
const K = { class: "gantt-timeline__header" }, P = { class: "gantt-timeline__rows" }, Q = {
|
|
5
|
+
key: 0,
|
|
6
|
+
class: "gantt-timeline__empty"
|
|
7
|
+
}, m = 40, tt = /* @__PURE__ */ Y({
|
|
8
|
+
__name: "GanttTimeline",
|
|
9
|
+
props: {
|
|
10
|
+
records: {},
|
|
11
|
+
schema: {},
|
|
12
|
+
viewConfig: {},
|
|
13
|
+
startFieldId: { default: "startDate" },
|
|
14
|
+
endFieldId: { default: "endDate" },
|
|
15
|
+
labelFieldId: { default: "title" },
|
|
16
|
+
items: {},
|
|
17
|
+
data: {},
|
|
18
|
+
startDate: {},
|
|
19
|
+
days: { default: 30 }
|
|
20
|
+
},
|
|
21
|
+
emits: ["row-click", "record-change", "update:records"],
|
|
22
|
+
setup(b, { emit: z }) {
|
|
23
|
+
const r = b, x = z;
|
|
24
|
+
function l(t) {
|
|
25
|
+
return /* @__PURE__ */ new Date(`${t}T00:00:00`);
|
|
26
|
+
}
|
|
27
|
+
function p(t) {
|
|
28
|
+
const e = t.getFullYear(), a = String(t.getMonth() + 1).padStart(2, "0"), n = String(t.getDate()).padStart(2, "0");
|
|
29
|
+
return `${e}-${a}-${n}`;
|
|
30
|
+
}
|
|
31
|
+
function h(t, e) {
|
|
32
|
+
return Math.round((l(e).getTime() - l(t).getTime()) / 864e5);
|
|
33
|
+
}
|
|
34
|
+
function v(t, e) {
|
|
35
|
+
const a = l(t), n = new Date(a);
|
|
36
|
+
return n.setDate(a.getDate() + e), p(n);
|
|
37
|
+
}
|
|
38
|
+
function S(t) {
|
|
39
|
+
if (typeof t != "string" || !t) return null;
|
|
40
|
+
const e = t.match(/^(\d{4}-\d{2}-\d{2})/);
|
|
41
|
+
return e ? e[1] : null;
|
|
42
|
+
}
|
|
43
|
+
function I() {
|
|
44
|
+
const t = /* @__PURE__ */ new Date();
|
|
45
|
+
return `${t.getFullYear()}-${String(t.getMonth() + 1).padStart(2, "0")}-01`;
|
|
46
|
+
}
|
|
47
|
+
const $ = o(() => {
|
|
48
|
+
var t, e;
|
|
49
|
+
return (t = r.records) != null && t.length ? r.records : (e = r.data) != null && e.length ? r.data.map(J) : [];
|
|
50
|
+
}), D = o(() => {
|
|
51
|
+
var t, e;
|
|
52
|
+
if ((t = r.records) != null && t.length || (e = r.data) != null && e.length) {
|
|
53
|
+
const a = [];
|
|
54
|
+
for (const n of $.value) {
|
|
55
|
+
const i = S(n.fields[r.startFieldId]), c = S(n.fields[r.endFieldId]), s = n.fields[r.labelFieldId];
|
|
56
|
+
!i || !c || a.push({
|
|
57
|
+
id: n.id,
|
|
58
|
+
sourceRecordId: n.id,
|
|
59
|
+
title: typeof s == "string" && s ? s : n.id,
|
|
60
|
+
status: typeof n.fields.status == "string" ? n.fields.status : "",
|
|
61
|
+
priority: typeof n.fields.priority == "string" ? n.fields.priority : "",
|
|
62
|
+
startDate: i,
|
|
63
|
+
endDate: c
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
return a;
|
|
67
|
+
}
|
|
68
|
+
return (r.items ?? []).map((a) => ({
|
|
69
|
+
id: a.id,
|
|
70
|
+
title: a.title,
|
|
71
|
+
status: a.status,
|
|
72
|
+
priority: a.priority,
|
|
73
|
+
startDate: a.startDate,
|
|
74
|
+
endDate: a.endDate,
|
|
75
|
+
barColor: a.barColor
|
|
76
|
+
}));
|
|
77
|
+
}), B = o(() => {
|
|
78
|
+
if (!D.value.length) return r.startDate || I();
|
|
79
|
+
const t = Math.min(
|
|
80
|
+
...D.value.map((a) => l(a.startDate).getTime())
|
|
81
|
+
), e = new Date(t);
|
|
82
|
+
return e.setDate(e.getDate() - 1), p(e);
|
|
83
|
+
}), E = o(() => {
|
|
84
|
+
if (!D.value.length)
|
|
85
|
+
return v(r.startDate || I(), r.days - 1);
|
|
86
|
+
const t = Math.max(...D.value.map((a) => l(a.endDate).getTime())), e = new Date(t);
|
|
87
|
+
return e.setDate(e.getDate() + 1), p(e);
|
|
88
|
+
}), g = o(() => r.startDate || B.value), y = o(() => r.startDate ? r.days : Math.max(r.days, h(g.value, E.value) + 1)), L = o(() => {
|
|
89
|
+
const t = [];
|
|
90
|
+
for (let e = 0; e < y.value; e++)
|
|
91
|
+
t.push(v(g.value, e));
|
|
92
|
+
return t;
|
|
93
|
+
}), u = G([]);
|
|
94
|
+
N(
|
|
95
|
+
D,
|
|
96
|
+
(t) => {
|
|
97
|
+
u.value = t.map((e) => ({ ...e }));
|
|
98
|
+
},
|
|
99
|
+
{ immediate: !0 }
|
|
100
|
+
);
|
|
101
|
+
const k = o(() => {
|
|
102
|
+
const t = g.value, e = y.value;
|
|
103
|
+
return u.value.map((a) => {
|
|
104
|
+
const n = Math.max(0, h(t, a.startDate)), i = Math.max(n, h(t, a.endDate)), c = Math.max(1, i - n + 1);
|
|
105
|
+
return { row: a, offsetDays: Math.min(n, e - 1), durationDays: c };
|
|
106
|
+
});
|
|
107
|
+
}), C = p(/* @__PURE__ */ new Date());
|
|
108
|
+
function H(t) {
|
|
109
|
+
return t === C;
|
|
110
|
+
}
|
|
111
|
+
function O(t) {
|
|
112
|
+
const e = l(t);
|
|
113
|
+
return `${String(e.getMonth() + 1).padStart(2, "0")}/${String(e.getDate()).padStart(2, "0")}`;
|
|
114
|
+
}
|
|
115
|
+
const F = o(() => {
|
|
116
|
+
const t = h(g.value, C);
|
|
117
|
+
return t < 0 || t > y.value - 1 ? null : t * m + m / 2;
|
|
118
|
+
});
|
|
119
|
+
function V(t) {
|
|
120
|
+
const e = u.value.findIndex((s) => s.id === t.id);
|
|
121
|
+
if (e === -1) return;
|
|
122
|
+
const a = v(g.value, t.offsetDays), n = v(a, t.durationDays - 1);
|
|
123
|
+
u.value[e] = {
|
|
124
|
+
...u.value[e],
|
|
125
|
+
startDate: a,
|
|
126
|
+
endDate: n
|
|
127
|
+
};
|
|
128
|
+
const i = u.value[e].sourceRecordId;
|
|
129
|
+
if (!i) return;
|
|
130
|
+
x("record-change", {
|
|
131
|
+
recordId: i,
|
|
132
|
+
startDate: a,
|
|
133
|
+
endDate: n
|
|
134
|
+
});
|
|
135
|
+
const c = $.value.map((s) => s.id !== i ? s : {
|
|
136
|
+
...s,
|
|
137
|
+
fields: {
|
|
138
|
+
...s.fields,
|
|
139
|
+
[r.startFieldId]: a,
|
|
140
|
+
[r.endFieldId]: n
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
x("update:records", c);
|
|
144
|
+
}
|
|
145
|
+
return (t, e) => (d(), f("div", {
|
|
146
|
+
class: "gantt-timeline",
|
|
147
|
+
style: _({ "--day-width": `${m}px` })
|
|
148
|
+
}, [
|
|
149
|
+
w("div", K, [
|
|
150
|
+
e[0] || (e[0] = w("div", { class: "gantt-timeline__header-label" }, "任务", -1)),
|
|
151
|
+
w("div", {
|
|
152
|
+
class: "gantt-timeline__header-dates",
|
|
153
|
+
style: _({ width: `${y.value * m}px` })
|
|
154
|
+
}, [
|
|
155
|
+
(d(!0), f(M, null, T(L.value, (a) => (d(), f("div", {
|
|
156
|
+
key: a,
|
|
157
|
+
class: A(["gantt-timeline__header-cell", { "gantt-timeline__header-cell--today": H(a) }]),
|
|
158
|
+
style: _({ width: `${m}px` })
|
|
159
|
+
}, W(O(a)), 7))), 128)),
|
|
160
|
+
F.value !== null ? (d(), f("div", {
|
|
161
|
+
key: 0,
|
|
162
|
+
class: "gantt-timeline__today-line",
|
|
163
|
+
style: _({ left: `${F.value}px` })
|
|
164
|
+
}, null, 4)) : R("", !0)
|
|
165
|
+
], 4)
|
|
166
|
+
]),
|
|
167
|
+
w("div", P, [
|
|
168
|
+
(d(!0), f(M, null, T(k.value, (a) => (d(), j(q, {
|
|
169
|
+
key: a.row.id,
|
|
170
|
+
item: a.row,
|
|
171
|
+
"offset-days": a.offsetDays,
|
|
172
|
+
"duration-days": a.durationDays,
|
|
173
|
+
"day-width": m,
|
|
174
|
+
"total-days": y.value,
|
|
175
|
+
onChange: V,
|
|
176
|
+
onClick: (n) => x("row-click", a.row)
|
|
177
|
+
}, null, 8, ["item", "offset-days", "duration-days", "total-days", "onClick"]))), 128)),
|
|
178
|
+
k.value.length === 0 ? (d(), f("div", Q, "暂无任务数据")) : R("", !0)
|
|
179
|
+
])
|
|
180
|
+
], 4));
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
export {
|
|
184
|
+
tt as default
|
|
185
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { defineComponent as s, openBlock as t, createBlock as o, Teleport as i, createElementVNode as l, createVNode as c, TransitionGroup as m, withCtx as d, createElementBlock as f, Fragment as p, renderList as u, unref as r } from "vue";
|
|
2
|
+
import { useToast as _ } from "../../composables/useToast.js";
|
|
3
|
+
import v from "./ToastItem.vue.js";
|
|
4
|
+
const C = {
|
|
5
|
+
class: "of-toast-container",
|
|
6
|
+
"aria-live": "polite",
|
|
7
|
+
"aria-atomic": "false"
|
|
8
|
+
}, E = /* @__PURE__ */ s({
|
|
9
|
+
__name: "ToastContainer",
|
|
10
|
+
setup(T) {
|
|
11
|
+
const { toasts: a, remove: n } = _();
|
|
12
|
+
return (k, h) => (t(), o(i, { to: "body" }, [
|
|
13
|
+
l("div", C, [
|
|
14
|
+
c(m, {
|
|
15
|
+
name: "of-toast",
|
|
16
|
+
tag: "div",
|
|
17
|
+
class: "of-toast-list"
|
|
18
|
+
}, {
|
|
19
|
+
default: d(() => [
|
|
20
|
+
(t(!0), f(p, null, u(r(a), (e) => (t(), o(v, {
|
|
21
|
+
key: e.id,
|
|
22
|
+
toast: e,
|
|
23
|
+
onClose: (x) => r(n)(e.id)
|
|
24
|
+
}, null, 8, ["toast", "onClose"]))), 128))
|
|
25
|
+
]),
|
|
26
|
+
_: 1
|
|
27
|
+
})
|
|
28
|
+
])
|
|
29
|
+
]));
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
export {
|
|
33
|
+
E as default
|
|
34
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { defineComponent as m, computed as a, openBlock as l, createElementBlock as s, normalizeStyle as g, normalizeClass as C, createElementVNode as r, createBlock as _, resolveDynamicComponent as p, toDisplayString as n, createCommentVNode as y, createVNode as k, unref as h } from "vue";
|
|
2
|
+
import { XCircle as L, AlertTriangle as z, CheckCircle2 as $, Info as B, X as I } from "lucide-vue-next";
|
|
3
|
+
const N = ["role", "aria-label"], V = { class: "of-toast__icon" }, w = { class: "of-toast__content" }, x = {
|
|
4
|
+
key: 0,
|
|
5
|
+
class: "of-toast__title"
|
|
6
|
+
}, D = { class: "of-toast__message" }, X = /* @__PURE__ */ m({
|
|
7
|
+
__name: "ToastItem",
|
|
8
|
+
props: {
|
|
9
|
+
toast: {}
|
|
10
|
+
},
|
|
11
|
+
emits: ["close"],
|
|
12
|
+
setup(o, { emit: f }) {
|
|
13
|
+
const t = o, i = f, d = {
|
|
14
|
+
info: B,
|
|
15
|
+
success: $,
|
|
16
|
+
warning: z,
|
|
17
|
+
error: L
|
|
18
|
+
}, b = {
|
|
19
|
+
info: {
|
|
20
|
+
icon: "var(--of-color-blue-500, #3b82f6)",
|
|
21
|
+
border: "var(--of-color-blue-200, #bfdbfe)",
|
|
22
|
+
borderLeft: "var(--of-color-blue-500, #3b82f6)",
|
|
23
|
+
bg: "var(--of-color-blue-50, #eff6ff)"
|
|
24
|
+
},
|
|
25
|
+
success: {
|
|
26
|
+
icon: "var(--of-color-green-500, #22c55e)",
|
|
27
|
+
border: "var(--of-color-green-200, #bbf7d0)",
|
|
28
|
+
borderLeft: "var(--of-color-green-500, #22c55e)",
|
|
29
|
+
bg: "var(--of-color-green-50, #f0fdf4)"
|
|
30
|
+
},
|
|
31
|
+
warning: {
|
|
32
|
+
icon: "var(--of-color-orange-500, #f97316)",
|
|
33
|
+
border: "var(--of-color-orange-200, #fed7aa)",
|
|
34
|
+
borderLeft: "var(--of-color-orange-500, #f97316)",
|
|
35
|
+
bg: "var(--of-color-orange-50, #fff7ed)"
|
|
36
|
+
},
|
|
37
|
+
error: {
|
|
38
|
+
icon: "var(--of-color-red-500, #ef4444)",
|
|
39
|
+
border: "var(--of-color-red-200, #fecaca)",
|
|
40
|
+
borderLeft: "var(--of-color-red-500, #ef4444)",
|
|
41
|
+
bg: "var(--of-color-red-50, #fef2f2)"
|
|
42
|
+
}
|
|
43
|
+
}, v = a(() => d[t.toast.type]), e = a(() => b[t.toast.type]), u = a(() => t.toast.type === "error" ? "alertdialog" : "alert");
|
|
44
|
+
return (E, c) => (l(), s("div", {
|
|
45
|
+
class: C(["of-toast", `of-toast--${o.toast.type}`]),
|
|
46
|
+
style: g({
|
|
47
|
+
borderColor: e.value.border,
|
|
48
|
+
borderLeftColor: e.value.borderLeft,
|
|
49
|
+
backgroundColor: e.value.bg
|
|
50
|
+
}),
|
|
51
|
+
role: u.value,
|
|
52
|
+
"aria-label": `${o.toast.type}: ${o.toast.message}`
|
|
53
|
+
}, [
|
|
54
|
+
r("div", V, [
|
|
55
|
+
(l(), _(p(v.value), {
|
|
56
|
+
size: 20,
|
|
57
|
+
color: e.value.icon,
|
|
58
|
+
"aria-hidden": "true"
|
|
59
|
+
}, null, 8, ["color"]))
|
|
60
|
+
]),
|
|
61
|
+
r("div", w, [
|
|
62
|
+
o.toast.title ? (l(), s("p", x, n(o.toast.title), 1)) : y("", !0),
|
|
63
|
+
r("p", D, n(o.toast.message), 1)
|
|
64
|
+
]),
|
|
65
|
+
r("button", {
|
|
66
|
+
class: "of-toast__close",
|
|
67
|
+
type: "button",
|
|
68
|
+
"aria-label": "关闭通知",
|
|
69
|
+
onClick: c[0] || (c[0] = (M) => i("close"))
|
|
70
|
+
}, [
|
|
71
|
+
k(h(I), { size: 16 })
|
|
72
|
+
])
|
|
73
|
+
], 14, N));
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
export {
|
|
77
|
+
X as default
|
|
78
|
+
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { shallowRef as A, ref as o, readonly as m, triggerRef as f } from "vue";
|
|
2
|
+
import { useStream as D } from "./useStream.js";
|
|
3
|
+
import { useTypewriter as I } from "./useTypewriter.js";
|
|
4
|
+
function g() {
|
|
5
|
+
return Date.now().toString(36) + Math.random().toString(36).slice(2, 6);
|
|
6
|
+
}
|
|
7
|
+
function E(r) {
|
|
8
|
+
const a = A([]), s = o(!1), n = o(null), l = r.typewriter ? I({
|
|
9
|
+
speed: r.typewriterSpeed ?? 15,
|
|
10
|
+
onUpdate: (e) => {
|
|
11
|
+
if (n.value) {
|
|
12
|
+
const t = a.value.findIndex((u) => u.id === n.value);
|
|
13
|
+
t !== -1 && (a.value[t].content = e, f(a));
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}) : null;
|
|
17
|
+
function h(e) {
|
|
18
|
+
const t = {
|
|
19
|
+
id: g(),
|
|
20
|
+
role: "user",
|
|
21
|
+
content: e,
|
|
22
|
+
timestamp: (/* @__PURE__ */ new Date()).toLocaleTimeString("zh-CN", { hour: "2-digit", minute: "2-digit" })
|
|
23
|
+
};
|
|
24
|
+
return a.value.push(t), f(a), t;
|
|
25
|
+
}
|
|
26
|
+
function S() {
|
|
27
|
+
const e = {
|
|
28
|
+
id: g(),
|
|
29
|
+
role: "ai",
|
|
30
|
+
content: "",
|
|
31
|
+
isStreaming: !0,
|
|
32
|
+
timestamp: (/* @__PURE__ */ new Date()).toLocaleTimeString("zh-CN", { hour: "2-digit", minute: "2-digit" })
|
|
33
|
+
};
|
|
34
|
+
return a.value.push(e), f(a), n.value = e.id, e;
|
|
35
|
+
}
|
|
36
|
+
function c(e, t) {
|
|
37
|
+
const u = a.value.findIndex((i) => i.id === e);
|
|
38
|
+
u !== -1 && (a.value[u] = { ...a.value[u], ...t }, f(a));
|
|
39
|
+
}
|
|
40
|
+
function d(e, t) {
|
|
41
|
+
const u = a.value.findIndex((i) => i.id === e);
|
|
42
|
+
u !== -1 && (a.value[u].content += t, f(a));
|
|
43
|
+
}
|
|
44
|
+
const {
|
|
45
|
+
start: w,
|
|
46
|
+
cancel: p,
|
|
47
|
+
isStreaming: x
|
|
48
|
+
} = D({
|
|
49
|
+
mode: r.parseChunk ? "sse" : "raw",
|
|
50
|
+
onData: r.parseChunk ? (e) => {
|
|
51
|
+
const t = r.parseChunk(e);
|
|
52
|
+
t && n.value && (l ? l.append(t) : d(n.value, t));
|
|
53
|
+
} : void 0,
|
|
54
|
+
onChunk: r.parseChunk ? void 0 : (e) => {
|
|
55
|
+
n.value && (l ? l.append(e) : d(n.value, e));
|
|
56
|
+
},
|
|
57
|
+
onDone: () => {
|
|
58
|
+
n.value && (l && l.flush(), c(n.value, { isStreaming: !1 })), s.value = !1, n.value = null;
|
|
59
|
+
},
|
|
60
|
+
onError: (e) => {
|
|
61
|
+
var t;
|
|
62
|
+
n.value && c(n.value, {
|
|
63
|
+
isStreaming: !1,
|
|
64
|
+
error: !0,
|
|
65
|
+
content: `错误:${e.message}`
|
|
66
|
+
}), s.value = !1, n.value = null, (t = r.onError) == null || t.call(r, e);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
async function C(e) {
|
|
70
|
+
var u;
|
|
71
|
+
if (s.value || !e.trim()) return;
|
|
72
|
+
h(e);
|
|
73
|
+
const t = S();
|
|
74
|
+
s.value = !0, l && l.reset();
|
|
75
|
+
try {
|
|
76
|
+
const i = await r.sendRequest(e, a.value.slice(0, -2)), M = i instanceof Response ? i.body : i;
|
|
77
|
+
await w(M);
|
|
78
|
+
} catch (i) {
|
|
79
|
+
c(t.id, {
|
|
80
|
+
isStreaming: !1,
|
|
81
|
+
error: !0,
|
|
82
|
+
content: `请求失败:${i.message}`
|
|
83
|
+
}), s.value = !1, n.value = null, (u = r.onError) == null || u.call(r, i);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function v() {
|
|
87
|
+
p(), n.value && c(n.value, { isStreaming: !1 }), s.value = !1, n.value = null;
|
|
88
|
+
}
|
|
89
|
+
function y() {
|
|
90
|
+
v(), a.value = [], f(a);
|
|
91
|
+
}
|
|
92
|
+
return {
|
|
93
|
+
messages: m(a),
|
|
94
|
+
isGenerating: m(s),
|
|
95
|
+
isStreaming: x,
|
|
96
|
+
send: C,
|
|
97
|
+
cancel: v,
|
|
98
|
+
clear: y
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
export {
|
|
102
|
+
E as useAiChat
|
|
103
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
const a = {
|
|
2
|
+
P0: { text: "var(--of-priority-p0-text)", bg: "var(--of-priority-p0-bg)", label: "P0" },
|
|
3
|
+
P1: { text: "var(--of-priority-p1-text)", bg: "var(--of-priority-p1-bg)", label: "P1" },
|
|
4
|
+
P2: { text: "var(--of-priority-p2-text)", bg: "var(--of-priority-p2-bg)", label: "P2" },
|
|
5
|
+
P3: { text: "var(--of-priority-p3-text)", bg: "var(--of-priority-p3-bg)", label: "P3" }
|
|
6
|
+
}, r = {
|
|
7
|
+
todo: { text: "var(--of-status-todo-text)", bg: "var(--of-status-todo-bg)", label: "待处理" },
|
|
8
|
+
in_progress: {
|
|
9
|
+
text: "var(--of-status-in-progress-text)",
|
|
10
|
+
bg: "var(--of-status-in-progress-bg)",
|
|
11
|
+
label: "进行中"
|
|
12
|
+
},
|
|
13
|
+
blocked: {
|
|
14
|
+
text: "var(--of-status-blocked-text)",
|
|
15
|
+
bg: "var(--of-status-blocked-bg)",
|
|
16
|
+
label: "已阻塞",
|
|
17
|
+
dot: "var(--of-status-blocked-text)"
|
|
18
|
+
},
|
|
19
|
+
done: { text: "var(--of-status-done-text)", bg: "var(--of-status-done-bg)", label: "已完成" },
|
|
20
|
+
// 常见英文别名
|
|
21
|
+
pending: { text: "var(--of-status-todo-text)", bg: "var(--of-status-todo-bg)", label: "Pending" },
|
|
22
|
+
open: {
|
|
23
|
+
text: "var(--of-status-in-progress-text)",
|
|
24
|
+
bg: "var(--of-status-in-progress-bg)",
|
|
25
|
+
label: "Open"
|
|
26
|
+
},
|
|
27
|
+
closed: { text: "var(--of-status-done-text)", bg: "var(--of-status-done-bg)", label: "Closed" },
|
|
28
|
+
cancelled: {
|
|
29
|
+
text: "var(--of-status-cancelled-text)",
|
|
30
|
+
bg: "var(--of-status-cancelled-bg)",
|
|
31
|
+
label: "Cancelled"
|
|
32
|
+
},
|
|
33
|
+
// 常见中文 key
|
|
34
|
+
待处理: { text: "var(--of-status-todo-text)", bg: "var(--of-status-todo-bg)", label: "待处理" },
|
|
35
|
+
进行中: {
|
|
36
|
+
text: "var(--of-status-in-progress-text)",
|
|
37
|
+
bg: "var(--of-status-in-progress-bg)",
|
|
38
|
+
label: "进行中"
|
|
39
|
+
},
|
|
40
|
+
已阻塞: {
|
|
41
|
+
text: "var(--of-status-blocked-text)",
|
|
42
|
+
bg: "var(--of-status-blocked-bg)",
|
|
43
|
+
label: "已阻塞",
|
|
44
|
+
dot: "var(--of-status-blocked-text)"
|
|
45
|
+
},
|
|
46
|
+
已完成: { text: "var(--of-status-done-text)", bg: "var(--of-status-done-bg)", label: "已完成" }
|
|
47
|
+
}, s = {
|
|
48
|
+
text: "var(--of-badge-gray-text)",
|
|
49
|
+
bg: "var(--of-badge-gray-bg)"
|
|
50
|
+
};
|
|
51
|
+
function b(t, e) {
|
|
52
|
+
const o = e[t] ?? s;
|
|
53
|
+
return {
|
|
54
|
+
style: { color: o.text, background: o.bg },
|
|
55
|
+
label: o.label ?? t,
|
|
56
|
+
dot: o.dot
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function l(t, e) {
|
|
60
|
+
return e ? { ...t, ...e } : t;
|
|
61
|
+
}
|
|
62
|
+
function g() {
|
|
63
|
+
return {
|
|
64
|
+
DEFAULT_PRIORITY_MAP: a,
|
|
65
|
+
DEFAULT_STATUS_MAP: r,
|
|
66
|
+
resolveBadge: b,
|
|
67
|
+
mergeColorMap: l
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
export {
|
|
71
|
+
a as DEFAULT_PRIORITY_MAP,
|
|
72
|
+
r as DEFAULT_STATUS_MAP,
|
|
73
|
+
l as mergeColorMap,
|
|
74
|
+
b as resolveBadge,
|
|
75
|
+
g as useBadge
|
|
76
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ref as t, onMounted as s, onUnmounted as r } from "vue";
|
|
2
|
+
function a() {
|
|
3
|
+
const o = t(!1), i = t(!1);
|
|
4
|
+
function e() {
|
|
5
|
+
const n = window.innerWidth;
|
|
6
|
+
o.value = n < 768, i.value = n >= 768 && n < 1024;
|
|
7
|
+
}
|
|
8
|
+
return s(() => {
|
|
9
|
+
e(), window.addEventListener("resize", e, { passive: !0 });
|
|
10
|
+
}), r(() => {
|
|
11
|
+
window.removeEventListener("resize", e);
|
|
12
|
+
}), { isMobile: o, isTablet: i, isDesktop: t(!0) };
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
a as useBreakpoint
|
|
16
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { readonly as c, ref as f } from "vue";
|
|
2
|
+
const n = f(null);
|
|
3
|
+
function I() {
|
|
4
|
+
function o(e, l) {
|
|
5
|
+
n.value = { rowId: e, fieldId: l };
|
|
6
|
+
}
|
|
7
|
+
function r(e, l, u) {
|
|
8
|
+
var i, t;
|
|
9
|
+
return ((i = n.value) == null ? void 0 : i.rowId) === e && ((t = n.value) == null ? void 0 : t.fieldId) === l && (n.value = null), u;
|
|
10
|
+
}
|
|
11
|
+
function a() {
|
|
12
|
+
n.value = null;
|
|
13
|
+
}
|
|
14
|
+
function d(e, l) {
|
|
15
|
+
var u, i;
|
|
16
|
+
return ((u = n.value) == null ? void 0 : u.rowId) === e && ((i = n.value) == null ? void 0 : i.fieldId) === l;
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
editingCell: c(n),
|
|
20
|
+
activate: o,
|
|
21
|
+
commit: r,
|
|
22
|
+
cancel: a,
|
|
23
|
+
isEditing: d
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
I as useInlineEdit
|
|
28
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { marked as o } from "marked";
|
|
2
|
+
import e from "../node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/core.js";
|
|
3
|
+
import l from "../node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/es/languages/javascript.js";
|
|
4
|
+
import p from "../node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/es/languages/typescript.js";
|
|
5
|
+
import u from "../node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/es/languages/python.js";
|
|
6
|
+
import n from "../node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/es/languages/bash.js";
|
|
7
|
+
import j from "../node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/es/languages/json.js";
|
|
8
|
+
import w from "../node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/es/languages/sql.js";
|
|
9
|
+
import c from "../node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/es/languages/xml.js";
|
|
10
|
+
import k from "../node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/es/languages/css.js";
|
|
11
|
+
import f from "../node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/es/languages/markdown.js";
|
|
12
|
+
import L from "../node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/es/languages/yaml.js";
|
|
13
|
+
import $ from "../node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/es/languages/java.js";
|
|
14
|
+
import q from "../node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/es/languages/go.js";
|
|
15
|
+
import B from "../node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/es/languages/rust.js";
|
|
16
|
+
import i from "../node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/es/languages/plaintext.js";
|
|
17
|
+
e.registerLanguage("plaintext", i);
|
|
18
|
+
e.registerLanguage("text", i);
|
|
19
|
+
e.registerLanguage("txt", i);
|
|
20
|
+
e.registerLanguage("javascript", l);
|
|
21
|
+
e.registerLanguage("js", l);
|
|
22
|
+
e.registerLanguage("typescript", p);
|
|
23
|
+
e.registerLanguage("ts", p);
|
|
24
|
+
e.registerLanguage("python", u);
|
|
25
|
+
e.registerLanguage("py", u);
|
|
26
|
+
e.registerLanguage("bash", n);
|
|
27
|
+
e.registerLanguage("sh", n);
|
|
28
|
+
e.registerLanguage("shell", n);
|
|
29
|
+
e.registerLanguage("json", j);
|
|
30
|
+
e.registerLanguage("sql", w);
|
|
31
|
+
e.registerLanguage("xml", c);
|
|
32
|
+
e.registerLanguage("html", c);
|
|
33
|
+
e.registerLanguage("css", k);
|
|
34
|
+
e.registerLanguage("markdown", f);
|
|
35
|
+
e.registerLanguage("md", f);
|
|
36
|
+
e.registerLanguage("yaml", L);
|
|
37
|
+
e.registerLanguage("yml", L);
|
|
38
|
+
e.registerLanguage("java", $);
|
|
39
|
+
e.registerLanguage("go", q);
|
|
40
|
+
e.registerLanguage("rust", B);
|
|
41
|
+
function Q(h = {}) {
|
|
42
|
+
const { showCopyButton: d = !1, t: y = (r) => r } = h, s = new o.Renderer();
|
|
43
|
+
s.code = function(r, x) {
|
|
44
|
+
const m = typeof r == "object" ? r.text || "" : r, t = typeof r == "object" ? r.lang || "" : x || "", a = t && e.getLanguage(t) ? t : "plaintext";
|
|
45
|
+
let g = "";
|
|
46
|
+
try {
|
|
47
|
+
g = e.highlight(m, { language: a }).value;
|
|
48
|
+
} catch {
|
|
49
|
+
g = e.highlight(m, { language: "plaintext" }).value;
|
|
50
|
+
}
|
|
51
|
+
const v = d ? `<button onclick="navigator.clipboard.writeText(this.parentElement.nextElementSibling.innerText)" class="of-markdown-copy-btn">${y("common.copy")}</button>` : "";
|
|
52
|
+
return `<div class="of-code-block-wrapper">
|
|
53
|
+
<div class="of-code-block-header">
|
|
54
|
+
<span class="of-code-block-lang">${a}</span>
|
|
55
|
+
${v}
|
|
56
|
+
</div>
|
|
57
|
+
<pre class="of-code-block-pre"><code class="hljs language-${a}">${g}</code></pre>
|
|
58
|
+
</div>`;
|
|
59
|
+
}, o.use({ renderer: s });
|
|
60
|
+
function b(r) {
|
|
61
|
+
return o.parse(r);
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
renderMarkdown: b
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
export {
|
|
68
|
+
Q as useMarkdown
|
|
69
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { ref as y, readonly as b } from "vue";
|
|
2
|
+
function P(e = {}) {
|
|
3
|
+
const t = y(!1), c = y(!1), k = y(null), l = y(0);
|
|
4
|
+
let r = null, n = "";
|
|
5
|
+
async function O(q) {
|
|
6
|
+
var x, I, R, T, A, B, C, E, F;
|
|
7
|
+
c.value = !0, t.value = !1, k.value = null, n = "", r = new AbortController();
|
|
8
|
+
let w = null;
|
|
9
|
+
e.timeout && e.timeout > 0 && (w = setTimeout(() => {
|
|
10
|
+
r == null || r.abort();
|
|
11
|
+
}, e.timeout));
|
|
12
|
+
let m = "", v = [], D = !1;
|
|
13
|
+
const S = () => {
|
|
14
|
+
var a, u;
|
|
15
|
+
if (m && ((a = e.onChunk) == null || a.call(e, m), m = ""), v.length > 0) {
|
|
16
|
+
for (const f of v)
|
|
17
|
+
(u = e.onData) == null || u.call(e, f);
|
|
18
|
+
v = [];
|
|
19
|
+
}
|
|
20
|
+
D = !1;
|
|
21
|
+
}, g = () => {
|
|
22
|
+
D || (D = !0, requestAnimationFrame(S));
|
|
23
|
+
};
|
|
24
|
+
try {
|
|
25
|
+
const a = q.getReader(), u = new TextDecoder();
|
|
26
|
+
for (c.value = !1, t.value = !0; ; ) {
|
|
27
|
+
const { done: f, value: i } = await a.read();
|
|
28
|
+
if (f) break;
|
|
29
|
+
const d = u.decode(i, { stream: !0 });
|
|
30
|
+
if (e.mode === "sse") {
|
|
31
|
+
n += d;
|
|
32
|
+
const L = n.split(`
|
|
33
|
+
`);
|
|
34
|
+
n = L.pop() ?? "";
|
|
35
|
+
for (const J of L) {
|
|
36
|
+
const h = J.trim();
|
|
37
|
+
if (!(!h || h.startsWith(":")) && h.startsWith("data: ")) {
|
|
38
|
+
const s = h.slice(6);
|
|
39
|
+
if (s === "[DONE]") continue;
|
|
40
|
+
try {
|
|
41
|
+
const N = JSON.parse(s);
|
|
42
|
+
(e.bufferInterval ?? 0) > 0 ? (v.push(N), g()) : (x = e.onData) == null || x.call(e, N);
|
|
43
|
+
} catch {
|
|
44
|
+
(e.bufferInterval ?? 0) > 0 ? (m += s, g()) : (I = e.onChunk) == null || I.call(e, s);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
} else
|
|
49
|
+
(e.bufferInterval ?? 0) > 0 ? (m += d, g()) : (R = e.onChunk) == null || R.call(e, d);
|
|
50
|
+
}
|
|
51
|
+
S(), (T = e.onDone) == null || T.call(e);
|
|
52
|
+
} catch (a) {
|
|
53
|
+
if (a.name !== "AbortError") {
|
|
54
|
+
const u = ((A = e.retry) == null ? void 0 : A.maxRetries) ?? 0;
|
|
55
|
+
if (l.value < u) {
|
|
56
|
+
const f = ((B = e.retry) == null ? void 0 : B.baseDelay) ?? 1e3, i = ((C = e.retry) == null ? void 0 : C.backoff) === "linear" ? f * (l.value + 1) : f * Math.pow(2, l.value);
|
|
57
|
+
l.value++, await new Promise((d) => setTimeout(d, i)), (E = e.onRetry) == null || E.call(e, l.value);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
k.value = a, (F = e.onError) == null || F.call(e, a);
|
|
61
|
+
}
|
|
62
|
+
} finally {
|
|
63
|
+
w && clearTimeout(w), t.value = !1, c.value = !1;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function W() {
|
|
67
|
+
r == null || r.abort(), t.value = !1, c.value = !1;
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
isStreaming: b(t),
|
|
71
|
+
isLoading: b(c),
|
|
72
|
+
error: b(k),
|
|
73
|
+
retryCount: b(l),
|
|
74
|
+
start: O,
|
|
75
|
+
cancel: W
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
export {
|
|
79
|
+
P as useStream
|
|
80
|
+
};
|