uview-ultra 4.5.48 → 4.5.71

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 (40) hide show
  1. package/changelog.md +1650 -1435
  2. package/components/up-button/up-button.uvue +9 -8
  3. package/components/up-button/up-button.vue +4 -4
  4. package/components/up-cell/props.js +6 -0
  5. package/components/up-cell/up-cell.uvue +21 -8
  6. package/components/up-cell/up-cell.vue +9 -2
  7. package/components/up-cell-group/up-cell-group.uvue +7 -0
  8. package/components/up-checkbox/up-checkbox.uvue +4 -3
  9. package/components/up-empty/up-empty.uvue +4 -0
  10. package/components/up-empty/up-empty.vue +3 -0
  11. package/components/up-goods-sku/up-goods-sku.uvue +32 -3
  12. package/components/up-goods-sku/up-goods-sku.vue +19 -3
  13. package/components/up-icon/icons.uts +1 -1
  14. package/components/up-navbar/navbar.uts +2 -0
  15. package/components/up-navbar/up-navbar.uvue +199 -28
  16. package/components/up-navbar/up-navbar.vue +14 -1
  17. package/components/up-popup/props.js +10 -0
  18. package/components/up-popup/up-popup.uvue +89 -1
  19. package/components/up-popup/up-popup.vue +69 -1
  20. package/components/up-radio/up-radio.uvue +6 -4
  21. package/components/up-radio-group/radioGroup.js +1 -1
  22. package/components/up-radio-group/radioGroup.uts +1 -1
  23. package/components/up-root/props.js +28 -0
  24. package/components/up-root/props.uts +28 -0
  25. package/components/up-root/root.js +14 -0
  26. package/components/up-root/root.uts +14 -0
  27. package/components/up-root/up-root.uvue +57 -0
  28. package/components/up-root/up-root.vue +35 -0
  29. package/components/up-root-toast-host/up-root-toast-host.uvue +27 -0
  30. package/components/up-switch/switch.uts +2 -1
  31. package/components/up-tag/up-tag.uvue +1 -1
  32. package/components/up-tag/up-tag.vue +1 -1
  33. package/components/up-transition/up-transition.uvue +10 -0
  34. package/components/up-transition/up-transition.vue +7 -0
  35. package/components/up-transition/vue.ani-style.scss +39 -10
  36. package/index.uts +47 -0
  37. package/libs/root/rootState.uts +74 -0
  38. package/libs/theme/theme.js +12 -2
  39. package/libs/theme/theme.uts +578 -0
  40. package/package.json +1 -1
@@ -72,6 +72,7 @@ import { computed } from 'vue'
72
72
  import { addStyle, addUnit, getPx, bem } from '../../libs/function/index'
73
73
  import { throttle } from '../../libs/function/throttle'
74
74
  import config from '../../libs/config/config'
75
+ import { upThemeVar } from '../../libs/theme/theme.uts'
75
76
  const props = defineProps({
76
77
  // 自定义样式
77
78
  customStyle: {
@@ -255,7 +256,7 @@ const loadingColor = computed(() => {
255
256
  // 如果有设置color值,则用color值,否则使用type主题颜色
256
257
  return props.color != ''
257
258
  ? props.color
258
- : config.getString(`color.up-${props.type}`) as string;
259
+ : upThemeVar(`--up-${props.type}`, config.getString(`color.up-${props.type}`) as string);
259
260
  }
260
261
  if (props.type == "info") {
261
262
  return "#c9c9c9";
@@ -270,7 +271,7 @@ const textColor = computed((): string => {
270
271
  if (props.color != '') return props.color
271
272
  if (props.type == 'info') return '#000000'
272
273
  if (props.type == 'warning') return config.getString('color.up-error') ?? '#fa3534'
273
- const color = config.getString(`color.up-${props.type}`) ?? ''
274
+ const color = upThemeVar(`--up-${props.type}`, config.getString(`color.up-${props.type}`) ?? '')
274
275
  return color == '' ? '#ffffff' : color
275
276
  })
276
277
 
@@ -402,10 +403,10 @@ $up-button-circle-border-top-right-radius: 100px !default;
402
403
  $up-button-circle-border-top-left-radius: 100px !default;
403
404
  $up-button-circle-border-bottom-left-radius: 100px !default;
404
405
  $up-button-circle-border-bottom-right-radius: 100px !default;
405
- $up-button-square-border-top-right-radius: 3px !default;
406
- $up-button-square-border-top-left-radius: 3px !default;
407
- $up-button-square-border-bottom-left-radius: 3px !default;
408
- $up-button-square-border-bottom-right-radius: 3px !default;
406
+ $up-button-square-border-top-right-radius: 10px !default;
407
+ $up-button-square-border-top-left-radius: 10px !default;
408
+ $up-button-square-border-bottom-left-radius: 10px !default;
409
+ $up-button-square-border-bottom-right-radius: 10px !default;
409
410
  $up-button-icon-min-width: 4px !default;
410
411
  $up-button-plain-background-color: transparent !default;
411
412
  $up-button-hairline-border-width: 0.5px !default;
@@ -500,8 +501,8 @@ $up-button-plain-up-button-warning-color:$up-error !default;;
500
501
  /* #ifndef APP */
501
502
  color: $up-button-primary-color;
502
503
  /* #endif */
503
- background-color: $up-button-primary-background-color !important;
504
- border-color: $up-button-primary-border-color !important;
504
+ background-color: var(--up-primary, $up-button-primary-background-color) !important;
505
+ border-color: var(--up-primary, $up-button-primary-border-color) !important;
505
506
  border-width: $up-button-primary-border-width !important;
506
507
  border-style: $up-button-primary-border-style !important;
507
508
  }
@@ -315,10 +315,10 @@ $up-button-circle-border-top-right-radius: 100px !default;
315
315
  $up-button-circle-border-top-left-radius: 100px !default;
316
316
  $up-button-circle-border-bottom-left-radius: 100px !default;
317
317
  $up-button-circle-border-bottom-right-radius: 100px !default;
318
- $up-button-square-border-top-right-radius: 3px !default;
319
- $up-button-square-border-top-left-radius: 3px !default;
320
- $up-button-square-border-bottom-left-radius: 3px !default;
321
- $up-button-square-border-bottom-right-radius: 3px !default;
318
+ $up-button-square-border-top-right-radius: 10px !default;
319
+ $up-button-square-border-top-left-radius: 10px !default;
320
+ $up-button-square-border-bottom-left-radius: 10px !default;
321
+ $up-button-square-border-bottom-right-radius: 10px !default;
322
322
  $up-button-icon-min-width: 1em !default;
323
323
  $up-button-plain-background-color: transparent !default;
324
324
  $up-button-hairline-border-width: 0.5px !default;
@@ -33,6 +33,12 @@ export const propsCell = defineMixin({
33
33
  type: Boolean,
34
34
  default: () => defProps.cell.border
35
35
  },
36
+ // 分隔线左侧偏移(px 或带单位字符串)。iOS 标准是线条不顶到图标,
37
+ // 而是从图标右侧的内容起始处开始;传 0 或不传保持通栏。
38
+ borderInsetLeft: {
39
+ type: [String, Number],
40
+ default: 0
41
+ },
36
42
  // 内容是否垂直居中(主要是针对右侧的value部分)
37
43
  center: {
38
44
  type: Boolean,
@@ -51,14 +51,21 @@
51
51
  </slot>
52
52
  </view>
53
53
  </view>
54
- <up-line v-if="border"></up-line>
54
+ <!--
55
+ iOS 标准分隔线:默认通栏;borderInsetLeft 传值后线条从该偏移处开始,
56
+ 对齐「图标右侧内容」的起始位置(= 左 padding + 图标宽 + 图标右距)。
57
+ -->
58
+ <view v-if="border" class="up-cell__line-wrap"
59
+ :style="{ paddingLeft: addUnit(borderInsetLeft) }">
60
+ <up-line></up-line>
61
+ </view>
55
62
  </view>
56
63
  </template>
57
64
 
58
65
  <script setup lang="ts">
59
66
  import { computed } from 'vue'
60
67
  import defProps from './cell'
61
- import { addStyle } from '../../libs/function/index'
68
+ import { addStyle, addUnit } from '../../libs/function/index'
62
69
  import { empty as _testEmpty } from '../../libs/function/test'
63
70
  // props
64
71
  const props = defineProps({
@@ -139,6 +146,12 @@
139
146
  type: Boolean,
140
147
  default: defProps.getBoolean('cell.border')
141
148
  },
149
+ // 分隔线左侧偏移(px 或带单位字符串)。iOS 标准是线条不顶到图标,
150
+ // 而是从图标右侧的内容起始处开始;传 0 或不传保持通栏。
151
+ borderInsetLeft: {
152
+ type: [String, Number],
153
+ default: 0
154
+ },
142
155
  disabled: {
143
156
  type: Boolean,
144
157
  default: defProps.getBoolean('cell.disabled')
@@ -200,15 +213,15 @@
200
213
  <style lang="scss" scoped>
201
214
  @import "../../libs/css/components.scss";
202
215
 
203
- $up-cell-padding: 10px 15px !important;
216
+ $up-cell-padding: 14px !important;
204
217
  $up-cell-font-size: 15px !important;
205
218
  $up-cell-line-height: 24px !important;
206
219
  $up-cell-color: $up-main-color !important;
207
220
  $up-cell-icon-size: 16px !important;
208
221
  $up-cell-title-font-size: 15px !important;
209
222
  $up-cell-title-line-height: 22px !important;
210
- $up-cell-title-color: $up-main-color !important;
211
- $up-cell-required-font-size: 14px !important;
223
+ $up-cell-title-color: $up-main-color !important;
224
+ $up-cell-required-font-size: 14px !important;
212
225
  $up-cell-required-color: #f56c6c !important;
213
226
  $up-cell-label-font-size: 12px !important;
214
227
  $up-cell-label-color: $up-tips-color !important;
@@ -217,12 +230,12 @@
217
230
  $up-cell-value-color: $up-content-color !important;
218
231
  $up-cell-clickable-color: $up-bg-color !important;
219
232
  $up-cell-disabled-color: #c8c9cc !important;
220
- $up-cell-padding-top-large: 13px !important;
221
- $up-cell-padding-bottom-large: 13px !important;
233
+ $up-cell-padding-top-large: 16px !important;
234
+ $up-cell-padding-bottom-large: 16px !important;
222
235
  $up-cell-value-font-size-large: 15px !important;
223
236
  $up-cell-label-font-size-large: 14px !important;
224
237
  $up-cell-title-font-size-large: 16px !important;
225
- $up-cell-left-icon-wrap-margin-right: 4px !important;
238
+ $up-cell-left-icon-wrap-margin-right: 10px !important;
226
239
  $up-cell-right-icon-wrap-margin-left: 4px !important;
227
240
  $up-cell-title-flex:1 !important;
228
241
  $up-cell-label-margin-top:5px !important;
@@ -44,7 +44,14 @@
44
44
  </slot>
45
45
  </view>
46
46
  </view>
47
- <up-line v-if="border"></up-line>
47
+ <!--
48
+ iOS 标准分隔线:默认通栏;borderInsetLeft 传值后线条从该偏移处开始,
49
+ 对齐「图标右侧内容」的起始位置(= 左 padding + 图标宽 + 图标右距)。
50
+ -->
51
+ <view v-if="border" class="up-cell__line-wrap"
52
+ :style="{ paddingLeft: addUnit(borderInsetLeft) }">
53
+ <up-line></up-line>
54
+ </view>
48
55
  </view>
49
56
  </template>
50
57
 
@@ -52,7 +59,7 @@
52
59
  import { computed, inject } from 'vue'
53
60
  import { propsCell } from './props.js'
54
61
  import { commonProps, useUltraUI } from '../../libs/composable/useUltraUI.js'
55
- import { addStyle } from '../../libs/function/index.js'
62
+ import { addStyle, addUnit } from '../../libs/function/index.js'
56
63
  import test from '../../libs/function/test.js'
57
64
  /**
58
65
  * cell 单元格
@@ -51,7 +51,14 @@
51
51
  $up-cell-group-title-line-height: 16px !default;
52
52
  $up-cell-group-title-color: $up-main-color !default;
53
53
 
54
+ /*
55
+ * 默认 iOS grouped-inset 卡片形制:大圆角 + 裁剪。
56
+ * 分隔线/子 cell 的直角背景被裁进圆角里;不需要圆角的场合用 customStyle
57
+ * 传 borderRadius: 0 覆盖(内联样式优先级高于此处类规则)。
58
+ */
54
59
  .up-cell-group {
60
+ border-radius: 12px;
61
+ overflow: hidden;
55
62
 
56
63
  &__title {
57
64
  padding: $up-cell-group-title-padding;
@@ -38,6 +38,7 @@
38
38
  import { array as testArray } from '../../libs/function/test'
39
39
  import { addStyle, addUnit, deepMerge, formValidate, error } from '../../libs/function/index'
40
40
  import defProps from './checkbox.uts'
41
+ import { upThemeVar } from '../../libs/theme/theme.uts'
41
42
  import { useUltraUI } from '../../libs/composable/useUltraUI'
42
43
  const { parent, parentData, getParentData } = useUltraUI()
43
44
  const instance = getCurrentInstance()!.proxy!
@@ -193,7 +194,7 @@
193
194
  ? props.activeColor
194
195
  : (parentData.value['activeColor'] != null
195
196
  ? parentData.value['activeColor'].toString()
196
- : '#2979ff');
197
+ : upThemeVar('--up-primary', '#2979ff'));
197
198
  })
198
199
 
199
200
  // 组件选未中激活时的颜色
@@ -503,8 +504,8 @@
503
504
 
504
505
  &--checked {
505
506
  color: $up-checkbox-icon-wrap-checked-color;
506
- background-color: $up-checkbox-icon-wrap-checked-background-color;
507
- border-color: $up-checkbox-icon-wrap-checked-border-color;
507
+ background-color: var(--up-primary, $up-checkbox-icon-wrap-checked-background-color);
508
+ border-color: var(--up-primary, $up-checkbox-icon-wrap-checked-border-color);
508
509
  }
509
510
 
510
511
  &--disabled {
@@ -27,6 +27,10 @@
27
27
  <view class="up-empty__wrap" v-if="$slots['default'] != null || $slots['$default'] != null">
28
28
  <slot />
29
29
  </view>
30
+ <!-- 兼容 uview-plus 3.x 的 bottom 具名插槽(按钮等操作区) -->
31
+ <view class="up-empty__wrap" v-if="$slots['bottom'] != null || $slots['$bottom'] != null">
32
+ <slot name="bottom" />
33
+ </view>
30
34
  </view>
31
35
  </template>
32
36
 
@@ -27,6 +27,9 @@
27
27
  <view class="up-empty__wrap" v-if="$slots.default || $slots.$default">
28
28
  <slot />
29
29
  </view>
30
+ <view class="up-empty__wrap" v-if="$slots.bottom || $slots.$bottom">
31
+ <slot name="bottom" />
32
+ </view>
30
33
  </view>
31
34
  </template>
32
35
 
@@ -8,6 +8,7 @@
8
8
  mode="bottom"
9
9
  :closeable="pageInline ? false : closeable"
10
10
  :pageInline="pageInline"
11
+ :safeAreaInsetBottom="safeAreaInsetBottom"
11
12
  :border-radius="20"
12
13
  @close="close"
13
14
  @closed="closedHandler"
@@ -78,7 +79,7 @@
78
79
 
79
80
  <script setup lang="uts">
80
81
  import type { PropType } from 'vue'
81
- import { computed, ref } from 'vue'
82
+ import { computed, ref, watch } from 'vue'
82
83
  function emptySkuList(): Array<UTSJSONObject> {
83
84
  return [] as Array<UTSJSONObject>
84
85
  }
@@ -88,6 +89,17 @@
88
89
  function emptyObject(): UTSJSONObject {
89
90
  return {} as UTSJSONObject
90
91
  }
92
+ function cloneSkuObject(value: UTSJSONObject | null): UTSJSONObject {
93
+ if (value == null) {
94
+ return emptyObject()
95
+ }
96
+ const result = emptyObject()
97
+ const keys = UTSJSONObject.keys(value)
98
+ for (let i = 0; i < keys.length; i++) {
99
+ result[keys[i]] = value[keys[i]]
100
+ }
101
+ return result
102
+ }
91
103
  function normalizeNumber(value: any | null, defaultValue: number = 0): number {
92
104
  if (typeof value === 'number') {
93
105
  return value
@@ -148,6 +160,13 @@ const props = defineProps({
148
160
  return [] as Array<UTSJSONObject>
149
161
  }
150
162
  },
163
+ // 默认选中的SKU
164
+ defaultSku: {
165
+ type: Object as PropType<UTSJSONObject>,
166
+ default(): UTSJSONObject {
167
+ return {} as UTSJSONObject
168
+ }
169
+ },
151
170
  // 最大购买数量
152
171
  maxBuy: {
153
172
  type: Number,
@@ -167,12 +186,17 @@ const props = defineProps({
167
186
  pageInline: {
168
187
  type: Boolean,
169
188
  default: false
189
+ },
190
+ // 是否留出底部安全距离
191
+ safeAreaInsetBottom: {
192
+ type: Boolean,
193
+ default: true
170
194
  }
171
195
  })
172
196
 
173
197
  const emit = defineEmits(['open', 'confirm', 'close', 'closed'])
174
198
  const show = ref(props.pageInline)
175
- const selectedSku = ref(emptyObject())
199
+ const selectedSku = ref(cloneSkuObject(props.defaultSku))
176
200
  const buyNum = ref(1)
177
201
 
178
202
  const skuTreeList = computed((): Array<UTSJSONObject> => {
@@ -380,10 +404,15 @@ const onNumChange = (e: UTSJSONObject): void => {
380
404
  }
381
405
 
382
406
  const reset = (): void => {
383
- selectedSku.value = emptyObject()
407
+ selectedSku.value = cloneSkuObject(props.defaultSku)
384
408
  buyNum.value = 1
385
409
  }
386
410
 
411
+ // 外部更新 defaultSku 时,同步替换内部选中状态
412
+ watch(() : UTSJSONObject | null => props.defaultSku, (newVal: UTSJSONObject | null) => {
413
+ selectedSku.value = cloneSkuObject(newVal)
414
+ })
415
+
387
416
  const open = (): void => {
388
417
  show.value = true
389
418
  emit('open')
@@ -8,6 +8,7 @@
8
8
  mode="bottom"
9
9
  :closeable="pageInline ? false : closeable"
10
10
  :pageInline="pageInline"
11
+ :safeAreaInsetBottom="safeAreaInsetBottom"
11
12
  :border-radius="20"
12
13
  @close="close"
13
14
  @closed="closedHandler"
@@ -77,7 +78,7 @@
77
78
  </template>
78
79
 
79
80
  <script setup>
80
- import { computed, ref } from 'vue'
81
+ import { computed, ref, watch } from 'vue'
81
82
  import { commonProps } from '../../libs/composable/useUltraUI.js'
82
83
  import { t } from '../../libs/i18n/index.js'
83
84
 
@@ -107,6 +108,11 @@ const props = defineProps({
107
108
  type: Array,
108
109
  default: () => []
109
110
  },
111
+ // 默认选中的SKU
112
+ defaultSku: {
113
+ type: Object,
114
+ default: () => ({})
115
+ },
110
116
  // 最大购买数量
111
117
  maxBuy: {
112
118
  type: Number,
@@ -126,12 +132,17 @@ const props = defineProps({
126
132
  pageInline: {
127
133
  type: Boolean,
128
134
  default: false
135
+ },
136
+ // 是否留出底部安全距离
137
+ safeAreaInsetBottom: {
138
+ type: Boolean,
139
+ default: true
129
140
  }
130
141
  })
131
142
  const emit = defineEmits(['open', 'confirm', 'close', 'closed'])
132
143
 
133
144
  const show = ref(false)
134
- const selectedSku = ref({})
145
+ const selectedSku = ref({ ...props.defaultSku })
135
146
  const buyNum = ref(1)
136
147
 
137
148
  if (props.pageInline) {
@@ -270,10 +281,15 @@ function onNumChange(e) {
270
281
  }
271
282
 
272
283
  function reset() {
273
- selectedSku.value = {}
284
+ selectedSku.value = { ...props.defaultSku }
274
285
  buyNum.value = 1
275
286
  }
276
287
 
288
+ // 外部更新 defaultSku 时,同步替换内部选中状态
289
+ watch(() => props.defaultSku, (sku) => {
290
+ selectedSku.value = { ...(sku || {}) }
291
+ })
292
+
277
293
  function open() {
278
294
  show.value = true
279
295
  emit('open')
@@ -10,7 +10,7 @@
10
10
  'upicon-level': '\ue693',
11
11
  'upicon-column-line': '\ue68e',
12
12
  'upicon-checkbox-mark': '\ue807',
13
- 'uiupiconcon-folder': '\ue7f5',
13
+ 'upicon-folder': '\ue7f5',
14
14
  'upicon-movie': '\ue7f6',
15
15
  'upicon-star-fill': '\ue669',
16
16
  'upicon-star': '\ue65f',
@@ -30,6 +30,8 @@ export default {
30
30
  titleStyle: {},
31
31
  mode: 'default',
32
32
  scrollTop: 0,
33
+ frosted: false,
34
+ statusBarInsetTop: -1,
33
35
  avoidCapsule: true
34
36
  }
35
37
  } as UTSJSONObject