wui-components-v2 1.2.90 → 1.2.92

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.
@@ -1105,6 +1105,29 @@ console.log('clearValueMap', clearValueMap)
1105
1105
  />
1106
1106
  </view>
1107
1107
  </wd-form-item>
1108
+ <!-- yes-no-select / yes-no-radio:是/否 单选,取值与 yes-no-switch 一致(是/否) -->
1109
+ <wd-form-item
1110
+ v-else-if="
1111
+ ['yes-no-select', 'yes-no-radio'].includes(
1112
+ ControlTypeSupportor.getControlType(item, props.entity && props.entity[item.sourceId])
1113
+ )
1114
+ "
1115
+ :class="{ 'no-border-top': fields.indexOf(item) === 0 }"
1116
+ :prop="item.sourceId"
1117
+ :title="item.title"
1118
+ >
1119
+ <wd-radio-group
1120
+ v-if="!item.disabled"
1121
+ v-model="model[item.sourceId]"
1122
+ inline
1123
+ shape="dot"
1124
+ custom-class="custom-radio"
1125
+ >
1126
+ <wd-radio value="是">是</wd-radio>
1127
+ <wd-radio value="否">否</wd-radio>
1128
+ </wd-radio-group>
1129
+ <view v-else class="text-left">{{ model[item.sourceId] }}</view>
1130
+ </wd-form-item>
1108
1131
  <wd-form-item
1109
1132
  v-else-if="
1110
1133
  ['tree-entity-select', 'ltree-entity-select', 'lab-tree-select'].includes(
@@ -51,7 +51,7 @@ function numColor(item: { themeColor?: string }) {
51
51
 
52
52
  <template>
53
53
  <view v-if="quickPanel.length > 0 || capsuleMenu.length > 0" class="mb-3">
54
- <view class="rounded-2xl bg-white p-4 shadow-[0_4px_16px_rgba(0,0,0,0.04)] dark:bg-black">
54
+ <view class="rounded-2xl bg-white p-3 shadow-[0_4px_16px_rgba(0,0,0,0.04)] dark:bg-black">
55
55
  <view class="mb-3 flex items-center gap-2 text-size-4 font-bold text-gray-800 dark:text-white">
56
56
  {{ languageStore.t('数据统计') }}
57
57
  </view>
@@ -78,12 +78,11 @@ function numColor(item: { themeColor?: string }) {
78
78
  :style="{ background: pillTheme(i).bg }"
79
79
  @click="handleClick(item)"
80
80
  >
81
- <view class="h-1.5 w-1.5 shrink-0 rounded-full" :style="{ background: pillTheme(i).dot }" />
82
- <text class="text-[11px] font-semibold" :style="{ color: pillTheme(i).text }">
81
+ <text class="min-w-0 whitespace-nowrap text-[11px] font-semibold" :style="{ color: pillTheme(i).text }">
83
82
  {{ stripParen(languageStore.t(item.title)) }}
84
83
  </text>
85
- <text class="text-[15px] font-extrabold" :style="{ color: pillTheme(i).text }">{{ item.count }}</text>
86
- <text class="text-[11px]" :style="{ color: pillTheme(i).text, opacity: 0.7 }">{{ languageStore.t('条') }}</text>
84
+ <text class="shrink-0 text-[15px] font-extrabold" :style="{ color: pillTheme(i).text }">{{ item.count }}</text>
85
+ <text class="shrink-0 text-[11px]" :style="{ color: pillTheme(i).text, opacity: 0.7 }">{{ languageStore.t('条') }}</text>
87
86
  </view>
88
87
  </view>
89
88
  </slot>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wui-components-v2",
3
- "version": "1.2.90",
3
+ "version": "1.2.92",
4
4
  "description": "wui 组件库",
5
5
  "author": "wgxshh",
6
6
  "license": "MIT",
package/store/language.ts CHANGED
@@ -44,6 +44,9 @@ export const useLanguageStore = defineStore('language', () => {
44
44
  }
45
45
  }
46
46
 
47
+ // 进行中的加载 Promise(按语言缓存):并发调用共享同一个请求,避免重复请求语言包
48
+ const loadingPromises: Record<string, Promise<LanguagePackage>> = {}
49
+
47
50
  /**
48
51
  * 加载并设置语言
49
52
  */
@@ -54,14 +57,20 @@ export const useLanguageStore = defineStore('language', () => {
54
57
  return
55
58
  }
56
59
 
60
+ // 已有同语言请求在进行中时直接复用,不再发新请求
61
+ if (!loadingPromises[lang]) {
62
+ loadingPromises[lang] = loadLanguageFromNetwork(lang).then((langPack) => {
63
+ languagePackages.value[lang] = langPack
64
+ loadedLanguages.value.push(lang)
65
+ return langPack
66
+ }).finally(() => {
67
+ delete loadingPromises[lang]
68
+ })
69
+ }
70
+
57
71
  loading.value = true
58
72
  try {
59
- const langPack = await loadLanguageFromNetwork(lang)
60
-
61
- languagePackages.value[lang] = langPack
62
-
63
- loadedLanguages.value.push(lang)
64
-
73
+ await loadingPromises[lang]
65
74
  currentLanguage.value = lang
66
75
  }
67
76
  finally {