hys-ui 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/LICENSE +21 -0
- package/README.md +83 -2
- package/dist/_virtual/_plugin-vue_export-helper.js +9 -0
- package/dist/components/HysAccordion/HysAccordion.vue.js +7 -0
- package/dist/components/HysAccordion/HysAccordion2.vue.js +65 -0
- package/dist/components/HysAlert/HysAlert.vue.js +56 -0
- package/dist/components/HysAlert/HysAlert2.vue.js +4 -0
- package/dist/components/HysAnimatedNumber/HysAnimatedNumber.vue.js +40 -0
- package/dist/components/HysAnimatedNumber/HysAnimatedNumber2.vue.js +4 -0
- package/dist/components/HysAvatar/HysAvatar.vue.js +37 -0
- package/dist/components/HysAvatar/HysAvatar2.vue.js +4 -0
- package/dist/components/HysBadge/HysBadge.vue.js +7 -0
- package/dist/components/HysBadge/HysBadge2.vue.js +43 -0
- package/dist/components/HysBreadcrumb/HysBreadcrumb.vue.js +40 -0
- package/dist/components/HysBreadcrumb/HysBreadcrumb2.vue.js +4 -0
- package/dist/components/HysButton/HysButton.vue.js +7 -0
- package/dist/components/HysButton/HysButton2.vue.js +106 -0
- package/dist/components/HysCalendar/HysCalendar.vue.js +86 -0
- package/dist/components/HysCalendar/HysCalendar2.vue.js +4 -0
- package/dist/components/HysCalendarNavigation/HysCalendarNavigation.vue.js +132 -0
- package/dist/components/HysCalendarNavigation/HysCalendarNavigation2.vue.js +4 -0
- package/dist/components/HysCard/HysCard.vue.js +7 -0
- package/dist/components/HysCard/HysCard2.vue.js +58 -0
- package/dist/components/HysCascader/HysCascader.vue.js +184 -0
- package/dist/components/HysCascader/HysCascader2.vue.js +4 -0
- package/dist/components/HysChart/HysChart.vue.js +51 -0
- package/dist/components/HysChart/HysChart2.vue.js +4 -0
- package/dist/components/HysCheckbox/HysCheckbox.vue.js +41 -0
- package/dist/components/HysCheckbox/HysCheckbox2.vue.js +4 -0
- package/dist/components/HysColorPicker/HysColorPicker.vue.js +7 -0
- package/dist/components/HysColorPicker/HysColorPicker2.vue.js +231 -0
- package/dist/components/HysColorTokenEditor/HysColorTokenEditor.vue.js +33 -0
- package/dist/components/HysColorTokenEditor/HysColorTokenEditor2.vue.js +4 -0
- package/dist/components/HysCommandPalette/HysCommandPalette.vue.js +104 -0
- package/dist/components/HysCommandPalette/HysCommandPalette2.vue.js +4 -0
- package/dist/components/HysCommentEditor/HysCommentEditor.vue.js +44 -0
- package/dist/components/HysCommentEditor/HysCommentEditor2.vue.js +4 -0
- package/dist/components/HysContextMenu/HysContextMenu.vue.js +91 -0
- package/dist/components/HysContextMenu/HysContextMenu2.vue.js +4 -0
- package/dist/components/HysCronEditor/HysCronEditor.vue.js +37 -0
- package/dist/components/HysCronEditor/HysCronEditor2.vue.js +4 -0
- package/dist/components/HysDataGrid/HysDataGrid.vue.js +7 -0
- package/dist/components/HysDataGrid/HysDataGrid2.vue.js +800 -0
- package/dist/components/HysDatePicker/HysDatePicker.vue.js +149 -0
- package/dist/components/HysDatePicker/HysDatePicker2.vue.js +4 -0
- package/dist/components/HysDateRangePicker/HysDateRangePicker.vue.js +168 -0
- package/dist/components/HysDateRangePicker/HysDateRangePicker2.vue.js +4 -0
- package/dist/components/HysDiffViewer/HysDiffViewer.vue.js +28 -0
- package/dist/components/HysDiffViewer/HysDiffViewer2.vue.js +4 -0
- package/dist/components/HysDivider/HysDivider.vue.js +7 -0
- package/dist/components/HysDivider/HysDivider2.vue.js +28 -0
- package/dist/components/HysDrawer/HysDrawer.vue.js +7 -0
- package/dist/components/HysDrawer/HysDrawer2.vue.js +101 -0
- package/dist/components/HysEmpty/HysEmpty.vue.js +43 -0
- package/dist/components/HysEmpty/HysEmpty2.vue.js +4 -0
- package/dist/components/HysFileManager/HysFileManager.vue.js +65 -0
- package/dist/components/HysFileManager/HysFileManager2.vue.js +4 -0
- package/dist/components/HysForm/HysForm.vue.js +7 -0
- package/dist/components/HysForm/HysForm2.vue.js +123 -0
- package/dist/components/HysFormItem/HysFormItem.vue.js +71 -0
- package/dist/components/HysFormItem/HysFormItem2.vue.js +4 -0
- package/dist/components/HysGantt/HysGantt.vue.js +266 -0
- package/dist/components/HysGantt/HysGantt2.vue.js +4 -0
- package/dist/components/HysInput/HysInput.vue.js +7 -0
- package/dist/components/HysInput/HysInput2.vue.js +158 -0
- package/dist/components/HysJsonEditor/HysJsonEditor.vue.js +49 -0
- package/dist/components/HysJsonEditor/HysJsonEditor2.vue.js +4 -0
- package/dist/components/HysKanban/HysKanban.vue.js +54 -0
- package/dist/components/HysKanban/HysKanban2.vue.js +4 -0
- package/dist/components/HysMention/HysMention.vue.js +7 -0
- package/dist/components/HysMention/HysMention2.vue.js +165 -0
- package/dist/components/HysModal/HysModal.vue.js +7 -0
- package/dist/components/HysModal/HysModal2.vue.js +101 -0
- package/dist/components/HysNotificationCenter/HysNotificationCenter.vue.js +61 -0
- package/dist/components/HysNotificationCenter/HysNotificationCenter2.vue.js +4 -0
- package/dist/components/HysNumberInput/HysNumberInput.vue.js +7 -0
- package/dist/components/HysNumberInput/HysNumberInput2.vue.js +89 -0
- package/dist/components/HysOrgTree/HysOrgTree.vue.js +56 -0
- package/dist/components/HysOrgTree/HysOrgTree2.vue.js +4 -0
- package/dist/components/HysPagination/HysPagination.vue.js +7 -0
- package/dist/components/HysPagination/HysPagination2.vue.js +213 -0
- package/dist/components/HysPermissionMatrix/HysPermissionMatrix.vue.js +43 -0
- package/dist/components/HysPermissionMatrix/HysPermissionMatrix2.vue.js +4 -0
- package/dist/components/HysPopover/HysPopover.vue.js +93 -0
- package/dist/components/HysPopover/HysPopover2.vue.js +4 -0
- package/dist/components/HysProgress/HysProgress.vue.js +7 -0
- package/dist/components/HysProgress/HysProgress2.vue.js +74 -0
- package/dist/components/HysRadioGroup/HysRadioGroup.vue.js +42 -0
- package/dist/components/HysRadioGroup/HysRadioGroup2.vue.js +4 -0
- package/dist/components/HysRating/HysRating.vue.js +7 -0
- package/dist/components/HysRating/HysRating2.vue.js +85 -0
- package/dist/components/HysResizablePanel/HysResizablePanel.vue.js +48 -0
- package/dist/components/HysResizablePanel/HysResizablePanel2.vue.js +4 -0
- package/dist/components/HysRichTextEditor/HysRichTextEditor.vue.js +7 -0
- package/dist/components/HysRichTextEditor/HysRichTextEditor2.vue.js +121 -0
- package/dist/components/HysSearch/HysSearch.vue.js +72 -0
- package/dist/components/HysSearch/HysSearch2.vue.js +4 -0
- package/dist/components/HysSegmented/HysSegmented.vue.js +60 -0
- package/dist/components/HysSegmented/HysSegmented2.vue.js +4 -0
- package/dist/components/HysSelect/HysSelect.vue.js +7 -0
- package/dist/components/HysSelect/HysSelect2.vue.js +201 -0
- package/dist/components/HysShortcutHelp/HysShortcutHelp.vue.js +23 -0
- package/dist/components/HysShortcutHelp/HysShortcutHelp2.vue.js +4 -0
- package/dist/components/HysSkeleton/HysSkeleton.vue.js +7 -0
- package/dist/components/HysSkeleton/HysSkeleton2.vue.js +43 -0
- package/dist/components/HysSlider/HysSlider.vue.js +7 -0
- package/dist/components/HysSlider/HysSlider2.vue.js +77 -0
- package/dist/components/HysSortableList/HysSortableList.vue.js +7 -0
- package/dist/components/HysSortableList/HysSortableList2.vue.js +145 -0
- package/dist/components/HysSplitPane/HysSplitPane.vue.js +65 -0
- package/dist/components/HysSplitPane/HysSplitPane2.vue.js +4 -0
- package/dist/components/HysSteps/HysSteps.vue.js +7 -0
- package/dist/components/HysSteps/HysSteps2.vue.js +53 -0
- package/dist/components/HysSwitch/HysSwitch.vue.js +7 -0
- package/dist/components/HysSwitch/HysSwitch2.vue.js +56 -0
- package/dist/components/HysTable/HysTable.vue.js +7 -0
- package/dist/components/HysTable/HysTable2.vue.js +105 -0
- package/dist/components/HysTabs/HysTabs.vue.js +7 -0
- package/dist/components/HysTabs/HysTabs2.vue.js +81 -0
- package/dist/components/HysTagInput/HysTagInput.vue.js +83 -0
- package/dist/components/HysTagInput/HysTagInput2.vue.js +4 -0
- package/dist/components/HysTextarea/HysTextarea.vue.js +80 -0
- package/dist/components/HysTextarea/HysTextarea2.vue.js +4 -0
- package/dist/components/HysTimeline/HysTimeline.vue.js +7 -0
- package/dist/components/HysTimeline/HysTimeline2.vue.js +36 -0
- package/dist/components/HysToast/HysToast.vue.js +7 -0
- package/dist/components/HysToast/HysToast2.vue.js +57 -0
- package/dist/components/HysTooltip/HysTooltip.vue.js +66 -0
- package/dist/components/HysTooltip/HysTooltip2.vue.js +4 -0
- package/dist/components/HysTour/HysTour.vue.js +81 -0
- package/dist/components/HysTour/HysTour2.vue.js +4 -0
- package/dist/components/HysTransfer/HysTransfer.vue.js +209 -0
- package/dist/components/HysTransfer/HysTransfer2.vue.js +4 -0
- package/dist/components/HysTree/HysTree.vue.js +8 -0
- package/dist/components/HysTree/HysTree2.vue.js +360 -0
- package/dist/components/HysTreeSelect/HysTreeSelect.vue.js +131 -0
- package/dist/components/HysTreeSelect/HysTreeSelect2.vue.js +4 -0
- package/dist/components/HysUpload/HysUpload.vue.js +7 -0
- package/dist/components/HysUpload/HysUpload2.vue.js +128 -0
- package/dist/components/HysVirtualTable/HysVirtualTable.vue.js +96 -0
- package/dist/components/HysVirtualTable/HysVirtualTable2.vue.js +4 -0
- package/dist/composables/formContext.js +5 -0
- package/dist/composables/overlayManager.js +25 -0
- package/dist/composables/useDialog.js +56 -0
- package/dist/composables/useFloating.js +82 -0
- package/dist/config.js +21 -0
- package/dist/index.js +143 -0
- package/dist/motion/useMotion.js +15 -0
- package/dist/style.css +1 -0
- package/dist/types/components/HysAccordion/HysAccordion.vue.d.ts +48 -0
- package/dist/types/components/HysAlert/HysAlert.vue.d.ts +35 -0
- package/dist/types/components/HysAnimatedNumber/HysAnimatedNumber.vue.d.ts +11 -0
- package/dist/types/components/HysAvatar/HysAvatar.vue.d.ts +32 -0
- package/dist/types/components/HysBadge/HysBadge.vue.d.ts +33 -0
- package/dist/types/components/HysBreadcrumb/HysBreadcrumb.vue.d.ts +30 -0
- package/dist/types/components/HysButton/HysButton.vue.d.ts +61 -0
- package/dist/types/components/HysCalendar/HysCalendar.vue.d.ts +36 -0
- package/dist/types/components/HysCalendarNavigation/HysCalendarNavigation.vue.d.ts +24 -0
- package/dist/types/components/HysCard/HysCard.vue.d.ts +30 -0
- package/dist/types/components/HysCascader/HysCascader.vue.d.ts +46 -0
- package/dist/types/components/HysChart/HysChart.vue.d.ts +14 -0
- package/dist/types/components/HysCheckbox/HysCheckbox.vue.d.ts +32 -0
- package/dist/types/components/HysColorPicker/HysColorPicker.vue.d.ts +14 -0
- package/dist/types/components/HysColorTokenEditor/HysColorTokenEditor.vue.d.ts +10 -0
- package/dist/types/components/HysCommandPalette/HysCommandPalette.vue.d.ts +15 -0
- package/dist/types/components/HysCommentEditor/HysCommentEditor.vue.d.ts +18 -0
- package/dist/types/components/HysContextMenu/HysContextMenu.vue.d.ts +37 -0
- package/dist/types/components/HysCronEditor/HysCronEditor.vue.d.ts +10 -0
- package/dist/types/components/HysDataGrid/HysDataGrid.vue.d.ts +125 -0
- package/dist/types/components/HysDatePicker/HysDatePicker.vue.d.ts +17 -0
- package/dist/types/components/HysDateRangePicker/HysDateRangePicker.vue.d.ts +17 -0
- package/dist/types/components/HysDiffViewer/HysDiffViewer.vue.d.ts +7 -0
- package/dist/types/components/HysDivider/HysDivider.vue.d.ts +24 -0
- package/dist/types/components/HysDrawer/HysDrawer.vue.d.ts +51 -0
- package/dist/types/components/HysEmpty/HysEmpty.vue.d.ts +29 -0
- package/dist/types/components/HysFileManager/HysFileManager.vue.d.ts +22 -0
- package/dist/types/components/HysForm/HysForm.vue.d.ts +54 -0
- package/dist/types/components/HysFormItem/HysFormItem.vue.d.ts +27 -0
- package/dist/types/components/HysGantt/HysGantt.vue.d.ts +39 -0
- package/dist/types/components/HysInput/HysInput.vue.d.ts +63 -0
- package/dist/types/components/HysJsonEditor/HysJsonEditor.vue.d.ts +10 -0
- package/dist/types/components/HysKanban/HysKanban.vue.d.ts +20 -0
- package/dist/types/components/HysMention/HysMention.vue.d.ts +54 -0
- package/dist/types/components/HysModal/HysModal.vue.d.ts +51 -0
- package/dist/types/components/HysNotificationCenter/HysNotificationCenter.vue.d.ts +24 -0
- package/dist/types/components/HysNumberInput/HysNumberInput.vue.d.ts +36 -0
- package/dist/types/components/HysOrgTree/HysOrgTree.vue.d.ts +22 -0
- package/dist/types/components/HysPagination/HysPagination.vue.d.ts +45 -0
- package/dist/types/components/HysPermissionMatrix/HysPermissionMatrix.vue.d.ts +12 -0
- package/dist/types/components/HysPopover/HysPopover.vue.d.ts +41 -0
- package/dist/types/components/HysProgress/HysProgress.vue.d.ts +34 -0
- package/dist/types/components/HysRadioGroup/HysRadioGroup.vue.d.ts +21 -0
- package/dist/types/components/HysRating/HysRating.vue.d.ts +36 -0
- package/dist/types/components/HysResizablePanel/HysResizablePanel.vue.d.ts +31 -0
- package/dist/types/components/HysRichTextEditor/HysRichTextEditor.vue.d.ts +27 -0
- package/dist/types/components/HysSearch/HysSearch.vue.d.ts +32 -0
- package/dist/types/components/HysSegmented/HysSegmented.vue.d.ts +39 -0
- package/dist/types/components/HysSelect/HysSelect.vue.d.ts +61 -0
- package/dist/types/components/HysShortcutHelp/HysShortcutHelp.vue.d.ts +9 -0
- package/dist/types/components/HysSkeleton/HysSkeleton.vue.d.ts +29 -0
- package/dist/types/components/HysSlider/HysSlider.vue.d.ts +31 -0
- package/dist/types/components/HysSortableList/HysSortableList.vue.d.ts +29 -0
- package/dist/types/components/HysSplitPane/HysSplitPane.vue.d.ts +33 -0
- package/dist/types/components/HysSteps/HysSteps.vue.d.ts +20 -0
- package/dist/types/components/HysSwitch/HysSwitch.vue.d.ts +20 -0
- package/dist/types/components/HysTable/HysTable.vue.d.ts +55 -0
- package/dist/types/components/HysTabs/HysTabs.vue.d.ts +48 -0
- package/dist/types/components/HysTagInput/HysTagInput.vue.d.ts +44 -0
- package/dist/types/components/HysTextarea/HysTextarea.vue.d.ts +43 -0
- package/dist/types/components/HysTimeline/HysTimeline.vue.d.ts +35 -0
- package/dist/types/components/HysToast/HysToast.vue.d.ts +19 -0
- package/dist/types/components/HysTooltip/HysTooltip.vue.d.ts +33 -0
- package/dist/types/components/HysTour/HysTour.vue.d.ts +27 -0
- package/dist/types/components/HysTransfer/HysTransfer.vue.d.ts +33 -0
- package/dist/types/components/HysTree/HysTree.vue.d.ts +100 -0
- package/dist/types/components/HysTreeSelect/HysTreeSelect.vue.d.ts +41 -0
- package/dist/types/components/HysUpload/HysUpload.vue.d.ts +70 -0
- package/dist/types/components/HysVirtualTable/HysVirtualTable.vue.d.ts +45 -0
- package/dist/types/composables/formContext.d.ts +24 -0
- package/dist/types/composables/overlayManager.d.ts +8 -0
- package/dist/types/composables/useDialog.d.ts +4 -0
- package/dist/types/composables/useFloating.d.ts +23 -0
- package/dist/types/composables/useRovingFocus.d.ts +7 -0
- package/dist/types/config.d.ts +15 -0
- package/dist/types/index.d.ts +90 -0
- package/dist/types/motion/useMotion.d.ts +3 -0
- package/package.json +21 -4
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.0
|
|
4
|
+
|
|
5
|
+
- Extract 69 independent Vue components with Hys-prefixed public names.
|
|
6
|
+
- Add isolated styles, six themes, reactive configuration and public TypeScript declarations.
|
|
7
|
+
- Expand common interaction capabilities across form, selection, feedback, navigation, layout and data components.
|
|
8
|
+
- Add rule-based forms, asynchronous validation, reset and accessible field feedback.
|
|
9
|
+
- Preserve custom calendars, color selection, virtualized data, drag/drop, filtering and cached-page cleanup.
|
|
10
|
+
- Add separate component documentation, runnable source examples, API metadata and release verification.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 hys-ui contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,84 @@
|
|
|
1
|
-
#
|
|
1
|
+
# HYS UI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
69 个独立的 Vue 3.5+ 组件,提供 TypeScript 类型、六套主题和独立的中文交互文档。
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install hys-ui
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```vue
|
|
12
|
+
<script setup lang="ts">
|
|
13
|
+
import { HysButton } from 'hys-ui'
|
|
14
|
+
import 'hys-ui/style.css'
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<template>
|
|
18
|
+
<HysButton round @click="console.log('confirmed')">确认</HysButton>
|
|
19
|
+
</template>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
通过命名导入按需使用组件。组件源码、文件名、导出名统一采用 `HysXxxxx`。ESM 包的 Vue peer dependency 为 `>=3.5.0 <4`,无需 Vue Router。图标使用 Lucide outline,宿主项目可以传入自有图标。
|
|
23
|
+
|
|
24
|
+
## 主题和动效
|
|
25
|
+
|
|
26
|
+
在根组件 setup 中调用,参数可以是响应式 ref 或 getter。配置会传递给子组件与 Teleport 浮层。
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
import { ref } from 'vue'
|
|
30
|
+
import { provideHysConfig, type HysTheme } from 'hys-ui'
|
|
31
|
+
|
|
32
|
+
const theme = ref<HysTheme>('blue')
|
|
33
|
+
provideHysConfig({ theme, motion: 'subtle' })
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
主题支持 `blue / dark / green / purple / orange / forest`,动效支持 `full / subtle / off`,系统减少动态效果设置优先。组件库不会写入浏览器存储或修改全局页面主题。
|
|
37
|
+
|
|
38
|
+
可以使用 `--hys-ui-primary`、`--hys-ui-surface`、`--hys-ui-text`、`--hys-ui-border`、`--hys-ui-font-family` 等公开变量覆盖组件外观。组件类名与变量采用独立前缀,没有 body/html 全局重置。
|
|
39
|
+
|
|
40
|
+
## 开发与文档
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npm install
|
|
44
|
+
npm run dev:docs
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
访问 http://127.0.0.1:5174。每个组件有独立路由、运行场景、源码、API 与说明,页面状态通过 KeepAlive 保留。API 从源码生成。
|
|
48
|
+
|
|
49
|
+
- `packages/ui`:唯一的组件源码及 npm 包。
|
|
50
|
+
- `apps/docs`:独立文档应用,包含 69 个组件页面。
|
|
51
|
+
- `tests`:核心行为回归。
|
|
52
|
+
- `scripts`:元信息提取、完整性检查、打包与发布验证。
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
npm run build:ui
|
|
56
|
+
npm run build:docs
|
|
57
|
+
npm test
|
|
58
|
+
npm run check:contracts
|
|
59
|
+
npm run check:release
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
`build:docs` 输出到 `apps/docs/dist`,部署服务需要将未知路径回退到 `index.html`。本仓库独立于项目治理平台,平台仅作为组件库的使用方。
|
|
63
|
+
|
|
64
|
+
## 功能对标
|
|
65
|
+
|
|
66
|
+
参考 Element Plus、Ant Design Vue、Naive UI 的成熟使用模式,覆盖所有能找到同类组件的核心场景。具体对应项、能力边界和高级能力迭代见 [组件能力对标](https://github.com/lampo1024/hys-ui/blob/main/docs/COMPONENT_PARITY.md)。HYS UI 保持自己的 API,不提供这三家组件库的直接替换兼容层。
|
|
67
|
+
|
|
68
|
+
## 发布
|
|
69
|
+
|
|
70
|
+
根工作区和文档应用为私有,npm 包名为 `hys-ui`,首版 `0.1.0`,MIT 公开发布。
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
npm run pack:ui
|
|
74
|
+
npm login --registry=https://registry.npmjs.org/
|
|
75
|
+
npm run release:ui
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
发布流程先执行全部检查、打包和仓库外安装验证,再检查登录账号、包名/版本及压缩包 SHA256,发布同一个已验证压缩包到 `latest`。凭证通过 npm 本地交互管理,不写入仓库。
|
|
79
|
+
|
|
80
|
+
后续版本按语义化版本发布,并更新 CHANGELOG。暂不承诺 SSR/Nuxt 支持。
|
|
81
|
+
|
|
82
|
+
## 许可证
|
|
83
|
+
|
|
84
|
+
[MIT](LICENSE)
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { defineComponent as V, ref as k, computed as A, useId as C, openBlock as c, createElementBlock as u, mergeProps as B, unref as l, Fragment as N, renderList as _, createElementVNode as p, renderSlot as b, createTextVNode as y, toDisplayString as v, createVNode as $, createCommentVNode as D } from "vue";
|
|
2
|
+
import { useHysRootAttrs as E } from "../../config.js";
|
|
3
|
+
import { ChevronDown as H } from "lucide-vue-next";
|
|
4
|
+
const R = ["id", "disabled", "aria-expanded", "aria-controls", "onClick"], S = ["id", "aria-labelledby"], L = /* @__PURE__ */ V({
|
|
5
|
+
__name: "HysAccordion",
|
|
6
|
+
props: {
|
|
7
|
+
items: {},
|
|
8
|
+
multiple: { type: Boolean },
|
|
9
|
+
modelValue: {},
|
|
10
|
+
defaultActive: {},
|
|
11
|
+
disabled: { type: Boolean }
|
|
12
|
+
},
|
|
13
|
+
emits: ["update:modelValue", "change"],
|
|
14
|
+
setup(i, { emit: f }) {
|
|
15
|
+
const h = E(), a = i, d = f, m = k(a.defaultActive || []), r = A(() => a.modelValue ?? m.value), s = C();
|
|
16
|
+
function g(t) {
|
|
17
|
+
var o;
|
|
18
|
+
if (a.disabled || (o = a.items[t]) != null && o.disabled) return;
|
|
19
|
+
const n = r.value.includes(t) ? r.value.filter((e) => e !== t) : a.multiple ? [...r.value, t] : [t];
|
|
20
|
+
m.value = n, d("update:modelValue", n), d("change", n);
|
|
21
|
+
}
|
|
22
|
+
return (t, n) => (c(), u("div", B(l(h), { class: "hys-ui-ex-accordion" }), [
|
|
23
|
+
(c(!0), u(N, null, _(i.items, (o, e) => (c(), u("section", { key: e }, [
|
|
24
|
+
p("h3", null, [
|
|
25
|
+
p("button", {
|
|
26
|
+
id: l(s) + "-button-" + e,
|
|
27
|
+
type: "button",
|
|
28
|
+
disabled: i.disabled || o.disabled,
|
|
29
|
+
"aria-expanded": r.value.includes(e),
|
|
30
|
+
"aria-controls": l(s) + "-panel-" + e,
|
|
31
|
+
onClick: (w) => g(e)
|
|
32
|
+
}, [
|
|
33
|
+
b(t.$slots, "title", {
|
|
34
|
+
item: o,
|
|
35
|
+
index: e
|
|
36
|
+
}, () => [
|
|
37
|
+
y(v(o.title), 1)
|
|
38
|
+
], !0),
|
|
39
|
+
$(l(H), {
|
|
40
|
+
size: 16,
|
|
41
|
+
class: "hys-ui-accordion-chevron"
|
|
42
|
+
})
|
|
43
|
+
], 8, R)
|
|
44
|
+
]),
|
|
45
|
+
r.value.includes(e) ? (c(), u("div", {
|
|
46
|
+
key: 0,
|
|
47
|
+
id: l(s) + "-panel-" + e,
|
|
48
|
+
role: "region",
|
|
49
|
+
"aria-labelledby": l(s) + "-button-" + e,
|
|
50
|
+
class: "hys-ui-ex-accordion-body"
|
|
51
|
+
}, [
|
|
52
|
+
b(t.$slots, "content", {
|
|
53
|
+
item: o,
|
|
54
|
+
index: e
|
|
55
|
+
}, () => [
|
|
56
|
+
y(v(o.content), 1)
|
|
57
|
+
], !0)
|
|
58
|
+
], 8, S)) : D("", !0)
|
|
59
|
+
]))), 128))
|
|
60
|
+
], 16));
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
export {
|
|
64
|
+
L as default
|
|
65
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { defineComponent as b, ref as k, computed as C, watch as g, openBlock as o, createElementBlock as i, mergeProps as B, unref as t, createBlock as w, resolveDynamicComponent as A, createCommentVNode as l, createElementVNode as c, renderSlot as u, createTextVNode as d, toDisplayString as m, createVNode as N } from "vue";
|
|
2
|
+
import { useHysRootAttrs as V } from "../../config.js";
|
|
3
|
+
import { CircleCheck as x, TriangleAlert as I, CircleAlert as p, Info as z, X as D } from "lucide-vue-next";
|
|
4
|
+
const E = ["role"], H = { key: 0 }, j = /* @__PURE__ */ b({
|
|
5
|
+
__name: "HysAlert",
|
|
6
|
+
props: {
|
|
7
|
+
tone: { default: "info" },
|
|
8
|
+
title: {},
|
|
9
|
+
description: {},
|
|
10
|
+
closable: { type: Boolean },
|
|
11
|
+
showIcon: { type: Boolean },
|
|
12
|
+
center: { type: Boolean },
|
|
13
|
+
visible: { type: Boolean, default: void 0 }
|
|
14
|
+
},
|
|
15
|
+
emits: ["close", "update:visible"],
|
|
16
|
+
setup(e, { emit: y }) {
|
|
17
|
+
const f = V(), s = e, r = y, n = k(!0), v = C(() => s.visible ?? n.value);
|
|
18
|
+
g(() => s.title, () => n.value = !0);
|
|
19
|
+
function h() {
|
|
20
|
+
n.value = !1, r("update:visible", !1), r("close");
|
|
21
|
+
}
|
|
22
|
+
return (a, R) => v.value ? (o(), i("div", B({ key: 0 }, t(f), {
|
|
23
|
+
class: ["hys-ui-ex-alert", "hys-ui-ex-" + e.tone],
|
|
24
|
+
role: e.tone === "danger" ? "alert" : "status",
|
|
25
|
+
style: { justifyContent: e.center ? "center" : void 0 }
|
|
26
|
+
}), [
|
|
27
|
+
e.showIcon ? (o(), w(A(e.tone === "success" ? t(x) : e.tone === "warning" ? t(I) : e.tone === "danger" ? t(p) : t(z)), {
|
|
28
|
+
key: 0,
|
|
29
|
+
size: 18
|
|
30
|
+
})) : l("", !0),
|
|
31
|
+
c("div", null, [
|
|
32
|
+
e.title ? (o(), i("strong", H, [
|
|
33
|
+
u(a.$slots, "title", {}, () => [
|
|
34
|
+
d(m(e.title), 1)
|
|
35
|
+
])
|
|
36
|
+
])) : l("", !0),
|
|
37
|
+
c("div", null, [
|
|
38
|
+
u(a.$slots, "default", {}, () => [
|
|
39
|
+
d(m(e.description), 1)
|
|
40
|
+
])
|
|
41
|
+
])
|
|
42
|
+
]),
|
|
43
|
+
e.closable ? (o(), i("button", {
|
|
44
|
+
key: 1,
|
|
45
|
+
type: "button",
|
|
46
|
+
"aria-label": "关闭提示",
|
|
47
|
+
onClick: h
|
|
48
|
+
}, [
|
|
49
|
+
N(t(D), { size: 14 })
|
|
50
|
+
])) : l("", !0)
|
|
51
|
+
], 16, E)) : l("", !0);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
export {
|
|
55
|
+
j as default
|
|
56
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { defineComponent as A, ref as M, watch as F, onDeactivated as x, onActivated as y, onBeforeUnmount as b, openBlock as w, createElementBlock as _, mergeProps as B, unref as g, toDisplayString as k } from "vue";
|
|
2
|
+
import { useHysRootAttrs as q } from "../../config.js";
|
|
3
|
+
import { useMotion as D } from "../../motion/useMotion.js";
|
|
4
|
+
const H = ["aria-label"], E = /* @__PURE__ */ A({
|
|
5
|
+
__name: "HysAnimatedNumber",
|
|
6
|
+
props: {
|
|
7
|
+
value: {},
|
|
8
|
+
duration: { default: 650 },
|
|
9
|
+
decimals: { default: 0 }
|
|
10
|
+
},
|
|
11
|
+
setup(o) {
|
|
12
|
+
const m = q(), { effectiveMotion: u } = D(), n = o, e = M(n.value);
|
|
13
|
+
let a = 0, r = !0;
|
|
14
|
+
function l(t) {
|
|
15
|
+
if (cancelAnimationFrame(a), u.value === "off") {
|
|
16
|
+
e.value = t;
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const i = e.value, d = performance.now(), v = Math.max(1, n.duration);
|
|
20
|
+
function s(p) {
|
|
21
|
+
const c = Math.min(1, (p - d) / v), h = 1 - Math.pow(1 - c, 3);
|
|
22
|
+
e.value = i + (t - i) * h, c < 1 && (a = requestAnimationFrame(s));
|
|
23
|
+
}
|
|
24
|
+
a = requestAnimationFrame(s);
|
|
25
|
+
}
|
|
26
|
+
return F(() => n.value, (t) => {
|
|
27
|
+
r ? l(t) : e.value = t;
|
|
28
|
+
}), x(() => {
|
|
29
|
+
r = !1, cancelAnimationFrame(a);
|
|
30
|
+
}), y(() => {
|
|
31
|
+
r = !0, e.value = n.value;
|
|
32
|
+
}), b(() => cancelAnimationFrame(a)), (t, f) => (w(), _("span", B(g(m), {
|
|
33
|
+
class: "hys-ui-motion-number",
|
|
34
|
+
"aria-label": String(o.value)
|
|
35
|
+
}), k(e.value.toFixed(Math.max(0, Math.min(5, o.decimals)))), 17, H));
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
export {
|
|
39
|
+
E as default
|
|
40
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { defineComponent as f, ref as d, computed as h, watch as y, openBlock as l, createElementBlock as s, mergeProps as v, unref as x, normalizeStyle as z, renderSlot as b, createTextVNode as g, toDisplayString as S } from "vue";
|
|
2
|
+
import { useHysRootAttrs as k } from "../../config.js";
|
|
3
|
+
const A = ["aria-label"], R = ["src", "alt"], C = /* @__PURE__ */ f({
|
|
4
|
+
__name: "HysAvatar",
|
|
5
|
+
props: {
|
|
6
|
+
name: { default: "" },
|
|
7
|
+
src: {},
|
|
8
|
+
size: { default: 36 },
|
|
9
|
+
shape: { default: "circle" },
|
|
10
|
+
fit: { default: "cover" },
|
|
11
|
+
alt: {}
|
|
12
|
+
},
|
|
13
|
+
emits: ["error"],
|
|
14
|
+
setup(e, { emit: i }) {
|
|
15
|
+
const o = k(), a = e, n = i, t = d(!1), c = h(() => a.name.trim().slice(0, 2).toUpperCase() || "?");
|
|
16
|
+
return y(() => a.src, () => t.value = !1), (m, r) => (l(), s("span", v(x(o), {
|
|
17
|
+
class: "hys-ui-ex-avatar",
|
|
18
|
+
style: { width: e.size + "px", height: e.size + "px", fontSize: Math.max(11, e.size * 0.34) + "px", borderRadius: e.shape === "square" ? "8px" : "50%" },
|
|
19
|
+
"aria-label": e.alt || e.name
|
|
20
|
+
}), [
|
|
21
|
+
e.src && !t.value ? (l(), s("img", {
|
|
22
|
+
key: 0,
|
|
23
|
+
src: e.src,
|
|
24
|
+
alt: e.alt || e.name,
|
|
25
|
+
style: z({ objectFit: e.fit }),
|
|
26
|
+
onError: r[0] || (r[0] = (u) => {
|
|
27
|
+
t.value = !0, n("error", u);
|
|
28
|
+
})
|
|
29
|
+
}, null, 44, R)) : b(m.$slots, "default", {}, () => [
|
|
30
|
+
g(S(c.value), 1)
|
|
31
|
+
], void 0, 1)
|
|
32
|
+
], 16, A));
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
export {
|
|
36
|
+
C as default
|
|
37
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { defineComponent as y, openBlock as t, createElementBlock as o, mergeProps as c, unref as l, createElementVNode as f, normalizeStyle as b, normalizeClass as n, renderSlot as v, withModifiers as g, createVNode as h, createCommentVNode as s, toDisplayString as B } from "vue";
|
|
2
|
+
import { useHysRootAttrs as x } from "../../config.js";
|
|
3
|
+
import { X as z } from "lucide-vue-next";
|
|
4
|
+
const S = /* @__PURE__ */ y({
|
|
5
|
+
__name: "HysBadge",
|
|
6
|
+
props: {
|
|
7
|
+
tone: { default: "blue" },
|
|
8
|
+
size: { default: "md" },
|
|
9
|
+
round: { type: Boolean },
|
|
10
|
+
closable: { type: Boolean },
|
|
11
|
+
dot: { type: Boolean },
|
|
12
|
+
value: {},
|
|
13
|
+
max: { default: 99 },
|
|
14
|
+
showZero: { type: Boolean }
|
|
15
|
+
},
|
|
16
|
+
emits: ["close"],
|
|
17
|
+
setup(e, { emit: u }) {
|
|
18
|
+
const d = x(), i = u;
|
|
19
|
+
return (r, a) => (t(), o("span", c(l(d), { class: "hys-ui-badge-wrap" }), [
|
|
20
|
+
f("span", {
|
|
21
|
+
class: n(["hys-ui-badge", "hys-ui-badge-" + e.tone]),
|
|
22
|
+
style: b({ borderRadius: e.round ? "99px" : void 0, fontSize: e.size === "sm" ? "10px" : void 0 })
|
|
23
|
+
}, [
|
|
24
|
+
v(r.$slots, "default", {}, void 0, !0),
|
|
25
|
+
e.closable ? (t(), o("button", {
|
|
26
|
+
key: 0,
|
|
27
|
+
type: "button",
|
|
28
|
+
"aria-label": "关闭标签",
|
|
29
|
+
onClick: a[0] || (a[0] = g((m) => i("close", m), ["stop"]))
|
|
30
|
+
}, [
|
|
31
|
+
h(l(z), { size: 12 })
|
|
32
|
+
])) : s("", !0)
|
|
33
|
+
], 6),
|
|
34
|
+
e.dot || e.value !== void 0 && (e.value !== 0 || e.showZero) ? (t(), o("sup", {
|
|
35
|
+
key: 0,
|
|
36
|
+
class: n(["hys-ui-badge-counter", { "hys-ui-badge-dot": e.dot }])
|
|
37
|
+
}, B(e.dot ? "" : typeof e.value == "number" && e.value > e.max ? e.max + "+" : e.value), 3)) : s("", !0)
|
|
38
|
+
], 16));
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
export {
|
|
42
|
+
S as default
|
|
43
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { defineComponent as u, openBlock as t, createElementBlock as o, mergeProps as m, unref as h, createElementVNode as l, Fragment as d, renderList as f, renderSlot as c, createTextVNode as p, toDisplayString as s, createCommentVNode as y } from "vue";
|
|
2
|
+
import { useHysRootAttrs as b } from "../../config.js";
|
|
3
|
+
const g = { class: "hys-ui-ex-breadcrumb" }, k = {
|
|
4
|
+
key: 0,
|
|
5
|
+
"aria-hidden": "true"
|
|
6
|
+
}, _ = ["href"], v = ["aria-current"], A = /* @__PURE__ */ u({
|
|
7
|
+
__name: "HysBreadcrumb",
|
|
8
|
+
props: {
|
|
9
|
+
separator: {},
|
|
10
|
+
items: {}
|
|
11
|
+
},
|
|
12
|
+
setup(a) {
|
|
13
|
+
const i = b();
|
|
14
|
+
return (n, B) => (t(), o("nav", m(h(i), { "aria-label": "面包屑" }), [
|
|
15
|
+
l("ol", g, [
|
|
16
|
+
(t(!0), o(d, null, f(a.items, (e, r) => (t(), o("li", { key: r }, [
|
|
17
|
+
r ? (t(), o("span", k, [
|
|
18
|
+
c(n.$slots, "separator", {}, () => [
|
|
19
|
+
p(s(a.separator || "/"), 1)
|
|
20
|
+
])
|
|
21
|
+
])) : y("", !0),
|
|
22
|
+
e.href && r !== a.items.length - 1 ? c(n.$slots, "link", {
|
|
23
|
+
item: e,
|
|
24
|
+
index: r
|
|
25
|
+
}, () => [
|
|
26
|
+
l("a", {
|
|
27
|
+
href: e.href
|
|
28
|
+
}, s(e.label), 9, _)
|
|
29
|
+
], void 0, 1) : (t(), o("span", {
|
|
30
|
+
key: 2,
|
|
31
|
+
"aria-current": r === a.items.length - 1 ? "page" : void 0
|
|
32
|
+
}, s(e.label), 9, v))
|
|
33
|
+
]))), 128))
|
|
34
|
+
])
|
|
35
|
+
], 16));
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
export {
|
|
39
|
+
A as default
|
|
40
|
+
};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { defineComponent as B, ref as $, computed as c, openBlock as a, createBlock as u, resolveDynamicComponent as r, mergeProps as C, unref as d, withCtx as z, createElementBlock as s, renderSlot as i, createVNode as P, createCommentVNode as y } from "vue";
|
|
2
|
+
import { LoaderCircle as L } from "lucide-vue-next";
|
|
3
|
+
import { useHysRootAttrs as w } from "../../config.js";
|
|
4
|
+
const A = {
|
|
5
|
+
key: 0,
|
|
6
|
+
class: "hys-ui-button-icon"
|
|
7
|
+
}, D = {
|
|
8
|
+
key: 1,
|
|
9
|
+
class: "hys-ui-button-icon"
|
|
10
|
+
}, H = {
|
|
11
|
+
key: 2,
|
|
12
|
+
class: "hys-ui-button-icon"
|
|
13
|
+
}, E = /* @__PURE__ */ B({
|
|
14
|
+
__name: "HysButton",
|
|
15
|
+
props: {
|
|
16
|
+
variant: { default: "primary" },
|
|
17
|
+
size: { default: "md" },
|
|
18
|
+
disabled: { type: Boolean },
|
|
19
|
+
loading: { type: Boolean },
|
|
20
|
+
plain: { type: Boolean },
|
|
21
|
+
round: { type: Boolean },
|
|
22
|
+
circle: { type: Boolean },
|
|
23
|
+
block: { type: Boolean },
|
|
24
|
+
dashed: { type: Boolean },
|
|
25
|
+
color: {},
|
|
26
|
+
icon: {},
|
|
27
|
+
iconPosition: { default: "left" },
|
|
28
|
+
type: { default: "button" },
|
|
29
|
+
nativeType: {},
|
|
30
|
+
href: {},
|
|
31
|
+
target: {},
|
|
32
|
+
rel: {},
|
|
33
|
+
autofocus: { type: Boolean },
|
|
34
|
+
focusable: { type: Boolean, default: !0 },
|
|
35
|
+
ariaLabel: {}
|
|
36
|
+
},
|
|
37
|
+
emits: ["click"],
|
|
38
|
+
setup(e, { expose: f, emit: h }) {
|
|
39
|
+
const n = e, b = h, m = w(), l = $(), o = c(() => n.disabled || n.loading), v = { danger: "#ed4556", success: "#16a46e", warning: "#d9860c", info: "#697b97" }, k = c(() => n.color || v[n.variant] || "var(--hys-ui-primary,var(--hys-ui-theme-primary))");
|
|
40
|
+
function g(t) {
|
|
41
|
+
if (o.value) {
|
|
42
|
+
t.preventDefault(), t.stopImmediatePropagation();
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
b("click", t);
|
|
46
|
+
}
|
|
47
|
+
return f({ element: l, focus: () => {
|
|
48
|
+
var t;
|
|
49
|
+
return (t = l.value) == null ? void 0 : t.focus();
|
|
50
|
+
}, blur: () => {
|
|
51
|
+
var t;
|
|
52
|
+
return (t = l.value) == null ? void 0 : t.blur();
|
|
53
|
+
} }), (t, N) => (a(), u(r(e.href ? "a" : "button"), C({
|
|
54
|
+
ref_key: "element",
|
|
55
|
+
ref: l
|
|
56
|
+
}, d(m), {
|
|
57
|
+
class: ["hys-ui-btn", ["hys-ui-btn-" + e.size, "hys-ui-button-" + e.variant, { "hys-ui-button-plain": e.plain, "hys-ui-button-round": e.round, "hys-ui-button-circle": e.circle, "hys-ui-button-block": e.block, "hys-ui-button-dashed": e.dashed, "hys-ui-button-locked": o.value }]],
|
|
58
|
+
style: { "--hys-ui-button-color": k.value },
|
|
59
|
+
type: e.href ? void 0 : e.nativeType || e.type,
|
|
60
|
+
href: o.value ? void 0 : e.href,
|
|
61
|
+
role: e.href ? "link" : void 0,
|
|
62
|
+
target: e.href ? e.target : void 0,
|
|
63
|
+
rel: e.href ? e.rel || (e.target === "_blank" ? "noopener noreferrer" : void 0) : void 0,
|
|
64
|
+
disabled: e.href ? void 0 : o.value,
|
|
65
|
+
"aria-disabled": o.value || void 0,
|
|
66
|
+
"aria-busy": e.loading || void 0,
|
|
67
|
+
"aria-label": e.ariaLabel,
|
|
68
|
+
tabindex: o.value || !e.focusable ? -1 : void 0,
|
|
69
|
+
autofocus: e.autofocus,
|
|
70
|
+
onClick: g
|
|
71
|
+
}), {
|
|
72
|
+
default: z(() => [
|
|
73
|
+
e.loading ? (a(), s("span", A, [
|
|
74
|
+
i(t.$slots, "loading", {}, () => [
|
|
75
|
+
P(d(L), {
|
|
76
|
+
class: "hys-ui-button-spinner",
|
|
77
|
+
size: 16,
|
|
78
|
+
"aria-hidden": "true"
|
|
79
|
+
})
|
|
80
|
+
], !0)
|
|
81
|
+
])) : (e.icon || t.$slots.icon) && e.iconPosition === "left" ? (a(), s("span", D, [
|
|
82
|
+
i(t.$slots, "icon", {}, () => [
|
|
83
|
+
(a(), u(r(e.icon), {
|
|
84
|
+
size: 16,
|
|
85
|
+
"aria-hidden": "true"
|
|
86
|
+
}))
|
|
87
|
+
], !0)
|
|
88
|
+
])) : y("", !0),
|
|
89
|
+
i(t.$slots, "default", {}, void 0, !0),
|
|
90
|
+
!e.loading && (e.icon || t.$slots.icon) && e.iconPosition === "right" ? (a(), s("span", H, [
|
|
91
|
+
i(t.$slots, "icon", {}, () => [
|
|
92
|
+
(a(), u(r(e.icon), {
|
|
93
|
+
size: 16,
|
|
94
|
+
"aria-hidden": "true"
|
|
95
|
+
}))
|
|
96
|
+
], !0)
|
|
97
|
+
])) : y("", !0),
|
|
98
|
+
i(t.$slots, "suffix", {}, void 0, !0)
|
|
99
|
+
]),
|
|
100
|
+
_: 3
|
|
101
|
+
}, 16, ["class", "style", "type", "href", "role", "target", "rel", "disabled", "aria-disabled", "aria-busy", "aria-label", "tabindex", "autofocus"]));
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
export {
|
|
105
|
+
E as default
|
|
106
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { defineComponent as A, ref as p, computed as C, openBlock as a, createElementBlock as l, mergeProps as F, unref as y, createElementVNode as i, createVNode as $, toDisplayString as c, Fragment as h, renderList as b, renderSlot as N, createTextVNode as R, createCommentVNode as x } from "vue";
|
|
2
|
+
import { useHysRootAttrs as z } from "../../config.js";
|
|
3
|
+
import { ChevronLeft as B, ChevronRight as E } from "lucide-vue-next";
|
|
4
|
+
const H = { class: "hys-ui-ent-toolbar" }, L = { class: "hys-ui-ent-calendar" }, M = ["disabled", "aria-pressed", "onClick"], Y = ["onClick"], G = /* @__PURE__ */ A({
|
|
5
|
+
__name: "HysCalendar",
|
|
6
|
+
props: {
|
|
7
|
+
modelValue: {},
|
|
8
|
+
events: {},
|
|
9
|
+
disabledDate: { type: Function }
|
|
10
|
+
},
|
|
11
|
+
emits: ["update:modelValue", "select", "event"],
|
|
12
|
+
setup(d, { emit: D }) {
|
|
13
|
+
const V = z(), m = D, f = /* @__PURE__ */ new Date(), o = p(f.getFullYear()), r = p(f.getMonth()), S = C(() => `${o.value}年${r.value + 1}月`), w = C(() => {
|
|
14
|
+
const n = (new Date(o.value, r.value, 1).getDay() + 6) % 7, t = new Date(o.value, r.value + 1, 0).getDate();
|
|
15
|
+
return [...Array(n).fill(null), ...Array.from({ length: t }, (e, v) => v + 1)];
|
|
16
|
+
});
|
|
17
|
+
function g(n) {
|
|
18
|
+
const t = new Date(o.value, r.value + n, 1);
|
|
19
|
+
o.value = t.getFullYear(), r.value = t.getMonth();
|
|
20
|
+
}
|
|
21
|
+
function s(n) {
|
|
22
|
+
return `${o.value}-${String(r.value + 1).padStart(2, "0")}-${String(n).padStart(2, "0")}`;
|
|
23
|
+
}
|
|
24
|
+
return (n, t) => (a(), l("section", F(y(V), { class: "hys-ui-ent-panel" }), [
|
|
25
|
+
i("header", H, [
|
|
26
|
+
i("button", {
|
|
27
|
+
type: "button",
|
|
28
|
+
"aria-label": "上个月",
|
|
29
|
+
onClick: t[0] || (t[0] = (e) => g(-1))
|
|
30
|
+
}, [
|
|
31
|
+
$(y(B), {
|
|
32
|
+
size: 16,
|
|
33
|
+
"aria-hidden": "true"
|
|
34
|
+
})
|
|
35
|
+
]),
|
|
36
|
+
i("strong", null, c(S.value), 1),
|
|
37
|
+
i("button", {
|
|
38
|
+
type: "button",
|
|
39
|
+
"aria-label": "下个月",
|
|
40
|
+
onClick: t[1] || (t[1] = (e) => g(1))
|
|
41
|
+
}, [
|
|
42
|
+
$(y(E), {
|
|
43
|
+
size: 16,
|
|
44
|
+
"aria-hidden": "true"
|
|
45
|
+
})
|
|
46
|
+
])
|
|
47
|
+
]),
|
|
48
|
+
i("div", L, [
|
|
49
|
+
(a(), l(h, null, b(["一", "二", "三", "四", "五", "六", "日"], (e) => i("strong", { key: e }, c(e), 1)), 64)),
|
|
50
|
+
(a(!0), l(h, null, b(w.value, (e, v) => {
|
|
51
|
+
var k;
|
|
52
|
+
return a(), l("div", {
|
|
53
|
+
key: v,
|
|
54
|
+
class: "hys-ui-ent-calendar-day"
|
|
55
|
+
}, [
|
|
56
|
+
e ? (a(), l("button", {
|
|
57
|
+
key: 0,
|
|
58
|
+
type: "button",
|
|
59
|
+
disabled: (k = d.disabledDate) == null ? void 0 : k.call(d, s(e)),
|
|
60
|
+
"aria-pressed": d.modelValue === s(e),
|
|
61
|
+
onClick: (u) => {
|
|
62
|
+
m("select", s(e)), m("update:modelValue", s(e));
|
|
63
|
+
}
|
|
64
|
+
}, [
|
|
65
|
+
N(n.$slots, "date", {
|
|
66
|
+
date: s(e),
|
|
67
|
+
day: e
|
|
68
|
+
}, () => [
|
|
69
|
+
R(c(e), 1)
|
|
70
|
+
])
|
|
71
|
+
], 8, M)) : x("", !0),
|
|
72
|
+
(a(!0), l(h, null, b((d.events || []).filter((u) => e && u.date === s(e)), (u) => (a(), l("button", {
|
|
73
|
+
type: "button",
|
|
74
|
+
key: u.id,
|
|
75
|
+
class: "hys-ui-ent-event",
|
|
76
|
+
onClick: (P) => m("event", u.id)
|
|
77
|
+
}, c(u.title), 9, Y))), 128))
|
|
78
|
+
]);
|
|
79
|
+
}), 128))
|
|
80
|
+
])
|
|
81
|
+
], 16));
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
export {
|
|
85
|
+
G as default
|
|
86
|
+
};
|