uview-plus 3.8.55 → 3.8.106

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 (229) hide show
  1. package/changelog.md +2147 -1828
  2. package/components/u-action-sheet/props.js +3 -1
  3. package/components/u-action-sheet/u-action-sheet.vue +22 -2
  4. package/components/u-album/props.js +3 -1
  5. package/components/u-alert/props.js +4 -2
  6. package/components/u-avatar/props.js +4 -1
  7. package/components/u-avatar-group/props.js +4 -1
  8. package/components/u-back-top/props.js +4 -1
  9. package/components/u-badge/props.js +4 -1
  10. package/components/u-barcode/u-barcode.vue +44 -15
  11. package/components/u-box/props.js +5 -2
  12. package/components/u-button/props.js +4 -1
  13. package/components/u-button/u-button.vue +2 -5
  14. package/components/u-button/vue.scss +3 -3
  15. package/components/u-calendar/calendar.js +8 -0
  16. package/components/u-calendar/props.js +43 -1
  17. package/components/u-calendar/u-calendar.vue +16 -0
  18. package/components/u-calendar-strip/props.js +3 -1
  19. package/components/u-canvas/u-canvas.vue +1028 -423
  20. package/components/u-car-keyboard/props.js +3 -1
  21. package/components/u-card/props.js +3 -1
  22. package/components/u-cell/props.js +4 -1
  23. package/components/u-cell/u-cell.vue +9 -1
  24. package/components/u-cell-group/props.js +4 -1
  25. package/components/u-checkbox/props.js +4 -1
  26. package/components/u-checkbox/u-checkbox.vue +7 -3
  27. package/components/u-checkbox-group/props.js +3 -1
  28. package/components/u-circle-progress/props.js +4 -1
  29. package/components/u-code/props.js +4 -1
  30. package/components/u-code-input/props.js +4 -1
  31. package/components/u-col/props.js +4 -1
  32. package/components/u-collapse/props.js +4 -1
  33. package/components/u-collapse-item/props.js +4 -1
  34. package/components/u-color-picker/u-color-picker.vue +1 -0
  35. package/components/u-column-notice/props.js +4 -1
  36. package/components/u-count-down/props.js +4 -1
  37. package/components/u-count-to/props.js +4 -1
  38. package/components/u-cropper/u-cropper.vue +95 -51
  39. package/components/u-datetime-picker/props.js +4 -1
  40. package/components/u-datetime-picker/u-datetime-picker.vue +53 -4
  41. package/components/u-divider/props.js +4 -1
  42. package/components/u-dragsort/u-dragsort.vue +57 -32
  43. package/components/u-dropdown/props.js +3 -1
  44. package/components/u-dropdown-item/props.js +3 -1
  45. package/components/u-empty/props.js +4 -1
  46. package/components/u-form/props.js +4 -1
  47. package/components/u-form-item/props.js +4 -1
  48. package/components/u-gap/props.js +4 -1
  49. package/components/u-grid/props.js +4 -1
  50. package/components/u-grid-item/props.js +4 -1
  51. package/components/u-guide/props.js +3 -1
  52. package/components/u-icon/props.js +4 -1
  53. package/components/u-icon/u-icon.vue +11 -2
  54. package/components/u-icon/upicon.ttf +0 -0
  55. package/components/u-icon/util.js +103 -10
  56. package/components/u-image/props.js +4 -1
  57. package/components/u-image/u-image.vue +280 -267
  58. package/components/u-index-anchor/props.js +4 -1
  59. package/components/u-index-item/props.js +2 -1
  60. package/components/u-index-item/u-index-item.vue +1 -1
  61. package/components/u-index-list/props.js +4 -1
  62. package/components/u-index-list/u-index-list.vue +1 -1
  63. package/components/u-input/props.js +3 -1
  64. package/components/u-keyboard/props.js +4 -1
  65. package/components/u-line/props.js +4 -1
  66. package/components/u-line-progress/props.js +6 -3
  67. package/components/u-link/props.js +4 -1
  68. package/components/u-list/props.js +4 -1
  69. package/components/u-list-item/props.js +4 -1
  70. package/components/u-loading-icon/props.js +4 -1
  71. package/components/u-loading-page/props.js +3 -1
  72. package/components/u-loadmore/props.js +4 -1
  73. package/components/u-markdown/u-markdown.vue +45 -3
  74. package/components/u-modal/props.js +4 -1
  75. package/components/u-navbar/props.js +4 -2
  76. package/components/u-navbar/u-navbar.vue +15 -9
  77. package/components/u-no-network/props.js +4 -1
  78. package/components/u-notice-bar/props.js +4 -1
  79. package/components/u-notify/props.js +4 -1
  80. package/components/u-novel-reader/content-normalizer.js +80 -0
  81. package/components/u-novel-reader/layout-engine.js +225 -0
  82. package/components/u-novel-reader/measure-adapter.js +69 -0
  83. package/components/u-novel-reader/novelReader.js +35 -0
  84. package/components/u-novel-reader/persistence.js +144 -0
  85. package/components/u-novel-reader/props.js +100 -0
  86. package/components/u-novel-reader/reader-catalog.vue +234 -0
  87. package/components/u-novel-reader/reader-content.vue +226 -0
  88. package/components/u-novel-reader/reader-core.js +151 -0
  89. package/components/u-novel-reader/reader-settings.vue +325 -0
  90. package/components/u-novel-reader/reader-toolbar.vue +313 -0
  91. package/components/u-novel-reader/theme-vars.scss +49 -0
  92. package/components/u-novel-reader/u-novel-reader.vue +836 -0
  93. package/components/u-number-box/props.js +4 -1
  94. package/components/u-number-box/u-number-box.vue +2 -2
  95. package/components/u-number-keyboard/props.js +4 -1
  96. package/components/u-overlay/props.js +4 -1
  97. package/components/u-pagination/u-pagination.vue +60 -39
  98. package/components/u-parse/props.js +4 -1
  99. package/components/u-picker/props.js +4 -1
  100. package/components/u-picker-column/props.js +3 -1
  101. package/components/u-popover/props.js +2 -1
  102. package/components/u-popup/props.js +4 -1
  103. package/components/u-poster/u-poster.vue +246 -214
  104. package/components/u-qrcode/qrcode.js +105 -97
  105. package/components/u-qrcode/u-qrcode.vue +242 -289
  106. package/components/u-radio/props.js +4 -1
  107. package/components/u-radio/u-radio.vue +7 -3
  108. package/components/u-radio-group/props.js +4 -1
  109. package/components/u-rate/props.js +4 -1
  110. package/components/u-read-more/props.js +4 -1
  111. package/components/u-row/props.js +4 -1
  112. package/components/u-row-notice/props.js +4 -1
  113. package/components/u-safe-bottom/props.js +2 -1
  114. package/components/u-scroll-list/props.js +4 -1
  115. package/components/u-scroll-list/scrollWxs.wxs +1 -1
  116. package/components/u-search/props.js +3 -1
  117. package/components/u-skeleton/props.js +4 -1
  118. package/components/u-slider/props.js +3 -1
  119. package/components/u-slider/u-slider.vue +71 -29
  120. package/components/u-status-bar/props.js +4 -1
  121. package/components/u-steps/props.js +4 -1
  122. package/components/u-steps-item/props.js +4 -1
  123. package/components/u-sticky/props.js +4 -1
  124. package/components/u-sticky/u-sticky.vue +11 -0
  125. package/components/u-subsection/props.js +3 -1
  126. package/components/u-swipe-action/props.js +4 -1
  127. package/components/u-swipe-action-item/index.wxs +43 -25
  128. package/components/u-swipe-action-item/nvue.js +9 -0
  129. package/components/u-swipe-action-item/other.js +32 -21
  130. package/components/u-swipe-action-item/props.js +9 -1
  131. package/components/u-swipe-action-item/swipeActionItem.js +1 -0
  132. package/components/u-swipe-action-item/u-swipe-action-item.vue +42 -4
  133. package/components/u-swiper/props.js +9 -1
  134. package/components/u-swiper/swiper.js +1 -0
  135. package/components/u-swiper/u-swiper.vue +2 -0
  136. package/components/u-swiper-indicator/props.js +4 -1
  137. package/components/u-switch/props.js +4 -1
  138. package/components/u-switch/u-switch.vue +1 -1
  139. package/components/u-tabbar/props.js +3 -1
  140. package/components/u-tabbar/u-tabbar.vue +2 -1
  141. package/components/u-tabbar-item/props.js +4 -1
  142. package/components/u-tabbar-item/u-tabbar-item.vue +64 -21
  143. package/components/u-table/props.js +3 -1
  144. package/components/u-table2/tableRow.vue +155 -69
  145. package/components/u-table2/u-table2.vue +327 -137
  146. package/components/u-tabs/props.js +4 -1
  147. package/components/u-tabs/u-tabs.vue +11 -8
  148. package/components/u-tabs-item/props.js +3 -1
  149. package/components/u-tabs-pro/u-tabs-pro.vue +212 -0
  150. package/components/u-tag/props.js +4 -1
  151. package/components/u-td/props.js +3 -1
  152. package/components/u-text/props.js +4 -1
  153. package/components/u-text/text.js +1 -1
  154. package/components/u-text/u-text.vue +18 -6
  155. package/components/u-textarea/props.js +3 -1
  156. package/components/u-textarea/u-textarea.vue +16 -5
  157. package/components/u-th/props.js +3 -1
  158. package/components/u-toolbar/props.js +4 -1
  159. package/components/u-tooltip/props.js +10 -2
  160. package/components/u-tooltip/tooltip.js +2 -1
  161. package/components/u-tooltip/u-tooltip.vue +31 -3
  162. package/components/u-tr/props.js +3 -1
  163. package/components/u-transition/nvue-ani-map.js +75 -68
  164. package/components/u-transition/props.js +4 -1
  165. package/components/u-transition/transitionMixin.js +164 -163
  166. package/components/u-upload/props.js +4 -1
  167. package/components/u-upload/u-upload.vue +48 -41
  168. package/components/u-waterfall/u-waterfall.vue +162 -110
  169. package/index.js +65 -8
  170. package/libs/config/config.js +1 -1
  171. package/libs/config/props.js +180 -204
  172. package/libs/css/components.scss +3 -0
  173. package/libs/function/index.js +66 -0
  174. package/libs/function/uni-api-shims.js +29 -0
  175. package/libs/i18n/index.js +71 -36
  176. package/libs/i18n/locale-packs.js +11 -0
  177. package/libs/i18n/locales/all.js +23 -0
  178. package/libs/i18n/locales/{de.json → de.js} +1 -1
  179. package/libs/i18n/locales/{en.json → en.js} +2 -2
  180. package/libs/i18n/locales/{es.json → es.js} +1 -1
  181. package/libs/i18n/locales/{fr.json → fr.js} +2 -2
  182. package/libs/i18n/locales/{ja.json → ja.js} +1 -1
  183. package/libs/i18n/locales/{ko.json → ko.js} +1 -1
  184. package/libs/i18n/locales/{ru.json → ru.js} +1 -1
  185. package/libs/i18n/locales/{th.json → th.js} +1 -1
  186. package/libs/i18n/locales/{zh-Hans.json → zh-Hans.js} +1 -1
  187. package/libs/i18n/locales/{zh-Hant.json → zh-Hant.js} +1 -1
  188. package/libs/mixin/mixin.js +18 -54
  189. package/libs/root/index.js +78 -5
  190. package/libs/root/page.js +7 -7
  191. package/libs/root/root.js +73 -3
  192. package/libs/util/app-nvue-webview-canvas.js +486 -0
  193. package/libs/util/gcanvas/bridge/bridge-weex.js +10 -7
  194. package/libs/util/gcanvas/context-2d/FillStyleLinearGradient.js +0 -0
  195. package/libs/util/gcanvas/context-2d/FillStylePattern.js +0 -0
  196. package/libs/util/gcanvas/context-2d/FillStyleRadialGradient.js +0 -0
  197. package/libs/util/gcanvas/context-2d/RenderingContext.js +0 -0
  198. package/libs/util/gcanvas/context-webgl/ActiveInfo.js +0 -0
  199. package/libs/util/gcanvas/context-webgl/Buffer.js +0 -0
  200. package/libs/util/gcanvas/context-webgl/Framebuffer.js +0 -0
  201. package/libs/util/gcanvas/context-webgl/GLenum.js +0 -0
  202. package/libs/util/gcanvas/context-webgl/GLmethod.js +0 -0
  203. package/libs/util/gcanvas/context-webgl/GLtype.js +0 -0
  204. package/libs/util/gcanvas/context-webgl/Program.js +0 -0
  205. package/libs/util/gcanvas/context-webgl/Renderbuffer.js +0 -0
  206. package/libs/util/gcanvas/context-webgl/RenderingContext.js +0 -0
  207. package/libs/util/gcanvas/context-webgl/Shader.js +0 -0
  208. package/libs/util/gcanvas/context-webgl/ShaderPrecisionFormat.js +0 -0
  209. package/libs/util/gcanvas/context-webgl/Texture.js +0 -0
  210. package/libs/util/gcanvas/context-webgl/UniformLocation.js +0 -0
  211. package/libs/util/gcanvas/context-webgl/classUtils.js +0 -0
  212. package/libs/util/gcanvas/env/canvas.js +0 -0
  213. package/libs/util/gcanvas/env/image.js +0 -0
  214. package/libs/util/gcanvas/env/tool.js +0 -0
  215. package/libs/util/gcanvas/index.js +3 -3
  216. package/package.json +4 -5
  217. package/tsconfig.json +18 -0
  218. package/types/comps/calendar.d.ts +38 -0
  219. package/types/comps/checkbox.d.ts +12 -0
  220. package/types/comps/lineProgress.d.ts +5 -0
  221. package/types/comps/navbar.d.ts +3 -3
  222. package/types/comps/swipeActionItem.d.ts +13 -0
  223. package/types/comps/swiper.d.ts +5 -0
  224. package/types/comps/tabs.d.ts +2 -1
  225. package/types/comps/text.d.ts +1 -1
  226. package/types/comps/tooltip.d.ts +36 -1
  227. package/types/func.d.ts +23 -0
  228. package/types/index.d.ts +1 -0
  229. /package/components/u-markdown/{marked.esm.js → marked.esm.mjs} +0 -0
@@ -1,220 +1,196 @@
1
1
  /**
2
- * 此文件的作用为统一配置所有组件的props参数
3
- * 借此用户可以全局覆盖组件的props默认值
4
- * 无需在每个引入组件的页面中都配置一次
2
+ * Shared props configuration store.
3
+ *
4
+ * Component defaults are registered lazily by each component props.js file so
5
+ * importing one component no longer pulls defaults for every component.
5
6
  */
6
7
  import config from './config'
7
- // 各个需要fixed的地方的z-index配置文件
8
8
  import zIndex from './zIndex.js'
9
- // 关于颜色的配置,特殊场景使用
10
9
  import color from './color.js'
11
- // http
12
10
  import http from '../function/http.js'
13
11
  import { shallowMerge } from '../function/index.js'
14
- // 组件props
15
- import ActionSheet from '../../components/u-action-sheet/actionSheet'
16
- import Album from '../../components/u-album/album'
17
- import Alert from '../../components/u-alert/alert'
18
- import Avatar from '../../components/u-avatar/avatar'
19
- import AvatarGroup from '../../components/u-avatar-group/avatarGroup'
20
- import Backtop from '../../components/u-back-top/backtop'
21
- import Badge from '../../components/u-badge/badge'
22
- import Button from '../../components/u-button/button'
23
- import Calendar from '../../components/u-calendar/calendar'
24
- import CalendarStrip from '../../components/u-calendar-strip/calendarStrip'
25
- import CarKeyboard from '../../components/u-car-keyboard/carKeyboard'
26
- import Card from '../../components/u-card/card'
27
- import Cell from '../../components/u-cell/cell'
28
- import CellGroup from '../../components/u-cell-group/cellGroup'
29
- import Checkbox from '../../components/u-checkbox/checkbox'
30
- import CheckboxGroup from '../../components/u-checkbox-group/checkboxGroup'
31
- import CircleProgress from '../../components/u-circle-progress/circleProgress'
32
- import Code from '../../components/u-code/code'
33
- import CodeInput from '../../components/u-code-input/codeInput'
34
- import Col from '../../components/u-col/col'
35
- import Collapse from '../../components/u-collapse/collapse'
36
- import CollapseItem from '../../components/u-collapse-item/collapseItem'
37
- import ColumnNotice from '../../components/u-column-notice/columnNotice'
38
- import CountDown from '../../components/u-count-down/countDown'
39
- import CountTo from '../../components/u-count-to/countTo'
40
- import DatetimePicker from '../../components/u-datetime-picker/datetimePicker'
41
- import Divider from '../../components/u-divider/divider'
42
- import Empty from '../../components/u-empty/empty'
43
- import Form from '../../components/u-form/form'
44
- import FormItem from '../../components/u-form-item/formItem'
45
- import Gap from '../../components/u-gap/gap'
46
- import Guide from '../../components/u-guide/guide'
47
- import Grid from '../../components/u-grid/grid'
48
- import GridItem from '../../components/u-grid-item/gridItem'
49
- import Icon from '../../components/u-icon/icon'
50
- import Image from '../../components/u-image/image'
51
- import IndexAnchor from '../../components/u-index-anchor/indexAnchor'
52
- import IndexList from '../../components/u-index-list/indexList'
53
- import Input from '../../components/u-input/input'
54
- import Keyboard from '../../components/u-keyboard/keyboard'
55
- import Line from '../../components/u-line/line'
56
- import LineProgress from '../../components/u-line-progress/lineProgress'
57
- import Link from '../../components/u-link/link'
58
- import List from '../../components/u-list/list'
59
- import ListItem from '../../components/u-list-item/listItem'
60
- import LoadingIcon from '../../components/u-loading-icon/loadingIcon'
61
- import LoadingPage from '../../components/u-loading-page/loadingPage'
62
- import Loadmore from '../../components/u-loadmore/loadmore'
63
- import Modal from '../../components/u-modal/modal'
64
- import Navbar from '../../components/u-navbar/navbar'
65
- import NoNetwork from '../../components/u-no-network/noNetwork'
66
- import NoticeBar from '../../components/u-notice-bar/noticeBar'
67
- import Notify from '../../components/u-notify/notify'
68
- import NumberBox from '../../components/u-number-box/numberBox'
69
- import NumberKeyboard from '../../components/u-number-keyboard/numberKeyboard'
70
- import Overlay from '../../components/u-overlay/overlay'
71
- import Parse from '../../components/u-parse/parse'
72
- import Picker from '../../components/u-picker/picker'
73
- import Popup from '../../components/u-popup/popup'
74
- import Radio from '../../components/u-radio/radio'
75
- import RadioGroup from '../../components/u-radio-group/radioGroup'
76
- import Rate from '../../components/u-rate/rate'
77
- import ReadMore from '../../components/u-read-more/readMore'
78
- import Row from '../../components/u-row/row'
79
- import RowNotice from '../../components/u-row-notice/rowNotice'
80
- import ScrollList from '../../components/u-scroll-list/scrollList'
81
- import Search from '../../components/u-search/search'
82
- import Section from '../../components/u-section/section'
83
- import Skeleton from '../../components/u-skeleton/skeleton'
84
- import Slider from '../../components/u-slider/slider'
85
- import StatusBar from '../../components/u-status-bar/statusBar'
86
- import Steps from '../../components/u-steps/steps'
87
- import StepsItem from '../../components/u-steps-item/stepsItem'
88
- import Sticky from '../../components/u-sticky/sticky'
89
- import Subsection from '../../components/u-subsection/subsection'
90
- import SwipeAction from '../../components/u-swipe-action/swipeAction'
91
- import SwipeActionItem from '../../components/u-swipe-action-item/swipeActionItem'
92
- import Swiper from '../../components/u-swiper/swiper'
93
- import SwipterIndicator from '../../components/u-swiper-indicator/swipterIndicator'
94
- import Switch from '../../components/u-switch/switch'
95
- import Tabbar from '../../components/u-tabbar/tabbar'
96
- import TabbarItem from '../../components/u-tabbar-item/tabbarItem'
97
- import Tabs from '../../components/u-tabs/tabs'
98
- import Tag from '../../components/u-tag/tag'
99
- import Text from '../../components/u-text/text'
100
- import Textarea from '../../components/u-textarea/textarea'
101
- import Toast from '../../components/u-toast/toast'
102
- import Toolbar from '../../components/u-toolbar/toolbar'
103
- import Tooltip from '../../components/u-tooltip/tooltip'
104
- import Transition from '../../components/u-transition/transition'
105
- import Upload from '../../components/u-upload/upload'
106
12
 
107
- const props = {
108
- ...ActionSheet,
109
- ...Album,
110
- ...Alert,
111
- ...Avatar,
112
- ...AvatarGroup,
113
- ...Backtop,
114
- ...Badge,
115
- ...Button,
116
- ...Calendar,
117
- ...CalendarStrip,
118
- ...CarKeyboard,
119
- ...Card,
120
- ...Cell,
121
- ...CellGroup,
122
- ...Checkbox,
123
- ...CheckboxGroup,
124
- ...CircleProgress,
125
- ...Code,
126
- ...CodeInput,
127
- ...Col,
128
- ...Collapse,
129
- ...CollapseItem,
130
- ...ColumnNotice,
131
- ...CountDown,
132
- ...CountTo,
133
- ...DatetimePicker,
134
- ...Divider,
135
- ...Empty,
136
- ...Form,
137
- ...FormItem,
138
- ...Gap,
139
- ...Guide,
140
- ...Grid,
141
- ...GridItem,
142
- ...Icon,
143
- ...Image,
144
- ...IndexAnchor,
145
- ...IndexList,
146
- ...Input,
147
- ...Keyboard,
148
- ...Line,
149
- ...LineProgress,
150
- ...Link,
151
- ...List,
152
- ...ListItem,
153
- ...LoadingIcon,
154
- ...LoadingPage,
155
- ...Loadmore,
156
- ...Modal,
157
- ...Navbar,
158
- ...NoNetwork,
159
- ...NoticeBar,
160
- ...Notify,
161
- ...NumberBox,
162
- ...NumberKeyboard,
163
- ...Overlay,
164
- ...Parse,
165
- ...Picker,
166
- ...Popup,
167
- ...Radio,
168
- ...RadioGroup,
169
- ...Rate,
170
- ...ReadMore,
171
- ...Row,
172
- ...RowNotice,
173
- ...ScrollList,
174
- ...Search,
175
- ...Section,
176
- ...Skeleton,
177
- ...Slider,
178
- ...StatusBar,
179
- ...Steps,
180
- ...StepsItem,
181
- ...Sticky,
182
- ...Subsection,
183
- ...SwipeAction,
184
- ...SwipeActionItem,
185
- ...Swiper,
186
- ...SwipterIndicator,
187
- ...Switch,
188
- ...Tabbar,
189
- ...TabbarItem,
190
- ...Tabs,
191
- ...Tag,
192
- ...Text,
193
- ...Textarea,
194
- ...Toast,
195
- ...Toolbar,
196
- ...Tooltip,
197
- ...Transition,
198
- ...Upload
13
+ const componentKeys = [
14
+ 'actionSheet',
15
+ 'album',
16
+ 'alert',
17
+ 'avatar',
18
+ 'avatarGroup',
19
+ 'backtop',
20
+ 'badge',
21
+ 'box',
22
+ 'button',
23
+ 'calendar',
24
+ 'calendarStrip',
25
+ 'carKeyboard',
26
+ 'card',
27
+ 'cell',
28
+ 'cellGroup',
29
+ 'checkbox',
30
+ 'checkboxGroup',
31
+ 'circleProgress',
32
+ 'code',
33
+ 'codeInput',
34
+ 'col',
35
+ 'collapse',
36
+ 'collapseItem',
37
+ 'columnNotice',
38
+ 'countDown',
39
+ 'countTo',
40
+ 'datetimePicker',
41
+ 'divider',
42
+ 'dropdown',
43
+ 'dropdownItem',
44
+ 'empty',
45
+ 'form',
46
+ 'formItem',
47
+ 'gap',
48
+ 'grid',
49
+ 'gridItem',
50
+ 'guide',
51
+ 'icon',
52
+ 'image',
53
+ 'indexAnchor',
54
+ 'indexItem',
55
+ 'indexList',
56
+ 'input',
57
+ 'keyboard',
58
+ 'line',
59
+ 'lineProgress',
60
+ 'link',
61
+ 'list',
62
+ 'listItem',
63
+ 'loadingIcon',
64
+ 'loadingPage',
65
+ 'loadmore',
66
+ 'modal',
67
+ 'navbar',
68
+ 'navbarMini',
69
+ 'noNetwork',
70
+ 'noticeBar',
71
+ 'notify',
72
+ 'novelReader',
73
+ 'numberBox',
74
+ 'numberKeyboard',
75
+ 'overlay',
76
+ 'parse',
77
+ 'pdfReader',
78
+ 'picker',
79
+ 'pickerColumn',
80
+ 'popover',
81
+ 'popup',
82
+ 'radio',
83
+ 'radioGroup',
84
+ 'rate',
85
+ 'readMore',
86
+ 'row',
87
+ 'rowNotice',
88
+ 'safeBottom',
89
+ 'scrollList',
90
+ 'search',
91
+ 'section',
92
+ 'skeleton',
93
+ 'slider',
94
+ 'statusBar',
95
+ 'steps',
96
+ 'stepsItem',
97
+ 'sticky',
98
+ 'subsection',
99
+ 'swipeAction',
100
+ 'swipeActionItem',
101
+ 'swiper',
102
+ 'swiperIndicator',
103
+ 'switch',
104
+ 'tabbar',
105
+ 'tabbarItem',
106
+ 'table',
107
+ 'tabs',
108
+ 'tabsItem',
109
+ 'tag',
110
+ 'td',
111
+ 'text',
112
+ 'textarea',
113
+ 'th',
114
+ 'toast',
115
+ 'toolbar',
116
+ 'tooltip',
117
+ 'tr',
118
+ 'transition',
119
+ 'upload'
120
+ ]
121
+
122
+ const props = {}
123
+
124
+ function ensureComponentProps(key) {
125
+ if (!props[key] || typeof props[key] !== 'object') {
126
+ props[key] = {}
127
+ }
128
+ return props[key]
129
+ }
130
+
131
+ function isPlainObject(value) {
132
+ return Object.prototype.toString.call(value) === '[object Object]'
133
+ }
134
+
135
+ function cloneDefaultValue(value) {
136
+ if (Array.isArray(value)) {
137
+ return value.slice()
138
+ }
139
+ if (isPlainObject(value)) {
140
+ return mergeDefaults({}, value)
141
+ }
142
+ return value
143
+ }
144
+
145
+ function mergeDefaults(target, defaults = {}) {
146
+ if (!target || typeof target !== 'object' || !defaults || typeof defaults !== 'object') {
147
+ return target
148
+ }
149
+ Object.keys(defaults).forEach((key) => {
150
+ const defaultValue = defaults[key]
151
+ const targetValue = target[key]
152
+ if (targetValue === undefined) {
153
+ target[key] = cloneDefaultValue(defaultValue)
154
+ } else if (isPlainObject(targetValue) && isPlainObject(defaultValue)) {
155
+ mergeDefaults(targetValue, defaultValue)
156
+ }
157
+ })
158
+ return target
159
+ }
160
+
161
+ componentKeys.forEach(ensureComponentProps)
162
+
163
+ export function registerComponentProps(defaultProps = {}) {
164
+ Object.keys(defaultProps || {}).forEach((key) => {
165
+ const componentProps = ensureComponentProps(key)
166
+ mergeDefaults(componentProps, defaultProps[key])
167
+ })
168
+ return props
169
+ }
170
+
171
+ export function setPropsConfig(configProps = {}) {
172
+ Object.keys(configProps || {}).forEach((key) => {
173
+ shallowMerge(ensureComponentProps(key), configProps[key])
174
+ })
175
+ return props
199
176
  }
200
177
 
201
- function setConfig(configs) {
202
- shallowMerge(config, configs.config || {})
203
- shallowMerge(props, configs.props || {})
204
- shallowMerge(color, configs.color || {})
205
- shallowMerge(zIndex, configs.zIndex || {})
178
+ function setConfig(configs = {}) {
179
+ shallowMerge(config, configs.config || {})
180
+ setPropsConfig(configs.props || {})
181
+ shallowMerge(color, configs.color || {})
182
+ shallowMerge(zIndex, configs.zIndex || {})
206
183
  }
207
184
 
208
- // 初始化自定义配置
209
185
  if (typeof uni !== 'undefined' && uni && uni.upuiParams) {
210
- console.log('setting uview-plus')
211
- let temp = uni.upuiParams()
212
- if (temp.httpIns) {
213
- temp.httpIns(http)
214
- }
215
- if (temp.options) {
216
- setConfig(temp.options)
217
- }
186
+ console.log('setting uview-plus')
187
+ let temp = uni.upuiParams()
188
+ if (temp.httpIns) {
189
+ temp.httpIns(http)
190
+ }
191
+ if (temp.options) {
192
+ setConfig(temp.options)
193
+ }
218
194
  }
219
195
 
220
196
  export default props
@@ -33,4 +33,7 @@
33
33
  align-items: stretch;
34
34
  align-content: flex-start;
35
35
  }
36
+ .w-full {
37
+ box-sizing: border-box;
38
+ }
36
39
  /* #endif */
@@ -5,6 +5,71 @@ import {
5
5
  } from './test.js'
6
6
  import { round } from './digit.js'
7
7
  import config from '../config/config.js'
8
+
9
+ function emptyNodeInfo() {
10
+ return {
11
+ width: 0,
12
+ height: 0,
13
+ left: 0,
14
+ right: 0,
15
+ top: 0,
16
+ bottom: 0
17
+ }
18
+ }
19
+
20
+ // #ifdef APP-NVUE
21
+ const dom = (typeof uni !== 'undefined' && uni && typeof uni.requireNativePlugin === 'function')
22
+ ? uni.requireNativePlugin('dom')
23
+ : null
24
+
25
+ function getNvueRect(ref) {
26
+ return new Promise((resolve) => {
27
+ if (!dom || !ref) {
28
+ resolve(emptyNodeInfo())
29
+ return
30
+ }
31
+ dom.getComponentRect(ref, (res) => {
32
+ resolve(res && res.size ? res.size : emptyNodeInfo())
33
+ })
34
+ })
35
+ }
36
+ // #endif
37
+
38
+ // 查询节点信息
39
+ export function upGetRect(selector, all = false, comp = null) {
40
+ return new Promise((resolve) => {
41
+ // #ifndef APP-NVUE
42
+ const query = uni.createSelectorQuery()
43
+ const scopedQuery = comp ? query.in(comp) : query
44
+ scopedQuery[all ? 'selectAll' : 'select'](selector)
45
+ .boundingClientRect((rect) => {
46
+ if (all) {
47
+ resolve(Array.isArray(rect) ? rect : [])
48
+ return
49
+ }
50
+ resolve(rect || emptyNodeInfo())
51
+ })
52
+ .exec()
53
+ // #endif
54
+
55
+ // #ifdef APP-NVUE
56
+ sleep(30).then(async () => {
57
+ const refs = comp?.$refs || comp?.proxy?.$refs || comp?.refs || {}
58
+ const selectorRef = refs[selector.substring(1)]
59
+ if (all) {
60
+ const selectorRefs = Array.isArray(selectorRef)
61
+ ? selectorRef
62
+ : selectorRef ? [selectorRef] : []
63
+ resolve(await Promise.all(selectorRefs.map(ref => getNvueRect(ref))))
64
+ return
65
+ }
66
+ const ref = Array.isArray(selectorRef) ? selectorRef[0] : selectorRef
67
+ resolve(await getNvueRect(ref))
68
+ })
69
+ // #endif
70
+ })
71
+ }
72
+
8
73
  /**
9
74
  * @description 如果value小于min,取min;如果value大于max,取max
10
75
  * @param {number} min
@@ -841,6 +906,7 @@ function hslToHex(h, s, l) {
841
906
  }
842
907
 
843
908
  export default {
909
+ upGetRect,
844
910
  range,
845
911
  getPx,
846
912
  sleep,
@@ -0,0 +1,29 @@
1
+ /**
2
+ * uni API shims
3
+ *
4
+ * 部分小程序平台(如支付宝)不支持某些 uni API,直接调用会抛出 TypeError。
5
+ * 本模块在库初始化时检测缺失的 API 并自动补齐空实现,防止运行时报错。
6
+ *
7
+ * 扩展方式:在 needShims 数组中追加 { name, fallback } 即可。
8
+ */
9
+
10
+ const needShims = [
11
+ {
12
+ name: 'onWindowResize',
13
+ fallback: function (_callback) { /* no-op */ }
14
+ },
15
+ {
16
+ name: 'offWindowResize',
17
+ fallback: function (_callback) { /* no-op */ }
18
+ }
19
+ ]
20
+
21
+ export function applyUniApiShims() {
22
+ if (typeof uni === 'undefined') return
23
+
24
+ for (const { name, fallback } of needShims) {
25
+ if (typeof uni[name] !== 'function') {
26
+ uni[name] = fallback
27
+ }
28
+ }
29
+ }
@@ -1,54 +1,89 @@
1
- import zhHans from './locales/zh-Hans.json'
2
- import zhHant from './locales/zh-Hant.json'
3
- import en from './locales/en.json'
4
- import es from './locales/es.json'
5
- import fr from './locales/fr.json'
6
- import de from './locales/de.json'
7
- import ko from './locales/ko.json'
8
- import ja from './locales/ja.json'
9
- import ru from './locales/ru.json'
10
-
11
- let settings = {
12
- lang: uni.getLocale(),
1
+ import zhHans from './locales/zh-Hans.js'
2
+
3
+ const settings = {
4
+ lang: typeof uni !== 'undefined' && typeof uni.getLocale === 'function'
5
+ ? uni.getLocale()
6
+ : 'zh-Hans',
13
7
  locales: {
14
- en,
15
- es,
16
- fr,
17
- de,
18
- ko,
19
- ja,
20
- ru,
21
- 'zh-Hant': zhHant,
22
8
  'zh-Hans': zhHans
23
9
  }
24
- };
10
+ }
11
+
12
+ if (typeof uni !== 'undefined' && typeof uni.onLocaleChange === 'function') {
13
+ uni.onLocaleChange((locale) => {
14
+ // uni-app 部分平台回调可能是字符串,也可能是 { locale }
15
+ settings.lang = typeof locale === 'string'
16
+ ? locale
17
+ : (locale && locale.locale) || settings.lang
18
+ })
19
+ }
25
20
 
26
- uni.onLocaleChange((locale) => {
27
- settings.lang = locale;
28
- })
21
+ function isPlainObject(value) {
22
+ return Object.prototype.toString.call(value) === '[object Object]'
23
+ }
24
+
25
+ export function hasLocale(locale) {
26
+ return !!(locale && settings.locales[locale])
27
+ }
28
+
29
+ export function getLocale() {
30
+ return settings.lang
31
+ }
32
+
33
+ export function setLocale(locale) {
34
+ if (!locale || typeof locale !== 'string') return settings.lang
35
+ settings.lang = locale
36
+ if (typeof uni !== 'undefined' && typeof uni.setLocale === 'function') {
37
+ try {
38
+ uni.setLocale(locale)
39
+ } catch (e) {
40
+ // 部分平台 setLocale 可能受限,忽略以保持 set 内部状态成功
41
+ }
42
+ }
43
+ return settings.lang
44
+ }
45
+
46
+ /**
47
+ * 注册语言包
48
+ * registerLocale('en', messages)
49
+ * registerLocale({ en: messages, ja: messages2 })
50
+ */
51
+ export function registerLocale(localeOrMap, messages) {
52
+ if (typeof localeOrMap === 'string') {
53
+ if (!localeOrMap || !isPlainObject(messages)) return
54
+ settings.locales[localeOrMap] = messages
55
+ return
56
+ }
57
+ if (!isPlainObject(localeOrMap)) return
58
+ Object.keys(localeOrMap).forEach((key) => {
59
+ const value = localeOrMap[key]
60
+ if (isPlainObject(value)) {
61
+ settings.locales[key] = value
62
+ }
63
+ })
64
+ }
29
65
 
30
66
  /**
31
67
  * 多语言方法
32
68
  */
33
69
  export function t(value, params = {}) {
34
- // console.log(settings.locales[settings.lang])
35
70
  if (value) {
36
71
  let lang = settings.lang
37
72
  if (!settings.locales[settings.lang]) {
38
73
  lang = 'zh-Hans'
39
74
  }
40
- let result = settings.locales[lang][value] || value;
41
- // 替换{xxx}格式的变量
42
- Object.keys(params).forEach(key => {
43
- const reg = new RegExp(`{${key}}`, 'g');
44
- result = result.replace(reg, params[key]);
45
- });
46
- return result;
47
- } else {
48
- return value;
75
+ let result = settings.locales[lang][value] || value
76
+ if (params && typeof params === 'object') {
77
+ Object.keys(params).forEach((key) => {
78
+ const reg = new RegExp(`{${key}}`, 'g')
79
+ result = String(result).replace(reg, params[key])
80
+ })
81
+ }
82
+ return result
49
83
  }
84
+ return value
50
85
  }
51
86
 
52
87
  export default {
53
- settings: settings
54
- }
88
+ settings
89
+ }
@@ -0,0 +1,11 @@
1
+ export { default as zhHans } from './locales/zh-Hans.js'
2
+ export { default as zhHant } from './locales/zh-Hant.js'
3
+ export { default as en } from './locales/en.js'
4
+ export { default as es } from './locales/es.js'
5
+ export { default as fr } from './locales/fr.js'
6
+ export { default as de } from './locales/de.js'
7
+ export { default as ko } from './locales/ko.js'
8
+ export { default as ja } from './locales/ja.js'
9
+ export { default as ru } from './locales/ru.js'
10
+ export { default as th } from './locales/th.js'
11
+ export { default as all } from './locales/all.js'
@@ -0,0 +1,23 @@
1
+ import zhHans from './zh-Hans.js'
2
+ import zhHant from './zh-Hant.js'
3
+ import en from './en.js'
4
+ import es from './es.js'
5
+ import fr from './fr.js'
6
+ import de from './de.js'
7
+ import ko from './ko.js'
8
+ import ja from './ja.js'
9
+ import ru from './ru.js'
10
+ import th from './th.js'
11
+
12
+ export default {
13
+ 'zh-Hans': zhHans,
14
+ 'zh-Hant': zhHant,
15
+ en,
16
+ es,
17
+ fr,
18
+ de,
19
+ ko,
20
+ ja,
21
+ ru,
22
+ th
23
+ }