hy-app 0.5.4 → 0.5.6

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.
Files changed (115) hide show
  1. package/components/hy-action-sheet/typing.d.ts +1 -63
  2. package/components/hy-address-picker/hy-address-picker.vue +7 -6
  3. package/components/hy-address-picker/typing.d.ts +0 -84
  4. package/components/hy-avatar/typing.d.ts +0 -66
  5. package/components/hy-back-top/props.ts +2 -3
  6. package/components/hy-back-top/typing.d.ts +0 -47
  7. package/components/hy-badge/props.ts +1 -1
  8. package/components/hy-badge/typing.d.ts +3 -60
  9. package/components/hy-button/props.ts +1 -1
  10. package/components/hy-button/typing.d.ts +28 -162
  11. package/components/hy-calendar/hy-calendar.vue +2 -2
  12. package/components/hy-calendar/typing.d.ts +0 -128
  13. package/components/hy-card/hy-card.vue +14 -13
  14. package/components/hy-card/props.ts +4 -6
  15. package/components/hy-card/typing.d.ts +1 -114
  16. package/components/hy-cell/hy-cell.vue +9 -190
  17. package/components/hy-cell/props.ts +7 -26
  18. package/components/hy-cell/typing.d.ts +2 -96
  19. package/components/hy-cell-item/hy-cell-item.vue +160 -0
  20. package/components/hy-cell-item/index.scss +100 -0
  21. package/components/hy-cell-item/props.ts +66 -0
  22. package/components/hy-cell-item/typing.d.ts +7 -0
  23. package/components/hy-check-button/typing.d.ts +0 -43
  24. package/components/hy-checkbox/typing.d.ts +1 -73
  25. package/components/hy-checkbox-group/props.ts +1 -1
  26. package/components/hy-checkbox-group/typing.d.ts +0 -65
  27. package/components/hy-checkbox-item/typing.d.ts +3 -3
  28. package/components/hy-code-input/typing.d.ts +0 -70
  29. package/components/hy-count-down/typing.d.ts +1 -20
  30. package/components/hy-count-to/typing.d.ts +0 -47
  31. package/components/hy-coupon/typing.d.ts +0 -133
  32. package/components/hy-datetime-picker/typing.d.ts +0 -119
  33. package/components/hy-dropdown-item/typing.d.ts +12 -31
  34. package/components/hy-empty/typing.d.ts +1 -59
  35. package/components/hy-float-button/typing.d.ts +24 -113
  36. package/components/hy-form/typing.d.ts +0 -27
  37. package/components/hy-form-item/hy-form-item.vue +7 -5
  38. package/components/hy-form-item/typing.d.ts +0 -19
  39. package/components/hy-grid/props.ts +1 -1
  40. package/components/hy-grid/typing.d.ts +1 -45
  41. package/components/hy-icon/props.ts +1 -1
  42. package/components/hy-icon/typing.d.ts +3 -84
  43. package/components/hy-image/typing.d.ts +0 -80
  44. package/components/hy-input/hy-input.vue +19 -22
  45. package/components/hy-input/props.ts +1 -1
  46. package/components/hy-input/typing.d.ts +0 -149
  47. package/components/hy-list/typing.d.ts +0 -51
  48. package/components/hy-menu/props.ts +2 -2
  49. package/components/hy-menu/typing.d.ts +0 -35
  50. package/components/hy-modal/typing.d.ts +9 -84
  51. package/components/hy-navbar/typing.d.ts +0 -81
  52. package/components/hy-notice-bar/typing.d.ts +0 -65
  53. package/components/hy-number-step/props.ts +1 -1
  54. package/components/hy-number-step/typing.d.ts +0 -110
  55. package/components/hy-overlay/typing.d.ts +2 -27
  56. package/components/hy-pagination/typing.d.ts +6 -49
  57. package/components/hy-picker/typing.d.ts +27 -124
  58. package/components/hy-popover/typing.d.ts +25 -66
  59. package/components/hy-popup/typing.d.ts +8 -77
  60. package/components/hy-price/hy-price.vue +9 -2
  61. package/components/hy-price/typing.d.ts +0 -41
  62. package/components/hy-qrcode/hy-qrcode.vue +3 -4
  63. package/components/hy-qrcode/index.scss +3 -3
  64. package/components/hy-qrcode/qrcode.js +0 -138
  65. package/components/hy-qrcode/typing.d.ts +0 -66
  66. package/components/hy-radio/typing.d.ts +1 -86
  67. package/components/hy-rate/typing.d.ts +0 -62
  68. package/components/hy-read-more/typing.d.ts +4 -49
  69. package/components/hy-scroll-list/typing.d.ts +4 -33
  70. package/components/hy-search/props.ts +1 -2
  71. package/components/hy-search/typing.d.ts +19 -120
  72. package/components/hy-signature/typing.d.ts +0 -101
  73. package/components/hy-slider/typing.d.ts +8 -77
  74. package/components/hy-steps/typing.d.ts +16 -60
  75. package/components/hy-submit-bar/typing.d.ts +0 -72
  76. package/components/hy-subsection/typing.d.ts +0 -49
  77. package/components/hy-swipe-action/index.ts +13 -22
  78. package/components/hy-swipe-action/typing.d.ts +1 -38
  79. package/components/hy-swiper/typing.d.ts +0 -101
  80. package/components/hy-switch/props.ts +1 -1
  81. package/components/hy-switch/typing.d.ts +0 -62
  82. package/components/hy-tabbar/index.scss +1 -1
  83. package/components/hy-tabbar/props.ts +1 -1
  84. package/components/hy-tabbar/typing.d.ts +0 -40
  85. package/components/hy-tabbar-group/props.ts +1 -1
  86. package/components/hy-tabbar-item/typing.ts +0 -12
  87. package/components/hy-tabs/props.ts +1 -1
  88. package/components/hy-tabs/typing.d.ts +25 -92
  89. package/components/hy-tag/props.ts +1 -1
  90. package/components/hy-tag/typing.d.ts +9 -78
  91. package/components/hy-text/typing.d.ts +3 -100
  92. package/components/hy-textarea/typing.d.ts +0 -27
  93. package/components/hy-tooltip/props.ts +0 -1
  94. package/components/hy-tooltip/typing.d.ts +2 -55
  95. package/components/hy-transition/typing.d.ts +14 -43
  96. package/components/hy-upload/typing.d.ts +56 -164
  97. package/components/hy-warn/typing.d.ts +4 -45
  98. package/global.d.ts +1 -0
  99. package/libs/css/theme.scss +1 -1
  100. package/package.json +2 -2
  101. package/web-types.json +1 -1
  102. package/components/hy-card/index.scss +0 -57
  103. package/components/hy-cell/index.scss +0 -136
  104. package/components/hy-config-provider/typing.d.ts +0 -24
  105. package/components/hy-divider/typing.d.ts +0 -64
  106. package/components/hy-dropdown/typing.d.ts +0 -48
  107. package/components/hy-form-group/typing.d.ts +0 -0
  108. package/components/hy-line/typing.d.ts +0 -32
  109. package/components/hy-line-progress/typing.d.ts +0 -32
  110. package/components/hy-loading/typing.d.ts +0 -52
  111. package/components/hy-notify/typing.d.ts +0 -48
  112. package/components/hy-status-bar/typing.d.ts +0 -12
  113. package/components/hy-tabbar-group/README.md +0 -326
  114. package/components/hy-waterfall/typing.d.ts +0 -14
  115. package/components/hy-watermark/typing.d.ts +0 -76
@@ -1,131 +1,3 @@
1
- export default interface HyCalendarProps {
2
- /**
3
- * @description 是否显示日历弹窗 (默认 false )
4
- * */
5
- show: boolean
6
- /**
7
- * @description 标题内容 (默认 日期选择 )
8
- * */
9
- title?: string
10
-
11
- /**
12
- * @description 是否显示标题 (默认 true )
13
- * */
14
- showTitle?: boolean
15
- /**
16
- * @description 是否显示副标题 (默认 true )
17
- * */
18
- showSubtitle?: boolean
19
- /**
20
- * @description 日期类型选择 single-选择单个日期,multiple-可以选择多个日期,range-选择日期范围 ( 默认 'single' )
21
- * */
22
- mode?: 'single' | 'range' | 'multiple'
23
- /**
24
- * @description mode=range时,第一个日期底部的提示文字 (默认 '开始' )
25
- * */
26
- startText?: string
27
- /**
28
- * @description mode=range时,最后一个日期底部的提示文字 (默认 '结束' )
29
- * */
30
- endText?: string
31
- /**
32
- * @description 自定义列表
33
- * */
34
- customList?: any[]
35
- /**
36
- * @description 主题色,对底部按钮和选中日期有效 (默认 ‘#3c9cff' )
37
- * */
38
- color?: string
39
- /**
40
- * @description 最小的可选日期 (默认 0 )
41
- * */
42
- minDate?: number | string
43
- /**
44
- * @description 最大可选日期 (默认 0 )
45
- * */
46
- maxDate?: number | string
47
- /**
48
- * @description 默认选中的日期,mode为multiple或range是必须为数组格式
49
- * */
50
- defaultDate?: Date | string | string[] | null
51
- /**
52
- * @description mode=multiple时,最多可选多少个日期 (默认 Number.MAX_SAFE_INTEGER )
53
- * */
54
- maxCount?: number
55
- /**
56
- * @description 日期行高 (默认 56 )
57
- * */
58
- rowHeight?: number
59
- /**
60
- * @description 日期格式化函数
61
- * */
62
- formatter?: ((date: Date) => string) | null
63
- /**
64
- * @description 是否显示农历 (默认 false )
65
- * */
66
- showLunar?: boolean
67
- /**
68
- * @description 是否显示月份背景色 (默认 true )
69
- * */
70
- showMark?: boolean
71
- /**
72
- * @description 确定按钮的文字 (默认 '确定' )
73
- * */
74
- confirmText?: string
75
- /**
76
- * @description 确认按钮处于禁用状态时的文字 (默认 '确定' )
77
- * */
78
- confirmDisabledText?: string
79
- /**
80
- * @description 是否允许点击遮罩关闭日历 (默认 false )
81
- * */
82
- closeOnClickOverlay?: boolean
83
- /**
84
- * @description 是否为只读状态,只读状态下禁止选择日期 (默认 false )
85
- * */
86
- readonly?: boolean
87
- /**
88
- * @description 是否展示确认按钮
89
- * */
90
- showConfirm?: boolean
91
- /**
92
- * @description 日期区间最多可选天数,默认无限制,mode = range时有效
93
- * */
94
- maxRange?: number
95
- /**
96
- * @description 范围选择超过最多可选天数时的提示文案,mode = range时有效
97
- * */
98
- rangePrompt?: string | null
99
- /**
100
- * @description 范围选择超过最多可选天数时,是否展示提示文案,mode = range时有效 (默认 true )
101
- * */
102
- showRangePrompt?: boolean
103
- /**
104
- * @description 是否允许日期范围的起止时间为同一天,mode = range时有效 (默认 false )
105
- * */
106
- allowSameDay?: boolean
107
- /**
108
- * @description 圆角值,默认无圆角 (默认 0 )
109
- * */
110
- round?: number
111
- /**
112
- * @description 最多展示的月份数量 (默认 3 )
113
- * */
114
- monthNum?: number
115
- /**
116
- * @description 星期文案 (默认 ['一', '二', '三', '四', '五', '六', '日'] )
117
- * */
118
- weekText?: string[]
119
- /**
120
- * @description 单选与多选禁止选中的日期列表,mode!=range时有效。
121
- * */
122
- forbidDays?: Date[]
123
- /**
124
- * @description 单选与多选禁止选中的日期选择时提示
125
- * */
126
- forbidDaysToast?: string
127
- }
128
-
129
1
  export interface ICalendarEmits {
130
2
  /** 日期选择完成后触发,则点击确认按钮后触发 */
131
3
  (e: 'confirm', selected: string[]): void
@@ -2,8 +2,8 @@
2
2
  <view class="hy-card" @tap.stop="click" :class="cardClass" :style="cardStyle">
3
3
  <view
4
4
  v-if="showHead"
5
- class="hy-card--head"
6
- :style="[{ padding: addUnit(paddingHead || padding) }, headStyle]"
5
+ class="hy-card__head"
6
+ :style="[{ padding: paddingHead || padding }, headStyle]"
7
7
  :class="{
8
8
  'hy-border__bottom': headBorderBottom
9
9
  }"
@@ -11,12 +11,12 @@
11
11
  >
12
12
  <!-- @slot 头部插槽 -->
13
13
  <slot v-if="$slots.header" name="header" />
14
- <view v-else class="hy-card--head__flex">
15
- <view class="hy-card--head__left">
14
+ <view v-else class="hy-card__head--flex">
15
+ <view class="hy-card__head--left">
16
16
  <hy-icon
17
17
  v-if="thumb"
18
18
  :name="thumb"
19
- custom-class="hy-card--head__left__thumb"
19
+ custom-class="hy-card__head--left__thumb"
20
20
  :height="thumbWidth"
21
21
  :width="thumbWidth"
22
22
  :round="thumbCircle ? '50%' : '4px'"
@@ -24,7 +24,7 @@
24
24
  <view>
25
25
  <view
26
26
  v-if="title"
27
- class="hy-card--head__left__title"
27
+ class="hy-card__head--left__title"
28
28
  :style="{
29
29
  fontSize: addUnit(titleSize),
30
30
  color: titleColor
@@ -34,7 +34,7 @@
34
34
  </view>
35
35
  <text
36
36
  v-if="subTitle"
37
- class="hy-card--head__left__sub"
37
+ class="hy-card__head--left__sub"
38
38
  :style="{
39
39
  fontSize: addUnit(subTitleSize),
40
40
  color: subTitleColor
@@ -44,9 +44,9 @@
44
44
  </text>
45
45
  </view>
46
46
  </view>
47
- <view class="hy-card--head__right" v-if="subTitle">
47
+ <view class="hy-card__head--right" v-if="subTitle">
48
48
  <text
49
- class="hy-card--head__right__text"
49
+ class="hy-card__head--right__text"
50
50
  :style="{
51
51
  fontSize: addUnit(rightTextSize),
52
52
  color: rightTextColor
@@ -60,7 +60,7 @@
60
60
  <view
61
61
  @tap="bodyClick"
62
62
  class="hy-card__body"
63
- :style="[{ padding: addUnit(paddingBody || padding) }, bodyStyle]"
63
+ :style="[{ padding: paddingBody || padding }, bodyStyle]"
64
64
  >
65
65
  <!-- @slot 中间内容插槽 -->
66
66
  <slot name="body" />
@@ -69,7 +69,7 @@
69
69
  v-if="showFoot"
70
70
  class="hy-card__foot"
71
71
  @tap="footClick"
72
- :style="[{ padding: $slots.footer ? addUnit(paddingFoot || padding) : 0 }, footStyle]"
72
+ :style="[{ padding: $slots.footer ? paddingFoot || padding : 0 }, footStyle]"
73
73
  :class="{
74
74
  'hy-border__top': footBorderTop
75
75
  }"
@@ -113,8 +113,9 @@ const cardClass = computed(() => {
113
113
  const hasBorder = getPx(props.borderRadius) > 0
114
114
  return [
115
115
  props.border && 'hy-border',
116
- props.full && 'hy-card--full',
117
- hasBorder && 'hy-card--border'
116
+ props.full && 'hy-card__full',
117
+ hasBorder && 'hy-card--border',
118
+ props.customClass
118
119
  ].filter(Boolean)
119
120
  })
120
121
  const cardStyle = computed(() => {
@@ -84,8 +84,7 @@ const cardProps = {
84
84
  },
85
85
  /** 给head,body,foot的内边距 */
86
86
  padding: {
87
- type: [String, Number],
88
- default: 15
87
+ type: [String, Number]
89
88
  },
90
89
  /** 头部内边距 */
91
90
  paddingHead: [String, Number],
@@ -115,10 +114,9 @@ const cardProps = {
115
114
  /** 底部自定义样式 */
116
115
  footStyle: Object as PropType<CSSProperties>,
117
116
  /** 定义需要用到的外部样式 */
118
- customStyle: {
119
- type: Object as PropType<CSSProperties>,
120
- default: () => {}
121
- }
117
+ customStyle: Object as PropType<CSSProperties>,
118
+ /** 自定义外部类名 */
119
+ customClass: String
122
120
  }
123
121
 
124
122
  export default cardProps
@@ -1,118 +1,5 @@
1
- import type { CSSProperties } from 'vue'
2
-
3
- export default interface HyCardProps {
4
- /**
5
- * @description 卡片与屏幕两侧是否留空隙(默认false)
6
- * */
7
- full?: boolean
8
-
9
- /**
10
- * @description 头部左边的标题
11
- * */
12
- title?: string
13
- /**
14
- * @description 标题颜色(默认#303133)
15
- * */
16
- titleColor?: string
17
- /**
18
- * @description 标题字体大小,单位rpx(默认15px)
19
- * */
20
- titleSize?: string | number
21
- /**
22
- * @description 头部右边的副标题
23
- * */
24
- subTitle?: string
25
- /**
26
- * @description 副标题颜色(默认#909399)
27
- * */
28
- subTitleColor?: string
29
- /**
30
- * @description 副标题字体大小(默认13px)
31
- * */
32
- subTitleSize?: string | number
33
- /**
34
- * @description 是否显示边框(默认true)
35
- * */
36
- border?: boolean
37
- /**
38
- * @description 用于标识点击了第几个卡片
39
- * */
40
- index?: string | number
41
- /**
42
- * @description 卡片与屏幕两边和上下元素的间距,需带单位,如"30px 20px"(默认15px)
43
- * */
44
- margin?: string
45
- /**
46
- * @description 卡片整体的圆角值,单位px(默认8px)
47
- * */
48
- borderRadius?: string | number
49
- /**
50
- * @description 头部自定义样式,对象形式
51
- * */
52
- headStyle?: CSSProperties
53
- /**
54
- * @description 中部自定义样式,对象形式
55
- * */
56
- bodyStyle?: CSSProperties
57
- /**
58
- * @description 底部自定义样式,对象形式
59
- * */
60
- footStyle?: CSSProperties
61
- /**
62
- * @description 是否显示头部的下边框(默认true)
63
- * */
64
- headBorderBottom?: boolean
65
- /**
66
- * @description 是否显示底部的上边框(默认true)
67
- * */
68
- footBorderTop?: boolean
69
- /**
70
- * @description 缩略图路径,如设置将显示在标题的左边,不建议使用相对路径
71
- * */
72
- thumb?: string
73
- /**
74
- * @description 缩略图的宽度,高等于宽,单位px(默认30px)
75
- * */
76
- thumbWidth?: string | number
77
- /**
78
- * @description 缩略图是否为圆形(默认false)
79
- * */
80
- thumbCircle?: boolean
81
- /**
82
- * @description // 给head,body,foot的内边距
83
- * */
84
- padding?: string | number
85
- /**
86
- * @description 头部内边距
87
- * */
88
- paddingHead?: string | number
89
- /**
90
- * @description 中部内边距
91
- * */
92
- paddingBody?: string | number
93
- /**
94
- * @description 尾部内边距
95
- * */
96
- paddingFoot?: string | number
97
- /**
98
- * @description 是否显示头部(默认true)
99
- * */
100
- showHead?: boolean
101
- /**
102
- * @description 是否显示尾部(默认true)
103
- * */
104
- showFoot?: boolean
105
- /**
106
- * @description 卡片外围阴影,字符串形式(默认true)
107
- * */
108
- boxShadow?: string | boolean
109
- /**
110
- * @description 定义需要用到的外部样式
111
- * */
112
- customStyle?: CSSProperties
113
- }
114
-
115
1
  type IndexVo = string | number | undefined
2
+
116
3
  export interface ICardEmits {
117
4
  /** 整个卡片任意位置被点击时触发 */
118
5
  (e: 'click', index: IndexVo): void
@@ -1,137 +1,6 @@
1
1
  <template>
2
- <view :style="customStyle" class="hy-cell">
3
- <view
4
- :class="['hy-cell--title', showVertical && 'hy-cell--title__vertical']"
5
- v-if="title || $slots['title']"
6
- >
7
- <!-- @slot 标题插槽 -->
8
- <slot v-if="$slots.title" name="title" :title="title"></slot>
9
- <text v-else class="hy-cell--title__text">{{ title }}</text>
10
- </view>
11
- <view class="hy-cell__body" :style="{ 'border-radius': addUnit(borderRadius) }">
12
- <!-- @slot 整体插槽 -->
13
- <slot v-if="$slots.default"></slot>
14
- <template v-else v-for="(item, i) in list" :key="i">
15
- <view
16
- :class="ItemClass"
17
- :hover-class="containerClass(item)"
18
- :hover-stay-time="250"
19
- :style="{
20
- borderBottom: border && i !== list.length - 1 ? '1rpx solid #c8c7cc66' : ''
21
- }"
22
- @tap="clickHandler($event, item, i)"
23
- >
24
- <view class="hy-cell__body--container__content">
25
- <view
26
- v-if="item?.icon?.name || $slots.icon"
27
- class="hy-cell__body--container__content--icon"
28
- >
29
- <!-- @slot 图标插槽 -->
30
- <slot v-if="$slots.icon" name="icon" :icon="item?.icon"></slot>
31
- <HyIcon
32
- v-else
33
- :size="iconSize"
34
- :name="item?.icon?.name"
35
- :color="disabled || item?.disabled ? '#c0c0c0' : item?.icon?.color"
36
- :bold="item?.icon?.bold"
37
- :customPrefix="item?.icon?.customPrefix"
38
- :imgMode="item?.icon?.imgMode"
39
- :width="item?.icon?.width"
40
- :height="item?.icon?.height"
41
- :top="item?.icon?.top"
42
- :stop="item?.icon?.stop"
43
- :round="item?.icon?.round"
44
- :customStyle="item?.icon?.customStyle"
45
- ></HyIcon>
46
- </view>
47
- <view class="hy-cell__body--container__content--title">
48
- <!-- 将slot与默认内容用if/else分开主要是因为微信小程序不支持slot嵌套传递,这样才能解决collapse组件的slot不失效问题,label暂时未用到。 -->
49
- <!-- @slot 列表标题插槽 -->
50
- <slot
51
- v-if="$slots['cell-title']"
52
- name="cell-title"
53
- :title="item?.title"
54
- ></slot>
55
- <text
56
- v-else
57
- class="hy-cell__body--container__content--title__text"
58
- :class="[(disabled || item?.disabled) && 'hy-cell__disabled']"
59
- >
60
- {{ item?.title }}
61
- </text>
62
- <!-- @slot 列表小标题插槽 -->
63
- <template v-if="item?.subhead">
64
- <slot v-if="$slots.sub" name="sub" :sub="item.subhead"></slot>
65
- <text
66
- v-else
67
- class="hy-cell__body--container__content--title__sub"
68
- :class="[disabled && 'hy-cell__disabled']"
69
- >
70
- {{ item.subhead }}
71
- </text>
72
- </template>
73
- </view>
74
- </view>
75
- <view
76
- class="hy-cell__body--container__center"
77
- :style="{
78
- justifyContent:
79
- arrange === 'left'
80
- ? 'flex-start'
81
- : arrange === 'right'
82
- ? 'flex-end'
83
- : 'center'
84
- }"
85
- >
86
- <!-- @slot 值内容插槽 -->
87
- <slot v-if="$slots.value" name="value" :record="item"></slot>
88
- <text
89
- v-else-if="value || item?.value"
90
- :class="[
91
- 'hy-cell__body__container__center--value',
92
- disabled && 'hy-cell--disabled'
93
- ]"
94
- >
95
- {{ item.value || value }}
96
- </text>
97
- </view>
98
- <view
99
- class="hy-cell__body--container__right-icon"
100
- :class="[
101
- `hy-cell__body--container__right-icon--${item?.arrowDirection || arrowDirection}`
102
- ]"
103
- >
104
- <!-- @slot 右边按钮插槽 -->
105
- <slot
106
- v-if="$slots['right-icon']"
107
- name="right-icon"
108
- :icon="item?.rightIcon || rightIcon"
109
- ></slot>
110
- <HyIcon
111
- v-else
112
- :name="item?.rightIcon?.name || rightIcon?.name || IconConfig.RIGHT"
113
- :color="
114
- disabled || item?.disabled
115
- ? '#c0c0c0'
116
- : item?.rightIcon?.color || rightIcon?.color
117
- "
118
- :bold="item?.rightIcon?.bold || rightIcon?.bold"
119
- :customPrefix="item?.rightIcon?.customPrefix || rightIcon?.customPrefix"
120
- :imgMode="item?.rightIcon?.imgMode || rightIcon?.imgMode"
121
- :width="item?.rightIcon?.width || rightIcon?.width"
122
- :height="item?.rightIcon?.height || rightIcon?.height"
123
- :top="item?.rightIcon?.top || rightIcon?.name"
124
- :stop="item?.rightIcon?.stop || rightIcon?.stop"
125
- :round="item?.rightIcon?.round || rightIcon?.round"
126
- :customStyle="item?.rightIcon?.customStyle || rightIcon?.customStyle"
127
- ></HyIcon>
128
- </view>
129
- </view>
130
-
131
- <!-- @slot 底部插槽 -->
132
- <slot name="bottom" :record="item" />
133
- </template>
134
- </view>
2
+ <view :class="['hy-cell', customClass]" :style="customStyle">
3
+ <slot></slot>
135
4
  </view>
136
5
  </template>
137
6
 
@@ -146,69 +15,19 @@ export default {
146
15
  </script>
147
16
 
148
17
  <script setup lang="ts">
149
- import { computed } from 'vue'
150
- import type { ICellEmits } from './typing'
151
- import type { CellContentVo } from './typing'
152
- import { IconConfig, addUnit } from '../../libs'
18
+ import { provide, toRefs } from 'vue'
153
19
  import cellProps from './props'
154
- // 组件
155
- import HyIcon from '../hy-icon/hy-icon.vue'
156
-
157
- /**
158
- * cell单元格一般用于一组列表的情况,比如个人中心页,设置页等
159
- * @displayName hy-cell
160
- */
161
- defineOptions({})
20
+ import type { ICellEmits } from './typing'
162
21
 
163
- // const props = withDefaults(defineProps<IProps>(), defaultProps);
164
22
  const props = defineProps(cellProps)
165
23
  const emit = defineEmits<ICellEmits>()
166
24
 
167
- /**
168
- * @description 计算什么时候出现点击状态
169
- * */
170
- const containerClass = computed(() => {
171
- return (temp: CellContentVo): string => {
172
- return [
173
- !props.disabled &&
174
- !temp?.disabled &&
175
- props.clickable &&
176
- 'hy-cell__body--container__clickable'
177
- ]
178
- .filter(Boolean)
179
- .join()
25
+ provide('hy-cell', {
26
+ ...toRefs(props),
27
+ onClick: (name: string | number) => {
28
+ emit('click', name)
180
29
  }
181
30
  })
182
- const ItemClass = computed(() => {
183
- return ['hy-cell__body--container', `hy-cell__body--container__${props.size}`]
184
- })
185
-
186
- const iconSize = computed(() => {
187
- switch (props.size) {
188
- case 'large':
189
- return 25
190
- case 'medium':
191
- return 20
192
- case 'small':
193
- return 15
194
- }
195
- })
196
-
197
- /**
198
- * @description 点击cell
199
- * */
200
- const clickHandler = (e: Event, temp: CellContentVo, index: number) => {
201
- if (props.disabled) return
202
- emit('click', temp, index)
203
- if (temp?.url) {
204
- uni.navigateTo({
205
- url: temp.url
206
- })
207
- }
208
- e.stopPropagation()
209
- }
210
31
  </script>
211
32
 
212
- <style lang="scss" scoped>
213
- @import './index.scss';
214
- </style>
33
+ <style lang="scss" scoped></style>
@@ -1,31 +1,11 @@
1
- import type { CellContentVo } from './typing'
2
1
  import type { CSSProperties, PropType } from 'vue'
3
- import type HyIconProps from '@/package/components/hy-icon/typing'
4
2
 
5
3
  const cellProps = {
6
- /** cell列表数据 */
7
- list: {
8
- type: Array as PropType<Array<CellContentVo>>,
9
- default: () => [],
10
- required: true
11
- },
12
- /** 头部标题 */
13
- title: String,
14
- /** 是否显示标题前缀竖线 */
15
- showVertical: {
16
- type: Boolean,
17
- default: true
18
- },
19
4
  /** 是否显示cell下边框 */
20
5
  border: {
21
6
  type: Boolean,
22
7
  default: true
23
8
  },
24
- /** 圆角 */
25
- borderRadius: {
26
- type: [String, Number],
27
- default: '5px'
28
- },
29
9
  /** 是否禁用cell */
30
10
  disabled: {
31
11
  type: Boolean,
@@ -44,8 +24,6 @@ const cellProps = {
44
24
  type: [String, Number],
45
25
  default: 'medium'
46
26
  },
47
- /** 右侧的内容 */
48
- value: String,
49
27
  /**
50
28
  * 内容是否垂直居中(主要是针对右侧的value部分)
51
29
  * @values left,center,right
@@ -54,9 +32,10 @@ const cellProps = {
54
32
  type: String,
55
33
  default: 'right'
56
34
  },
57
- /** cell列表数据 */
58
- rightIcon: {
59
- type: Object as PropType<HyIconProps>
35
+ /** 是否展示右侧图标 */
36
+ isRightIcon: {
37
+ type: Boolean,
38
+ default: true
60
39
  },
61
40
  /**
62
41
  * 右侧箭头的方向
@@ -67,7 +46,9 @@ const cellProps = {
67
46
  default: 'right'
68
47
  },
69
48
  /** 定义需要用到的外部样式 */
70
- customStyle: Object as PropType<CSSProperties>
49
+ customStyle: Object as PropType<CSSProperties>,
50
+ /** 自定义外部类名 */
51
+ customClass: String
71
52
  }
72
53
 
73
54
  export default cellProps