oxy-uni-ui 1.2.3 → 2.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.
Files changed (235) hide show
  1. package/attributes.json +1 -1
  2. package/components/common/abstracts/variable.scss +353 -328
  3. package/components/common/util.ts +185 -32
  4. package/components/composables/index.ts +1 -0
  5. package/components/composables/usePopover.ts +24 -20
  6. package/components/composables/useVirtualScroll.ts +10 -9
  7. package/components/composables/useWindowResize.ts +35 -0
  8. package/components/oxy-action-sheet/index.scss +24 -11
  9. package/components/oxy-action-sheet/oxy-action-sheet.vue +27 -19
  10. package/components/oxy-action-sheet/types.ts +7 -0
  11. package/components/oxy-backtop/index.scss +3 -3
  12. package/components/oxy-backtop/oxy-backtop.vue +9 -6
  13. package/components/oxy-backtop/types.ts +7 -7
  14. package/components/oxy-badge/index.scss +4 -4
  15. package/components/oxy-badge/oxy-badge.vue +3 -3
  16. package/components/oxy-badge/types.ts +2 -2
  17. package/components/oxy-button/index.scss +5 -5
  18. package/components/oxy-button/oxy-button.vue +5 -1
  19. package/components/oxy-calendar/index.scss +11 -11
  20. package/components/oxy-calendar/oxy-calendar.vue +1 -0
  21. package/components/oxy-calendar/types.ts +5 -0
  22. package/components/oxy-calendar-view/month/index.scss +4 -4
  23. package/components/oxy-calendar-view/month/types.ts +36 -0
  24. package/components/oxy-calendar-view/monthPanel/index.scss +7 -7
  25. package/components/oxy-calendar-view/monthPanel/month-panel.vue +14 -8
  26. package/components/oxy-calendar-view/year/index.scss +4 -4
  27. package/components/oxy-calendar-view/yearPanel/index.scss +4 -4
  28. package/components/oxy-calendar-view/yearPanel/year-panel.vue +21 -5
  29. package/components/oxy-card/index.scss +2 -2
  30. package/components/oxy-cell/index.scss +8 -8
  31. package/components/oxy-checkbox/index.scss +7 -7
  32. package/components/oxy-checkbox-group/index.scss +2 -2
  33. package/components/oxy-circle/oxy-circle.vue +10 -7
  34. package/components/oxy-circle/types.ts +5 -5
  35. package/components/oxy-col/oxy-col.vue +2 -2
  36. package/components/oxy-col-picker/index.scss +4 -4
  37. package/components/oxy-col-picker/oxy-col-picker.vue +6 -5
  38. package/components/oxy-col-picker/types.ts +7 -2
  39. package/components/oxy-collapse/index.scss +2 -2
  40. package/components/oxy-collapse-item/oxy-collapse-item.vue +3 -3
  41. package/components/oxy-corner/index.scss +32 -32
  42. package/components/oxy-count-to/oxy-count-to.vue +3 -3
  43. package/components/oxy-curtain/index.scss +15 -15
  44. package/components/oxy-curtain/oxy-curtain.vue +4 -2
  45. package/components/oxy-curtain/types.ts +6 -1
  46. package/components/oxy-date-strip/oxy-date-strip.vue +2 -2
  47. package/components/oxy-date-strip/types.ts +1 -1
  48. package/components/oxy-date-strip-item/index.scss +3 -3
  49. package/components/oxy-datetime-picker/index.scss +11 -11
  50. package/components/oxy-datetime-picker/oxy-datetime-picker.vue +1 -0
  51. package/components/oxy-datetime-picker/types.ts +5 -0
  52. package/components/oxy-drop-menu/index.scss +3 -3
  53. package/components/oxy-drop-menu/oxy-drop-menu.vue +3 -3
  54. package/components/oxy-drop-menu-item/index.scss +1 -1
  55. package/components/oxy-drop-menu-item/oxy-drop-menu-item.vue +4 -3
  56. package/components/oxy-drop-menu-item/types.ts +5 -0
  57. package/components/oxy-echarts/types.ts +6 -0
  58. package/components/oxy-fab/index.scss +8 -8
  59. package/components/oxy-fab/oxy-fab.vue +22 -3
  60. package/components/oxy-file-list/index.scss +24 -23
  61. package/components/oxy-file-list/oxy-file-list.vue +2 -2
  62. package/components/oxy-floating-panel/oxy-floating-panel.vue +13 -9
  63. package/components/oxy-floating-panel/{type.ts → types.ts} +8 -8
  64. package/components/oxy-footer/index.scss +19 -0
  65. package/components/oxy-footer/oxy-footer.vue +78 -0
  66. package/components/oxy-footer/types.ts +17 -0
  67. package/components/oxy-form-item/types.ts +22 -1
  68. package/components/oxy-gap/oxy-gap.vue +2 -2
  69. package/components/oxy-gap/types.ts +2 -2
  70. package/components/oxy-grid/oxy-grid.vue +1 -1
  71. package/components/oxy-grid/types.ts +1 -1
  72. package/components/oxy-grid-item/index.scss +1 -1
  73. package/components/oxy-grid-item/oxy-grid-item.vue +7 -5
  74. package/components/oxy-grid-item/types.ts +1 -1
  75. package/components/oxy-guidance/index.scss +75 -0
  76. package/components/oxy-guidance/oxy-guidance.vue +201 -0
  77. package/components/oxy-guidance/types.ts +33 -0
  78. package/components/oxy-icon/oxy-icon.vue +2 -2
  79. package/components/oxy-icon/types.ts +1 -1
  80. package/components/oxy-img/oxy-img.vue +4 -4
  81. package/components/oxy-img/types.ts +3 -3
  82. package/components/oxy-img-cropper/index.scss +12 -12
  83. package/components/oxy-img-cropper/oxy-img-cropper.vue +97 -52
  84. package/components/oxy-img-cropper/types.ts +2 -2
  85. package/components/oxy-img-lazy/oxy-img-lazy.vue +3 -3
  86. package/components/oxy-img-lazy/types.ts +3 -3
  87. package/components/oxy-index-anchor/index.scss +2 -2
  88. package/components/oxy-index-anchor/oxy-index-anchor.vue +2 -2
  89. package/components/oxy-index-anchor/{type.ts → types.ts} +3 -0
  90. package/components/oxy-index-bar/index.scss +3 -3
  91. package/components/oxy-index-bar/oxy-index-bar.vue +3 -3
  92. package/components/oxy-index-bar/{type.ts → types.ts} +2 -2
  93. package/components/oxy-input/index.scss +1 -1
  94. package/components/oxy-input-number/index.scss +5 -5
  95. package/components/oxy-input-number/oxy-input-number.vue +2 -2
  96. package/components/oxy-input-number/types.ts +3 -2
  97. package/components/oxy-keyboard/index.scss +5 -5
  98. package/components/oxy-keyboard/key/index.scss +3 -3
  99. package/components/oxy-keyboard/key/index.vue +2 -2
  100. package/components/oxy-keyboard/key/types.ts +15 -0
  101. package/components/oxy-keyboard/oxy-keyboard.vue +1 -0
  102. package/components/oxy-keyboard/types.ts +5 -0
  103. package/components/oxy-link/index.scss +2 -2
  104. package/components/oxy-list/oxy-list.vue +4 -3
  105. package/components/oxy-loading/oxy-loading.vue +8 -4
  106. package/components/oxy-loading/types.ts +1 -1
  107. package/components/oxy-loadmore/index.scss +3 -3
  108. package/components/oxy-long-press-menu/index.scss +93 -0
  109. package/components/oxy-long-press-menu/oxy-long-press-menu.vue +338 -0
  110. package/components/oxy-long-press-menu/types.ts +34 -0
  111. package/components/oxy-message-box/index.scss +12 -11
  112. package/components/oxy-message-box/oxy-message-box.vue +11 -3
  113. package/components/oxy-message-box/types.ts +14 -0
  114. package/components/oxy-navbar/index.scss +2 -2
  115. package/components/oxy-navbar/oxy-navbar.vue +58 -13
  116. package/components/oxy-navbar/types.ts +8 -1
  117. package/components/oxy-navbar-capsule/types.ts +3 -0
  118. package/components/oxy-notice-bar/index.scss +3 -3
  119. package/components/oxy-notice-bar/oxy-notice-bar.vue +9 -5
  120. package/components/oxy-notice-bar/types.ts +3 -3
  121. package/components/oxy-notify/index.ts +1 -0
  122. package/components/oxy-notify/oxy-notify.vue +3 -2
  123. package/components/oxy-notify/types.ts +7 -0
  124. package/components/oxy-pagination/index.scss +1 -1
  125. package/components/oxy-password-input/oxy-password-input.vue +2 -2
  126. package/components/oxy-password-input/types.ts +1 -1
  127. package/components/oxy-picker/index.scss +45 -2
  128. package/components/oxy-picker/oxy-picker.vue +100 -14
  129. package/components/oxy-picker/types.ts +29 -1
  130. package/components/oxy-picker-view/index.scss +3 -3
  131. package/components/oxy-picker-view/oxy-picker-view.vue +4 -4
  132. package/components/oxy-popover/index.scss +9 -9
  133. package/components/oxy-popup/index.scss +2 -2
  134. package/components/oxy-popup/oxy-popup.vue +35 -2
  135. package/components/oxy-popup/types.ts +8 -1
  136. package/components/oxy-progress/index.scss +3 -3
  137. package/components/oxy-qrcode/draw.ts +398 -0
  138. package/components/oxy-qrcode/index.scss +2 -0
  139. package/components/oxy-qrcode/oxy-qrcode.vue +124 -0
  140. package/components/oxy-qrcode/qrcode.ts +936 -0
  141. package/components/oxy-qrcode/types.ts +42 -0
  142. package/components/oxy-radio/index.scss +10 -10
  143. package/components/oxy-radio-group/index.scss +2 -2
  144. package/components/oxy-rate/types.ts +4 -4
  145. package/components/oxy-resize/index.scss +2 -2
  146. package/components/oxy-resize/oxy-resize.vue +4 -4
  147. package/components/oxy-resize/types.ts +3 -0
  148. package/components/oxy-rich-text/index.scss +30 -29
  149. package/components/oxy-rich-text/mp-html/mp-html.vue +33 -24
  150. package/components/oxy-rich-text/mp-html/node/node.vue +30 -19
  151. package/components/oxy-rich-text/oxy-rich-text.vue +31 -31
  152. package/components/oxy-rich-text/types.ts +6 -1
  153. package/components/oxy-row/oxy-row.vue +3 -3
  154. package/components/oxy-row/types.ts +1 -1
  155. package/components/oxy-search/index.scss +3 -3
  156. package/components/oxy-segmented/index.scss +16 -16
  157. package/components/oxy-segmented/oxy-segmented.vue +23 -3
  158. package/components/oxy-select/index.scss +144 -68
  159. package/components/oxy-select/oxy-select.vue +85 -50
  160. package/components/oxy-select/types.ts +13 -1
  161. package/components/oxy-select-picker/index.scss +7 -7
  162. package/components/oxy-select-picker/oxy-select-picker.vue +1 -0
  163. package/components/oxy-select-picker/types.ts +2 -0
  164. package/components/oxy-sidebar-item/index.scss +1 -1
  165. package/components/oxy-signature/oxy-signature.vue +18 -10
  166. package/components/oxy-signature/types.ts +106 -13
  167. package/components/oxy-skeleton/oxy-skeleton.vue +6 -6
  168. package/components/oxy-skeleton/types.ts +1 -1
  169. package/components/oxy-slider/index.scss +3 -3
  170. package/components/oxy-sort-button/index.scss +8 -8
  171. package/components/oxy-status-tip/index.scss +4 -4
  172. package/components/oxy-status-tip/oxy-status-tip.vue +5 -5
  173. package/components/oxy-status-tip/types.ts +3 -3
  174. package/components/oxy-step/index.scss +14 -14
  175. package/components/oxy-sticky/oxy-sticky.vue +6 -6
  176. package/components/oxy-stream-render/types.ts +4 -1
  177. package/components/oxy-swipe-action/oxy-swipe-action.vue +27 -2
  178. package/components/oxy-swiper/oxy-swiper.vue +6 -6
  179. package/components/oxy-swiper/types.ts +5 -5
  180. package/components/oxy-switch/index.scss +8 -8
  181. package/components/oxy-switch/oxy-switch.vue +2 -2
  182. package/components/oxy-switch/types.ts +1 -1
  183. package/components/oxy-tab/index.scss +11 -1
  184. package/components/oxy-tabbar/index.scss +1 -1
  185. package/components/oxy-tabbar/oxy-tabbar.vue +39 -10
  186. package/components/oxy-table/index.scss +5 -5
  187. package/components/oxy-table/oxy-table.vue +8 -6
  188. package/components/oxy-table/types.ts +2 -2
  189. package/components/oxy-table-col/oxy-table-col.vue +3 -3
  190. package/components/oxy-table-col/types.ts +2 -2
  191. package/components/oxy-tabs/index.scss +43 -15
  192. package/components/oxy-tabs/oxy-tabs.vue +53 -19
  193. package/components/oxy-tabs/types.ts +15 -3
  194. package/components/oxy-tag/index.scss +15 -15
  195. package/components/oxy-text/index.scss +5 -1
  196. package/components/oxy-text/oxy-text.vue +76 -7
  197. package/components/oxy-text/types.ts +12 -0
  198. package/components/oxy-textarea/index.scss +6 -6
  199. package/components/oxy-toast/oxy-toast.vue +24 -8
  200. package/components/oxy-tooltip/index.scss +9 -9
  201. package/components/oxy-tree/index.scss +51 -15
  202. package/components/oxy-tree/oxy-tree.vue +13 -9
  203. package/components/oxy-tree/types.ts +12 -9
  204. package/components/oxy-upload/index.scss +21 -21
  205. package/components/oxy-upload/types.ts +2 -2
  206. package/components/oxy-verification-code/index.scss +6 -0
  207. package/components/oxy-verification-code/oxy-verification-code.vue +187 -0
  208. package/components/oxy-verification-code/types.ts +82 -0
  209. package/components/oxy-video-preview/index.scss +4 -4
  210. package/components/oxy-virtual-scroll/index.scss +4 -4
  211. package/components/oxy-virtual-scroll/oxy-virtual-scroll.vue +11 -7
  212. package/components/oxy-virtual-scroll/types.ts +14 -14
  213. package/components/oxy-voice-player/index.scss +908 -0
  214. package/components/oxy-voice-player/oxy-voice-player.vue +821 -0
  215. package/components/oxy-voice-player/types.ts +567 -0
  216. package/components/oxy-waterfall/oxy-waterfall.vue +6 -6
  217. package/components/oxy-waterfall/types.ts +6 -6
  218. package/components/oxy-watermark/oxy-watermark.vue +35 -13
  219. package/components/oxy-watermark/types.ts +14 -14
  220. package/global.d.ts +2 -0
  221. package/locale/lang/ar-SA.ts +3 -0
  222. package/locale/lang/en-US.ts +3 -0
  223. package/locale/lang/zh-CN.ts +3 -0
  224. package/package.json +97 -1
  225. package/tags.json +1 -1
  226. package/web-types.json +1 -1
  227. package/components/oxy-number-keyboard/index.scss +0 -78
  228. package/components/oxy-number-keyboard/key/index.scss +0 -81
  229. package/components/oxy-number-keyboard/key/index.vue +0 -78
  230. package/components/oxy-number-keyboard/key/types.ts +0 -11
  231. package/components/oxy-number-keyboard/oxy-number-keyboard.vue +0 -151
  232. package/components/oxy-number-keyboard/types.ts +0 -83
  233. package/components/oxy-tree/components/tree-node-content.vue +0 -72
  234. package/components/oxy-tree/index.ts +0 -51
  235. package/oxy-uni-ui.zip +0 -0
@@ -4,8 +4,8 @@
4
4
  @include b(backtop) {
5
5
  position: fixed;
6
6
  background-color: $-backtop-bg;
7
- width: 40px;
8
- height: 40px;
7
+ width: 80rpx;
8
+ height: 80rpx;
9
9
  display: flex;
10
10
  justify-content: center;
11
11
  align-items: center;
@@ -20,6 +20,6 @@
20
20
  }
21
21
 
22
22
  @include when(square) {
23
- border-radius: 4px;
23
+ border-radius: 8rpx;
24
24
  }
25
25
  }
@@ -1,10 +1,6 @@
1
1
  <template>
2
2
  <oxy-transition :show="show" name="fade">
3
- <view
4
- :class="`oxy-backtop ${customClass} is-${shape}`"
5
- :style="`z-index: ${zIndex}; bottom: ${bottom}px; right: ${right}px; ${customStyle}`"
6
- @click="handleBacktop"
7
- >
3
+ <view :class="`oxy-backtop ${customClass} is-${shape}`" :style="rootStyle" @click="handleBacktop">
8
4
  <slot v-if="$slots.default"></slot>
9
5
  <oxy-icon v-else custom-class="oxy-backtop__backicon" name="backtop" :custom-style="iconStyle" />
10
6
  </view>
@@ -26,11 +22,18 @@ export default {
26
22
  import OxyTransition from '../oxy-transition/oxy-transition.vue'
27
23
  import OxyIcon from '../oxy-icon/oxy-icon.vue'
28
24
  import { computed } from 'vue'
25
+ import { unitConvertWithDefault, withDefaultUnit } from '../common/util'
29
26
  import { backtopProps } from './types'
30
27
 
31
28
  const props = defineProps(backtopProps)
32
29
 
33
- const show = computed(() => props.scrollTop > props.top)
30
+ const thresholdTop = computed(() => unitConvertWithDefault(props.top, { defaultUnit: 'rpx' }))
31
+ const show = computed(() => props.scrollTop > thresholdTop.value)
32
+ const rootStyle = computed(() => {
33
+ return `z-index: ${props.zIndex}; bottom: ${withDefaultUnit(props.bottom, 'rpx')}; right: ${withDefaultUnit(props.right, 'rpx')}; ${
34
+ props.customStyle
35
+ }`
36
+ })
34
37
 
35
38
  function handleBacktop() {
36
39
  uni.pageScrollTo({
@@ -1,4 +1,4 @@
1
- import { baseProps, makeNumberProp, makeRequiredProp, makeStringProp } from '../common/props'
1
+ import { baseProps, makeNumberProp, makeNumericProp, makeRequiredProp, makeStringProp } from '../common/props'
2
2
 
3
3
  export const backtopProps = {
4
4
  ...baseProps,
@@ -7,9 +7,9 @@ export const backtopProps = {
7
7
  */
8
8
  scrollTop: makeRequiredProp(Number),
9
9
  /**
10
- * 距离顶部多少距离时显示
10
+ * 距离顶部多少距离时显示,支持 `px/rpx`;number 或纯数字字符串按 `rpx` 处理
11
11
  */
12
- top: makeNumberProp(300),
12
+ top: makeNumericProp(600),
13
13
  /**
14
14
  * 返回顶部滚动时间
15
15
  */
@@ -27,11 +27,11 @@ export const backtopProps = {
27
27
  */
28
28
  shape: makeStringProp('circle'),
29
29
  /**
30
- * 距离屏幕底部距离
30
+ * 距离屏幕底部距离,支持 `px/rpx`;number 或纯数字字符串按 `rpx` 处理
31
31
  */
32
- bottom: makeNumberProp(100),
32
+ bottom: makeNumericProp(200),
33
33
  /**
34
- * 距离屏幕右边距离
34
+ * 距离屏幕右边距离,支持 `px/rpx`;number 或纯数字字符串按 `rpx` 处理
35
35
  */
36
- right: makeNumberProp(20)
36
+ right: makeNumericProp(40)
37
37
  }
@@ -22,7 +22,7 @@
22
22
  line-height: $-badge-height;
23
23
  padding: $-badge-padding;
24
24
  background-color: $-badge-bg;
25
- border-radius: calc($-badge-height / 2 + 2px);
25
+ border-radius: calc($-badge-height / 2 + 4rpx);
26
26
  color: $-badge-color;
27
27
  font-size: $-badge-fs;
28
28
  text-align: center;
@@ -32,8 +32,8 @@
32
32
 
33
33
  @include when(fixed) {
34
34
  position: absolute;
35
- top: 0px;
36
- right: 0px;
35
+ top: 0;
36
+ right: 0;
37
37
  transform: translateY(-50%) translateX(50%);
38
38
  }
39
39
 
@@ -60,4 +60,4 @@
60
60
  }
61
61
  }
62
62
  }
63
- }
63
+ }
@@ -23,7 +23,7 @@ export default {
23
23
  <script lang="ts" setup>
24
24
  import { computed, type CSSProperties } from 'vue'
25
25
  import { badgeProps } from './types'
26
- import { addUnit, isDef, isNumber, objToStyle } from '../common/util'
26
+ import { withDefaultUnit, isDef, isNumber, objToStyle } from '../common/util'
27
27
 
28
28
  const props = defineProps(badgeProps)
29
29
  const content = computed(() => {
@@ -43,11 +43,11 @@ const contentStyle = computed(() => {
43
43
  }
44
44
 
45
45
  if (isDef(props.top)) {
46
- style.top = addUnit(props.top)
46
+ style.top = withDefaultUnit(props.top)
47
47
  }
48
48
 
49
49
  if (isDef(props.right)) {
50
- style.right = addUnit(props.right)
50
+ style.right = withDefaultUnit(props.right)
51
51
  }
52
52
  return objToStyle(style)
53
53
  })
@@ -29,11 +29,11 @@ export const badgeProps = {
29
29
  */
30
30
  type: makeStringProp<BadgeType | undefined>(undefined),
31
31
  /**
32
- * 为正时,角标向下偏移对应的像素
32
+ * 为正时,角标向下偏移距离,支持 `px/rpx`
33
33
  */
34
34
  top: numericProp,
35
35
  /**
36
- * 为正时,角标向左偏移对应的像素
36
+ * 为正时,角标向左偏移距离,支持 `px/rpx`
37
37
  */
38
38
  right: numericProp
39
39
  }
@@ -97,7 +97,7 @@
97
97
  }
98
98
 
99
99
  @include e(loading) {
100
- margin-right: 5px;
100
+ margin-right: 10rpx;
101
101
  animation: oxy-rotate 0.8s linear infinite;
102
102
  animation-duration: 2s;
103
103
  }
@@ -154,7 +154,7 @@
154
154
  padding: $-button-medium-padding;
155
155
  border-radius: $-button-medium-radius;
156
156
  font-size: $-button-medium-fs;
157
- min-width: 120px;
157
+ min-width: 240rpx;
158
158
 
159
159
 
160
160
  @include when(round) {
@@ -194,13 +194,13 @@
194
194
 
195
195
 
196
196
  @include when(round) {
197
- border-radius: 999px;
197
+ border-radius: 1998rpx;
198
198
  }
199
199
 
200
200
  @include when(text) {
201
201
  color: $-button-primary-bg-color;
202
202
  min-width: 0;
203
- padding: 4px 0;
203
+ padding: 8rpx 0;
204
204
 
205
205
  &::after {
206
206
  display: none;
@@ -314,7 +314,7 @@
314
314
 
315
315
  @include edeep(icon) {
316
316
  display: block;
317
- margin-right: 6px;
317
+ margin-right: 12rpx;
318
318
  font-size: $-button-icon-fs;
319
319
  vertical-align: middle;
320
320
  }
@@ -17,7 +17,7 @@
17
17
  ]"
18
18
  :hover-start-time="hoverStartTime"
19
19
  :hover-stay-time="hoverStayTime"
20
- :open-type="disabled || loading ? undefined : openType"
20
+ :open-type="openTypeValue"
21
21
  :send-message-title="sendMessageTitle"
22
22
  :send-message-path="sendMessagePath"
23
23
  :send-message-img="sendMessageImg"
@@ -98,6 +98,10 @@ const loadingStyle = computed(() => {
98
98
  return `background-image: url(${loadingIconSvg.value});`
99
99
  })
100
100
 
101
+ const openTypeValue = computed(() => {
102
+ return (props.disabled || props.loading ? undefined : props.openType) as any
103
+ })
104
+
101
105
  watch(
102
106
  () => props.loading,
103
107
  () => {
@@ -61,25 +61,25 @@
61
61
  }
62
62
 
63
63
  @include e(tabs) {
64
- width: 222px;
65
- margin: 10px auto 12px;
64
+ width: 444rpx;
65
+ margin: 20rpx auto 24rpx;
66
66
  }
67
67
 
68
68
  @include e(shortcuts) {
69
- padding: 20px 0;
69
+ padding: 40rpx 0;
70
70
  text-align: center;
71
71
  }
72
72
 
73
73
  @include edeep(tag) {
74
- margin-right: 8px;
74
+ margin-right: 16rpx;
75
75
  }
76
76
 
77
77
  @include e(view) {
78
78
  @include when(show-confirm) {
79
- height: 394px;
79
+ height: 788rpx;
80
80
 
81
81
  @include when(range) {
82
- height: 384px;
82
+ height: 768rpx;
83
83
  }
84
84
  }
85
85
  }
@@ -88,11 +88,11 @@
88
88
  display: flex;
89
89
  justify-content: center;
90
90
  align-items: center;
91
- font-size: 14px;
91
+ font-size: 28rpx;
92
92
 
93
93
  @include when(monthrange) {
94
- padding-bottom: 10px;
95
- box-shadow: 0px 4px 8px 0 rgba(0, 0, 0, 0.02);
94
+ padding-bottom: 20rpx;
95
+ box-shadow: 0 8rpx 16rpx 0 rgba(0, 0, 0, 0.02);
96
96
  }
97
97
  }
98
98
 
@@ -106,12 +106,12 @@
106
106
  }
107
107
 
108
108
  @include e(range-sperator) {
109
- margin: 0 24px;
109
+ margin: 0 48rpx;
110
110
  color: rgba(0, 0, 0, 0.25);
111
111
  }
112
112
 
113
113
  @include e(confirm) {
114
- padding: 12px 25px 14px;
114
+ padding: 24rpx 50rpx 28rpx;
115
115
  }
116
116
 
117
117
  @include edeep(cell) {
@@ -43,6 +43,7 @@
43
43
  :close-on-click-modal="closeOnClickModal"
44
44
  :safe-area-inset-bottom="safeAreaInsetBottom"
45
45
  :z-index="zIndex"
46
+ :max-width="popupMaxWidth"
46
47
  :root-portal="rootPortal"
47
48
  @close="close"
48
49
  >
@@ -107,6 +107,11 @@ export const calendarProps = {
107
107
  * 弹框层级
108
108
  */
109
109
  zIndex: makeNumberProp(15),
110
+ /**
111
+ * 弹层最大宽度,支持 `rpx`、`px`、`%` 等单位;
112
+ * `%` 在弹层打开时按屏幕宽度换算为 `rpx`
113
+ */
114
+ popupMaxWidth: makeStringProp('1200rpx'),
110
115
  /**
111
116
  * 是否显示确定按钮
112
117
  */
@@ -26,7 +26,7 @@
26
26
  display: flex;
27
27
  align-items: center;
28
28
  justify-content: center;
29
- height: 45px;
29
+ height: 90rpx;
30
30
  font-size: $-calendar-panel-title-fs;
31
31
  color: $-calendar-panel-title-color;
32
32
  }
@@ -142,7 +142,7 @@
142
142
 
143
143
  @include e(day-top) {
144
144
  position: absolute;
145
- top: 10px;
145
+ top: 20rpx;
146
146
  left: 0;
147
147
  right: 0;
148
148
  line-height: 1.1;
@@ -152,11 +152,11 @@
152
152
 
153
153
  @include e(day-bottom) {
154
154
  position: absolute;
155
- bottom: 10px;
155
+ bottom: 20rpx;
156
156
  left: 0;
157
157
  right: 0;
158
158
  line-height: 1.1;
159
159
  font-size: $-calendar-info-fs;
160
160
  text-align: center;
161
161
  }
162
- }
162
+ }
@@ -3,18 +3,54 @@ import { makeBooleanProp, makeRequiredProp } from '../../common/props'
3
3
  import type { CalendarFormatter, CalendarType } from '../types'
4
4
 
5
5
  export const monthProps = {
6
+ /**
7
+ * 日历选择类型
8
+ */
6
9
  type: makeRequiredProp(String as PropType<CalendarType>),
10
+ /**
11
+ * 当前月份时间戳
12
+ */
7
13
  date: makeRequiredProp(Number),
14
+ /**
15
+ * 已选中的值
16
+ */
8
17
  value: makeRequiredProp([Number, Array, null] as PropType<number | (number | null)[] | null>),
18
+ /**
19
+ * 可选最小日期
20
+ */
9
21
  minDate: makeRequiredProp(Number),
22
+ /**
23
+ * 可选最大日期
24
+ */
10
25
  maxDate: makeRequiredProp(Number),
26
+ /**
27
+ * 每周起始日
28
+ */
11
29
  firstDayOfWeek: makeRequiredProp(Number),
30
+ /**
31
+ * 日期单元格格式化函数
32
+ */
12
33
  formatter: Function as PropType<CalendarFormatter>,
34
+ /**
35
+ * 范围选择最大天数
36
+ */
13
37
  maxRange: Number,
38
+ /**
39
+ * 超出范围提示文案
40
+ */
14
41
  rangePrompt: String,
42
+ /**
43
+ * 范围选择是否允许同一天
44
+ */
15
45
  allowSameDay: makeBooleanProp(false),
46
+ /**
47
+ * 默认时间配置
48
+ */
16
49
  defaultTime: {
17
50
  type: [Array] as PropType<Array<number[]>>
18
51
  },
52
+ /**
53
+ * 是否显示标题
54
+ */
19
55
  showTitle: makeBooleanProp(true)
20
56
  }
@@ -8,7 +8,7 @@
8
8
  }
9
9
 
10
10
  @include e(weeks) {
11
- box-shadow: 0px 4px 8px 0 rgba(255, 255, 255, 0.02);
11
+ box-shadow: 0 8rpx 16rpx 0 rgba(255, 255, 255, 0.02);
12
12
  color: $-dark-color;
13
13
  }
14
14
 
@@ -25,7 +25,7 @@
25
25
  font-size: $-calendar-fs;
26
26
 
27
27
  @include e(title) {
28
- padding: 5px 0;
28
+ padding: 10rpx 0;
29
29
  text-align: center;
30
30
  font-size: $-calendar-panel-title-fs;
31
31
  color: $-calendar-panel-title-color;
@@ -36,7 +36,7 @@
36
36
  display: flex;
37
37
  height: $-calendar-week-height;
38
38
  line-height: $-calendar-week-height;
39
- box-shadow: 0px 4px 8px 0 rgba(0, 0, 0, 0.02);
39
+ box-shadow: 0 8rpx 16rpx 0 rgba(0, 0, 0, 0.02);
40
40
  color: $-calendar-week-color;
41
41
  font-size: $-calendar-week-fs;
42
42
  padding: $-calendar-panel-padding;
@@ -54,7 +54,7 @@
54
54
 
55
55
  @include e(time) {
56
56
  display: flex;
57
- box-shadow: 0px -4px 8px 0px rgba(0, 0, 0, 0.02);
57
+ box-shadow: 0 -8rpx 16rpx 0 rgba(0, 0, 0, 0.02);
58
58
  }
59
59
 
60
60
  @include e(time-label) {
@@ -62,13 +62,13 @@
62
62
  flex: 1;
63
63
  font-size: $-picker-column-fs;
64
64
  text-align: center;
65
- line-height: 125px;
65
+ line-height: 250rpx;
66
66
  color: $-picker-column-color;
67
67
 
68
68
  &::after {
69
69
  position: absolute;
70
70
  content: '';
71
- height: 35px;
71
+ height: 70rpx;
72
72
  top: 50%;
73
73
  left: 0;
74
74
  right: 0;
@@ -86,4 +86,4 @@
86
86
  @include e(time-picker) {
87
87
  flex: 3;
88
88
  }
89
- }
89
+ }
@@ -8,7 +8,7 @@
8
8
  </view>
9
9
  <scroll-view
10
10
  :class="`oxy-month-panel__container ${!!timeType ? 'oxy-month-panel__container--time' : ''}`"
11
- :style="`height: ${scrollHeight}px`"
11
+ :style="`height: ${unitConvert(scrollHeight, 0, { output: 'px' })}`"
12
12
  scroll-y
13
13
  @scroll="monthScroll"
14
14
  :scroll-top="scrollTop"
@@ -64,7 +64,7 @@ export default {
64
64
  <script lang="ts" setup>
65
65
  import OxyPickerView from '../../oxy-picker-view/oxy-picker-view.vue'
66
66
  import { computed, ref, watch, onMounted } from 'vue'
67
- import { debounce, isArray, isEqual, isNumber, pause } from '../../common/util'
67
+ import { debounce, isArray, isEqual, isNumber, pause, unitConvert } from '../../common/util'
68
68
  import { compareMonth, formatMonthTitle, getMonthEndDay, getMonths, getTimeData, getWeekLabel } from '../utils'
69
69
  import Month from '../month/month.vue'
70
70
  import { monthPanelProps, type MonthInfo, type MonthPanelTimeType, type MonthPanelExpose } from './types'
@@ -83,6 +83,12 @@ const timeValue = ref<number[]>([]) // 当前选中的时分秒
83
83
  const timeType = ref<MonthPanelTimeType>('') // 当前时间类型,是开始还是结束
84
84
  const innerValue = ref<string | number | (number | null)[]>('') // 内部保存一个值,用于判断新老值,避免监听器触发
85
85
 
86
+ const designPxToRuntimePx = (designPx: number): number => unitConvert(`${designPx * 2}rpx`)
87
+ const MONTH_ROW_HEIGHT = designPxToRuntimePx(64)
88
+ const MONTH_ROW_GAP = designPxToRuntimePx(4)
89
+ const MONTH_TITLE_HEIGHT = designPxToRuntimePx(45)
90
+ const TIME_PICKER_HEIGHT = designPxToRuntimePx(125)
91
+
86
92
  const handleChange = debounce((value) => {
87
93
  emit('change', {
88
94
  value
@@ -132,7 +138,8 @@ const weekLabel = computed(() => {
132
138
 
133
139
  // 滚动区域的高度
134
140
  const scrollHeight = computed(() => {
135
- const scrollHeight: number = timeType.value ? props.panelHeight - 125 : props.panelHeight
141
+ const panelHeight = designPxToRuntimePx(props.panelHeight)
142
+ const scrollHeight: number = timeType.value ? panelHeight - TIME_PICKER_HEIGHT : panelHeight
136
143
  return scrollHeight
137
144
  })
138
145
 
@@ -143,7 +150,7 @@ const months = computed<MonthInfo[]>(() => {
143
150
  const totalDay = getMonthEndDay(new Date(month).getFullYear(), new Date(month).getMonth() + 1)
144
151
  const rows = Math.ceil((offset + totalDay) / 7)
145
152
  return {
146
- height: rows * 64 + (rows - 1) * 4 + (index === 0 ? 0 : 45), // 每行64px高度,除最后一行外每行加4px margin,加上标题45px
153
+ height: rows * MONTH_ROW_HEIGHT + (rows - 1) * MONTH_ROW_GAP + (index === 0 ? 0 : MONTH_TITLE_HEIGHT),
147
154
  date: month
148
155
  }
149
156
  })
@@ -214,8 +221,8 @@ async function scrollIntoView() {
214
221
  const firstDay = new Date(date.getFullYear(), date.getMonth(), 1)
215
222
  const offset = (7 + firstDay.getDay() - props.firstDayOfWeek) % 7
216
223
  const row = Math.floor((offset + day - 1) / 7)
217
- // 每行高度64px,每行加4px margin
218
- top += row * 64 + row * 4
224
+ // 每行高度与行间距按 rpx 基线换算为运行时 px
225
+ top += row * (MONTH_ROW_HEIGHT + MONTH_ROW_GAP)
219
226
  break
220
227
  }
221
228
  top += months.value[index] ? Number(months.value[index].height) : 0
@@ -223,8 +230,7 @@ async function scrollIntoView() {
223
230
  scrollTop.value = 0
224
231
  if (top > 0) {
225
232
  await pause()
226
- // 如果不是第一个月才加45
227
- scrollTop.value = top + (activeMonthIndex > 0 ? 45 : 0)
233
+ scrollTop.value = top + (activeMonthIndex > 0 ? MONTH_TITLE_HEIGHT : 0)
228
234
  }
229
235
  }
230
236
  /**
@@ -27,7 +27,7 @@
27
27
  display: flex;
28
28
  align-items: center;
29
29
  justify-content: center;
30
- height: 45px;
30
+ height: 90rpx;
31
31
  font-size: $-calendar-panel-title-fs;
32
32
  color: $-calendar-panel-title-color;
33
33
  }
@@ -133,7 +133,7 @@
133
133
 
134
134
  @include e(month-top) {
135
135
  position: absolute;
136
- top: 10px;
136
+ top: 20rpx;
137
137
  left: 0;
138
138
  right: 0;
139
139
  line-height: 1.1;
@@ -143,11 +143,11 @@
143
143
 
144
144
  @include e(month-bottom) {
145
145
  position: absolute;
146
- bottom: 10px;
146
+ bottom: 20rpx;
147
147
  left: 0;
148
148
  right: 0;
149
149
  line-height: 1.1;
150
150
  font-size: $-calendar-info-fs;
151
151
  text-align: center;
152
152
  }
153
- }
153
+ }
@@ -5,7 +5,7 @@
5
5
  @include b(year-panel) {
6
6
  @include e(title) {
7
7
  color: $-dark-color;
8
- box-shadow: 0px 4px 8px 0 rgba(255, 255,255, 0.02);
8
+ box-shadow: 0 8rpx 16rpx 0 rgba(255, 255,255, 0.02);
9
9
  }
10
10
  }
11
11
  }
@@ -15,10 +15,10 @@
15
15
  padding: $-calendar-panel-padding;
16
16
 
17
17
  @include e(title) {
18
- padding: 5px 0;
18
+ padding: 10rpx 0;
19
19
  text-align: center;
20
20
  font-size: $-calendar-panel-title-fs;
21
21
  color: $-calendar-panel-title-color;
22
- box-shadow: 0px 4px 8px 0 rgba(0, 0, 0, 0.02);
22
+ box-shadow: 0 8rpx 16rpx 0 rgba(0, 0, 0, 0.02);
23
23
  }
24
- }
24
+ }
@@ -1,7 +1,13 @@
1
1
  <template>
2
2
  <view class="oxy-year-panel">
3
3
  <view v-if="showPanelTitle" class="oxy-year-panel__title">{{ title }}</view>
4
- <scroll-view class="oxy-year-panel__container" :style="`height: ${scrollHeight}px`" scroll-y @scroll="yearScroll" :scroll-top="scrollTop">
4
+ <scroll-view
5
+ class="oxy-year-panel__container"
6
+ :style="`height: ${unitConvert(scrollHeight, 0, { output: 'px' })}`"
7
+ scroll-y
8
+ @scroll="yearScroll"
9
+ :scroll-top="scrollTop"
10
+ >
5
11
  <view v-for="(item, index) in years" :key="index" :id="`year${index}`">
6
12
  <year
7
13
  :type="type"
@@ -34,7 +40,7 @@ export default {
34
40
  <script lang="ts" setup>
35
41
  import { computed, ref, onMounted } from 'vue'
36
42
  import { compareYear, formatYearTitle, getYears } from '../utils'
37
- import { isArray, isNumber, pause } from '../../common/util'
43
+ import { isArray, isNumber, pause, unitConvert } from '../../common/util'
38
44
  import Year from '../year/year.vue'
39
45
  import { yearPanelProps, type YearInfo, type YearPanelExpose } from './types'
40
46
 
@@ -44,9 +50,19 @@ const emit = defineEmits(['change'])
44
50
  const scrollTop = ref<number>(0) // 滚动位置
45
51
  const scrollIndex = ref<number>(0) // 当前显示的年份索引
46
52
 
53
+ const designPxToRuntimePx = (designPx: number): number => unitConvert(`${designPx * 2}rpx`)
54
+ const YEAR_MONTH_HEIGHT = designPxToRuntimePx(64)
55
+ const YEAR_MONTH_GAP = designPxToRuntimePx(4)
56
+ const YEAR_TITLE_HEIGHT = designPxToRuntimePx(45)
57
+ const PANEL_EXTRA_WITH_TITLE = designPxToRuntimePx(26)
58
+ const PANEL_EXTRA_NO_TITLE = designPxToRuntimePx(16)
59
+ const YEAR_HEIGHT_WITHOUT_TITLE = YEAR_MONTH_HEIGHT * 3 + YEAR_MONTH_GAP * 2
60
+ const YEAR_HEIGHT_WITH_TITLE = YEAR_HEIGHT_WITHOUT_TITLE + YEAR_TITLE_HEIGHT
61
+
47
62
  // 滚动区域的高度
48
63
  const scrollHeight = computed(() => {
49
- const scrollHeight: number = props.panelHeight + (props.showPanelTitle ? 26 : 16)
64
+ const panelHeight = designPxToRuntimePx(props.panelHeight)
65
+ const scrollHeight: number = panelHeight + (props.showPanelTitle ? PANEL_EXTRA_WITH_TITLE : PANEL_EXTRA_NO_TITLE)
50
66
  return scrollHeight
51
67
  })
52
68
 
@@ -55,7 +71,7 @@ const years = computed<YearInfo[]>(() => {
55
71
  return getYears(props.minDate, props.maxDate).map((year, index) => {
56
72
  return {
57
73
  date: year,
58
- height: index === 0 ? 200 : 245
74
+ height: index === 0 ? YEAR_HEIGHT_WITHOUT_TITLE : YEAR_HEIGHT_WITH_TITLE
59
75
  }
60
76
  })
61
77
  })
@@ -92,7 +108,7 @@ async function scrollIntoView() {
92
108
  scrollTop.value = 0
93
109
  if (top > 0) {
94
110
  await pause()
95
- scrollTop.value = top + 45
111
+ scrollTop.value = top + YEAR_TITLE_HEIGHT
96
112
  }
97
113
  }
98
114
 
@@ -31,7 +31,7 @@
31
31
  border-radius: $-card-radius;
32
32
  box-shadow: $-card-shadow-color;
33
33
  font-size: $-card-fs;
34
- margin-bottom: 12px;
34
+ margin-bottom: 24rpx;
35
35
 
36
36
  @include when(rectangle) {
37
37
  margin-left: 0;
@@ -56,7 +56,7 @@
56
56
  }
57
57
  }
58
58
  @include e(title-content) {
59
- padding: 16px 0;
59
+ padding: 32rpx 0;
60
60
  color: $-card-title-color;
61
61
  font-size: $-card-title-fs;
62
62
  }