@kengic/uni 0.3.2-beta.4 → 0.3.2-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (255) hide show
  1. package/dist/kengic-uni.js +2 -1527
  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 +3 -2
  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 -244
  178. package/dist/src/components/uni-ui/uni-data-pickerview/uni-data-picker.d.ts +0 -178
  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 -13
  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 -13
  229. package/dist/src/components/uni-ui/uni-popup/popup.d.ts +0 -11
  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
@@ -1,1530 +1,5 @@
1
- import O, { openBlock as d, createElementBlock as p, renderSlot as b, normalizeClass as v, normalizeStyle as w, toDisplayString as $, createCommentVNode as S, defineComponent as M, createElementVNode as h, resolveComponent as L, createBlock as _, Fragment as V } from "vue";
2
- const F = (e, t) => {
3
- const r = e.__vccOpts || e;
4
- for (const [i, s] of t)
5
- r[i] = s;
6
- return r;
7
- }, P = {
8
- name: "UniBadge",
9
- emits: ["click"],
10
- props: {
11
- type: {
12
- type: String,
13
- default: "error"
14
- },
15
- inverted: {
16
- type: Boolean,
17
- default: !1
18
- },
19
- isDot: {
20
- type: Boolean,
21
- default: !1
22
- },
23
- maxNum: {
24
- type: Number,
25
- default: 99
26
- },
27
- absolute: {
28
- type: String,
29
- default: ""
30
- },
31
- offset: {
32
- type: Array,
33
- default() {
34
- return [0, 0];
35
- }
36
- },
37
- text: {
38
- type: [String, Number],
39
- default: ""
40
- },
41
- size: {
42
- type: String,
43
- default: "small"
44
- },
45
- customStyle: {
46
- type: Object,
47
- default() {
48
- return {};
49
- }
50
- }
51
- },
52
- data() {
53
- return {};
54
- },
55
- computed: {
56
- width() {
57
- return String(this.text).length * 8 + 12;
58
- },
59
- classNames() {
60
- const { inverted: e, type: t, size: r, absolute: i } = this;
61
- return [e ? "uni-badge--" + t + "-inverted" : "", "uni-badge--" + t, "uni-badge--" + r, i ? "uni-badge--absolute" : ""].join(
62
- " "
63
- );
64
- },
65
- positionStyle() {
66
- if (!this.absolute)
67
- return {};
68
- let e = this.width / 2, t = 10;
69
- this.isDot && (e = 5, t = 5);
70
- const r = `${-e + this.offset[0]}px`, i = `${-t + this.offset[1]}px`, s = {
71
- rightTop: {
72
- right: r,
73
- top: i
74
- },
75
- rightBottom: {
76
- right: r,
77
- bottom: i
78
- },
79
- leftBottom: {
80
- left: r,
81
- bottom: i
82
- },
83
- leftTop: {
84
- left: r,
85
- top: i
86
- }
87
- }, n = s[this.absolute];
88
- return n || s.rightTop;
89
- },
90
- dotStyle() {
91
- return this.isDot ? {
92
- width: "10px",
93
- minWidth: "0",
94
- height: "10px",
95
- padding: "0",
96
- borderRadius: "10px"
97
- } : {};
98
- },
99
- displayValue() {
100
- const { isDot: e, text: t, maxNum: r } = this;
101
- return e ? "" : Number(t) > r ? `${r}+` : t;
102
- }
103
- },
104
- methods: {
105
- onClick() {
106
- this.$emit("click");
107
- }
108
- }
109
- }, q = { class: "uni-badge--x" };
110
- function x(e, t, r, i, s, n) {
111
- return d(), p("view", q, [
112
- b(e.$slots, "default"),
113
- r.text ? (d(), p("text", {
114
- key: 0,
115
- class: v([n.classNames, "uni-badge"]),
116
- style: w([n.positionStyle, r.customStyle, n.dotStyle]),
117
- onClick: t[0] || (t[0] = (a) => n.onClick())
118
- }, $(n.displayValue), 7)) : S("", !0)
119
- ]);
120
- }
121
- const Ie = /* @__PURE__ */ F(P, [["render", x]]);
122
- const U = M({
123
- name: "UniCard",
124
- emits: ["click"],
125
- props: {
126
- title: {
127
- type: String,
128
- default: ""
129
- },
130
- subTitle: {
131
- type: String,
132
- default: ""
133
- },
134
- padding: {
135
- type: String,
136
- default: "10px"
137
- },
138
- margin: {
139
- type: String,
140
- default: "15px"
141
- },
142
- spacing: {
143
- type: String,
144
- default: "0 10px"
145
- },
146
- extra: {
147
- type: String,
148
- default: ""
149
- },
150
- cover: {
151
- type: String,
152
- default: ""
153
- },
154
- thumbnail: {
155
- type: String,
156
- default: ""
157
- },
158
- isFull: {
159
- // 内容区域是否通栏
160
- type: Boolean,
161
- default: !1
162
- },
163
- isShadow: {
164
- // 是否开启阴影
165
- type: Boolean,
166
- default: !0
167
- },
168
- shadow: {
169
- type: String,
170
- default: "0px 0px 3px 1px rgba(0, 0, 0, 0.08)"
171
- },
172
- border: {
173
- type: Boolean,
174
- default: !0
175
- }
176
- },
177
- methods: {
178
- onClick(e) {
179
- this.$emit("click", e);
180
- }
181
- }
182
- }), z = {
183
- key: 0,
184
- class: "uni-card__cover"
185
- }, W = ["src"], H = {
186
- key: 0,
187
- class: "uni-card__header"
188
- }, J = {
189
- key: 0,
190
- class: "uni-card__header-avatar"
191
- }, G = ["src"], K = { class: "uni-card__header-content" }, X = { class: "uni-card__header-content-title uni-ellipsis" }, Q = {
192
- key: 0,
193
- class: "uni-card__header-content-subtitle uni-ellipsis"
194
- }, Y = { class: "uni-card__header-extra-text" };
195
- function Z(e, t, r, i, s, n) {
196
- return d(), p("view", {
197
- class: v(["uni-card", { "uni-card--full": e.isFull, "uni-card--shadow": e.isShadow, "uni-card--border": e.border }]),
198
- style: w({ margin: e.isFull ? 0 : e.margin, padding: e.spacing, "box-shadow": e.isShadow ? e.shadow : "" })
199
- }, [
200
- b(e.$slots, "cover", {}, () => [
201
- e.cover ? (d(), p("view", z, [
202
- h("image", {
203
- class: "uni-card__cover-image",
204
- mode: "widthFix",
205
- onClick: t[0] || (t[0] = (a) => e.onClick("cover")),
206
- src: e.cover
207
- }, null, 8, W)
208
- ])) : S("", !0)
209
- ]),
210
- b(e.$slots, "title", {}, () => [
211
- e.title || e.extra ? (d(), p("view", H, [
212
- h("view", {
213
- class: "uni-card__header-box",
214
- onClick: t[1] || (t[1] = (a) => e.onClick("title"))
215
- }, [
216
- e.thumbnail ? (d(), p("view", J, [
217
- h("image", {
218
- class: "uni-card__header-avatar-image",
219
- src: e.thumbnail,
220
- mode: "aspectFit"
221
- }, null, 8, G)
222
- ])) : S("", !0),
223
- h("view", K, [
224
- h("text", X, $(e.title), 1),
225
- e.title && e.subTitle ? (d(), p("text", Q, $(e.subTitle), 1)) : S("", !0)
226
- ])
227
- ]),
228
- h("view", {
229
- class: "uni-card__header-extra",
230
- onClick: t[2] || (t[2] = (a) => e.onClick("extra"))
231
- }, [
232
- b(e.$slots, "extra", {}, () => [
233
- h("text", Y, $(e.extra), 1)
234
- ])
235
- ])
236
- ])) : S("", !0)
237
- ]),
238
- h("view", {
239
- class: "uni-card__content",
240
- style: w({ padding: e.padding }),
241
- onClick: t[3] || (t[3] = (a) => e.onClick("content"))
242
- }, [
243
- b(e.$slots, "default")
244
- ], 4),
245
- h("view", {
246
- class: "uni-card__actions",
247
- onClick: t[4] || (t[4] = (a) => e.onClick("actions"))
248
- }, [
249
- b(e.$slots, "actions")
250
- ])
251
- ], 6);
252
- }
253
- const Re = /* @__PURE__ */ F(U, [["render", Z]]);
254
- function ee(e) {
255
- let t = "";
256
- for (let r in e)
257
- e[r] && (t += `${r} `);
258
- return t;
259
- }
260
- function I(e) {
261
- let t = "";
262
- for (let r in e) {
263
- const i = e[r];
264
- t += `${r}:${i};`;
265
- }
266
- return t;
267
- }
268
- const te = M({
269
- name: "UniEasyinput",
270
- emits: ["click", "iconClick", "update:modelValue", "input", "focus", "blur", "confirm", "clear", "eyes", "change", "keyboardheightchange"],
271
- model: {
272
- prop: "modelValue",
273
- event: "update:modelValue"
274
- },
275
- options: {
276
- virtualHost: !0
277
- },
278
- inject: {
279
- form: {
280
- from: "uniForm",
281
- default: null
282
- },
283
- formItem: {
284
- from: "uniFormItem",
285
- default: null
286
- }
287
- },
288
- props: {
289
- name: String,
290
- value: [Number, String],
291
- modelValue: [Number, String],
292
- type: {
293
- type: String,
294
- default: "text"
295
- },
296
- clearable: {
297
- type: Boolean,
298
- default: !0
299
- },
300
- autoHeight: {
301
- type: Boolean,
302
- default: !1
303
- },
304
- placeholder: {
305
- type: String,
306
- default: " "
307
- },
308
- placeholderStyle: String,
309
- focus: {
310
- type: Boolean,
311
- default: !1
312
- },
313
- disabled: {
314
- type: Boolean,
315
- default: !1
316
- },
317
- maxlength: {
318
- type: [Number, String],
319
- default: 140
320
- },
321
- confirmType: {
322
- type: String,
323
- default: "done"
324
- },
325
- clearSize: {
326
- type: [Number, String],
327
- default: 24
328
- },
329
- inputBorder: {
330
- type: Boolean,
331
- default: !0
332
- },
333
- prefixIcon: {
334
- type: String,
335
- default: ""
336
- },
337
- suffixIcon: {
338
- type: String,
339
- default: ""
340
- },
341
- trim: {
342
- type: [Boolean, String],
343
- default: !1
344
- },
345
- cursorSpacing: {
346
- type: Number,
347
- default: 0
348
- },
349
- passwordIcon: {
350
- type: Boolean,
351
- default: !0
352
- },
353
- primaryColor: {
354
- type: String,
355
- default: "#2979ff"
356
- },
357
- styles: {
358
- type: Object,
359
- default() {
360
- return {
361
- color: "#333",
362
- backgroundColor: "#fff",
363
- disableColor: "#F7F6F6",
364
- borderColor: "#e5e5e5"
365
- };
366
- }
367
- },
368
- errorMessage: {
369
- type: [String, Boolean],
370
- default: ""
371
- }
372
- },
373
- data() {
374
- return {
375
- focused: !1,
376
- val: "",
377
- showMsg: "",
378
- border: !1,
379
- isFirstBorder: !1,
380
- showClearIcon: !1,
381
- showPassword: !1,
382
- focusShow: !1,
383
- localMsg: "",
384
- isEnter: !1
385
- // 用于判断当前是否是使用回车操作
386
- };
387
- },
388
- computed: {
389
- // 输入框内是否有值
390
- isVal() {
391
- const e = this.val;
392
- return !!(e || e === 0);
393
- },
394
- msg() {
395
- return this.localMsg || this.errorMessage;
396
- },
397
- // 因为uniapp的input组件的maxlength组件必须要数值,这里转为数值,用户可以传入字符串数值
398
- inputMaxlength() {
399
- return Number(this.maxlength);
400
- },
401
- // 处理外层样式的style
402
- boxStyle() {
403
- return `color:${this.inputBorder && this.msg ? "#e43d33" : this.styles.color};`;
404
- },
405
- // input 内容的类和样式处理
406
- inputContentClass() {
407
- return ee({
408
- "is-input-border": this.inputBorder,
409
- "is-input-error-border": this.inputBorder && this.msg,
410
- "is-textarea": this.type === "textarea",
411
- "is-disabled": this.disabled,
412
- "is-focused": this.focusShow
413
- });
414
- },
415
- inputContentStyle() {
416
- const e = this.focusShow ? this.primaryColor : this.styles.borderColor, t = this.inputBorder && this.msg ? "#dd524d" : e;
417
- return I({
418
- "border-color": t || "#e5e5e5",
419
- "background-color": this.disabled ? this.styles.disableColor : this.styles.backgroundColor
420
- });
421
- },
422
- // input右侧样式
423
- inputStyle() {
424
- const e = this.type === "password" || this.clearable || this.prefixIcon ? "" : "10px";
425
- return I({
426
- "padding-right": e,
427
- "padding-left": this.prefixIcon ? "" : "10px"
428
- });
429
- }
430
- },
431
- watch: {
432
- value(e) {
433
- this.val = e;
434
- },
435
- modelValue(e) {
436
- this.val = e;
437
- },
438
- focus(e) {
439
- this.$nextTick(() => {
440
- this.focused = this.focus, this.focusShow = this.focus;
441
- });
442
- }
443
- },
444
- created() {
445
- this.init(), this.form && this.formItem && this.$watch("formItem.errMsg", (e) => {
446
- this.localMsg = e;
447
- });
448
- },
449
- mounted() {
450
- this.$nextTick(() => {
451
- this.focused = this.focus, this.focusShow = this.focus;
452
- });
453
- },
454
- methods: {
455
- /**
456
- * 初始化变量值
457
- */
458
- init() {
459
- this.value || this.value === 0 ? this.val = this.value : this.modelValue || this.modelValue === 0 || this.modelValue === "" ? this.val = this.modelValue : this.val = null;
460
- },
461
- /**
462
- * 点击图标时触发
463
- * @param {Object} type
464
- */
465
- onClickIcon(e) {
466
- this.$emit("iconClick", e);
467
- },
468
- /**
469
- * 显示隐藏内容,密码框时生效
470
- */
471
- onEyes() {
472
- this.showPassword = !this.showPassword, this.$emit("eyes", this.showPassword);
473
- },
474
- /**
475
- * 输入时触发
476
- * @param {Object} event
477
- */
478
- onInput(e) {
479
- let t = e.detail.value;
480
- this.trim && (typeof this.trim == "boolean" && this.trim && (t = this.trimStr(t)), typeof this.trim == "string" && (t = this.trimStr(t, this.trim))), this.errMsg && (this.errMsg = ""), this.val = t, this.$emit("input", t), this.$emit("update:modelValue", t);
481
- },
482
- /**
483
- * 外部调用方法
484
- * 获取焦点时触发
485
- * @param {Object} event
486
- */
487
- onFocus() {
488
- this.$nextTick(() => {
489
- this.focused = !0;
490
- }), this.$emit("focus", null);
491
- },
492
- _Focus(e) {
493
- this.focusShow = !0, this.$emit("focus", e);
494
- },
495
- /**
496
- * 外部调用方法
497
- * 失去焦点时触发
498
- * @param {Object} event
499
- */
500
- onBlur() {
501
- this.focused = !1, this.$emit("focus", null);
502
- },
503
- _Blur(e) {
504
- if (e.detail.value, this.focusShow = !1, this.$emit("blur", e), this.isEnter === !1 && this.$emit("change", this.val), this.form && this.formItem) {
505
- const { validateTrigger: t } = this.form;
506
- t === "blur" && this.formItem.onFieldChange();
507
- }
508
- },
509
- /**
510
- * 按下键盘的发送键
511
- * @param {Object} e
512
- */
513
- onConfirm(e) {
514
- this.$emit("confirm", this.val), this.isEnter = !0, this.$emit("change", this.val), this.$nextTick(() => {
515
- this.isEnter = !1;
516
- });
517
- },
518
- /**
519
- * 清理内容
520
- * @param {Object} event
521
- */
522
- onClear(e) {
523
- this.val = "", this.$emit("input", ""), this.$emit("update:modelValue", ""), this.$emit("clear");
524
- },
525
- /**
526
- * 键盘高度发生变化的时候触发此事件
527
- * 兼容性:微信小程序2.7.0+、App 3.1.0+
528
- * @param {Object} event
529
- */
530
- onkeyboardheightchange(e) {
531
- this.$emit("keyboardheightchange", e);
532
- },
533
- /**
534
- * 去除空格
535
- */
536
- trimStr(e, t = "both") {
537
- return t === "both" ? e.trim() : t === "left" ? e.trimLeft() : t === "right" ? e.trimRight() : t === "start" ? e.trimStart() : t === "end" ? e.trimEnd() : t === "all" ? e.replace(/\s+/g, "") : e;
538
- }
539
- }
540
- }), re = ["name", "value", "placeholder", "placeholderStyle", "disabled", "maxlength", "focus", "autoHeight", "cursor-spacing"], ie = ["type", "name", "value", "password", "placeholder", "placeholderStyle", "disabled", "maxlength", "focus", "confirmType", "cursor-spacing"];
541
- function se(e, t, r, i, s, n) {
542
- const a = L("uni-icons");
543
- return d(), p("view", {
544
- class: v(["uni-easyinput", { "uni-easyinput-error": e.msg }]),
545
- style: w(e.boxStyle)
546
- }, [
547
- h("view", {
548
- class: v(["uni-easyinput__content", e.inputContentClass]),
549
- style: w(e.inputContentStyle)
550
- }, [
551
- e.prefixIcon ? (d(), _(a, {
552
- key: 0,
553
- class: "content-clear-icon",
554
- type: e.prefixIcon,
555
- color: "#c0c4cc",
556
- onClick: t[0] || (t[0] = (l) => e.onClickIcon("prefix")),
557
- size: "22"
558
- }, null, 8, ["type"])) : S("", !0),
559
- e.type === "textarea" ? (d(), p("textarea", {
560
- key: 1,
561
- class: v(["uni-easyinput__content-textarea", { "input-padding": e.inputBorder }]),
562
- name: e.name,
563
- value: e.val,
564
- placeholder: e.placeholder,
565
- placeholderStyle: e.placeholderStyle,
566
- disabled: e.disabled,
567
- "placeholder-class": "uni-easyinput__placeholder-class",
568
- maxlength: e.inputMaxlength,
569
- focus: e.focused,
570
- autoHeight: e.autoHeight,
571
- "cursor-spacing": e.cursorSpacing,
572
- onInput: t[1] || (t[1] = (...l) => e.onInput && e.onInput(...l)),
573
- onBlur: t[2] || (t[2] = (...l) => e._Blur && e._Blur(...l)),
574
- onFocus: t[3] || (t[3] = (...l) => e._Focus && e._Focus(...l)),
575
- onConfirm: t[4] || (t[4] = (...l) => e.onConfirm && e.onConfirm(...l)),
576
- onKeyboardheightchange: t[5] || (t[5] = (...l) => e.onkeyboardheightchange && e.onkeyboardheightchange(...l))
577
- }, null, 42, re)) : (d(), p("input", {
578
- key: 2,
579
- type: e.type === "password" ? "text" : e.type,
580
- class: "uni-easyinput__content-input",
581
- style: w(e.inputStyle),
582
- name: e.name,
583
- value: e.val,
584
- password: !e.showPassword && e.type === "password",
585
- placeholder: e.placeholder,
586
- placeholderStyle: e.placeholderStyle,
587
- "placeholder-class": "uni-easyinput__placeholder-class",
588
- disabled: e.disabled,
589
- maxlength: e.inputMaxlength,
590
- focus: e.focused,
591
- confirmType: e.confirmType,
592
- "cursor-spacing": e.cursorSpacing,
593
- onFocus: t[6] || (t[6] = (...l) => e._Focus && e._Focus(...l)),
594
- onBlur: t[7] || (t[7] = (...l) => e._Blur && e._Blur(...l)),
595
- onInput: t[8] || (t[8] = (...l) => e.onInput && e.onInput(...l)),
596
- onConfirm: t[9] || (t[9] = (...l) => e.onConfirm && e.onConfirm(...l)),
597
- onKeyboardheightchange: t[10] || (t[10] = (...l) => e.onkeyboardheightchange && e.onkeyboardheightchange(...l))
598
- }, null, 44, ie)),
599
- e.type === "password" && e.passwordIcon ? (d(), p(V, { key: 3 }, [
600
- e.isVal ? (d(), _(a, {
601
- key: 0,
602
- class: v(["content-clear-icon", { "is-textarea-icon": e.type === "textarea" }]),
603
- type: e.showPassword ? "eye-slash-filled" : "eye-filled",
604
- size: 22,
605
- color: e.focusShow ? e.primaryColor : "#c0c4cc",
606
- onClick: e.onEyes
607
- }, null, 8, ["class", "type", "color", "onClick"])) : S("", !0)
608
- ], 64)) : e.suffixIcon ? (d(), p(V, { key: 4 }, [
609
- e.suffixIcon ? (d(), _(a, {
610
- key: 0,
611
- class: "content-clear-icon",
612
- type: e.suffixIcon,
613
- color: "#c0c4cc",
614
- onClick: t[11] || (t[11] = (l) => e.onClickIcon("suffix")),
615
- size: "22"
616
- }, null, 8, ["type"])) : S("", !0)
617
- ], 64)) : (d(), p(V, { key: 5 }, [
618
- e.clearable && e.isVal && !e.disabled && e.type !== "textarea" ? (d(), _(a, {
619
- key: 0,
620
- class: v(["content-clear-icon", { "is-textarea-icon": e.type === "textarea" }]),
621
- type: "clear",
622
- size: e.clearSize,
623
- color: e.msg ? "#dd524d" : e.focusShow ? e.primaryColor : "#c0c4cc",
624
- onClick: e.onClear
625
- }, null, 8, ["class", "size", "color", "onClick"])) : S("", !0)
626
- ], 64)),
627
- b(e.$slots, "right")
628
- ], 6)
629
- ], 6);
630
- }
631
- const Ae = /* @__PURE__ */ F(te, [["render", se]]);
632
- var B = {
633
- email: /^\S+?@\S+?\.\S+?$/,
634
- idcard: /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/,
635
- url: new RegExp(
636
- "^(?!mailto:)(?:(?:http|https|ftp)://|//)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$",
637
- "i"
638
- )
639
- };
640
- const R = {
641
- int: "integer",
642
- bool: "boolean",
643
- double: "number",
644
- long: "number",
645
- password: "string"
646
- // "fileurls": 'array'
647
- };
648
- function g(e, t = "") {
649
- var r = ["label"];
650
- r.forEach((s) => {
651
- e[s] === void 0 && (e[s] = "");
652
- });
653
- let i = t;
654
- for (let s in e) {
655
- let n = new RegExp("{" + s + "}");
656
- i = i.replace(n, e[s]);
657
- }
658
- return i;
659
- }
660
- function ne(e, t) {
661
- return !!(e == null || typeof e == "string" && !e || Array.isArray(e) && !e.length || t === "object" && !Object.keys(e).length);
662
- }
663
- const y = {
664
- integer(e) {
665
- return y.number(e) && parseInt(e, 10) === e;
666
- },
667
- string(e) {
668
- return typeof e == "string";
669
- },
670
- number(e) {
671
- return isNaN(e) ? !1 : typeof e == "number";
672
- },
673
- boolean: function(e) {
674
- return typeof e == "boolean";
675
- },
676
- float: function(e) {
677
- return y.number(e) && !y.integer(e);
678
- },
679
- array(e) {
680
- return Array.isArray(e);
681
- },
682
- object(e) {
683
- return typeof e == "object" && !y.array(e);
684
- },
685
- date(e) {
686
- return e instanceof Date;
687
- },
688
- timestamp(e) {
689
- return !(!this.integer(e) || Math.abs(e).toString().length > 16);
690
- },
691
- file(e) {
692
- return typeof e.url == "string";
693
- },
694
- email(e) {
695
- return typeof e == "string" && !!e.match(B.email) && e.length < 255;
696
- },
697
- url(e) {
698
- return typeof e == "string" && !!e.match(B.url);
699
- },
700
- pattern(e, t) {
701
- try {
702
- return new RegExp(e).test(t);
703
- } catch {
704
- return !1;
705
- }
706
- },
707
- method(e) {
708
- return typeof e == "function";
709
- },
710
- idcard(e) {
711
- return typeof e == "string" && !!e.match(B.idcard);
712
- },
713
- "url-https"(e) {
714
- return this.url(e) && e.startsWith("https://");
715
- },
716
- "url-scheme"(e) {
717
- return e.startsWith("://");
718
- },
719
- "url-web"(e) {
720
- return !1;
721
- }
722
- };
723
- class ae {
724
- constructor(t) {
725
- this._message = t;
726
- }
727
- async validateRule(t, r, i, s, n) {
728
- var a = null;
729
- let l = r.rules;
730
- if (l.findIndex((o) => o.required) < 0 && (i == null || typeof i == "string" && !i.length))
731
- return a;
732
- var c = this._message;
733
- if (l === void 0)
734
- return c.default;
735
- for (var m = 0; m < l.length; m++) {
736
- let o = l[m], f = this._getValidateType(o);
737
- if (Object.assign(o, {
738
- label: r.label || `["${t}"]`
739
- }), A[f] && (a = A[f](o, i, c), a != null))
740
- break;
741
- if (o.validateExpr) {
742
- let j = Date.now();
743
- if (o.validateExpr(i, n, j) === !1) {
744
- a = this._getMessage(o, o.errorMessage || this._message.default);
745
- break;
746
- }
747
- }
748
- if (o.validateFunction && (a = await this.validateFunction(o, i, s, n, f), a !== null))
749
- break;
750
- }
751
- return a !== null && (a = c.TAG + a), a;
752
- }
753
- async validateFunction(t, r, i, s, n) {
754
- let a = null;
755
- try {
756
- let l = null;
757
- const u = await t.validateFunction(t, r, s || i, (c) => {
758
- l = c;
759
- });
760
- (l || typeof u == "string" && u || u === !1) && (a = this._getMessage(t, l || u, n));
761
- } catch (l) {
762
- a = this._getMessage(t, l.message, n);
763
- }
764
- return a;
765
- }
766
- _getMessage(t, r, i) {
767
- return g(t, r || t.errorMessage || this._message[i] || r.default);
768
- }
769
- _getValidateType(t) {
770
- var r = "";
771
- return t.required ? r = "required" : t.format ? r = "format" : t.arrayType ? r = "arrayTypeFormat" : t.range ? r = "range" : t.maximum !== void 0 || t.minimum !== void 0 ? r = "rangeNumber" : t.maxLength !== void 0 || t.minLength !== void 0 ? r = "rangeLength" : t.pattern ? r = "pattern" : t.validateFunction && (r = "validateFunction"), r;
772
- }
773
- }
774
- const A = {
775
- required(e, t, r) {
776
- return e.required && ne(t, e.format || typeof t) ? g(e, e.errorMessage || r.required) : null;
777
- },
778
- range(e, t, r) {
779
- const {
780
- range: i,
781
- errorMessage: s
782
- } = e;
783
- let n = new Array(i.length);
784
- for (let l = 0; l < i.length; l++) {
785
- const u = i[l];
786
- y.object(u) && u.value !== void 0 ? n[l] = u.value : n[l] = u;
787
- }
788
- let a = !1;
789
- return Array.isArray(t) ? a = new Set(t.concat(n)).size === n.length : n.indexOf(t) > -1 && (a = !0), a ? null : g(e, s || r.enum);
790
- },
791
- rangeNumber(e, t, r) {
792
- if (!y.number(t))
793
- return g(e, e.errorMessage || r.pattern.mismatch);
794
- let {
795
- minimum: i,
796
- maximum: s,
797
- exclusiveMinimum: n,
798
- exclusiveMaximum: a
799
- } = e, l = n ? t <= i : t < i, u = a ? t >= s : t > s;
800
- return i !== void 0 && l ? g(e, e.errorMessage || r.number[n ? "exclusiveMinimum" : "minimum"]) : s !== void 0 && u ? g(e, e.errorMessage || r.number[a ? "exclusiveMaximum" : "maximum"]) : i !== void 0 && s !== void 0 && (l || u) ? g(e, e.errorMessage || r.number.range) : null;
801
- },
802
- rangeLength(e, t, r) {
803
- if (!y.string(t) && !y.array(t))
804
- return g(e, e.errorMessage || r.pattern.mismatch);
805
- let i = e.minLength, s = e.maxLength, n = t.length;
806
- return i !== void 0 && n < i ? g(e, e.errorMessage || r.length.minLength) : s !== void 0 && n > s ? g(e, e.errorMessage || r.length.maxLength) : i !== void 0 && s !== void 0 && (n < i || n > s) ? g(e, e.errorMessage || r.length.range) : null;
807
- },
808
- pattern(e, t, r) {
809
- return y.pattern(e.pattern, t) ? null : g(e, e.errorMessage || r.pattern.mismatch);
810
- },
811
- format(e, t, r) {
812
- var i = Object.keys(y), s = R[e.format] ? R[e.format] : e.format || e.arrayType;
813
- return i.indexOf(s) > -1 && !y[s](t) ? g(e, e.errorMessage || r.typeError) : null;
814
- },
815
- arrayTypeFormat(e, t, r) {
816
- if (!Array.isArray(t))
817
- return g(e, e.errorMessage || r.typeError);
818
- for (let i = 0; i < t.length; i++) {
819
- const s = t[i];
820
- let n = this.format(e, s, r);
821
- if (n !== null)
822
- return n;
823
- }
824
- return null;
825
- }
826
- };
827
- class C extends ae {
828
- constructor(t, r) {
829
- super(C.message), this._schema = t, this._options = r || null;
830
- }
831
- updateSchema(t) {
832
- this._schema = t;
833
- }
834
- async validate(t, r) {
835
- let i = this._checkFieldInSchema(t);
836
- return i || (i = await this.invokeValidate(t, !1, r)), i.length ? i[0] : null;
837
- }
838
- async validateAll(t, r) {
839
- let i = this._checkFieldInSchema(t);
840
- return i || (i = await this.invokeValidate(t, !0, r)), i;
841
- }
842
- async validateUpdate(t, r) {
843
- let i = this._checkFieldInSchema(t);
844
- return i || (i = await this.invokeValidateUpdate(t, !1, r)), i.length ? i[0] : null;
845
- }
846
- async invokeValidate(t, r, i) {
847
- let s = [], n = this._schema;
848
- for (let a in n) {
849
- let l = n[a], u = await this.validateRule(a, l, t[a], t, i);
850
- if (u != null && (s.push({
851
- key: a,
852
- errorMessage: u
853
- }), !r))
854
- break;
855
- }
856
- return s;
857
- }
858
- async invokeValidateUpdate(t, r, i) {
859
- let s = [];
860
- for (let n in t) {
861
- let a = await this.validateRule(n, this._schema[n], t[n], t, i);
862
- if (a != null && (s.push({
863
- key: n,
864
- errorMessage: a
865
- }), !r))
866
- break;
867
- }
868
- return s;
869
- }
870
- _checkFieldInSchema(t) {
871
- var r = Object.keys(t), i = Object.keys(this._schema);
872
- if (new Set(r.concat(i)).size === i.length)
873
- return "";
874
- var s = r.filter((a) => i.indexOf(a) < 0), n = g({
875
- field: JSON.stringify(s)
876
- }, C.message.TAG + C.message.defaultInvalid);
877
- return [{
878
- key: "invalid",
879
- errorMessage: n
880
- }];
881
- }
882
- }
883
- function le() {
884
- return {
885
- TAG: "",
886
- default: "验证错误",
887
- defaultInvalid: "提交的字段{field}在数据库中并不存在",
888
- validateFunction: "验证无效",
889
- required: "{label}必填",
890
- enum: "{label}超出范围",
891
- timestamp: "{label}格式无效",
892
- whitespace: "{label}不能为空",
893
- typeError: "{label}类型无效",
894
- date: {
895
- format: "{label}日期{value}格式无效",
896
- parse: "{label}日期无法解析,{value}无效",
897
- invalid: "{label}日期{value}无效"
898
- },
899
- length: {
900
- minLength: "{label}长度不能少于{minLength}",
901
- maxLength: "{label}长度不能超过{maxLength}",
902
- range: "{label}必须介于{minLength}和{maxLength}之间"
903
- },
904
- number: {
905
- minimum: "{label}不能小于{minimum}",
906
- maximum: "{label}不能大于{maximum}",
907
- exclusiveMinimum: "{label}不能小于等于{minimum}",
908
- exclusiveMaximum: "{label}不能大于等于{maximum}",
909
- range: "{label}必须介于{minimum}and{maximum}之间"
910
- },
911
- pattern: {
912
- mismatch: "{label}格式不匹配"
913
- }
914
- };
915
- }
916
- C.message = new le();
917
- const oe = (e) => JSON.parse(JSON.stringify(e)), ue = (e) => e === "int" || e === "double" || e === "number" || e === "timestamp", D = (e, t, r) => {
918
- const i = r.find((n) => n.format && ue(n.format)), s = r.find((n) => n.format && n.format === "boolean" || n.format === "bool");
919
- return i && (!t && t !== 0 ? t = null : t = T(Number(t)) ? Number(t) : t), s && (t = ge(t) ? t : !1), t;
920
- }, fe = (e, t, r) => (t[e] = r, r || ""), E = (e, t) => pe(t, e), k = (e, t = {}) => {
921
- const r = N(e);
922
- return typeof r == "object" && Array.isArray(r) && r.length > 1 ? r.reduce((s, n) => s += `#${n}`, "_formdata_") : r[0] || e;
923
- }, de = (e) => /^_formdata_#*/.test(e), he = (e = {}, t) => {
924
- let r = JSON.parse(JSON.stringify(e)), i = {};
925
- for (let s in r) {
926
- let n = me(s);
927
- ce(i, n, r[s]);
928
- }
929
- return i;
930
- }, me = (e) => {
931
- let t = e.replace("_formdata_#", "");
932
- return t = t.split("#").map((r) => T(r) ? Number(r) : r), t;
933
- }, ce = (e, t, r) => (typeof e != "object" || N(t).reduce((i, s, n, a) => n === a.length - 1 ? (i[s] = r, null) : (s in i || (i[s] = /^[0-9]{1,}$/.test(a[n + 1]) ? [] : {}), i[s]), e), e);
934
- function N(e) {
935
- return Array.isArray(e) ? e : e.replace(/\[/g, ".").replace(/\]/g, "").split(".");
936
- }
937
- const pe = (e, t, r = "undefined") => {
938
- let s = N(t).reduce((n, a) => (n || {})[a], e);
939
- return !s || s !== void 0 ? s : r;
940
- }, T = (e) => !isNaN(Number(e)), ge = (e) => typeof e == "boolean", ye = (e) => {
941
- let t = !1;
942
- for (let r = 0; r < e.length; r++)
943
- if (e[r].required) {
944
- t = !0;
945
- break;
946
- }
947
- return t;
948
- }, be = (e, t) => {
949
- if (e === t)
950
- return e !== 0 || 1 / e === 1 / t;
951
- if (e == null || t == null)
952
- return e === t;
953
- var r = toString.call(e), i = toString.call(t);
954
- if (r !== i)
955
- return !1;
956
- switch (r) {
957
- case "[object RegExp]":
958
- case "[object String]":
959
- return "" + e == "" + t;
960
- case "[object Number]":
961
- return +e != +e ? +t != +t : +e == 0 ? 1 / +e === 1 / t : +e == +t;
962
- case "[object Date]":
963
- case "[object Boolean]":
964
- return +e == +t;
965
- }
966
- if (r == "[object Object]") {
967
- var s = Object.getOwnPropertyNames(e), n = Object.getOwnPropertyNames(t);
968
- if (s.length != n.length)
969
- return !1;
970
- for (var a = 0; a < s.length; a++) {
971
- var l = s[a];
972
- if (e[l] !== t[l])
973
- return !1;
974
- }
975
- return !0;
976
- }
977
- if (r == "[object Array]")
978
- return e.toString() == t.toString();
979
- };
980
- O.prototype.binddata = function(e, t, r) {
981
- if (r)
982
- this.$refs[r].setValue(e, t);
983
- else {
984
- let i;
985
- for (let s in this.$refs) {
986
- const n = this.$refs[s];
987
- if (n && n.$options && n.$options.name === "uniForms") {
988
- i = n;
989
- break;
990
- }
991
- }
992
- if (!i)
993
- return console.error("当前 uni-froms 组件缺少 ref 属性");
994
- i.setValue(e, t);
995
- }
996
- };
997
- const ve = M({
998
- name: "UniForms",
999
- emits: ["validate", "submit"],
1000
- options: {
1001
- virtualHost: !0
1002
- },
1003
- props: {
1004
- // 即将弃用
1005
- value: {
1006
- type: Object,
1007
- default() {
1008
- return null;
1009
- }
1010
- },
1011
- // vue3 替换 value 属性
1012
- modelValue: {
1013
- type: Object,
1014
- default() {
1015
- return null;
1016
- }
1017
- },
1018
- // 1.4.0 开始将不支持 v-model ,且废弃 value 和 modelValue
1019
- model: {
1020
- type: Object,
1021
- default() {
1022
- return null;
1023
- }
1024
- },
1025
- // 表单校验规则
1026
- rules: {
1027
- type: Object,
1028
- default() {
1029
- return {};
1030
- }
1031
- },
1032
- //校验错误信息提示方式 默认 undertext 取值 [undertext|toast|modal]
1033
- errShowType: {
1034
- type: String,
1035
- default: "undertext"
1036
- },
1037
- // 校验触发器方式 默认 bind 取值 [bind|submit]
1038
- validateTrigger: {
1039
- type: String,
1040
- default: "submit"
1041
- },
1042
- // label 位置,默认 left 取值 top/left
1043
- labelPosition: {
1044
- type: String,
1045
- default: "left"
1046
- },
1047
- // label 宽度
1048
- labelWidth: {
1049
- type: [String, Number],
1050
- default: ""
1051
- },
1052
- // label 居中方式,默认 left 取值 left/center/right
1053
- labelAlign: {
1054
- type: String,
1055
- default: "left"
1056
- },
1057
- border: {
1058
- type: Boolean,
1059
- default: !1
1060
- }
1061
- },
1062
- provide() {
1063
- return {
1064
- uniForm: this
1065
- };
1066
- },
1067
- data() {
1068
- return {
1069
- // 表单本地值的记录,不应该与传如的值进行关联
1070
- formData: {},
1071
- formRules: {}
1072
- };
1073
- },
1074
- computed: {
1075
- // 计算数据源变化的
1076
- localData() {
1077
- const e = this.model || this.modelValue || this.value;
1078
- return e ? oe(e) : {};
1079
- }
1080
- },
1081
- watch: {
1082
- // 监听数据变化 ,暂时不使用,需要单独赋值
1083
- // localData: {},
1084
- // 监听规则变化
1085
- rules: {
1086
- handler: function(e, t) {
1087
- this.setRules(e);
1088
- },
1089
- deep: !0,
1090
- immediate: !0
1091
- }
1092
- },
1093
- created() {
1094
- getApp().$vm.$.appContext.config.globalProperties.binddata || (getApp().$vm.$.appContext.config.globalProperties.binddata = function(t, r, i) {
1095
- if (i)
1096
- this.$refs[i].setValue(t, r);
1097
- else {
1098
- let s;
1099
- for (let n in this.$refs) {
1100
- const a = this.$refs[n];
1101
- if (a && a.$options && a.$options.name === "uniForms") {
1102
- s = a;
1103
- break;
1104
- }
1105
- }
1106
- if (!s)
1107
- return console.error("当前 uni-froms 组件缺少 ref 属性");
1108
- s.setValue(t, r);
1109
- }
1110
- }), this.childrens = [], this.inputChildrens = [], this.setRules(this.rules);
1111
- },
1112
- methods: {
1113
- /**
1114
- * 外部调用方法
1115
- * 设置规则 ,主要用于小程序自定义检验规则
1116
- * @param {Array} rules 规则源数据
1117
- */
1118
- setRules(e) {
1119
- this.formRules = Object.assign({}, this.formRules, e), this.validator = new C(e);
1120
- },
1121
- /**
1122
- * 外部调用方法
1123
- * 设置数据,用于设置表单数据,公开给用户使用 , 不支持在动态表单中使用
1124
- * @param {Object} key
1125
- * @param {Object} value
1126
- */
1127
- setValue(e, t) {
1128
- let r = this.childrens.find((i) => i.name === e);
1129
- return r ? (this.formData[e] = D(e, t, this.formRules[e] && this.formRules[e].rules || []), r.onFieldChange(this.formData[e])) : null;
1130
- },
1131
- /**
1132
- * 外部调用方法
1133
- * 手动提交校验表单
1134
- * 对整个表单进行校验的方法,参数为一个回调函数。
1135
- * @param {Array} keepitem 保留不参与校验的字段
1136
- * @param {type} callback 方法回调
1137
- */
1138
- validate(e, t) {
1139
- return this.checkAll(this.formData, e, t);
1140
- },
1141
- /**
1142
- * 外部调用方法
1143
- * 部分表单校验
1144
- * @param {Array|String} props 需要校验的字段
1145
- * @param {Function} 回调函数
1146
- */
1147
- validateField(e = [], t) {
1148
- e = [].concat(e);
1149
- let r = {};
1150
- return this.childrens.forEach((i) => {
1151
- const s = k(i.name);
1152
- e.indexOf(s) !== -1 && (r = Object.assign({}, r, {
1153
- [s]: this.formData[s]
1154
- }));
1155
- }), this.checkAll(r, [], t);
1156
- },
1157
- /**
1158
- * 外部调用方法
1159
- * 移除表单项的校验结果。传入待移除的表单项的 prop 属性或者 prop 组成的数组,如不传则移除整个表单的校验结果
1160
- * @param {Array|String} props 需要移除校验的字段 ,不填为所有
1161
- */
1162
- clearValidate(e = []) {
1163
- e = [].concat(e), this.childrens.forEach((t) => {
1164
- if (e.length === 0)
1165
- t.errMsg = "";
1166
- else {
1167
- const r = k(t.name);
1168
- e.indexOf(r) !== -1 && (t.errMsg = "");
1169
- }
1170
- });
1171
- },
1172
- /**
1173
- * 外部调用方法 ,即将废弃
1174
- * 手动提交校验表单
1175
- * 对整个表单进行校验的方法,参数为一个回调函数。
1176
- * @param {Array} keepitem 保留不参与校验的字段
1177
- * @param {type} callback 方法回调
1178
- */
1179
- submit(e, t, r) {
1180
- for (let i in this.dataValue)
1181
- this.childrens.find((n) => n.name === i) && this.formData[i] === void 0 && (this.formData[i] = this._getValue(i, this.dataValue[i]));
1182
- return r || console.warn("submit 方法即将废弃,请使用validate方法代替!"), this.checkAll(this.formData, e, t, "submit");
1183
- },
1184
- // 校验所有
1185
- async checkAll(e, t, r, i) {
1186
- if (!this.validator)
1187
- return;
1188
- let s = [];
1189
- for (let c in e) {
1190
- const m = this.childrens.find((o) => k(o.name) === c);
1191
- m && s.push(m);
1192
- }
1193
- !r && typeof t == "function" && (r = t);
1194
- let n;
1195
- !r && typeof r != "function" && Promise && (n = new Promise((c, m) => {
1196
- r = function(o, f) {
1197
- o ? m(o) : c(f);
1198
- };
1199
- }));
1200
- let a = [], l = JSON.parse(JSON.stringify(e));
1201
- for (let c in s) {
1202
- const m = s[c];
1203
- let o = k(m.name);
1204
- const f = await m.onFieldChange(l[o]);
1205
- if (f && (a.push(f), this.errShowType === "toast" || this.errShowType === "modal"))
1206
- break;
1207
- }
1208
- Array.isArray(a) && a.length === 0 && (a = null), Array.isArray(t) && t.forEach((c) => {
1209
- let m = k(c), o = E(c, this.localData);
1210
- o !== void 0 && (l[m] = o);
1211
- }), i === "submit" ? this.$emit("submit", {
1212
- detail: {
1213
- value: l,
1214
- errors: a
1215
- }
1216
- }) : this.$emit("validate", a);
1217
- let u = {};
1218
- return u = he(l, this.name), r && typeof r == "function" && r(a, u), n && r ? n : null;
1219
- },
1220
- /**
1221
- * 返回validate事件
1222
- * @param {Object} result
1223
- */
1224
- validateCheck(e) {
1225
- this.$emit("validate", e);
1226
- },
1227
- _getValue: D,
1228
- _isRequiredField: ye,
1229
- _setDataValue: fe,
1230
- _getDataValue: E,
1231
- _realName: k,
1232
- _isRealName: de,
1233
- _isEqual: be
1234
- }
1235
- }), Se = { class: "uni-forms" };
1236
- function we(e, t, r, i, s, n) {
1237
- return d(), p("view", Se, [
1238
- h("form", null, [
1239
- b(e.$slots, "default")
1240
- ])
1241
- ]);
1242
- }
1243
- const De = /* @__PURE__ */ F(ve, [["render", we]]);
1244
- const $e = M({
1245
- name: "UniFormsItem",
1246
- options: {
1247
- virtualHost: !0
1248
- },
1249
- provide() {
1250
- return {
1251
- uniFormItem: this
1252
- };
1253
- },
1254
- inject: {
1255
- form: {
1256
- from: "uniForm",
1257
- default: null
1258
- }
1259
- },
1260
- props: {
1261
- // 表单校验规则
1262
- rules: {
1263
- type: Array,
1264
- default() {
1265
- return null;
1266
- }
1267
- },
1268
- // 表单域的属性名,在使用校验规则时必填
1269
- name: {
1270
- type: [String, Array],
1271
- default: ""
1272
- },
1273
- required: {
1274
- type: Boolean,
1275
- default: !1
1276
- },
1277
- label: {
1278
- type: String,
1279
- default: ""
1280
- },
1281
- // label的宽度 ,默认 80
1282
- labelWidth: {
1283
- type: [String, Number],
1284
- default: ""
1285
- },
1286
- // label 居中方式,默认 left 取值 left/center/right
1287
- labelAlign: {
1288
- type: String,
1289
- default: ""
1290
- },
1291
- // 强制显示错误信息
1292
- errorMessage: {
1293
- type: [String, Boolean],
1294
- default: ""
1295
- },
1296
- // 1.4.0 弃用,统一使用 form 的校验时机
1297
- // validateTrigger: {
1298
- // type: String,
1299
- // default: ''
1300
- // },
1301
- // 1.4.0 弃用,统一使用 form 的label 位置
1302
- // labelPosition: {
1303
- // type: String,
1304
- // default: ''
1305
- // },
1306
- // 1.4.0 以下属性已经废弃,请使用 #label 插槽代替
1307
- leftIcon: String,
1308
- iconColor: {
1309
- type: String,
1310
- default: "#606266"
1311
- }
1312
- },
1313
- data() {
1314
- return {
1315
- errMsg: "",
1316
- userRules: null,
1317
- localLabelAlign: "left",
1318
- localLabelWidth: "65px",
1319
- localLabelPos: "left",
1320
- border: !1,
1321
- isFirstBorder: !1
1322
- };
1323
- },
1324
- computed: {
1325
- // 处理错误信息
1326
- msg() {
1327
- return this.errorMessage || this.errMsg;
1328
- }
1329
- },
1330
- watch: {
1331
- // 规则发生变化通知子组件更新
1332
- "form.formRules"(e) {
1333
- this.init();
1334
- },
1335
- "form.labelWidth"(e) {
1336
- this.localLabelWidth = this._labelWidthUnit(e);
1337
- },
1338
- "form.labelPosition"(e) {
1339
- this.localLabelPos = this._labelPosition();
1340
- },
1341
- "form.labelAlign"(e) {
1342
- }
1343
- },
1344
- created() {
1345
- this.init(!0), this.name && this.form && (this.$watch("form.formRules", () => {
1346
- this.init();
1347
- }), this.$watch(
1348
- () => this.form._getDataValue(this.name, this.form.localData),
1349
- (e, t) => {
1350
- if (!this.form._isEqual(e, t)) {
1351
- const i = this.itemSetValue(e);
1352
- this.onFieldChange(i, !1);
1353
- }
1354
- },
1355
- {
1356
- immediate: !1
1357
- }
1358
- ));
1359
- },
1360
- // #ifndef VUE3
1361
- destroyed() {
1362
- this.__isUnmounted || this.unInit();
1363
- },
1364
- // #endif
1365
- // #ifdef VUE3
1366
- unmounted() {
1367
- this.__isUnmounted = !0, this.unInit();
1368
- },
1369
- // #endif
1370
- methods: {
1371
- /**
1372
- * 外部调用方法
1373
- * 设置规则 ,主要用于小程序自定义检验规则
1374
- * @param {Array} rules 规则源数据
1375
- */
1376
- setRules(e = null) {
1377
- this.userRules = e, this.init(!1);
1378
- },
1379
- // 兼容老版本表单组件
1380
- setValue() {
1381
- },
1382
- /**
1383
- * 外部调用方法
1384
- * 校验数据
1385
- * @param {any} value 需要校验的数据
1386
- * @param {boolean} 是否立即校验
1387
- * @return {Array|null} 校验内容
1388
- */
1389
- async onFieldChange(e, t = !0) {
1390
- const { formData: r, localData: i, errShowType: s, validateCheck: n, validateTrigger: a, _isRequiredField: l, _realName: u } = this.form, c = u(this.name);
1391
- e || (e = this.form.formData[c]);
1392
- const m = this.itemRules.rules && this.itemRules.rules.length;
1393
- if (!this.validator || !m || m === 0)
1394
- return;
1395
- const o = l(this.itemRules.rules || []);
1396
- let f = null;
1397
- return a === "bind" || t ? (f = await this.validator.validateUpdate(
1398
- {
1399
- [c]: e
1400
- },
1401
- r
1402
- ), !o && (e === void 0 || e === "") && (f = null), f && f.errorMessage ? (s === "undertext" && (this.errMsg = f ? f.errorMessage : ""), s === "toast" && uni.showToast({
1403
- title: f.errorMessage || "校验错误",
1404
- icon: "none"
1405
- }), s === "modal" && uni.showModal({
1406
- title: "提示",
1407
- content: f.errorMessage || "校验错误"
1408
- })) : this.errMsg = "", n(f || null)) : this.errMsg = "", f || null;
1409
- },
1410
- /**
1411
- * 初始组件数据
1412
- */
1413
- init(e = !1) {
1414
- const { validator: t, formRules: r, childrens: i, formData: s, localData: n, _realName: a, labelWidth: l, _getDataValue: u, _setDataValue: c } = this.form || {};
1415
- if (this.localLabelAlign = this._justifyContent(), this.localLabelWidth = this._labelWidthUnit(l), this.localLabelPos = this._labelPosition(), this.form && e && i.push(this), !t || !r)
1416
- return;
1417
- this.form.isFirstBorder || (this.form.isFirstBorder = !0, this.isFirstBorder = !0), this.group && (this.group.isFirstBorder || (this.group.isFirstBorder = !0, this.isFirstBorder = !0)), this.border = this.form.border;
1418
- const m = a(this.name), o = this.userRules || this.rules;
1419
- typeof r == "object" && o && (r[m] = {
1420
- rules: o
1421
- }, t.updateSchema(r));
1422
- const f = r[m] || {};
1423
- this.itemRules = f, this.validator = t, this.itemSetValue(u(this.name, n));
1424
- },
1425
- unInit() {
1426
- if (this.form) {
1427
- const { childrens: e, formData: t, _realName: r } = this.form;
1428
- e.forEach((i, s) => {
1429
- i === this && (this.form.childrens.splice(s, 1), delete t[r(i.name)]);
1430
- });
1431
- }
1432
- },
1433
- // 设置item 的值
1434
- itemSetValue(e) {
1435
- const t = this.form._realName(this.name), r = this.itemRules.rules || [], i = this.form._getValue(t, e, r);
1436
- return this.form._setDataValue(t, this.form.formData, i), i;
1437
- },
1438
- /**
1439
- * 移除该表单项的校验结果
1440
- */
1441
- clearValidate() {
1442
- this.errMsg = "";
1443
- },
1444
- // 是否显示星号
1445
- _isRequired() {
1446
- return this.required;
1447
- },
1448
- // 处理对齐方式
1449
- _justifyContent() {
1450
- if (this.form) {
1451
- const { labelAlign: e } = this.form;
1452
- let t = this.labelAlign ? this.labelAlign : e;
1453
- if (t === "left")
1454
- return "flex-start";
1455
- if (t === "center")
1456
- return "center";
1457
- if (t === "right")
1458
- return "flex-end";
1459
- }
1460
- return "flex-start";
1461
- },
1462
- // 处理 label宽度单位 ,继承父元素的值
1463
- _labelWidthUnit(e) {
1464
- return this.num2px(this.labelWidth ? this.labelWidth : e || (this.label ? 65 : "auto"));
1465
- },
1466
- // 处理 label 位置
1467
- _labelPosition() {
1468
- return this.form && this.form.labelPosition || "left";
1469
- },
1470
- /**
1471
- * 触发时机
1472
- * @param {Object} rule 当前规则内时机
1473
- * @param {Object} itemRlue 当前组件时机
1474
- * @param {Object} parentRule 父组件时机
1475
- */
1476
- isTrigger(e, t, r) {
1477
- return e === "submit" || !e ? e === void 0 ? t !== "bind" ? t ? "submit" : r === "" ? "bind" : "submit" : "bind" : "submit" : "bind";
1478
- },
1479
- num2px(e) {
1480
- return typeof e == "number" ? `${e}px` : e;
1481
- }
1482
- }
1483
- }), ke = {
1484
- key: 0,
1485
- class: "is-required"
1486
- }, Ce = { class: "uni-forms-item__content" }, Fe = { class: "uni-forms-item__nuve-content" }, _e = { class: "uni-forms-item__content" }, Me = { class: "error-text" };
1487
- function Ve(e, t, r, i, s, n) {
1488
- return d(), p("view", {
1489
- class: v(["uni-forms-item", ["is-direction-" + e.localLabelPos, e.border ? "uni-forms-item--border" : "", e.border && e.isFirstBorder ? "is-first-border" : ""]])
1490
- }, [
1491
- b(e.$slots, "label", {}, () => [
1492
- h("view", {
1493
- class: v(["uni-forms-item__label", { "no-label": !e.label && !e.required }]),
1494
- style: w({ width: e.localLabelWidth, justifyContent: e.localLabelAlign })
1495
- }, [
1496
- e.required ? (d(), p("text", ke, "*")) : S("", !0),
1497
- h("text", null, $(e.label), 1)
1498
- ], 6)
1499
- ]),
1500
- h("view", Ce, [
1501
- b(e.$slots, "default"),
1502
- h("view", {
1503
- class: v(["uni-forms-item__error", { "msg--active": e.msg }])
1504
- }, [
1505
- h("text", null, $(e.msg), 1)
1506
- ], 2)
1507
- ]),
1508
- h("view", Fe, [
1509
- h("view", _e, [
1510
- b(e.$slots, "default")
1511
- ]),
1512
- h("view", {
1513
- class: v(["uni-forms-item__error", { "msg--active": e.msg }])
1514
- }, [
1515
- h("text", Me, $(e.msg), 1)
1516
- ], 2)
1517
- ])
1518
- ], 2);
1519
- }
1520
- const Ee = /* @__PURE__ */ F($e, [["render", Ve]]);
1521
- class Te {
1
+ class t {
1522
2
  }
1523
3
  export {
1524
- Te as KgUtil,
1525
- Ie as UniBadge,
1526
- Re as UniCard,
1527
- Ae as UniEasyinput,
1528
- De as UniForms,
1529
- Ee as UniFormsItem
4
+ t as KgUtil
1530
5
  };