@puresnake/snake-ui 0.0.0-stage → 0.0.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/LICENSE +21 -0
- package/changelog.md +83 -0
- package/components/snake-activity-list/snake-activity-list.vue +365 -0
- package/components/snake-activity-list/types.ts +29 -0
- package/components/snake-auxiliary-segmentation/snake-auxiliary-segmentation.vue +44 -0
- package/components/snake-auxiliary-segmentation/types.ts +5 -0
- package/components/snake-button/snake-button.vue +357 -0
- package/components/snake-button/types.ts +103 -0
- package/components/snake-button-sort/snake-button-sort.vue +72 -0
- package/components/snake-button-sort/types.ts +22 -0
- package/components/snake-calendar/snake-calendar.vue +998 -0
- package/components/snake-calendar/types.ts +189 -0
- package/components/snake-cell-group/snake-cell-group.vue +55 -0
- package/components/snake-cell-group/types.ts +19 -0
- package/components/snake-cell-item/snake-cell-item.vue +159 -0
- package/components/snake-cell-item/types.ts +66 -0
- package/components/snake-checkbox/snake-checkbox.vue +264 -0
- package/components/snake-checkbox/types.ts +70 -0
- package/components/snake-checkbox-group/snake-checkbox-group.vue +154 -0
- package/components/snake-checkbox-group/types.ts +52 -0
- package/components/snake-cms/blocks/v2/cms-v2-carousel.vue +87 -0
- package/components/snake-cms/blocks/v2/cms-v2-coupon.vue +25 -0
- package/components/snake-cms/blocks/v2/cms-v2-custom.vue +12 -0
- package/components/snake-cms/blocks/v2/cms-v2-divider.vue +33 -0
- package/components/snake-cms/blocks/v2/cms-v2-floatbutton.vue +28 -0
- package/components/snake-cms/blocks/v2/cms-v2-goods-list.vue +150 -0
- package/components/snake-cms/blocks/v2/cms-v2-hotzone.vue +41 -0
- package/components/snake-cms/blocks/v2/cms-v2-images.vue +41 -0
- package/components/snake-cms/blocks/v2/cms-v2-magiccube.vue +93 -0
- package/components/snake-cms/blocks/v2/cms-v2-notice.vue +80 -0
- package/components/snake-cms/blocks/v2/cms-v2-popup.vue +46 -0
- package/components/snake-cms/blocks/v2/cms-v2-richtext.vue +18 -0
- package/components/snake-cms/blocks/v2/cms-v2-search.vue +115 -0
- package/components/snake-cms/blocks/v2/cms-v2-video.vue +25 -0
- package/components/snake-cms/blocks/v2/shared.ts +84 -0
- package/components/snake-cms/snake-cms.vue +409 -0
- package/components/snake-cms/types.ts +50 -0
- package/components/snake-commodity-search/snake-commodity-search.vue +234 -0
- package/components/snake-commodity-search/types.ts +11 -0
- package/components/snake-config-provider/snake-config-provider.vue +61 -0
- package/components/snake-config-provider/types.ts +22 -0
- package/components/snake-count-down/snake-count-down.vue +231 -0
- package/components/snake-count-down/types.ts +103 -0
- package/components/snake-coupon/snake-coupon.vue +209 -0
- package/components/snake-coupon/types.ts +21 -0
- package/components/snake-custom-module/snake-custom-module.vue +25 -0
- package/components/snake-custom-module/types.ts +11 -0
- package/components/snake-drop-menu/snake-drop-menu.vue +123 -0
- package/components/snake-drop-menu/types.ts +95 -0
- package/components/snake-drop-menu-item/snake-drop-menu-item.vue +181 -0
- package/components/snake-drop-menu-item/types.ts +48 -0
- package/components/snake-empty/snake-empty.vue +100 -0
- package/components/snake-empty/types.ts +48 -0
- package/components/snake-filter-sorts/filter-page.vue +695 -0
- package/components/snake-filter-sorts/snake-filter-sorts.vue +185 -0
- package/components/snake-filter-sorts/types.ts +57 -0
- package/components/snake-floating-bubble/snake-floating-bubble.vue +157 -0
- package/components/snake-floating-bubble/types.ts +43 -0
- package/components/snake-follow/snake-follow.vue +18 -0
- package/components/snake-follow/types.ts +2 -0
- package/components/snake-form/snake-form.vue +124 -0
- package/components/snake-form/types.ts +96 -0
- package/components/snake-form-item/snake-form-item.vue +331 -0
- package/components/snake-form-item/types.ts +70 -0
- package/components/snake-goods-list/snake-goods-list.vue +792 -0
- package/components/snake-goods-list/types.ts +55 -0
- package/components/snake-graphic-navigation/snake-graphic-navigation.vue +198 -0
- package/components/snake-graphic-navigation/types.ts +43 -0
- package/components/snake-icon/icon-names.ts +222 -0
- package/components/snake-icon/snake-icon.vue +220 -0
- package/components/snake-icon/types.ts +45 -0
- package/components/snake-image/snake-image.vue +230 -0
- package/components/snake-image/types.ts +70 -0
- package/components/snake-images/snake-images.vue +80 -0
- package/components/snake-images/types.ts +5 -0
- package/components/snake-index-anchor/snake-index-anchor.vue +83 -0
- package/components/snake-index-anchor/types.ts +14 -0
- package/components/snake-index-list/anchor-registry.ts +80 -0
- package/components/snake-index-list/snake-index-list.vue +259 -0
- package/components/snake-index-list/types.ts +115 -0
- package/components/snake-index-list-panel/snake-index-list-panel.vue +277 -0
- package/components/snake-index-list-panel/types.ts +10 -0
- package/components/snake-input/snake-input.vue +225 -0
- package/components/snake-input/types.ts +99 -0
- package/components/snake-jump-applet/snake-jump-applet.vue +99 -0
- package/components/snake-jump-applet/types.ts +17 -0
- package/components/snake-line/snake-line.vue +42 -0
- package/components/snake-line/types.ts +30 -0
- package/components/snake-line-progress/snake-line-progress.vue +105 -0
- package/components/snake-line-progress/types.ts +26 -0
- package/components/snake-link/snake-link.vue +74 -0
- package/components/snake-link/types.ts +30 -0
- package/components/snake-list-switching/components/tree-select/index.vue +156 -0
- package/components/snake-list-switching/snake-list-switching.vue +1285 -0
- package/components/snake-list-switching/types.ts +11 -0
- package/components/snake-loading/snake-loading.vue +241 -0
- package/components/snake-loading/types.ts +34 -0
- package/components/snake-loadmore/snake-loadmore.vue +103 -0
- package/components/snake-loadmore/types.ts +56 -0
- package/components/snake-magic-cube/snake-magic-cube.vue +622 -0
- package/components/snake-magic-cube/types.ts +5 -0
- package/components/snake-modal/snake-modal.vue +434 -0
- package/components/snake-modal/types.ts +71 -0
- package/components/snake-navbar/snake-navbar.vue +194 -0
- package/components/snake-navbar/types.ts +54 -0
- package/components/snake-no-network/snake-no-network.vue +125 -0
- package/components/snake-no-network/types.ts +27 -0
- package/components/snake-notice/snake-notice.vue +44 -0
- package/components/snake-notice/types.ts +5 -0
- package/components/snake-notice-bar/snake-notice-bar.vue +336 -0
- package/components/snake-notice-bar/types.ts +82 -0
- package/components/snake-overlay/snake-overlay.vue +73 -0
- package/components/snake-overlay/types.ts +35 -0
- package/components/snake-page-popup/snake-page-popup.vue +146 -0
- package/components/snake-page-popup/types.ts +28 -0
- package/components/snake-parse/audio/audio.vue +286 -0
- package/components/snake-parse/audio/context.js +11 -0
- package/components/snake-parse/audio/index.js +34 -0
- package/components/snake-parse/node/node.vue +830 -0
- package/components/snake-parse/parser.js +1480 -0
- package/components/snake-parse/snake-parse.vue +548 -0
- package/components/snake-parse/static/app-plus/snake-parse/js/handler.js +109 -0
- package/components/snake-parse/static/app-plus/snake-parse/js/uni.webview.js +0 -0
- package/components/snake-parse/static/app-plus/snake-parse/js/uni.webview.min.js +1 -0
- package/components/snake-parse/static/app-plus/snake-parse/local.html +3 -0
- package/components/snake-parse/style/index.js +132 -0
- package/components/snake-parse/style/parser.js +175 -0
- package/components/snake-parse/types.ts +49 -0
- package/components/snake-picture-ads/snake-picture-ads.vue +292 -0
- package/components/snake-picture-ads/types.ts +5 -0
- package/components/snake-popup/snake-popup.vue +348 -0
- package/components/snake-popup/types.ts +88 -0
- package/components/snake-qr-code/qrcode.ts +1214 -0
- package/components/snake-qr-code/snake-qr-code.vue +408 -0
- package/components/snake-qr-code/types.ts +78 -0
- package/components/snake-radio/snake-radio.vue +271 -0
- package/components/snake-radio/types.ts +64 -0
- package/components/snake-radio-group/snake-radio-group.vue +98 -0
- package/components/snake-radio-group/types.ts +48 -0
- package/components/snake-read-more/snake-read-more.vue +140 -0
- package/components/snake-read-more/types.ts +53 -0
- package/components/snake-rich-text/snake-rich-text.vue +24 -0
- package/components/snake-rich-text/types.ts +5 -0
- package/components/snake-root-portal/snake-root-portal.vue +92 -0
- package/components/snake-root-portal/types.ts +9 -0
- package/components/snake-search/snake-search.vue +202 -0
- package/components/snake-search/types.ts +84 -0
- package/components/snake-select/snake-select.vue +371 -0
- package/components/snake-select/types.ts +75 -0
- package/components/snake-skeleton/snake-skeleton.vue +104 -0
- package/components/snake-skeleton/types.ts +32 -0
- package/components/snake-skeleton-item/snake-skeleton-item.vue +90 -0
- package/components/snake-skeleton-item/types.ts +30 -0
- package/components/snake-slider/snake-slider.vue +249 -0
- package/components/snake-slider/types.ts +59 -0
- package/components/snake-sticky/snake-sticky.vue +178 -0
- package/components/snake-sticky/types.ts +48 -0
- package/components/snake-subsection/snake-subsection.vue +188 -0
- package/components/snake-subsection/types.ts +54 -0
- package/components/snake-swiper/snake-swiper.vue +229 -0
- package/components/snake-swiper/types.ts +79 -0
- package/components/snake-switch/snake-switch.vue +100 -0
- package/components/snake-switch/types.ts +41 -0
- package/components/snake-tabbar/snake-tabbar.vue +306 -0
- package/components/snake-tabbar/types.ts +93 -0
- package/components/snake-tabs/snake-tabs.vue +305 -0
- package/components/snake-tabs/types.ts +79 -0
- package/components/snake-text/snake-text.vue +292 -0
- package/components/snake-text/types.ts +100 -0
- package/components/snake-textarea/snake-textarea.vue +171 -0
- package/components/snake-textarea/types.ts +79 -0
- package/components/snake-toast/snake-toast.vue +330 -0
- package/components/snake-toast/types.ts +55 -0
- package/components/snake-tooltip/position.ts +33 -0
- package/components/snake-tooltip/snake-tooltip.vue +339 -0
- package/components/snake-tooltip/types.ts +80 -0
- package/components/snake-transition/snake-transition.vue +315 -0
- package/components/snake-transition/types.ts +65 -0
- package/components/snake-upload/snake-upload.vue +1801 -0
- package/components/snake-upload/types.ts +256 -0
- package/components/snake-videos/snake-videos.vue +122 -0
- package/components/snake-videos/types.ts +7 -0
- package/iconfont.css +881 -0
- package/index.d.ts +7 -0
- package/index.scss +26 -0
- package/index.ts +94 -0
- package/libs/cms/blocks.ts +103 -0
- package/libs/cms/config.ts +25 -0
- package/libs/cms/index.ts +7 -0
- package/libs/cms/normalize.ts +135 -0
- package/libs/cms/resolve.ts +12 -0
- package/libs/cms/types.ts +164 -0
- package/libs/cms/use-commerce.ts +385 -0
- package/libs/cms/v2.ts +193 -0
- package/libs/config/index.ts +4 -0
- package/libs/config/modal.ts +93 -0
- package/libs/config/state.ts +33 -0
- package/libs/config/theme.ts +351 -0
- package/libs/config/toast.ts +71 -0
- package/libs/config/types.ts +135 -0
- package/libs/config/zIndex.ts +44 -0
- package/libs/css/color.scss +105 -0
- package/libs/css/common.scss +171 -0
- package/libs/css/style.h5.scss +7 -0
- package/libs/css/style.mp.scss +7 -0
- package/libs/css/style.theme.scss +70 -0
- package/libs/css/style.vue.scss +140 -0
- package/libs/form/async-validator.min.d.ts +75 -0
- package/libs/form/async-validator.min.js +3 -0
- package/libs/form/index.ts +3 -0
- package/libs/form/path.ts +40 -0
- package/libs/form/types.ts +51 -0
- package/libs/form/validate.ts +149 -0
- package/libs/foundation.ts +96 -0
- package/libs/function/$parent.ts +33 -0
- package/libs/function/clipboard.ts +13 -0
- package/libs/function/color.ts +55 -0
- package/libs/function/debounce.ts +34 -0
- package/libs/function/deepClone.ts +30 -0
- package/libs/function/deepMerge.ts +25 -0
- package/libs/function/emitter.ts +30 -0
- package/libs/function/format.ts +27 -0
- package/libs/function/getParent.ts +53 -0
- package/libs/function/getRect.ts +29 -0
- package/libs/function/guid.ts +11 -0
- package/libs/function/index.ts +31 -0
- package/libs/function/queryParams.ts +73 -0
- package/libs/function/random.ts +6 -0
- package/libs/function/randomArray.ts +14 -0
- package/libs/function/route.ts +155 -0
- package/libs/function/sleep.ts +7 -0
- package/libs/function/style.ts +58 -0
- package/libs/function/styleUtils.ts +83 -0
- package/libs/function/system.ts +14 -0
- package/libs/function/test.ts +202 -0
- package/libs/function/throttle.ts +36 -0
- package/libs/function/timeFormat.ts +27 -0
- package/libs/function/timeFrom.ts +27 -0
- package/libs/function/toast.ts +10 -0
- package/libs/function/trim.ts +11 -0
- package/libs/function/type2icon.ts +11 -0
- package/libs/function/unit.ts +45 -0
- package/libs/hooks/index.ts +11 -0
- package/libs/hooks/useChildren.ts +125 -0
- package/libs/hooks/useColor.ts +5 -0
- package/libs/hooks/useDebounce.ts +5 -0
- package/libs/hooks/useLocale.ts +13 -0
- package/libs/hooks/useModal.ts +131 -0
- package/libs/hooks/useParent.ts +62 -0
- package/libs/hooks/useRect.ts +44 -0
- package/libs/hooks/useRouter.ts +5 -0
- package/libs/hooks/useTheme.ts +31 -0
- package/libs/hooks/useThrottle.ts +5 -0
- package/libs/hooks/useToast.ts +116 -0
- package/libs/index.ts +18 -0
- package/libs/request/auto-http.ts +1 -0
- package/libs/request/index.ts +343 -0
- package/libs/runtime/accessors.ts +55 -0
- package/libs/runtime/context.ts +40 -0
- package/libs/runtime/index.ts +18 -0
- package/libs/runtime/types.ts +49 -0
- package/libs/util/calendar.ts +6 -0
- package/locale/index.ts +130 -0
- package/locale/lang/en-US.ts +67 -0
- package/locale/lang/zh-CN.ts +67 -0
- package/package.json +134 -5
- package/plugins/index.ts +1 -0
- package/plugins/root/README.md +86 -0
- package/plugins/root/index.ts +123 -0
- package/plugins/root/page.ts +77 -0
- package/plugins/root/root.ts +53 -0
- package/plugins/root/utils.ts +137 -0
- package/readme.md +79 -0
- package/theme.scss +118 -0
- package/types/components.d.ts +236 -0
- package/types/global.d.ts +21 -0
- package/types/index.d.ts +6 -0
- package/types/uni-app.d.ts +16 -0
- package/README.md +0 -3
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
+
import type { StyleValue } from '../../types/global';
|
|
3
|
+
|
|
4
|
+
/** CalendarMode 类型定义。 */
|
|
5
|
+
export type CalendarMode = 'date' | 'range';
|
|
6
|
+
/** CalendarLunar 农历信息。 */
|
|
7
|
+
export interface CalendarLunar {
|
|
8
|
+
/** 农历日中文。 */
|
|
9
|
+
dayCn: string;
|
|
10
|
+
/** 星期中文。 */
|
|
11
|
+
weekCn: string;
|
|
12
|
+
/** 农历月中文。 */
|
|
13
|
+
monthCn: string;
|
|
14
|
+
/** 农历日。 */
|
|
15
|
+
day: number;
|
|
16
|
+
/** 星期几。 */
|
|
17
|
+
week: number;
|
|
18
|
+
/** 农历月。 */
|
|
19
|
+
month: number;
|
|
20
|
+
/** 农历年。 */
|
|
21
|
+
year: number;
|
|
22
|
+
}
|
|
23
|
+
/** CalendarChangeDate 单选模式 change 事件载荷。 */
|
|
24
|
+
export interface CalendarChangeDate {
|
|
25
|
+
/** 选中年。 */
|
|
26
|
+
year: number;
|
|
27
|
+
/** 选中月。 */
|
|
28
|
+
month: number;
|
|
29
|
+
/** 选中日。 */
|
|
30
|
+
day: number;
|
|
31
|
+
/** 当月天数。 */
|
|
32
|
+
days: number;
|
|
33
|
+
/** 选中日期,格式 YYYY-MM-DD。 */
|
|
34
|
+
result: string;
|
|
35
|
+
/** 星期文本。 */
|
|
36
|
+
week: string;
|
|
37
|
+
/** 是否今天。 */
|
|
38
|
+
isToday: boolean;
|
|
39
|
+
/** 农历信息。 */
|
|
40
|
+
lunar: CalendarLunar | null;
|
|
41
|
+
}
|
|
42
|
+
/** CalendarChangeRange 范围模式 change 事件载荷。 */
|
|
43
|
+
export interface CalendarChangeRange {
|
|
44
|
+
/** 开始年。 */
|
|
45
|
+
startYear: number;
|
|
46
|
+
/** 开始月。 */
|
|
47
|
+
startMonth: number;
|
|
48
|
+
/** 开始日。 */
|
|
49
|
+
startDay: number;
|
|
50
|
+
/** 开始日期,格式 YYYY-MM-DD。 */
|
|
51
|
+
startDate: string;
|
|
52
|
+
/** 开始日期星期文本。 */
|
|
53
|
+
startWeek: string;
|
|
54
|
+
/** 结束年。 */
|
|
55
|
+
endYear: number;
|
|
56
|
+
/** 结束月。 */
|
|
57
|
+
endMonth: number;
|
|
58
|
+
/** 结束日。 */
|
|
59
|
+
endDay: number;
|
|
60
|
+
/** 结束日期,格式 YYYY-MM-DD。 */
|
|
61
|
+
endDate: string;
|
|
62
|
+
/** 结束日期星期文本。 */
|
|
63
|
+
endWeek: string;
|
|
64
|
+
/** 开始日期农历信息。 */
|
|
65
|
+
startLunar: CalendarLunar | null;
|
|
66
|
+
/** 结束日期农历信息。 */
|
|
67
|
+
endLunar: CalendarLunar | null;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** calendarProps 运行时属性及默认值。 */
|
|
71
|
+
export const calendarProps = {
|
|
72
|
+
/** 根节点自定义样式。 */
|
|
73
|
+
customStyle: { type: [String, Object, Array] as PropType<StyleValue>, default: '' },
|
|
74
|
+
/** 根节点自定义类名。 */
|
|
75
|
+
customClass: { type: String, default: '' },
|
|
76
|
+
/** 是否开启底部安全区适配。 */
|
|
77
|
+
safeAreaInsetBottom: { type: Boolean, default: false },
|
|
78
|
+
/** 是否允许通过点击遮罩关闭日历。 */
|
|
79
|
+
maskCloseAble: { type: Boolean, default: true },
|
|
80
|
+
/** 双向绑定控制日历的弹出与收起。 */
|
|
81
|
+
modelValue: { type: Boolean, default: false },
|
|
82
|
+
/** 弹出时的层级,0 表示使用弹层默认层级。 */
|
|
83
|
+
zIndex: { type: [Number, String] as PropType<number | string>, default: 0 },
|
|
84
|
+
/** 是否允许切换年份。 */
|
|
85
|
+
changeYear: { type: Boolean, default: true },
|
|
86
|
+
/** 是否允许切换月份。 */
|
|
87
|
+
changeMonth: { type: Boolean, default: true },
|
|
88
|
+
/** 选择模式,date 单个日期,range 日期范围。 */
|
|
89
|
+
mode: { type: String as PropType<CalendarMode>, default: 'date' },
|
|
90
|
+
/** 可切换的最大年份。 */
|
|
91
|
+
maxYear: { type: [Number, String] as PropType<number | string>, default: 2050 },
|
|
92
|
+
/** 可切换的最小年份。 */
|
|
93
|
+
minYear: { type: [Number, String] as PropType<number | string>, default: 1950 },
|
|
94
|
+
/** 最小可选日期,不在范围内的日期禁用不可选。 */
|
|
95
|
+
minDate: { type: [Number, String] as PropType<number | string>, default: '1950-01-01' },
|
|
96
|
+
/** 最大可选日期,默认最大值为今天。 */
|
|
97
|
+
maxDate: { type: [Number, String] as PropType<number | string>, default: '' },
|
|
98
|
+
/** 弹窗顶部左右两边的圆角值。 */
|
|
99
|
+
borderRadius: { type: [String, Number] as PropType<string | number>, default: 20 },
|
|
100
|
+
/** 月份切换按钮箭头颜色。 */
|
|
101
|
+
monthArrowColor: { type: String, default: 'var(--snake-color-text-secondary, #606266)' },
|
|
102
|
+
/** 年份切换按钮箭头颜色。 */
|
|
103
|
+
yearArrowColor: { type: String, default: 'var(--snake-color-text-muted, #909399)' },
|
|
104
|
+
/** 默认日期字体颜色。 */
|
|
105
|
+
color: { type: String, default: 'var(--snake-color-text, #303133)' },
|
|
106
|
+
/** 选中/起始结束日期背景色。 */
|
|
107
|
+
activeBgColor: { type: String, default: 'var(--snake-color-primary, #06D290)' },
|
|
108
|
+
/** 选中/起始结束日期字体颜色。 */
|
|
109
|
+
activeColor: { type: String, default: 'var(--snake-color-white, #fff)' },
|
|
110
|
+
/** 范围内日期背景色。 */
|
|
111
|
+
rangeBgColor: { type: String, default: 'rgba(var(--snake-color-primary-rgb, 6, 210, 144), 0.13)' },
|
|
112
|
+
/** 范围内日期字体颜色。 */
|
|
113
|
+
rangeColor: { type: String, default: 'var(--snake-color-primary, #06D290)' },
|
|
114
|
+
/** mode 为 range 时生效,起始日期自定义文案。 */
|
|
115
|
+
startText: { type: String, default: '' },
|
|
116
|
+
/** mode 为 range 时生效,结束日期自定义文案。 */
|
|
117
|
+
endText: { type: String, default: '' },
|
|
118
|
+
/** 确定按钮样式类型。 */
|
|
119
|
+
btnType: { type: String, default: 'primary' },
|
|
120
|
+
/** 当前选中日期带选中效果。 */
|
|
121
|
+
isActiveCurrent: { type: Boolean, default: true },
|
|
122
|
+
/** 初始化时是否默认选中今天,优先级低于 defaultDate/startDate/endDate。 */
|
|
123
|
+
defaultSelectToday: { type: Boolean, default: true },
|
|
124
|
+
/** 切换年月是否触发事件,mode 为 date 时生效。 */
|
|
125
|
+
isChange: { type: Boolean, default: false },
|
|
126
|
+
/** 是否显示右上角的关闭图标。 */
|
|
127
|
+
closeable: { type: Boolean, default: true },
|
|
128
|
+
/** 顶部的提示文字。 */
|
|
129
|
+
toolTip: { type: String, default: '' },
|
|
130
|
+
/** 是否显示农历。 */
|
|
131
|
+
showLunar: { type: Boolean, default: false },
|
|
132
|
+
/** 是否在页面中直接显示,不使用弹窗。 */
|
|
133
|
+
isPage: { type: Boolean, default: false },
|
|
134
|
+
/** 默认选中的日期,mode 为 date 时生效,格式 2024-01-01。 */
|
|
135
|
+
defaultDate: { type: String, default: '' },
|
|
136
|
+
/** 默认选中的开始日期,mode 为 range 时生效,格式 2024-01-01。 */
|
|
137
|
+
startDate: { type: String, default: '' },
|
|
138
|
+
/** 默认选中的结束日期,mode 为 range 时生效,格式 2024-01-01。 */
|
|
139
|
+
endDate: { type: String, default: '' },
|
|
140
|
+
/** 是否只读,只读模式下禁止点击选择日期。 */
|
|
141
|
+
readonly: { type: Boolean, default: false },
|
|
142
|
+
/** 已打卡日期列表,格式 ['2024-01-01']。 */
|
|
143
|
+
checkedDates: { type: Array as PropType<string[]>, default: () => [] },
|
|
144
|
+
/** 打卡日期背景色。 */
|
|
145
|
+
checkedBgColor: { type: String, default: 'var(--snake-color-warning, #ff9900)' },
|
|
146
|
+
/** 打卡日期字体颜色。 */
|
|
147
|
+
checkedColor: { type: String, default: 'var(--snake-color-white, #fff)' },
|
|
148
|
+
/** 今日是否已打卡。 */
|
|
149
|
+
todayChecked: { type: Boolean, default: false },
|
|
150
|
+
/** 今日已打卡背景色。 */
|
|
151
|
+
todayCheckedBgColor: { type: String, default: 'var(--snake-color-success, #19be6b)' },
|
|
152
|
+
/** 未打卡日期背景色。 */
|
|
153
|
+
uncheckedBgColor: { type: String, default: 'var(--snake-color-text-light, #c0c4cc)' },
|
|
154
|
+
/** 未打卡日期字体颜色。 */
|
|
155
|
+
uncheckedColor: { type: String, default: 'var(--snake-color-white, #fff)' },
|
|
156
|
+
/** 是否启用打卡签到模式(未打卡日期显示灰色)。 */
|
|
157
|
+
checkinMode: { type: Boolean, default: false },
|
|
158
|
+
/** 节假日列表,格式 ['2024-01-01']。 */
|
|
159
|
+
holidays: { type: Array as PropType<string[]>, default: () => [] },
|
|
160
|
+
/** 节假日文字颜色。 */
|
|
161
|
+
holidayColor: { type: String, default: 'var(--snake-color-error, #fa3534)' },
|
|
162
|
+
/** 加班日列表,格式 ['2024-01-06']。 */
|
|
163
|
+
workdays: { type: Array as PropType<string[]>, default: () => [] },
|
|
164
|
+
/** 加班日文字颜色。 */
|
|
165
|
+
workdayColor: { type: String, default: 'var(--snake-color-primary, #06D290)' },
|
|
166
|
+
/** 节日配置,格式 { '2024-04-04': '清明节' }。 */
|
|
167
|
+
festivals: { type: Object as PropType<Record<string, string>>, default: () => ({}) },
|
|
168
|
+
/** 节日文字颜色。 */
|
|
169
|
+
festivalColor: { type: String, default: 'var(--snake-color-primary, #06D290)' },
|
|
170
|
+
/** 是否显示内置节日(中国传统节日)。 */
|
|
171
|
+
showFestival: { type: Boolean, default: false },
|
|
172
|
+
/** 是否启用自定义日期内容插槽。 */
|
|
173
|
+
useDateSlot: { type: Boolean, default: false }
|
|
174
|
+
} as const;
|
|
175
|
+
|
|
176
|
+
/** Calendar 组件的公开属性。 */
|
|
177
|
+
export type CalendarProps = ExtractPropTypes<typeof calendarProps>;
|
|
178
|
+
|
|
179
|
+
/** Calendar 组件的事件契约。 */
|
|
180
|
+
export type CalendarEmits = {
|
|
181
|
+
/** 双向绑定值更新。 */
|
|
182
|
+
'update:modelValue': [value: boolean];
|
|
183
|
+
/** 弹窗通过按钮收起时触发(兼容 input 语义)。 */
|
|
184
|
+
input: [value: boolean];
|
|
185
|
+
/** 点击遮罩或关闭按钮收起时触发。 */
|
|
186
|
+
close: [];
|
|
187
|
+
/** 选择结果变化时触发。 */
|
|
188
|
+
change: [value: CalendarChangeDate | CalendarChangeRange];
|
|
189
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="snake-cell-group" :class="customClass" :style="customStyle">
|
|
3
|
+
<view v-if="title" class="snake-cell-group__title" :style="titleStyle">{{ title }}</view>
|
|
4
|
+
<view class="snake-cell-group__body" :class="{ 'snake-cell-group__body--border': border }">
|
|
5
|
+
<slot />
|
|
6
|
+
</view>
|
|
7
|
+
</view>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script setup lang="ts">
|
|
11
|
+
/**
|
|
12
|
+
* @component CellGroup
|
|
13
|
+
* @description 单元格分组容器,一般搭配 CellItem 用于列表场景,支持分组标题与上下外边框。
|
|
14
|
+
* @see /components/cell
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { cellGroupProps } from './types';
|
|
18
|
+
|
|
19
|
+
defineOptions({ name: 'CellGroup', options: { virtualHost: true, styleIsolation: 'shared' } });
|
|
20
|
+
defineProps(cellGroupProps);
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<style scoped>
|
|
24
|
+
.snake-cell-group {
|
|
25
|
+
width: 100%;
|
|
26
|
+
}
|
|
27
|
+
.snake-cell-group__title {
|
|
28
|
+
padding: 30rpx 32rpx 10rpx 32rpx;
|
|
29
|
+
font-size: 30rpx;
|
|
30
|
+
text-align: left;
|
|
31
|
+
color: var(--snake-color-text-muted, #909399);
|
|
32
|
+
}
|
|
33
|
+
.snake-cell-group__body {
|
|
34
|
+
background-color: var(--snake-color-surface, #fff);
|
|
35
|
+
}
|
|
36
|
+
.snake-cell-group__body--border {
|
|
37
|
+
position: relative;
|
|
38
|
+
}
|
|
39
|
+
.snake-cell-group__body--border::before,
|
|
40
|
+
.snake-cell-group__body--border::after {
|
|
41
|
+
content: '';
|
|
42
|
+
position: absolute;
|
|
43
|
+
right: 0;
|
|
44
|
+
left: 0;
|
|
45
|
+
height: 1px;
|
|
46
|
+
background-color: var(--snake-color-border, #e4e7ed);
|
|
47
|
+
transform: scaleY(0.5);
|
|
48
|
+
}
|
|
49
|
+
.snake-cell-group__body--border::before {
|
|
50
|
+
top: 0;
|
|
51
|
+
}
|
|
52
|
+
.snake-cell-group__body--border::after {
|
|
53
|
+
bottom: 0;
|
|
54
|
+
}
|
|
55
|
+
</style>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
+
import type { StyleValue } from '../../types/global';
|
|
3
|
+
|
|
4
|
+
/** cellGroupProps 运行时属性及默认值。 */
|
|
5
|
+
export const cellGroupProps = {
|
|
6
|
+
/** 根节点自定义样式。 */
|
|
7
|
+
customStyle: { type: [String, Object, Array] as PropType<StyleValue>, default: '' },
|
|
8
|
+
/** 根节点自定义类名。 */
|
|
9
|
+
customClass: { type: String, default: '' },
|
|
10
|
+
/** 分组标题。 */
|
|
11
|
+
title: { type: String, default: '' },
|
|
12
|
+
/** 是否显示分组上下边框。 */
|
|
13
|
+
border: { type: Boolean, default: true },
|
|
14
|
+
/** 分组标题的样式,对象形式,注意驼峰属性写法。 */
|
|
15
|
+
titleStyle: { type: [Object, Array] as PropType<StyleValue>, default: () => ({}) }
|
|
16
|
+
} as const;
|
|
17
|
+
|
|
18
|
+
/** CellGroup 组件的公开属性。 */
|
|
19
|
+
export type CellGroupProps = ExtractPropTypes<typeof cellGroupProps>;
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view
|
|
3
|
+
class="snake-cell-item"
|
|
4
|
+
:class="[
|
|
5
|
+
{
|
|
6
|
+
'snake-cell-item--border-bottom': borderBottom,
|
|
7
|
+
'snake-cell-item--border-top': borderTop,
|
|
8
|
+
'snake-cell-item--center': center,
|
|
9
|
+
'snake-cell-item--required': required
|
|
10
|
+
},
|
|
11
|
+
customClass
|
|
12
|
+
]"
|
|
13
|
+
hover-stay-time="150"
|
|
14
|
+
:hover-class="hoverClass"
|
|
15
|
+
:style="[{ backgroundColor: bgColor }, customStyle]"
|
|
16
|
+
@click="onClick"
|
|
17
|
+
>
|
|
18
|
+
<view v-if="icon" class="snake-cell-item__left-icon-wrap">
|
|
19
|
+
<snake-icon :size="iconSize" :name="icon" :custom-style="iconStyle" />
|
|
20
|
+
</view>
|
|
21
|
+
<view v-else class="snake-cell-item__icon-slot">
|
|
22
|
+
<slot name="icon" />
|
|
23
|
+
</view>
|
|
24
|
+
<view class="snake-cell-item__title" :style="[{ width: titleWidth ? `${titleWidth}rpx` : 'auto' }, titleStyle]">
|
|
25
|
+
<template v-if="title !== ''">{{ title }}</template>
|
|
26
|
+
<slot v-else name="title" />
|
|
27
|
+
<view v-if="label || slots.label" class="snake-cell-item__label" :style="[labelStyle]">
|
|
28
|
+
<template v-if="label !== ''">{{ label }}</template>
|
|
29
|
+
<slot v-else name="label" />
|
|
30
|
+
</view>
|
|
31
|
+
</view>
|
|
32
|
+
<view class="snake-cell-item__value" :style="[valueStyle]">
|
|
33
|
+
<template v-if="value !== ''">{{ value }}</template>
|
|
34
|
+
<slot v-else />
|
|
35
|
+
</view>
|
|
36
|
+
<view v-if="slots['right-icon']" class="snake-cell-item__right">
|
|
37
|
+
<slot name="right-icon" />
|
|
38
|
+
</view>
|
|
39
|
+
<view v-if="arrow" class="snake-cell-item__right-icon-wrap">
|
|
40
|
+
<snake-icon name="arrow-right" :custom-style="arrowStyle" />
|
|
41
|
+
</view>
|
|
42
|
+
</view>
|
|
43
|
+
</template>
|
|
44
|
+
|
|
45
|
+
<script setup lang="ts">
|
|
46
|
+
/**
|
|
47
|
+
* @component CellItem
|
|
48
|
+
* @description 单元格条目,一般搭配 CellGroup 用于列表场景,支持图标、标题、描述、右侧内容与箭头。
|
|
49
|
+
* @see /components/cell
|
|
50
|
+
*/
|
|
51
|
+
|
|
52
|
+
import { computed, useSlots } from 'vue';
|
|
53
|
+
import Icon from '../snake-icon/snake-icon.vue';
|
|
54
|
+
import { cellItemProps, type CellItemEmits } from './types';
|
|
55
|
+
|
|
56
|
+
defineOptions({ name: 'CellItem', options: { virtualHost: true, styleIsolation: 'shared' } });
|
|
57
|
+
const props = defineProps(cellItemProps);
|
|
58
|
+
const emit = defineEmits<CellItemEmits>();
|
|
59
|
+
const slots = useSlots();
|
|
60
|
+
|
|
61
|
+
/** 箭头旋转样式。 */
|
|
62
|
+
const arrowStyle = computed(() => {
|
|
63
|
+
if (props.arrowDirection === 'up') return { transform: 'rotate(-90deg)' };
|
|
64
|
+
if (props.arrowDirection === 'down') return { transform: 'rotate(90deg)' };
|
|
65
|
+
return { transform: 'rotate(0deg)' };
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
/** 点击事件,回调中返回 index 标识当前条目。 */
|
|
69
|
+
function onClick() {
|
|
70
|
+
emit('click', props.index);
|
|
71
|
+
}
|
|
72
|
+
</script>
|
|
73
|
+
|
|
74
|
+
<style scoped>
|
|
75
|
+
.snake-cell-item {
|
|
76
|
+
position: relative;
|
|
77
|
+
box-sizing: border-box;
|
|
78
|
+
display: flex;
|
|
79
|
+
align-items: center;
|
|
80
|
+
width: 100%;
|
|
81
|
+
padding: 26rpx 32rpx;
|
|
82
|
+
font-size: 28rpx;
|
|
83
|
+
line-height: 54rpx;
|
|
84
|
+
color: var(--snake-color-text-secondary, #606266);
|
|
85
|
+
text-align: left;
|
|
86
|
+
}
|
|
87
|
+
.snake-cell-item__title {
|
|
88
|
+
font-size: 28rpx;
|
|
89
|
+
}
|
|
90
|
+
.snake-cell-item__left-icon-wrap,
|
|
91
|
+
.snake-cell-item__right-icon-wrap,
|
|
92
|
+
.snake-cell-item__icon-slot,
|
|
93
|
+
.snake-cell-item__right {
|
|
94
|
+
display: flex;
|
|
95
|
+
align-items: center;
|
|
96
|
+
height: 48rpx;
|
|
97
|
+
}
|
|
98
|
+
.snake-cell-item__left-icon-wrap,
|
|
99
|
+
.snake-cell-item__icon-slot {
|
|
100
|
+
margin-right: 10rpx;
|
|
101
|
+
font-size: 32rpx;
|
|
102
|
+
}
|
|
103
|
+
.snake-cell-item__right-icon-wrap {
|
|
104
|
+
margin-left: 10rpx;
|
|
105
|
+
color: var(--snake-color-text-muted, #909399);
|
|
106
|
+
font-size: 28rpx;
|
|
107
|
+
}
|
|
108
|
+
.snake-cell-item__right {
|
|
109
|
+
line-height: 1;
|
|
110
|
+
}
|
|
111
|
+
.snake-cell-item--border-bottom::after,
|
|
112
|
+
.snake-cell-item--border-top::before {
|
|
113
|
+
content: '';
|
|
114
|
+
position: absolute;
|
|
115
|
+
right: 0;
|
|
116
|
+
left: 0;
|
|
117
|
+
height: 1px;
|
|
118
|
+
background-color: var(--snake-color-border, #e4e7ed);
|
|
119
|
+
transform: scaleY(0.5);
|
|
120
|
+
}
|
|
121
|
+
.snake-cell-item--border-bottom::after {
|
|
122
|
+
bottom: 0;
|
|
123
|
+
}
|
|
124
|
+
.snake-cell-item--border-top::before {
|
|
125
|
+
top: 0;
|
|
126
|
+
}
|
|
127
|
+
.snake-cell-item__label {
|
|
128
|
+
margin-top: 6rpx;
|
|
129
|
+
font-size: 26rpx;
|
|
130
|
+
line-height: 36rpx;
|
|
131
|
+
color: var(--snake-color-text-muted, #909399);
|
|
132
|
+
word-wrap: break-word;
|
|
133
|
+
}
|
|
134
|
+
.snake-cell-item__value {
|
|
135
|
+
overflow: hidden;
|
|
136
|
+
font-size: 26rpx;
|
|
137
|
+
color: var(--snake-color-text-muted, #909399);
|
|
138
|
+
text-align: right;
|
|
139
|
+
vertical-align: middle;
|
|
140
|
+
}
|
|
141
|
+
.snake-cell-item__title,
|
|
142
|
+
.snake-cell-item__value {
|
|
143
|
+
flex: 1;
|
|
144
|
+
}
|
|
145
|
+
.snake-cell-item--required {
|
|
146
|
+
overflow: visible;
|
|
147
|
+
}
|
|
148
|
+
.snake-cell-item--required::before {
|
|
149
|
+
content: '*';
|
|
150
|
+
position: absolute;
|
|
151
|
+
left: 8px;
|
|
152
|
+
margin-top: 4rpx;
|
|
153
|
+
font-size: 14px;
|
|
154
|
+
color: var(--snake-color-error, #fa3534);
|
|
155
|
+
}
|
|
156
|
+
.snake-cell-item--hover {
|
|
157
|
+
background-color: var(--snake-color-surface-muted, #f2f3f6);
|
|
158
|
+
}
|
|
159
|
+
</style>
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
+
import type { StyleValue } from '../../types/global';
|
|
3
|
+
|
|
4
|
+
/** CellItemIndex 类型定义。 */
|
|
5
|
+
export type CellItemIndex = string | number;
|
|
6
|
+
/** CellItemStyle 类型定义。 */
|
|
7
|
+
export type CellItemStyle = Record<string, unknown>;
|
|
8
|
+
/** CellItemArrowDirection 类型定义。 */
|
|
9
|
+
export type CellItemArrowDirection = 'right' | 'up' | 'down';
|
|
10
|
+
|
|
11
|
+
/** cellItemProps 运行时属性及默认值。 */
|
|
12
|
+
export const cellItemProps = {
|
|
13
|
+
/** 根节点自定义样式。 */
|
|
14
|
+
customStyle: { type: [String, Object, Array] as PropType<StyleValue>, default: '' },
|
|
15
|
+
/** 根节点自定义类名。 */
|
|
16
|
+
customClass: { type: String, default: '' },
|
|
17
|
+
/** 左侧图标名称或图片地址。 */
|
|
18
|
+
icon: { type: String, default: '' },
|
|
19
|
+
/** 左侧标题。 */
|
|
20
|
+
title: { type: [String, Number] as PropType<string | number>, default: '' },
|
|
21
|
+
/** 右侧内容。 */
|
|
22
|
+
value: { type: [String, Number] as PropType<string | number>, default: '' },
|
|
23
|
+
/** 标题下方的描述信息。 */
|
|
24
|
+
label: { type: [String, Number] as PropType<string | number>, default: '' },
|
|
25
|
+
/** 是否显示下边框。 */
|
|
26
|
+
borderBottom: { type: Boolean, default: true },
|
|
27
|
+
/** 是否显示上边框。 */
|
|
28
|
+
borderTop: { type: Boolean, default: false },
|
|
29
|
+
/** 是否开启点击反馈,点击时背景变灰。 */
|
|
30
|
+
hoverClass: { type: String, default: 'snake-cell-item--hover' },
|
|
31
|
+
/** 是否显示右侧箭头。 */
|
|
32
|
+
arrow: { type: Boolean, default: true },
|
|
33
|
+
/** 内容是否垂直居中。 */
|
|
34
|
+
center: { type: Boolean, default: false },
|
|
35
|
+
/** 是否显示左侧表示必填的星号。 */
|
|
36
|
+
required: { type: Boolean, default: false },
|
|
37
|
+
/** 标题的宽度,数值按 rpx 处理。 */
|
|
38
|
+
titleWidth: { type: [Number, String] as PropType<number | string>, default: '' },
|
|
39
|
+
/** 右侧箭头方向。 */
|
|
40
|
+
arrowDirection: { type: String as PropType<CellItemArrowDirection>, default: 'right' },
|
|
41
|
+
/** 标题样式,对象形式。 */
|
|
42
|
+
titleStyle: { type: [Object, Array] as PropType<StyleValue>, default: () => ({}) },
|
|
43
|
+
/** 右侧内容样式,对象形式。 */
|
|
44
|
+
valueStyle: { type: [Object, Array] as PropType<StyleValue>, default: () => ({}) },
|
|
45
|
+
/** 描述信息样式,对象形式。 */
|
|
46
|
+
labelStyle: { type: [Object, Array] as PropType<StyleValue>, default: () => ({}) },
|
|
47
|
+
/** 背景颜色。 */
|
|
48
|
+
bgColor: { type: String, default: 'transparent' },
|
|
49
|
+
/** 用于 click 事件回调中标识当前是第几个条目。 */
|
|
50
|
+
index: { type: [String, Number] as PropType<CellItemIndex>, default: '' },
|
|
51
|
+
/** 是否使用 label 插槽。 */
|
|
52
|
+
useLabelSlot: { type: Boolean, default: false },
|
|
53
|
+
/** 左侧图标的大小,数值按 rpx 处理,只对传入 icon 字段时有效。 */
|
|
54
|
+
iconSize: { type: [Number, String] as PropType<number | string>, default: 34 },
|
|
55
|
+
/** 左侧图标的样式,对象形式。 */
|
|
56
|
+
iconStyle: { type: [Object, Array] as PropType<StyleValue>, default: () => ({}) }
|
|
57
|
+
} as const;
|
|
58
|
+
|
|
59
|
+
/** CellItem 组件的公开属性。 */
|
|
60
|
+
export type CellItemProps = ExtractPropTypes<typeof cellItemProps>;
|
|
61
|
+
|
|
62
|
+
/** CellItem 组件的事件契约。 */
|
|
63
|
+
export type CellItemEmits = {
|
|
64
|
+
/** click 事件携带的参数。 */
|
|
65
|
+
click: [index: CellItemIndex];
|
|
66
|
+
};
|