uview-plus 3.8.49 → 3.8.86
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.
- package/changelog.md +2043 -1827
- package/components/u-action-sheet/props.js +3 -1
- package/components/u-action-sheet/u-action-sheet.vue +1 -0
- package/components/u-album/props.js +3 -1
- package/components/u-alert/props.js +4 -2
- package/components/u-avatar/props.js +4 -1
- package/components/u-avatar-group/props.js +4 -1
- package/components/u-back-top/props.js +4 -1
- package/components/u-badge/props.js +4 -1
- package/components/u-barcode/u-barcode.vue +46 -15
- package/components/u-box/props.js +5 -2
- package/components/u-button/props.js +4 -1
- package/components/u-button/vue.scss +3 -3
- package/components/u-calendar/calendar.js +14 -2
- package/components/u-calendar/month.vue +41 -6
- package/components/u-calendar/props.js +63 -1
- package/components/u-calendar/u-calendar.vue +311 -2
- package/components/u-calendar-strip/props.js +3 -1
- package/components/u-canvas/u-canvas.vue +734 -423
- package/components/u-car-keyboard/props.js +3 -1
- package/components/u-card/props.js +3 -1
- package/components/u-cell/props.js +4 -1
- package/components/u-cell/u-cell.vue +1 -1
- package/components/u-cell-group/props.js +4 -1
- package/components/u-checkbox/props.js +4 -1
- package/components/u-checkbox/u-checkbox.vue +7 -3
- package/components/u-checkbox-group/props.js +3 -1
- package/components/u-circle-progress/props.js +4 -1
- package/components/u-code/props.js +4 -1
- package/components/u-code-input/props.js +4 -1
- package/components/u-col/props.js +4 -1
- package/components/u-collapse/props.js +4 -1
- package/components/u-collapse-item/props.js +4 -1
- package/components/u-color-picker/u-color-picker.vue +1 -0
- package/components/u-column-notice/props.js +4 -1
- package/components/u-count-down/props.js +4 -1
- package/components/u-count-to/props.js +4 -1
- package/components/u-cropper/u-cropper.vue +95 -51
- package/components/u-datetime-picker/props.js +4 -1
- package/components/u-divider/props.js +4 -1
- package/components/u-dragsort/u-dragsort.vue +2 -1
- package/components/u-dropdown/props.js +3 -1
- package/components/u-dropdown-item/props.js +3 -1
- package/components/u-empty/props.js +4 -1
- package/components/u-form/props.js +4 -1
- package/components/u-form-item/props.js +4 -1
- package/components/u-gap/props.js +4 -1
- package/components/u-grid/props.js +4 -1
- package/components/u-grid-item/props.js +4 -1
- package/components/u-guide/props.js +3 -1
- package/components/u-icon/props.js +4 -1
- package/components/u-icon/u-icon.vue +2 -2
- package/components/u-icon/upicon.ttf +0 -0
- package/components/u-icon/util.js +29 -7
- package/components/u-image/props.js +4 -1
- package/components/u-image/u-image.vue +280 -267
- package/components/u-index-anchor/props.js +4 -1
- package/components/u-index-item/props.js +2 -1
- package/components/u-index-list/props.js +4 -1
- package/components/u-input/props.js +3 -1
- package/components/u-input/u-input.vue +10 -1
- package/components/u-keyboard/props.js +4 -1
- package/components/u-line/props.js +4 -1
- package/components/u-line-progress/props.js +6 -3
- package/components/u-link/props.js +4 -1
- package/components/u-list/props.js +4 -1
- package/components/u-list-item/props.js +4 -1
- package/components/u-loading-icon/props.js +4 -1
- package/components/u-loading-page/props.js +3 -1
- package/components/u-loadmore/props.js +4 -1
- package/components/u-markdown/u-markdown.vue +45 -3
- package/components/u-modal/props.js +4 -1
- package/components/u-navbar/props.js +4 -2
- package/components/u-navbar/u-navbar.vue +15 -9
- package/components/u-no-network/props.js +4 -1
- package/components/u-notice-bar/props.js +4 -1
- package/components/u-notify/props.js +4 -1
- package/components/u-number-box/props.js +4 -1
- package/components/u-number-box/u-number-box.vue +2 -2
- package/components/u-number-keyboard/props.js +4 -1
- package/components/u-overlay/props.js +4 -1
- package/components/u-pagination/u-pagination.vue +60 -39
- package/components/u-parse/props.js +4 -1
- package/components/u-picker/props.js +4 -1
- package/components/u-picker/u-picker.vue +15 -0
- package/components/u-picker-column/props.js +3 -1
- package/components/u-popover/props.js +2 -1
- package/components/u-popup/props.js +4 -1
- package/components/u-poster/u-poster.vue +29 -14
- package/components/u-qrcode/qrcode.js +88 -87
- package/components/u-qrcode/u-qrcode.vue +138 -256
- package/components/u-radio/props.js +4 -1
- package/components/u-radio/u-radio.vue +7 -3
- package/components/u-radio-group/props.js +4 -1
- package/components/u-rate/props.js +4 -1
- package/components/u-read-more/props.js +4 -1
- package/components/u-row/props.js +4 -1
- package/components/u-row-notice/props.js +4 -1
- package/components/u-safe-bottom/props.js +2 -1
- package/components/u-scroll-list/props.js +4 -1
- package/components/u-search/props.js +3 -1
- package/components/u-skeleton/props.js +4 -1
- package/components/u-slider/props.js +3 -1
- package/components/u-slider/u-slider.vue +70 -28
- package/components/u-status-bar/props.js +4 -1
- package/components/u-steps/props.js +4 -1
- package/components/u-steps-item/props.js +4 -1
- package/components/u-sticky/props.js +4 -1
- package/components/u-sticky/u-sticky.vue +11 -0
- package/components/u-subsection/props.js +3 -1
- package/components/u-swipe-action/props.js +4 -1
- package/components/u-swipe-action-item/props.js +4 -1
- package/components/u-swipe-action-item/u-swipe-action-item.vue +14 -0
- package/components/u-swiper/props.js +9 -1
- package/components/u-swiper/swiper.js +1 -0
- package/components/u-swiper/u-swiper.vue +2 -0
- package/components/u-swiper-indicator/props.js +4 -1
- package/components/u-switch/props.js +4 -1
- package/components/u-tabbar/props.js +3 -1
- package/components/u-tabbar-item/props.js +4 -1
- package/components/u-table/props.js +3 -1
- package/components/u-table2/tableRow.vue +155 -69
- package/components/u-table2/u-table2.vue +328 -140
- package/components/u-tabs/props.js +4 -1
- package/components/u-tabs-item/props.js +3 -1
- package/components/u-tag/props.js +4 -1
- package/components/u-td/props.js +3 -1
- package/components/u-text/props.js +4 -1
- package/components/u-textarea/props.js +3 -1
- package/components/u-textarea/u-textarea.vue +16 -5
- package/components/u-th/props.js +3 -1
- package/components/u-toolbar/props.js +4 -1
- package/components/u-tooltip/props.js +10 -2
- package/components/u-tooltip/tooltip.js +2 -1
- package/components/u-tooltip/u-tooltip.vue +31 -3
- package/components/u-tr/props.js +3 -1
- package/components/u-transition/nvue-ani-map.js +75 -68
- package/components/u-transition/props.js +4 -1
- package/components/u-transition/transitionMixin.js +164 -163
- package/components/u-upload/props.js +4 -1
- package/components/u-upload/u-upload.vue +47 -40
- package/components/u-waterfall/u-waterfall.vue +50 -51
- package/index.js +65 -8
- package/libs/config/props.js +179 -204
- package/libs/css/components.scss +3 -0
- package/libs/function/uni-api-shims.js +29 -0
- package/libs/i18n/index.js +71 -36
- package/libs/i18n/locale-packs.js +11 -0
- package/libs/i18n/locales/all.js +23 -0
- package/libs/i18n/locales/{de.json → de.js} +1 -1
- package/libs/i18n/locales/{en.json → en.js} +2 -2
- package/libs/i18n/locales/{es.json → es.js} +1 -1
- package/libs/i18n/locales/{fr.json → fr.js} +2 -2
- package/libs/i18n/locales/{ja.json → ja.js} +1 -1
- package/libs/i18n/locales/{ko.json → ko.js} +1 -1
- package/libs/i18n/locales/{ru.json → ru.js} +1 -1
- package/libs/i18n/locales/{th.json → th.js} +1 -1
- package/libs/i18n/locales/{zh-Hans.json → zh-Hans.js} +1 -1
- package/libs/i18n/locales/{zh-Hant.json → zh-Hant.js} +1 -1
- package/libs/mixin/mixin.js +14 -4
- package/libs/util/gcanvas/bridge/bridge-weex.js +10 -5
- package/package.json +4 -5
- package/tsconfig.json +18 -0
- package/types/comps/calendar.d.ts +57 -0
- package/types/comps/checkbox.d.ts +12 -0
- package/types/comps/lineProgress.d.ts +5 -0
- package/types/comps/navbar.d.ts +3 -3
- package/types/comps/swiper.d.ts +5 -0
- package/types/comps/tooltip.d.ts +36 -1
- /package/components/u-markdown/{marked.esm.js → marked.esm.mjs} +0 -0
package/index.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
// 补齐部分平台缺失的 uni API(如支付宝小程序的 onWindowResize)
|
|
2
|
+
import { applyUniApiShims } from './libs/function/uni-api-shims.js'
|
|
3
|
+
applyUniApiShims()
|
|
4
|
+
|
|
1
5
|
// 看到此报错,是因为没有配置vite.config.js的【transpileDependencies】
|
|
2
6
|
// const pleaseSetTranspileDependencies = {}, babelTest = pleaseSetTranspileDependencies?.test
|
|
3
7
|
|
|
@@ -27,7 +31,7 @@ import index, { rpx2px } from './libs/function/index.js'
|
|
|
27
31
|
// 配置信息
|
|
28
32
|
import config from './libs/config/config.js'
|
|
29
33
|
// props配置信息
|
|
30
|
-
import props from './libs/config/props.js'
|
|
34
|
+
import props, { setPropsConfig } from './libs/config/props.js'
|
|
31
35
|
// 各个需要fixed的地方的z-index配置文件
|
|
32
36
|
import zIndex from './libs/config/zIndex.js'
|
|
33
37
|
// 关于颜色的配置,特殊场景使用
|
|
@@ -42,7 +46,26 @@ import http from './libs/function/http.js'
|
|
|
42
46
|
import fontUtil from './components/u-icon/util.js';
|
|
43
47
|
|
|
44
48
|
// i18n
|
|
45
|
-
import i18n, {
|
|
49
|
+
import i18n, {
|
|
50
|
+
t,
|
|
51
|
+
registerLocale,
|
|
52
|
+
hasLocale,
|
|
53
|
+
getLocale,
|
|
54
|
+
setLocale
|
|
55
|
+
} from './libs/i18n/index.js'
|
|
56
|
+
import {
|
|
57
|
+
en,
|
|
58
|
+
es,
|
|
59
|
+
fr,
|
|
60
|
+
de,
|
|
61
|
+
ko,
|
|
62
|
+
ja,
|
|
63
|
+
ru,
|
|
64
|
+
th,
|
|
65
|
+
zhHans,
|
|
66
|
+
zhHant,
|
|
67
|
+
all as allLocales
|
|
68
|
+
} from './libs/i18n/locale-packs.js'
|
|
46
69
|
import {
|
|
47
70
|
themeState,
|
|
48
71
|
setTheme,
|
|
@@ -135,7 +158,41 @@ function rootNotify(options = {}) {
|
|
|
135
158
|
|
|
136
159
|
// 导出
|
|
137
160
|
let themeType = ['primary', 'success', 'error', 'warning', 'info'];
|
|
138
|
-
export {
|
|
161
|
+
export {
|
|
162
|
+
route,
|
|
163
|
+
http,
|
|
164
|
+
debounce,
|
|
165
|
+
throttle,
|
|
166
|
+
calc,
|
|
167
|
+
digit,
|
|
168
|
+
platform,
|
|
169
|
+
themeType,
|
|
170
|
+
mixin,
|
|
171
|
+
mpMixin,
|
|
172
|
+
props,
|
|
173
|
+
color,
|
|
174
|
+
test,
|
|
175
|
+
zIndex,
|
|
176
|
+
fontUtil,
|
|
177
|
+
i18n,
|
|
178
|
+
rpx2px,
|
|
179
|
+
t,
|
|
180
|
+
registerLocale,
|
|
181
|
+
hasLocale,
|
|
182
|
+
getLocale,
|
|
183
|
+
setLocale,
|
|
184
|
+
en,
|
|
185
|
+
es,
|
|
186
|
+
fr,
|
|
187
|
+
de,
|
|
188
|
+
ko,
|
|
189
|
+
ja,
|
|
190
|
+
ru,
|
|
191
|
+
th,
|
|
192
|
+
zhHans,
|
|
193
|
+
zhHant,
|
|
194
|
+
allLocales
|
|
195
|
+
}
|
|
139
196
|
export * from './libs/function/index.js'
|
|
140
197
|
export * from './libs/function/colorGradient.js'
|
|
141
198
|
|
|
@@ -149,7 +206,7 @@ export * from './libs/function/colorGradient.js'
|
|
|
149
206
|
export function setConfig(configs) {
|
|
150
207
|
const settings = configs || {}
|
|
151
208
|
index.shallowMerge(config, settings.config || {})
|
|
152
|
-
|
|
209
|
+
setPropsConfig(settings.props || {})
|
|
153
210
|
index.shallowMerge(color, settings.color || {})
|
|
154
211
|
index.shallowMerge(zIndex, settings.zIndex || {})
|
|
155
212
|
syncThemeColorOverrideState({
|
|
@@ -182,7 +239,7 @@ const $u = {
|
|
|
182
239
|
calc,
|
|
183
240
|
mixin,
|
|
184
241
|
mpMixin,
|
|
185
|
-
|
|
242
|
+
props,
|
|
186
243
|
...index,
|
|
187
244
|
color,
|
|
188
245
|
platform,
|
|
@@ -253,8 +310,8 @@ let components = []
|
|
|
253
310
|
function resolveComponents() {
|
|
254
311
|
if (components.length) return components
|
|
255
312
|
// #ifdef H5
|
|
256
|
-
|
|
257
|
-
|
|
313
|
+
// import.meta.glob is a Vite compile-time macro; the runtime guard would
|
|
314
|
+
// always fail in the browser and block component registration.
|
|
258
315
|
const importFn = import.meta.glob('./components/u-*/u-*.vue', { eager: true })
|
|
259
316
|
for (const key in importFn) {
|
|
260
317
|
const component = importFn[key]?.default
|
|
@@ -305,4 +362,4 @@ const install = (Vue, upuiParams = '') => {
|
|
|
305
362
|
|
|
306
363
|
export default {
|
|
307
364
|
install
|
|
308
|
-
}
|
|
365
|
+
}
|
package/libs/config/props.js
CHANGED
|
@@ -1,220 +1,195 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
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
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
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
|
+
'numberBox',
|
|
73
|
+
'numberKeyboard',
|
|
74
|
+
'overlay',
|
|
75
|
+
'parse',
|
|
76
|
+
'pdfReader',
|
|
77
|
+
'picker',
|
|
78
|
+
'pickerColumn',
|
|
79
|
+
'popover',
|
|
80
|
+
'popup',
|
|
81
|
+
'radio',
|
|
82
|
+
'radioGroup',
|
|
83
|
+
'rate',
|
|
84
|
+
'readMore',
|
|
85
|
+
'row',
|
|
86
|
+
'rowNotice',
|
|
87
|
+
'safeBottom',
|
|
88
|
+
'scrollList',
|
|
89
|
+
'search',
|
|
90
|
+
'section',
|
|
91
|
+
'skeleton',
|
|
92
|
+
'slider',
|
|
93
|
+
'statusBar',
|
|
94
|
+
'steps',
|
|
95
|
+
'stepsItem',
|
|
96
|
+
'sticky',
|
|
97
|
+
'subsection',
|
|
98
|
+
'swipeAction',
|
|
99
|
+
'swipeActionItem',
|
|
100
|
+
'swiper',
|
|
101
|
+
'swiperIndicator',
|
|
102
|
+
'switch',
|
|
103
|
+
'tabbar',
|
|
104
|
+
'tabbarItem',
|
|
105
|
+
'table',
|
|
106
|
+
'tabs',
|
|
107
|
+
'tabsItem',
|
|
108
|
+
'tag',
|
|
109
|
+
'td',
|
|
110
|
+
'text',
|
|
111
|
+
'textarea',
|
|
112
|
+
'th',
|
|
113
|
+
'toast',
|
|
114
|
+
'toolbar',
|
|
115
|
+
'tooltip',
|
|
116
|
+
'tr',
|
|
117
|
+
'transition',
|
|
118
|
+
'upload'
|
|
119
|
+
]
|
|
120
|
+
|
|
121
|
+
const props = {}
|
|
122
|
+
|
|
123
|
+
function ensureComponentProps(key) {
|
|
124
|
+
if (!props[key] || typeof props[key] !== 'object') {
|
|
125
|
+
props[key] = {}
|
|
126
|
+
}
|
|
127
|
+
return props[key]
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function isPlainObject(value) {
|
|
131
|
+
return Object.prototype.toString.call(value) === '[object Object]'
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function cloneDefaultValue(value) {
|
|
135
|
+
if (Array.isArray(value)) {
|
|
136
|
+
return value.slice()
|
|
137
|
+
}
|
|
138
|
+
if (isPlainObject(value)) {
|
|
139
|
+
return mergeDefaults({}, value)
|
|
140
|
+
}
|
|
141
|
+
return value
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function mergeDefaults(target, defaults = {}) {
|
|
145
|
+
if (!target || typeof target !== 'object' || !defaults || typeof defaults !== 'object') {
|
|
146
|
+
return target
|
|
147
|
+
}
|
|
148
|
+
Object.keys(defaults).forEach((key) => {
|
|
149
|
+
const defaultValue = defaults[key]
|
|
150
|
+
const targetValue = target[key]
|
|
151
|
+
if (targetValue === undefined) {
|
|
152
|
+
target[key] = cloneDefaultValue(defaultValue)
|
|
153
|
+
} else if (isPlainObject(targetValue) && isPlainObject(defaultValue)) {
|
|
154
|
+
mergeDefaults(targetValue, defaultValue)
|
|
155
|
+
}
|
|
156
|
+
})
|
|
157
|
+
return target
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
componentKeys.forEach(ensureComponentProps)
|
|
161
|
+
|
|
162
|
+
export function registerComponentProps(defaultProps = {}) {
|
|
163
|
+
Object.keys(defaultProps || {}).forEach((key) => {
|
|
164
|
+
const componentProps = ensureComponentProps(key)
|
|
165
|
+
mergeDefaults(componentProps, defaultProps[key])
|
|
166
|
+
})
|
|
167
|
+
return props
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export function setPropsConfig(configProps = {}) {
|
|
171
|
+
Object.keys(configProps || {}).forEach((key) => {
|
|
172
|
+
shallowMerge(ensureComponentProps(key), configProps[key])
|
|
173
|
+
})
|
|
174
|
+
return props
|
|
199
175
|
}
|
|
200
176
|
|
|
201
|
-
function setConfig(configs) {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
177
|
+
function setConfig(configs = {}) {
|
|
178
|
+
shallowMerge(config, configs.config || {})
|
|
179
|
+
setPropsConfig(configs.props || {})
|
|
180
|
+
shallowMerge(color, configs.color || {})
|
|
181
|
+
shallowMerge(zIndex, configs.zIndex || {})
|
|
206
182
|
}
|
|
207
183
|
|
|
208
|
-
// 初始化自定义配置
|
|
209
184
|
if (typeof uni !== 'undefined' && uni && uni.upuiParams) {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
185
|
+
console.log('setting uview-plus')
|
|
186
|
+
let temp = uni.upuiParams()
|
|
187
|
+
if (temp.httpIns) {
|
|
188
|
+
temp.httpIns(http)
|
|
189
|
+
}
|
|
190
|
+
if (temp.options) {
|
|
191
|
+
setConfig(temp.options)
|
|
192
|
+
}
|
|
218
193
|
}
|
|
219
194
|
|
|
220
195
|
export default props
|
package/libs/css/components.scss
CHANGED
|
@@ -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
|
+
}
|
package/libs/i18n/index.js
CHANGED
|
@@ -1,54 +1,89 @@
|
|
|
1
|
-
import zhHans from './locales/zh-Hans.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
|
|
27
|
-
|
|
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
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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
|
|
54
|
-
}
|
|
88
|
+
settings
|
|
89
|
+
}
|