@kine-design/core 0.0.1-beta.1 → 0.0.1-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +17 -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 +18 -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 +15 -0
- package/components/base/avatar/props.d.ts +37 -0
- package/components/base/backTop/api.ts +17 -0
- package/components/base/backTop/index.ts +17 -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 +17 -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 +149 -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 +17 -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 +18 -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 +18 -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 +17 -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 +17 -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 +15 -0
- package/components/base/li/props.d.ts +30 -0
- package/components/base/list/api.ts +16 -0
- package/components/base/list/index.ts +17 -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 +17 -0
- package/components/base/popover/props.d.ts +73 -0
- package/components/base/popover/usePopover.ts +192 -0
- package/components/base/progress/api.ts +18 -0
- package/components/base/progress/index.ts +17 -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 +17 -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 +17 -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 +19 -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 +15 -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 +234 -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 +18 -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 +19 -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 +17 -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 +89 -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/index.d.ts +2 -1
- package/dist/components/base/affix/useAffix.d.ts +6 -5
- package/dist/components/base/anchor/index.d.ts +2 -1
- package/dist/components/base/anchor/useAnchor.d.ts +2 -2
- package/dist/components/base/autoComplete/useAutoComplete.d.ts +12 -4
- package/dist/components/base/avatar/index.d.ts +1 -0
- package/dist/components/base/backTop/index.d.ts +2 -1
- package/dist/components/base/backTop/useBackTop.d.ts +2 -2
- package/dist/components/base/button/index.d.ts +3 -21
- package/dist/components/base/button/useButton.d.ts +5 -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/index.d.ts +2 -1
- package/dist/components/base/checkbox/useCheckbox.d.ts +4 -3
- package/dist/components/base/collapse/index.d.ts +2 -1
- package/dist/components/base/collapse/useCollapse.d.ts +3 -3
- package/dist/components/base/datePicker/useDatePicker.d.ts +140 -8
- package/dist/components/base/dropdown/index.d.ts +2 -1
- package/dist/components/base/dropdown/useDropdown.d.ts +12 -6
- package/dist/components/base/image/useImage.d.ts +5 -5
- package/dist/components/base/input/index.d.ts +2 -1
- package/dist/components/base/input/useInput.d.ts +1 -2
- package/dist/components/base/inputNumber/index.d.ts +2 -1
- package/dist/components/base/inputNumber/useInputNumber.d.ts +3 -3
- package/dist/components/base/li/index.d.ts +1 -0
- package/dist/components/base/list/index.d.ts +2 -1
- package/dist/components/base/list/useList.d.ts +1 -1
- package/dist/components/base/popover/index.d.ts +2 -1
- package/dist/components/base/popover/usePopover.d.ts +9 -9
- package/dist/components/base/progress/index.d.ts +2 -1
- package/dist/components/base/progress/useProgress.d.ts +2 -2
- package/dist/components/base/rate/index.d.ts +2 -1
- package/dist/components/base/rate/useRate.d.ts +2 -2
- package/dist/components/base/select/useSelect.d.ts +8 -8
- package/dist/components/base/slider/index.d.ts +2 -1
- package/dist/components/base/slider/useSlider.d.ts +4 -4
- 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/index.d.ts +2 -1
- package/dist/components/base/switch/useSwitch.d.ts +8 -3
- package/dist/components/base/tabs/index.d.ts +1 -1
- package/dist/components/base/tabs/useTabs.d.ts +3 -3
- package/dist/components/base/tag/index.d.ts +1 -0
- package/dist/components/base/timePicker/useTimePicker.d.ts +14 -6
- package/dist/components/base/tooltip/index.d.ts +1 -1
- package/dist/components/base/tooltip/useTooltip.d.ts +15 -5
- 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/drawer/index.d.ts +2 -2
- 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/index.d.ts +1 -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/index.d.ts +0 -1
- package/dist/components/template/menu/useMenu.d.ts +2 -1
- package/dist/components/template/pagination/index.d.ts +2 -1
- package/dist/components/template/virtualList/index.d.ts +0 -1
- 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 +6147 -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,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description progress api
|
|
3
|
+
* @author 阿怪
|
|
4
|
+
* @date 2026/2/27
|
|
5
|
+
* @version v1.1.0
|
|
6
|
+
*
|
|
7
|
+
* 江湖的业务千篇一律,复杂的代码好几百行。
|
|
8
|
+
*/
|
|
9
|
+
import { MCOPO, MPropType } from '../../types/props';
|
|
10
|
+
import { ProgressProps, ProgressStatus } from './props';
|
|
11
|
+
|
|
12
|
+
export const props: MCOPO<ProgressProps> = {
|
|
13
|
+
value: { type: Number, default: 0 },
|
|
14
|
+
max: { type: Number, default: 100 },
|
|
15
|
+
showInfo: { type: Boolean, default: true },
|
|
16
|
+
status: { type: String as unknown as MPropType<ProgressStatus>, default: 'default' },
|
|
17
|
+
strokeWidth: { type: Number, default: 4 },
|
|
18
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description progress core
|
|
3
|
+
* @author 阿怪
|
|
4
|
+
* @date 2025/02/25 00:00
|
|
5
|
+
* @version v1.0.0
|
|
6
|
+
*
|
|
7
|
+
* 江湖的业务千篇一律,复杂的代码好几百行。
|
|
8
|
+
*/
|
|
9
|
+
import { props } from './api';
|
|
10
|
+
import { useProgress } from './useProgress';
|
|
11
|
+
|
|
12
|
+
export const ProgressCore = {
|
|
13
|
+
props,
|
|
14
|
+
useProgress,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type { ProgressProps, ProgressStatus } from './props';
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description progress props type
|
|
3
|
+
* @author 阿怪
|
|
4
|
+
* @date 2026/2/27
|
|
5
|
+
* @version v1.1.0
|
|
6
|
+
*
|
|
7
|
+
* @name m-progress
|
|
8
|
+
* @docDescription Progress component.
|
|
9
|
+
* 进度条组件。
|
|
10
|
+
* @docUrl https://shuimo.design/progress
|
|
11
|
+
*
|
|
12
|
+
* 江湖的业务千篇一律,复杂的代码好几百行。
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
export declare type ProgressStatus = 'default' | 'success' | 'warning' | 'danger';
|
|
16
|
+
|
|
17
|
+
export declare type ProgressProps = {
|
|
18
|
+
/**
|
|
19
|
+
* @description progress value
|
|
20
|
+
* 进度条的值(0 ~ max)
|
|
21
|
+
* @type number
|
|
22
|
+
* @default 0
|
|
23
|
+
*/
|
|
24
|
+
value?: number,
|
|
25
|
+
/**
|
|
26
|
+
* @description progress value max
|
|
27
|
+
* 进度条最大值
|
|
28
|
+
* @type number
|
|
29
|
+
* @default 100
|
|
30
|
+
*/
|
|
31
|
+
max?: number,
|
|
32
|
+
/**
|
|
33
|
+
* @description display value
|
|
34
|
+
* 是否显示进度值
|
|
35
|
+
* @type boolean
|
|
36
|
+
* @default true
|
|
37
|
+
*/
|
|
38
|
+
showInfo?: boolean,
|
|
39
|
+
/**
|
|
40
|
+
* @description status color variant
|
|
41
|
+
* 状态颜色变体:default | success | warning | danger
|
|
42
|
+
* @type ProgressStatus
|
|
43
|
+
* @default 'default'
|
|
44
|
+
*/
|
|
45
|
+
status?: ProgressStatus,
|
|
46
|
+
/**
|
|
47
|
+
* @description stroke width in px
|
|
48
|
+
* 进度条粗细(px)
|
|
49
|
+
* @type number
|
|
50
|
+
* @default 4
|
|
51
|
+
*/
|
|
52
|
+
strokeWidth?: number,
|
|
53
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description progress hook
|
|
3
|
+
* @author 阿怪
|
|
4
|
+
* @date 2025/02/25 00:00
|
|
5
|
+
* @version v1.0.0
|
|
6
|
+
*
|
|
7
|
+
* 江湖的业务千篇一律,复杂的代码好几百行。
|
|
8
|
+
*/
|
|
9
|
+
import { computed } from 'vue';
|
|
10
|
+
import { ProgressProps } from './props';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @description 清除多余小数位,保留两位小数
|
|
14
|
+
*/
|
|
15
|
+
const clearZero = (num: number) => {
|
|
16
|
+
const str = num.toString();
|
|
17
|
+
const index = str.indexOf('.');
|
|
18
|
+
if (index === -1) { return num; }
|
|
19
|
+
return str.slice(0, index + 3);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export function useProgress(props: Required<ProgressProps>) {
|
|
23
|
+
const percentage = computed(() => clearZero((props.value * 100 / props.max)));
|
|
24
|
+
|
|
25
|
+
return {
|
|
26
|
+
percentage,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description radio api
|
|
3
|
+
* @author 阿怪
|
|
4
|
+
* @date 2025/02/25 00:00
|
|
5
|
+
* @version v1.0.0
|
|
6
|
+
*
|
|
7
|
+
* 江湖的业务千篇一律,复杂的代码好几百行。
|
|
8
|
+
*/
|
|
9
|
+
import { MCOPO } from '../../types/props';
|
|
10
|
+
import { RadioProps } from './props';
|
|
11
|
+
|
|
12
|
+
export const props: MCOPO<RadioProps> = {
|
|
13
|
+
label: { type: [String, Number], default: '' },
|
|
14
|
+
name: { type: String, default: undefined },
|
|
15
|
+
checked: { type: Boolean, default: undefined },
|
|
16
|
+
value: { type: [String, Number], default: '' },
|
|
17
|
+
modelValue: { type: null, default: '' },
|
|
18
|
+
disabled: { type: Boolean, default: false },
|
|
19
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description radio core
|
|
3
|
+
* @author 阿怪
|
|
4
|
+
* @date 2025/02/25 00:00
|
|
5
|
+
* @version v1.0.0
|
|
6
|
+
*
|
|
7
|
+
* 江湖的业务千篇一律,复杂的代码好几百行。
|
|
8
|
+
*/
|
|
9
|
+
import { props } from './api';
|
|
10
|
+
import { initChecked, getNewModelValue, createRadioId } from './useRadio';
|
|
11
|
+
|
|
12
|
+
export const RadioCore = {
|
|
13
|
+
props,
|
|
14
|
+
initChecked,
|
|
15
|
+
getNewModelValue,
|
|
16
|
+
createRadioId,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export { initChecked, getNewModelValue, createRadioId } from './useRadio';
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description radio props type
|
|
3
|
+
* @author 阿怪
|
|
4
|
+
* @date 2025/02/25 00:00
|
|
5
|
+
* @version v1.0.0
|
|
6
|
+
*
|
|
7
|
+
* @name m-radio
|
|
8
|
+
* @docDescription Radio component.
|
|
9
|
+
* 单选组件。
|
|
10
|
+
* @docUrl https://shuimo.design/radio
|
|
11
|
+
*
|
|
12
|
+
* 江湖的业务千篇一律,复杂的代码好几百行。
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
export declare type RadioProps = {
|
|
16
|
+
/**
|
|
17
|
+
* @description radio label
|
|
18
|
+
* 单选框的标签值
|
|
19
|
+
* @type string | number
|
|
20
|
+
* @default ''
|
|
21
|
+
*/
|
|
22
|
+
label?: string | number,
|
|
23
|
+
/**
|
|
24
|
+
* @description radio name
|
|
25
|
+
* 单选框的name值
|
|
26
|
+
* @type string | undefined
|
|
27
|
+
* @default undefined
|
|
28
|
+
*/
|
|
29
|
+
name?: string,
|
|
30
|
+
/**
|
|
31
|
+
* @description radio checked
|
|
32
|
+
* 是否选中
|
|
33
|
+
* @default undefined
|
|
34
|
+
*/
|
|
35
|
+
checked?: boolean | undefined | null,
|
|
36
|
+
/**
|
|
37
|
+
* @description radio value
|
|
38
|
+
* 单选框的值
|
|
39
|
+
* @default undefined
|
|
40
|
+
*/
|
|
41
|
+
value?: string | number,
|
|
42
|
+
/**
|
|
43
|
+
* @description value
|
|
44
|
+
* 绑定值
|
|
45
|
+
* @type string | number | boolean
|
|
46
|
+
* @default ''
|
|
47
|
+
*/
|
|
48
|
+
modelValue?: string | number | boolean,
|
|
49
|
+
/**
|
|
50
|
+
* @description radio disabled
|
|
51
|
+
* 是否禁用
|
|
52
|
+
* @default false
|
|
53
|
+
*/
|
|
54
|
+
disabled?: boolean,
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export declare type RadioEvents = {
|
|
58
|
+
onClick?: (e: MouseEvent, value?: string | number) => void
|
|
59
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description radio hook
|
|
3
|
+
* @author 阿怪
|
|
4
|
+
* @date 2025/02/25 00:00
|
|
5
|
+
* @version v1.0.0
|
|
6
|
+
*
|
|
7
|
+
* 江湖的业务千篇一律,复杂的代码好几百行。
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export { initChecked, getNewModelValue } from '../../../compositions/input/useBooleanInput';
|
|
11
|
+
export const createRadioId = () => `m-radio-${Math.random().toString(36).substring(2)}`;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description rate api
|
|
3
|
+
* @author 阿怪
|
|
4
|
+
* @date 2026/2/26
|
|
5
|
+
* @version v1.0.0
|
|
6
|
+
*
|
|
7
|
+
* 江湖的业务千篇一律,复杂的代码好几百行。
|
|
8
|
+
*/
|
|
9
|
+
import { MCOPO } from '../../types/props';
|
|
10
|
+
import { RateProps } from './props';
|
|
11
|
+
|
|
12
|
+
export const props: MCOPO<RateProps> = {
|
|
13
|
+
modelValue: { type: Number, default: 0 },
|
|
14
|
+
count: { type: Number, default: 5 },
|
|
15
|
+
allowHalf: { type: Boolean, default: false },
|
|
16
|
+
readonly: { type: Boolean, default: false },
|
|
17
|
+
disabled: { type: Boolean, default: false },
|
|
18
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description rate core
|
|
3
|
+
* @author 阿怪
|
|
4
|
+
* @date 2026/2/26
|
|
5
|
+
* @version v1.0.0
|
|
6
|
+
*
|
|
7
|
+
* 江湖的业务千篇一律,复杂的代码好几百行。
|
|
8
|
+
*/
|
|
9
|
+
import { props } from './api';
|
|
10
|
+
import { useRate } from './useRate';
|
|
11
|
+
|
|
12
|
+
export const RateCore = {
|
|
13
|
+
props,
|
|
14
|
+
useRate,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type { RateProps } from './props';
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description rate props type
|
|
3
|
+
* @author 阿怪
|
|
4
|
+
* @date 2026/2/26
|
|
5
|
+
* @version v1.0.0
|
|
6
|
+
*
|
|
7
|
+
* @name k-rate
|
|
8
|
+
* @docDescription Rate(评分)组件。
|
|
9
|
+
*
|
|
10
|
+
* 江湖的业务千篇一律,复杂的代码好几百行。
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export declare type RateProps = {
|
|
14
|
+
/**
|
|
15
|
+
* @description 当前评分值(v-model)
|
|
16
|
+
* @type number
|
|
17
|
+
* @default 0
|
|
18
|
+
*/
|
|
19
|
+
modelValue?: number,
|
|
20
|
+
/**
|
|
21
|
+
* @description 星星总数
|
|
22
|
+
* @type number
|
|
23
|
+
* @default 5
|
|
24
|
+
*/
|
|
25
|
+
count?: number,
|
|
26
|
+
/**
|
|
27
|
+
* @description 是否允许半星
|
|
28
|
+
* @type boolean
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
allowHalf?: boolean,
|
|
32
|
+
/**
|
|
33
|
+
* @description 是否只读(仅展示,不可交互,不灰显)
|
|
34
|
+
* @type boolean
|
|
35
|
+
* @default false
|
|
36
|
+
*/
|
|
37
|
+
readonly?: boolean,
|
|
38
|
+
/**
|
|
39
|
+
* @description 是否禁用
|
|
40
|
+
* @type boolean
|
|
41
|
+
* @default false
|
|
42
|
+
*/
|
|
43
|
+
disabled?: boolean,
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export declare type RateEmits = {
|
|
47
|
+
'onUpdate:modelValue'?: (value: number) => void,
|
|
48
|
+
onChange?: (value: number) => void,
|
|
49
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description rate hook
|
|
3
|
+
* @author 阿怪
|
|
4
|
+
* @date 2026/2/26
|
|
5
|
+
* @version v1.0.0
|
|
6
|
+
*
|
|
7
|
+
* 江湖的业务千篇一律,复杂的代码好几百行。
|
|
8
|
+
*/
|
|
9
|
+
import { ref } from 'vue';
|
|
10
|
+
import { RateProps } from './props';
|
|
11
|
+
|
|
12
|
+
export function useRate(props: Required<RateProps>, emit: (...args: any[]) => void) {
|
|
13
|
+
// 悬停预览值,null 表示未悬停
|
|
14
|
+
const hoverValue = ref<number | null>(null);
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* 计算鼠标在星星内的位置,返回实际值(支持半星)
|
|
18
|
+
*/
|
|
19
|
+
const getValueFromEvent = (e: MouseEvent, index: number): number => {
|
|
20
|
+
if (!props.allowHalf) {
|
|
21
|
+
return index + 1;
|
|
22
|
+
}
|
|
23
|
+
const target = e.currentTarget as HTMLElement;
|
|
24
|
+
const { left, width } = target.getBoundingClientRect();
|
|
25
|
+
const isHalf = (e.clientX - left) / width <= 0.5;
|
|
26
|
+
return isHalf ? index + 0.5 : index + 1;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const onMouseEnter = (e: MouseEvent, index: number) => {
|
|
30
|
+
if (props.disabled || props.readonly) { return; }
|
|
31
|
+
hoverValue.value = getValueFromEvent(e, index);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const onMouseMove = (e: MouseEvent, index: number) => {
|
|
35
|
+
if (props.disabled || props.readonly) { return; }
|
|
36
|
+
hoverValue.value = getValueFromEvent(e, index);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const onMouseLeave = () => {
|
|
40
|
+
if (props.disabled || props.readonly) { return; }
|
|
41
|
+
hoverValue.value = null;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const onClick = (e: MouseEvent, index: number) => {
|
|
45
|
+
if (props.disabled || props.readonly) { return; }
|
|
46
|
+
const value = getValueFromEvent(e, index);
|
|
47
|
+
emit('update:modelValue', value);
|
|
48
|
+
emit('change', value);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* 计算第 index 颗星(0 起始)的填充状态
|
|
53
|
+
* @returns 'full' | 'half' | 'empty'
|
|
54
|
+
*/
|
|
55
|
+
const getStarState = (index: number): 'full' | 'half' | 'empty' => {
|
|
56
|
+
const current = hoverValue.value ?? props.modelValue;
|
|
57
|
+
const starValue = index + 1;
|
|
58
|
+
if (current >= starValue) {
|
|
59
|
+
return 'full';
|
|
60
|
+
}
|
|
61
|
+
if (props.allowHalf && current >= starValue - 0.5) {
|
|
62
|
+
return 'half';
|
|
63
|
+
}
|
|
64
|
+
return 'empty';
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
return {
|
|
68
|
+
hoverValue,
|
|
69
|
+
getStarState,
|
|
70
|
+
onMouseEnter,
|
|
71
|
+
onMouseMove,
|
|
72
|
+
onMouseLeave,
|
|
73
|
+
onClick,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description result 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 { ResultProps, ResultStatus } from './props';
|
|
11
|
+
|
|
12
|
+
export const props: MCOPO<ResultProps> = {
|
|
13
|
+
status: {
|
|
14
|
+
type: String as MPropType<ResultStatus>,
|
|
15
|
+
default: 'info',
|
|
16
|
+
enum: ['success', 'warning', 'error', 'info', '404'],
|
|
17
|
+
},
|
|
18
|
+
title: { type: String, default: '' },
|
|
19
|
+
subTitle: { type: String, default: '' },
|
|
20
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description result 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 ResultCore = {
|
|
12
|
+
props,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type { ResultProps, ResultStatus } from './props';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description result props type
|
|
3
|
+
* @author 阿怪
|
|
4
|
+
* @date 2026/2/26
|
|
5
|
+
* @version v1.0.0
|
|
6
|
+
*
|
|
7
|
+
* @name m-result
|
|
8
|
+
* @docDescription Result page component for displaying operation results.
|
|
9
|
+
* 结果页组件,用于展示操作结果或页面状态。
|
|
10
|
+
*
|
|
11
|
+
* 江湖的业务千篇一律,复杂的代码好几百行。
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
export declare type ResultStatus = 'success' | 'warning' | 'error' | 'info' | '404';
|
|
15
|
+
|
|
16
|
+
export declare type ResultProps = {
|
|
17
|
+
/**
|
|
18
|
+
* @description 结果状态,决定默认图标和配色
|
|
19
|
+
* @type string
|
|
20
|
+
* @default 'info'
|
|
21
|
+
* @enum success|warning|error|info|404
|
|
22
|
+
*/
|
|
23
|
+
status?: ResultStatus,
|
|
24
|
+
/**
|
|
25
|
+
* @description 主标题
|
|
26
|
+
* @type string
|
|
27
|
+
* @default ''
|
|
28
|
+
*/
|
|
29
|
+
title?: string,
|
|
30
|
+
/**
|
|
31
|
+
* @description 副标题
|
|
32
|
+
* @type string
|
|
33
|
+
* @default ''
|
|
34
|
+
*/
|
|
35
|
+
subTitle?: string,
|
|
36
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description select api
|
|
3
|
+
* @author 阿怪
|
|
4
|
+
* @date 2023/4/23 11:46
|
|
5
|
+
* @version v1.0.1
|
|
6
|
+
*
|
|
7
|
+
* 江湖的业务千篇一律,复杂的代码好几百行。
|
|
8
|
+
*
|
|
9
|
+
* v1.0.1 新增 filterable prop 阿怪 2026/2/27
|
|
10
|
+
*/
|
|
11
|
+
import { MCOPO, MPropType } from '../../types/props';
|
|
12
|
+
import { SelectProps } from './props';
|
|
13
|
+
|
|
14
|
+
export const props: MCOPO<SelectProps> = {
|
|
15
|
+
modelValue: { type: undefined, default: '' },
|
|
16
|
+
options: { type: Array, default: () => [] },
|
|
17
|
+
inputParam: { type: String, default: undefined },
|
|
18
|
+
optionParam: { type: String, default: undefined },
|
|
19
|
+
valueParam: { type: String, default: undefined },
|
|
20
|
+
readonly: { type: Boolean, default: true },
|
|
21
|
+
disabled: { type: Boolean, default: false },
|
|
22
|
+
placeholder: { type: String, default: '请选择...' },
|
|
23
|
+
toMatch: { type: Function as MPropType<(option: any, value: any) => boolean>, default: undefined },
|
|
24
|
+
multiple: { type: Boolean, default: false },
|
|
25
|
+
checkbox: { type: Boolean, default: true },
|
|
26
|
+
filterable: { type: Boolean, default: false },
|
|
27
|
+
filter: { type: Function as MPropType<(option: any, inputValue: string) => boolean>, default: undefined },
|
|
28
|
+
optionsH: { type: [Number, String], default: undefined },
|
|
29
|
+
needFetch: { type: Boolean, default: false },
|
|
30
|
+
fetch: { type: Function as MPropType<() => Promise<void>>, default: undefined },
|
|
31
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description select core 导出
|
|
3
|
+
* @author 阿怪
|
|
4
|
+
* @date 2026/2/25 14:50
|
|
5
|
+
* @version v2.0.0
|
|
6
|
+
*
|
|
7
|
+
* 江湖的业务千篇一律,复杂的代码好几百行。
|
|
8
|
+
*/
|
|
9
|
+
import { props } from './api';
|
|
10
|
+
import { useSelect } from './useSelect';
|
|
11
|
+
|
|
12
|
+
export const SelectCore = {
|
|
13
|
+
props,
|
|
14
|
+
useSelect,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type { SelectProps } from './props';
|
|
18
|
+
export type { SelectOptionItem } from './useSelect';
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description select api type
|
|
3
|
+
* @author 阿怪
|
|
4
|
+
* @date 2022/4/16 21:10
|
|
5
|
+
* @version v1.0.2
|
|
6
|
+
*
|
|
7
|
+
* @name m-select
|
|
8
|
+
* @docDescription Select component with shuimo-ui style.
|
|
9
|
+
* 水墨组件的选择组件。
|
|
10
|
+
* @docUrl https://shuimo.design/select
|
|
11
|
+
*
|
|
12
|
+
* 江湖的业务千篇一律,复杂的代码好几百行。
|
|
13
|
+
*
|
|
14
|
+
* v1.0.1 新增多选和filter配置 Jimmy
|
|
15
|
+
* v1.0.2 新增 filterable prop,支持内置搜索过滤 阿怪
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
export declare type SelectProps = {
|
|
19
|
+
/**
|
|
20
|
+
* @description select value
|
|
21
|
+
* 选择框的值
|
|
22
|
+
* @type any | any[]
|
|
23
|
+
* @default ''
|
|
24
|
+
*/
|
|
25
|
+
modelValue?: any | any[],
|
|
26
|
+
/**
|
|
27
|
+
* @description select options
|
|
28
|
+
* 选择框的数组
|
|
29
|
+
* @type any[]
|
|
30
|
+
* @default []
|
|
31
|
+
*/
|
|
32
|
+
options?: Array<any>,
|
|
33
|
+
/**
|
|
34
|
+
* @description support for which key value to display in 'input'
|
|
35
|
+
* 选择后使用option中的哪个key的值去更新modelValue
|
|
36
|
+
* @type string
|
|
37
|
+
* @default undefined
|
|
38
|
+
*/
|
|
39
|
+
inputParam?: string,
|
|
40
|
+
/**
|
|
41
|
+
* @description select dropdown display info key
|
|
42
|
+
* 选择下拉框中显示内容的key
|
|
43
|
+
* @type string
|
|
44
|
+
* @default undefined
|
|
45
|
+
*/
|
|
46
|
+
optionParam?: string,
|
|
47
|
+
/**
|
|
48
|
+
* @description modelValue's key
|
|
49
|
+
* 参数的key
|
|
50
|
+
* @type string
|
|
51
|
+
* @default undefined
|
|
52
|
+
*/
|
|
53
|
+
valueParam?: string,
|
|
54
|
+
/**
|
|
55
|
+
* @description used to disable input event
|
|
56
|
+
* 用于禁止输入事件
|
|
57
|
+
* @type boolean
|
|
58
|
+
* @default true
|
|
59
|
+
*/
|
|
60
|
+
readonly?: boolean,
|
|
61
|
+
/**
|
|
62
|
+
* @description used to disable select
|
|
63
|
+
* 是否禁用
|
|
64
|
+
* @type boolean
|
|
65
|
+
* @default false
|
|
66
|
+
*/
|
|
67
|
+
disabled?: boolean,
|
|
68
|
+
/**
|
|
69
|
+
* @description input placeholder. 提示语
|
|
70
|
+
* @type string
|
|
71
|
+
* @default '请选择...'
|
|
72
|
+
*/
|
|
73
|
+
placeholder?: string,
|
|
74
|
+
/**
|
|
75
|
+
* @description modelValue match function
|
|
76
|
+
* 用于比较参数和modelValue是否相等的方法,常用于modelValue为对象的场景
|
|
77
|
+
* option: 列表数据
|
|
78
|
+
* value: modelValue
|
|
79
|
+
* @type function
|
|
80
|
+
* @default undefined
|
|
81
|
+
*/
|
|
82
|
+
toMatch?: (option: any, value: any) => boolean,
|
|
83
|
+
/**
|
|
84
|
+
* @description multiple choice
|
|
85
|
+
* 是否为多选
|
|
86
|
+
* @type boolean
|
|
87
|
+
* @default false
|
|
88
|
+
*/
|
|
89
|
+
multiple?: boolean,
|
|
90
|
+
/**
|
|
91
|
+
* @description in multiple, whether to show checkbox
|
|
92
|
+
* 多选模式下是否启用checkbox
|
|
93
|
+
* @type boolean
|
|
94
|
+
* @default true
|
|
95
|
+
*/
|
|
96
|
+
checkbox?: boolean,
|
|
97
|
+
/**
|
|
98
|
+
* @description whether to enable built-in search filtering
|
|
99
|
+
* 是否开启内置搜索过滤,开启后输入框变为可编辑状态
|
|
100
|
+
* @type boolean
|
|
101
|
+
* @default false
|
|
102
|
+
*/
|
|
103
|
+
filterable?: boolean,
|
|
104
|
+
/**
|
|
105
|
+
* @description defined input box filter query method
|
|
106
|
+
* 自定义输入框filter查询方法,filterable 为 true 时生效;未传则使用默认标签匹配
|
|
107
|
+
* @type function (options:any, inputValue: string) =>boolean
|
|
108
|
+
* @default undefined
|
|
109
|
+
*/
|
|
110
|
+
filter?: (options: any, inputValue: string) => boolean,
|
|
111
|
+
/**
|
|
112
|
+
* @description The height of the options dom
|
|
113
|
+
* 下拉框的高度
|
|
114
|
+
* @type number | string
|
|
115
|
+
* @default undefined
|
|
116
|
+
*/
|
|
117
|
+
optionsH?: number | string,
|
|
118
|
+
/**
|
|
119
|
+
* @description Whether to fetch
|
|
120
|
+
* 是否fetch
|
|
121
|
+
* @type boolean
|
|
122
|
+
* @default false
|
|
123
|
+
*/
|
|
124
|
+
needFetch?: boolean,
|
|
125
|
+
/**
|
|
126
|
+
* @description beta version autoComplete fetch func, should return an end flag
|
|
127
|
+
* beta版本的自动补全,需要返回一个是否停止标志
|
|
128
|
+
* @type Function
|
|
129
|
+
* @default undefined
|
|
130
|
+
*/
|
|
131
|
+
fetch?: () => Promise<void>
|
|
132
|
+
};
|