@oneflowui/ui 0.4.2 → 0.4.4
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/assets/tableWorker-CTsbCPPP.js +1 -0
- package/dist/components/ContextMenu/index.vue.d.ts +2 -1
- package/dist/components/ContextMenu/index.vue.js +7 -0
- package/dist/components/ContextMenu/index.vue2.js +92 -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 +91 -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.d.ts +1 -1
- package/dist/components/base/MonitorItem.vue.js +7 -0
- package/dist/components/base/MonitorItem.vue2.js +56 -0
- package/dist/components/base/PersonaCard.vue.d.ts +2 -1
- package/dist/components/base/PersonaCard.vue.js +7 -0
- package/dist/components/base/PersonaCard.vue2.js +185 -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.d.ts +2 -2
- package/dist/components/base/RefTag.vue.js +7 -0
- package/dist/components/base/RefTag.vue2.js +52 -0
- package/dist/components/base/SearchHighlight.vue.d.ts +6 -0
- package/dist/components/base/SearchHighlight.vue.js +7 -0
- package/dist/components/base/SearchHighlight.vue2.js +21 -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.d.ts +2 -1
- package/dist/components/base/ToolbarBtn.vue.js +7 -0
- package/dist/components/base/ToolbarBtn.vue2.js +30 -0
- package/dist/components/base/ViewModeGroup.vue.d.ts +2 -1
- package/dist/components/base/ViewModeGroup.vue.js +7 -0
- package/dist/components/base/ViewModeGroup.vue2.js +32 -0
- package/dist/components/base/ViewSwitcher.vue.d.ts +2 -1
- 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/base/index.d.ts +1 -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/FieldAttachment.vue.d.ts +17 -0
- package/dist/components/field/FieldAttachment.vue.js +7 -0
- package/dist/components/field/FieldAttachment.vue2.js +69 -0
- package/dist/components/field/FieldAutoNumber.vue.d.ts +7 -0
- package/dist/components/field/FieldAutoNumber.vue.js +7 -0
- package/dist/components/field/FieldAutoNumber.vue2.js +15 -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/FieldCreator.vue.d.ts +7 -0
- package/dist/components/field/FieldCreator.vue.js +7 -0
- package/dist/components/field/FieldCreator.vue2.js +24 -0
- package/dist/components/field/FieldCurrency.vue.d.ts +17 -0
- package/dist/components/field/FieldCurrency.vue.js +7 -0
- package/dist/components/field/FieldCurrency.vue2.js +42 -0
- package/dist/components/field/FieldDate.vue.js +7 -0
- package/dist/components/field/FieldDate.vue2.js +36 -0
- 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/FieldMarkdownPreview.vue.d.ts +13 -0
- package/dist/components/field/FieldMarkdownPreview.vue.js +7 -0
- package/dist/components/field/FieldMarkdownPreview.vue2.js +37 -0
- 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/FieldPhone.vue.d.ts +17 -0
- package/dist/components/field/FieldPhone.vue.js +7 -0
- package/dist/components/field/FieldPhone.vue2.js +34 -0
- package/dist/components/field/FieldProgress.vue.d.ts +15 -0
- package/dist/components/field/FieldProgress.vue.js +7 -0
- package/dist/components/field/FieldProgress.vue2.js +40 -0
- package/dist/components/field/FieldRating.vue.js +7 -0
- package/dist/components/field/FieldRating.vue2.js +31 -0
- package/dist/components/field/FieldRelation.vue.d.ts +17 -0
- package/dist/components/field/FieldRelation.vue.js +7 -0
- package/dist/components/field/FieldRelation.vue2.js +67 -0
- package/dist/components/field/FieldRichText.vue.d.ts +17 -0
- package/dist/components/field/FieldRichText.vue.js +7 -0
- package/dist/components/field/FieldRichText.vue2.js +65 -0
- package/dist/components/field/FieldSelect.vue.js +7 -0
- package/dist/{FieldSelect-B39Ad8VH.js → components/field/FieldSelect.vue2.js} +44 -44
- 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 +255 -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.d.ts +6 -2
- package/dist/components/gallery/GalleryView.vue.js +7 -0
- package/dist/components/gallery/GalleryView.vue2.js +58 -0
- package/dist/components/kanban/KanbanBoard.vue.d.ts +5 -1
- package/dist/components/kanban/KanbanBoard.vue.js +7 -0
- package/dist/components/kanban/KanbanBoard.vue2.js +119 -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 +82 -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 +96 -0
- package/dist/components/overlay/Modal.vue.js +7 -0
- package/dist/components/overlay/Modal.vue2.js +99 -0
- package/dist/components/overlay/SidePanel.vue.js +7 -0
- package/dist/components/overlay/SidePanel.vue2.js +121 -0
- package/dist/components/split/SplitPane.vue.js +8 -0
- package/dist/components/split/SplitPane.vue2.js +68 -0
- package/dist/components/table/ColumnHeaderMenu.vue.d.ts +33 -0
- package/dist/components/table/ColumnHeaderMenu.vue.js +7 -0
- package/dist/components/table/ColumnHeaderMenu.vue2.js +153 -0
- package/dist/components/table/DataTable.vue.d.ts +116 -25
- package/dist/components/table/DataTable.vue.js +7 -0
- package/dist/components/table/DataTable.vue2.js +821 -0
- package/dist/components/table/DetailSheet.vue.d.ts +43 -0
- package/dist/components/table/DetailSheet.vue.js +7 -0
- package/dist/components/table/DetailSheet.vue2.js +140 -0
- package/dist/components/table/FieldCell.vue.d.ts +1 -1
- package/dist/components/table/FieldCell.vue.js +7 -0
- package/dist/components/table/FieldCell.vue2.js +86 -0
- package/dist/components/table/FieldTypePicker.vue.d.ts +15 -0
- package/dist/components/table/FieldTypePicker.vue.js +7 -0
- package/dist/components/table/FieldTypePicker.vue2.js +92 -0
- package/dist/components/table/MobileListView.vue.d.ts +24 -0
- package/dist/components/table/MobileListView.vue.js +7 -0
- package/dist/components/table/MobileListView.vue2.js +90 -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.d.ts +5 -0
- package/dist/components/table/TableGroupRow.vue.js +7 -0
- package/dist/components/table/TableGroupRow.vue2.js +58 -0
- package/dist/components/table/TableHeaderRow.vue.d.ts +16 -0
- package/dist/components/table/TableHeaderRow.vue.js +7 -0
- package/dist/components/table/TableHeaderRow.vue2.js +90 -0
- package/dist/components/table/TableToolbar.vue.d.ts +118 -0
- package/dist/components/table/TableToolbar.vue.js +7 -0
- package/dist/components/table/TableToolbar.vue2.js +273 -0
- package/dist/components/table/index.d.ts +5 -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 +186 -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/index.d.ts +19 -0
- package/dist/composables/useAiChat.js +103 -0
- package/dist/composables/useBadge.js +76 -0
- package/dist/composables/useBreakpoint.d.ts +2 -1
- package/dist/composables/useBreakpoint.js +18 -0
- package/dist/composables/useColumnResize.d.ts +19 -0
- package/dist/composables/useColumnResize.js +58 -0
- package/dist/composables/useDraftRows.d.ts +33 -0
- package/dist/composables/useDraftRows.js +103 -0
- package/dist/composables/useFixedColumns.d.ts +25 -0
- package/dist/composables/useFixedColumns.js +61 -0
- package/dist/composables/useFocusTrap.d.ts +10 -0
- package/dist/composables/useFocusTrap.js +37 -0
- package/dist/composables/useInlineEdit.js +28 -0
- package/dist/composables/useKeyboardNavigation.d.ts +45 -0
- package/dist/composables/useKeyboardNavigation.js +140 -0
- package/dist/composables/useMarkdown.js +69 -0
- package/dist/composables/useRowDrag.d.ts +32 -0
- package/dist/composables/useRowDrag.js +85 -0
- package/dist/composables/useSchemaEngine.d.ts +31 -0
- package/dist/composables/useSchemaEngine.js +129 -0
- package/dist/composables/useSearch.d.ts +30 -0
- package/dist/composables/useSearch.js +59 -0
- package/dist/composables/useStream.js +80 -0
- package/dist/composables/useSupabaseProvider.d.ts +70 -0
- package/dist/composables/useSupabaseProvider.js +126 -0
- package/dist/composables/useTable.d.ts +3 -0
- package/dist/composables/useTable.js +135 -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.d.ts +14 -1
- package/dist/composables/useTableGroup.js +70 -0
- package/dist/composables/useToast.js +38 -0
- package/dist/composables/useTypewriter.js +56 -0
- package/dist/composables/useViewPersistence.d.ts +98 -0
- package/dist/composables/useViewPersistence.js +141 -0
- package/dist/composables/useVirtualList.d.ts +4 -1
- package/dist/composables/useVirtualList.js +140 -0
- package/dist/composables/useWorkerSort.d.ts +14 -0
- package/dist/composables/useWorkerSort.js +61 -0
- package/dist/constants/table.js +11 -0
- package/dist/index.d.ts +28 -4
- package/dist/index.js +349 -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.d.ts +63 -2
- package/dist/types/index.js +94 -0
- package/dist/types/table-internal.d.ts +64 -0
- package/dist/utils/aggregation.d.ts +5 -0
- package/dist/utils/aggregation.js +38 -0
- package/dist/utils/icon.js +15 -0
- package/dist/utils/supabaseAdapter.d.ts +48 -0
- package/dist/utils/supabaseAdapter.js +76 -0
- package/dist/utils/supabaseSchema.d.ts +81 -0
- package/dist/utils/supabaseSchema.js +202 -0
- package/dist/workers/tableWorker.d.ts +31 -0
- package/package.json +13 -6
- package/dist/FieldDate-Bljx4jb7.js +0 -34
- 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,58 @@
|
|
|
1
|
+
import { ref as o, onUnmounted as b, readonly as a } from "vue";
|
|
2
|
+
function E(u) {
|
|
3
|
+
const d = u.minWidth ?? 60, m = o(!1), v = o(null), i = o(/* @__PURE__ */ new Map()), f = o(0), h = o(!1);
|
|
4
|
+
let n = null, y = "", W = "";
|
|
5
|
+
function X(e) {
|
|
6
|
+
if (i.value.has(e))
|
|
7
|
+
return i.value.get(e);
|
|
8
|
+
const t = u.columns.value.find((s) => s.key === e);
|
|
9
|
+
return !t || t.width === "fill" ? 200 : t.width ?? 200;
|
|
10
|
+
}
|
|
11
|
+
function w(e) {
|
|
12
|
+
var r;
|
|
13
|
+
if (!n) return;
|
|
14
|
+
const t = e.clientX - n.startX, s = Math.max(d, n.initialWidth + t), l = new Map(i.value);
|
|
15
|
+
l.set(n.colKey, s), i.value = l, f.value = e.clientX, (r = u.onResize) == null || r.call(u, n.colKey, s);
|
|
16
|
+
}
|
|
17
|
+
function z() {
|
|
18
|
+
n && (document.body.style.cursor = y, document.body.style.userSelect = W, document.removeEventListener("mousemove", w), document.removeEventListener("mouseup", z), m.value = !1, v.value = null, h.value = !1, n = null);
|
|
19
|
+
}
|
|
20
|
+
function R(e, t) {
|
|
21
|
+
e.preventDefault(), e.stopPropagation(), n = {
|
|
22
|
+
colKey: t,
|
|
23
|
+
startX: e.clientX,
|
|
24
|
+
initialWidth: X(t)
|
|
25
|
+
}, m.value = !0, v.value = t, f.value = e.clientX, h.value = !0, y = document.body.style.cursor, W = document.body.style.userSelect, document.body.style.cursor = "col-resize", document.body.style.userSelect = "none", document.addEventListener("mousemove", w), document.addEventListener("mouseup", z);
|
|
26
|
+
}
|
|
27
|
+
function g(e) {
|
|
28
|
+
return X(e);
|
|
29
|
+
}
|
|
30
|
+
function C(e, t) {
|
|
31
|
+
var r;
|
|
32
|
+
if (!t) return;
|
|
33
|
+
const s = t.querySelectorAll(`[data-col-key="${e}"]`);
|
|
34
|
+
let l = d;
|
|
35
|
+
if (s.forEach((c) => {
|
|
36
|
+
const M = c.firstElementChild;
|
|
37
|
+
M && (l = Math.max(l, M.scrollWidth + 24));
|
|
38
|
+
}), l > d) {
|
|
39
|
+
const c = new Map(i.value);
|
|
40
|
+
c.set(e, l), i.value = c, (r = u.onResize) == null || r.call(u, e, l);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return b(() => {
|
|
44
|
+
n && z();
|
|
45
|
+
}), {
|
|
46
|
+
startResize: R,
|
|
47
|
+
isResizing: a(m),
|
|
48
|
+
resizingColumn: a(v),
|
|
49
|
+
columnWidthOverrides: a(i),
|
|
50
|
+
resolvedWidth: g,
|
|
51
|
+
autoFitColumn: C,
|
|
52
|
+
resizeIndicatorX: a(f),
|
|
53
|
+
showResizeIndicator: a(h)
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
export {
|
|
57
|
+
E as useColumnResize
|
|
58
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { CellValue, DataRecord, TableSchema } from '../types';
|
|
3
|
+
export interface UseDraftRowsOptions {
|
|
4
|
+
schema: Ref<TableSchema | undefined>;
|
|
5
|
+
groupFieldId?: Ref<string | undefined>;
|
|
6
|
+
}
|
|
7
|
+
export declare function useDraftRows(options: UseDraftRowsOptions): {
|
|
8
|
+
drafts: Readonly<Ref<ReadonlyMap<string, {
|
|
9
|
+
readonly draftId: string;
|
|
10
|
+
readonly fields: {
|
|
11
|
+
readonly [x: string]: string | number | boolean | readonly string[] | null;
|
|
12
|
+
};
|
|
13
|
+
readonly dirtyFields: ReadonlySet<string>;
|
|
14
|
+
readonly validationErrors: ReadonlyMap<string, string>;
|
|
15
|
+
readonly groupFieldValue?: string | number | boolean | readonly string[] | null | undefined;
|
|
16
|
+
}>, ReadonlyMap<string, {
|
|
17
|
+
readonly draftId: string;
|
|
18
|
+
readonly fields: {
|
|
19
|
+
readonly [x: string]: string | number | boolean | readonly string[] | null;
|
|
20
|
+
};
|
|
21
|
+
readonly dirtyFields: ReadonlySet<string>;
|
|
22
|
+
readonly validationErrors: ReadonlyMap<string, string>;
|
|
23
|
+
readonly groupFieldValue?: string | number | boolean | readonly string[] | null | undefined;
|
|
24
|
+
}>>>;
|
|
25
|
+
addDraft: (groupFieldValue?: CellValue) => string;
|
|
26
|
+
updateDraftField: (draftId: string, fieldId: string, value: CellValue) => void;
|
|
27
|
+
removeDraft: (draftId: string) => void;
|
|
28
|
+
commitDraft: (draftId: string) => DataRecord | null;
|
|
29
|
+
commitAll: () => DataRecord[];
|
|
30
|
+
discardAll: () => void;
|
|
31
|
+
isDraft: (rowId: string) => boolean;
|
|
32
|
+
getDraftErrors: (draftId: string) => Map<string, string>;
|
|
33
|
+
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { ref as E, readonly as h } from "vue";
|
|
2
|
+
let g = 0;
|
|
3
|
+
function _() {
|
|
4
|
+
return `__draft__${++g}__${Date.now()}`;
|
|
5
|
+
}
|
|
6
|
+
function y(l) {
|
|
7
|
+
const n = E(/* @__PURE__ */ new Map());
|
|
8
|
+
function d(t) {
|
|
9
|
+
var i;
|
|
10
|
+
const e = _(), o = {}, r = l.schema.value;
|
|
11
|
+
if (r)
|
|
12
|
+
for (const D of r.fields)
|
|
13
|
+
o[D.id] = null;
|
|
14
|
+
const a = (i = l.groupFieldId) == null ? void 0 : i.value;
|
|
15
|
+
a && t !== void 0 && (o[a] = t);
|
|
16
|
+
const s = new Map(n.value);
|
|
17
|
+
return s.set(e, {
|
|
18
|
+
draftId: e,
|
|
19
|
+
fields: o,
|
|
20
|
+
dirtyFields: /* @__PURE__ */ new Set(),
|
|
21
|
+
validationErrors: /* @__PURE__ */ new Map(),
|
|
22
|
+
groupFieldValue: t
|
|
23
|
+
}), n.value = s, e;
|
|
24
|
+
}
|
|
25
|
+
function c(t, e, o) {
|
|
26
|
+
const r = n.value.get(t);
|
|
27
|
+
if (!r) return;
|
|
28
|
+
const a = new Map(n.value), s = {
|
|
29
|
+
...r,
|
|
30
|
+
fields: { ...r.fields, [e]: o },
|
|
31
|
+
dirtyFields: /* @__PURE__ */ new Set([...r.dirtyFields, e])
|
|
32
|
+
};
|
|
33
|
+
if (r.validationErrors.has(e)) {
|
|
34
|
+
const i = new Map(r.validationErrors);
|
|
35
|
+
i.delete(e), s.validationErrors = i;
|
|
36
|
+
}
|
|
37
|
+
a.set(t, s), n.value = a;
|
|
38
|
+
}
|
|
39
|
+
function f(t) {
|
|
40
|
+
const e = new Map(n.value);
|
|
41
|
+
e.delete(t), n.value = e;
|
|
42
|
+
}
|
|
43
|
+
function v(t) {
|
|
44
|
+
const e = n.value.get(t);
|
|
45
|
+
if (!e) return null;
|
|
46
|
+
const o = u(e);
|
|
47
|
+
if (o.size > 0) {
|
|
48
|
+
const a = new Map(n.value);
|
|
49
|
+
return a.set(t, { ...e, validationErrors: o }), n.value = a, null;
|
|
50
|
+
}
|
|
51
|
+
const r = {
|
|
52
|
+
id: t,
|
|
53
|
+
// Consumer should replace with server-generated id
|
|
54
|
+
fields: { ...e.fields }
|
|
55
|
+
};
|
|
56
|
+
return f(t), r;
|
|
57
|
+
}
|
|
58
|
+
function w() {
|
|
59
|
+
const t = [], e = /* @__PURE__ */ new Map();
|
|
60
|
+
for (const [o, r] of n.value) {
|
|
61
|
+
const a = u(r);
|
|
62
|
+
a.size > 0 ? e.set(o, { ...r, validationErrors: a }) : t.push({
|
|
63
|
+
id: o,
|
|
64
|
+
fields: { ...r.fields }
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
return n.value = e, t;
|
|
68
|
+
}
|
|
69
|
+
function p() {
|
|
70
|
+
n.value = /* @__PURE__ */ new Map();
|
|
71
|
+
}
|
|
72
|
+
function m(t) {
|
|
73
|
+
return n.value.has(t);
|
|
74
|
+
}
|
|
75
|
+
function M(t) {
|
|
76
|
+
var e;
|
|
77
|
+
return ((e = n.value.get(t)) == null ? void 0 : e.validationErrors) ?? /* @__PURE__ */ new Map();
|
|
78
|
+
}
|
|
79
|
+
function u(t) {
|
|
80
|
+
const e = /* @__PURE__ */ new Map(), o = l.schema.value;
|
|
81
|
+
if (!o) return e;
|
|
82
|
+
for (const r of o.fields)
|
|
83
|
+
if (r.required) {
|
|
84
|
+
const a = t.fields[r.id];
|
|
85
|
+
(a == null || a === "") && e.set(r.id, `${r.name} 为必填项`);
|
|
86
|
+
}
|
|
87
|
+
return e;
|
|
88
|
+
}
|
|
89
|
+
return {
|
|
90
|
+
drafts: h(n),
|
|
91
|
+
addDraft: d,
|
|
92
|
+
updateDraftField: c,
|
|
93
|
+
removeDraft: f,
|
|
94
|
+
commitDraft: v,
|
|
95
|
+
commitAll: w,
|
|
96
|
+
discardAll: p,
|
|
97
|
+
isDraft: m,
|
|
98
|
+
getDraftErrors: M
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
export {
|
|
102
|
+
y as useDraftRows
|
|
103
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Ref, ComputedRef } from 'vue';
|
|
2
|
+
import { TableColumn } from '../types';
|
|
3
|
+
export interface UseFixedColumnsOptions {
|
|
4
|
+
columns: Ref<TableColumn[]>;
|
|
5
|
+
fixedColumnKeys: Ref<string[]>;
|
|
6
|
+
scrollContainerRef: Ref<HTMLElement | null>;
|
|
7
|
+
fixedContainerRef: Ref<HTMLElement | null>;
|
|
8
|
+
/** Width of the selector checkbox column (default 40) */
|
|
9
|
+
selectorWidth?: number;
|
|
10
|
+
}
|
|
11
|
+
export declare function useFixedColumns(options: UseFixedColumnsOptions): {
|
|
12
|
+
fixedColumns: ComputedRef<TableColumn[]>;
|
|
13
|
+
scrollableColumns: ComputedRef<TableColumn[]>;
|
|
14
|
+
fixedWidth: ComputedRef<number>;
|
|
15
|
+
handleScroll: (e: Event) => void;
|
|
16
|
+
handleFixedScroll: (e: Event) => void;
|
|
17
|
+
scrollLeft: Readonly<Ref<number, number>>;
|
|
18
|
+
syncHover: (rowId: string | null) => void;
|
|
19
|
+
isRowHovered: (rowId: string) => boolean;
|
|
20
|
+
hoverState: Readonly<Ref<{
|
|
21
|
+
readonly rowId: string | null;
|
|
22
|
+
}, {
|
|
23
|
+
readonly rowId: string | null;
|
|
24
|
+
}>>;
|
|
25
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { ref as f, computed as a, onUnmounted as w, readonly as d } from "vue";
|
|
2
|
+
function A(n) {
|
|
3
|
+
const m = n.selectorWidth ?? 40, i = f(0), u = f({ rowId: null });
|
|
4
|
+
let o = null, r = null, c = null;
|
|
5
|
+
const s = a(() => {
|
|
6
|
+
const e = new Set(n.fixedColumnKeys.value);
|
|
7
|
+
return n.columns.value.filter((l) => e.has(l.key));
|
|
8
|
+
}), v = a(() => {
|
|
9
|
+
const e = new Set(n.fixedColumnKeys.value);
|
|
10
|
+
return n.columns.value.filter((l) => !e.has(l.key));
|
|
11
|
+
}), h = a(() => {
|
|
12
|
+
let e = m;
|
|
13
|
+
for (const l of s.value)
|
|
14
|
+
e += typeof l.width == "number" ? l.width : l.minWidth ?? 200;
|
|
15
|
+
return e;
|
|
16
|
+
});
|
|
17
|
+
function x(e) {
|
|
18
|
+
if (c === "fixed") {
|
|
19
|
+
c = null;
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const l = e.target;
|
|
23
|
+
i.value = l.scrollLeft, o !== null && cancelAnimationFrame(o), o = requestAnimationFrame(() => {
|
|
24
|
+
const t = n.fixedContainerRef.value;
|
|
25
|
+
t && t !== l && (c = "scroll", t.scrollTop = l.scrollTop), o = null;
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
function y(e) {
|
|
29
|
+
if (c === "scroll") {
|
|
30
|
+
c = null;
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const l = e.target;
|
|
34
|
+
r !== null && cancelAnimationFrame(r), r = requestAnimationFrame(() => {
|
|
35
|
+
const t = n.scrollContainerRef.value;
|
|
36
|
+
t && t !== l && (c = "fixed", t.scrollTop = l.scrollTop), r = null;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
function F(e) {
|
|
40
|
+
u.value = { rowId: e };
|
|
41
|
+
}
|
|
42
|
+
function S(e) {
|
|
43
|
+
return u.value.rowId === e;
|
|
44
|
+
}
|
|
45
|
+
return w(() => {
|
|
46
|
+
o !== null && cancelAnimationFrame(o), r !== null && cancelAnimationFrame(r);
|
|
47
|
+
}), {
|
|
48
|
+
fixedColumns: s,
|
|
49
|
+
scrollableColumns: v,
|
|
50
|
+
fixedWidth: h,
|
|
51
|
+
handleScroll: x,
|
|
52
|
+
handleFixedScroll: y,
|
|
53
|
+
scrollLeft: d(i),
|
|
54
|
+
syncHover: F,
|
|
55
|
+
isRowHovered: S,
|
|
56
|
+
hoverState: d(u)
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
export {
|
|
60
|
+
A as useFixedColumns
|
|
61
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Focus trap composable — 管理 dialog/drawer/panel 的焦点陷阱
|
|
3
|
+
*
|
|
4
|
+
* 返回 containerRef(绑到容器元素),activate() 打开时调用,deactivate() 关闭时调用。
|
|
5
|
+
*/
|
|
6
|
+
export declare function useFocusTrap(): {
|
|
7
|
+
containerRef: import('vue').Ref<HTMLElement | null, HTMLElement | null>;
|
|
8
|
+
activate: () => void;
|
|
9
|
+
deactivate: () => void;
|
|
10
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ref as f, onBeforeUnmount as s, nextTick as d } from "vue";
|
|
2
|
+
function v() {
|
|
3
|
+
const o = f(null);
|
|
4
|
+
let t = null;
|
|
5
|
+
function r() {
|
|
6
|
+
return o.value ? Array.from(
|
|
7
|
+
o.value.querySelectorAll(
|
|
8
|
+
'button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]), a[href]'
|
|
9
|
+
)
|
|
10
|
+
).filter((e) => !e.closest('[aria-hidden="true"]')) : [];
|
|
11
|
+
}
|
|
12
|
+
function u(e) {
|
|
13
|
+
if (e.key !== "Tab") return;
|
|
14
|
+
const n = r();
|
|
15
|
+
if (n.length === 0) {
|
|
16
|
+
e.preventDefault();
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const c = n[0], i = n[n.length - 1];
|
|
20
|
+
e.shiftKey ? document.activeElement === c && (e.preventDefault(), i.focus()) : document.activeElement === i && (e.preventDefault(), c.focus());
|
|
21
|
+
}
|
|
22
|
+
function l() {
|
|
23
|
+
t = document.activeElement, d(() => {
|
|
24
|
+
const e = r();
|
|
25
|
+
e.length && e[0].focus(), document.addEventListener("keydown", u);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
function a() {
|
|
29
|
+
document.removeEventListener("keydown", u), t == null || t.focus(), t = null;
|
|
30
|
+
}
|
|
31
|
+
return s(() => {
|
|
32
|
+
document.removeEventListener("keydown", u);
|
|
33
|
+
}), { containerRef: o, activate: l, deactivate: a };
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
v as useFocusTrap
|
|
37
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ref as c, readonly as f } from "vue";
|
|
2
|
+
function I() {
|
|
3
|
+
const n = c(null);
|
|
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: f(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,45 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { TableColumn } from '../types';
|
|
3
|
+
import { EditingCell } from './useInlineEdit';
|
|
4
|
+
export interface UseKeyboardNavigationOptions {
|
|
5
|
+
columns: Ref<TableColumn[]>;
|
|
6
|
+
rows: Ref<Array<{
|
|
7
|
+
id: string;
|
|
8
|
+
} & Record<string, any>>>;
|
|
9
|
+
containerRef: Ref<HTMLElement | null>;
|
|
10
|
+
editingCell: Ref<EditingCell | null>;
|
|
11
|
+
enabled: Ref<boolean>;
|
|
12
|
+
/** Callback to activate inline edit on a cell */
|
|
13
|
+
onActivateEdit?: (rowId: string, colKey: string) => void;
|
|
14
|
+
/** Callback to cancel inline edit */
|
|
15
|
+
onCancelEdit?: () => void;
|
|
16
|
+
/** Callback to scroll a row into view */
|
|
17
|
+
onScrollToRow?: (rowIndex: number) => void;
|
|
18
|
+
/** Callback to get cell text value for copy (optional, enables Ctrl+C) */
|
|
19
|
+
getCellValue?: (rowId: string, colKey: string) => string;
|
|
20
|
+
/** Callback when paste data is received (optional, enables Ctrl+V) */
|
|
21
|
+
onPaste?: (startRowId: string, startColKey: string, data: string[][]) => void;
|
|
22
|
+
}
|
|
23
|
+
export interface SelectedCell {
|
|
24
|
+
rowId: string;
|
|
25
|
+
colKey: string;
|
|
26
|
+
}
|
|
27
|
+
export declare function useKeyboardNavigation(options: UseKeyboardNavigationOptions): {
|
|
28
|
+
activeCell: Readonly<Ref<{
|
|
29
|
+
readonly rowId: string;
|
|
30
|
+
readonly colKey: string;
|
|
31
|
+
} | null, {
|
|
32
|
+
readonly rowId: string;
|
|
33
|
+
readonly colKey: string;
|
|
34
|
+
} | null>>;
|
|
35
|
+
selectedRange: Readonly<Ref<readonly {
|
|
36
|
+
readonly rowId: string;
|
|
37
|
+
readonly colKey: string;
|
|
38
|
+
}[], readonly {
|
|
39
|
+
readonly rowId: string;
|
|
40
|
+
readonly colKey: string;
|
|
41
|
+
}[]>>;
|
|
42
|
+
setActiveCell: (rowId: string, colKey: string) => void;
|
|
43
|
+
clearActiveCell: () => void;
|
|
44
|
+
handleKeyDown: (e: KeyboardEvent) => void;
|
|
45
|
+
};
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { ref as g, readonly as A } from "vue";
|
|
2
|
+
function M(t) {
|
|
3
|
+
const l = g(null), i = g(null), s = g([]);
|
|
4
|
+
function k(e, a) {
|
|
5
|
+
l.value = { rowId: e, colKey: a }, i.value = null, s.value = [];
|
|
6
|
+
}
|
|
7
|
+
function m() {
|
|
8
|
+
l.value = null, i.value = null, s.value = [];
|
|
9
|
+
}
|
|
10
|
+
function h() {
|
|
11
|
+
return t.columns.value.filter((e) => !e.hidden);
|
|
12
|
+
}
|
|
13
|
+
function C(e, a) {
|
|
14
|
+
const n = t.rows.value, c = h(), r = n.findIndex((v) => v.id === e.rowId), u = c.findIndex((v) => v.key === e.colKey), o = n.findIndex((v) => v.id === a.rowId), y = c.findIndex((v) => v.key === a.colKey);
|
|
15
|
+
if (r === -1 || u === -1 || o === -1 || y === -1)
|
|
16
|
+
return [];
|
|
17
|
+
const I = Math.min(r, o), K = Math.max(r, o), d = Math.min(u, y), w = Math.max(u, y), f = [];
|
|
18
|
+
for (let v = I; v <= K; v++)
|
|
19
|
+
for (let x = d; x <= w; x++)
|
|
20
|
+
f.push({ rowId: n[v].id, colKey: c[x].key });
|
|
21
|
+
return f;
|
|
22
|
+
}
|
|
23
|
+
async function S() {
|
|
24
|
+
if (!t.getCellValue) return;
|
|
25
|
+
const e = s.value.length > 0 ? s.value : l.value ? [l.value] : [];
|
|
26
|
+
if (e.length === 0) return;
|
|
27
|
+
const a = t.rows.value, n = h(), c = [...new Set(e.map((d) => d.rowId))], r = [...new Set(e.map((d) => d.colKey))], u = c.sort((d, w) => a.findIndex((f) => f.id === d) - a.findIndex((f) => f.id === w)), o = r.sort((d, w) => n.findIndex((f) => f.key === d) - n.findIndex((f) => f.key === w)), y = new Set(e.map((d) => `${d.rowId}:${d.colKey}`)), I = [];
|
|
28
|
+
for (const d of u) {
|
|
29
|
+
const w = [];
|
|
30
|
+
for (const f of o)
|
|
31
|
+
y.has(`${d}:${f}`) ? w.push(t.getCellValue(d, f)) : w.push("");
|
|
32
|
+
I.push(w.join(" "));
|
|
33
|
+
}
|
|
34
|
+
const K = I.join(`
|
|
35
|
+
`);
|
|
36
|
+
try {
|
|
37
|
+
await navigator.clipboard.writeText(K);
|
|
38
|
+
} catch {
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
async function E() {
|
|
42
|
+
if (!t.onPaste || !l.value) return;
|
|
43
|
+
let e;
|
|
44
|
+
try {
|
|
45
|
+
e = await navigator.clipboard.readText();
|
|
46
|
+
} catch {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (!e) return;
|
|
50
|
+
const a = e.split(/\r?\n/).filter((n) => n.length > 0).map((n) => n.split(" "));
|
|
51
|
+
a.length !== 0 && t.onPaste(l.value.rowId, l.value.colKey, a);
|
|
52
|
+
}
|
|
53
|
+
function T(e) {
|
|
54
|
+
var n, c, r;
|
|
55
|
+
if (!t.enabled.value) return;
|
|
56
|
+
if (t.editingCell.value !== null) {
|
|
57
|
+
if (e.key === "Escape") {
|
|
58
|
+
e.preventDefault(), (n = t.onCancelEdit) == null || n.call(t);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (e.key === "Tab") {
|
|
62
|
+
e.preventDefault(), (c = t.onCancelEdit) == null || c.call(t), R(e.shiftKey);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
if ((e.ctrlKey || e.metaKey) && e.key === "c") {
|
|
68
|
+
e.preventDefault(), S();
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
if ((e.ctrlKey || e.metaKey) && e.key === "v") {
|
|
72
|
+
e.preventDefault(), E();
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
if (!l.value) {
|
|
76
|
+
if (["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"].includes(e.key)) {
|
|
77
|
+
e.preventDefault();
|
|
78
|
+
const u = t.rows.value, o = h();
|
|
79
|
+
u.length > 0 && o.length > 0 && k(u[0].id, o[0].key);
|
|
80
|
+
}
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
switch (e.key) {
|
|
84
|
+
case "ArrowUp":
|
|
85
|
+
e.preventDefault(), D(-1, e.shiftKey);
|
|
86
|
+
break;
|
|
87
|
+
case "ArrowDown":
|
|
88
|
+
e.preventDefault(), D(1, e.shiftKey);
|
|
89
|
+
break;
|
|
90
|
+
case "ArrowLeft":
|
|
91
|
+
e.preventDefault(), b(-1, e.shiftKey);
|
|
92
|
+
break;
|
|
93
|
+
case "ArrowRight":
|
|
94
|
+
e.preventDefault(), b(1, e.shiftKey);
|
|
95
|
+
break;
|
|
96
|
+
case "Enter":
|
|
97
|
+
e.preventDefault(), l.value && ((r = t.onActivateEdit) == null || r.call(t, l.value.rowId, l.value.colKey));
|
|
98
|
+
break;
|
|
99
|
+
case "Escape":
|
|
100
|
+
e.preventDefault(), m();
|
|
101
|
+
break;
|
|
102
|
+
case "Tab":
|
|
103
|
+
e.preventDefault(), R(e.shiftKey);
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
function D(e, a = !1) {
|
|
108
|
+
var u;
|
|
109
|
+
if (!l.value) return;
|
|
110
|
+
const n = t.rows.value, c = n.findIndex((o) => o.id === l.value.rowId);
|
|
111
|
+
if (c === -1) return;
|
|
112
|
+
const r = c + e;
|
|
113
|
+
r < 0 || r >= n.length || (a ? (i.value || (i.value = { rowId: l.value.rowId, colKey: l.value.colKey }), l.value = { rowId: n[r].id, colKey: l.value.colKey }, s.value = C(i.value, l.value)) : (i.value = null, s.value = [], l.value = { rowId: n[r].id, colKey: l.value.colKey }), (u = t.onScrollToRow) == null || u.call(t, r));
|
|
114
|
+
}
|
|
115
|
+
function b(e, a = !1) {
|
|
116
|
+
if (!l.value) return;
|
|
117
|
+
const n = h(), c = n.findIndex((u) => u.key === l.value.colKey);
|
|
118
|
+
if (c === -1) return;
|
|
119
|
+
const r = c + e;
|
|
120
|
+
r < 0 || r >= n.length || (a ? (i.value || (i.value = { rowId: l.value.rowId, colKey: l.value.colKey }), l.value = { rowId: l.value.rowId, colKey: n[r].key }, s.value = C(i.value, l.value)) : (i.value = null, s.value = [], l.value = { rowId: l.value.rowId, colKey: n[r].key }));
|
|
121
|
+
}
|
|
122
|
+
function R(e) {
|
|
123
|
+
var y;
|
|
124
|
+
if (!l.value) return;
|
|
125
|
+
const a = t.rows.value, n = h(), c = a.findIndex((I) => I.id === l.value.rowId), r = n.findIndex((I) => I.key === l.value.colKey);
|
|
126
|
+
if (c === -1 || r === -1) return;
|
|
127
|
+
let u = r + (e ? -1 : 1), o = c;
|
|
128
|
+
u >= n.length ? (u = 0, o++) : u < 0 && (u = n.length - 1, o--), !(o < 0 || o >= a.length) && (l.value = { rowId: a[o].id, colKey: n[u].key }, i.value = null, s.value = [], (y = t.onScrollToRow) == null || y.call(t, o));
|
|
129
|
+
}
|
|
130
|
+
return {
|
|
131
|
+
activeCell: A(l),
|
|
132
|
+
selectedRange: A(s),
|
|
133
|
+
setActiveCell: k,
|
|
134
|
+
clearActiveCell: m,
|
|
135
|
+
handleKeyDown: T
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
export {
|
|
139
|
+
M as useKeyboardNavigation
|
|
140
|
+
};
|
|
@@ -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,32 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { GroupedListItem } from './useTableGroup';
|
|
3
|
+
export interface UseRowDragOptions<T> {
|
|
4
|
+
/** The flattened items list (with group headers) */
|
|
5
|
+
processedItems: Ref<GroupedListItem<T>[]>;
|
|
6
|
+
/** Whether cross-group drag is allowed */
|
|
7
|
+
enableCrossGroupDrag?: Ref<boolean>;
|
|
8
|
+
/** The field id used for grouping (needed for cross-group value update) */
|
|
9
|
+
groupFieldId?: Ref<string | undefined>;
|
|
10
|
+
}
|
|
11
|
+
export interface RowReorderPayload {
|
|
12
|
+
rowId: string;
|
|
13
|
+
beforeRowId: string | null;
|
|
14
|
+
}
|
|
15
|
+
export interface RowGroupChangePayload {
|
|
16
|
+
rowId: string;
|
|
17
|
+
groupFieldId: string;
|
|
18
|
+
newValue: unknown;
|
|
19
|
+
}
|
|
20
|
+
export declare function useRowDrag<T extends Record<string, any>>(options: UseRowDragOptions<T>): {
|
|
21
|
+
isDragging: Readonly<Ref<boolean, boolean>>;
|
|
22
|
+
draggedRowId: Readonly<Ref<string | null, string | null>>;
|
|
23
|
+
dropTargetId: Readonly<Ref<string | null, string | null>>;
|
|
24
|
+
dropPosition: Readonly<Ref<"before" | "after" | "into-group", "before" | "after" | "into-group">>;
|
|
25
|
+
handleDragStart: (e: DragEvent, item: GroupedListItem<T>) => void;
|
|
26
|
+
handleDragOver: (e: DragEvent, targetItem: GroupedListItem<T>) => void;
|
|
27
|
+
handleDrop: (e: DragEvent, targetItem: GroupedListItem<T>, callbacks: {
|
|
28
|
+
onReorder?: (payload: RowReorderPayload) => void;
|
|
29
|
+
onGroupChange?: (payload: RowGroupChangePayload) => void;
|
|
30
|
+
}) => void;
|
|
31
|
+
handleDragEnd: () => void;
|
|
32
|
+
};
|