dishui 0.0.65 → 0.0.66
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/_rolldown/runtime.js +10 -11
- package/dist/chart.js +12 -46
- package/dist/code-editor.js +16 -43
- package/dist/components/Badge/index.js +10 -15
- package/dist/components/Badge/index.js.map +1 -1
- package/dist/components/Button/index.js +62 -89
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Card/index.d.ts +76 -0
- package/dist/components/Card/index.js +178 -69
- package/dist/components/Card/index.js.map +1 -1
- package/dist/components/Chart/Chart.js +25 -25
- package/dist/components/Chart/Chart.js.map +1 -1
- package/dist/components/Checkbox/index.js +57 -65
- package/dist/components/Checkbox/index.js.map +1 -1
- package/dist/components/ChoicePicker/index.d.ts +44 -0
- package/dist/components/ChoicePicker/index.js +81 -0
- package/dist/components/ChoicePicker/index.js.map +1 -0
- package/dist/components/Column/index.d.ts +28 -0
- package/dist/components/Column/index.js +30 -0
- package/dist/components/Column/index.js.map +1 -0
- package/dist/components/DateTimeInput/index.d.ts +44 -0
- package/dist/components/DateTimeInput/index.js +48 -0
- package/dist/components/DateTimeInput/index.js.map +1 -0
- package/dist/components/Demo/index.js +107 -107
- package/dist/components/Demo/index.js.map +1 -1
- package/dist/components/Divider/index.d.ts +20 -0
- package/dist/components/Divider/index.js +30 -0
- package/dist/components/Divider/index.js.map +1 -0
- package/dist/components/EmptyState/index.js +24 -24
- package/dist/components/EmptyState/index.js.map +1 -1
- package/dist/components/FileUploader/DropZone.js +134 -136
- package/dist/components/FileUploader/DropZone.js.map +1 -1
- package/dist/components/FileUploader/FileItem.js +159 -163
- package/dist/components/FileUploader/FileItem.js.map +1 -1
- package/dist/components/FileUploader/FileUploader.js +126 -127
- package/dist/components/FileUploader/FileUploader.js.map +1 -1
- package/dist/components/FileUploader/UploadQueue.js +62 -62
- package/dist/components/FileUploader/UploadQueue.js.map +1 -1
- package/dist/components/FloatWindow/index.d.ts +28 -0
- package/dist/components/GridLayout/index.d.ts +42 -0
- package/dist/components/Icon/index.d.ts +24 -0
- package/dist/components/Icon/index.js +26 -0
- package/dist/components/Icon/index.js.map +1 -0
- package/dist/components/Image/index.d.ts +33 -0
- package/dist/components/Image/index.js +44 -0
- package/dist/components/Image/index.js.map +1 -0
- package/dist/components/Input/index.js +196 -197
- package/dist/components/Input/index.js.map +1 -1
- package/dist/components/Label/index.js +62 -74
- package/dist/components/Label/index.js.map +1 -1
- package/dist/components/Layout/index.js +134 -139
- package/dist/components/Layout/index.js.map +1 -1
- package/dist/components/List/index.js +45 -58
- package/dist/components/List/index.js.map +1 -1
- package/dist/components/Markdown/Markdown.js +106 -107
- package/dist/components/Markdown/Markdown.js.map +1 -1
- package/dist/components/Markdown/codeThemes.js +24 -33
- package/dist/components/Markdown/codeThemes.js.map +1 -1
- package/dist/components/Markdown/markdownComponents.js +203 -208
- package/dist/components/Markdown/markdownComponents.js.map +1 -1
- package/dist/components/Markdown/parseCodeBlockMeta.js +22 -22
- package/dist/components/Markdown/parseCodeBlockMeta.js.map +1 -1
- package/dist/components/Markdown/useMarkdownSource.js +46 -46
- package/dist/components/Markdown/useMarkdownSource.js.map +1 -1
- package/dist/components/Markdown/useMarkmapRenderer.js +35 -36
- package/dist/components/Markdown/useMarkmapRenderer.js.map +1 -1
- package/dist/components/Markdown/useMermaidRenderer.js +41 -42
- package/dist/components/Markdown/useMermaidRenderer.js.map +1 -1
- package/dist/components/Modal/index.js +82 -82
- package/dist/components/Modal/index.js.map +1 -1
- package/dist/components/MultipleChoice/index.d.ts +44 -0
- package/dist/components/MultipleChoice/index.js +52 -0
- package/dist/components/MultipleChoice/index.js.map +1 -0
- package/dist/components/Notification/index.d.ts +17 -0
- package/dist/components/Page/index.js +40 -71
- package/dist/components/Page/index.js.map +1 -1
- package/dist/components/PageHeader/index.js +28 -28
- package/dist/components/PageHeader/index.js.map +1 -1
- package/dist/components/ProtectedRoute/index.js +8 -9
- package/dist/components/ProtectedRoute/index.js.map +1 -1
- package/dist/components/Row/index.d.ts +28 -0
- package/dist/components/Row/index.js +30 -0
- package/dist/components/Row/index.js.map +1 -0
- package/dist/components/Select/index.js +251 -254
- package/dist/components/Select/index.js.map +1 -1
- package/dist/components/SidebarToggleButton/index.js +56 -59
- package/dist/components/SidebarToggleButton/index.js.map +1 -1
- package/dist/components/Slider/index.d.ts +39 -0
- package/dist/components/Slider/index.js +52 -0
- package/dist/components/Slider/index.js.map +1 -0
- package/dist/components/StatCard/index.d.ts +29 -1
- package/dist/components/StatCard/index.js +189 -86
- package/dist/components/StatCard/index.js.map +1 -1
- package/dist/components/Switch/index.d.ts +34 -0
- package/dist/components/Switch/index.js +55 -0
- package/dist/components/Switch/index.js.map +1 -0
- package/dist/components/Tab/index.d.ts +40 -0
- package/dist/components/Table/index.js +109 -121
- package/dist/components/Table/index.js.map +1 -1
- package/dist/components/Tabs/index.js +28 -38
- package/dist/components/Tabs/index.js.map +1 -1
- package/dist/components/Text/index.d.ts +43 -0
- package/dist/components/Text/index.js +55 -0
- package/dist/components/Text/index.js.map +1 -0
- package/dist/components/Tooltip/index.d.ts +23 -0
- package/dist/components/Tooltip/index.js +34 -0
- package/dist/components/Tooltip/index.js.map +1 -0
- package/dist/components/Tree/Tree.js +205 -205
- package/dist/components/Tree/Tree.js.map +1 -1
- package/dist/components/pro/ArticleContextMenu/index.js +86 -87
- package/dist/components/pro/ArticleContextMenu/index.js.map +1 -1
- package/dist/components/pro/ArticleControl/ArticleControl2.js +250 -250
- package/dist/components/pro/ArticleControl/ArticleControl2.js.map +1 -1
- package/dist/components/pro/ArticleControl/buildHeadingTree.js +31 -32
- package/dist/components/pro/ArticleControl/buildHeadingTree.js.map +1 -1
- package/dist/components/pro/ArticleControl/useArticleToc.js +100 -102
- package/dist/components/pro/ArticleControl/useArticleToc.js.map +1 -1
- package/dist/components/pro/Calendar/Calendar.d.ts +10 -0
- package/dist/components/pro/Calendar/hooks/useCalendarDrag.d.ts +47 -0
- package/dist/components/pro/Calendar/hooks/useCalendarState.d.ts +56 -0
- package/dist/components/pro/Calendar/index.d.ts +7 -0
- package/dist/components/pro/Calendar/types.d.ts +151 -0
- package/dist/components/pro/Calendar/utils.d.ts +94 -0
- package/dist/components/pro/Chat/Chat.d.ts +6 -0
- package/dist/components/pro/Chat/index.d.ts +2 -0
- package/dist/components/pro/Chat/types.d.ts +84 -0
- package/dist/components/pro/CodeEditor/editors/CodeEditor.js +287 -327
- package/dist/components/pro/CodeEditor/editors/CodeEditor.js.map +1 -1
- package/dist/components/pro/CodeEditor/editors/MarkdownEditor.js +167 -224
- package/dist/components/pro/CodeEditor/editors/MarkdownEditor.js.map +1 -1
- package/dist/components/pro/CodeEditor/editors/markdownExtensions.js +594 -613
- package/dist/components/pro/CodeEditor/editors/markdownExtensions.js.map +1 -1
- package/dist/components/pro/CodeEditor/extensions/contextMenu.js +54 -55
- package/dist/components/pro/CodeEditor/extensions/contextMenu.js.map +1 -1
- package/dist/components/pro/CodeEditor/extensions/index.js +152 -160
- package/dist/components/pro/CodeEditor/extensions/index.js.map +1 -1
- package/dist/components/pro/CodeEditor/langs/index.js +7 -15
- package/dist/components/pro/CodeEditor/langs/index.js.map +1 -1
- package/dist/components/pro/CodeEditor/langs/javascript.js +11 -48
- package/dist/components/pro/CodeEditor/langs/javascript.js.map +1 -1
- package/dist/components/pro/CodeEditor/langs/python.js +4 -40
- package/dist/components/pro/CodeEditor/langs/python.js.map +1 -1
- package/dist/components/pro/CodeEditor/langs/snippets.js +118 -147
- package/dist/components/pro/CodeEditor/langs/snippets.js.map +1 -1
- package/dist/components/pro/CodeEditor/panels/FootnotePanel.js +153 -153
- package/dist/components/pro/CodeEditor/panels/FootnotePanel.js.map +1 -1
- package/dist/components/pro/CodeEditor/panels/HistoryPanel.js +180 -190
- package/dist/components/pro/CodeEditor/panels/HistoryPanel.js.map +1 -1
- package/dist/components/pro/CodeEditor/panels/OutlinePanel.js +130 -137
- package/dist/components/pro/CodeEditor/panels/OutlinePanel.js.map +1 -1
- package/dist/components/pro/CodeEditor/panels/TableOfContentsPanel.js +228 -242
- package/dist/components/pro/CodeEditor/panels/TableOfContentsPanel.js.map +1 -1
- package/dist/components/pro/CodeEditor/panels/VariablePanel.js +208 -248
- package/dist/components/pro/CodeEditor/panels/VariablePanel.js.map +1 -1
- package/dist/components/pro/CodeEditor/themes.js +513 -483
- package/dist/components/pro/CodeEditor/themes.js.map +1 -1
- package/dist/components/pro/CodeEditor/types.d.ts +1 -1
- package/dist/components/pro/CodeEditor/utils.js +171 -175
- package/dist/components/pro/CodeEditor/utils.js.map +1 -1
- package/dist/components/pro/DataTable/DataTable.js +305 -306
- package/dist/components/pro/DataTable/DataTable.js.map +1 -1
- package/dist/components/pro/DataTable/Filters.js +299 -314
- package/dist/components/pro/DataTable/Filters.js.map +1 -1
- package/dist/components/pro/DataTable/PivotPanel.js +203 -204
- package/dist/components/pro/DataTable/PivotPanel.js.map +1 -1
- package/dist/components/pro/DataTable/PivotView.js +142 -144
- package/dist/components/pro/DataTable/PivotView.js.map +1 -1
- package/dist/components/pro/DataTable/components/BulkActions.js +42 -42
- package/dist/components/pro/DataTable/components/BulkActions.js.map +1 -1
- package/dist/components/pro/DataTable/components/ColumnSelector.js +84 -84
- package/dist/components/pro/DataTable/components/ColumnSelector.js.map +1 -1
- package/dist/components/pro/DataTable/components/FilterBar.js +58 -58
- package/dist/components/pro/DataTable/components/FilterBar.js.map +1 -1
- package/dist/components/pro/DataTable/components/TableBody.js +93 -94
- package/dist/components/pro/DataTable/components/TableBody.js.map +1 -1
- package/dist/components/pro/DataTable/components/TableHeader.js +78 -78
- package/dist/components/pro/DataTable/components/TableHeader.js.map +1 -1
- package/dist/components/pro/DataTable/components/TablePagination.js +77 -77
- package/dist/components/pro/DataTable/components/TablePagination.js.map +1 -1
- package/dist/components/pro/DataTable/components/TableToolbar.js +40 -40
- package/dist/components/pro/DataTable/components/TableToolbar.js.map +1 -1
- package/dist/components/pro/DataTable/extension.js +5 -5
- package/dist/components/pro/DataTable/extension.js.map +1 -1
- package/dist/components/pro/DataTable/pivotEngine.js +84 -92
- package/dist/components/pro/DataTable/pivotEngine.js.map +1 -1
- package/dist/components/pro/DataTable/pivotExtension.js +93 -93
- package/dist/components/pro/DataTable/pivotExtension.js.map +1 -1
- package/dist/components/pro/DataTable/rowDetailExtension.js +30 -30
- package/dist/components/pro/DataTable/rowDetailExtension.js.map +1 -1
- package/dist/components/pro/DataTable/tanstack-table.js +45 -62
- package/dist/components/pro/DataTable/tanstack-table.js.map +1 -1
- package/dist/components/pro/DataTable/treeDataUtils.js +37 -48
- package/dist/components/pro/DataTable/treeDataUtils.js.map +1 -1
- package/dist/components/pro/DataTable/useColumnDragReorder.js +68 -68
- package/dist/components/pro/DataTable/useColumnDragReorder.js.map +1 -1
- package/dist/components/pro/DataTable/utils.js +156 -168
- package/dist/components/pro/DataTable/utils.js.map +1 -1
- package/dist/components/pro/FileExplorer/Breadcrumb.js +180 -180
- package/dist/components/pro/FileExplorer/Breadcrumb.js.map +1 -1
- package/dist/components/pro/FileExplorer/CreateDialog.js +78 -78
- package/dist/components/pro/FileExplorer/CreateDialog.js.map +1 -1
- package/dist/components/pro/FileExplorer/FileExplorer.js +202 -205
- package/dist/components/pro/FileExplorer/FileExplorer.js.map +1 -1
- package/dist/components/pro/FileExplorer/FileIcon.js +189 -189
- package/dist/components/pro/FileExplorer/FileIcon.js.map +1 -1
- package/dist/components/pro/FileExplorer/GridView.js +100 -100
- package/dist/components/pro/FileExplorer/GridView.js.map +1 -1
- package/dist/components/pro/FileExplorer/ListView.js +209 -209
- package/dist/components/pro/FileExplorer/ListView.js.map +1 -1
- package/dist/components/pro/FileExplorer/Toolbar.js +199 -199
- package/dist/components/pro/FileExplorer/Toolbar.js.map +1 -1
- package/dist/components/pro/Flow/Flow.js +920 -948
- package/dist/components/pro/Flow/Flow.js.map +1 -1
- package/dist/components/pro/Flow/FlowCanvas.js +1626 -1662
- package/dist/components/pro/Flow/FlowCanvas.js.map +1 -1
- package/dist/components/pro/Flow/archify/build.js +85 -94
- package/dist/components/pro/Flow/archify/build.js.map +1 -1
- package/dist/components/pro/Flow/archify/convert.js +512 -519
- package/dist/components/pro/Flow/archify/convert.js.map +1 -1
- package/dist/components/pro/Flow/archify/palette.js +87 -104
- package/dist/components/pro/Flow/archify/palette.js.map +1 -1
- package/dist/components/pro/Flow/archify/presets.js +34 -37
- package/dist/components/pro/Flow/archify/presets.js.map +1 -1
- package/dist/components/pro/Flow/archify/spec.js +7 -7
- package/dist/components/pro/Flow/archify/spec.js.map +1 -1
- package/dist/components/pro/Flow/canvas/AlignmentGuides.js +25 -25
- package/dist/components/pro/Flow/canvas/AlignmentGuides.js.map +1 -1
- package/dist/components/pro/Flow/canvas/GridRenderer.js +54 -55
- package/dist/components/pro/Flow/canvas/GridRenderer.js.map +1 -1
- package/dist/components/pro/Flow/canvas/MiniMapRenderer.js +54 -58
- package/dist/components/pro/Flow/canvas/MiniMapRenderer.js.map +1 -1
- package/dist/components/pro/Flow/canvas/PixiApp.js +105 -102
- package/dist/components/pro/Flow/canvas/PixiApp.js.map +1 -1
- package/dist/components/pro/Flow/canvas/SelectionOverlay.js +38 -38
- package/dist/components/pro/Flow/canvas/SelectionOverlay.js.map +1 -1
- package/dist/components/pro/Flow/canvas/ViewportContainer.js +117 -117
- package/dist/components/pro/Flow/canvas/ViewportContainer.js.map +1 -1
- package/dist/components/pro/Flow/constants.js +266 -278
- package/dist/components/pro/Flow/constants.js.map +1 -1
- package/dist/components/pro/Flow/context/FlowAIContext.js +27 -28
- package/dist/components/pro/Flow/context/FlowAIContext.js.map +1 -1
- package/dist/components/pro/Flow/context/FlowContext.js +60 -61
- package/dist/components/pro/Flow/context/FlowContext.js.map +1 -1
- package/dist/components/pro/Flow/context/FlowUIContext.js +115 -117
- package/dist/components/pro/Flow/context/FlowUIContext.js.map +1 -1
- package/dist/components/pro/Flow/edges/EdgeRenderer.js +135 -138
- package/dist/components/pro/Flow/edges/EdgeRenderer.js.map +1 -1
- package/dist/components/pro/Flow/edges/edgeMarkers.js +11 -14
- package/dist/components/pro/Flow/edges/edgeMarkers.js.map +1 -1
- package/dist/components/pro/Flow/edges/edgePaths.js +351 -367
- package/dist/components/pro/Flow/edges/edgePaths.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useAlignmentGuides.js +49 -52
- package/dist/components/pro/Flow/hooks/useAlignmentGuides.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useClipboard.js +154 -154
- package/dist/components/pro/Flow/hooks/useClipboard.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useCompactMode.js +17 -17
- package/dist/components/pro/Flow/hooks/useCompactMode.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useDeleteSelection.js +40 -40
- package/dist/components/pro/Flow/hooks/useDeleteSelection.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useDraggablePanel.js +51 -51
- package/dist/components/pro/Flow/hooks/useDraggablePanel.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useEdgeMutations.js +157 -157
- package/dist/components/pro/Flow/hooks/useEdgeMutations.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useFlowImportExport.js +190 -201
- package/dist/components/pro/Flow/hooks/useFlowImportExport.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useKeyboardShortcuts.js +32 -38
- package/dist/components/pro/Flow/hooks/useKeyboardShortcuts.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useLayoutActions.js +172 -180
- package/dist/components/pro/Flow/hooks/useLayoutActions.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useLineMutations.js +57 -57
- package/dist/components/pro/Flow/hooks/useLineMutations.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useMindMap.js +229 -238
- package/dist/components/pro/Flow/hooks/useMindMap.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useNodeMutations.js +102 -102
- package/dist/components/pro/Flow/hooks/useNodeMutations.js.map +1 -1
- package/dist/components/pro/Flow/hooks/usePdfExport.js +55 -56
- package/dist/components/pro/Flow/hooks/usePdfExport.js.map +1 -1
- package/dist/components/pro/Flow/hooks/usePixiApp.js +55 -57
- package/dist/components/pro/Flow/hooks/usePixiApp.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useResizablePanel.js +31 -31
- package/dist/components/pro/Flow/hooks/useResizablePanel.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useSelection.js +69 -69
- package/dist/components/pro/Flow/hooks/useSelection.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useUndoRedo.js +27 -27
- package/dist/components/pro/Flow/hooks/useUndoRedo.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useViewport.js +28 -28
- package/dist/components/pro/Flow/hooks/useViewport.js.map +1 -1
- package/dist/components/pro/Flow/lines/FreehandTool.js +63 -63
- package/dist/components/pro/Flow/lines/FreehandTool.js.map +1 -1
- package/dist/components/pro/Flow/lines/GeometricLineTool.js +80 -80
- package/dist/components/pro/Flow/lines/GeometricLineTool.js.map +1 -1
- package/dist/components/pro/Flow/lines/LineRenderer.js +88 -88
- package/dist/components/pro/Flow/lines/LineRenderer.js.map +1 -1
- package/dist/components/pro/Flow/lines/lineSmoothing.js +32 -34
- package/dist/components/pro/Flow/lines/lineSmoothing.js.map +1 -1
- package/dist/components/pro/Flow/nodes/DataNodeView.js +236 -242
- package/dist/components/pro/Flow/nodes/DataNodeView.js.map +1 -1
- package/dist/components/pro/Flow/nodes/MediaContent.js +236 -246
- package/dist/components/pro/Flow/nodes/MediaContent.js.map +1 -1
- package/dist/components/pro/Flow/nodes/MediaOverlay.js +63 -63
- package/dist/components/pro/Flow/nodes/MediaOverlay.js.map +1 -1
- package/dist/components/pro/Flow/nodes/Model3DView.js +111 -113
- package/dist/components/pro/Flow/nodes/Model3DView.js.map +1 -1
- package/dist/components/pro/Flow/nodes/NodeHandles.js +74 -80
- package/dist/components/pro/Flow/nodes/NodeHandles.js.map +1 -1
- package/dist/components/pro/Flow/nodes/NodeRenderer.js +303 -314
- package/dist/components/pro/Flow/nodes/NodeRenderer.js.map +1 -1
- package/dist/components/pro/Flow/nodes/NodeText.js +25 -29
- package/dist/components/pro/Flow/nodes/NodeText.js.map +1 -1
- package/dist/components/pro/Flow/nodes/aiClient.js +124 -137
- package/dist/components/pro/Flow/nodes/aiClient.js.map +1 -1
- package/dist/components/pro/Flow/nodes/animAnchors.js +42 -49
- package/dist/components/pro/Flow/nodes/animAnchors.js.map +1 -1
- package/dist/components/pro/Flow/nodes/dataUtils.js +246 -267
- package/dist/components/pro/Flow/nodes/dataUtils.js.map +1 -1
- package/dist/components/pro/Flow/nodes/nodeUtils.js +23 -28
- package/dist/components/pro/Flow/nodes/nodeUtils.js.map +1 -1
- package/dist/components/pro/Flow/nodes/shapes.js +556 -589
- package/dist/components/pro/Flow/nodes/shapes.js.map +1 -1
- package/dist/components/pro/Flow/nodes/svgIconTexture.js +37 -39
- package/dist/components/pro/Flow/nodes/svgIconTexture.js.map +1 -1
- package/dist/components/pro/Flow/nodes/svgIcons.js +684 -689
- package/dist/components/pro/Flow/nodes/svgIcons.js.map +1 -1
- package/dist/components/pro/Flow/panels/AIPanel.js +464 -491
- package/dist/components/pro/Flow/panels/AIPanel.js.map +1 -1
- package/dist/components/pro/Flow/panels/Breadcrumb.js +41 -41
- package/dist/components/pro/Flow/panels/Breadcrumb.js.map +1 -1
- package/dist/components/pro/Flow/panels/ContextMenu.js +37 -37
- package/dist/components/pro/Flow/panels/ContextMenu.js.map +1 -1
- package/dist/components/pro/Flow/panels/DataInspectorSection.js +428 -432
- package/dist/components/pro/Flow/panels/DataInspectorSection.js.map +1 -1
- package/dist/components/pro/Flow/panels/ExpandableTextarea.js +61 -62
- package/dist/components/pro/Flow/panels/ExpandableTextarea.js.map +1 -1
- package/dist/components/pro/Flow/panels/FlowPanelGroup.js +114 -114
- package/dist/components/pro/Flow/panels/FlowPanelGroup.js.map +1 -1
- package/dist/components/pro/Flow/panels/FlowToolbar.js +347 -391
- package/dist/components/pro/Flow/panels/FlowToolbar.js.map +1 -1
- package/dist/components/pro/Flow/panels/InspectorPanel.js +1792 -1798
- package/dist/components/pro/Flow/panels/InspectorPanel.js.map +1 -1
- package/dist/components/pro/Flow/panels/OutlinePanel.js +242 -248
- package/dist/components/pro/Flow/panels/OutlinePanel.js.map +1 -1
- package/dist/components/pro/Flow/panels/PresentationMode.js +137 -140
- package/dist/components/pro/Flow/panels/PresentationMode.js.map +1 -1
- package/dist/components/pro/Flow/panels/ProjectTitle.js +46 -46
- package/dist/components/pro/Flow/panels/ProjectTitle.js.map +1 -1
- package/dist/components/pro/Flow/panels/ShapePalette.js +557 -572
- package/dist/components/pro/Flow/panels/ShapePalette.js.map +1 -1
- package/dist/components/pro/Flow/panels/toolbarIcons.d.ts +0 -1
- package/dist/components/pro/Flow/panels/toolbarIcons.js +508 -557
- package/dist/components/pro/Flow/panels/toolbarIcons.js.map +1 -1
- package/dist/components/pro/Flow/types.js +26 -26
- package/dist/components/pro/Flow/types.js.map +1 -1
- package/dist/components/pro/Flow/utils/dashedLine.js +113 -117
- package/dist/components/pro/Flow/utils/dashedLine.js.map +1 -1
- package/dist/components/pro/Flow/utils/gradient.js +55 -55
- package/dist/components/pro/Flow/utils/gradient.js.map +1 -1
- package/dist/components/pro/Flow/utils/pdfExport.js +50 -89
- package/dist/components/pro/Flow/utils/pdfExport.js.map +1 -1
- package/dist/components/pro/Flow/utils/themeColor.js +185 -195
- package/dist/components/pro/Flow/utils/themeColor.js.map +1 -1
- package/dist/components/pro/Gantt/Gantt.d.ts +7 -0
- package/dist/components/pro/Gantt/hooks/useGanttDrag.d.ts +31 -0
- package/dist/components/pro/Gantt/hooks/useGanttState.d.ts +58 -0
- package/dist/components/pro/Gantt/index.d.ts +6 -0
- package/dist/components/pro/Gantt/types.d.ts +478 -0
- package/dist/components/pro/Gantt/utils.d.ts +124 -0
- package/dist/components/pro/Resizable/Resizable.d.ts +30 -0
- package/dist/components/pro/Resizable/index.d.ts +2 -0
- package/dist/components/pro/RichTextEditor/AIRewrite.js +323 -334
- package/dist/components/pro/RichTextEditor/AIRewrite.js.map +1 -1
- package/dist/components/pro/RichTextEditor/BlockHandle.js +314 -316
- package/dist/components/pro/RichTextEditor/BlockHandle.js.map +1 -1
- package/dist/components/pro/RichTextEditor/BubbleToolbar.js +97 -97
- package/dist/components/pro/RichTextEditor/BubbleToolbar.js.map +1 -1
- package/dist/components/pro/RichTextEditor/CommentDialog.js +88 -88
- package/dist/components/pro/RichTextEditor/CommentDialog.js.map +1 -1
- package/dist/components/pro/RichTextEditor/CommentPanel.js +240 -240
- package/dist/components/pro/RichTextEditor/CommentPanel.js.map +1 -1
- package/dist/components/pro/RichTextEditor/CommentPopover.js +234 -234
- package/dist/components/pro/RichTextEditor/CommentPopover.js.map +1 -1
- package/dist/components/pro/RichTextEditor/ContextMenu.js +251 -252
- package/dist/components/pro/RichTextEditor/ContextMenu.js.map +1 -1
- package/dist/components/pro/RichTextEditor/RichTextEditor.js +267 -271
- package/dist/components/pro/RichTextEditor/RichTextEditor.js.map +1 -1
- package/dist/components/pro/RichTextEditor/SlashMenu.js +214 -214
- package/dist/components/pro/RichTextEditor/SlashMenu.js.map +1 -1
- package/dist/components/pro/RichTextEditor/Toolbar/ColorPicker.js +44 -75
- package/dist/components/pro/RichTextEditor/Toolbar/ColorPicker.js.map +1 -1
- package/dist/components/pro/RichTextEditor/Toolbar/FloatingDialogMenu.js +261 -261
- package/dist/components/pro/RichTextEditor/Toolbar/FloatingDialogMenu.js.map +1 -1
- package/dist/components/pro/RichTextEditor/Toolbar/MarkdownTemplates.js +172 -526
- package/dist/components/pro/RichTextEditor/Toolbar/MarkdownTemplates.js.map +1 -1
- package/dist/components/pro/RichTextEditor/Toolbar/SelectDropdown.js +112 -114
- package/dist/components/pro/RichTextEditor/Toolbar/SelectDropdown.js.map +1 -1
- package/dist/components/pro/RichTextEditor/Toolbar/TableOpsMenu.js +194 -194
- package/dist/components/pro/RichTextEditor/Toolbar/TableOpsMenu.js.map +1 -1
- package/dist/components/pro/RichTextEditor/Toolbar/Toolbar.js +970 -973
- package/dist/components/pro/RichTextEditor/Toolbar/Toolbar.js.map +1 -1
- package/dist/components/pro/RichTextEditor/Toolbar/ToolbarButton.js +11 -12
- package/dist/components/pro/RichTextEditor/Toolbar/ToolbarButton.js.map +1 -1
- package/dist/components/pro/RichTextEditor/extensions/CodeBlockView.js +310 -344
- package/dist/components/pro/RichTextEditor/extensions/CodeBlockView.js.map +1 -1
- package/dist/components/pro/RichTextEditor/extensions/CommentMark.js +38 -39
- package/dist/components/pro/RichTextEditor/extensions/CommentMark.js.map +1 -1
- package/dist/components/pro/RichTextEditor/extensions/FloatingDialog.js +620 -625
- package/dist/components/pro/RichTextEditor/extensions/FloatingDialog.js.map +1 -1
- package/dist/components/pro/RichTextEditor/extensions/FontSize.js +25 -25
- package/dist/components/pro/RichTextEditor/extensions/FontSize.js.map +1 -1
- package/dist/components/pro/RichTextEditor/extensions/MarkdownBlock.js +167 -176
- package/dist/components/pro/RichTextEditor/extensions/MarkdownBlock.js.map +1 -1
- package/dist/components/pro/RichTextEditor/types.js +75 -75
- package/dist/components/pro/RichTextEditor/types.js.map +1 -1
- package/dist/contexts/AppContext.d.ts +1 -1
- package/dist/contexts/AppContext.js +216 -221
- package/dist/contexts/AppContext.js.map +1 -1
- package/dist/data-table.js +15 -41
- package/dist/data-table.js.map +1 -1
- package/dist/dishui.css +1 -1
- package/dist/flow.js +27 -83
- package/dist/hooks/useClickOutside.js +18 -18
- package/dist/hooks/useClickOutside.js.map +1 -1
- package/dist/hooks/useContainerElement.js +9 -9
- package/dist/hooks/useContainerElement.js.map +1 -1
- package/dist/hooks/useControllableState.js +33 -35
- package/dist/hooks/useControllableState.js.map +1 -1
- package/dist/hooks/useCopyToClipboard.js +16 -16
- package/dist/hooks/useCopyToClipboard.js.map +1 -1
- package/dist/hooks/useDebounce.js +14 -14
- package/dist/hooks/useDebounce.js.map +1 -1
- package/dist/hooks/useDraggable.js +50 -50
- package/dist/hooks/useDraggable.js.map +1 -1
- package/dist/hooks/useTableColumns.js +39 -41
- package/dist/hooks/useTableColumns.js.map +1 -1
- package/dist/hooks/useTableData.js +67 -68
- package/dist/hooks/useTableData.js.map +1 -1
- package/dist/index-nostyled.d.ts +8 -0
- package/dist/index.d.ts +27 -1
- package/dist/index.js +105 -241
- package/dist/layouts/MainLayout.js +56 -56
- package/dist/layouts/MainLayout.js.map +1 -1
- package/dist/layouts/Navbar.js +214 -214
- package/dist/layouts/Navbar.js.map +1 -1
- package/dist/layouts/Sidebar.js +184 -186
- package/dist/layouts/Sidebar.js.map +1 -1
- package/dist/layouts/headbar/Headbar.js +25 -25
- package/dist/layouts/headbar/Headbar.js.map +1 -1
- package/dist/layouts/headbar/HeadbarLangSwitcher.js +39 -39
- package/dist/layouts/headbar/HeadbarLangSwitcher.js.map +1 -1
- package/dist/layouts/headbar/HeadbarSearch.js +120 -120
- package/dist/layouts/headbar/HeadbarSearch.js.map +1 -1
- package/dist/layouts/headbar/HeadbarThemeSwitcher.js +27 -27
- package/dist/layouts/headbar/HeadbarThemeSwitcher.js.map +1 -1
- package/dist/layouts/headbar/HeadbarTitle.js +26 -26
- package/dist/layouts/headbar/HeadbarTitle.js.map +1 -1
- package/dist/lite.js +9 -24
- package/dist/markdown.js +4 -9
- package/dist/pages/components/Calendar/index.d.ts +3 -0
- package/dist/pages/components/Calendar/index.en.d.ts +3 -0
- package/dist/pages/components/Calendar/index.zh.d.ts +3 -0
- package/dist/pages/components/Chat/index.d.ts +3 -0
- package/dist/pages/components/Chat/index.en.d.ts +3 -0
- package/dist/pages/components/Chat/index.zh.d.ts +3 -0
- package/dist/pages/components/FloatWindow/index.d.ts +3 -0
- package/dist/pages/components/FloatWindow/index.en.d.ts +3 -0
- package/dist/pages/components/FloatWindow/index.zh.d.ts +3 -0
- package/dist/pages/components/Gantt/index.d.ts +3 -0
- package/dist/pages/components/Gantt/index.en.d.ts +3 -0
- package/dist/pages/components/Gantt/index.zh.d.ts +3 -0
- package/dist/pages/components/GridLayout/index.d.ts +3 -0
- package/dist/pages/components/GridLayout/index.en.d.ts +3 -0
- package/dist/pages/components/GridLayout/index.zh.d.ts +3 -0
- package/dist/pages/components/Notification/index.d.ts +3 -0
- package/dist/pages/components/Notification/index.en.d.ts +3 -0
- package/dist/pages/components/Notification/index.zh.d.ts +3 -0
- package/dist/pages/components/Resizable/index.d.ts +3 -0
- package/dist/pages/components/Resizable/index.en.d.ts +3 -0
- package/dist/pages/components/Resizable/index.zh.d.ts +3 -0
- package/dist/pages/components/Tab/index.d.ts +3 -0
- package/dist/pages/components/Tab/index.en.d.ts +3 -0
- package/dist/pages/components/Tab/index.zh.d.ts +3 -0
- package/dist/styles/themeStyles.js +87 -86
- package/dist/styles/themeStyles.js.map +1 -1
- package/dist/utils/cn.d.ts +13 -0
- package/dist/utils/cn.js +16 -0
- package/dist/utils/cn.js.map +1 -0
- package/dist/utils/i18n.js +690 -602
- package/dist/utils/i18n.js.map +1 -1
- package/dist/utils/menu.js +94 -94
- package/dist/utils/menu.js.map +1 -1
- package/dist/utils/rehype-code-meta.js +14 -14
- package/dist/utils/rehype-code-meta.js.map +1 -1
- package/dist/utils/remark-code-meta.js +9 -9
- package/dist/utils/remark-code-meta.js.map +1 -1
- package/dist/utils/routerBuilder.js +59 -60
- package/dist/utils/routerBuilder.js.map +1 -1
- package/dist/utils/selection.js +28 -29
- package/dist/utils/selection.js.map +1 -1
- package/dist/utils/themes.js +275 -255
- package/dist/utils/themes.js.map +1 -1
- package/package.json +19 -6
|
@@ -1,36 +1,35 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
import e from "react";
|
|
2
|
+
//#region src/components/pro/ArticleControl/buildHeadingTree.ts
|
|
3
|
+
function t(t) {
|
|
4
|
+
let n = [], r = [];
|
|
5
|
+
return t.forEach((t, i) => {
|
|
6
|
+
let a = {
|
|
7
|
+
id: t.id || `heading-${i}`,
|
|
8
|
+
label: t.text,
|
|
9
|
+
icon: e.createElement("span", { className: "text-xs opacity-50" }, t.level === 1 ? "●" : t.level === 2 ? "○" : "▪"),
|
|
10
|
+
meta: { heading: t }
|
|
11
|
+
};
|
|
12
|
+
for (; r.length > 0 && r[r.length - 1].level >= t.level;) r.pop();
|
|
13
|
+
if (r.length === 0) n.push(a);
|
|
14
|
+
else {
|
|
15
|
+
let e = r[r.length - 1].node;
|
|
16
|
+
e.children ||= [], e.children.push(a);
|
|
17
|
+
}
|
|
18
|
+
r.push({
|
|
19
|
+
node: a,
|
|
20
|
+
level: t.level
|
|
21
|
+
});
|
|
22
|
+
}), n;
|
|
22
23
|
}
|
|
23
|
-
function
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
function n(e) {
|
|
25
|
+
let t = [], n = (e) => {
|
|
26
|
+
e.forEach((e) => {
|
|
27
|
+
t.push(e.id), e.children && n(e.children);
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
return n(e), t;
|
|
30
31
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
d as getAllNodeIds
|
|
34
|
-
};
|
|
32
|
+
//#endregion
|
|
33
|
+
export { t as buildHeadingTree, n as getAllNodeIds };
|
|
35
34
|
|
|
36
35
|
//# sourceMappingURL=buildHeadingTree.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildHeadingTree.js","names":[],"sources":["../../../../src/components/pro/ArticleControl/buildHeadingTree.ts"],"sourcesContent":["import React from 'react';\nimport type { TreeNode } from '../../Tree';\nimport type { HeadingItem } from './types';\n\nexport function buildHeadingTree(items: HeadingItem[]): TreeNode[] {\n const result: TreeNode[] = [];\n const stack: { node: TreeNode; level: number }[] = [];\n\n items.forEach((item, index) => {\n const treeNode: TreeNode = {\n id: item.id || `heading-${index}`,\n label: item.text,\n icon: React.createElement(\n 'span',\n { className: 'text-xs opacity-50' },\n item.level === 1 ? '●' : item.level === 2 ? '○' : '▪',\n ),\n meta: { heading: item },\n };\n\n while (stack.length > 0 && stack[stack.length - 1].level >= item.level) {\n stack.pop();\n }\n\n if (stack.length === 0) {\n result.push(treeNode);\n } else {\n const parent = stack[stack.length - 1].node;\n if (!parent.children) parent.children = [];\n parent.children.push(treeNode);\n }\n\n stack.push({ node: treeNode, level: item.level });\n });\n\n return result;\n}\n\nexport function getAllNodeIds(nodes: TreeNode[]): (string | number)[] {\n const ids: (string | number)[] = [];\n const traverse = (items: TreeNode[]) => {\n items.forEach(node => {\n ids.push(node.id);\n if (node.children) traverse(node.children);\n });\n };\n traverse(nodes);\n return ids;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"buildHeadingTree.js","names":[],"sources":["../../../../src/components/pro/ArticleControl/buildHeadingTree.ts"],"sourcesContent":["import React from 'react';\nimport type { TreeNode } from '../../Tree';\nimport type { HeadingItem } from './types';\n\nexport function buildHeadingTree(items: HeadingItem[]): TreeNode[] {\n const result: TreeNode[] = [];\n const stack: { node: TreeNode; level: number }[] = [];\n\n items.forEach((item, index) => {\n const treeNode: TreeNode = {\n id: item.id || `heading-${index}`,\n label: item.text,\n icon: React.createElement(\n 'span',\n { className: 'text-xs opacity-50' },\n item.level === 1 ? '●' : item.level === 2 ? '○' : '▪',\n ),\n meta: { heading: item },\n };\n\n while (stack.length > 0 && stack[stack.length - 1].level >= item.level) {\n stack.pop();\n }\n\n if (stack.length === 0) {\n result.push(treeNode);\n } else {\n const parent = stack[stack.length - 1].node;\n if (!parent.children) parent.children = [];\n parent.children.push(treeNode);\n }\n\n stack.push({ node: treeNode, level: item.level });\n });\n\n return result;\n}\n\nexport function getAllNodeIds(nodes: TreeNode[]): (string | number)[] {\n const ids: (string | number)[] = [];\n const traverse = (items: TreeNode[]) => {\n items.forEach(node => {\n ids.push(node.id);\n if (node.children) traverse(node.children);\n });\n };\n traverse(nodes);\n return ids;\n}\n"],"mappings":";;AAIA,SAAgB,EAAiB,GAAkC;CACjE,IAAM,IAAqB,CAAC,GACtB,IAA6C,CAAC;CA6BpD,OA3BA,EAAM,SAAS,GAAM,MAAU;EAC7B,IAAM,IAAqB;GACzB,IAAI,EAAK,MAAM,WAAW;GAC1B,OAAO,EAAK;GACZ,MAAM,EAAM,cACV,QACA,EAAE,WAAW,qBAAqB,GAClC,EAAK,UAAU,IAAI,MAAM,EAAK,UAAU,IAAI,MAAM,GACpD;GACA,MAAM,EAAE,SAAS,EAAK;EACxB;EAEA,OAAO,EAAM,SAAS,KAAK,EAAM,EAAM,SAAS,EAAE,CAAC,SAAS,EAAK,QAC/D,EAAM,IAAI;EAGZ,IAAI,EAAM,WAAW,GACnB,EAAO,KAAK,CAAQ;OACf;GACL,IAAM,IAAS,EAAM,EAAM,SAAS,EAAE,CAAC;GAEvC,AADA,AAAsB,EAAO,aAAW,CAAC,GACzC,EAAO,SAAS,KAAK,CAAQ;EAC/B;EAEA,EAAM,KAAK;GAAE,MAAM;GAAU,OAAO,EAAK;EAAM,CAAC;CAClD,CAAC,GAEM;AACT;AAEA,SAAgB,EAAc,GAAwC;CACpE,IAAM,IAA2B,CAAC,GAC5B,KAAY,MAAsB;EACtC,EAAM,SAAQ,MAAQ;GAEpB,AADA,EAAI,KAAK,EAAK,EAAE,GACZ,EAAK,YAAU,EAAS,EAAK,QAAQ;EAC3C,CAAC;CACH;CAEA,OADA,EAAS,CAAK,GACP;AACT"}
|
|
@@ -1,105 +1,103 @@
|
|
|
1
|
-
import { useCallback as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
};
|
|
1
|
+
import { useCallback as e, useEffect as t, useRef as n, useState as r } from "react";
|
|
2
|
+
//#region src/components/pro/ArticleControl/useArticleToc.ts
|
|
3
|
+
function i(i) {
|
|
4
|
+
let [a, o] = r([]), [s, c] = r(""), [l, u] = r(""), d = n("");
|
|
5
|
+
t(() => {
|
|
6
|
+
d.current = s;
|
|
7
|
+
}, [s]);
|
|
8
|
+
let f = e(() => {
|
|
9
|
+
if (!i) return;
|
|
10
|
+
let e = i.querySelectorAll("h1, h2, h3, h4, h5, h6"), t = [];
|
|
11
|
+
e.forEach((e) => {
|
|
12
|
+
let n = e.id || e.textContent?.toLowerCase().replace(/\s+/g, "-") || "", r = e.textContent || "", i = parseInt(e.tagName.substring(1));
|
|
13
|
+
!e.id && n && (e.id = n), t.push({
|
|
14
|
+
id: n,
|
|
15
|
+
text: r,
|
|
16
|
+
level: i
|
|
17
|
+
});
|
|
18
|
+
}), o(t);
|
|
19
|
+
}, [i]);
|
|
20
|
+
return t(() => {
|
|
21
|
+
if (!i) return;
|
|
22
|
+
let e = ((e) => {
|
|
23
|
+
let t = e;
|
|
24
|
+
for (; t;) {
|
|
25
|
+
let e = window.getComputedStyle(t).overflowY;
|
|
26
|
+
if (e === "auto" || e === "scroll") return t;
|
|
27
|
+
t = t.parentElement;
|
|
28
|
+
}
|
|
29
|
+
return null;
|
|
30
|
+
})(i), t = /* @__PURE__ */ new Map(), n = new IntersectionObserver((e) => {
|
|
31
|
+
e.forEach((e) => {
|
|
32
|
+
let n = e.target.id;
|
|
33
|
+
e.isIntersecting ? t.set(n, {
|
|
34
|
+
ratio: e.intersectionRatio,
|
|
35
|
+
top: e.boundingClientRect.top
|
|
36
|
+
}) : t.delete(n);
|
|
37
|
+
});
|
|
38
|
+
let n = "", r = Infinity;
|
|
39
|
+
if (t.forEach((e, t) => {
|
|
40
|
+
let i = Math.abs(e.top - 100);
|
|
41
|
+
i < r && (r = i, n = t);
|
|
42
|
+
}), !n) {
|
|
43
|
+
let e = i.querySelectorAll("h1, h2, h3, h4, h5, h6"), t = "";
|
|
44
|
+
e.forEach((e) => {
|
|
45
|
+
e.getBoundingClientRect().top <= 120 && (t = e.id);
|
|
46
|
+
}), t && (n = t);
|
|
47
|
+
}
|
|
48
|
+
n && n !== d.current && (u(d.current), c(n));
|
|
49
|
+
}, {
|
|
50
|
+
root: e,
|
|
51
|
+
rootMargin: "-5% 0px -70% 0px",
|
|
52
|
+
threshold: [
|
|
53
|
+
0,
|
|
54
|
+
.1,
|
|
55
|
+
.25,
|
|
56
|
+
.5,
|
|
57
|
+
.75,
|
|
58
|
+
1
|
|
59
|
+
]
|
|
60
|
+
});
|
|
61
|
+
i.querySelectorAll("h1, h2, h3, h4, h5, h6").forEach((e) => {
|
|
62
|
+
e.id && n.observe(e);
|
|
63
|
+
});
|
|
64
|
+
let r = () => {
|
|
65
|
+
let e = i.querySelectorAll("h1, h2, h3, h4, h5, h6"), t = "", n = Infinity;
|
|
66
|
+
e.forEach((e) => {
|
|
67
|
+
let r = e.getBoundingClientRect(), i = Math.abs(r.top - 100);
|
|
68
|
+
r.top <= 150 && i < n && (n = i, t = e.id);
|
|
69
|
+
}), t || e.forEach((e) => {
|
|
70
|
+
e.getBoundingClientRect().top <= 100 && (t = e.id);
|
|
71
|
+
}), t && t !== d.current && (u(d.current), c(t));
|
|
72
|
+
}, a = [];
|
|
73
|
+
return e && a.push(e), a.push(window), a.forEach((e) => e.addEventListener("scroll", r, { passive: !0 })), setTimeout(r, 100), () => {
|
|
74
|
+
n.disconnect(), a.forEach((e) => e.removeEventListener("scroll", r));
|
|
75
|
+
};
|
|
76
|
+
}, [i, a]), t(() => {
|
|
77
|
+
let e = setTimeout(f, 500);
|
|
78
|
+
return () => clearTimeout(e);
|
|
79
|
+
}, [f]), t(() => {
|
|
80
|
+
if (!i) return;
|
|
81
|
+
let e = new MutationObserver(() => f());
|
|
82
|
+
return e.observe(i, {
|
|
83
|
+
childList: !0,
|
|
84
|
+
subtree: !0
|
|
85
|
+
}), () => e.disconnect();
|
|
86
|
+
}, [i, f]), {
|
|
87
|
+
headings: a,
|
|
88
|
+
activeId: s,
|
|
89
|
+
prevActiveId: l,
|
|
90
|
+
setActiveId: c,
|
|
91
|
+
scrollToHeading: e((e) => {
|
|
92
|
+
let t = document.getElementById(e.id);
|
|
93
|
+
t && (t.scrollIntoView({
|
|
94
|
+
behavior: "smooth",
|
|
95
|
+
block: "start"
|
|
96
|
+
}), c(e.id));
|
|
97
|
+
}, [])
|
|
98
|
+
};
|
|
100
99
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
};
|
|
100
|
+
//#endregion
|
|
101
|
+
export { i as useArticleToc };
|
|
104
102
|
|
|
105
103
|
//# sourceMappingURL=useArticleToc.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useArticleToc.js","names":[],"sources":["../../../../src/components/pro/ArticleControl/useArticleToc.ts"],"sourcesContent":["import { useState, useEffect, useRef, useCallback } from 'react';\nimport type { HeadingItem } from './types';\n\nexport function useArticleToc(container: HTMLElement | null) {\n const [headings, setHeadings] = useState<HeadingItem[]>([]);\n const [activeId, setActiveId] = useState<string>('');\n const [prevActiveId, setPrevActiveId] = useState<string>('');\n const activeIdRef = useRef<string>('');\n\n useEffect(() => {\n activeIdRef.current = activeId;\n }, [activeId]);\n\n const extractHeadings = useCallback(() => {\n if (!container) return;\n\n const headingElements = container.querySelectorAll('h1, h2, h3, h4, h5, h6');\n const extracted: HeadingItem[] = [];\n\n headingElements.forEach((element) => {\n const id = element.id || element.textContent?.toLowerCase().replace(/\\s+/g, '-') || '';\n const text = element.textContent || '';\n const level = parseInt(element.tagName.substring(1));\n if (!element.id && id) element.id = id;\n extracted.push({ id, text, level });\n });\n\n setHeadings(extracted);\n }, [container]);\n\n useEffect(() => {\n if (!container) return;\n\n const findScrollContainer = (el: HTMLElement): HTMLElement | null => {\n let current: HTMLElement | null = el;\n while (current) {\n const overflow = window.getComputedStyle(current).overflowY;\n if (overflow === 'auto' || overflow === 'scroll') return current;\n current = current.parentElement;\n }\n return null;\n };\n\n const scrollContainer = findScrollContainer(container);\n const visibleHeadings = new Map<string, { ratio: number; top: number }>();\n\n const observer = new IntersectionObserver(\n (entries) => {\n entries.forEach((entry) => {\n const id = entry.target.id;\n if (entry.isIntersecting) {\n visibleHeadings.set(id, { ratio: entry.intersectionRatio, top: entry.boundingClientRect.top });\n } else {\n visibleHeadings.delete(id);\n }\n });\n\n let bestId = '';\n let bestTop = Infinity;\n\n visibleHeadings.forEach((info, id) => {\n const absTop = Math.abs(info.top - 100);\n if (absTop < bestTop) { bestTop = absTop; bestId = id; }\n });\n\n if (!bestId) {\n const headingElements = container!.querySelectorAll('h1, h2, h3, h4, h5, h6');\n let lastPassedId = '';\n headingElements.forEach((element) => {\n const rect = element.getBoundingClientRect();\n if (rect.top <= 120) lastPassedId = element.id;\n });\n if (lastPassedId) bestId = lastPassedId;\n }\n\n if (bestId && bestId !== activeIdRef.current) {\n setPrevActiveId(activeIdRef.current);\n setActiveId(bestId);\n }\n },\n {\n root: scrollContainer,\n rootMargin: '-5% 0px -70% 0px',\n threshold: [0, 0.1, 0.25, 0.5, 0.75, 1],\n },\n );\n\n const headingElements = container.querySelectorAll('h1, h2, h3, h4, h5, h6');\n headingElements.forEach((element) => { if (element.id) observer.observe(element); });\n\n const handleScroll = () => {\n const headingElements = container!.querySelectorAll('h1, h2, h3, h4, h5, h6');\n let currentId = '';\n let minDistance = Infinity;\n\n headingElements.forEach((element) => {\n const rect = element.getBoundingClientRect();\n const distance = Math.abs(rect.top - 100);\n if (rect.top <= 150 && distance < minDistance) { minDistance = distance; currentId = element.id; }\n });\n\n if (!currentId) {\n headingElements.forEach((element) => {\n const rect = element.getBoundingClientRect();\n if (rect.top <= 100) currentId = element.id;\n });\n }\n\n if (currentId && currentId !== activeIdRef.current) {\n setPrevActiveId(activeIdRef.current);\n setActiveId(currentId);\n }\n };\n\n const scrollTargets: (HTMLElement | Window)[] = [];\n if (scrollContainer) scrollTargets.push(scrollContainer);\n scrollTargets.push(window);\n scrollTargets.forEach(target => target.addEventListener('scroll', handleScroll, { passive: true }));\n setTimeout(handleScroll, 100);\n\n return () => {\n observer.disconnect();\n scrollTargets.forEach(target => target.removeEventListener('scroll', handleScroll));\n };\n }, [container, headings]);\n\n useEffect(() => {\n const timer = setTimeout(extractHeadings, 500);\n return () => clearTimeout(timer);\n }, [extractHeadings]);\n\n useEffect(() => {\n if (!container) return;\n const observer = new MutationObserver(() => extractHeadings());\n observer.observe(container, { childList: true, subtree: true });\n return () => observer.disconnect();\n }, [container, extractHeadings]);\n\n const scrollToHeading = useCallback((heading: HeadingItem) => {\n const element = document.getElementById(heading.id);\n if (element) {\n element.scrollIntoView({ behavior: 'smooth', block: 'start' });\n setActiveId(heading.id);\n }\n }, []);\n\n return { headings, activeId, prevActiveId, setActiveId, scrollToHeading };\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useArticleToc.js","names":[],"sources":["../../../../src/components/pro/ArticleControl/useArticleToc.ts"],"sourcesContent":["import { useState, useEffect, useRef, useCallback } from 'react';\nimport type { HeadingItem } from './types';\n\nexport function useArticleToc(container: HTMLElement | null) {\n const [headings, setHeadings] = useState<HeadingItem[]>([]);\n const [activeId, setActiveId] = useState<string>('');\n const [prevActiveId, setPrevActiveId] = useState<string>('');\n const activeIdRef = useRef<string>('');\n\n useEffect(() => {\n activeIdRef.current = activeId;\n }, [activeId]);\n\n const extractHeadings = useCallback(() => {\n if (!container) return;\n\n const headingElements = container.querySelectorAll('h1, h2, h3, h4, h5, h6');\n const extracted: HeadingItem[] = [];\n\n headingElements.forEach((element) => {\n const id = element.id || element.textContent?.toLowerCase().replace(/\\s+/g, '-') || '';\n const text = element.textContent || '';\n const level = parseInt(element.tagName.substring(1));\n if (!element.id && id) element.id = id;\n extracted.push({ id, text, level });\n });\n\n setHeadings(extracted);\n }, [container]);\n\n useEffect(() => {\n if (!container) return;\n\n const findScrollContainer = (el: HTMLElement): HTMLElement | null => {\n let current: HTMLElement | null = el;\n while (current) {\n const overflow = window.getComputedStyle(current).overflowY;\n if (overflow === 'auto' || overflow === 'scroll') return current;\n current = current.parentElement;\n }\n return null;\n };\n\n const scrollContainer = findScrollContainer(container);\n const visibleHeadings = new Map<string, { ratio: number; top: number }>();\n\n const observer = new IntersectionObserver(\n (entries) => {\n entries.forEach((entry) => {\n const id = entry.target.id;\n if (entry.isIntersecting) {\n visibleHeadings.set(id, { ratio: entry.intersectionRatio, top: entry.boundingClientRect.top });\n } else {\n visibleHeadings.delete(id);\n }\n });\n\n let bestId = '';\n let bestTop = Infinity;\n\n visibleHeadings.forEach((info, id) => {\n const absTop = Math.abs(info.top - 100);\n if (absTop < bestTop) { bestTop = absTop; bestId = id; }\n });\n\n if (!bestId) {\n const headingElements = container!.querySelectorAll('h1, h2, h3, h4, h5, h6');\n let lastPassedId = '';\n headingElements.forEach((element) => {\n const rect = element.getBoundingClientRect();\n if (rect.top <= 120) lastPassedId = element.id;\n });\n if (lastPassedId) bestId = lastPassedId;\n }\n\n if (bestId && bestId !== activeIdRef.current) {\n setPrevActiveId(activeIdRef.current);\n setActiveId(bestId);\n }\n },\n {\n root: scrollContainer,\n rootMargin: '-5% 0px -70% 0px',\n threshold: [0, 0.1, 0.25, 0.5, 0.75, 1],\n },\n );\n\n const headingElements = container.querySelectorAll('h1, h2, h3, h4, h5, h6');\n headingElements.forEach((element) => { if (element.id) observer.observe(element); });\n\n const handleScroll = () => {\n const headingElements = container!.querySelectorAll('h1, h2, h3, h4, h5, h6');\n let currentId = '';\n let minDistance = Infinity;\n\n headingElements.forEach((element) => {\n const rect = element.getBoundingClientRect();\n const distance = Math.abs(rect.top - 100);\n if (rect.top <= 150 && distance < minDistance) { minDistance = distance; currentId = element.id; }\n });\n\n if (!currentId) {\n headingElements.forEach((element) => {\n const rect = element.getBoundingClientRect();\n if (rect.top <= 100) currentId = element.id;\n });\n }\n\n if (currentId && currentId !== activeIdRef.current) {\n setPrevActiveId(activeIdRef.current);\n setActiveId(currentId);\n }\n };\n\n const scrollTargets: (HTMLElement | Window)[] = [];\n if (scrollContainer) scrollTargets.push(scrollContainer);\n scrollTargets.push(window);\n scrollTargets.forEach(target => target.addEventListener('scroll', handleScroll, { passive: true }));\n setTimeout(handleScroll, 100);\n\n return () => {\n observer.disconnect();\n scrollTargets.forEach(target => target.removeEventListener('scroll', handleScroll));\n };\n }, [container, headings]);\n\n useEffect(() => {\n const timer = setTimeout(extractHeadings, 500);\n return () => clearTimeout(timer);\n }, [extractHeadings]);\n\n useEffect(() => {\n if (!container) return;\n const observer = new MutationObserver(() => extractHeadings());\n observer.observe(container, { childList: true, subtree: true });\n return () => observer.disconnect();\n }, [container, extractHeadings]);\n\n const scrollToHeading = useCallback((heading: HeadingItem) => {\n const element = document.getElementById(heading.id);\n if (element) {\n element.scrollIntoView({ behavior: 'smooth', block: 'start' });\n setActiveId(heading.id);\n }\n }, []);\n\n return { headings, activeId, prevActiveId, setActiveId, scrollToHeading };\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DishUI Calendar Component
|
|
3
|
+
*
|
|
4
|
+
* A full-featured calendar with month/week/day views, drag-and-drop,
|
|
5
|
+
* holiday support, and entry management.
|
|
6
|
+
*/
|
|
7
|
+
import React from "react";
|
|
8
|
+
import type { CalendarProps, CalendarHandle } from "./types";
|
|
9
|
+
declare const Calendar: React.ForwardRefExoticComponent<CalendarProps & React.RefAttributes<CalendarHandle>>;
|
|
10
|
+
export default Calendar;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useCalendarDrag - Drag-and-drop interaction hook for Calendar entries.
|
|
3
|
+
*
|
|
4
|
+
* Uses the native HTML5 Drag and Drop API to support:
|
|
5
|
+
* - Moving entries between date cells (month view)
|
|
6
|
+
* - Moving entries between time slots (week/day view)
|
|
7
|
+
* - Resizing entry duration in time-based views
|
|
8
|
+
*/
|
|
9
|
+
import type { CalendarEntry, CalendarDragEvent } from "../types";
|
|
10
|
+
export interface DragState {
|
|
11
|
+
/** The entry being dragged */
|
|
12
|
+
entry: CalendarEntry;
|
|
13
|
+
/** The original date of the entry */
|
|
14
|
+
fromDate: string;
|
|
15
|
+
/** The original start time (if time-based) */
|
|
16
|
+
fromTime?: string;
|
|
17
|
+
/** Whether we're resizing (bottom edge) vs moving */
|
|
18
|
+
isResize: boolean;
|
|
19
|
+
/** Initial mouse Y when drag started (for resize calculations) */
|
|
20
|
+
startY: number;
|
|
21
|
+
/** Original entry duration in minutes (for resize) */
|
|
22
|
+
originalDuration: number;
|
|
23
|
+
}
|
|
24
|
+
export interface DropTarget {
|
|
25
|
+
/** Target date (YYYY-MM-DD) */
|
|
26
|
+
date: string;
|
|
27
|
+
/** Target time slot (HH:mm) — only in week/day view */
|
|
28
|
+
time?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface UseCalendarDragOptions {
|
|
31
|
+
readOnly?: boolean;
|
|
32
|
+
onEntryDrop?: (event: CalendarDragEvent) => void;
|
|
33
|
+
onEntryUpdate?: (entry: CalendarEntry) => void;
|
|
34
|
+
}
|
|
35
|
+
export declare function useCalendarDrag(options: UseCalendarDragOptions): {
|
|
36
|
+
isDragging: boolean;
|
|
37
|
+
draggingEntryId: string | null;
|
|
38
|
+
dragState: DragState | null;
|
|
39
|
+
dropTarget: DropTarget | null;
|
|
40
|
+
isDropTarget: (date: string, time?: string) => boolean;
|
|
41
|
+
handleDragStart: (e: React.DragEvent, entry: CalendarEntry) => void;
|
|
42
|
+
handleResizeStart: (e: React.DragEvent, entry: CalendarEntry) => void;
|
|
43
|
+
handleDragOver: (e: React.DragEvent, date: string, time?: string) => void;
|
|
44
|
+
handleDragLeave: (e: React.DragEvent) => void;
|
|
45
|
+
handleDrop: (e: React.DragEvent, date: string, time?: string) => void;
|
|
46
|
+
handleDragEnd: () => void;
|
|
47
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useCalendarState - Core state management hook for the Calendar component.
|
|
3
|
+
*
|
|
4
|
+
* Manages current date, view mode, entries CRUD, navigation,
|
|
5
|
+
* and modal state for add/edit entry forms.
|
|
6
|
+
*/
|
|
7
|
+
import type { CalendarViewMode, CalendarEntry, CalendarLabels, HolidayCalendar } from "../types";
|
|
8
|
+
export interface UseCalendarStateOptions {
|
|
9
|
+
entries?: CalendarEntry[];
|
|
10
|
+
holidays?: HolidayCalendar;
|
|
11
|
+
defaultView?: CalendarViewMode;
|
|
12
|
+
defaultDate?: string;
|
|
13
|
+
locale?: "zh" | "en";
|
|
14
|
+
labels?: CalendarLabels;
|
|
15
|
+
colorOptions?: string[];
|
|
16
|
+
readOnly?: boolean;
|
|
17
|
+
onEntryAdd?: (entry: CalendarEntry) => void;
|
|
18
|
+
onEntryUpdate?: (entry: CalendarEntry) => void;
|
|
19
|
+
onEntryDelete?: (entryId: string) => void;
|
|
20
|
+
onViewChange?: (view: CalendarViewMode) => void;
|
|
21
|
+
}
|
|
22
|
+
export interface EntryModalState {
|
|
23
|
+
open: boolean;
|
|
24
|
+
mode: "add" | "edit";
|
|
25
|
+
entry: Partial<CalendarEntry>;
|
|
26
|
+
}
|
|
27
|
+
export declare function useCalendarState(options: UseCalendarStateOptions): {
|
|
28
|
+
currentDate: string;
|
|
29
|
+
currentDateObj: Date;
|
|
30
|
+
viewMode: CalendarViewMode;
|
|
31
|
+
entries: CalendarEntry[];
|
|
32
|
+
labels: Required<CalendarLabels>;
|
|
33
|
+
colorOptions: string[];
|
|
34
|
+
holidays: HolidayCalendar | undefined;
|
|
35
|
+
readOnly: boolean;
|
|
36
|
+
goToToday: () => void;
|
|
37
|
+
goToDate: (date: string) => void;
|
|
38
|
+
goNext: () => void;
|
|
39
|
+
goPrev: () => void;
|
|
40
|
+
title: string;
|
|
41
|
+
setViewMode: (view: CalendarViewMode) => void;
|
|
42
|
+
monthDates: Date[];
|
|
43
|
+
weekDates: Date[];
|
|
44
|
+
addEntry: (entry: Omit<CalendarEntry, "id"> & {
|
|
45
|
+
id?: string;
|
|
46
|
+
}) => CalendarEntry;
|
|
47
|
+
updateEntry: (entry: CalendarEntry) => void;
|
|
48
|
+
deleteEntry: (entryId: string) => void;
|
|
49
|
+
getEntriesForDate: (date: string) => CalendarEntry[];
|
|
50
|
+
modalState: EntryModalState;
|
|
51
|
+
openAddModal: (date?: string, startTime?: string) => void;
|
|
52
|
+
openEditModal: (entry: CalendarEntry) => void;
|
|
53
|
+
closeModal: () => void;
|
|
54
|
+
saveModal: (entryData: Partial<CalendarEntry>) => CalendarEntry;
|
|
55
|
+
deleteModalEntry: () => void;
|
|
56
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { default as Calendar } from "./Calendar";
|
|
2
|
+
export * from "./types";
|
|
3
|
+
export { LABELS_EN, LABELS_ZH, DEFAULT_COLOR_OPTIONS, parseDate, formatDate, todayStr, isToday, isSameDay, isWeekend, isHoliday, isNonWorkingDay, getHolidayEntry, getDaysInMonth, getFirstDayOfMonth, getMonthDates, getWeekDates, minutesToTime, timeToMinutes, formatTime, parseTime, generateTimeSlots, TIME_SLOTS, SLOT_HEIGHT, TIME_GRID_HEIGHT, addDays, generateId, clamp, } from "./utils";
|
|
4
|
+
export { useCalendarState } from "./hooks/useCalendarState";
|
|
5
|
+
export type { UseCalendarStateOptions, EntryModalState } from "./hooks/useCalendarState";
|
|
6
|
+
export { useCalendarDrag } from "./hooks/useCalendarDrag";
|
|
7
|
+
export type { DragState as CalendarDragState, DropTarget as CalendarDropTarget, UseCalendarDragOptions, } from "./hooks/useCalendarDrag";
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DishUI Calendar Component - Type Definitions
|
|
3
|
+
*/
|
|
4
|
+
/** The three display modes for the calendar */
|
|
5
|
+
export type CalendarViewMode = "month" | "week" | "day";
|
|
6
|
+
/**
|
|
7
|
+
* A single calendar entry / event.
|
|
8
|
+
* Supports both all-day events and time-based events.
|
|
9
|
+
*/
|
|
10
|
+
export interface CalendarEntry {
|
|
11
|
+
/** Unique identifier */
|
|
12
|
+
id: string;
|
|
13
|
+
/** Display title */
|
|
14
|
+
title: string;
|
|
15
|
+
/** Date in YYYY-MM-DD format */
|
|
16
|
+
date: string;
|
|
17
|
+
/** Start time in HH:mm format. Omit for all-day events. */
|
|
18
|
+
startTime?: string;
|
|
19
|
+
/** End time in HH:mm format. Omit for all-day events. */
|
|
20
|
+
endTime?: string;
|
|
21
|
+
/** Display color key or CSS color */
|
|
22
|
+
color?: string;
|
|
23
|
+
/** Optional description text */
|
|
24
|
+
description?: string;
|
|
25
|
+
/** Whether this is an all-day event (no start/end time) */
|
|
26
|
+
allDay?: boolean;
|
|
27
|
+
/** Allow arbitrary extra fields */
|
|
28
|
+
[key: string]: any;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* A single holiday definition.
|
|
32
|
+
* Compatible with the Gantt component's HolidayEntry.
|
|
33
|
+
*/
|
|
34
|
+
export interface HolidayEntry {
|
|
35
|
+
/** Date string in YYYY-MM-DD format */
|
|
36
|
+
date: string;
|
|
37
|
+
/** Display name of the holiday */
|
|
38
|
+
name: string;
|
|
39
|
+
/**
|
|
40
|
+
* If true, this is a compensatory workday (调休).
|
|
41
|
+
* The date is treated as a normal working day even if it falls on a weekend.
|
|
42
|
+
*/
|
|
43
|
+
isWorkday?: boolean;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Holiday calendar configuration.
|
|
47
|
+
* Determines which days are holidays / non-working days.
|
|
48
|
+
*/
|
|
49
|
+
export interface HolidayCalendar {
|
|
50
|
+
/** List of holiday/special day entries */
|
|
51
|
+
entries: HolidayEntry[];
|
|
52
|
+
/**
|
|
53
|
+
* Whether weekends (Saturday & Sunday) are non-working days.
|
|
54
|
+
* Default: true.
|
|
55
|
+
*/
|
|
56
|
+
weekendsOff?: boolean;
|
|
57
|
+
}
|
|
58
|
+
/** Describes a drag-and-drop operation on a calendar entry */
|
|
59
|
+
export interface CalendarDragEvent {
|
|
60
|
+
/** The entry being dragged */
|
|
61
|
+
entry: CalendarEntry;
|
|
62
|
+
/** Original date (YYYY-MM-DD) */
|
|
63
|
+
fromDate: string;
|
|
64
|
+
/** New date (YYYY-MM-DD) */
|
|
65
|
+
toDate: string;
|
|
66
|
+
/** Original start time (HH:mm) if applicable */
|
|
67
|
+
fromTime?: string;
|
|
68
|
+
/** New start time (HH:mm) if applicable */
|
|
69
|
+
toTime?: string;
|
|
70
|
+
}
|
|
71
|
+
/** Customizable UI labels for the calendar */
|
|
72
|
+
export interface CalendarLabels {
|
|
73
|
+
today?: string;
|
|
74
|
+
month?: string;
|
|
75
|
+
week?: string;
|
|
76
|
+
day?: string;
|
|
77
|
+
addEntry?: string;
|
|
78
|
+
deleteEntry?: string;
|
|
79
|
+
editEntry?: string;
|
|
80
|
+
allDay?: string;
|
|
81
|
+
noEntries?: string;
|
|
82
|
+
confirmDelete?: string;
|
|
83
|
+
cancel?: string;
|
|
84
|
+
save?: string;
|
|
85
|
+
title?: string;
|
|
86
|
+
date?: string;
|
|
87
|
+
startTime?: string;
|
|
88
|
+
endTime?: string;
|
|
89
|
+
description?: string;
|
|
90
|
+
color?: string;
|
|
91
|
+
/** 7 items starting from Sunday */
|
|
92
|
+
weekDays?: string[];
|
|
93
|
+
/** 12 month names */
|
|
94
|
+
monthNames?: string[];
|
|
95
|
+
}
|
|
96
|
+
export interface CalendarProps {
|
|
97
|
+
/** Calendar entries / events */
|
|
98
|
+
entries?: CalendarEntry[];
|
|
99
|
+
/** Holiday calendar configuration */
|
|
100
|
+
holidays?: HolidayCalendar;
|
|
101
|
+
/** Initial view mode. Default: 'month' */
|
|
102
|
+
defaultView?: CalendarViewMode;
|
|
103
|
+
/** Initial date in YYYY-MM-DD format. Default: today */
|
|
104
|
+
defaultDate?: string;
|
|
105
|
+
/** If true, entries cannot be added, edited, deleted, or dragged */
|
|
106
|
+
readOnly?: boolean;
|
|
107
|
+
/** Locale shorthand for built-in labels. Default: 'en' */
|
|
108
|
+
locale?: "zh" | "en";
|
|
109
|
+
/** Custom label overrides (merged on top of locale defaults) */
|
|
110
|
+
labels?: CalendarLabels;
|
|
111
|
+
/** Calendar height */
|
|
112
|
+
height?: number | string;
|
|
113
|
+
/** Calendar width */
|
|
114
|
+
width?: number | string;
|
|
115
|
+
/** Called when a new entry is added via the form */
|
|
116
|
+
onEntryAdd?: (entry: CalendarEntry) => void;
|
|
117
|
+
/** Called when an existing entry is updated via the form */
|
|
118
|
+
onEntryUpdate?: (entry: CalendarEntry) => void;
|
|
119
|
+
/** Called when an entry is deleted */
|
|
120
|
+
onEntryDelete?: (entryId: string) => void;
|
|
121
|
+
/** Called when an entry is drag-and-dropped to a new date/time */
|
|
122
|
+
onEntryDrop?: (event: CalendarDragEvent) => void;
|
|
123
|
+
/** Called when an entry is clicked */
|
|
124
|
+
onEntryClick?: (entry: CalendarEntry) => void;
|
|
125
|
+
/** Called when a date cell is clicked (not on an entry) */
|
|
126
|
+
onDateClick?: (date: string) => void;
|
|
127
|
+
/** Called when the view mode changes */
|
|
128
|
+
onViewChange?: (view: CalendarViewMode) => void;
|
|
129
|
+
/** Background color for holiday cells */
|
|
130
|
+
holidayColor?: string;
|
|
131
|
+
/** Background/border color for today */
|
|
132
|
+
todayColor?: string;
|
|
133
|
+
/** Background color for weekend cells */
|
|
134
|
+
weekendColor?: string;
|
|
135
|
+
/** Additional class name on the root element */
|
|
136
|
+
className?: string;
|
|
137
|
+
/** Inline styles on the root element */
|
|
138
|
+
style?: React.CSSProperties;
|
|
139
|
+
/** Available colors for the entry color picker */
|
|
140
|
+
colorOptions?: string[];
|
|
141
|
+
}
|
|
142
|
+
export interface CalendarHandle {
|
|
143
|
+
/** Navigate to today */
|
|
144
|
+
goToToday: () => void;
|
|
145
|
+
/** Navigate to a specific date (YYYY-MM-DD) */
|
|
146
|
+
goToDate: (date: string) => void;
|
|
147
|
+
/** Set the view mode */
|
|
148
|
+
setView: (view: CalendarViewMode) => void;
|
|
149
|
+
/** Get all current entries */
|
|
150
|
+
getEntries: () => CalendarEntry[];
|
|
151
|
+
}
|