@kengic/uni 0.3.2-beta.3 → 0.3.2-beta.5

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 (255) hide show
  1. package/dist/kengic-uni.js +2 -1371
  2. package/dist/src/index.d.ts +0 -1
  3. package/dist/uni-ui/index.ts +5 -0
  4. package/dist/uni-ui/uni-badge/uni-badge.vue +253 -0
  5. package/dist/uni-ui/uni-breadcrumb/uni-breadcrumb.vue +41 -0
  6. package/dist/uni-ui/uni-breadcrumb-item/uni-breadcrumb-item.vue +121 -0
  7. package/dist/uni-ui/uni-calendar/calendar.js +546 -0
  8. package/dist/uni-ui/uni-calendar/i18n/en.json +12 -0
  9. package/dist/uni-ui/uni-calendar/i18n/index.js +8 -0
  10. package/dist/uni-ui/uni-calendar/i18n/zh-Hans.json +12 -0
  11. package/dist/uni-ui/uni-calendar/i18n/zh-Hant.json +12 -0
  12. package/dist/uni-ui/uni-calendar/uni-calendar-item.vue +187 -0
  13. package/dist/uni-ui/uni-calendar/uni-calendar.vue +566 -0
  14. package/dist/uni-ui/uni-calendar/util.js +360 -0
  15. package/dist/uni-ui/uni-card/uni-card.vue +281 -0
  16. package/dist/uni-ui/uni-col/uni-col.vue +317 -0
  17. package/dist/uni-ui/uni-collapse/uni-collapse.vue +147 -0
  18. package/dist/uni-ui/uni-collapse-item/uni-collapse-item.vue +402 -0
  19. package/dist/uni-ui/uni-combox/uni-combox.vue +294 -0
  20. package/dist/uni-ui/uni-countdown/i18n/en.json +6 -0
  21. package/dist/uni-ui/uni-countdown/i18n/index.js +8 -0
  22. package/dist/uni-ui/uni-countdown/i18n/zh-Hans.json +6 -0
  23. package/dist/uni-ui/uni-countdown/i18n/zh-Hant.json +6 -0
  24. package/dist/uni-ui/uni-countdown/uni-countdown.vue +267 -0
  25. package/dist/uni-ui/uni-data-checkbox/uni-data-checkbox.vue +821 -0
  26. package/dist/uni-ui/uni-data-picker/keypress.js +45 -0
  27. package/dist/uni-ui/uni-data-picker/uni-data-picker.vue +551 -0
  28. package/dist/uni-ui/uni-data-pickerview/uni-data-picker.js +622 -0
  29. package/dist/uni-ui/uni-data-pickerview/uni-data-pickerview.vue +323 -0
  30. package/dist/uni-ui/uni-data-select/uni-data-select.vue +517 -0
  31. package/dist/uni-ui/uni-dateformat/date-format.js +200 -0
  32. package/dist/uni-ui/uni-dateformat/uni-dateformat.vue +88 -0
  33. package/dist/uni-ui/uni-datetime-picker/calendar-item.vue +177 -0
  34. package/dist/uni-ui/uni-datetime-picker/calendar.vue +928 -0
  35. package/dist/uni-ui/uni-datetime-picker/i18n/en.json +22 -0
  36. package/dist/uni-ui/uni-datetime-picker/i18n/index.js +8 -0
  37. package/dist/uni-ui/uni-datetime-picker/i18n/zh-Hans.json +22 -0
  38. package/dist/uni-ui/uni-datetime-picker/i18n/zh-Hant.json +22 -0
  39. package/dist/uni-ui/uni-datetime-picker/time-picker.vue +934 -0
  40. package/dist/uni-ui/uni-datetime-picker/uni-datetime-picker.vue +1026 -0
  41. package/dist/uni-ui/uni-datetime-picker/util.js +403 -0
  42. package/dist/uni-ui/uni-drawer/keypress.js +45 -0
  43. package/dist/uni-ui/uni-drawer/uni-drawer.vue +181 -0
  44. package/dist/uni-ui/uni-easyinput/common.js +56 -0
  45. package/dist/uni-ui/uni-easyinput/uni-easyinput.vue +660 -0
  46. package/dist/uni-ui/uni-fab/uni-fab.vue +491 -0
  47. package/dist/uni-ui/uni-fav/i18n/en.json +4 -0
  48. package/dist/uni-ui/uni-fav/i18n/index.js +8 -0
  49. package/dist/uni-ui/uni-fav/i18n/zh-Hans.json +4 -0
  50. package/dist/uni-ui/uni-fav/i18n/zh-Hant.json +4 -0
  51. package/dist/uni-ui/uni-fav/uni-fav.vue +161 -0
  52. package/dist/uni-ui/uni-file-picker/choose-and-upload-file.js +224 -0
  53. package/dist/uni-ui/uni-file-picker/uni-file-picker.vue +667 -0
  54. package/dist/uni-ui/uni-file-picker/upload-file.vue +325 -0
  55. package/dist/uni-ui/uni-file-picker/upload-image.vue +292 -0
  56. package/dist/uni-ui/uni-file-picker/utils.js +109 -0
  57. package/dist/uni-ui/uni-forms/uni-forms.vue +398 -0
  58. package/dist/uni-ui/uni-forms/utils.js +293 -0
  59. package/dist/uni-ui/uni-forms/validate.js +486 -0
  60. package/dist/uni-ui/uni-forms-item/uni-forms-item.vue +601 -0
  61. package/dist/uni-ui/uni-goods-nav/i18n/en.json +6 -0
  62. package/dist/uni-ui/uni-goods-nav/i18n/index.js +8 -0
  63. package/dist/uni-ui/uni-goods-nav/i18n/zh-Hans.json +6 -0
  64. package/dist/uni-ui/uni-goods-nav/i18n/zh-Hant.json +6 -0
  65. package/dist/uni-ui/uni-goods-nav/uni-goods-nav.vue +229 -0
  66. package/dist/uni-ui/uni-grid/uni-grid.vue +143 -0
  67. package/dist/uni-ui/uni-grid-item/uni-grid-item.vue +129 -0
  68. package/dist/uni-ui/uni-group/uni-group.vue +134 -0
  69. package/dist/uni-ui/uni-icons/icons.js +1169 -0
  70. package/dist/uni-ui/uni-icons/uni-icons.vue +96 -0
  71. package/dist/uni-ui/uni-icons/uniicons.css +663 -0
  72. package/dist/uni-ui/uni-icons/uniicons.ttf +0 -0
  73. package/dist/uni-ui/uni-indexed-list/uni-indexed-list-item.vue +144 -0
  74. package/dist/uni-ui/uni-indexed-list/uni-indexed-list.vue +367 -0
  75. package/dist/uni-ui/uni-link/uni-link.vue +128 -0
  76. package/dist/uni-ui/uni-list/uni-list.vue +123 -0
  77. package/dist/uni-ui/uni-list/uni-refresh.vue +65 -0
  78. package/dist/uni-ui/uni-list/uni-refresh.wxs +87 -0
  79. package/dist/uni-ui/uni-list-ad/uni-list-ad.vue +107 -0
  80. package/dist/uni-ui/uni-list-chat/uni-list-chat.scss +58 -0
  81. package/dist/uni-ui/uni-list-chat/uni-list-chat.vue +593 -0
  82. package/dist/uni-ui/uni-list-item/uni-list-item.vue +534 -0
  83. package/dist/uni-ui/uni-load-more/i18n/en.json +5 -0
  84. package/dist/uni-ui/uni-load-more/i18n/index.js +8 -0
  85. package/dist/uni-ui/uni-load-more/i18n/zh-Hans.json +5 -0
  86. package/dist/uni-ui/uni-load-more/i18n/zh-Hant.json +5 -0
  87. package/dist/uni-ui/uni-load-more/uni-load-more.vue +399 -0
  88. package/dist/uni-ui/uni-nav-bar/uni-nav-bar.vue +357 -0
  89. package/dist/uni-ui/uni-nav-bar/uni-status-bar.vue +24 -0
  90. package/dist/uni-ui/uni-notice-bar/uni-notice-bar.vue +426 -0
  91. package/dist/uni-ui/uni-number-box/uni-number-box.vue +221 -0
  92. package/dist/uni-ui/uni-pagination/i18n/en.json +5 -0
  93. package/dist/uni-ui/uni-pagination/i18n/es.json +5 -0
  94. package/dist/uni-ui/uni-pagination/i18n/fr.json +5 -0
  95. package/dist/uni-ui/uni-pagination/i18n/index.js +12 -0
  96. package/dist/uni-ui/uni-pagination/i18n/zh-Hans.json +5 -0
  97. package/dist/uni-ui/uni-pagination/i18n/zh-Hant.json +5 -0
  98. package/dist/uni-ui/uni-pagination/uni-pagination.vue +465 -0
  99. package/dist/uni-ui/uni-popup/i18n/en.json +7 -0
  100. package/dist/uni-ui/uni-popup/i18n/index.js +8 -0
  101. package/dist/uni-ui/uni-popup/i18n/zh-Hans.json +7 -0
  102. package/dist/uni-ui/uni-popup/i18n/zh-Hant.json +7 -0
  103. package/dist/uni-ui/uni-popup/keypress.js +45 -0
  104. package/dist/uni-ui/uni-popup/popup.js +26 -0
  105. package/dist/uni-ui/uni-popup/uni-popup.vue +473 -0
  106. package/dist/uni-ui/uni-popup-dialog/keypress.js +45 -0
  107. package/dist/uni-ui/uni-popup-dialog/uni-popup-dialog.vue +275 -0
  108. package/dist/uni-ui/uni-popup-message/uni-popup-message.vue +143 -0
  109. package/dist/uni-ui/uni-popup-share/uni-popup-share.vue +187 -0
  110. package/dist/uni-ui/uni-rate/uni-rate.vue +365 -0
  111. package/dist/uni-ui/uni-row/uni-row.vue +190 -0
  112. package/dist/uni-ui/uni-scss/changelog.md +8 -0
  113. package/dist/uni-ui/uni-scss/index.scss +1 -0
  114. package/dist/uni-ui/uni-scss/package.json +82 -0
  115. package/dist/uni-ui/uni-scss/readme.md +4 -0
  116. package/dist/uni-ui/uni-scss/styles/index.scss +7 -0
  117. package/dist/uni-ui/uni-scss/styles/setting/_border.scss +3 -0
  118. package/dist/uni-ui/uni-scss/styles/setting/_color.scss +66 -0
  119. package/dist/uni-ui/uni-scss/styles/setting/_radius.scss +55 -0
  120. package/dist/uni-ui/uni-scss/styles/setting/_space.scss +56 -0
  121. package/dist/uni-ui/uni-scss/styles/setting/_styles.scss +167 -0
  122. package/dist/uni-ui/uni-scss/styles/setting/_text.scss +24 -0
  123. package/dist/uni-ui/uni-scss/styles/setting/_variables.scss +146 -0
  124. package/dist/uni-ui/uni-scss/styles/tools/functions.scss +19 -0
  125. package/dist/uni-ui/uni-scss/theme.scss +31 -0
  126. package/dist/uni-ui/uni-scss/variables.scss +62 -0
  127. package/dist/uni-ui/uni-search-bar/i18n/en.json +4 -0
  128. package/dist/uni-ui/uni-search-bar/i18n/index.js +8 -0
  129. package/dist/uni-ui/uni-search-bar/i18n/zh-Hans.json +4 -0
  130. package/dist/uni-ui/uni-search-bar/i18n/zh-Hant.json +4 -0
  131. package/dist/uni-ui/uni-search-bar/uni-search-bar.vue +298 -0
  132. package/dist/uni-ui/uni-section/uni-section.vue +167 -0
  133. package/dist/uni-ui/uni-segmented-control/uni-segmented-control.vue +145 -0
  134. package/dist/uni-ui/uni-steps/uni-steps.vue +269 -0
  135. package/dist/uni-ui/uni-swipe-action/uni-swipe-action.vue +60 -0
  136. package/dist/uni-ui/uni-swipe-action-item/bindingx.js +302 -0
  137. package/dist/uni-ui/uni-swipe-action-item/isPC.js +12 -0
  138. package/dist/uni-ui/uni-swipe-action-item/mpalipay.js +195 -0
  139. package/dist/uni-ui/uni-swipe-action-item/mpother.js +260 -0
  140. package/dist/uni-ui/uni-swipe-action-item/mpwxs.js +84 -0
  141. package/dist/uni-ui/uni-swipe-action-item/render.js +270 -0
  142. package/dist/uni-ui/uni-swipe-action-item/uni-swipe-action-item.vue +347 -0
  143. package/dist/uni-ui/uni-swipe-action-item/wx.wxs +341 -0
  144. package/dist/uni-ui/uni-swiper-dot/uni-swiper-dot.vue +218 -0
  145. package/dist/uni-ui/uni-table/uni-table.vue +455 -0
  146. package/dist/uni-ui/uni-tag/uni-tag.vue +252 -0
  147. package/dist/uni-ui/uni-tbody/uni-tbody.vue +29 -0
  148. package/dist/uni-ui/uni-td/uni-td.vue +90 -0
  149. package/dist/uni-ui/uni-th/filter-dropdown.vue +511 -0
  150. package/dist/uni-ui/uni-th/uni-th.vue +285 -0
  151. package/dist/uni-ui/uni-thead/uni-thead.vue +129 -0
  152. package/dist/uni-ui/uni-title/uni-title.vue +171 -0
  153. package/dist/uni-ui/uni-tooltip/uni-tooltip.vue +68 -0
  154. package/dist/uni-ui/uni-tr/table-checkbox.vue +179 -0
  155. package/dist/uni-ui/uni-tr/uni-tr.vue +171 -0
  156. package/dist/uni-ui/uni-transition/createAnimation.js +131 -0
  157. package/dist/uni-ui/uni-transition/uni-transition.vue +281 -0
  158. package/package.json +10 -10
  159. package/dist/index.css +0 -1
  160. package/dist/src/components/index.d.ts +0 -5
  161. package/dist/src/components/uni-ui/uni-badge/uni-badge.vue.d.ts +0 -108
  162. package/dist/src/components/uni-ui/uni-breadcrumb/uni-breadcrumb.vue.d.ts +0 -23
  163. package/dist/src/components/uni-ui/uni-breadcrumb-item/uni-breadcrumb-item.vue.d.ts +0 -30
  164. package/dist/src/components/uni-ui/uni-calendar/calendar.d.ts +0 -67
  165. package/dist/src/components/uni-ui/uni-calendar/i18n/index.d.ts +0 -39
  166. package/dist/src/components/uni-ui/uni-calendar/uni-calendar-item.vue.d.ts +0 -47
  167. package/dist/src/components/uni-ui/uni-calendar/uni-calendar.vue.d.ts +0 -166
  168. package/dist/src/components/uni-ui/uni-calendar/util.d.ts +0 -211
  169. package/dist/src/components/uni-ui/uni-card/uni-card.vue.d.ts +0 -117
  170. package/dist/src/components/uni-ui/uni-col/uni-col.vue.d.ts +0 -70
  171. package/dist/src/components/uni-ui/uni-collapse/uni-collapse.vue.d.ts +0 -45
  172. package/dist/src/components/uni-ui/uni-collapse-item/uni-collapse-item.vue.d.ts +0 -102
  173. package/dist/src/components/uni-ui/uni-combox/uni-combox.vue.d.ts +0 -95
  174. package/dist/src/components/uni-ui/uni-countdown/i18n/index.d.ts +0 -21
  175. package/dist/src/components/uni-ui/uni-countdown/uni-countdown.vue.d.ts +0 -158
  176. package/dist/src/components/uni-ui/uni-data-checkbox/uni-data-checkbox.vue.d.ts +0 -192
  177. package/dist/src/components/uni-ui/uni-data-picker/uni-data-picker.vue.d.ts +0 -267
  178. package/dist/src/components/uni-ui/uni-data-pickerview/uni-data-picker.d.ts +0 -221
  179. package/dist/src/components/uni-ui/uni-data-pickerview/uni-data-pickerview.vue.d.ts +0 -169
  180. package/dist/src/components/uni-ui/uni-data-select/uni-data-select.vue.d.ts +0 -125
  181. package/dist/src/components/uni-ui/uni-dateformat/date-format.d.ts +0 -6
  182. package/dist/src/components/uni-ui/uni-dateformat/uni-dateformat.vue.d.ts +0 -57
  183. package/dist/src/components/uni-ui/uni-datetime-picker/calendar-item.vue.d.ts +0 -44
  184. package/dist/src/components/uni-ui/uni-datetime-picker/calendar.vue.d.ts +0 -253
  185. package/dist/src/components/uni-ui/uni-datetime-picker/i18n/index.d.ts +0 -69
  186. package/dist/src/components/uni-ui/uni-datetime-picker/time-picker.vue.d.ts +0 -225
  187. package/dist/src/components/uni-ui/uni-datetime-picker/uni-datetime-picker.vue.d.ts +0 -236
  188. package/dist/src/components/uni-ui/uni-datetime-picker/util.d.ts +0 -171
  189. package/dist/src/components/uni-ui/uni-drawer/keypress.d.ts +0 -14
  190. package/dist/src/components/uni-ui/uni-drawer/uni-drawer.vue.d.ts +0 -78
  191. package/dist/src/components/uni-ui/uni-easyinput/uni-easyinput.vue.d.ts +0 -269
  192. package/dist/src/components/uni-ui/uni-fab/uni-fab.vue.d.ts +0 -109
  193. package/dist/src/components/uni-ui/uni-fav/i18n/index.d.ts +0 -15
  194. package/dist/src/components/uni-ui/uni-fav/uni-fav.vue.d.ts +0 -99
  195. package/dist/src/components/uni-ui/uni-file-picker/choose-and-upload-file.d.ts +0 -4
  196. package/dist/src/components/uni-ui/uni-file-picker/uni-file-picker.vue.d.ts +0 -254
  197. package/dist/src/components/uni-ui/uni-file-picker/upload-file.vue.d.ts +0 -81
  198. package/dist/src/components/uni-ui/uni-file-picker/upload-image.vue.d.ts +0 -90
  199. package/dist/src/components/uni-ui/uni-file-picker/utils.d.ts +0 -22
  200. package/dist/src/components/uni-ui/uni-forms/uni-forms.vue.d.ts +0 -160
  201. package/dist/src/components/uni-ui/uni-forms/utils.d.ts +0 -20
  202. package/dist/src/components/uni-ui/uni-forms/validate.d.ts +0 -42
  203. package/dist/src/components/uni-ui/uni-forms-item/uni-forms-item.vue.d.ts +0 -127
  204. package/dist/src/components/uni-ui/uni-goods-nav/i18n/index.d.ts +0 -21
  205. package/dist/src/components/uni-ui/uni-goods-nav/uni-goods-nav.vue.d.ts +0 -61
  206. package/dist/src/components/uni-ui/uni-grid/uni-grid.vue.d.ts +0 -59
  207. package/dist/src/components/uni-ui/uni-grid-item/uni-grid-item.vue.d.ts +0 -26
  208. package/dist/src/components/uni-ui/uni-group/uni-group.vue.d.ts +0 -52
  209. package/dist/src/components/uni-ui/uni-icons/icons.d.ts +0 -15
  210. package/dist/src/components/uni-ui/uni-icons/uni-icons.vue.d.ts +0 -56
  211. package/dist/src/components/uni-ui/uni-indexed-list/uni-indexed-list-item.vue.d.ts +0 -45
  212. package/dist/src/components/uni-ui/uni-indexed-list/uni-indexed-list.vue.d.ts +0 -49
  213. package/dist/src/components/uni-ui/uni-link/uni-link.vue.d.ts +0 -75
  214. package/dist/src/components/uni-ui/uni-list/uni-list.vue.d.ts +0 -53
  215. package/dist/src/components/uni-ui/uni-list/uni-refresh.vue.d.ts +0 -22
  216. package/dist/src/components/uni-ui/uni-list-ad/uni-list-ad.vue.d.ts +0 -25
  217. package/dist/src/components/uni-ui/uni-list-chat/uni-list-chat.vue.d.ts +0 -123
  218. package/dist/src/components/uni-ui/uni-list-item/uni-list-item.vue.d.ts +0 -248
  219. package/dist/src/components/uni-ui/uni-load-more/i18n/index.d.ts +0 -18
  220. package/dist/src/components/uni-ui/uni-load-more/uni-load-more.vue.d.ts +0 -89
  221. package/dist/src/components/uni-ui/uni-nav-bar/uni-nav-bar.vue.d.ts +0 -163
  222. package/dist/src/components/uni-ui/uni-nav-bar/uni-status-bar.vue.d.ts +0 -4
  223. package/dist/src/components/uni-ui/uni-notice-bar/uni-notice-bar.vue.d.ts +0 -138
  224. package/dist/src/components/uni-ui/uni-number-box/uni-number-box.vue.d.ts +0 -90
  225. package/dist/src/components/uni-ui/uni-pagination/i18n/index.d.ts +0 -28
  226. package/dist/src/components/uni-ui/uni-pagination/uni-pagination.vue.d.ts +0 -127
  227. package/dist/src/components/uni-ui/uni-popup/i18n/index.d.ts +0 -24
  228. package/dist/src/components/uni-ui/uni-popup/keypress.d.ts +0 -14
  229. package/dist/src/components/uni-ui/uni-popup/popup.d.ts +0 -17
  230. package/dist/src/components/uni-ui/uni-popup/uni-popup.vue.d.ts +0 -136
  231. package/dist/src/components/uni-ui/uni-popup-dialog/uni-popup-dialog.vue.d.ts +0 -123
  232. package/dist/src/components/uni-ui/uni-popup-message/uni-popup-message.vue.d.ts +0 -67
  233. package/dist/src/components/uni-ui/uni-popup-share/uni-popup-share.vue.d.ts +0 -49
  234. package/dist/src/components/uni-ui/uni-rate/uni-rate.vue.d.ts +0 -154
  235. package/dist/src/components/uni-ui/uni-row/uni-row.vue.d.ts +0 -41
  236. package/dist/src/components/uni-ui/uni-search-bar/i18n/index.d.ts +0 -15
  237. package/dist/src/components/uni-ui/uni-search-bar/uni-search-bar.vue.d.ts +0 -126
  238. package/dist/src/components/uni-ui/uni-section/uni-section.vue.d.ts +0 -85
  239. package/dist/src/components/uni-ui/uni-segmented-control/uni-segmented-control.vue.d.ts +0 -47
  240. package/dist/src/components/uni-ui/uni-steps/uni-steps.vue.d.ts +0 -59
  241. package/dist/src/components/uni-ui/uni-swipe-action/uni-swipe-action.vue.d.ts +0 -6
  242. package/dist/src/components/uni-ui/uni-swiper-dot/uni-swiper-dot.vue.d.ts +0 -65
  243. package/dist/src/components/uni-ui/uni-table/uni-table.vue.d.ts +0 -99
  244. package/dist/src/components/uni-ui/uni-tag/uni-tag.vue.d.ts +0 -84
  245. package/dist/src/components/uni-ui/uni-tbody/uni-tbody.vue.d.ts +0 -2
  246. package/dist/src/components/uni-ui/uni-td/uni-td.vue.d.ts +0 -48
  247. package/dist/src/components/uni-ui/uni-th/filter-dropdown.vue.d.ts +0 -99
  248. package/dist/src/components/uni-ui/uni-th/uni-th.vue.d.ts +0 -97
  249. package/dist/src/components/uni-ui/uni-thead/uni-thead.vue.d.ts +0 -15
  250. package/dist/src/components/uni-ui/uni-title/uni-title.vue.d.ts +0 -54
  251. package/dist/src/components/uni-ui/uni-tooltip/uni-tooltip.vue.d.ts +0 -23
  252. package/dist/src/components/uni-ui/uni-tr/table-checkbox.vue.d.ts +0 -58
  253. package/dist/src/components/uni-ui/uni-tr/uni-tr.vue.d.ts +0 -39
  254. package/dist/src/components/uni-ui/uni-transition/createAnimation.d.ts +0 -16
  255. package/dist/src/components/uni-ui/uni-transition/uni-transition.vue.d.ts +0 -240
@@ -0,0 +1,601 @@
1
+ <template>
2
+ <view
3
+ class="uni-forms-item"
4
+ :class="['is-direction-' + localLabelPos, border ? 'uni-forms-item--border' : '', border && isFirstBorder ? 'is-first-border' : '']"
5
+ >
6
+ <slot name="label">
7
+ <view
8
+ class="uni-forms-item__label"
9
+ :class="{ 'no-label': !label && !required }"
10
+ :style="{ width: localLabelWidth, justifyContent: localLabelAlign }"
11
+ >
12
+ <text v-if="required" class="is-required">*</text>
13
+ <text>{{ label }}</text>
14
+ </view>
15
+ </slot>
16
+ <!-- #ifndef APP-NVUE -->
17
+ <view class="uni-forms-item__content">
18
+ <slot></slot>
19
+ <view class="uni-forms-item__error" :class="{ 'msg--active': msg }">
20
+ <text>{{ msg }}</text>
21
+ </view>
22
+ </view>
23
+ <!-- #endif -->
24
+ <!-- #ifdef APP-NVUE -->
25
+ <view class="uni-forms-item__nuve-content">
26
+ <view class="uni-forms-item__content">
27
+ <slot></slot>
28
+ </view>
29
+ <view class="uni-forms-item__error" :class="{ 'msg--active': msg }">
30
+ <text class="error-text">{{ msg }}</text>
31
+ </view>
32
+ </view>
33
+ <!-- #endif -->
34
+ </view>
35
+ </template>
36
+
37
+ <script>
38
+ /**
39
+ * uni-fomrs-item 表单子组件
40
+ * @description uni-fomrs-item 表单子组件,提供了基础布局已经校验能力
41
+ * @tutorial https://ext.dcloud.net.cn/plugin?id=2773
42
+ * @property {Boolean} required 是否必填,左边显示红色"*"号
43
+ * @property {String } label 输入框左边的文字提示
44
+ * @property {Number } labelWidth label的宽度,单位px(默认65)
45
+ * @property {String } labelAlign = [left|center|right] label的文字对齐方式(默认left)
46
+ * @value left label 左侧显示
47
+ * @value center label 居中
48
+ * @value right label 右侧对齐
49
+ * @property {String } errorMessage 显示的错误提示内容,如果为空字符串或者false,则不显示错误信息
50
+ * @property {String } name 表单域的属性名,在使用校验规则时必填
51
+ * @property {String } leftIcon 【1.4.0废弃】label左边的图标,限 uni-ui 的图标名称
52
+ * @property {String } iconColor 【1.4.0废弃】左边通过icon配置的图标的颜色(默认#606266)
53
+ * @property {String} validateTrigger = [bind|submit|blur] 【1.4.0废弃】校验触发器方式 默认 submit
54
+ * @value bind 发生变化时触发
55
+ * @value submit 提交时触发
56
+ * @value blur 失去焦点触发
57
+ * @property {String } labelPosition = [top|left] 【1.4.0废弃】label的文字的位置(默认left)
58
+ * @value top 顶部显示 label
59
+ * @value left 左侧显示 label
60
+ */
61
+ import { defineComponent } from 'vue';
62
+
63
+ export default defineComponent({
64
+ name: 'UniFormsItem',
65
+ options: {
66
+ virtualHost: true,
67
+ },
68
+ provide() {
69
+ return {
70
+ uniFormItem: this,
71
+ };
72
+ },
73
+ inject: {
74
+ form: {
75
+ from: 'uniForm',
76
+ default: null,
77
+ },
78
+ },
79
+ props: {
80
+ // 表单校验规则
81
+ rules: {
82
+ type: Array,
83
+ default() {
84
+ return null;
85
+ },
86
+ },
87
+ // 表单域的属性名,在使用校验规则时必填
88
+ name: {
89
+ type: [String, Array],
90
+ default: '',
91
+ },
92
+ required: {
93
+ type: Boolean,
94
+ default: false,
95
+ },
96
+ label: {
97
+ type: String,
98
+ default: '',
99
+ },
100
+ // label的宽度 ,默认 80
101
+ labelWidth: {
102
+ type: [String, Number],
103
+ default: '',
104
+ },
105
+ // label 居中方式,默认 left 取值 left/center/right
106
+ labelAlign: {
107
+ type: String,
108
+ default: '',
109
+ },
110
+ // 强制显示错误信息
111
+ errorMessage: {
112
+ type: [String, Boolean],
113
+ default: '',
114
+ },
115
+ // 1.4.0 弃用,统一使用 form 的校验时机
116
+ // validateTrigger: {
117
+ // type: String,
118
+ // default: ''
119
+ // },
120
+ // 1.4.0 弃用,统一使用 form 的label 位置
121
+ // labelPosition: {
122
+ // type: String,
123
+ // default: ''
124
+ // },
125
+ // 1.4.0 以下属性已经废弃,请使用 #label 插槽代替
126
+ leftIcon: String,
127
+ iconColor: {
128
+ type: String,
129
+ default: '#606266',
130
+ },
131
+ },
132
+ data() {
133
+ return {
134
+ errMsg: '',
135
+ userRules: null,
136
+ localLabelAlign: 'left',
137
+ localLabelWidth: '65px',
138
+ localLabelPos: 'left',
139
+ border: false,
140
+ isFirstBorder: false,
141
+ };
142
+ },
143
+ computed: {
144
+ // 处理错误信息
145
+ msg() {
146
+ return this.errorMessage || this.errMsg;
147
+ },
148
+ },
149
+ watch: {
150
+ // 规则发生变化通知子组件更新
151
+ 'form.formRules'(val) {
152
+ // TODO 处理头条vue3 watch不生效的问题
153
+ // #ifndef MP-TOUTIAO
154
+ this.init();
155
+ // #endif
156
+ },
157
+ 'form.labelWidth'(val) {
158
+ // 宽度
159
+ this.localLabelWidth = this._labelWidthUnit(val);
160
+ },
161
+ 'form.labelPosition'(val) {
162
+ // 标签位置
163
+ this.localLabelPos = this._labelPosition();
164
+ },
165
+ 'form.labelAlign'(val) {},
166
+ },
167
+ created() {
168
+ this.init(true);
169
+ if (this.name && this.form) {
170
+ // TODO 处理头条vue3 watch不生效的问题
171
+ // #ifdef MP-TOUTIAO
172
+ this.$watch('form.formRules', () => {
173
+ this.init();
174
+ });
175
+ // #endif
176
+
177
+ // 监听变化
178
+ this.$watch(
179
+ () => {
180
+ const val = this.form._getDataValue(this.name, this.form.localData);
181
+ return val;
182
+ },
183
+ (value, oldVal) => {
184
+ const isEqual = this.form._isEqual(value, oldVal);
185
+ // 简单判断前后值的变化,只有发生变化才会发生校验
186
+ // TODO 如果 oldVal = undefined ,那么大概率是源数据里没有值导致 ,这个情况不哦校验 ,可能不严谨 ,需要在做观察
187
+ // fix by mehaotian 暂时取消 && oldVal !== undefined ,如果formData 中不存在,可能会不校验
188
+ if (!isEqual) {
189
+ const val = this.itemSetValue(value);
190
+ this.onFieldChange(val, false);
191
+ }
192
+ },
193
+ {
194
+ immediate: false,
195
+ },
196
+ );
197
+ }
198
+ },
199
+ // #ifndef VUE3
200
+ destroyed() {
201
+ if (this.__isUnmounted) return;
202
+ this.unInit();
203
+ },
204
+ // #endif
205
+ // #ifdef VUE3
206
+ unmounted() {
207
+ this.__isUnmounted = true;
208
+ this.unInit();
209
+ },
210
+ // #endif
211
+ methods: {
212
+ /**
213
+ * 外部调用方法
214
+ * 设置规则 ,主要用于小程序自定义检验规则
215
+ * @param {Array} rules 规则源数据
216
+ */
217
+ setRules(rules = null) {
218
+ this.userRules = rules;
219
+ this.init(false);
220
+ },
221
+ // 兼容老版本表单组件
222
+ setValue() {
223
+ // console.log('setValue 方法已经弃用,请使用最新版本的 uni-forms 表单组件以及其他关联组件。');
224
+ },
225
+ /**
226
+ * 外部调用方法
227
+ * 校验数据
228
+ * @param {any} value 需要校验的数据
229
+ * @param {boolean} 是否立即校验
230
+ * @return {Array|null} 校验内容
231
+ */
232
+ async onFieldChange(value, formtrigger = true) {
233
+ const { formData, localData, errShowType, validateCheck, validateTrigger, _isRequiredField, _realName } = this.form;
234
+ const name = _realName(this.name);
235
+ if (!value) {
236
+ value = this.form.formData[name];
237
+ }
238
+ // fixd by mehaotian 不在校验前清空信息,解决闪屏的问题
239
+ // this.errMsg = '';
240
+
241
+ // fix by mehaotian 解决没有检验规则的情况下,抛出错误的问题
242
+ const ruleLen = this.itemRules.rules && this.itemRules.rules.length;
243
+ if (!this.validator || !ruleLen || ruleLen === 0) return;
244
+
245
+ // 检验时机
246
+ // let trigger = this.isTrigger(this.itemRules.validateTrigger, this.validateTrigger, validateTrigger);
247
+ const isRequiredField = _isRequiredField(this.itemRules.rules || []);
248
+ let result = null;
249
+ // 只有等于 bind 时 ,才能开启时实校验
250
+ if (validateTrigger === 'bind' || formtrigger) {
251
+ // 校验当前表单项
252
+ result = await this.validator.validateUpdate(
253
+ {
254
+ [name]: value,
255
+ },
256
+ formData,
257
+ );
258
+
259
+ // 判断是否必填,非必填,不填不校验,填写才校验 ,暂时只处理 undefined 和空的情况
260
+ if (!isRequiredField && (value === undefined || value === '')) {
261
+ result = null;
262
+ }
263
+
264
+ // 判断错误信息显示类型
265
+ if (result && result.errorMessage) {
266
+ if (errShowType === 'undertext') {
267
+ // 获取错误信息
268
+ this.errMsg = !result ? '' : result.errorMessage;
269
+ }
270
+ if (errShowType === 'toast') {
271
+ uni.showToast({
272
+ title: result.errorMessage || '校验错误',
273
+ icon: 'none',
274
+ });
275
+ }
276
+ if (errShowType === 'modal') {
277
+ uni.showModal({
278
+ title: '提示',
279
+ content: result.errorMessage || '校验错误',
280
+ });
281
+ }
282
+ } else {
283
+ this.errMsg = '';
284
+ }
285
+ // 通知 form 组件更新事件
286
+ validateCheck(result ? result : null);
287
+ } else {
288
+ this.errMsg = '';
289
+ }
290
+ return result ? result : null;
291
+ },
292
+ /**
293
+ * 初始组件数据
294
+ */
295
+ init(type = false) {
296
+ const { validator, formRules, childrens, formData, localData, _realName, labelWidth, _getDataValue, _setDataValue } = this.form || {};
297
+ // 对齐方式
298
+ this.localLabelAlign = this._justifyContent();
299
+ // 宽度
300
+ this.localLabelWidth = this._labelWidthUnit(labelWidth);
301
+ // 标签位置
302
+ this.localLabelPos = this._labelPosition();
303
+ // 将需要校验的子组件加入form 队列
304
+ this.form && type && childrens.push(this);
305
+
306
+ if (!validator || !formRules) return;
307
+ // 判断第一个 item
308
+ if (!this.form.isFirstBorder) {
309
+ this.form.isFirstBorder = true;
310
+ this.isFirstBorder = true;
311
+ }
312
+
313
+ // 判断 group 里的第一个 item
314
+ if (this.group) {
315
+ if (!this.group.isFirstBorder) {
316
+ this.group.isFirstBorder = true;
317
+ this.isFirstBorder = true;
318
+ }
319
+ }
320
+ this.border = this.form.border;
321
+ // 获取子域的真实名称
322
+ const name = _realName(this.name);
323
+ const itemRule = this.userRules || this.rules;
324
+ if (typeof formRules === 'object' && itemRule) {
325
+ // 子规则替换父规则
326
+ formRules[name] = {
327
+ rules: itemRule,
328
+ };
329
+ validator.updateSchema(formRules);
330
+ }
331
+ // 注册校验规则
332
+ const itemRules = formRules[name] || {};
333
+ this.itemRules = itemRules;
334
+ // 注册校验函数
335
+ this.validator = validator;
336
+ // 默认值赋予
337
+ this.itemSetValue(_getDataValue(this.name, localData));
338
+ },
339
+ unInit() {
340
+ if (this.form) {
341
+ const { childrens, formData, _realName } = this.form;
342
+ childrens.forEach((item, index) => {
343
+ if (item === this) {
344
+ this.form.childrens.splice(index, 1);
345
+ delete formData[_realName(item.name)];
346
+ }
347
+ });
348
+ }
349
+ },
350
+ // 设置item 的值
351
+ itemSetValue(value) {
352
+ const name = this.form._realName(this.name);
353
+ const rules = this.itemRules.rules || [];
354
+ const val = this.form._getValue(name, value, rules);
355
+ this.form._setDataValue(name, this.form.formData, val);
356
+ return val;
357
+ },
358
+
359
+ /**
360
+ * 移除该表单项的校验结果
361
+ */
362
+ clearValidate() {
363
+ this.errMsg = '';
364
+ },
365
+
366
+ // 是否显示星号
367
+ _isRequired() {
368
+ // TODO 不根据规则显示 星号,考虑后续兼容
369
+ // if (this.form) {
370
+ // if (this.form._isRequiredField(this.itemRules.rules || []) && this.required) {
371
+ // return true
372
+ // }
373
+ // return false
374
+ // }
375
+ return this.required;
376
+ },
377
+
378
+ // 处理对齐方式
379
+ _justifyContent() {
380
+ if (this.form) {
381
+ const { labelAlign } = this.form;
382
+ let labelAli = this.labelAlign ? this.labelAlign : labelAlign;
383
+ if (labelAli === 'left') return 'flex-start';
384
+ if (labelAli === 'center') return 'center';
385
+ if (labelAli === 'right') return 'flex-end';
386
+ }
387
+ return 'flex-start';
388
+ },
389
+ // 处理 label宽度单位 ,继承父元素的值
390
+ _labelWidthUnit(labelWidth) {
391
+ // if (this.form) {
392
+ // const {
393
+ // labelWidth
394
+ // } = this.form
395
+ return this.num2px(this.labelWidth ? this.labelWidth : labelWidth || (this.label ? 65 : 'auto'));
396
+ // }
397
+ // return '65px'
398
+ },
399
+ // 处理 label 位置
400
+ _labelPosition() {
401
+ if (this.form) return this.form.labelPosition || 'left';
402
+ return 'left';
403
+ },
404
+
405
+ /**
406
+ * 触发时机
407
+ * @param {Object} rule 当前规则内时机
408
+ * @param {Object} itemRlue 当前组件时机
409
+ * @param {Object} parentRule 父组件时机
410
+ */
411
+ isTrigger(rule, itemRlue, parentRule) {
412
+ // bind submit
413
+ if (rule === 'submit' || !rule) {
414
+ if (rule === undefined) {
415
+ if (itemRlue !== 'bind') {
416
+ if (!itemRlue) {
417
+ return parentRule === '' ? 'bind' : 'submit';
418
+ }
419
+ return 'submit';
420
+ }
421
+ return 'bind';
422
+ }
423
+ return 'submit';
424
+ }
425
+ return 'bind';
426
+ },
427
+ num2px(num) {
428
+ if (typeof num === 'number') {
429
+ return `${num}px`;
430
+ }
431
+ return num;
432
+ },
433
+ },
434
+ });
435
+ </script>
436
+
437
+ <style lang="scss">
438
+ .uni-forms-item {
439
+ position: relative;
440
+ display: flex;
441
+ /* #ifdef APP-NVUE */
442
+ // 在 nvue 中,使用 margin-bottom error 信息会被隐藏
443
+ padding-bottom: 22px;
444
+ /* #endif */
445
+ /* #ifndef APP-NVUE */
446
+ margin-bottom: 22px;
447
+ /* #endif */
448
+ flex-direction: row;
449
+
450
+ &__label {
451
+ display: flex;
452
+ flex-direction: row;
453
+ align-items: center;
454
+ text-align: left;
455
+ font-size: 14px;
456
+ color: #606266;
457
+ height: 36px;
458
+ padding: 0 12px 0 0;
459
+ /* #ifndef APP-NVUE */
460
+ vertical-align: middle;
461
+ flex-shrink: 0;
462
+ /* #endif */
463
+
464
+ /* #ifndef APP-NVUE */
465
+ box-sizing: border-box;
466
+
467
+ /* #endif */
468
+ &.no-label {
469
+ padding: 0;
470
+ }
471
+ }
472
+
473
+ &__content {
474
+ /* #ifndef MP-TOUTIAO */
475
+ // display: flex;
476
+ // align-items: center;
477
+ /* #endif */
478
+ position: relative;
479
+ font-size: 14px;
480
+ flex: 1;
481
+ /* #ifndef APP-NVUE */
482
+ box-sizing: border-box;
483
+ /* #endif */
484
+ flex-direction: row;
485
+
486
+ /* #ifndef APP || H5 || MP-WEIXIN || APP-NVUE */
487
+ // TODO 因为小程序平台会多一层标签节点 ,所以需要在多余节点继承当前样式
488
+ & > uni-easyinput,
489
+ & > uni-data-picker {
490
+ width: 100%;
491
+ }
492
+
493
+ /* #endif */
494
+ }
495
+
496
+ & .uni-forms-item__nuve-content {
497
+ display: flex;
498
+ flex-direction: column;
499
+ flex: 1;
500
+ }
501
+
502
+ &__error {
503
+ color: #f56c6c;
504
+ font-size: 12px;
505
+ line-height: 1;
506
+ padding-top: 4px;
507
+ position: absolute;
508
+ /* #ifndef APP-NVUE */
509
+ top: 100%;
510
+ left: 0;
511
+ transform: translateY(-100%);
512
+ /* #endif */
513
+ /* #ifdef APP-NVUE */
514
+ bottom: 5px;
515
+ /* #endif */
516
+
517
+ opacity: 0;
518
+
519
+ .error-text {
520
+ // 只有 nvue 下这个样式才生效
521
+ color: #f56c6c;
522
+ font-size: 12px;
523
+ }
524
+
525
+ &.msg--active {
526
+ opacity: 1;
527
+ transform: translateY(0%);
528
+ }
529
+ }
530
+
531
+ // 位置修饰样式
532
+ &.is-direction-left {
533
+ flex-direction: row;
534
+ }
535
+
536
+ &.is-direction-top {
537
+ flex-direction: column;
538
+
539
+ .uni-forms-item__label {
540
+ padding: 0 0 8px;
541
+ line-height: 1.5715;
542
+ text-align: left;
543
+ /* #ifndef APP-NVUE */
544
+ white-space: initial;
545
+ /* #endif */
546
+ }
547
+ }
548
+
549
+ .is-required {
550
+ // color: $uni-color-error;
551
+ color: #dd524d;
552
+ font-weight: bold;
553
+ }
554
+ }
555
+
556
+ .uni-forms-item--border {
557
+ margin-bottom: 0;
558
+ padding: 10px 0;
559
+ // padding-bottom: 0;
560
+ border-top: 1px #eee solid;
561
+
562
+ /* #ifndef APP-NVUE */
563
+ .uni-forms-item__content {
564
+ flex-direction: column;
565
+ justify-content: flex-start;
566
+ align-items: flex-start;
567
+
568
+ .uni-forms-item__error {
569
+ position: relative;
570
+ top: 5px;
571
+ left: 0;
572
+ padding-top: 0;
573
+ }
574
+ }
575
+
576
+ /* #endif */
577
+
578
+ /* #ifdef APP-NVUE */
579
+ display: flex;
580
+ flex-direction: column;
581
+
582
+ .uni-forms-item__error {
583
+ position: relative;
584
+ top: 0px;
585
+ left: 0;
586
+ padding-top: 0;
587
+ margin-top: 5px;
588
+ }
589
+
590
+ /* #endif */
591
+ }
592
+
593
+ .is-first-border {
594
+ /* #ifndef APP-NVUE */
595
+ border: none;
596
+ /* #endif */
597
+ /* #ifdef APP-NVUE */
598
+ border-width: 0;
599
+ /* #endif */
600
+ }
601
+ </style>
@@ -0,0 +1,6 @@
1
+ {
2
+ "uni-goods-nav.options.shop": "shop",
3
+ "uni-goods-nav.options.cart": "cart",
4
+ "uni-goods-nav.buttonGroup.addToCart": "add to cart",
5
+ "uni-goods-nav.buttonGroup.buyNow": "buy now"
6
+ }
@@ -0,0 +1,8 @@
1
+ import en from './en.json'
2
+ import zhHans from './zh-Hans.json'
3
+ import zhHant from './zh-Hant.json'
4
+ export default {
5
+ en,
6
+ 'zh-Hans': zhHans,
7
+ 'zh-Hant': zhHant
8
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "uni-goods-nav.options.shop": "店铺",
3
+ "uni-goods-nav.options.cart": "购物车",
4
+ "uni-goods-nav.buttonGroup.addToCart": "加入购物车",
5
+ "uni-goods-nav.buttonGroup.buyNow": "立即购买"
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "uni-goods-nav.options.shop": "店鋪",
3
+ "uni-goods-nav.options.cart": "購物車",
4
+ "uni-goods-nav.buttonGroup.addToCart": "加入購物車",
5
+ "uni-goods-nav.buttonGroup.buyNow": "立即購買"
6
+ }