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
@@ -65,7 +65,7 @@
65
65
  }
66
66
 
67
67
  // 结算框对角尺寸
68
- $border-size: 2px;
68
+ $border-size: 4rpx;
69
69
 
70
70
  // 节选框的四个角
71
71
  .is-left-top,
@@ -76,14 +76,14 @@
76
76
  content: "";
77
77
  position: absolute;
78
78
  width: $border-size;
79
- height: 20px;
79
+ height: 40rpx;
80
80
  background-color: #fff;
81
81
  }
82
82
 
83
83
  &::after {
84
84
  content: "";
85
85
  position: absolute;
86
- width: 20px;
86
+ width: 40rpx;
87
87
  height: $border-size;
88
88
  background-color: #fff;
89
89
  }
@@ -184,8 +184,8 @@
184
184
  @include e(canvas) {
185
185
  position: fixed;
186
186
  background: white;
187
- width: 150px;
188
- height: 150px;
187
+ width: 300rpx;
188
+ height: 300rpx;
189
189
  z-index: 10;
190
190
  top: -200%;
191
191
  pointer-events: none;
@@ -194,7 +194,7 @@
194
194
  @include e(footer) {
195
195
  position: fixed;
196
196
  z-index: 10;
197
- bottom: 10px;
197
+ bottom: 20rpx;
198
198
  width: 100%;
199
199
  height: 15vh;
200
200
  text-align: center;
@@ -202,7 +202,7 @@
202
202
  @include m(button) {
203
203
  position: relative;
204
204
  text-align: left;
205
- margin: 0 20px;
205
+ margin: 0 40rpx;
206
206
  padding-top: 4vh;
207
207
  // line-height: 32px;
208
208
  box-sizing: border-box;
@@ -210,16 +210,16 @@
210
210
  .is-cancel {
211
211
  display: inline-block;
212
212
  color: #fff;
213
- font-size: 16px;
213
+ font-size: 32rpx;
214
214
  }
215
215
 
216
216
  .is-confirm {
217
217
  position: absolute;
218
218
  right: 0;
219
219
  // height: 32px;
220
- width: 56px;
221
- border-radius: 16px;
222
- font-size: 16px;
220
+ width: 112rpx;
221
+ border-radius: 32rpx;
222
+ font-size: 32rpx;
223
223
  }
224
224
  }
225
225
  }
@@ -228,4 +228,4 @@
228
228
  font-size: $-img-cropper-icon-size;
229
229
  color: $-img-cropper-icon-color;
230
230
  }
231
- }
231
+ }
@@ -6,15 +6,15 @@
6
6
  <!-- 画出裁剪框 -->
7
7
  <view class="oxy-img-cropper__cut">
8
8
  <!-- 上方阴影块 -->
9
- <view :class="`oxy-img-cropper__cut--top ${IS_TOUCH_END ? '' : 'is-hightlight'}`" :style="`height: ${cutTop}px;`"></view>
10
- <view class="oxy-img-cropper__cut--middle" :style="`height: ${cutHeight}px;`">
9
+ <view :class="`oxy-img-cropper__cut--top ${IS_TOUCH_END ? '' : 'is-hightlight'}`" :style="`height: ${toPx(cutTop)};`"></view>
10
+ <view class="oxy-img-cropper__cut--middle" :style="`height: ${toPx(cutHeight)};`">
11
11
  <!-- 左侧阴影块 -->
12
12
  <view
13
13
  :class="`oxy-img-cropper__cut--left ${IS_TOUCH_END ? '' : 'is-hightlight'}`"
14
- :style="`width: ${cutLeft}px; height: ${cutHeight}px;`"
14
+ :style="`width: ${toPx(cutLeft)}; height: ${toPx(cutHeight)};`"
15
15
  ></view>
16
16
  <!-- 裁剪框 -->
17
- <view class="oxy-img-cropper__cut--body" :style="`width: ${cutWidth}px; height: ${cutHeight}px;`">
17
+ <view class="oxy-img-cropper__cut--body" :style="`width: ${toPx(cutWidth)}; height: ${toPx(cutHeight)};`">
18
18
  <!-- 内部网格线 -->
19
19
  <view class="is-gridlines-x"></view>
20
20
  <view class="is-gridlines-y"></view>
@@ -52,7 +52,7 @@
52
52
  :id="canvasId"
53
53
  class="oxy-img-cropper__canvas"
54
54
  :disable-scroll="true"
55
- :style="`width: ${Number(canvasWidth) * canvasScale}px; height: ${Number(canvasHeight) * canvasScale}px;`"
55
+ :style="`width: ${toPx(Number(canvasWidth) * canvasScale)}; height: ${toPx(Number(canvasHeight) * canvasScale)};`"
56
56
  />
57
57
  <!-- 下方按钮 -->
58
58
  <view class="oxy-img-cropper__footer">
@@ -80,7 +80,8 @@ export default {
80
80
  import OxyIcon from '../oxy-icon/oxy-icon.vue'
81
81
  import OxyButton from '../oxy-button/oxy-button.vue'
82
82
  import { computed, getCurrentInstance, ref, watch } from 'vue'
83
- import { addUnit, objToStyle, uuid } from '../common/util'
83
+ import { objToStyle, unitConvert, unitConvertWithDefault, uuid } from '../common/util'
84
+ import { useWindowResize, type WindowResizeResult } from '../composables/useWindowResize'
84
85
  import { useTranslate } from '../composables/useTranslate'
85
86
  import { imgCropperProps, type ImgCropperExpose } from './types'
86
87
 
@@ -132,11 +133,12 @@ const imgScale = ref<number>(1)
132
133
  // imgWidth: null,
133
134
  // imgHeight: null,
134
135
  // 图片中心轴点距左的距离
135
- const imgLeft = ref<number>(uni.getSystemInfoSync().windowWidth / 2)
136
- const imgTop = ref<number>((uni.getSystemInfoSync().windowHeight / 2) * TOP_PERCENT)
136
+ const initialInfo = uni.getSystemInfoSync()
137
+ const imgLeft = ref<number>(initialInfo.windowWidth / 2)
138
+ const imgTop = ref<number>((initialInfo.windowHeight / 2) * TOP_PERCENT)
137
139
 
138
140
  const imgInfo = ref<UniApp.GetImageInfoSuccessData | null>(null)
139
- const info = ref<UniApp.GetSystemInfoResult>(uni.getSystemInfoSync())
141
+ const info = ref<UniApp.GetSystemInfoResult>(initialInfo)
140
142
 
141
143
  // 是否移动中设置 同时控制背景颜色是否高亮
142
144
  const IS_TOUCH_END = ref<boolean>(true)
@@ -157,31 +159,58 @@ const fingerDistance = ref<string | number>('')
157
159
  const ctx = ref<UniApp.CanvasContext | null>(null)
158
160
 
159
161
  const { proxy } = getCurrentInstance() as any
162
+ const updateSystemInfo = (res?: WindowResizeResult) => {
163
+ const systemInfo = uni.getSystemInfoSync()
164
+ const resizeWidth = Number(res?.size?.windowWidth ?? res?.windowWidth)
165
+ const resizeHeight = Number(res?.size?.windowHeight ?? res?.windowHeight)
166
+ info.value = {
167
+ ...systemInfo,
168
+ windowWidth: Number.isFinite(resizeWidth) && resizeWidth > 0 ? resizeWidth : systemInfo.windowWidth,
169
+ windowHeight: Number.isFinite(resizeHeight) && resizeHeight > 0 ? resizeHeight : systemInfo.windowHeight
170
+ }
171
+ }
172
+
173
+ function updateCropLayout() {
174
+ INIT_IMGWIDTH = props.imgWidth
175
+ INIT_IMGHEIGHT = props.imgHeight
176
+
177
+ // 根据aspectRatio计算裁剪框尺寸
178
+ const [widthRatio, heightRatio] = props.aspectRatio.split(':').map(Number)
179
+ const tempCutWidth = info.value.windowWidth - offset.value * 2
180
+ const tempCutHeight = (tempCutWidth * heightRatio) / widthRatio
181
+
182
+ cutWidth.value = tempCutWidth
183
+ cutHeight.value = tempCutHeight
184
+ cutTop.value = (info.value.windowHeight * TOP_PERCENT - tempCutHeight) / 2
185
+ cutLeft.value = offset.value
186
+
187
+ canvasScale.value = props.exportScale
188
+ canvasHeight.value = tempCutHeight
189
+ canvasWidth.value = tempCutWidth
190
+
191
+ // 根据开发者设置的图片目标尺寸计算实际尺寸
192
+ initImageSize()
193
+ }
194
+
195
+ const handleWindowResize = (res?: WindowResizeResult) => {
196
+ updateSystemInfo(res)
197
+ if (!props.modelValue) return
198
+
199
+ updateCropLayout()
200
+ if (imgInfo.value) {
201
+ computeImgSize()
202
+ resetImg()
203
+ }
204
+ }
205
+
206
+ useWindowResize(handleWindowResize)
160
207
 
161
208
  watch(
162
209
  () => props.modelValue,
163
210
  (newValue) => {
164
211
  if (newValue) {
165
- INIT_IMGWIDTH = props.imgWidth
166
- INIT_IMGHEIGHT = props.imgHeight
167
- info.value = uni.getSystemInfoSync()
168
-
169
- // 根据aspectRatio计算裁剪框尺寸
170
- const [widthRatio, heightRatio] = props.aspectRatio.split(':').map(Number)
171
- const tempCutWidth = info.value.windowWidth - offset.value * 2
172
- const tempCutHeight = (tempCutWidth * heightRatio) / widthRatio
173
-
174
- cutWidth.value = tempCutWidth
175
- cutHeight.value = tempCutHeight
176
- cutTop.value = (info.value.windowHeight * TOP_PERCENT - tempCutHeight) / 2
177
- cutLeft.value = offset.value
178
-
179
- canvasScale.value = props.exportScale
180
- canvasHeight.value = tempCutHeight
181
- canvasWidth.value = tempCutWidth
182
-
183
- // 根据开发者设置的图片目标尺寸计算实际尺寸
184
- initImageSize()
212
+ updateSystemInfo()
213
+ updateCropLayout()
185
214
  // 初始化canvas
186
215
  initCanvas()
187
216
  // 加载图片
@@ -242,21 +271,25 @@ const buttonStyle = computed(() => {
242
271
  position: 'absolute',
243
272
  right: 0,
244
273
  // height: 32px;
245
- width: '56px',
246
- 'border-radius': '16px',
247
- 'font-size': '16px'
274
+ width: '112rpx',
275
+ 'border-radius': '32rpx',
276
+ 'font-size': '32rpx'
248
277
  }
249
278
 
250
279
  return objToStyle(style)
251
280
  })
252
281
 
282
+ const toPx = (value: string | number | null | undefined) => unitConvert(value, 0, { output: 'px' })
283
+
253
284
  const imageStyle = computed(() => {
254
285
  const style: Record<string, string | number> = {
255
- width: picWidth.value ? addUnit(picWidth.value) : 'auto',
256
- height: picHeight.value ? addUnit(picHeight.value) : 'auto',
257
- transform: `translate(${addUnit(imgLeft.value - picWidth.value / 2)}, ${addUnit(imgTop.value - picHeight.value / 2)}) scale(${
258
- imgScale.value
259
- }) rotate(${imgAngle.value}deg)`,
286
+ width: picWidth.value ? unitConvert(picWidth.value, 0, { output: 'px' }) : 'auto',
287
+ height: picHeight.value ? unitConvert(picHeight.value, 0, { output: 'px' }) : 'auto',
288
+ transform: `translate(${unitConvert(imgLeft.value - picWidth.value / 2, 0, { output: 'px' })}, ${unitConvert(
289
+ imgTop.value - picHeight.value / 2,
290
+ 0,
291
+ { output: 'px' }
292
+ )}) scale(${imgScale.value}) rotate(${imgAngle.value}deg)`,
260
293
  'transition-duration': (isAnimation.value ? 0.4 : 0) + 's'
261
294
  }
262
295
  return objToStyle(style)
@@ -305,7 +338,7 @@ function setRoate(angle: number) {
305
338
  * 初始化图片的大小和角度以及距离
306
339
  */
307
340
  function resetImg() {
308
- const { windowHeight, windowWidth } = uni.getSystemInfoSync()
341
+ const { windowHeight, windowWidth } = info.value
309
342
  imgScale.value = 1
310
343
  imgAngle.value = 0
311
344
  imgLeft.value = windowWidth / 2
@@ -387,21 +420,33 @@ function initCanvas() {
387
420
  * 图片初始化,处理宽高特殊单位
388
421
  */
389
422
  function initImageSize() {
390
- // 处理宽高特殊单位 %>px
391
- if (INIT_IMGWIDTH && typeof INIT_IMGWIDTH === 'string' && INIT_IMGWIDTH.indexOf('%') !== -1) {
392
- const width: string = INIT_IMGWIDTH.replace('%', '')
393
- INIT_IMGWIDTH = (info.value.windowWidth / 100) * Number(width)
394
- picWidth.value = INIT_IMGWIDTH
395
- } else if (INIT_IMGWIDTH && typeof INIT_IMGWIDTH === 'number') {
396
- picWidth.value = INIT_IMGWIDTH
423
+ const resolveImageLength = (value: number | string | null, base: number): number | null => {
424
+ if (value === null || value === undefined || value === '') return null
425
+
426
+ if (typeof value === 'string') {
427
+ const trimmed = value.trim()
428
+ if (!trimmed) return null
429
+ if (trimmed.endsWith('%')) {
430
+ const percentValue = Number(trimmed.slice(0, -1))
431
+ if (!Number.isFinite(percentValue)) return null
432
+ return (base * percentValue) / 100
433
+ }
434
+ }
435
+
436
+ const converted = unitConvertWithDefault(value, { defaultUnit: 'rpx' })
437
+ return Number.isFinite(converted) && converted > 0 ? converted : null
397
438
  }
398
- if (INIT_IMGHEIGHT && typeof INIT_IMGHEIGHT === 'string' && INIT_IMGHEIGHT.indexOf('%') !== -1) {
399
- const height = (props.imgHeight as string).replace('%', '')
400
- // INIT_IMGHEIGHT = this.data.imgHeight = (info.value.windowHeight / 100) * Number(height)
401
- INIT_IMGHEIGHT = (info.value.windowHeight / 100) * Number(height)
402
- picWidth.value = INIT_IMGHEIGHT
403
- } else if (INIT_IMGHEIGHT && typeof INIT_IMGHEIGHT === 'number') {
404
- picWidth.value = Number(INIT_IMGWIDTH)
439
+
440
+ const resolvedWidth = resolveImageLength(INIT_IMGWIDTH, info.value.windowWidth)
441
+ if (resolvedWidth !== null) {
442
+ INIT_IMGWIDTH = resolvedWidth
443
+ picWidth.value = resolvedWidth
444
+ }
445
+
446
+ const resolvedHeight = resolveImageLength(INIT_IMGHEIGHT, info.value.windowHeight)
447
+ if (resolvedHeight !== null) {
448
+ INIT_IMGHEIGHT = resolvedHeight
449
+ picHeight.value = resolvedHeight
405
450
  }
406
451
  }
407
452
 
@@ -38,11 +38,11 @@ export const imgCropperProps = {
38
38
  */
39
39
  imgSrc: makeStringProp(''),
40
40
  /**
41
- * 图片宽
41
+ * 图片宽,支持 `px/rpx/%`,number 与纯数字字符串按 rpx 处理
42
42
  */
43
43
  imgWidth: makeNumericProp(''),
44
44
  /**
45
- * 图片高
45
+ * 图片高,支持 `px/rpx/%`,number 与纯数字字符串按 rpx 处理
46
46
  */
47
47
  imgHeight: makeNumericProp(''),
48
48
  /**
@@ -64,7 +64,7 @@ export default {
64
64
 
65
65
  <script lang="ts" setup>
66
66
  import { computed, getCurrentInstance, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue'
67
- import { addUnit, isDef, objToStyle } from '../common/util'
67
+ import { withDefaultUnit, isDef, objToStyle } from '../common/util'
68
68
  import { imgLazyProps } from './types'
69
69
 
70
70
  const props = defineProps(imgLazyProps)
@@ -73,10 +73,10 @@ const emit = defineEmits(['show', 'load', 'error', 'destroyed'])
73
73
  const rootStyle = computed(() => {
74
74
  const style: Record<string, string | number> = {}
75
75
  if (isDef(props.height)) {
76
- style['height'] = addUnit(props.height)
76
+ style['height'] = withDefaultUnit(props.height)
77
77
  }
78
78
  if (isDef(props.width)) {
79
- style['width'] = addUnit(props.width)
79
+ style['width'] = withDefaultUnit(props.width)
80
80
  }
81
81
  return `${objToStyle(style)}${props.customStyle}`
82
82
  })
@@ -28,15 +28,15 @@ export const imgLazyProps = {
28
28
  */
29
29
  mode: makeStringProp<ImageMode>('aspectFill'),
30
30
  /**
31
- * 宽度,默认单位为px
31
+ * 宽度,number 类型按 `rpx` 语义处理,也支持 `px/rpx`
32
32
  */
33
33
  width: numericProp,
34
34
  /**
35
- * 高度,默认单位为px
35
+ * 高度,number 类型按 `rpx` 语义处理,也支持 `px/rpx`
36
36
  */
37
37
  height: numericProp,
38
38
  /**
39
- * 圆角大小,默认单位为px
39
+ * 圆角大小,number 类型按 `rpx` 语义处理,也支持 `px/rpx`
40
40
  */
41
41
  borderRadius: makeStringProp('0'),
42
42
  /**
@@ -22,8 +22,8 @@
22
22
 
23
23
  @include b(index-anchor) {
24
24
  background-color: $-color-gray-2;
25
- padding: 10px;
26
- font-size: 14px;
25
+ padding: 20rpx;
26
+ font-size: 28rpx;
27
27
  color: $-color-title;
28
28
 
29
29
  @include when(sticky){
@@ -13,9 +13,9 @@
13
13
  </template>
14
14
 
15
15
  <script setup lang="ts">
16
- import { indexAnchorProps } from './type'
16
+ import { indexAnchorProps } from './types'
17
17
  import { onMounted, getCurrentInstance, ref, computed } from 'vue'
18
- import { indexBarInjectionKey } from '../oxy-index-bar/type'
18
+ import { indexBarInjectionKey } from '../oxy-index-bar/types'
19
19
  import { getRect, isDef, uuid } from '../common/util'
20
20
  import { useParent } from '../composables/useParent'
21
21
 
@@ -3,6 +3,9 @@ import { baseProps, makeRequiredProp } from '../common/props'
3
3
 
4
4
  export const indexAnchorProps = {
5
5
  ...baseProps,
6
+ /**
7
+ * 索引项标识,可用于字母索引或数字索引
8
+ */
6
9
  index: makeRequiredProp([String, Number])
7
10
  }
8
11
 
@@ -22,15 +22,15 @@
22
22
  @include e(sidebar) {
23
23
  position: absolute;
24
24
  top: 50%;
25
- right: 4px;
25
+ right: 8rpx;
26
26
  transform: translateY(-50%);
27
27
  }
28
28
 
29
29
  @include e(index) {
30
- font-size: 12px;
30
+ font-size: 24rpx;
31
31
  font-weight: $-fw-medium;
32
32
  color: $-color-title;
33
- padding: 4px 6px;
33
+ padding: 8rpx 12rpx;
34
34
 
35
35
  @include when(active) {
36
36
  color: $-color-theme;
@@ -24,8 +24,8 @@
24
24
  </template>
25
25
 
26
26
  <script setup lang="ts">
27
- import type { AnchorIndex } from './type'
28
- import { indexBarInjectionKey, indexBarProps } from './type'
27
+ import type { AnchorIndex } from './types'
28
+ import { indexBarInjectionKey, indexBarProps } from './types'
29
29
  import { ref, getCurrentInstance, onMounted, reactive, nextTick, watch } from 'vue'
30
30
  import { getRect, isDef, uuid, pause } from '../common/util'
31
31
  import { useChildren } from '../composables/useChildren'
@@ -71,7 +71,7 @@ let offsetTop = 0
71
71
  let sidebarInfo = {
72
72
  // 侧边栏距离顶部的高度
73
73
  offsetTop: 0,
74
- // 高度固定24px
74
+ // 高度固定48rpx
75
75
  indexHeight: 24
76
76
  }
77
77
 
@@ -6,7 +6,7 @@ export type AnchorIndex = number | string
6
6
 
7
7
  export const indexBarProps = {
8
8
  /**
9
- * @description 索引是否吸顶
9
+ * 索引栏是否启用吸顶效果
10
10
  */
11
11
  sticky: makeBooleanProp(false)
12
12
  }
@@ -16,7 +16,7 @@ export type IndexBarProps = ExtractPropTypes<typeof indexBarProps>
16
16
  export type InderBarProvide = {
17
17
  props: { sticky?: boolean }
18
18
  anchorState: {
19
- activeIndex: AnchorIndex | null // 当前激活的索引
19
+ activeIndex: AnchorIndex | null
20
20
  }
21
21
  }
22
22
 
@@ -301,7 +301,7 @@
301
301
  }
302
302
 
303
303
  @include e(count) {
304
- margin-left: 15px;
304
+ margin-left: 30rpx;
305
305
  font-size: $-input-count-fs;
306
306
  color: $-input-count-color;
307
307
  vertical-align: middle;
@@ -45,8 +45,8 @@
45
45
  &::after {
46
46
  position: absolute;
47
47
  content: "";
48
- width: calc(200% - 2px);
49
- height: calc(200% - 2px);
48
+ width: calc(200% - 4rpx);
49
+ height: calc(200% - 4rpx);
50
50
  left: 0;
51
51
  top: 0;
52
52
  border: 1px solid $-input-number-border-color;
@@ -77,7 +77,7 @@
77
77
  display: block;
78
78
  width: $-input-number-input-width;
79
79
  height: $-input-number-height;
80
- padding: 0 2px;
80
+ padding: 0 4rpx;
81
81
  box-sizing: border-box;
82
82
  z-index: 1;
83
83
  background: transparent;
@@ -93,7 +93,7 @@
93
93
  @include e(input-border) {
94
94
  position: absolute;
95
95
  width: 100%;
96
- height: calc(200% - 2px);
96
+ height: calc(200% - 4rpx);
97
97
  left: 0;
98
98
  top: 0;
99
99
  border-top: 1px solid $-input-number-border-color;
@@ -129,4 +129,4 @@
129
129
  border-left: none;
130
130
  }
131
131
  }
132
- }
132
+ }
@@ -13,7 +13,7 @@
13
13
  <view v-if="!withoutInput" class="oxy-input-number__inner" @click.stop="">
14
14
  <input
15
15
  class="oxy-input-number__input"
16
- :style="`${inputWidth ? 'width: ' + inputWidth : ''}`"
16
+ :style="`${inputWidth ? 'width: ' + withDefaultUnit(inputWidth) : ''}`"
17
17
  :type="inputType"
18
18
  :input-mode="precision ? 'decimal' : 'numeric'"
19
19
  :disabled="disabled || disableInput"
@@ -52,7 +52,7 @@ export default {
52
52
  <script lang="ts" setup>
53
53
  import OxyIcon from '../oxy-icon/oxy-icon.vue'
54
54
  import { computed, nextTick, ref, watch } from 'vue'
55
- import { isDef, isEqual } from '../common/util'
55
+ import { isDef, isEqual, withDefaultUnit } from '../common/util'
56
56
  import { inputNumberProps, type OperationType } from './types'
57
57
  import { callInterceptor } from '../common/interceptor'
58
58
 
@@ -57,9 +57,10 @@ export const inputNumberProps = {
57
57
  */
58
58
  withoutInput: makeBooleanProp(false),
59
59
  /**
60
- * 输入框宽度
60
+ * 输入框宽度。
61
+ * number 或纯数字字符串默认按 rpx 处理,支持传入带单位字符串(如 `px`、`rpx`、`%`)。
61
62
  */
62
- inputWidth: makeNumericProp(36),
63
+ inputWidth: makeNumericProp(72),
63
64
  /**
64
65
  * 是否允许为空
65
66
  */
@@ -18,7 +18,7 @@
18
18
  user-select: none;
19
19
 
20
20
  @include m(with-title) {
21
- border-radius: 20px 20px 0 0;
21
+ border-radius: 40rpx 40rpx 0 0;
22
22
  }
23
23
 
24
24
  @include e(header) {
@@ -28,7 +28,7 @@
28
28
  justify-content: center;
29
29
  box-sizing: content-box;
30
30
  height: $-keyboard-title-height;
31
- padding-top: 6px;
31
+ padding-top: 12rpx;
32
32
  color: $-keyboard-title-color;
33
33
  font-size: $-keyboard-title-font-size;
34
34
  }
@@ -45,7 +45,7 @@
45
45
 
46
46
  @include e(body) {
47
47
  display: flex;
48
- padding: 6px 0 0 6px;
48
+ padding: 12rpx 0 0 12rpx;
49
49
  }
50
50
 
51
51
  @include e(keys) {
@@ -57,7 +57,7 @@
57
57
  &-car {
58
58
  @include e(body) {
59
59
  display: flex;
60
- padding: 6px 0 0 6px;
60
+ padding: 12rpx 0 0 12rpx;
61
61
  }
62
62
  }
63
63
 
@@ -68,7 +68,7 @@
68
68
  flex-wrap: wrap;
69
69
 
70
70
  .oxy-key-wrapper {
71
- --oxy-keyboard-key-font-size: 18px;
71
+ --oxy-keyboard-key-font-size: 36rpx;
72
72
  flex-basis: 10%;
73
73
 
74
74
  @include m(wider) {
@@ -21,7 +21,7 @@
21
21
  flex: 1;
22
22
  flex-basis: 33%;
23
23
  box-sizing: border-box;
24
- padding: 0 6px 6px 0;
24
+ padding: 0 12rpx 12rpx 0;
25
25
 
26
26
  @include m(wider) {
27
27
  flex-basis: 66%;
@@ -45,8 +45,8 @@
45
45
  @include m(large) {
46
46
  position: absolute;
47
47
  top: 0;
48
- right: 6px;
49
- bottom: 6px;
48
+ right: 12rpx;
49
+ bottom: 12rpx;
50
50
  left: 0;
51
51
  height: auto;
52
52
  }
@@ -11,13 +11,13 @@
11
11
  <template v-if="text">
12
12
  {{ text }}
13
13
  </template>
14
- <oxy-icon v-else custom-class="oxy-key__icon" name="keyboard-delete" size="22px"></oxy-icon>
14
+ <oxy-icon v-else custom-class="oxy-key__icon" name="keyboard-delete" size="44rpx"></oxy-icon>
15
15
  </template>
16
16
  <template v-else-if="type === 'extra'">
17
17
  <template v-if="text">
18
18
  {{ text }}
19
19
  </template>
20
- <oxy-icon v-else custom-class="oxy-key__icon" name="keyboard-collapse" size="22px"></oxy-icon>
20
+ <oxy-icon v-else custom-class="oxy-key__icon" name="keyboard-collapse" size="44rpx"></oxy-icon>
21
21
  </template>
22
22
  <template v-else>{{ text }}</template>
23
23
  </view>
@@ -3,9 +3,24 @@ import { makeBooleanProp, makeNumericProp, makeStringProp } from '../../common/p
3
3
  export type NumberKeyType = '' | 'delete' | 'extra' | 'close'
4
4
 
5
5
  export const keyProps = {
6
+ /**
7
+ * 按键类型
8
+ */
6
9
  type: makeStringProp<NumberKeyType>(''),
10
+ /**
11
+ * 按键显示文本
12
+ */
7
13
  text: makeNumericProp(''),
14
+ /**
15
+ * 是否为加宽按键
16
+ */
8
17
  wider: makeBooleanProp(false),
18
+ /**
19
+ * 是否为大号按键
20
+ */
9
21
  large: makeBooleanProp(false),
22
+ /**
23
+ * 是否显示加载状态
24
+ */
10
25
  loading: makeBooleanProp(false)
11
26
  }
@@ -3,6 +3,7 @@
3
3
  v-model="show"
4
4
  position="bottom"
5
5
  :z-index="zIndex"
6
+ :max-width="popupMaxWidth"
6
7
  :safe-area-inset-bottom="safeAreaInsetBottom"
7
8
  :modal-style="modal ? '' : 'opacity: 0;'"
8
9
  :modal="hideOnClickOutside"
@@ -33,6 +33,11 @@ export const keyboardProps = {
33
33
  * 层级
34
34
  */
35
35
  zIndex: makeNumberProp(100),
36
+ /**
37
+ * 弹层最大宽度,支持 `rpx`、`px`、`%` 等单位;
38
+ * `%` 在弹层打开时按屏幕宽度换算为 `rpx`
39
+ */
40
+ popupMaxWidth: makeStringProp('1200rpx'),
36
41
  /**
37
42
  * 最大长度
38
43
  */