miao-design 1.0.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/README.md +76 -0
- package/dist/alert/Alert.vue.d.ts +27 -0
- package/dist/alert/index.d.ts +2 -0
- package/dist/alert/types.d.ts +20 -0
- package/dist/avatar/Avatar.vue.d.ts +18 -0
- package/dist/avatar/index.d.ts +2 -0
- package/dist/avatar/types.d.ts +19 -0
- package/dist/button/Button.vue.d.ts +26 -0
- package/dist/button/index.d.ts +2 -0
- package/dist/button/types.d.ts +21 -0
- package/dist/button-group/ButtonGroup.vue.d.ts +17 -0
- package/dist/button-group/context.d.ts +14 -0
- package/dist/button-group/index.d.ts +2 -0
- package/dist/button-group/types.d.ts +16 -0
- package/dist/checkbox/Checkbox.vue.d.ts +23 -0
- package/dist/checkbox/CheckboxGroup.vue.d.ts +23 -0
- package/dist/checkbox/context.d.ts +15 -0
- package/dist/checkbox/index.d.ts +3 -0
- package/dist/checkbox/types.d.ts +35 -0
- package/dist/date-picker/DatePicker.vue.d.ts +21 -0
- package/dist/date-picker/TimeSpinner.vue.d.ts +18 -0
- package/dist/date-picker/date-utils.d.ts +15 -0
- package/dist/date-picker/index.d.ts +3 -0
- package/dist/date-picker/types.d.ts +31 -0
- package/dist/date-range-picker/DateRangePicker.vue.d.ts +22 -0
- package/dist/date-range-picker/index.d.ts +2 -0
- package/dist/date-range-picker/types.d.ts +35 -0
- package/dist/dialog/Dialog.vue.d.ts +36 -0
- package/dist/dialog/index.d.ts +2 -0
- package/dist/dialog/types.d.ts +30 -0
- package/dist/directives/ripple.d.ts +58 -0
- package/dist/drawer/Drawer.vue.d.ts +35 -0
- package/dist/drawer/index.d.ts +2 -0
- package/dist/drawer/types.d.ts +26 -0
- package/dist/dropdown/Dropdown.vue.d.ts +32 -0
- package/dist/dropdown/DropdownItem.vue.d.ts +21 -0
- package/dist/dropdown/context.d.ts +13 -0
- package/dist/dropdown/index.d.ts +3 -0
- package/dist/dropdown/types.d.ts +45 -0
- package/dist/fab/Fab.vue.d.ts +26 -0
- package/dist/fab/index.d.ts +2 -0
- package/dist/fab/types.d.ts +21 -0
- package/dist/index.d.ts +27 -0
- package/dist/input/Input.vue.d.ts +34 -0
- package/dist/input/index.d.ts +2 -0
- package/dist/input/types.d.ts +24 -0
- package/dist/input-number/InputNumber.vue.d.ts +23 -0
- package/dist/input-number/index.d.ts +2 -0
- package/dist/input-number/types.d.ts +29 -0
- package/dist/miao-design.css +2 -0
- package/dist/miao-design.js +4103 -0
- package/dist/miao-design.umd.cjs +1 -0
- package/dist/radio/Radio.vue.d.ts +22 -0
- package/dist/radio/RadioGroup.vue.d.ts +23 -0
- package/dist/radio/context.d.ts +17 -0
- package/dist/radio/index.d.ts +3 -0
- package/dist/radio/types.d.ts +34 -0
- package/dist/select/Select.vue.d.ts +16 -0
- package/dist/select/index.d.ts +2 -0
- package/dist/select/types.d.ts +27 -0
- package/dist/slider/Slider.vue.d.ts +18 -0
- package/dist/slider/index.d.ts +2 -0
- package/dist/slider/types.d.ts +23 -0
- package/dist/switch/Switch.vue.d.ts +25 -0
- package/dist/switch/index.d.ts +2 -0
- package/dist/switch/types.d.ts +20 -0
- package/dist/tabs/TabPane.vue.d.ts +16 -0
- package/dist/tabs/Tabs.vue.d.ts +30 -0
- package/dist/tabs/context.d.ts +33 -0
- package/dist/tabs/index.d.ts +3 -0
- package/dist/tabs/types.d.ts +39 -0
- package/dist/toast/MToast.vue.d.ts +26 -0
- package/dist/toast/ToastCard.vue.d.ts +11 -0
- package/dist/toast/ToastContainer.vue.d.ts +3 -0
- package/dist/toast/index.d.ts +5 -0
- package/dist/toast/service.d.ts +15 -0
- package/dist/toast/state.d.ts +6 -0
- package/dist/toast/types.d.ts +46 -0
- package/dist/tooltip/Tooltip.vue.d.ts +32 -0
- package/dist/tooltip/index.d.ts +2 -0
- package/dist/tooltip/types.d.ts +30 -0
- package/dist/utils/scroll-lock.d.ts +2 -0
- package/dist/utils/throttle.d.ts +2 -0
- package/package.json +35 -0
package/README.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Miao UI Vue
|
|
2
|
+
|
|
3
|
+
基于 Vue 3 + TypeScript 的轻量级组件库。
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add miao-design
|
|
9
|
+
# 或
|
|
10
|
+
npm install miao-design
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
> `vue@^3.5` 作为 peerDependency,由使用方自行安装。
|
|
14
|
+
|
|
15
|
+
## 使用
|
|
16
|
+
|
|
17
|
+
### 完整引入
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { createApp } from 'vue'
|
|
21
|
+
import MiaoUI from 'miao-design'
|
|
22
|
+
import 'miao-design/style.css'
|
|
23
|
+
|
|
24
|
+
createApp(App).use(MiaoUI).mount('#app')
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### 按需引入
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import { MButton } from 'miao-design'
|
|
31
|
+
import 'miao-design/style.css'
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
组件通过 `use()` 注册后自动完成全局注册;按需使用时在模板中直接引用组件即可。
|
|
35
|
+
|
|
36
|
+
### 指令
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
import { vRipple } from 'miao-design'
|
|
40
|
+
|
|
41
|
+
// 任意元素上使用 v-ripple
|
|
42
|
+
app.directive('ripple', vRipple)
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### 编程式 Toast
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
import { toast } from 'miao-design'
|
|
49
|
+
|
|
50
|
+
toast.success('操作成功')
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## 组件列表
|
|
54
|
+
|
|
55
|
+
| 组件 | 说明 |
|
|
56
|
+
| --- | --- |
|
|
57
|
+
| `MAlert` | 警告提示 |
|
|
58
|
+
| `MAvatar` | 头像 |
|
|
59
|
+
| `MButton` / `MButtonGroup` | 按钮 / 按钮组 |
|
|
60
|
+
| `MCheckbox` / `MCheckboxGroup` | 复选框 / 复选框组 |
|
|
61
|
+
| `MDatePicker` / `MDateRangePicker` | 日期选择器 / 日期范围选择器 |
|
|
62
|
+
| `MDialog` / `MDrawer` | 对话框 / 抽屉 |
|
|
63
|
+
| `MDropdown` / `MDropdownItem` | 下拉菜单 / 菜单项 |
|
|
64
|
+
| `MFab` | 悬浮按钮 |
|
|
65
|
+
| `MInput` / `MInputNumber` | 输入框 / 数字输入框 |
|
|
66
|
+
| `MRadio` / `MRadioGroup` | 单选框 / 单选框组 |
|
|
67
|
+
| `MSelect` | 选择器 |
|
|
68
|
+
| `MSlider` | 滑块 |
|
|
69
|
+
| `MSwitch` | 开关 |
|
|
70
|
+
| `MTabs` / `MTabPane` | 标签页 / 标签面板 |
|
|
71
|
+
| `MToast` | 轻提示 |
|
|
72
|
+
| `MTooltip` | 文字提示 |
|
|
73
|
+
|
|
74
|
+
## License
|
|
75
|
+
|
|
76
|
+
MIT
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { AlertSeverity, MAlertProps } from './types';
|
|
2
|
+
declare var __VLS_7: {}, __VLS_9: {}, __VLS_11: {};
|
|
3
|
+
type __VLS_Slots = {} & {
|
|
4
|
+
icon?: (props: typeof __VLS_7) => any;
|
|
5
|
+
} & {
|
|
6
|
+
title?: (props: typeof __VLS_9) => any;
|
|
7
|
+
} & {
|
|
8
|
+
default?: (props: typeof __VLS_11) => any;
|
|
9
|
+
};
|
|
10
|
+
declare const __VLS_base: import('vue').DefineComponent<MAlertProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
11
|
+
close: () => any;
|
|
12
|
+
}, string, import('vue').PublicProps, Readonly<MAlertProps> & Readonly<{
|
|
13
|
+
onClose?: (() => any) | undefined;
|
|
14
|
+
}>, {
|
|
15
|
+
severity: AlertSeverity;
|
|
16
|
+
variant: import('./types').AlertVariant;
|
|
17
|
+
closable: boolean;
|
|
18
|
+
showIcon: boolean;
|
|
19
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
20
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
21
|
+
declare const _default: typeof __VLS_export;
|
|
22
|
+
export default _default;
|
|
23
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
24
|
+
new (): {
|
|
25
|
+
$slots: S;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type AlertSeverity = 'success' | 'info' | 'warning' | 'error';
|
|
2
|
+
export type AlertVariant = 'standard' | 'filled' | 'outlined';
|
|
3
|
+
export interface MAlertProps {
|
|
4
|
+
/** 语义类型:决定图标与配色 */
|
|
5
|
+
severity?: AlertSeverity;
|
|
6
|
+
/** 外观变体:浅底 / 实底 / 描边 */
|
|
7
|
+
variant?: AlertVariant;
|
|
8
|
+
/** 显示右上角关闭按钮(关闭后组件进入离场动画) */
|
|
9
|
+
closable?: boolean;
|
|
10
|
+
/** 显示语义图标(默认 true;自定义 #icon 插槽时自动隐藏内置图标) */
|
|
11
|
+
showIcon?: boolean;
|
|
12
|
+
/** 标题文本(也可用 #title 插槽) */
|
|
13
|
+
title?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const MAlertPropsDefault: {
|
|
16
|
+
readonly severity: "info";
|
|
17
|
+
readonly variant: "standard";
|
|
18
|
+
readonly closable: false;
|
|
19
|
+
readonly showIcon: true;
|
|
20
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { MAvatarProps } from './types';
|
|
2
|
+
declare var __VLS_1: {};
|
|
3
|
+
type __VLS_Slots = {} & {
|
|
4
|
+
default?: (props: typeof __VLS_1) => any;
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_base: import('vue').DefineComponent<MAvatarProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<MAvatarProps> & Readonly<{}>, {
|
|
7
|
+
size: import('./types').AvatarSize;
|
|
8
|
+
shape: import('./types').AvatarShape;
|
|
9
|
+
color: import('./types').AvatarColor;
|
|
10
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
11
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
12
|
+
declare const _default: typeof __VLS_export;
|
|
13
|
+
export default _default;
|
|
14
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
15
|
+
new (): {
|
|
16
|
+
$slots: S;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type AvatarSize = number | 'small' | 'default' | 'large';
|
|
2
|
+
export type AvatarShape = 'circle' | 'square' | 'rounded';
|
|
3
|
+
export type AvatarColor = 'primary' | 'secondary' | 'success' | 'warning' | 'error' | 'info';
|
|
4
|
+
export interface MAvatarProps {
|
|
5
|
+
/** 图片地址(加载失败自动回退到默认插槽 / 首字符 / 人形占位) */
|
|
6
|
+
src?: string;
|
|
7
|
+
/** 图片 alt;无图片时作为首字符占位来源 */
|
|
8
|
+
alt?: string;
|
|
9
|
+
/** 数字按 px 处理;'small' | 'default' | 'large' 使用预设尺寸 */
|
|
10
|
+
size?: AvatarSize;
|
|
11
|
+
shape?: AvatarShape;
|
|
12
|
+
/** 文本 / 图标占位背景色(图片模式忽略) */
|
|
13
|
+
color?: AvatarColor;
|
|
14
|
+
}
|
|
15
|
+
export declare const MAvatarPropsDefault: {
|
|
16
|
+
readonly size: 40;
|
|
17
|
+
readonly shape: "circle";
|
|
18
|
+
readonly color: "primary";
|
|
19
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { MButtonProps } from './types';
|
|
2
|
+
declare var __VLS_1: {};
|
|
3
|
+
type __VLS_Slots = {} & {
|
|
4
|
+
default?: (props: typeof __VLS_1) => any;
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_base: import('vue').DefineComponent<MButtonProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
7
|
+
click: (event: MouseEvent) => any;
|
|
8
|
+
}, string, import('vue').PublicProps, Readonly<MButtonProps> & Readonly<{
|
|
9
|
+
onClick?: ((event: MouseEvent) => any) | undefined;
|
|
10
|
+
}>, {
|
|
11
|
+
variant: import('./types').ButtonVariant;
|
|
12
|
+
type: "button" | "submit" | "reset";
|
|
13
|
+
size: "small" | "default" | "large";
|
|
14
|
+
shape: "round" | "circle" | "";
|
|
15
|
+
disabled: boolean;
|
|
16
|
+
loading: boolean;
|
|
17
|
+
throttle: number;
|
|
18
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
19
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
20
|
+
declare const _default: typeof __VLS_export;
|
|
21
|
+
export default _default;
|
|
22
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
23
|
+
new (): {
|
|
24
|
+
$slots: S;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type ButtonColor = 'primary' | 'secondary' | 'error' | 'success' | 'warning' | 'info';
|
|
2
|
+
export type ButtonVariant = 'text' | 'outlined' | 'contained';
|
|
3
|
+
export interface MButtonProps {
|
|
4
|
+
color?: ButtonColor;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
variant?: ButtonVariant;
|
|
7
|
+
loading?: boolean;
|
|
8
|
+
type?: 'button' | 'submit' | 'reset';
|
|
9
|
+
size?: 'small' | 'default' | 'large';
|
|
10
|
+
throttle?: number;
|
|
11
|
+
shape?: 'round' | 'circle' | '';
|
|
12
|
+
}
|
|
13
|
+
export declare const MButtonPropsDefault: {
|
|
14
|
+
readonly type: "button";
|
|
15
|
+
readonly disabled: false;
|
|
16
|
+
readonly loading: false;
|
|
17
|
+
readonly size: "default";
|
|
18
|
+
readonly variant: "text";
|
|
19
|
+
readonly throttle: 200;
|
|
20
|
+
readonly shape: "";
|
|
21
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { MButtonGroupProps } from './types';
|
|
2
|
+
declare var __VLS_1: {};
|
|
3
|
+
type __VLS_Slots = {} & {
|
|
4
|
+
default?: (props: typeof __VLS_1) => any;
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_base: import('vue').DefineComponent<MButtonGroupProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<MButtonGroupProps> & Readonly<{}>, {
|
|
7
|
+
variant: import('..').ButtonVariant;
|
|
8
|
+
disabled: boolean;
|
|
9
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
10
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
11
|
+
declare const _default: typeof __VLS_export;
|
|
12
|
+
export default _default;
|
|
13
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
14
|
+
new (): {
|
|
15
|
+
$slots: S;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { InjectionKey } from 'vue';
|
|
2
|
+
import { ButtonColor, ButtonVariant } from '../button/types';
|
|
3
|
+
/**
|
|
4
|
+
* MButtonGroup 通过 provide 向子 MButton 暴露统一配置:
|
|
5
|
+
* 组内按钮的变体 / 尺寸 / 颜色 / 禁用状态由此统一下发,
|
|
6
|
+
* MButton 读取后覆盖自身的默认渲染。
|
|
7
|
+
*/
|
|
8
|
+
export interface ButtonGroupContext {
|
|
9
|
+
color?: ButtonColor;
|
|
10
|
+
variant: ButtonVariant;
|
|
11
|
+
size: 'small' | 'default' | 'large';
|
|
12
|
+
disabled: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare const buttonGroupContextKey: InjectionKey<ButtonGroupContext>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ButtonColor, ButtonVariant } from '../button/types';
|
|
2
|
+
import { InputSize } from '../input/types';
|
|
3
|
+
export interface MButtonGroupProps {
|
|
4
|
+
/** 组内按钮统一变体(默认 outlined,对齐 MUI ButtonGroup) */
|
|
5
|
+
variant?: ButtonVariant;
|
|
6
|
+
/** 组内按钮统一语义色(未传时各按钮保持自身颜色,默认主色) */
|
|
7
|
+
color?: ButtonColor;
|
|
8
|
+
/** 组内按钮统一尺寸 */
|
|
9
|
+
size?: InputSize;
|
|
10
|
+
/** 是否整体禁用组内所有按钮 */
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare const MButtonGroupPropsDefault: {
|
|
14
|
+
readonly variant: "outlined";
|
|
15
|
+
readonly disabled: false;
|
|
16
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { MCheckboxProps } from './types';
|
|
2
|
+
declare var __VLS_1: {};
|
|
3
|
+
type __VLS_Slots = {} & {
|
|
4
|
+
default?: (props: typeof __VLS_1) => any;
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_base: import('vue').DefineComponent<MCheckboxProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
7
|
+
change: (value: boolean) => any;
|
|
8
|
+
"update:modelValue": (value: boolean) => any;
|
|
9
|
+
}, string, import('vue').PublicProps, Readonly<MCheckboxProps> & Readonly<{
|
|
10
|
+
onChange?: ((value: boolean) => any) | undefined;
|
|
11
|
+
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
12
|
+
}>, {
|
|
13
|
+
disabled: boolean;
|
|
14
|
+
indeterminate: boolean;
|
|
15
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
16
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
17
|
+
declare const _default: typeof __VLS_export;
|
|
18
|
+
export default _default;
|
|
19
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
20
|
+
new (): {
|
|
21
|
+
$slots: S;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { MCheckboxGroupProps, CheckboxValue } from './types';
|
|
2
|
+
declare var __VLS_1: {};
|
|
3
|
+
type __VLS_Slots = {} & {
|
|
4
|
+
default?: (props: typeof __VLS_1) => any;
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_base: import('vue').DefineComponent<MCheckboxGroupProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
7
|
+
change: (value: CheckboxValue[]) => any;
|
|
8
|
+
"update:modelValue": (value: CheckboxValue[]) => any;
|
|
9
|
+
}, string, import('vue').PublicProps, Readonly<MCheckboxGroupProps> & Readonly<{
|
|
10
|
+
onChange?: ((value: CheckboxValue[]) => any) | undefined;
|
|
11
|
+
"onUpdate:modelValue"?: ((value: CheckboxValue[]) => any) | undefined;
|
|
12
|
+
}>, {
|
|
13
|
+
disabled: boolean;
|
|
14
|
+
vertical: boolean;
|
|
15
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
16
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
17
|
+
declare const _default: typeof __VLS_export;
|
|
18
|
+
export default _default;
|
|
19
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
20
|
+
new (): {
|
|
21
|
+
$slots: S;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { InjectionKey, Ref } from 'vue';
|
|
2
|
+
import { CheckboxColor, CheckboxSize, CheckboxValue } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* MCheckboxGroup 通过 provide 向子 MCheckbox 下发选中数组与更新回调,
|
|
5
|
+
* 使组内 Checkbox 维护统一的选中值集合。
|
|
6
|
+
*/
|
|
7
|
+
export interface CheckboxGroupContext {
|
|
8
|
+
modelValue: Ref<CheckboxValue[]>;
|
|
9
|
+
color: CheckboxColor;
|
|
10
|
+
size: CheckboxSize;
|
|
11
|
+
disabled: boolean;
|
|
12
|
+
/** 勾选 / 取消勾选:更新组选中数组 */
|
|
13
|
+
toggleValue: (value: CheckboxValue, checked: boolean) => void;
|
|
14
|
+
}
|
|
15
|
+
export declare const checkboxGroupContextKey: InjectionKey<CheckboxGroupContext>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export type CheckboxColor = 'primary' | 'secondary' | 'success' | 'warning' | 'error' | 'info';
|
|
2
|
+
export type CheckboxSize = 'small' | 'default' | 'large';
|
|
3
|
+
export type CheckboxValue = string | number | boolean;
|
|
4
|
+
export interface MCheckboxProps {
|
|
5
|
+
/** 组内项值:在 MCheckboxGroup 内用于维护选中数组 */
|
|
6
|
+
value?: CheckboxValue;
|
|
7
|
+
/** 独立使用时的选中状态(v-model,boolean);组内忽略此值 */
|
|
8
|
+
modelValue?: boolean;
|
|
9
|
+
/** 半选状态:勾选角标显示为横线(通常用于「全选」联动) */
|
|
10
|
+
indeterminate?: boolean;
|
|
11
|
+
/** 原生 input name */
|
|
12
|
+
name?: string;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
/** 选中态颜色(未显式设置时继承 MCheckboxGroup) */
|
|
15
|
+
color?: CheckboxColor;
|
|
16
|
+
/** 尺寸(未显式设置时继承 MCheckboxGroup) */
|
|
17
|
+
size?: CheckboxSize;
|
|
18
|
+
}
|
|
19
|
+
export interface MCheckboxGroupProps {
|
|
20
|
+
/** 选中值数组(v-model) */
|
|
21
|
+
modelValue?: CheckboxValue[];
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
color?: CheckboxColor;
|
|
24
|
+
size?: CheckboxSize;
|
|
25
|
+
/** 纵向排列 */
|
|
26
|
+
vertical?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export declare const MCheckboxPropsDefault: {
|
|
29
|
+
readonly disabled: false;
|
|
30
|
+
readonly indeterminate: false;
|
|
31
|
+
};
|
|
32
|
+
export declare const MCheckboxGroupPropsDefault: {
|
|
33
|
+
readonly disabled: false;
|
|
34
|
+
readonly vertical: false;
|
|
35
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { MDatePickerProps } from './types';
|
|
2
|
+
declare const __VLS_export: import('vue').DefineComponent<MDatePickerProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
3
|
+
close: () => any;
|
|
4
|
+
change: (value: string) => any;
|
|
5
|
+
"update:modelValue": (value: string) => any;
|
|
6
|
+
open: () => any;
|
|
7
|
+
}, string, import('vue').PublicProps, Readonly<MDatePickerProps> & Readonly<{
|
|
8
|
+
onClose?: (() => any) | undefined;
|
|
9
|
+
onChange?: ((value: string) => any) | undefined;
|
|
10
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
11
|
+
onOpen?: (() => any) | undefined;
|
|
12
|
+
}>, {
|
|
13
|
+
size: import('./types').DatePickerSize;
|
|
14
|
+
disabled: boolean;
|
|
15
|
+
format: string;
|
|
16
|
+
clearable: boolean;
|
|
17
|
+
appendToBody: boolean;
|
|
18
|
+
popupPlacement: "top" | "bottom";
|
|
19
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
20
|
+
declare const _default: typeof __VLS_export;
|
|
21
|
+
export default _default;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
hour: number;
|
|
3
|
+
minute: number;
|
|
4
|
+
second: number;
|
|
5
|
+
/** 无值时置灰不可操作 */
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
};
|
|
8
|
+
declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
9
|
+
"update:hour": (value: number) => any;
|
|
10
|
+
"update:minute": (value: number) => any;
|
|
11
|
+
"update:second": (value: number) => any;
|
|
12
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
13
|
+
"onUpdate:hour"?: ((value: number) => any) | undefined;
|
|
14
|
+
"onUpdate:minute"?: ((value: number) => any) | undefined;
|
|
15
|
+
"onUpdate:second"?: ((value: number) => any) | undefined;
|
|
16
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
17
|
+
declare const _default: typeof __VLS_export;
|
|
18
|
+
export default _default;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** 日期工具:解析 / 格式化 / 月历生成,全部基于本地时区 */
|
|
2
|
+
export declare function pad(n: number): string;
|
|
3
|
+
/** 按格式模板输出日期字符串,支持 YYYY / MM / DD / HH / mm / ss */
|
|
4
|
+
export declare function formatDate(date: Date, format: string): string;
|
|
5
|
+
/** 解析 Date 或字符串(优先匹配 YYYY-MM-DD[ HH:mm[:ss]] 前缀,其次交给 Date 构造器) */
|
|
6
|
+
export declare function parseDate(value: Date | string | null | undefined): Date | null;
|
|
7
|
+
export declare function startOfDay(d: Date): Date;
|
|
8
|
+
export declare function isSameDay(a: Date, b: Date): boolean;
|
|
9
|
+
export declare function isSameMonth(a: Date, b: Date): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* 生成 6 周 × 7 天 = 42 格的月历格子(含前后月补位),
|
|
12
|
+
* 以视图月 1 号所在周(周日为一周起点)为起始。
|
|
13
|
+
*/
|
|
14
|
+
export declare function buildMonthDays(viewDate: Date): Date[];
|
|
15
|
+
export declare const WEEKDAY_LABELS: string[];
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export type DatePickerSize = 'small' | 'default' | 'large';
|
|
2
|
+
export interface MDatePickerProps {
|
|
3
|
+
/** 当前值(v-model):Date 或可解析字符串,输出始终为 format 格式字符串 */
|
|
4
|
+
modelValue?: Date | string | null;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
/** 输出格式模板(默认 YYYY-MM-DD) */
|
|
7
|
+
format?: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
/** 有值时显示清除按钮 */
|
|
10
|
+
clearable?: boolean;
|
|
11
|
+
size?: DatePickerSize;
|
|
12
|
+
/** 可选最小日期 */
|
|
13
|
+
min?: Date | string;
|
|
14
|
+
/** 可选最大日期 */
|
|
15
|
+
max?: Date | string;
|
|
16
|
+
/** 挂载到 body(默认开启) */
|
|
17
|
+
appendToBody?: boolean;
|
|
18
|
+
/** 弹出方向(空间不足时自动翻转) */
|
|
19
|
+
popupPlacement?: 'top' | 'bottom';
|
|
20
|
+
width?: string;
|
|
21
|
+
/** 原生 input name(表单提交) */
|
|
22
|
+
name?: string;
|
|
23
|
+
}
|
|
24
|
+
export declare const MDatePickerPropsDefault: {
|
|
25
|
+
readonly format: "YYYY-MM-DD";
|
|
26
|
+
readonly disabled: false;
|
|
27
|
+
readonly clearable: false;
|
|
28
|
+
readonly size: "default";
|
|
29
|
+
readonly appendToBody: true;
|
|
30
|
+
readonly popupPlacement: "bottom";
|
|
31
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { MDateRangePickerProps } from './types';
|
|
2
|
+
declare const __VLS_export: import('vue').DefineComponent<MDateRangePickerProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
3
|
+
close: () => any;
|
|
4
|
+
change: (value: [string | null, string | null] | null) => any;
|
|
5
|
+
"update:modelValue": (value: [string | null, string | null] | null) => any;
|
|
6
|
+
open: () => any;
|
|
7
|
+
}, string, import('vue').PublicProps, Readonly<MDateRangePickerProps> & Readonly<{
|
|
8
|
+
onClose?: (() => any) | undefined;
|
|
9
|
+
onChange?: ((value: [string | null, string | null] | null) => any) | undefined;
|
|
10
|
+
"onUpdate:modelValue"?: ((value: [string | null, string | null] | null) => any) | undefined;
|
|
11
|
+
onOpen?: (() => any) | undefined;
|
|
12
|
+
}>, {
|
|
13
|
+
size: import('..').DatePickerSize;
|
|
14
|
+
disabled: boolean;
|
|
15
|
+
placeholder: string | [string, string];
|
|
16
|
+
format: string;
|
|
17
|
+
clearable: boolean;
|
|
18
|
+
appendToBody: boolean;
|
|
19
|
+
popupPlacement: "top" | "bottom";
|
|
20
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
21
|
+
declare const _default: typeof __VLS_export;
|
|
22
|
+
export default _default;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { DatePickerSize } from '../date-picker/types';
|
|
2
|
+
/** 范围值:[开始, 结束],元素为 Date 或可解析字符串,输出均为 format 格式字符串 */
|
|
3
|
+
export type DateRangeValue = [Date | string | null, Date | string | null] | null;
|
|
4
|
+
export interface MDateRangePickerProps {
|
|
5
|
+
/** 当前值(v-model):[开始, 结束] */
|
|
6
|
+
modelValue?: DateRangeValue;
|
|
7
|
+
/** 占位符:单个字符串同时用于两格,数组则分别用于开始 / 结束 */
|
|
8
|
+
placeholder?: string | [string, string];
|
|
9
|
+
/** 输出格式模板(默认 YYYY-MM-DD) */
|
|
10
|
+
format?: string;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
/** 有值时显示清除按钮 */
|
|
13
|
+
clearable?: boolean;
|
|
14
|
+
size?: DatePickerSize;
|
|
15
|
+
/** 可选最小日期 */
|
|
16
|
+
min?: Date | string;
|
|
17
|
+
/** 可选最大日期 */
|
|
18
|
+
max?: Date | string;
|
|
19
|
+
/** 挂载到 body(默认开启) */
|
|
20
|
+
appendToBody?: boolean;
|
|
21
|
+
/** 弹出方向(空间不足时自动翻转) */
|
|
22
|
+
popupPlacement?: 'top' | 'bottom';
|
|
23
|
+
width?: string;
|
|
24
|
+
/** 原生 input name(表单提交) */
|
|
25
|
+
name?: string;
|
|
26
|
+
}
|
|
27
|
+
export declare const MDateRangePickerPropsDefault: {
|
|
28
|
+
readonly placeholder: "开始日期 ~ 结束日期";
|
|
29
|
+
readonly format: "YYYY-MM-DD";
|
|
30
|
+
readonly disabled: false;
|
|
31
|
+
readonly clearable: false;
|
|
32
|
+
readonly size: "default";
|
|
33
|
+
readonly appendToBody: true;
|
|
34
|
+
readonly popupPlacement: "bottom";
|
|
35
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { MDialogProps } from './types';
|
|
2
|
+
declare var __VLS_1: {}, __VLS_18: {}, __VLS_20: {}, __VLS_22: {};
|
|
3
|
+
type __VLS_Slots = {} & {
|
|
4
|
+
trigger?: (props: typeof __VLS_1) => any;
|
|
5
|
+
} & {
|
|
6
|
+
title?: (props: typeof __VLS_18) => any;
|
|
7
|
+
} & {
|
|
8
|
+
default?: (props: typeof __VLS_20) => any;
|
|
9
|
+
} & {
|
|
10
|
+
footer?: (props: typeof __VLS_22) => any;
|
|
11
|
+
};
|
|
12
|
+
declare const __VLS_base: import('vue').DefineComponent<MDialogProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
13
|
+
close: () => any;
|
|
14
|
+
"update:modelValue": (value: boolean) => any;
|
|
15
|
+
open: () => any;
|
|
16
|
+
}, string, import('vue').PublicProps, Readonly<MDialogProps> & Readonly<{
|
|
17
|
+
onClose?: (() => any) | undefined;
|
|
18
|
+
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
19
|
+
onOpen?: (() => any) | undefined;
|
|
20
|
+
}>, {
|
|
21
|
+
anchor: HTMLElement | null;
|
|
22
|
+
width: string | number;
|
|
23
|
+
appendToBody: boolean;
|
|
24
|
+
closeOnClickOverlay: boolean;
|
|
25
|
+
closeOnPressEscape: boolean;
|
|
26
|
+
showClose: boolean;
|
|
27
|
+
fullscreen: boolean;
|
|
28
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
29
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
30
|
+
declare const _default: typeof __VLS_export;
|
|
31
|
+
export default _default;
|
|
32
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
33
|
+
new (): {
|
|
34
|
+
$slots: S;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface MDialogProps {
|
|
2
|
+
modelValue?: boolean;
|
|
3
|
+
title?: string;
|
|
4
|
+
/** 对话框宽度,数字按 px 处理(全屏模式下忽略) */
|
|
5
|
+
width?: string | number;
|
|
6
|
+
/** 点击遮罩关闭(默认开启) */
|
|
7
|
+
closeOnClickOverlay?: boolean;
|
|
8
|
+
/** Esc 关闭(默认开启) */
|
|
9
|
+
closeOnPressEscape?: boolean;
|
|
10
|
+
/** 挂载到 body(默认开启) */
|
|
11
|
+
appendToBody?: boolean;
|
|
12
|
+
/** 显示右上角关闭按钮 */
|
|
13
|
+
showClose?: boolean;
|
|
14
|
+
/** 全屏模式:铺满视口,从底部向上滑入 */
|
|
15
|
+
fullscreen?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* 触发元素:传入后对话框从该元素包围盒 Morph 展开。
|
|
18
|
+
* 也可不传,改用 #trigger 插槽渲染触发内容,点击时组件自动记录触发元素。
|
|
19
|
+
*/
|
|
20
|
+
anchor?: HTMLElement | null;
|
|
21
|
+
}
|
|
22
|
+
export declare const MDialogPropsDefault: {
|
|
23
|
+
readonly closeOnClickOverlay: true;
|
|
24
|
+
readonly closeOnPressEscape: true;
|
|
25
|
+
readonly appendToBody: true;
|
|
26
|
+
readonly showClose: true;
|
|
27
|
+
readonly width: 420;
|
|
28
|
+
readonly fullscreen: false;
|
|
29
|
+
readonly anchor: null;
|
|
30
|
+
};
|