@kine-design/core 0.0.1-beta.1 → 0.0.1-beta.2
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/assets/style/global.css +1 -0
- package/assets/style/var/Wuxing.css +71 -0
- package/assets/style/var.css +23 -0
- package/components/base/affix/api.ts +16 -0
- package/components/base/affix/index.ts +15 -0
- package/components/base/affix/props.d.ts +34 -0
- package/components/base/affix/useAffix.ts +123 -0
- package/components/base/alert/api.ts +18 -0
- package/components/base/alert/index.ts +15 -0
- package/components/base/alert/props.d.ts +50 -0
- package/components/base/anchor/api.ts +20 -0
- package/components/base/anchor/index.ts +16 -0
- package/components/base/anchor/props.d.ts +46 -0
- package/components/base/anchor/useAnchor.ts +83 -0
- package/components/base/autoComplete/api.ts +24 -0
- package/components/base/autoComplete/index.ts +17 -0
- package/components/base/autoComplete/props.d.ts +75 -0
- package/components/base/autoComplete/useAutoComplete.ts +149 -0
- package/components/base/avatar/api.ts +17 -0
- package/components/base/avatar/avatar.css +61 -0
- package/components/base/avatar/index.ts +14 -0
- package/components/base/avatar/props.d.ts +37 -0
- package/components/base/backTop/api.ts +17 -0
- package/components/base/backTop/index.ts +15 -0
- package/components/base/backTop/props.d.ts +38 -0
- package/components/base/backTop/useBackTop.ts +62 -0
- package/components/base/badge/api.ts +22 -0
- package/components/base/badge/index.ts +15 -0
- package/components/base/badge/props.d.ts +50 -0
- package/components/base/button/api.ts +28 -0
- package/components/base/button/button.css +34 -0
- package/components/base/button/index.ts +16 -0
- package/components/base/button/props.d.ts +64 -0
- package/components/base/button/useButton.ts +37 -0
- package/components/base/card/api.ts +17 -0
- package/components/base/card/index.ts +15 -0
- package/components/base/card/props.d.ts +37 -0
- package/components/base/carousel/api.ts +28 -0
- package/components/base/carousel/index.ts +17 -0
- package/components/base/carousel/props.d.ts +72 -0
- package/components/base/carousel/useCarousel.ts +151 -0
- package/components/base/cascader/api.ts +23 -0
- package/components/base/cascader/index.ts +18 -0
- package/components/base/cascader/props.d.ts +103 -0
- package/components/base/cascader/useCascader.ts +334 -0
- package/components/base/checkbox/api.ts +24 -0
- package/components/base/checkbox/checkbox.css +0 -0
- package/components/base/checkbox/index.ts +16 -0
- package/components/base/checkbox/props.d.ts +77 -0
- package/components/base/checkbox/useCheckbox.ts +42 -0
- package/components/base/collapse/api.ts +21 -0
- package/components/base/collapse/index.ts +16 -0
- package/components/base/collapse/props.d.ts +45 -0
- package/components/base/collapse/useCollapse.ts +80 -0
- package/components/base/datePicker/api.ts +18 -0
- package/components/base/datePicker/index.ts +19 -0
- package/components/base/datePicker/props.d.ts +60 -0
- package/components/base/datePicker/useDatePicker.ts +392 -0
- package/components/base/divider/api.ts +15 -0
- package/components/base/divider/divider.css +11 -0
- package/components/base/divider/index.ts +15 -0
- package/components/base/divider/props.d.ts +30 -0
- package/components/base/dropdown/api.ts +33 -0
- package/components/base/dropdown/index.ts +16 -0
- package/components/base/dropdown/props.d.ts +60 -0
- package/components/base/dropdown/useDropdown.ts +123 -0
- package/components/base/empty/api.ts +15 -0
- package/components/base/empty/index.ts +15 -0
- package/components/base/empty/props.d.ts +26 -0
- package/components/base/image/api.ts +25 -0
- package/components/base/image/index.ts +18 -0
- package/components/base/image/props.d.ts +67 -0
- package/components/base/image/useImage.ts +119 -0
- package/components/base/input/api.ts +19 -0
- package/components/base/input/index.ts +16 -0
- package/components/base/input/input.css +19 -0
- package/components/base/input/props.d.ts +60 -0
- package/components/base/input/useInput.ts +53 -0
- package/components/base/inputNumber/api.ts +21 -0
- package/components/base/inputNumber/index.ts +15 -0
- package/components/base/inputNumber/props.d.ts +64 -0
- package/components/base/inputNumber/useInputNumber.ts +140 -0
- package/components/base/li/api.ts +15 -0
- package/components/base/li/index.ts +13 -0
- package/components/base/li/props.d.ts +30 -0
- package/components/base/list/api.ts +16 -0
- package/components/base/list/index.ts +15 -0
- package/components/base/list/props.d.ts +33 -0
- package/components/base/list/useList.ts +36 -0
- package/components/base/loading/api.ts +17 -0
- package/components/base/loading/index.ts +15 -0
- package/components/base/loading/props.d.ts +38 -0
- package/components/base/popover/api.ts +28 -0
- package/components/base/popover/index.ts +15 -0
- package/components/base/popover/props.d.ts +73 -0
- package/components/base/popover/usePopover.ts +188 -0
- package/components/base/progress/api.ts +18 -0
- package/components/base/progress/index.ts +15 -0
- package/components/base/progress/props.d.ts +53 -0
- package/components/base/progress/useProgress.ts +28 -0
- package/components/base/radio/api.ts +19 -0
- package/components/base/radio/index.ts +19 -0
- package/components/base/radio/props.d.ts +59 -0
- package/components/base/radio/useRadio.ts +11 -0
- package/components/base/rate/api.ts +18 -0
- package/components/base/rate/index.ts +15 -0
- package/components/base/rate/props.d.ts +49 -0
- package/components/base/rate/useRate.ts +75 -0
- package/components/base/result/api.ts +20 -0
- package/components/base/result/index.ts +15 -0
- package/components/base/result/props.d.ts +36 -0
- package/components/base/select/api.ts +31 -0
- package/components/base/select/index.ts +18 -0
- package/components/base/select/props.d.ts +132 -0
- package/components/base/select/select.css +7 -0
- package/components/base/select/useSelect.ts +280 -0
- package/components/base/select/useSelectTools.ts +60 -0
- package/components/base/skeleton/api.ts +18 -0
- package/components/base/skeleton/index.ts +15 -0
- package/components/base/skeleton/props.d.ts +41 -0
- package/components/base/slider/api.ts +20 -0
- package/components/base/slider/index.ts +15 -0
- package/components/base/slider/props.d.ts +65 -0
- package/components/base/slider/useSlider.ts +83 -0
- package/components/base/space/api.ts +17 -0
- package/components/base/space/index.ts +15 -0
- package/components/base/space/props.d.ts +39 -0
- package/components/base/steps/api.ts +30 -0
- package/components/base/steps/index.ts +22 -0
- package/components/base/steps/props.d.ts +88 -0
- package/components/base/steps/useSteps.ts +101 -0
- package/components/base/switch/api.ts +22 -0
- package/components/base/switch/index.ts +17 -0
- package/components/base/switch/props.d.ts +66 -0
- package/components/base/switch/useSwitch.tsx +79 -0
- package/components/base/tabs/api.ts +23 -0
- package/components/base/tabs/index.ts +18 -0
- package/components/base/tabs/props.d.ts +41 -0
- package/components/base/tabs/useTabs.ts +66 -0
- package/components/base/tag/api.ts +17 -0
- package/components/base/tag/index.ts +13 -0
- package/components/base/tag/props.d.ts +49 -0
- package/components/base/timePicker/api.ts +21 -0
- package/components/base/timePicker/index.ts +18 -0
- package/components/base/timePicker/props.d.ts +66 -0
- package/components/base/timePicker/useTimePicker.ts +161 -0
- package/components/base/timeline/api.ts +24 -0
- package/components/base/timeline/index.ts +16 -0
- package/components/base/timeline/props.d.ts +60 -0
- package/components/base/tooltip/api.ts +19 -0
- package/components/base/tooltip/index.ts +17 -0
- package/components/base/tooltip/props.d.ts +34 -0
- package/components/base/tooltip/useTooltip.ts +89 -0
- package/components/base/transfer/api.ts +18 -0
- package/components/base/transfer/index.ts +17 -0
- package/components/base/transfer/props.d.ts +63 -0
- package/components/base/transfer/useTransfer.ts +207 -0
- package/components/base/tree/api.ts +47 -0
- package/components/base/tree/index.ts +29 -0
- package/components/base/tree/props.d.ts +108 -0
- package/components/base/tree/tree.ts +263 -0
- package/components/base/tree/useTree.ts +114 -0
- package/components/message/confirm/api.ts +21 -0
- package/components/message/confirm/index.ts +15 -0
- package/components/message/confirm/props.d.ts +69 -0
- package/components/message/dialog/api.ts +19 -0
- package/components/message/dialog/index.ts +15 -0
- package/components/message/dialog/props.d.ts +55 -0
- package/components/message/drawer/api.ts +32 -0
- package/components/message/drawer/index.ts +15 -0
- package/components/message/drawer/props.d.ts +73 -0
- package/components/message/message/api.ts +27 -0
- package/components/message/message/index.ts +20 -0
- package/components/message/message/props.d.ts +54 -0
- package/components/message/message/useMessage.ts +61 -0
- package/components/message/notification/api.ts +23 -0
- package/components/message/notification/index.ts +19 -0
- package/components/message/notification/props.d.ts +64 -0
- package/components/message/notification/useNotification.ts +79 -0
- package/components/message/popover/MPopover.tsx +94 -0
- package/components/message/popover/api.ts +54 -0
- package/components/message/popover/index.ts +17 -0
- package/components/message/popover/popover.css +21 -0
- package/components/message/popover/props.d.ts +76 -0
- package/components/message/popover/usePopover.ts +230 -0
- package/components/other/darkMode/api.ts +17 -0
- package/components/other/darkMode/index.ts +17 -0
- package/components/other/darkMode/props.d.ts +37 -0
- package/components/other/darkMode/useDarkMode.ts +129 -0
- package/components/template/border/api.ts +18 -0
- package/components/template/border/index.ts +15 -0
- package/components/template/border/props.d.ts +41 -0
- package/components/template/breadcrumb/api.ts +15 -0
- package/components/template/breadcrumb/index.ts +15 -0
- package/components/template/breadcrumb/props.d.ts +45 -0
- package/components/template/descriptions/api.ts +23 -0
- package/components/template/descriptions/index.ts +16 -0
- package/components/template/descriptions/props.d.ts +54 -0
- package/components/template/form/api.ts +23 -0
- package/components/template/form/index.ts +20 -0
- package/components/template/form/props.d.ts +60 -0
- package/components/template/grid/api.ts +20 -0
- package/components/template/grid/index.ts +15 -0
- package/components/template/grid/props.d.ts +48 -0
- package/components/template/menu/api.ts +26 -0
- package/components/template/menu/index.ts +19 -0
- package/components/template/menu/props.d.ts +93 -0
- package/components/template/menu/useMenu.ts +155 -0
- package/components/template/pagination/api.ts +22 -0
- package/components/template/pagination/index.ts +18 -0
- package/components/template/pagination/props.d.ts +65 -0
- package/components/template/pagination/usePagination.ts +186 -0
- package/components/template/table/api.ts +18 -0
- package/components/template/table/index.ts +18 -0
- package/components/template/table/props.d.ts +36 -0
- package/components/template/table/useTable.ts +138 -0
- package/components/template/tableColumn/api.ts +17 -0
- package/components/template/tableColumn/index.ts +15 -0
- package/components/template/tableColumn/props.d.ts +32 -0
- package/components/template/virtualList/api.ts +16 -0
- package/components/template/virtualList/index.ts +18 -0
- package/components/template/virtualList/props.d.ts +25 -0
- package/components/template/virtualList/useVirtualList.ts +237 -0
- package/components/types/hook.d.ts +13 -0
- package/components/types/props.d.ts +52 -0
- package/components/types/template.d.ts +59 -0
- package/compositions/common/defineCore.ts +55 -0
- package/compositions/common/useDebounceFn.ts +27 -0
- package/compositions/common/useDrag.ts +65 -0
- package/compositions/common/useElementSize.ts +37 -0
- package/compositions/common/useEventListener.ts +48 -0
- package/compositions/common/usePopover.ts +45 -0
- package/compositions/common/useResizeObserver.ts +43 -0
- package/compositions/common/useTeleport.ts +24 -0
- package/compositions/input/useBooleanInput.ts +52 -0
- package/compositions/modal/useModal.ts +72 -0
- package/compositions/popper/useClickAway.ts +41 -0
- package/compositions/popper/usePopper.ts +63 -0
- package/compositions/utils/filters.ts +135 -0
- package/compositions/virtualList/enums.ts +52 -0
- package/compositions/virtualList/useContainerObserver.ts +82 -0
- package/compositions/virtualList/useEntries.ts +248 -0
- package/compositions/virtualList/useHeightCache.ts +83 -0
- package/compositions/virtualList/useSentinelObserver.ts +81 -0
- package/dist/components/base/affix/useAffix.d.ts +5 -4
- package/dist/components/base/anchor/useAnchor.d.ts +1 -1
- package/dist/components/base/autoComplete/useAutoComplete.d.ts +12 -4
- package/dist/components/base/backTop/useBackTop.d.ts +1 -1
- package/dist/components/base/button/index.d.ts +11 -2
- package/dist/components/base/button/useButton.d.ts +11 -2
- package/dist/components/base/carousel/useCarousel.d.ts +6 -3
- package/dist/components/base/cascader/useCascader.d.ts +23 -11
- package/dist/components/base/checkbox/useCheckbox.d.ts +4 -3
- package/dist/components/base/collapse/useCollapse.d.ts +2 -2
- package/dist/components/base/datePicker/useDatePicker.d.ts +140 -8
- package/dist/components/base/dropdown/useDropdown.d.ts +11 -5
- package/dist/components/base/image/useImage.d.ts +5 -5
- package/dist/components/base/input/useInput.d.ts +1 -2
- package/dist/components/base/inputNumber/useInputNumber.d.ts +2 -2
- package/dist/components/base/popover/usePopover.d.ts +8 -8
- package/dist/components/base/progress/useProgress.d.ts +1 -1
- package/dist/components/base/rate/useRate.d.ts +1 -1
- package/dist/components/base/select/useSelect.d.ts +8 -8
- package/dist/components/base/slider/useSlider.d.ts +3 -3
- package/dist/components/base/steps/index.d.ts +1 -1
- package/dist/components/base/steps/useSteps.d.ts +5 -5
- package/dist/components/base/switch/useSwitch.d.ts +8 -3
- package/dist/components/base/tabs/useTabs.d.ts +2 -2
- package/dist/components/base/timePicker/useTimePicker.d.ts +14 -6
- package/dist/components/base/tooltip/useTooltip.d.ts +14 -4
- package/dist/components/base/transfer/useTransfer.d.ts +15 -15
- package/dist/components/base/tree/index.d.ts +1 -1
- package/dist/components/base/tree/useTree.d.ts +2 -1
- package/dist/components/message/message/useMessage.d.ts +11 -1
- package/dist/components/message/notification/useNotification.d.ts +17 -1
- package/dist/components/message/popover/MPopover.d.ts +6 -1
- package/dist/components/message/popover/usePopover.d.ts +6 -6
- package/dist/components/other/darkMode/useDarkMode.d.ts +1 -1
- package/dist/components/template/menu/useMenu.d.ts +1 -0
- package/dist/components/template/virtualList/useVirtualList.d.ts +10 -7
- package/dist/compositions/common/useDrag.d.ts +1 -1
- package/dist/compositions/common/useElementSize.d.ts +2 -2
- package/dist/compositions/common/useTeleport.d.ts +4 -2
- package/dist/compositions/modal/useModal.d.ts +1 -1
- package/dist/core.js +6137 -4186
- package/dist/runtime/defineHook.d.ts +1 -1
- package/index.css +1 -0
- package/index.ts +71 -0
- package/package.json +19 -16
- package/runtime/defineHook.ts +21 -0
- package/tools/empty.ts +81 -0
- package/tools/index.ts +15 -0
- package/tools/types.ts +11 -0
- package/tsconfig.json +8 -0
- package/types/common/common.d.ts +25 -0
- package/types/common/model.d.ts +25 -0
- package/types/index.d.ts +11 -0
- package/types/props.d.ts +13 -0
- package/vite.config.build.ts +41 -0
- package/dist/vite.config.build.d.ts +0 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import "var.css";
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
/*木 春*/
|
|
3
|
+
--m-color-piaobi: #C0D695; /*缥碧*/
|
|
4
|
+
--m-color-qingqing: #4F6F46; /*青青*/
|
|
5
|
+
--m-color-cuiqiu: #446A37; /*翠虬*/
|
|
6
|
+
--m-color-qingshou: #284852; /*青绶*/
|
|
7
|
+
--m-color-qingluan: #9AA7B1; /*青鸾*/
|
|
8
|
+
--m-color-songlan: #6B798E; /*菘蓝*/
|
|
9
|
+
--m-color-qingdai: #45465E; /*青黛*/
|
|
10
|
+
--m-color-luozidai: #13393E; /*螺子黛*/
|
|
11
|
+
--m-color-qiling: #12264F; /*麒麟*/
|
|
12
|
+
--m-color-cuiwei: #4C8045; /*翠微*/
|
|
13
|
+
--m-color-tingwulv: #68945C; /*庭芜绿*/
|
|
14
|
+
--m-color-cangjia: #A8BF8F; /*苍葭*/
|
|
15
|
+
--m-color-huangliliu: #FEDC5E; /*黄栗留*/
|
|
16
|
+
--m-color-zhizi: #FAC03D; /*栀子*/
|
|
17
|
+
|
|
18
|
+
/*火 夏*/
|
|
19
|
+
--m-color-zhuyantuo: #F29A76; /*朱颜酡*/
|
|
20
|
+
--m-color-wozhe: #DD6B7B; /*渥赭*/
|
|
21
|
+
--m-color-chunzhi: #C25160; /*唇脂*/
|
|
22
|
+
--m-color-danji: #E60012; /*丹罽*/
|
|
23
|
+
--m-color-daran: #A81C2B; /*大繎*/
|
|
24
|
+
--m-color-jiangsha: #B27777; /*绛纱*/
|
|
25
|
+
--m-color-xilan: #E3ADB9; /*夕岚*/
|
|
26
|
+
|
|
27
|
+
/*金 秋*/
|
|
28
|
+
--m-color-gaoyu: #EFEFEF; /*缟羽*/
|
|
29
|
+
--m-color-yuse: #EAE4D1; /*玉色*/
|
|
30
|
+
--m-color-luanhua: #C0AD5E; /*栾华*/
|
|
31
|
+
--m-color-xinzi: #DA9233; /*杏子*/
|
|
32
|
+
--m-color-moge: #9F5221; /*靺鞈*/
|
|
33
|
+
--m-color-chenxiang: #99806C; /*沉香*/
|
|
34
|
+
--m-color-mihe: #DFD7C2; /*蜜合*/
|
|
35
|
+
--m-color-huaqing: #1A2847; /*花青*/
|
|
36
|
+
|
|
37
|
+
/*水 冬*/
|
|
38
|
+
--m-color-yuebai: #D4E5EF; /*月白*/
|
|
39
|
+
--m-color-qingshan: #A3BBDB; /*晴山*/
|
|
40
|
+
--m-color-ziyuan: #757CBB; /*紫苑*/
|
|
41
|
+
--m-color-zhengqing: #6CA8AF; /*正青*/
|
|
42
|
+
--m-color-yuyangran: #576470; /*育阳染*/
|
|
43
|
+
--m-color-jingyuan: #31322C; /*京元*/
|
|
44
|
+
--m-color-tieli: #46433B; /*驖骊*/
|
|
45
|
+
--m-color-tajian: #151D29; /*獭见*/
|
|
46
|
+
--m-color-jieshizi: #602641; /*芥拾紫*/
|
|
47
|
+
--m-color-shiyin: #C8B6BB; /*石英*/
|
|
48
|
+
|
|
49
|
+
/*土*/
|
|
50
|
+
--m-color-xiaoyaoyou: #B2BFC3; /*逍遥游*/
|
|
51
|
+
--m-color-huangliang: #C4B798; /*黄梁*/
|
|
52
|
+
--m-color-tanhe: #945635; /*檀褐*/
|
|
53
|
+
--m-color-jijin: #896D47; /*吉金*/
|
|
54
|
+
--m-color-youhulu: #644D31; /*油葫芦*/
|
|
55
|
+
|
|
56
|
+
--m-color-jin-yang: var(--m-color-xinzi); /*金-阳*/
|
|
57
|
+
--m-color-jin-yin: var(--m-color-gaoyu); /*金-阴*/
|
|
58
|
+
|
|
59
|
+
--m-color-mu-yang: var(--m-color-cuiqiu); /*木-阳*/
|
|
60
|
+
--m-color-mu-yin: var(--m-color-piaobi); /*木-阴*/
|
|
61
|
+
|
|
62
|
+
--m-color-shui-yang: var(--m-color-tajian); /*水-阳*/
|
|
63
|
+
--m-color-shui-yin: var(--m-color-qingshan); /*水-阴*/
|
|
64
|
+
|
|
65
|
+
--m-color-huo-yang: var(--m-color-daran); /*火-阳*/
|
|
66
|
+
--m-color-huo-yin: var(--m-color-wozhe); /*火-阴*/
|
|
67
|
+
|
|
68
|
+
--m-color-tu-yang: var(--m-color-tanhe); /*土-阳*/
|
|
69
|
+
--m-color-tu-yin: var(--m-color-huangliang); /*土-阴*/
|
|
70
|
+
|
|
71
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
@import "./var/Wuxing.css";
|
|
2
|
+
|
|
3
|
+
:root{
|
|
4
|
+
--m-color-text: #2B333E;
|
|
5
|
+
--m-color-text-disabled: #74787A;
|
|
6
|
+
--m-color-text-dark: #0F1423;
|
|
7
|
+
--m-color-divider: #0F142333;
|
|
8
|
+
--m-color-success: #4A9992;
|
|
9
|
+
--m-color-error: #861717;
|
|
10
|
+
--m-color-background: #0F142320;
|
|
11
|
+
--m-color-green2: #1A3B32;
|
|
12
|
+
--m-color-pink: #CC163A;
|
|
13
|
+
--m-color-warn: #E8B004;
|
|
14
|
+
|
|
15
|
+
--m-color-main: #861717;
|
|
16
|
+
--m-color-border: #5E616D;
|
|
17
|
+
--m-color-orange: #FCA104;
|
|
18
|
+
--m-color-blue: #1661AB;
|
|
19
|
+
--m-color-green: #223E36;
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
--m-color-disabled: #DBDADD;
|
|
23
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description affix api
|
|
3
|
+
* @author 阿怪
|
|
4
|
+
* @date 2026/2/26
|
|
5
|
+
* @version v1.0.0
|
|
6
|
+
*
|
|
7
|
+
* 江湖的业务千篇一律,复杂的代码好几百行。
|
|
8
|
+
*/
|
|
9
|
+
import { MCOPO } from '../../types/props';
|
|
10
|
+
import { AffixProps } from './props';
|
|
11
|
+
|
|
12
|
+
export const props: MCOPO<AffixProps> = {
|
|
13
|
+
offsetTop: { type: Number, default: undefined },
|
|
14
|
+
offsetBottom: { type: Number, default: undefined },
|
|
15
|
+
target: { type: String, default: '' },
|
|
16
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description affix core
|
|
3
|
+
* @author 阿怪
|
|
4
|
+
* @date 2026/2/26
|
|
5
|
+
* @version v1.0.0
|
|
6
|
+
*
|
|
7
|
+
* 江湖的业务千篇一律,复杂的代码好几百行。
|
|
8
|
+
*/
|
|
9
|
+
import { props } from './api.ts';
|
|
10
|
+
import useAffix from './useAffix';
|
|
11
|
+
|
|
12
|
+
export const AffixCore = {
|
|
13
|
+
props,
|
|
14
|
+
useAffix,
|
|
15
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description affix props type
|
|
3
|
+
* @author 阿怪
|
|
4
|
+
* @date 2026/2/26
|
|
5
|
+
* @version v1.0.0
|
|
6
|
+
*
|
|
7
|
+
* @name k-affix
|
|
8
|
+
* @docDescription Affix(固钉)组件,滚动时将内容固定在可视区域。
|
|
9
|
+
*
|
|
10
|
+
* 江湖的业务千篇一律,复杂的代码好几百行。
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export declare type AffixProps = {
|
|
14
|
+
/**
|
|
15
|
+
* @description 距顶部的偏移量(px),与 offsetBottom 二选一
|
|
16
|
+
* @type number
|
|
17
|
+
*/
|
|
18
|
+
offsetTop?: number,
|
|
19
|
+
/**
|
|
20
|
+
* @description 距底部的偏移量(px),与 offsetTop 二选一
|
|
21
|
+
* @type number
|
|
22
|
+
*/
|
|
23
|
+
offsetBottom?: number,
|
|
24
|
+
/**
|
|
25
|
+
* @description 触发滚动监听的目标元素 CSS 选择器,默认监听 window
|
|
26
|
+
* @type string
|
|
27
|
+
* @default ''
|
|
28
|
+
*/
|
|
29
|
+
target?: string,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export declare type AffixEmits = {
|
|
33
|
+
onChange?: (affixed: boolean) => void,
|
|
34
|
+
};
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description affix hook
|
|
3
|
+
* @author 阿怪
|
|
4
|
+
* @date 2026/2/26
|
|
5
|
+
* @version v1.0.0
|
|
6
|
+
*
|
|
7
|
+
* 江湖的业务千篇一律,复杂的代码好几百行。
|
|
8
|
+
*/
|
|
9
|
+
import { ref, onMounted, onUnmounted } from 'vue';
|
|
10
|
+
import { AffixProps } from './props';
|
|
11
|
+
|
|
12
|
+
export default function useAffix(
|
|
13
|
+
props: Required<AffixProps>,
|
|
14
|
+
emit: (event: string, ...args: unknown[]) => void,
|
|
15
|
+
) {
|
|
16
|
+
const affixed = ref(false);
|
|
17
|
+
// 固定后占位元素的高度(撑开文档流)
|
|
18
|
+
const placeholderHeight = ref(0);
|
|
19
|
+
// 固定后的位置样式
|
|
20
|
+
const affixStyle = ref<Record<string, string>>({});
|
|
21
|
+
|
|
22
|
+
const wrapperRef = ref<HTMLElement | null>(null);
|
|
23
|
+
const wrapRef = ref<HTMLElement | null>(null);
|
|
24
|
+
|
|
25
|
+
const findScrollParent = (node: HTMLElement | null): HTMLElement | Window => {
|
|
26
|
+
let el = node?.parentElement;
|
|
27
|
+
while (el) {
|
|
28
|
+
const { overflowY } = getComputedStyle(el);
|
|
29
|
+
if (overflowY === 'auto' || overflowY === 'scroll') {
|
|
30
|
+
return el;
|
|
31
|
+
}
|
|
32
|
+
el = el.parentElement;
|
|
33
|
+
}
|
|
34
|
+
return window;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
let scrollTarget: HTMLElement | Window | null = null;
|
|
38
|
+
|
|
39
|
+
const getScrollTarget = (): HTMLElement | Window => {
|
|
40
|
+
if (scrollTarget) { return scrollTarget; }
|
|
41
|
+
if (props.target) {
|
|
42
|
+
const el = document.querySelector<HTMLElement>(props.target);
|
|
43
|
+
if (el) { scrollTarget = el; return el; }
|
|
44
|
+
}
|
|
45
|
+
scrollTarget = findScrollParent(wrapperRef.value);
|
|
46
|
+
return scrollTarget;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const getContainerRect = (): DOMRect => {
|
|
50
|
+
const t = getScrollTarget();
|
|
51
|
+
if (t === window) {
|
|
52
|
+
return new DOMRect(0, 0, window.innerWidth, window.innerHeight);
|
|
53
|
+
}
|
|
54
|
+
return (t as HTMLElement).getBoundingClientRect();
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const update = () => {
|
|
58
|
+
if (!wrapperRef.value || !wrapRef.value) { return; }
|
|
59
|
+
|
|
60
|
+
// 用 wrapper(始终在文档流中)的位置来判断,避免 fixed 元素位置不准
|
|
61
|
+
const wrapRect = wrapperRef.value.getBoundingClientRect();
|
|
62
|
+
const containerRect = getContainerRect();
|
|
63
|
+
let shouldAffix = false;
|
|
64
|
+
const style: Record<string, string> = {};
|
|
65
|
+
|
|
66
|
+
const contentWidth = affixed.value
|
|
67
|
+
? wrapRef.value.getBoundingClientRect().width
|
|
68
|
+
: wrapRef.value.offsetWidth;
|
|
69
|
+
|
|
70
|
+
if (props.offsetTop !== undefined) {
|
|
71
|
+
const threshold = containerRect.top + props.offsetTop;
|
|
72
|
+
if (wrapRect.top <= threshold) {
|
|
73
|
+
shouldAffix = true;
|
|
74
|
+
style.position = 'fixed';
|
|
75
|
+
style.top = `${containerRect.top + props.offsetTop}px`;
|
|
76
|
+
style.width = `${contentWidth}px`;
|
|
77
|
+
style.zIndex = '100';
|
|
78
|
+
}
|
|
79
|
+
} else if (props.offsetBottom !== undefined) {
|
|
80
|
+
const threshold = containerRect.bottom - props.offsetBottom;
|
|
81
|
+
if (wrapRect.bottom >= threshold) {
|
|
82
|
+
shouldAffix = true;
|
|
83
|
+
style.position = 'fixed';
|
|
84
|
+
style.bottom = `${window.innerHeight - containerRect.bottom + props.offsetBottom}px`;
|
|
85
|
+
style.width = `${contentWidth}px`;
|
|
86
|
+
style.zIndex = '100';
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (shouldAffix !== affixed.value) {
|
|
91
|
+
if (shouldAffix) {
|
|
92
|
+
placeholderHeight.value = wrapRect.height;
|
|
93
|
+
} else {
|
|
94
|
+
placeholderHeight.value = 0;
|
|
95
|
+
}
|
|
96
|
+
affixed.value = shouldAffix;
|
|
97
|
+
emit('change', shouldAffix);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
affixStyle.value = shouldAffix ? style : {};
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
onMounted(() => {
|
|
104
|
+
const target = getScrollTarget();
|
|
105
|
+
target.addEventListener('scroll', update, { passive: true });
|
|
106
|
+
window.addEventListener('resize', update, { passive: true });
|
|
107
|
+
update();
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
onUnmounted(() => {
|
|
111
|
+
const target = getScrollTarget();
|
|
112
|
+
target.removeEventListener('scroll', update);
|
|
113
|
+
window.removeEventListener('resize', update);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
return {
|
|
117
|
+
wrapperRef,
|
|
118
|
+
wrapRef,
|
|
119
|
+
affixed,
|
|
120
|
+
affixStyle,
|
|
121
|
+
placeholderHeight,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description alert api
|
|
3
|
+
* @author 阿怪
|
|
4
|
+
* @date 2026/2/26
|
|
5
|
+
* @version v1.0.0
|
|
6
|
+
*
|
|
7
|
+
* 江湖的业务千篇一律,复杂的代码好几百行。
|
|
8
|
+
*/
|
|
9
|
+
import { MCOPO, MPropType } from '../../types/props';
|
|
10
|
+
import { AlertProps } from './props';
|
|
11
|
+
|
|
12
|
+
export const props: MCOPO<AlertProps> = {
|
|
13
|
+
type: { type: String as MPropType<'success' | 'warning' | 'error' | 'info'>, default: 'info' },
|
|
14
|
+
title: { type: String, default: undefined },
|
|
15
|
+
description: { type: String, default: undefined },
|
|
16
|
+
closable: { type: Boolean, default: false },
|
|
17
|
+
showIcon: { type: Boolean, default: false },
|
|
18
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description alert core 导出
|
|
3
|
+
* @author 阿怪
|
|
4
|
+
* @date 2026/2/26
|
|
5
|
+
* @version v1.0.0
|
|
6
|
+
*
|
|
7
|
+
* 江湖的业务千篇一律,复杂的代码好几百行。
|
|
8
|
+
*/
|
|
9
|
+
import { props } from './api';
|
|
10
|
+
|
|
11
|
+
export const AlertCore = {
|
|
12
|
+
props,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type { AlertProps, AlertEvents } from './props';
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description alert api type
|
|
3
|
+
* @author 阿怪
|
|
4
|
+
* @date 2026/2/26
|
|
5
|
+
* @version v1.0.0
|
|
6
|
+
*
|
|
7
|
+
* @name m-alert
|
|
8
|
+
* @docDescription Alert component with shuimo-ui style.
|
|
9
|
+
* 水墨组件的警告提示组件。
|
|
10
|
+
*
|
|
11
|
+
* 江湖的业务千篇一律,复杂的代码好几百行。
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
export declare type AlertProps = {
|
|
15
|
+
/**
|
|
16
|
+
* @description 提示类型
|
|
17
|
+
* @type 'success' | 'warning' | 'error' | 'info'
|
|
18
|
+
* @default 'info'
|
|
19
|
+
*/
|
|
20
|
+
type?: 'success' | 'warning' | 'error' | 'info';
|
|
21
|
+
/**
|
|
22
|
+
* @description 标题
|
|
23
|
+
* @type string
|
|
24
|
+
*/
|
|
25
|
+
title?: string;
|
|
26
|
+
/**
|
|
27
|
+
* @description 描述内容
|
|
28
|
+
* @type string
|
|
29
|
+
*/
|
|
30
|
+
description?: string;
|
|
31
|
+
/**
|
|
32
|
+
* @description 是否可关闭
|
|
33
|
+
* @type boolean
|
|
34
|
+
* @default false
|
|
35
|
+
*/
|
|
36
|
+
closable?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* @description 是否显示图标
|
|
39
|
+
* @type boolean
|
|
40
|
+
* @default false
|
|
41
|
+
*/
|
|
42
|
+
showIcon?: boolean;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export declare type AlertEvents = {
|
|
46
|
+
/**
|
|
47
|
+
* @description 关闭时触发
|
|
48
|
+
*/
|
|
49
|
+
onClose?: () => void;
|
|
50
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description anchor api
|
|
3
|
+
* @author 阿怪
|
|
4
|
+
* @date 2026/2/26
|
|
5
|
+
* @version v1.0.0
|
|
6
|
+
*
|
|
7
|
+
* 江湖的业务千篇一律,复杂的代码好几百行。
|
|
8
|
+
*/
|
|
9
|
+
import { MCOPO, MPropType } from '../../types/props';
|
|
10
|
+
import { AnchorProps, AnchorLinkProps } from './props';
|
|
11
|
+
|
|
12
|
+
export const props: MCOPO<AnchorProps> = {
|
|
13
|
+
offsetTop: { type: Number, default: 0 },
|
|
14
|
+
bounds: { type: Number, default: 5 },
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const anchorLinkProps: MCOPO<AnchorLinkProps> = {
|
|
18
|
+
href: { type: String as MPropType<string>, required: true },
|
|
19
|
+
title: { type: String, default: '' },
|
|
20
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description anchor core
|
|
3
|
+
* @author 阿怪
|
|
4
|
+
* @date 2026/2/26
|
|
5
|
+
* @version v1.0.0
|
|
6
|
+
*
|
|
7
|
+
* 江湖的业务千篇一律,复杂的代码好几百行。
|
|
8
|
+
*/
|
|
9
|
+
import { props, anchorLinkProps } from './api.ts';
|
|
10
|
+
import useAnchor from './useAnchor';
|
|
11
|
+
|
|
12
|
+
export const AnchorCore = {
|
|
13
|
+
props,
|
|
14
|
+
anchorLinkProps,
|
|
15
|
+
useAnchor,
|
|
16
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description anchor props type
|
|
3
|
+
* @author 阿怪
|
|
4
|
+
* @date 2026/2/26
|
|
5
|
+
* @version v1.0.0
|
|
6
|
+
*
|
|
7
|
+
* @name k-anchor
|
|
8
|
+
* @docDescription Anchor(锚点导航)组件,根据滚动位置高亮当前锚点。
|
|
9
|
+
*
|
|
10
|
+
* 江湖的业务千篇一律,复杂的代码好几百行。
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export declare type AnchorProps = {
|
|
14
|
+
/**
|
|
15
|
+
* @description 滚动锚定时距顶部的偏移量(px)
|
|
16
|
+
* @type number
|
|
17
|
+
* @default 0
|
|
18
|
+
*/
|
|
19
|
+
offsetTop?: number,
|
|
20
|
+
/**
|
|
21
|
+
* @description 锚点区域边界值,达到对应 bound 距离顶部就切换高亮(px)
|
|
22
|
+
* @type number
|
|
23
|
+
* @default 5
|
|
24
|
+
*/
|
|
25
|
+
bounds?: number,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export declare type AnchorEmits = {
|
|
29
|
+
onChange?: (currentLink: string) => void,
|
|
30
|
+
onClick?: (href: string) => void,
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/** AnchorLink 子组件 props */
|
|
34
|
+
export declare type AnchorLinkProps = {
|
|
35
|
+
/**
|
|
36
|
+
* @description 锚点目标的 hash(如 #section-1)
|
|
37
|
+
* @type string
|
|
38
|
+
*/
|
|
39
|
+
href: string,
|
|
40
|
+
/**
|
|
41
|
+
* @description 显示的标题文本
|
|
42
|
+
* @type string
|
|
43
|
+
* @default ''
|
|
44
|
+
*/
|
|
45
|
+
title?: string,
|
|
46
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description anchor hook
|
|
3
|
+
* @author 阿怪
|
|
4
|
+
* @date 2026/2/26
|
|
5
|
+
* @version v1.0.0
|
|
6
|
+
*
|
|
7
|
+
* 江湖的业务千篇一律,复杂的代码好几百行。
|
|
8
|
+
*/
|
|
9
|
+
import { ref, onMounted, onUnmounted } from 'vue';
|
|
10
|
+
import { AnchorProps } from './props';
|
|
11
|
+
|
|
12
|
+
export default function useAnchor(
|
|
13
|
+
props: Required<AnchorProps>,
|
|
14
|
+
emit: (event: string, ...args: unknown[]) => void,
|
|
15
|
+
) {
|
|
16
|
+
const currentLink = ref('');
|
|
17
|
+
// 由子组件注册的 href 列表(按 DOM 顺序)
|
|
18
|
+
const links = ref<string[]>([]);
|
|
19
|
+
|
|
20
|
+
/** 子组件调用此方法注册自己的 href */
|
|
21
|
+
const registerLink = (href: string) => {
|
|
22
|
+
if (!links.value.includes(href)) {
|
|
23
|
+
links.value.push(href);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const unregisterLink = (href: string) => {
|
|
28
|
+
const idx = links.value.indexOf(href);
|
|
29
|
+
if (idx !== -1) {
|
|
30
|
+
links.value.splice(idx, 1);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const getTargetEl = (href: string): HTMLElement | null => {
|
|
35
|
+
if (!href.startsWith('#')) { return null; }
|
|
36
|
+
return document.querySelector<HTMLElement>(href);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const onScroll = () => {
|
|
40
|
+
const scrollTop = window.scrollY + props.offsetTop + props.bounds;
|
|
41
|
+
let active = '';
|
|
42
|
+
|
|
43
|
+
// 从下往上遍历,找到第一个顶部距离小于等于 scrollTop 的元素
|
|
44
|
+
for (let i = links.value.length - 1; i >= 0; i--) {
|
|
45
|
+
const href = links.value[i];
|
|
46
|
+
const el = getTargetEl(href);
|
|
47
|
+
if (el && el.offsetTop <= scrollTop) {
|
|
48
|
+
active = href;
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (active !== currentLink.value) {
|
|
54
|
+
currentLink.value = active;
|
|
55
|
+
emit('change', active);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const handleClick = (href: string) => {
|
|
60
|
+
emit('click', href);
|
|
61
|
+
const el = getTargetEl(href);
|
|
62
|
+
if (el) {
|
|
63
|
+
const top = el.offsetTop - props.offsetTop;
|
|
64
|
+
window.scrollTo({ top, behavior: 'smooth' });
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
onMounted(() => {
|
|
69
|
+
window.addEventListener('scroll', onScroll, { passive: true });
|
|
70
|
+
onScroll();
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
onUnmounted(() => {
|
|
74
|
+
window.removeEventListener('scroll', onScroll);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
return {
|
|
78
|
+
currentLink,
|
|
79
|
+
registerLink,
|
|
80
|
+
unregisterLink,
|
|
81
|
+
handleClick,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description autoComplete api
|
|
3
|
+
* @author 阿怪
|
|
4
|
+
* @date 2026/2/26
|
|
5
|
+
* @version v1.0.0
|
|
6
|
+
*
|
|
7
|
+
* 江湖的业务千篇一律,复杂的代码好几百行。
|
|
8
|
+
*/
|
|
9
|
+
import { MCOPO, MPropType } from '../../types/props';
|
|
10
|
+
import { AutoCompleteProps, AutoCompleteOption } from './props';
|
|
11
|
+
|
|
12
|
+
export const props: MCOPO<AutoCompleteProps> = {
|
|
13
|
+
modelValue: { type: String, default: '' },
|
|
14
|
+
placeholder: { type: String, default: '请输入...' },
|
|
15
|
+
disabled: { type: Boolean, default: false },
|
|
16
|
+
clearable: { type: Boolean, default: false },
|
|
17
|
+
debounce: { type: Number, default: 300 },
|
|
18
|
+
fetchSuggestions: {
|
|
19
|
+
type: Function as MPropType<(query: string) => Promise<AutoCompleteOption[]> | AutoCompleteOption[]>,
|
|
20
|
+
default: undefined,
|
|
21
|
+
},
|
|
22
|
+
triggerOnFocus: { type: Boolean, default: false },
|
|
23
|
+
highlight: { type: Boolean, default: false },
|
|
24
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description autoComplete core 导出
|
|
3
|
+
* @author 阿怪
|
|
4
|
+
* @date 2026/2/26
|
|
5
|
+
* @version v1.0.0
|
|
6
|
+
*
|
|
7
|
+
* 江湖的业务千篇一律,复杂的代码好几百行。
|
|
8
|
+
*/
|
|
9
|
+
import { props } from './api';
|
|
10
|
+
import { useAutoComplete } from './useAutoComplete';
|
|
11
|
+
|
|
12
|
+
export const AutoCompleteCore = {
|
|
13
|
+
props,
|
|
14
|
+
useAutoComplete,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type { AutoCompleteProps, AutoCompleteOption } from './props';
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description autoComplete api type
|
|
3
|
+
* @author 阿怪
|
|
4
|
+
* @date 2026/2/26
|
|
5
|
+
* @version v1.0.0
|
|
6
|
+
*
|
|
7
|
+
* 江湖的业务千篇一律,复杂的代码好几百行。
|
|
8
|
+
*
|
|
9
|
+
* AutoComplete 是 freetype 模式的 Select:
|
|
10
|
+
* 输入值不限于选项,选项只是建议;
|
|
11
|
+
* 搜索来源由外部 fetchSuggestions 驱动。
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* 建议项类型
|
|
16
|
+
*/
|
|
17
|
+
export declare type AutoCompleteOption = {
|
|
18
|
+
/** 值(也是输入框显示的文本) */
|
|
19
|
+
value: string;
|
|
20
|
+
/** 可选的展示标签,不传则使用 value */
|
|
21
|
+
label?: string;
|
|
22
|
+
/** 允许附加任意业务字段 */
|
|
23
|
+
[key: string]: unknown;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export declare type AutoCompleteProps = {
|
|
27
|
+
/**
|
|
28
|
+
* @description 当前输入值(双向绑定)
|
|
29
|
+
* @type string
|
|
30
|
+
* @default ''
|
|
31
|
+
*/
|
|
32
|
+
modelValue?: string;
|
|
33
|
+
/**
|
|
34
|
+
* @description 输入框占位文字
|
|
35
|
+
* @type string
|
|
36
|
+
* @default '请输入...'
|
|
37
|
+
*/
|
|
38
|
+
placeholder?: string;
|
|
39
|
+
/**
|
|
40
|
+
* @description 是否禁用
|
|
41
|
+
* @type boolean
|
|
42
|
+
* @default false
|
|
43
|
+
*/
|
|
44
|
+
disabled?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* @description 是否可清空
|
|
47
|
+
* @type boolean
|
|
48
|
+
* @default false
|
|
49
|
+
*/
|
|
50
|
+
clearable?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* @description 输入 debounce 延迟(毫秒),超过此时间后才触发 onSearch / fetchSuggestions
|
|
53
|
+
* @type number
|
|
54
|
+
* @default 300
|
|
55
|
+
*/
|
|
56
|
+
debounce?: number;
|
|
57
|
+
/**
|
|
58
|
+
* @description 获取建议列表的函数,可返回 Promise 或同步数组
|
|
59
|
+
* @type Function
|
|
60
|
+
* @default undefined
|
|
61
|
+
*/
|
|
62
|
+
fetchSuggestions?: (query: string) => Promise<AutoCompleteOption[]> | AutoCompleteOption[];
|
|
63
|
+
/**
|
|
64
|
+
* @description 聚焦时是否立即触发一次搜索(query 为当前 modelValue)
|
|
65
|
+
* @type boolean
|
|
66
|
+
* @default false
|
|
67
|
+
*/
|
|
68
|
+
triggerOnFocus?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* @description 是否高亮匹配文字
|
|
71
|
+
* @type boolean
|
|
72
|
+
* @default false
|
|
73
|
+
*/
|
|
74
|
+
highlight?: boolean;
|
|
75
|
+
};
|