@gmcb/uv-ui 0.2.26

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 (285) hide show
  1. package/CHANGELOG.md +295 -0
  2. package/LICENSE +21 -0
  3. package/README.md +164 -0
  4. package/components/uv-action-sheet/props.js +50 -0
  5. package/components/uv-action-sheet/uv-action-sheet.vue +280 -0
  6. package/components/uv-album/uv-album.vue +312 -0
  7. package/components/uv-alert/props.js +45 -0
  8. package/components/uv-alert/uv-alert.vue +246 -0
  9. package/components/uv-avatar/props.js +85 -0
  10. package/components/uv-avatar/uv-avatar.vue +182 -0
  11. package/components/uv-avatar-group/props.js +53 -0
  12. package/components/uv-avatar-group/uv-avatar-group.vue +106 -0
  13. package/components/uv-back-top/props.js +58 -0
  14. package/components/uv-back-top/uv-back-top.vue +116 -0
  15. package/components/uv-badge/props.js +73 -0
  16. package/components/uv-badge/uv-badge.vue +176 -0
  17. package/components/uv-button/nvue.scss +46 -0
  18. package/components/uv-button/props.js +163 -0
  19. package/components/uv-button/uv-button.vue +529 -0
  20. package/components/uv-button/vue.scss +93 -0
  21. package/components/uv-calendar/calendar.js +546 -0
  22. package/components/uv-calendar/header.vue +104 -0
  23. package/components/uv-calendar/month.vue +616 -0
  24. package/components/uv-calendar/props.js +145 -0
  25. package/components/uv-calendar/uv-calendar.vue +390 -0
  26. package/components/uv-calendars/calendar-body.vue +376 -0
  27. package/components/uv-calendars/calendar-item.vue +248 -0
  28. package/components/uv-calendars/calendar.js +546 -0
  29. package/components/uv-calendars/i18n/en.json +12 -0
  30. package/components/uv-calendars/i18n/index.js +8 -0
  31. package/components/uv-calendars/i18n/zh-Hans.json +12 -0
  32. package/components/uv-calendars/i18n/zh-Hant.json +12 -0
  33. package/components/uv-calendars/util.js +435 -0
  34. package/components/uv-calendars/uv-calendars.vue +452 -0
  35. package/components/uv-cell/props.js +116 -0
  36. package/components/uv-cell/uv-cell.vue +209 -0
  37. package/components/uv-cell-group/props.js +15 -0
  38. package/components/uv-cell-group/uv-cell-group.vue +63 -0
  39. package/components/uv-checkbox/props.js +70 -0
  40. package/components/uv-checkbox/uv-checkbox.vue +371 -0
  41. package/components/uv-checkbox-group/props.js +84 -0
  42. package/components/uv-checkbox-group/uv-checkbox-group.vue +119 -0
  43. package/components/uv-code/props.js +35 -0
  44. package/components/uv-code/uv-code.vue +136 -0
  45. package/components/uv-code-input/props.js +83 -0
  46. package/components/uv-code-input/uv-code-input.vue +272 -0
  47. package/components/uv-col/props.js +30 -0
  48. package/components/uv-col/uv-col.vue +165 -0
  49. package/components/uv-collapse/props.js +20 -0
  50. package/components/uv-collapse/uv-collapse.vue +86 -0
  51. package/components/uv-collapse-item/props.js +60 -0
  52. package/components/uv-collapse-item/uv-collapse-item.vue +228 -0
  53. package/components/uv-column-notice/props.js +61 -0
  54. package/components/uv-column-notice/uv-column-notice.vue +176 -0
  55. package/components/uv-count-down/props.js +25 -0
  56. package/components/uv-count-down/utils.js +62 -0
  57. package/components/uv-count-down/uv-count-down.vue +169 -0
  58. package/components/uv-count-to/props.js +60 -0
  59. package/components/uv-count-to/uv-count-to.vue +187 -0
  60. package/components/uv-datetime-picker/props.js +130 -0
  61. package/components/uv-datetime-picker/uv-datetime-picker.vue +355 -0
  62. package/components/uv-divider/props.js +45 -0
  63. package/components/uv-divider/uv-divider.vue +113 -0
  64. package/components/uv-drop-down/uv-drop-down.vue +135 -0
  65. package/components/uv-drop-down-item/uv-drop-down-item.vue +169 -0
  66. package/components/uv-drop-down-popup/uv-drop-down-popup.vue +242 -0
  67. package/components/uv-empty/props.js +60 -0
  68. package/components/uv-empty/uv-empty.vue +126 -0
  69. package/components/uv-form/props.js +46 -0
  70. package/components/uv-form/uv-form.vue +209 -0
  71. package/components/uv-form/valid.js +1343 -0
  72. package/components/uv-form-item/props.js +49 -0
  73. package/components/uv-form-item/uv-form-item.vue +226 -0
  74. package/components/uv-gap/props.js +25 -0
  75. package/components/uv-gap/uv-gap.vue +36 -0
  76. package/components/uv-grid/props.js +20 -0
  77. package/components/uv-grid/uv-grid.vue +100 -0
  78. package/components/uv-grid-item/props.js +15 -0
  79. package/components/uv-grid-item/uv-grid-item.vue +223 -0
  80. package/components/uv-icon/icons.js +160 -0
  81. package/components/uv-icon/props.js +90 -0
  82. package/components/uv-icon/uv-icon.vue +226 -0
  83. package/components/uv-icon/uvicons.ttf +0 -0
  84. package/components/uv-image/props.js +100 -0
  85. package/components/uv-image/uv-image.vue +296 -0
  86. package/components/uv-index-anchor/props.js +30 -0
  87. package/components/uv-index-anchor/uv-index-anchor.vue +98 -0
  88. package/components/uv-index-item/uv-index-item.vue +87 -0
  89. package/components/uv-index-list/props.js +30 -0
  90. package/components/uv-index-list/uv-index-list.vue +461 -0
  91. package/components/uv-input/props.js +175 -0
  92. package/components/uv-input/uv-input.vue +348 -0
  93. package/components/uv-keyboard/props.js +95 -0
  94. package/components/uv-keyboard/uv-keyboard.vue +180 -0
  95. package/components/uv-keyboard-car/props.js +24 -0
  96. package/components/uv-keyboard-car/uv-keyboard-car.vue +347 -0
  97. package/components/uv-keyboard-number/props.js +19 -0
  98. package/components/uv-keyboard-number/uv-keyboard-number.vue +201 -0
  99. package/components/uv-line/props.js +34 -0
  100. package/components/uv-line/uv-line.vue +60 -0
  101. package/components/uv-line-progress/props.js +29 -0
  102. package/components/uv-line-progress/uv-line-progress.vue +146 -0
  103. package/components/uv-link/props.js +40 -0
  104. package/components/uv-link/uv-link.vue +83 -0
  105. package/components/uv-list/uv-list.vue +147 -0
  106. package/components/uv-list-item/uv-list-item.vue +535 -0
  107. package/components/uv-load-more/props.js +95 -0
  108. package/components/uv-load-more/uv-load-more.vue +152 -0
  109. package/components/uv-loading-icon/props.js +67 -0
  110. package/components/uv-loading-icon/uv-loading-icon.vue +347 -0
  111. package/components/uv-loading-page/props.js +55 -0
  112. package/components/uv-loading-page/uv-loading-page.vue +96 -0
  113. package/components/uv-modal/props.js +90 -0
  114. package/components/uv-modal/uv-modal.vue +245 -0
  115. package/components/uv-navbar/props.js +89 -0
  116. package/components/uv-navbar/uv-navbar.vue +245 -0
  117. package/components/uv-no-network/props.js +20 -0
  118. package/components/uv-no-network/uv-no-network.vue +222 -0
  119. package/components/uv-notice-bar/props.js +76 -0
  120. package/components/uv-notice-bar/uv-notice-bar.vue +110 -0
  121. package/components/uv-notify/props.js +45 -0
  122. package/components/uv-notify/uv-notify.vue +220 -0
  123. package/components/uv-number-box/props.js +118 -0
  124. package/components/uv-number-box/uv-number-box.vue +397 -0
  125. package/components/uv-overlay/props.js +25 -0
  126. package/components/uv-overlay/uv-overlay.vue +85 -0
  127. package/components/uv-parse/node/node.vue +576 -0
  128. package/components/uv-parse/parser.js +1335 -0
  129. package/components/uv-parse/uv-parse.vue +498 -0
  130. package/components/uv-pick-color/colors.js +217 -0
  131. package/components/uv-pick-color/props.js +47 -0
  132. package/components/uv-pick-color/uv-pick-color.vue +551 -0
  133. package/components/uv-picker/props.js +95 -0
  134. package/components/uv-picker/uv-picker.vue +329 -0
  135. package/components/uv-popup/keypress.js +45 -0
  136. package/components/uv-popup/uv-popup.vue +537 -0
  137. package/components/uv-preview-video/uv-preview-video.vue +52 -0
  138. package/components/uv-qrcode/cache.js +1 -0
  139. package/components/uv-qrcode/gcanvas/bridge/bridge-weex.js +241 -0
  140. package/components/uv-qrcode/gcanvas/context-2d/FillStyleLinearGradient.js +18 -0
  141. package/components/uv-qrcode/gcanvas/context-2d/FillStylePattern.js +8 -0
  142. package/components/uv-qrcode/gcanvas/context-2d/FillStyleRadialGradient.js +17 -0
  143. package/components/uv-qrcode/gcanvas/context-2d/RenderingContext.js +666 -0
  144. package/components/uv-qrcode/gcanvas/context-webgl/ActiveInfo.js +11 -0
  145. package/components/uv-qrcode/gcanvas/context-webgl/Buffer.js +21 -0
  146. package/components/uv-qrcode/gcanvas/context-webgl/Framebuffer.js +21 -0
  147. package/components/uv-qrcode/gcanvas/context-webgl/GLenum.js +298 -0
  148. package/components/uv-qrcode/gcanvas/context-webgl/GLmethod.js +142 -0
  149. package/components/uv-qrcode/gcanvas/context-webgl/GLtype.js +23 -0
  150. package/components/uv-qrcode/gcanvas/context-webgl/Program.js +21 -0
  151. package/components/uv-qrcode/gcanvas/context-webgl/Renderbuffer.js +21 -0
  152. package/components/uv-qrcode/gcanvas/context-webgl/RenderingContext.js +1191 -0
  153. package/components/uv-qrcode/gcanvas/context-webgl/Shader.js +22 -0
  154. package/components/uv-qrcode/gcanvas/context-webgl/ShaderPrecisionFormat.js +11 -0
  155. package/components/uv-qrcode/gcanvas/context-webgl/Texture.js +22 -0
  156. package/components/uv-qrcode/gcanvas/context-webgl/UniformLocation.js +22 -0
  157. package/components/uv-qrcode/gcanvas/context-webgl/classUtils.js +3 -0
  158. package/components/uv-qrcode/gcanvas/env/canvas.js +74 -0
  159. package/components/uv-qrcode/gcanvas/env/image.js +96 -0
  160. package/components/uv-qrcode/gcanvas/env/tool.js +24 -0
  161. package/components/uv-qrcode/gcanvas/index.js +39 -0
  162. package/components/uv-qrcode/props.js +85 -0
  163. package/components/uv-qrcode/qrcode.js +34 -0
  164. package/components/uv-qrcode/queue.js +41 -0
  165. package/components/uv-qrcode/uv-qrcode.vue +1038 -0
  166. package/components/uv-radio/props.js +65 -0
  167. package/components/uv-radio/uv-radio.vue +349 -0
  168. package/components/uv-radio-group/props.js +89 -0
  169. package/components/uv-radio-group/uv-radio-group.vue +115 -0
  170. package/components/uv-rate/props.js +73 -0
  171. package/components/uv-rate/uv-rate.vue +274 -0
  172. package/components/uv-read-more/props.js +62 -0
  173. package/components/uv-read-more/uv-read-more.vue +162 -0
  174. package/components/uv-row/props.js +20 -0
  175. package/components/uv-row/uv-row.vue +95 -0
  176. package/components/uv-row-notice/props.js +40 -0
  177. package/components/uv-row-notice/uv-row-notice.vue +341 -0
  178. package/components/uv-safe-bottom/uv-safe-bottom.vue +67 -0
  179. package/components/uv-scroll-list/nvue.js +29 -0
  180. package/components/uv-scroll-list/props.js +35 -0
  181. package/components/uv-scroll-list/scrollWxs.wxs +51 -0
  182. package/components/uv-scroll-list/uv-scroll-list.vue +218 -0
  183. package/components/uv-search/props.js +127 -0
  184. package/components/uv-search/uv-search.vue +311 -0
  185. package/components/uv-skeleton/props.js +65 -0
  186. package/components/uv-skeleton/uv-skeleton.vue +250 -0
  187. package/components/uv-skeletons/uv-skeletons.vue +247 -0
  188. package/components/uv-slider/props.js +58 -0
  189. package/components/uv-slider/uv-slider.vue +58 -0
  190. package/components/uv-status-bar/props.js +8 -0
  191. package/components/uv-status-bar/uv-status-bar.vue +54 -0
  192. package/components/uv-steps/props.js +40 -0
  193. package/components/uv-steps/uv-steps.vue +83 -0
  194. package/components/uv-steps-item/props.js +25 -0
  195. package/components/uv-steps-item/uv-steps-item.vue +347 -0
  196. package/components/uv-sticky/props.js +41 -0
  197. package/components/uv-sticky/uv-sticky.vue +223 -0
  198. package/components/uv-subsection/props.js +54 -0
  199. package/components/uv-subsection/uv-subsection.vue +269 -0
  200. package/components/uv-swipe-action/props.js +10 -0
  201. package/components/uv-swipe-action/uv-swipe-action.vue +65 -0
  202. package/components/uv-swipe-action-item/index - backup.wxs +256 -0
  203. package/components/uv-swipe-action-item/index.wxs +225 -0
  204. package/components/uv-swipe-action-item/nvue - backup.js +264 -0
  205. package/components/uv-swipe-action-item/nvue.js +182 -0
  206. package/components/uv-swipe-action-item/props.js +40 -0
  207. package/components/uv-swipe-action-item/uv-swipe-action-item.vue +200 -0
  208. package/components/uv-swipe-action-item/wxs.js +15 -0
  209. package/components/uv-swiper/props.js +136 -0
  210. package/components/uv-swiper/uv-swiper.vue +263 -0
  211. package/components/uv-swiper-indicator/props.js +30 -0
  212. package/components/uv-swiper-indicator/uv-swiper-indicator.vue +112 -0
  213. package/components/uv-switch/props.js +58 -0
  214. package/components/uv-switch/uv-switch.vue +182 -0
  215. package/components/uv-tabbar/props.js +50 -0
  216. package/components/uv-tabbar/uv-tabbar.vue +146 -0
  217. package/components/uv-tabbar-item/props.js +40 -0
  218. package/components/uv-tabbar-item/uv-tabbar-item.vue +146 -0
  219. package/components/uv-tabs/props.js +71 -0
  220. package/components/uv-tabs/uv-tabs.vue +391 -0
  221. package/components/uv-tags/props.js +104 -0
  222. package/components/uv-tags/uv-tags.vue +379 -0
  223. package/components/uv-text/props.js +113 -0
  224. package/components/uv-text/uv-text.vue +218 -0
  225. package/components/uv-text/value.js +87 -0
  226. package/components/uv-textarea/props.js +138 -0
  227. package/components/uv-textarea/uv-textarea.vue +238 -0
  228. package/components/uv-toast/uv-toast.vue +292 -0
  229. package/components/uv-toolbar/props.js +40 -0
  230. package/components/uv-toolbar/uv-toolbar.vue +109 -0
  231. package/components/uv-tooltip/props.js +60 -0
  232. package/components/uv-tooltip/uv-tooltip.vue +372 -0
  233. package/components/uv-transition/createAnimation.js +131 -0
  234. package/components/uv-transition/props.js +31 -0
  235. package/components/uv-transition/uv-transition.vue +320 -0
  236. package/components/uv-upload/mixin.js +22 -0
  237. package/components/uv-upload/props.js +130 -0
  238. package/components/uv-upload/utils.js +151 -0
  239. package/components/uv-upload/uv-upload.vue +488 -0
  240. package/components/uv-vtabs/props.js +79 -0
  241. package/components/uv-vtabs/uv-vtabs.vue +438 -0
  242. package/components/uv-vtabs-item/uv-vtabs-item.vue +68 -0
  243. package/components/uv-waterfall/props.js +69 -0
  244. package/components/uv-waterfall/uv-waterfall.vue +265 -0
  245. package/index.js +82 -0
  246. package/index.scss +7 -0
  247. package/libs/config/config.js +34 -0
  248. package/libs/css/color.scss +32 -0
  249. package/libs/css/common.scss +100 -0
  250. package/libs/css/components.scss +23 -0
  251. package/libs/css/variable.scss +111 -0
  252. package/libs/css/vue.scss +40 -0
  253. package/libs/function/colorGradient.js +134 -0
  254. package/libs/function/compress.js +27 -0
  255. package/libs/function/debounce.js +29 -0
  256. package/libs/function/digit.js +167 -0
  257. package/libs/function/index.js +734 -0
  258. package/libs/function/platform.js +75 -0
  259. package/libs/function/test.js +287 -0
  260. package/libs/function/throttle.js +30 -0
  261. package/libs/luch-request/adapters/index.js +132 -0
  262. package/libs/luch-request/core/InterceptorManager.js +51 -0
  263. package/libs/luch-request/core/Request.js +201 -0
  264. package/libs/luch-request/core/buildFullPath.js +20 -0
  265. package/libs/luch-request/core/defaults.js +33 -0
  266. package/libs/luch-request/core/dispatchRequest.js +6 -0
  267. package/libs/luch-request/core/mergeConfig.js +126 -0
  268. package/libs/luch-request/core/settle.js +16 -0
  269. package/libs/luch-request/helpers/buildURL.js +64 -0
  270. package/libs/luch-request/helpers/combineURLs.js +14 -0
  271. package/libs/luch-request/helpers/isAbsoluteURL.js +14 -0
  272. package/libs/luch-request/index.d.ts +197 -0
  273. package/libs/luch-request/index.js +2 -0
  274. package/libs/luch-request/utils/clone.js +264 -0
  275. package/libs/luch-request/utils.js +135 -0
  276. package/libs/mixin/button.js +13 -0
  277. package/libs/mixin/mixin.js +172 -0
  278. package/libs/mixin/mpMixin.js +8 -0
  279. package/libs/mixin/mpShare.js +13 -0
  280. package/libs/mixin/openType.js +47 -0
  281. package/libs/mixin/touch.js +59 -0
  282. package/libs/util/dayjs.js +216 -0
  283. package/libs/util/route.js +126 -0
  284. package/package.json +28 -0
  285. package/theme.scss +43 -0
@@ -0,0 +1,47 @@
1
+ export default {
2
+ props: {
3
+ // 颜色选择器初始颜色
4
+ color: {
5
+ type: Object,
6
+ default: () => {
7
+ return { r: 0, g: 0, b: 0, a: 0 }
8
+ }
9
+ },
10
+ // 预制颜色
11
+ prefabColor: {
12
+ type: Array,
13
+ default: () => []
14
+ },
15
+ // 是否允许点击遮罩关闭
16
+ closeOnClickOverlay: {
17
+ type: Boolean,
18
+ default: true
19
+ },
20
+ // 顶部标题
21
+ title: {
22
+ type: String,
23
+ default: ''
24
+ },
25
+ // 取消按钮的文字
26
+ cancelText: {
27
+ type: String,
28
+ default: '取消'
29
+ },
30
+ // 确认按钮的文字
31
+ confirmText: {
32
+ type: String,
33
+ default: '确定'
34
+ },
35
+ // 取消按钮的颜色
36
+ cancelColor: {
37
+ type: String,
38
+ default: '#909193'
39
+ },
40
+ // 确认按钮的颜色
41
+ confirmColor: {
42
+ type: String,
43
+ default: '#3c9cff'
44
+ },
45
+ ...uni.$uv?.props?.pickColor
46
+ }
47
+ }
@@ -0,0 +1,551 @@
1
+ <template>
2
+ <!-- #ifndef APP-NVUE -->
3
+ <uv-popup
4
+ ref="pickerColorPopup"
5
+ mode="bottom"
6
+ :close-on-click-overlay="closeOnClickOverlay"
7
+ @change="popupChange">
8
+ <view class="uv-pick-color">
9
+ <uv-toolbar
10
+ :show="showToolbar"
11
+ :cancelColor="cancelColor"
12
+ :confirmColor="confirmColor"
13
+ :cancelText="cancelText"
14
+ :confirmText="confirmText"
15
+ :title="title"
16
+ :show-border="true"
17
+ @cancel="cancelHandler"
18
+ @confirm="confirmHandler"></uv-toolbar>
19
+ <view
20
+ class="uv-pick-color__box"
21
+ :style="{
22
+ background:`rgb(${bgcolor.r},${bgcolor.g},${bgcolor.b})`
23
+ }"
24
+ >
25
+ <!-- #ifdef H5 -->
26
+ <view
27
+ class="uv-pick-color__box__bg drag-box"
28
+ @tap.stop.prevent="touchstart($event, 0)"
29
+ @touchstart.stop.prevent="touchstart($event, 0)"
30
+ @touchmove.stop.prevent="touchmove($event, 0)"
31
+ @touchend.stop.prevent="touchend($event, 0)"
32
+ >
33
+ <!-- #endif -->
34
+ <!-- #ifndef H5 -->
35
+ <view
36
+ class="uv-pick-color__box__bg drag-box"
37
+ @touchstart.stop.prevent="touchstart($event, 0)"
38
+ @touchmove.stop.prevent="touchmove($event, 0)"
39
+ @touchend.stop.prevent="touchend($event, 0)"
40
+ >
41
+ <!-- #endif -->
42
+ <view class="uv-pick-color__box__bg-mask"></view>
43
+ <view
44
+ class="uv-pick-color__box__bg-pointer"
45
+ :style="[pointerStyle]"
46
+ >
47
+ </view>
48
+ </view>
49
+ </view>
50
+ <view class="uv-pick-color__control">
51
+ <view class="uv-pick-color__control__alpha">
52
+ <view
53
+ class="uv-pick-color__control__alpha--color"
54
+ :style="{ background:`rgba(${rgba.r},${rgba.g},${rgba.b},${rgba.a})` }"
55
+ ></view>
56
+ </view>
57
+ <view class="uv-pick-color__control__item">
58
+ <!-- #ifdef H5 -->
59
+ <view
60
+ class="uv-pick-color__control__item__drag drag-box"
61
+ @tap.stop="touchstart($event, 1)"
62
+ @touchstart.stop="touchstart($event, 1)"
63
+ @touchmove.stop="touchmove($event, 1)"
64
+ @touchend.stop="touchend($event, 1)"
65
+ >
66
+ <!-- #endif -->
67
+ <!-- #ifndef H5 -->
68
+ <view
69
+ class="uv-pick-color__control__item__drag drag-box"
70
+ @touchstart.stop="touchstart($event, 1)"
71
+ @touchmove.stop="touchmove($event, 1)"
72
+ @touchend.stop="touchend($event, 1)"
73
+ >
74
+ <!-- #endif -->
75
+ <view class="uv-pick-color__control__item__drag--hue"></view>
76
+ <view
77
+ class="uv-pick-color__control__item__drag--circle"
78
+ :style="{
79
+ left: $uv.getPx(site[1].left - 10,true)
80
+ }"
81
+ ></view>
82
+ </view>
83
+ <!-- #ifdef H5 -->
84
+ <view
85
+ class="uv-pick-color__control__item__drag drag-box"
86
+ @tap.stop="touchstart($event, 2)"
87
+ @touchstart.stop="touchstart($event, 2)"
88
+ @touchmove.stop="touchmove($event, 2)"
89
+ @touchend.stop="touchend($event, 2)"
90
+ >
91
+ <!-- #endif -->
92
+ <!-- #ifndef H5 -->
93
+ <view
94
+ class="uv-pick-color__control__item__drag drag-box"
95
+ @touchstart.stop="touchstart($event, 2)"
96
+ @touchmove.stop="touchmove($event, 2)"
97
+ @touchend.stop="touchend($event, 2)"
98
+ >
99
+ <!-- #endif -->
100
+ <view class="uv-pick-color__control__item__drag--alpha"></view>
101
+ <view
102
+ class="uv-pick-color__control__item__drag--circle"
103
+ :style="{
104
+ left: $uv.getPx(site[2].left - 10,true)
105
+ }"
106
+ ></view>
107
+ </view>
108
+ </view>
109
+ </view>
110
+ <view class="uv-pick-color__result">
111
+ <view
112
+ class="uv-pick-color__result__select"
113
+ hover-class="uv-hover-class"
114
+ @click.stop="select"
115
+ >
116
+ <text class="text">切换</text>
117
+ <text class="text">模式</text>
118
+ </view>
119
+ <view class="uv-pick-color__result__item" v-if="mode">
120
+ <view class="uv-pick-color__result__item--value uv-border">
121
+ <text>{{hex}}</text>
122
+ </view>
123
+ <view class="uv-pick-color__result__item--hex">
124
+ <text>HEX</text>
125
+ </view>
126
+ </view>
127
+ <template v-else>
128
+ <view class="uv-pick-color__result__item">
129
+ <view class="uv-pick-color__result__item--value uv-border">
130
+ <text>{{rgba.r}}</text>
131
+ </view>
132
+ <view class="uv-pick-color__result__item--rgba">
133
+ <text>R</text>
134
+ </view>
135
+ </view>
136
+ <view class="uv-pick-color__result__gap"></view>
137
+ <view class="uv-pick-color__result__item">
138
+ <view class="uv-pick-color__result__item--value uv-border">
139
+ <text>{{rgba.g}}</text>
140
+ </view>
141
+ <view class="uv-pick-color__result__item--rgba">
142
+ <text>G</text>
143
+ </view>
144
+ </view>
145
+ <view class="uv-pick-color__result__gap"></view>
146
+ <view class="uv-pick-color__result__item">
147
+ <view class="uv-pick-color__result__item--value uv-border">
148
+ <text>{{rgba.b}}</text>
149
+ </view>
150
+ <view class="uv-pick-color__result__item--rgba">
151
+ <text>B</text>
152
+ </view>
153
+ </view>
154
+ <view class="uv-pick-color__result__gap"></view>
155
+ <view class="uv-pick-color__result__item">
156
+ <view class="uv-pick-color__result__item--value uv-border">
157
+ <text>{{rgba.a}}</text>
158
+ </view>
159
+ <view class="uv-pick-color__result__item--rgba">
160
+ <text>A</text>
161
+ </view>
162
+ </view>
163
+ </template>
164
+ </view>
165
+ <view class="uv-pick-color__prefab">
166
+ <view
167
+ class="uv-pick-color__prefab__item"
168
+ v-for="(item,index) in colorList"
169
+ :key="index"
170
+ >
171
+ <view
172
+ class="uv-pick-color__prefab__item--color"
173
+ :style="{ background:`rgba(${item.r},${item.g},${item.b},${item.a})` }"
174
+ @click.stop="setColorBySelect(item)"
175
+ ></view>
176
+ </view>
177
+ </view>
178
+ </view>
179
+ </uv-popup>
180
+ <!-- #endif -->
181
+ <!-- #ifdef APP-NVUE -->
182
+ <view>
183
+ <text>nvue暂不支持uv-pick-color组件</text>
184
+ </view>
185
+ <!-- #endif -->
186
+ </template>
187
+ <script>
188
+ import mpMixin from '../../libs/mixin/mpMixin.js';
189
+ import mixin from '../../libs/mixin/mixin.js';
190
+ import { rgbToHsb, hsbToRgb, rgbToHex, colorList } from './colors.js';
191
+ import props from './props.js';
192
+ export default {
193
+ name: 'uv-pick-color',
194
+ emits: ['confirm', 'cancel', 'close', 'change'],
195
+ mixins: [mpMixin, mixin, props],
196
+ computed: {
197
+ pointerStyle() {
198
+ const style = {};
199
+ style.top = this.$uv.addUnit(this.site[0].top - 8);
200
+ style.left = this.$uv.addUnit(this.site[0].left - 8);
201
+ return style;
202
+ }
203
+ },
204
+ data() {
205
+ return {
206
+ showToolbar: false,
207
+ // rgba 颜色
208
+ rgba: {
209
+ r: 0,
210
+ g: 0,
211
+ b: 0,
212
+ a: 1
213
+ },
214
+ // hsb 颜色
215
+ hsb: {
216
+ h: 0,
217
+ s: 0,
218
+ b: 0
219
+ },
220
+ site: [{
221
+ top: 0,
222
+ left: 0
223
+ }, {
224
+ left: 0
225
+ }, {
226
+ left: 0
227
+ }],
228
+ index: 0,
229
+ bgcolor: {
230
+ r: 255,
231
+ g: 0,
232
+ b: 0,
233
+ a: 1
234
+ },
235
+ hex: '#000000',
236
+ mode: true,
237
+ colorList: colorList
238
+ };
239
+ },
240
+ watch: {
241
+ prefabColor(newVal) {
242
+ this.colorList = newVal;
243
+ }
244
+ },
245
+ created() {
246
+ // #ifdef APP-NVUE
247
+ return this.$uv.error('nvue暂不支持uv-pick-color组件');
248
+ // #endif
249
+ this.rgba = this.color;
250
+ if (this.prefabColor.length) this.colorList = this.prefabColor;
251
+ },
252
+ methods: {
253
+ open() {
254
+ this.$refs.pickerColorPopup.open();
255
+ this.showToolbar = true;
256
+ this.$nextTick(async () => {
257
+ await this.$uv.sleep(350);
258
+ this.getSelectorQuery();
259
+ })
260
+ },
261
+ close() {
262
+ this.$refs.pickerColorPopup.close();
263
+ },
264
+ popupChange(e) {
265
+ if(!e.show) this.$emit('close');
266
+ },
267
+ // 点击工具栏的取消按钮
268
+ cancelHandler() {
269
+ this.$emit('cancel');
270
+ this.close();
271
+ },
272
+ // 点击工具栏的确定按钮
273
+ confirmHandler() {
274
+ this.$emit('confirm', {
275
+ rgba: this.rgba,
276
+ hex: this.hex
277
+ })
278
+ this.close();
279
+ },
280
+ // 初始化
281
+ init() {
282
+ // hsb 颜色
283
+ this.hsb = rgbToHsb(this.rgba);
284
+ this.setValue(this.rgba);
285
+ },
286
+ async getSelectorQuery() {
287
+ const data = await this.$uvGetRect('.drag-box',true);
288
+ this.position = data;
289
+ this.setColorBySelect(this.rgba);
290
+ },
291
+ // 选择模式
292
+ select() {
293
+ this.mode = !this.mode;
294
+ },
295
+ touchstart(e, index) {
296
+ const { clientX, clientY } = e.touches[0];
297
+ this.pageX = clientX;
298
+ this.pageY = clientY;
299
+ this.setPosition(clientX, clientY, index);
300
+ },
301
+ touchmove(e, index) {
302
+ const { clientX, clientY } = e.touches[0];
303
+ this.moveX = clientX;
304
+ this.moveY = clientY;
305
+ this.setPosition(clientX, clientY, index);
306
+ },
307
+ touchend(e, index) {},
308
+ /**
309
+ * 设置位置
310
+ */
311
+ setPosition(x, y, index) {
312
+ this.index = index;
313
+ const { top, left, width, height } = this.position[index];
314
+ // 设置最大最小值
315
+ this.site[index].left = Math.max(0, Math.min(parseInt(x - left), width));
316
+ if (index === 0) {
317
+ this.site[index].top = Math.max(0, Math.min(parseInt(y - top), height));
318
+ // 设置颜色
319
+ this.hsb.s = parseInt((100 * this.site[index].left) / width);
320
+ this.hsb.b = parseInt(100 - (100 * this.site[index].top) / height);
321
+ this.setColor();
322
+ this.setValue(this.rgba);
323
+ } else {
324
+ this.setControl(index, this.site[index].left);
325
+ }
326
+ },
327
+ /**
328
+ * 设置 rgb 颜色
329
+ */
330
+ setColor() {
331
+ const rgb = hsbToRgb(this.hsb);
332
+ this.rgba.r = rgb.r;
333
+ this.rgba.g = rgb.g;
334
+ this.rgba.b = rgb.b;
335
+ },
336
+ /**
337
+ * 设置二进制颜色
338
+ * @param {Object} rgb
339
+ */
340
+ setValue(rgb) {
341
+ this.hex = `#${(rgbToHex(rgb))}`;
342
+ },
343
+ setControl(index, x) {
344
+ const {
345
+ top,
346
+ left,
347
+ width,
348
+ height
349
+ } = this.position[index];
350
+
351
+ if (index === 1) {
352
+ this.hsb.h = parseInt((360 * x) / width);
353
+ this.bgcolor = hsbToRgb({
354
+ h: this.hsb.h,
355
+ s: 100,
356
+ b: 100
357
+ });
358
+ this.setColor()
359
+ } else {
360
+ this.rgba.a = +(x / width).toFixed(1);
361
+ }
362
+ this.setValue(this.rgba);
363
+ },
364
+ setColorBySelect(getrgb) {
365
+ const { r, g, b, a } = getrgb;
366
+ let rgb = {};
367
+ rgb = {
368
+ r: r ? parseInt(r) : 0,
369
+ g: g ? parseInt(g) : 0,
370
+ b: b ? parseInt(b) : 0,
371
+ a: a ? a : 0
372
+ };
373
+ this.rgba = rgb;
374
+ this.hsb = rgbToHsb(rgb);
375
+ this.changeViewByHsb();
376
+ },
377
+ changeViewByHsb() {
378
+ const [a, b, c] = this.position;
379
+ this.site[0].left = parseInt(this.hsb.s * a.width / 100);
380
+ this.site[0].top = parseInt((100 - this.hsb.b) * a.height / 100);
381
+ this.setColor(this.hsb.h);
382
+ this.setValue(this.rgba);
383
+ this.bgcolor = hsbToRgb({
384
+ h: this.hsb.h,
385
+ s: 100,
386
+ b: 100
387
+ });
388
+ this.site[1].left = this.hsb.h / 360 * b.width;
389
+ this.site[2].left = this.rgba.a * c.width;
390
+ }
391
+ }
392
+ };
393
+ </script>
394
+ <style scoped lang="scss">
395
+ $show-border: 1;
396
+ @import '../../libs/css/variable.scss';
397
+ @import '../../libs/css/components.scss';
398
+ $height: 400rpx;
399
+ /* #ifndef APP-NVUE */
400
+ .uv-pick-color {
401
+ &__box {
402
+ position: relative;
403
+ height: $height;
404
+ background: rgb(255, 0, 0);
405
+ margin: 20rpx;
406
+ &__bg {
407
+ position: absolute;
408
+ top: 0;
409
+ left: 0;
410
+ right: 0;
411
+ bottom: 0;
412
+ background: linear-gradient(to right, #fff, rgba(255, 255, 255, 0));
413
+ &-mask {
414
+ position: absolute;
415
+ top: 0;
416
+ left: 0;
417
+ right: 0;
418
+ bottom: 0;
419
+ height: $height;
420
+ background: linear-gradient(to top, #000, rgba(0, 0, 0, 0));
421
+ }
422
+ &-pointer {
423
+ position: absolute;
424
+ top: -8px;
425
+ left: -8px;
426
+ z-index: 2;
427
+ width: 16px;
428
+ height: 16px;
429
+ border: 1px #fff solid;
430
+ border-radius: 8px;
431
+ }
432
+ }
433
+ }
434
+ &__control {
435
+ @include flex;
436
+ padding: 10rpx 20rpx;
437
+ &__alpha {
438
+ width: 100rpx;
439
+ height: 100rpx;
440
+ border-radius: 50rpx;
441
+ background-color: #fff;
442
+ background-image: linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%, #eee),linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%, #eee);
443
+ background-size: 36rpx 36rpx;
444
+ background-position: 0 0, 18rpx 18rpx;
445
+ border: 1px #eee solid;
446
+ overflow: hidden;
447
+ &--color {
448
+ width: 100%;
449
+ height: 100%;
450
+ }
451
+ }
452
+ &__item {
453
+ flex: 1;
454
+ @include flex(column);
455
+ justify-content: space-between;
456
+ height: 100rpx;
457
+ padding: 6rpx 0 6rpx 30rpx;
458
+ }
459
+ &__item__drag {
460
+ position: relative;
461
+ height: 16px;
462
+ background-color: #fff;
463
+ background-image: linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%, #eee),
464
+ linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%, #eee);
465
+ background-size: 32rpx 32rpx;
466
+ background-position: 0 0, 16rpx 16rpx;
467
+ &--hue {
468
+ width: 100%;
469
+ height: 100%;
470
+ background: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);
471
+ }
472
+ &--alpha {
473
+ width: 100%;
474
+ height: 100%;
475
+ background: linear-gradient(to right, rgba(0, 0, 0, 0) 0%, rgb(0, 0, 0));
476
+ }
477
+ &--circle {
478
+ position: absolute;
479
+ top: -2px;
480
+ width: 20px;
481
+ height: 20px;
482
+ box-sizing: border-box;
483
+ border-radius: 10px;
484
+ background: #fff;
485
+ box-shadow: 0 0 2px 1px rgba(0, 0, 0, 0.1);
486
+ }
487
+ }
488
+ }
489
+ &__result {
490
+ @include flex;
491
+ padding: 20rpx;
492
+ text-align: center;
493
+ &__select {
494
+ @include flex(column);
495
+ justify-content: center;
496
+ width: 100rpx;
497
+ height: 100rpx;
498
+ margin-right: 10px;
499
+ border-radius: 10rpx;
500
+ box-shadow: 1px 1px 2px 1px rgba(0, 0, 0, 0.1);
501
+ font-size: 14px;
502
+ color: #999;
503
+ }
504
+ &__item {
505
+ flex: 1;
506
+ height: 100rpx;
507
+ &--value {
508
+ height: 50rpx;
509
+ line-height: 50rpx;
510
+ border-radius: 4rpx;
511
+ font-size: 28rpx;
512
+ color: #999;
513
+ }
514
+ &--hex,
515
+ &--rgba {
516
+ height: 50rpx;
517
+ line-height: 50rpx;
518
+ font-size: 30rpx;
519
+ }
520
+ }
521
+ &__gap {
522
+ width: 10px;
523
+ height: 10px;
524
+ }
525
+ }
526
+ &__prefab {
527
+ @include flex;
528
+ margin: 0 -8rpx;
529
+ padding: 0 20rpx 20rpx;
530
+ flex-wrap: wrap;
531
+ &__item {
532
+ width: 50rpx;
533
+ height: 50rpx;
534
+ margin: 8rpx;
535
+ border-radius: 6rpx;
536
+ background-color: #fff;
537
+ background-image: linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%, #eee),
538
+ linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%, #eee);
539
+ background-size: 36rpx 36rpx;
540
+ background-position: 0 0, 18rpx 18rpx;
541
+ border: 1px #eee solid;
542
+ &--color {
543
+ width: 100%;
544
+ height: 100%;
545
+ border-radius: 6rpx;
546
+ }
547
+ }
548
+ }
549
+ }
550
+ /* #endif */
551
+ </style>
@@ -0,0 +1,95 @@
1
+ export default {
2
+ props: {
3
+ // 是否展示顶部的操作栏
4
+ showToolbar: {
5
+ type: Boolean,
6
+ default: true
7
+ },
8
+ // 顶部标题
9
+ title: {
10
+ type: String,
11
+ default: ''
12
+ },
13
+ // 弹窗圆角
14
+ round: {
15
+ type: [String, Number],
16
+ default: 0
17
+ },
18
+ // 对象数组,设置每一列的数据
19
+ columns: {
20
+ type: Array,
21
+ default: () => []
22
+ },
23
+ // 是否显示加载中状态
24
+ loading: {
25
+ type: Boolean,
26
+ default: false
27
+ },
28
+ // 各列中,单个选项的高度
29
+ itemHeight: {
30
+ type: [String, Number],
31
+ default: 44
32
+ },
33
+ // 取消按钮的文字
34
+ cancelText: {
35
+ type: String,
36
+ default: '取消'
37
+ },
38
+ // 确认按钮的文字
39
+ confirmText: {
40
+ type: String,
41
+ default: '确定'
42
+ },
43
+ // 取消按钮的颜色
44
+ cancelColor: {
45
+ type: String,
46
+ default: '#909193'
47
+ },
48
+ // 确认按钮的颜色
49
+ confirmColor: {
50
+ type: String,
51
+ default: '#3c9cff'
52
+ },
53
+ // 文字颜色
54
+ color: {
55
+ type: String,
56
+ default: ''
57
+ },
58
+ // 选中文字的颜色
59
+ activeColor: {
60
+ type: String,
61
+ default: ''
62
+ },
63
+ // 每列中可见选项的数量
64
+ visibleItemCount: {
65
+ type: [String, Number],
66
+ default: 5
67
+ },
68
+ // 选项对象中,需要展示的属性键名
69
+ keyName: {
70
+ type: String,
71
+ default: 'text'
72
+ },
73
+ // 是否允许点击遮罩关闭选择器
74
+ closeOnClickOverlay: {
75
+ type: Boolean,
76
+ default: true
77
+ },
78
+ // 是否允许点击确认关闭选择器
79
+ closeOnClickConfirm: {
80
+ type: Boolean,
81
+ default: true
82
+ },
83
+ // 各列的默认索引
84
+ defaultIndex: {
85
+ type: Array,
86
+ default: () => [],
87
+ },
88
+ // 是否在手指松开时立即触发 change 事件。若不开启则会在滚动动画结束后触发 change 事件,只在微信2.21.1及以上有效
89
+ immediateChange: {
90
+ type: Boolean,
91
+ default: true
92
+ },
93
+ ...uni.$uv?.props?.picker
94
+ }
95
+ }