uview-pro 0.5.14 → 0.5.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/changelog.md +53 -8
- package/components/u-action-sheet/types.ts +10 -2
- package/components/u-action-sheet-item/types.ts +10 -2
- package/components/u-alert-tips/types.ts +10 -2
- package/components/u-avatar/types.ts +10 -2
- package/components/u-back-top/types.ts +10 -2
- package/components/u-badge/types.ts +10 -2
- package/components/u-button/types.ts +11 -3
- package/components/u-button/u-button.vue +17 -0
- package/components/u-calendar/types.ts +10 -2
- package/components/u-car-keyboard/types.ts +11 -3
- package/components/u-card/types.ts +10 -2
- package/components/u-cell-group/types.ts +10 -2
- package/components/u-cell-item/types.ts +10 -2
- package/components/u-checkbox/types.ts +12 -4
- package/components/u-checkbox/u-checkbox.vue +73 -9
- package/components/u-checkbox-group/types.ts +14 -6
- package/components/u-checkbox-group/u-checkbox-group.vue +1 -1
- package/components/u-circle-progress/types.ts +10 -2
- package/components/u-city-select/types.ts +10 -2
- package/components/u-col/types.ts +10 -2
- package/components/u-collapse/types.ts +10 -2
- package/components/u-collapse-item/types.ts +10 -2
- package/components/u-column-notice/types.ts +10 -2
- package/components/u-config-provider/types.ts +10 -2
- package/components/u-count-down/types.ts +10 -2
- package/components/u-count-to/types.ts +10 -2
- package/components/u-divider/types.ts +10 -2
- package/components/u-dropdown/types.ts +10 -2
- package/components/u-dropdown-item/types.ts +10 -2
- package/components/u-empty/types.ts +10 -2
- package/components/u-fab/types.ts +10 -2
- package/components/u-field/types.ts +10 -2
- package/components/u-form/types.ts +14 -4
- package/components/u-form-item/types.ts +16 -3
- package/components/u-form-item/u-form-item.vue +73 -9
- package/components/u-full-screen/types.ts +10 -2
- package/components/u-gap/types.ts +10 -2
- package/components/u-grid/types.ts +10 -2
- package/components/u-grid-item/types.ts +10 -2
- package/components/u-icon/types.ts +10 -2
- package/components/u-image/types.ts +10 -2
- package/components/u-index-anchor/types.ts +10 -2
- package/components/u-input/types.ts +16 -3
- package/components/u-input/u-input.vue +100 -22
- package/components/u-loading/types.ts +10 -2
- package/components/u-loadmore/types.ts +10 -2
- package/components/u-mask/types.ts +10 -2
- package/components/u-message-input/types.ts +10 -2
- package/components/u-modal/types.ts +10 -2
- package/components/u-pagination/types.ts +11 -2
- package/components/u-picker/types.ts +10 -2
- package/components/u-popup/types.ts +10 -2
- package/components/u-radio/types.ts +14 -4
- package/components/u-radio/u-radio.vue +78 -10
- package/components/u-radio-group/types.ts +12 -4
- package/components/u-rate/types.ts +10 -2
- package/components/u-read-more/types.ts +10 -2
- package/components/u-row/types.ts +10 -2
- package/components/u-row-notice/types.ts +10 -2
- package/components/u-safe-bottom/types.ts +19 -0
- package/components/u-safe-bottom/u-safe-bottom.vue +1 -1
- package/components/u-search/types.ts +10 -2
- package/components/u-section/types.ts +10 -2
- package/components/u-select/types.ts +10 -2
- package/components/u-skeleton/types.ts +10 -2
- package/components/u-slider/types.ts +10 -2
- package/components/u-status-bar/types.ts +21 -0
- package/components/u-status-bar/u-status-bar.vue +1 -1
- package/components/u-step/types.ts +10 -2
- package/components/u-steps/types.ts +10 -2
- package/components/u-sticky/types.ts +10 -2
- package/components/u-subsection/types.ts +10 -2
- package/components/u-swipe-action/types.ts +10 -2
- package/components/u-swiper/types.ts +10 -2
- package/components/u-switch/types.ts +12 -4
- package/components/u-switch/u-switch.vue +60 -5
- package/components/u-tabbar/types.ts +10 -2
- package/components/u-table/types.ts +10 -2
- package/components/u-tabs/types.ts +10 -2
- package/components/u-tabs-swiper/types.ts +10 -2
- package/components/u-tag/types.ts +10 -2
- package/components/u-tag/u-tag.vue +5 -0
- package/components/u-td/types.ts +10 -2
- package/components/u-text/types.ts +10 -2
- package/components/u-textarea/types.ts +16 -5
- package/components/u-textarea/u-textarea.vue +87 -6
- package/components/u-th/types.ts +10 -2
- package/components/u-time-line/u-time-line.vue +13 -2
- package/components/u-time-line-item/types.ts +10 -2
- package/components/u-toast/types.ts +10 -2
- package/components/u-top-tips/types.ts +10 -2
- package/components/u-tr/types.ts +11 -3
- package/components/u-transition/types.ts +10 -2
- package/components/u-upload/types.ts +10 -2
- package/components/u-verification-code/types.ts +10 -2
- package/components/u-waterfall/types.ts +10 -2
- package/index.ts +4 -5
- package/libs/config/config.ts +27 -4
- package/libs/css/common.scss +5 -0
- package/libs/hooks/useCompRelation.ts +37 -34
- package/libs/index.ts +0 -1
- package/libs/util/config-provider.ts +24 -25
- package/package.json +3 -2
- package/types/global.d.ts +8 -9
- package/components/common/props.ts +0 -22
- package/components/u-safe-bottom/props.ts +0 -11
- package/components/u-status-bar/props.ts +0 -13
- package/libs/util/logger.ts +0 -364
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
-
import { baseProps } from '../common/props';
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* u-city-select 城市选择器 Props
|
|
6
5
|
* @description 用于选择省、市、区三级行政区域,支持回显和自定义初始值。
|
|
7
6
|
*/
|
|
8
7
|
export const CitySelectProps = {
|
|
9
|
-
|
|
8
|
+
/** 自定义根节点样式 */
|
|
9
|
+
customStyle: {
|
|
10
|
+
type: [String, Object] as PropType<string | Record<string, any>>,
|
|
11
|
+
default: () => ({})
|
|
12
|
+
},
|
|
13
|
+
/** 自定义根节点样式类 */
|
|
14
|
+
customClass: {
|
|
15
|
+
type: String as unknown as PropType<string>,
|
|
16
|
+
default: ''
|
|
17
|
+
},
|
|
10
18
|
/** 控制弹窗显示与隐藏(v-model) */
|
|
11
19
|
modelValue: { type: Boolean, default: false },
|
|
12
20
|
/** 默认选中的省市区名称数组 */
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
2
|
import type { AlignType, JustifyType } from '../../types/global';
|
|
3
|
-
import { baseProps } from '../common/props';
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* u-col 布局单元格 Props
|
|
@@ -14,7 +13,16 @@ import { baseProps } from '../common/props';
|
|
|
14
13
|
*/
|
|
15
14
|
|
|
16
15
|
export const ColProps = {
|
|
17
|
-
|
|
16
|
+
/** 自定义根节点样式 */
|
|
17
|
+
customStyle: {
|
|
18
|
+
type: [String, Object] as PropType<string | Record<string, any>>,
|
|
19
|
+
default: () => ({})
|
|
20
|
+
},
|
|
21
|
+
/** 自定义根节点样式类 */
|
|
22
|
+
customClass: {
|
|
23
|
+
type: String as unknown as PropType<string>,
|
|
24
|
+
default: ''
|
|
25
|
+
},
|
|
18
26
|
/** 占父容器宽度的多少等分,总分为12份 */
|
|
19
27
|
span: { type: [Number, String] as PropType<number | string>, default: 12 },
|
|
20
28
|
/** 指定栅格左侧的间隔数(总12栏) */
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
-
import { baseProps } from '../common/props';
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* u-collapse 手风琴 Props
|
|
@@ -13,7 +12,16 @@ import { baseProps } from '../common/props';
|
|
|
13
12
|
* @property {String} hoverClass 样式类名,按下时有效(默认u-hover-class)
|
|
14
13
|
*/
|
|
15
14
|
export const CollapseProps = {
|
|
16
|
-
|
|
15
|
+
/** 自定义根节点样式 */
|
|
16
|
+
customStyle: {
|
|
17
|
+
type: [String, Object] as PropType<string | Record<string, any>>,
|
|
18
|
+
default: () => ({})
|
|
19
|
+
},
|
|
20
|
+
/** 自定义根节点样式类 */
|
|
21
|
+
customClass: {
|
|
22
|
+
type: String as unknown as PropType<string>,
|
|
23
|
+
default: ''
|
|
24
|
+
},
|
|
17
25
|
/** 是否手风琴模式 */
|
|
18
26
|
accordion: { type: Boolean, default: true },
|
|
19
27
|
/** 头部的样式 */
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
2
|
import type { TextAlign } from '../../types/global';
|
|
3
|
-
import { baseProps } from '../common/props';
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* u-collapse-item 手风琴Item Props
|
|
7
6
|
* @description 通过折叠面板收纳内容区域(搭配u-collapse使用)
|
|
8
7
|
*/
|
|
9
8
|
export const CollapseItemProps = {
|
|
10
|
-
|
|
9
|
+
/** 自定义根节点样式 */
|
|
10
|
+
customStyle: {
|
|
11
|
+
type: [String, Object] as PropType<string | Record<string, any>>,
|
|
12
|
+
default: () => ({})
|
|
13
|
+
},
|
|
14
|
+
/** 自定义根节点样式类 */
|
|
15
|
+
customClass: {
|
|
16
|
+
type: String as unknown as PropType<string>,
|
|
17
|
+
default: ''
|
|
18
|
+
},
|
|
11
19
|
/** 标题 */
|
|
12
20
|
title: { type: String, default: '' },
|
|
13
21
|
/** 标题的对齐方式 */
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
2
|
import type { Direction, PlayState, ScrollDirection, ThemeType } from '../../types/global';
|
|
3
|
-
import { baseProps } from '../common/props';
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* u-column-notice 通告栏 Props
|
|
7
6
|
*/
|
|
8
7
|
export const ColumnNoticeProps = {
|
|
9
|
-
|
|
8
|
+
/** 自定义根节点样式 */
|
|
9
|
+
customStyle: {
|
|
10
|
+
type: [String, Object] as PropType<string | Record<string, any>>,
|
|
11
|
+
default: () => ({})
|
|
12
|
+
},
|
|
13
|
+
/** 自定义根节点样式类 */
|
|
14
|
+
customClass: {
|
|
15
|
+
type: String as unknown as PropType<string>,
|
|
16
|
+
default: ''
|
|
17
|
+
},
|
|
10
18
|
/** 显示的内容,数组 */
|
|
11
19
|
list: { type: Array as PropType<string[]>, default: () => [] },
|
|
12
20
|
/** 显示的主题,success|error|primary|info|warning */
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
-
import { baseProps } from '../common/props';
|
|
3
2
|
import { config, configProvider } from '../../libs';
|
|
4
3
|
import type { Theme } from '../../types/global';
|
|
5
4
|
|
|
6
5
|
export const ConfigProviderProps = {
|
|
7
|
-
|
|
6
|
+
/** 自定义根节点样式 */
|
|
7
|
+
customStyle: {
|
|
8
|
+
type: [String, Object] as PropType<string | Record<string, any>>,
|
|
9
|
+
default: () => ({})
|
|
10
|
+
},
|
|
11
|
+
/** 自定义根节点样式类 */
|
|
12
|
+
customClass: {
|
|
13
|
+
type: String as unknown as PropType<string>,
|
|
14
|
+
default: ''
|
|
15
|
+
},
|
|
8
16
|
/**
|
|
9
17
|
* 主题风格,可选值:
|
|
10
18
|
* - 'light': 强制亮色模式(默认)
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
-
import { baseProps } from '../common/props';
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* u-count-down 倒计时 Props
|
|
6
5
|
* @description 该组件一般使用于某个活动的截止时间上,通过数字的变化,给用户明确的时间感受,提示用户进行某一个行为操作。
|
|
7
6
|
*/
|
|
8
7
|
export const CountDownProps = {
|
|
9
|
-
|
|
8
|
+
/** 自定义根节点样式 */
|
|
9
|
+
customStyle: {
|
|
10
|
+
type: [String, Object] as PropType<string | Record<string, any>>,
|
|
11
|
+
default: () => ({})
|
|
12
|
+
},
|
|
13
|
+
/** 自定义根节点样式类 */
|
|
14
|
+
customClass: {
|
|
15
|
+
type: String as unknown as PropType<string>,
|
|
16
|
+
default: ''
|
|
17
|
+
},
|
|
10
18
|
/** 倒计时的时间,秒为单位 */
|
|
11
19
|
timestamp: { type: [Number, String] as PropType<number | string>, default: 0 },
|
|
12
20
|
/** 是否自动开始倒计时 */
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
-
import { baseProps } from '../common/props';
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* u-count-to 数字滚动 Props
|
|
6
5
|
* @description 该组件一般用于需要滚动数字到某一个值的场景,目标要求是一个递增的值。
|
|
7
6
|
*/
|
|
8
7
|
export const CountToProps = {
|
|
9
|
-
|
|
8
|
+
/** 自定义根节点样式 */
|
|
9
|
+
customStyle: {
|
|
10
|
+
type: [String, Object] as PropType<string | Record<string, any>>,
|
|
11
|
+
default: () => ({})
|
|
12
|
+
},
|
|
13
|
+
/** 自定义根节点样式类 */
|
|
14
|
+
customClass: {
|
|
15
|
+
type: String as unknown as PropType<string>,
|
|
16
|
+
default: ''
|
|
17
|
+
},
|
|
10
18
|
/** 开始的数值,默认从0增长到某一个数 */
|
|
11
19
|
startVal: { type: [Number, String] as PropType<number | string>, default: 0 },
|
|
12
20
|
/** 要滚动的目标数值,必须 */
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
2
|
import type { ThemeType } from '../../types/global';
|
|
3
|
-
import { baseProps } from '../common/props';
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* u-divider 分割线 Props
|
|
7
6
|
* @description 区隔内容的分割线,一般用于页面底部"没有更多"的提示。
|
|
8
7
|
*/
|
|
9
8
|
export const DividerProps = {
|
|
10
|
-
|
|
9
|
+
/** 自定义根节点样式 */
|
|
10
|
+
customStyle: {
|
|
11
|
+
type: [String, Object] as PropType<string | Record<string, any>>,
|
|
12
|
+
default: () => ({})
|
|
13
|
+
},
|
|
14
|
+
/** 自定义根节点样式类 */
|
|
15
|
+
customClass: {
|
|
16
|
+
type: String as unknown as PropType<string>,
|
|
17
|
+
default: ''
|
|
18
|
+
},
|
|
11
19
|
/** 单一边divider横线的宽度(数值),单位rpx。或者百分比 */
|
|
12
20
|
halfWidth: { type: [Number, String] as PropType<number | string>, default: 150 },
|
|
13
21
|
/** divider横线的颜色,如设置 */
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
-
import { baseProps } from '../common/props';
|
|
3
2
|
import { getColor } from '../../';
|
|
4
3
|
|
|
5
4
|
/**
|
|
@@ -7,7 +6,16 @@ import { getColor } from '../../';
|
|
|
7
6
|
* @description 该组件一般用于向下展开菜单,同时可切换多个选项卡的场景
|
|
8
7
|
*/
|
|
9
8
|
export const DropdownProps = {
|
|
10
|
-
|
|
9
|
+
/** 自定义根节点样式 */
|
|
10
|
+
customStyle: {
|
|
11
|
+
type: [String, Object] as PropType<string | Record<string, any>>,
|
|
12
|
+
default: () => ({})
|
|
13
|
+
},
|
|
14
|
+
/** 自定义根节点样式类 */
|
|
15
|
+
customClass: {
|
|
16
|
+
type: String as unknown as PropType<string>,
|
|
17
|
+
default: ''
|
|
18
|
+
},
|
|
11
19
|
/** 菜单标题和选项的激活态颜色 */
|
|
12
20
|
activeColor: { type: String, default: () => getColor('primary') },
|
|
13
21
|
/** 菜单标题和选项的未激活态颜色 */
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
2
|
import type { OptionType } from '../../types/global';
|
|
3
|
-
import { baseProps } from '../common/props';
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* u-dropdown-item 下拉菜单项 Props
|
|
@@ -14,7 +13,16 @@ import { baseProps } from '../common/props';
|
|
|
14
13
|
*/
|
|
15
14
|
|
|
16
15
|
export const DropdownItemProps = {
|
|
17
|
-
|
|
16
|
+
/** 自定义根节点样式 */
|
|
17
|
+
customStyle: {
|
|
18
|
+
type: [String, Object] as PropType<string | Record<string, any>>,
|
|
19
|
+
default: () => ({})
|
|
20
|
+
},
|
|
21
|
+
/** 自定义根节点样式类 */
|
|
22
|
+
customClass: {
|
|
23
|
+
type: String as unknown as PropType<string>,
|
|
24
|
+
default: ''
|
|
25
|
+
},
|
|
18
26
|
/** 当前选中项的value值 */
|
|
19
27
|
modelValue: { type: [Number, String, Array] as PropType<number | string | any[]>, default: '' },
|
|
20
28
|
/** 菜单项标题 */
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
-
import { baseProps } from '../common/props';
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* u-empty 组件 Props 类型定义
|
|
6
5
|
*/
|
|
7
6
|
export const EmptyProps = {
|
|
8
|
-
|
|
7
|
+
/** 自定义根节点样式 */
|
|
8
|
+
customStyle: {
|
|
9
|
+
type: [String, Object] as PropType<string | Record<string, any>>,
|
|
10
|
+
default: () => ({})
|
|
11
|
+
},
|
|
12
|
+
/** 自定义根节点样式类 */
|
|
13
|
+
customClass: {
|
|
14
|
+
type: String as unknown as PropType<string>,
|
|
15
|
+
default: ''
|
|
16
|
+
},
|
|
9
17
|
/** 图标路径 */
|
|
10
18
|
src: { type: String, default: '' },
|
|
11
19
|
/** 提示文字 */
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { CSSProperties, ExtractPropTypes, PropType } from 'vue';
|
|
2
2
|
import type { FabDirection, FabGap, FabPosition, ThemeType } from '../../types/global';
|
|
3
|
-
import { baseProps } from '../common/props';
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* fab 悬浮按钮类型定义
|
|
@@ -8,7 +7,16 @@ import { baseProps } from '../common/props';
|
|
|
8
7
|
*/
|
|
9
8
|
|
|
10
9
|
export const FabProps = {
|
|
11
|
-
|
|
10
|
+
/** 自定义根节点样式 */
|
|
11
|
+
customStyle: {
|
|
12
|
+
type: [String, Object] as PropType<string | Record<string, any>>,
|
|
13
|
+
default: () => ({})
|
|
14
|
+
},
|
|
15
|
+
/** 自定义根节点样式类 */
|
|
16
|
+
customClass: {
|
|
17
|
+
type: String as unknown as PropType<string>,
|
|
18
|
+
default: ''
|
|
19
|
+
},
|
|
12
20
|
/** 按钮的预置样式,primary,info,error,warning,success */
|
|
13
21
|
type: { type: String as PropType<ThemeType>, default: 'primary' },
|
|
14
22
|
/** 是否禁止状态 */
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
2
|
import type { InputAlign, InputConfirmType, InputLabelPosition, InputType } from '../../types/global';
|
|
3
|
-
import { baseProps } from '../common/props';
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* u-field 组件 Props 类型定义
|
|
7
6
|
* @description 表单输入框属性
|
|
8
7
|
*/
|
|
9
8
|
export const FieldProps = {
|
|
10
|
-
|
|
9
|
+
/** 自定义根节点样式 */
|
|
10
|
+
customStyle: {
|
|
11
|
+
type: [String, Object] as PropType<string | Record<string, any>>,
|
|
12
|
+
default: () => ({})
|
|
13
|
+
},
|
|
14
|
+
/** 自定义根节点样式类 */
|
|
15
|
+
customClass: {
|
|
16
|
+
type: String as unknown as PropType<string>,
|
|
17
|
+
default: ''
|
|
18
|
+
},
|
|
11
19
|
/** label左边的图标,限uView的图标名称 */
|
|
12
20
|
icon: { type: String, default: '' },
|
|
13
21
|
/** 输入框右边的图标名称,限uView的图标名称(默认false) */
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
-
import type { FormRules, InputAlign, FormErrorType, InputLabelPosition } from '../../types/global';
|
|
3
|
-
import { baseProps } from '../common/props';
|
|
2
|
+
import type { FormRules, InputAlign, FormErrorType, InputLabelPosition, SizeType } from '../../types/global';
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* u-form 组件 Props 类型定义
|
|
7
6
|
* @description 表单组件属性
|
|
8
7
|
*/
|
|
9
8
|
export const FormProps = {
|
|
10
|
-
|
|
9
|
+
/** 自定义根节点样式 */
|
|
10
|
+
customStyle: {
|
|
11
|
+
type: [String, Object] as PropType<string | Record<string, any>>,
|
|
12
|
+
default: () => ({})
|
|
13
|
+
},
|
|
14
|
+
/** 自定义根节点样式类 */
|
|
15
|
+
customClass: {
|
|
16
|
+
type: String as unknown as PropType<string>,
|
|
17
|
+
default: ''
|
|
18
|
+
},
|
|
11
19
|
/** 当前form的需要验证字段的集合 */
|
|
12
20
|
model: { type: Object as PropType<Record<string, any>>, default: () => ({}) },
|
|
13
21
|
/** 表单验证规则 */
|
|
@@ -23,7 +31,9 @@ export const FormProps = {
|
|
|
23
31
|
/** label字体的对齐方式 */
|
|
24
32
|
labelAlign: { type: String as PropType<InputAlign>, default: 'left' },
|
|
25
33
|
/** label的样式,对象形式 */
|
|
26
|
-
labelStyle: { type: Object as PropType<Record<string, any>>, default: () => ({}) }
|
|
34
|
+
labelStyle: { type: Object as PropType<Record<string, any>>, default: () => ({}) },
|
|
35
|
+
/** 表单内组件的大小,仅支持预设值 default/small/large(默认 default) */
|
|
36
|
+
size: { type: String as PropType<SizeType>, default: 'default' }
|
|
27
37
|
};
|
|
28
38
|
|
|
29
39
|
export type FormProps = ExtractPropTypes<typeof FormProps>;
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
import type { PropType, ExtractPropTypes } from 'vue';
|
|
2
|
-
import type { InputAlign, InputLabelPosition } from '../../types/global';
|
|
3
|
-
import { baseProps } from '../common/props';
|
|
2
|
+
import type { InputAlign, InputLabelPosition, SizeType } from '../../types/global';
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* form-item 表单item Props
|
|
7
6
|
*/
|
|
8
7
|
export const FormItemProps = {
|
|
9
|
-
|
|
8
|
+
/** 自定义根节点样式 */
|
|
9
|
+
customStyle: {
|
|
10
|
+
type: [String, Object] as PropType<string | Record<string, any>>,
|
|
11
|
+
default: () => ({})
|
|
12
|
+
},
|
|
13
|
+
/** 自定义根节点样式类 */
|
|
14
|
+
customClass: {
|
|
15
|
+
type: String as unknown as PropType<string>,
|
|
16
|
+
default: ''
|
|
17
|
+
},
|
|
10
18
|
/** input的label提示语 */
|
|
11
19
|
label: {
|
|
12
20
|
type: String,
|
|
@@ -76,6 +84,11 @@ export const FormItemProps = {
|
|
|
76
84
|
required: {
|
|
77
85
|
type: Boolean,
|
|
78
86
|
default: false
|
|
87
|
+
},
|
|
88
|
+
/** 表单内组件的大小,仅支持预设值 default/small/large */
|
|
89
|
+
size: {
|
|
90
|
+
type: String as PropType<SizeType | string>,
|
|
91
|
+
default: ''
|
|
79
92
|
}
|
|
80
93
|
};
|
|
81
94
|
|
|
@@ -36,8 +36,9 @@
|
|
|
36
36
|
<view class="u-form-item--left__content__icon" v-if="leftIcon || $slots.leftIcon">
|
|
37
37
|
<slot name="leftIcon">
|
|
38
38
|
<u-icon
|
|
39
|
-
:custom-prefix="leftIconPrefix"
|
|
40
39
|
:name="leftIcon"
|
|
40
|
+
:size="currentIconSize"
|
|
41
|
+
:custom-prefix="leftIconPrefix"
|
|
41
42
|
:custom-style="leftIconStyle"
|
|
42
43
|
></u-icon>
|
|
43
44
|
</slot>
|
|
@@ -46,6 +47,7 @@
|
|
|
46
47
|
class="u-form-item--left__content__label"
|
|
47
48
|
:style="[
|
|
48
49
|
elLabelStyle,
|
|
50
|
+
{ 'font-size': actualFontSize },
|
|
49
51
|
{
|
|
50
52
|
'justify-content':
|
|
51
53
|
elLabelAlign == 'left'
|
|
@@ -75,6 +77,7 @@
|
|
|
75
77
|
<u-icon
|
|
76
78
|
v-if="rightIcon"
|
|
77
79
|
:name="rightIcon"
|
|
80
|
+
:size="currentIconSize"
|
|
78
81
|
:custom-prefix="rightIconPrefix"
|
|
79
82
|
:custom-style="rightIconStyle"
|
|
80
83
|
></u-icon>
|
|
@@ -88,10 +91,13 @@
|
|
|
88
91
|
class="u-form-item__message"
|
|
89
92
|
v-if="validateState === 'error' && showError('message')"
|
|
90
93
|
:style="{
|
|
91
|
-
paddingLeft: elLabelPosition == 'left' && label ? $u.addUnit(elLabelWidth) : '0'
|
|
94
|
+
paddingLeft: elLabelPosition == 'left' && label ? $u.addUnit(elLabelWidth) : '0',
|
|
95
|
+
fontSize: $u.addUnit(currentSizeConfig.messageSize),
|
|
96
|
+
lineHeight: $u.addUnit(currentSizeConfig.messageSize)
|
|
92
97
|
}"
|
|
93
|
-
>{{ validateMessage }}</view
|
|
94
98
|
>
|
|
99
|
+
{{ validateMessage }}
|
|
100
|
+
</view>
|
|
95
101
|
</view>
|
|
96
102
|
</template>
|
|
97
103
|
|
|
@@ -114,11 +120,10 @@ import { $u, useChildren, useParent } from '../..';
|
|
|
114
120
|
// @ts-ignore
|
|
115
121
|
import schema from '../../libs/util/async-validator';
|
|
116
122
|
import { FormItemProps } from './types';
|
|
123
|
+
import type { SizeType } from '../../types/global';
|
|
117
124
|
// 去除警告信息
|
|
118
125
|
schema.warning = function () {};
|
|
119
126
|
|
|
120
|
-
const { broadcast } = useParent('u-form-item');
|
|
121
|
-
|
|
122
127
|
/**
|
|
123
128
|
* form-item 表单item
|
|
124
129
|
* @description 此组件一般用于表单场景,可以配置Input输入框,Select弹出框,进行表单验证等。
|
|
@@ -143,6 +148,7 @@ const props = defineProps(FormItemProps);
|
|
|
143
148
|
// 插槽
|
|
144
149
|
const $slots = useSlots();
|
|
145
150
|
|
|
151
|
+
const { broadcast } = useParent('u-form-item');
|
|
146
152
|
const { parentExposed } = useChildren('u-form-item', 'u-form');
|
|
147
153
|
|
|
148
154
|
// 组件状态
|
|
@@ -168,6 +174,62 @@ const showError = computed(() => (type: string) => {
|
|
|
168
174
|
else return false;
|
|
169
175
|
});
|
|
170
176
|
|
|
177
|
+
// 根据 size 定义不同的配置
|
|
178
|
+
const sizeConfig = {
|
|
179
|
+
small: {
|
|
180
|
+
fontSize: 24,
|
|
181
|
+
iconSize: 28,
|
|
182
|
+
messageSize: 20
|
|
183
|
+
},
|
|
184
|
+
default: {
|
|
185
|
+
fontSize: 28,
|
|
186
|
+
iconSize: 32,
|
|
187
|
+
messageSize: 24
|
|
188
|
+
},
|
|
189
|
+
large: {
|
|
190
|
+
fontSize: 32,
|
|
191
|
+
iconSize: 36,
|
|
192
|
+
messageSize: 28
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
// 获取实际使用的 size 值(优先级:u-textarea.size > u-form.size)
|
|
197
|
+
const actualSize = computed(() => {
|
|
198
|
+
// 优先使用 props 的 size 属性
|
|
199
|
+
if (props.size !== '') {
|
|
200
|
+
return String(props.size);
|
|
201
|
+
}
|
|
202
|
+
// 次优先:使用 u-form 的 size 属性(u-form 的 size 只支持预设值)
|
|
203
|
+
if (parentExposed.value?.props?.size) {
|
|
204
|
+
return String(parentExposed.value.props.size);
|
|
205
|
+
}
|
|
206
|
+
// 默认值
|
|
207
|
+
return 'default';
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
// 判断实际使用的 size 是否在预设配置中
|
|
211
|
+
const isInSizeConfig = computed(() => actualSize.value in sizeConfig);
|
|
212
|
+
|
|
213
|
+
// 获取预设 size(用于查找 sizeConfig 配置,如图标大小、高度等)
|
|
214
|
+
const presetSize = computed(() => {
|
|
215
|
+
return (isInSizeConfig.value ? actualSize.value : 'default') as SizeType;
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
// 获取当前尺寸配置
|
|
219
|
+
const currentSizeConfig = computed(() => sizeConfig[presetSize.value]);
|
|
220
|
+
|
|
221
|
+
// 获取实际要使用的 font-size(如果是预设值使用配置值,否则作为自定义值处理)
|
|
222
|
+
const actualFontSize = computed(() => {
|
|
223
|
+
if (isInSizeConfig.value) {
|
|
224
|
+
return $u.addUnit(currentSizeConfig.value.fontSize);
|
|
225
|
+
}
|
|
226
|
+
// 自定义size值,直接作为fontSize处理
|
|
227
|
+
return $u.addUnit(actualSize.value);
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
// 计算当前图标大小
|
|
231
|
+
const currentIconSize = computed(() => currentSizeConfig.value.iconSize);
|
|
232
|
+
|
|
171
233
|
// 监听校验状态和父表单 errorType 变化
|
|
172
234
|
watch(validateState, () => {
|
|
173
235
|
broadcastInputError();
|
|
@@ -233,7 +295,7 @@ const elBorderBottom = computed(() => {
|
|
|
233
295
|
? props.borderBottom
|
|
234
296
|
: parentData.value.borderBottom
|
|
235
297
|
? parentData.value.borderBottom
|
|
236
|
-
:
|
|
298
|
+
: false;
|
|
237
299
|
});
|
|
238
300
|
|
|
239
301
|
// 事件派发/广播工具
|
|
@@ -394,7 +456,7 @@ onMounted(() => {
|
|
|
394
456
|
onBeforeUnmount(() => {
|
|
395
457
|
// 如果当前没有prop的话表示当前不要进行删除(因为没有注入)
|
|
396
458
|
if (parentExposed?.value && props.prop) {
|
|
397
|
-
parentExposed?.value?.removeField({ prop: props.prop });
|
|
459
|
+
parentExposed?.value?.removeField && parentExposed?.value?.removeField({ prop: props.prop });
|
|
398
460
|
}
|
|
399
461
|
});
|
|
400
462
|
|
|
@@ -446,6 +508,8 @@ defineExpose({
|
|
|
446
508
|
|
|
447
509
|
&__icon {
|
|
448
510
|
margin-right: 8rpx;
|
|
511
|
+
@include vue-flex;
|
|
512
|
+
align-items: center;
|
|
449
513
|
}
|
|
450
514
|
|
|
451
515
|
&--required {
|
|
@@ -474,16 +538,16 @@ defineExpose({
|
|
|
474
538
|
|
|
475
539
|
&__slot {
|
|
476
540
|
flex: 1;
|
|
477
|
-
/* #ifndef MP */
|
|
478
541
|
@include vue-flex;
|
|
479
542
|
align-items: center;
|
|
480
|
-
/* #endif */
|
|
481
543
|
}
|
|
482
544
|
|
|
483
545
|
&__icon {
|
|
484
546
|
margin-left: 10rpx;
|
|
485
547
|
color: $u-light-color;
|
|
486
548
|
font-size: 30rpx;
|
|
549
|
+
@include vue-flex;
|
|
550
|
+
align-items: center;
|
|
487
551
|
}
|
|
488
552
|
}
|
|
489
553
|
}
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
-
import { baseProps } from '../common/props';
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* u-full-screen 组件 Props 类型定义
|
|
6
5
|
* @description 用于APP弹窗遮盖导航栏和底部tabbar,提示新版本升级内容
|
|
7
6
|
*/
|
|
8
7
|
export const FullScreenProps = {
|
|
9
|
-
|
|
8
|
+
/** 自定义根节点样式 */
|
|
9
|
+
customStyle: {
|
|
10
|
+
type: [String, Object] as PropType<string | Record<string, any>>,
|
|
11
|
+
default: () => ({})
|
|
12
|
+
},
|
|
13
|
+
/** 自定义根节点样式类 */
|
|
14
|
+
customClass: {
|
|
15
|
+
type: String as unknown as PropType<string>,
|
|
16
|
+
default: ''
|
|
17
|
+
},
|
|
10
18
|
/** 是否显示弹窗 */
|
|
11
19
|
show: { type: Boolean, default: false },
|
|
12
20
|
/** 弹窗标题 */
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
-
import { baseProps } from '../common/props';
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* u-gap 组件 Props 类型定义
|
|
6
5
|
* @description 间隔槽组件属性
|
|
7
6
|
*/
|
|
8
7
|
export const GapProps = {
|
|
9
|
-
|
|
8
|
+
/** 自定义根节点样式 */
|
|
9
|
+
customStyle: {
|
|
10
|
+
type: [String, Object] as PropType<string | Record<string, any>>,
|
|
11
|
+
default: () => ({})
|
|
12
|
+
},
|
|
13
|
+
/** 自定义根节点样式类 */
|
|
14
|
+
customClass: {
|
|
15
|
+
type: String as unknown as PropType<string>,
|
|
16
|
+
default: ''
|
|
17
|
+
},
|
|
10
18
|
/** 背景颜色 */
|
|
11
19
|
bgColor: { type: String, default: 'transparent' },
|
|
12
20
|
/** 高度 */
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
2
|
import type { InputAlign } from '../../types/global';
|
|
3
|
-
import { baseProps } from '../common/props';
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* u-grid 组件 Props 类型定义
|
|
7
6
|
* @description 宫格组件属性
|
|
8
7
|
*/
|
|
9
8
|
export const GridProps = {
|
|
10
|
-
|
|
9
|
+
/** 自定义根节点样式 */
|
|
10
|
+
customStyle: {
|
|
11
|
+
type: [String, Object] as PropType<string | Record<string, any>>,
|
|
12
|
+
default: () => ({})
|
|
13
|
+
},
|
|
14
|
+
/** 自定义根节点样式类 */
|
|
15
|
+
customClass: {
|
|
16
|
+
type: String as unknown as PropType<string>,
|
|
17
|
+
default: ''
|
|
18
|
+
},
|
|
11
19
|
/** 分成几列 */
|
|
12
20
|
col: { type: [Number, String] as PropType<string | number>, default: 3 },
|
|
13
21
|
/** 是否显示边框 */
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
-
import { baseProps } from '../common/props';
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* u-grid-item 组件 Props 类型定义
|
|
6
5
|
* @description 宫格项组件属性
|
|
7
6
|
*/
|
|
8
7
|
export const GridItemProps = {
|
|
9
|
-
|
|
8
|
+
/** 自定义根节点样式 */
|
|
9
|
+
customStyle: {
|
|
10
|
+
type: [String, Object] as PropType<string | Record<string, any>>,
|
|
11
|
+
default: () => ({})
|
|
12
|
+
},
|
|
13
|
+
/** 自定义根节点样式类 */
|
|
14
|
+
customClass: {
|
|
15
|
+
type: String as unknown as PropType<string>,
|
|
16
|
+
default: ''
|
|
17
|
+
},
|
|
10
18
|
/** 背景颜色 */
|
|
11
19
|
bgColor: { type: String, default: 'var(--u-bg-white)' },
|
|
12
20
|
/** 点击时返回的index */
|