wui-components-v2 1.2.84 → 1.2.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.
@@ -0,0 +1,35 @@
1
+ <script setup lang="ts">
2
+ import { defineEmits, defineOptions, defineProps } from 'vue'
3
+ import type { FilterInTabPageItem } from '../../type'
4
+
5
+ defineOptions({
6
+ name: 'FilterInTabPage',
7
+ })
8
+
9
+ const props = defineProps<{
10
+ /** 同一 blockId 下的 tab 项(由调用方按 order 排序后传入) */
11
+ tabs: FilterInTabPageItem[]
12
+ /** 当前列表页的 sourceId,用于高亮激活 tab */
13
+ activeId: string
14
+ }>()
15
+
16
+ const emit = defineEmits<{
17
+ (e: 'change', item: FilterInTabPageItem): void
18
+ }>()
19
+
20
+ // click事件:wd-tab 回调携带 name(即 item.id),换算成 tab 项后抛给父级处理跳转
21
+ function click(event: { name: string }) {
22
+ const item = props.tabs.find(i => i.id === event.name)
23
+ if (item) {
24
+ emit('change', item)
25
+ }
26
+ }
27
+ </script>
28
+
29
+ <template>
30
+ <wd-tabs :model-value="activeId" animated slidable="always" @click="click">
31
+ <block v-for="item in tabs" :key="item.id">
32
+ <wd-tab :title="item.title" :name="item.id" />
33
+ </block>
34
+ </wd-tabs>
35
+ </template>
@@ -288,6 +288,15 @@ function downloadExportFile() {
288
288
 
289
289
  console.log(props.buttons, '33333')
290
290
 
291
+ // 顶部可见按钮数量:仅剩一个时按钮不拉伸占满整行(去掉 flex-1,按内容自适应宽度)
292
+ const visibleBtnCount = computed(() => {
293
+ let count = 0
294
+ if (props.buttons.includes('dtmplAdd')) count++
295
+ if (props.buttons.includes('exportLtmplExcel')) count++
296
+ if (props.batchOpsVisible !== false) count++
297
+ return count
298
+ })
299
+
291
300
  // 供父组件(如 wui-list 底部批量操作条)触发文件导出弹窗
292
301
  defineExpose({
293
302
  openExportPopup,
@@ -296,11 +305,17 @@ defineExpose({
296
305
 
297
306
  <template>
298
307
  <view v-if="showButtons" class="flex justify-end gap-1 py-2 px-2 bg-white dark:bg-[var(--wot-dark-background)]">
299
- <wd-button class="flex-1" v-if="buttons.includes('dtmplAdd')" type="primary" @click="gotoAddPage" icon="plus">
308
+ <wd-button
309
+ :class="visibleBtnCount > 1 ? 'flex-1' : ''"
310
+ v-if="buttons.includes('dtmplAdd')"
311
+ type="primary"
312
+ @click="gotoAddPage"
313
+ icon="plus"
314
+ >
300
315
  {{ props.config?.editBtnTitle || '新增' }}
301
316
  </wd-button>
302
317
  <wd-button
303
- class="flex-1"
318
+ :class="visibleBtnCount > 1 ? 'flex-1' : ''"
304
319
  v-if="buttons.includes('exportLtmplExcel')"
305
320
  type="primary"
306
321
  @click="openExportPopup()"
@@ -312,7 +327,7 @@ defineExpose({
312
327
  <slot />
313
328
  <wd-button
314
329
  v-if="props.batchOpsVisible !== false"
315
- class="flex-1"
330
+ :class="visibleBtnCount > 1 ? 'flex-1' : ''"
316
331
  type="primary"
317
332
  @click="emit('batchEdit')"
318
333
  :icon="props.batchEditing ? 'close' : 'edit'"
@@ -602,6 +602,8 @@ function tabSearchClick(data: any) {
602
602
  >
603
603
  <template #top>
604
604
  <slot name="top" />
605
+ <!-- 自定义 tab 容器:tab 内容完全由使用方传入 -->
606
+ <slot name="filterTabs" />
605
607
  <Search
606
608
  v-if="showSearch"
607
609
  :main-code="mainCode"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wui-components-v2",
3
- "version": "1.2.84",
3
+ "version": "1.2.86",
4
4
  "description": "wui 组件库",
5
5
  "author": "wgxshh",
6
6
  "license": "MIT",
package/type.ts CHANGED
@@ -22,6 +22,25 @@ export type Comparator =
22
22
  // tab字段配置
23
23
  export interface Split2TabCriterias extends Fields {}
24
24
 
25
+ /**
26
+ * fastMenu.FilterInTabPage 项:同组列表页 tab(如声音/振动/温度报警)。
27
+ * 同组项共享同一个 blockId,order 决定排列顺序,id 即对应列表页的 sourceId。
28
+ */
29
+ export interface FilterInTabPageItem {
30
+ id: string
31
+ blockId: string
32
+ title: string
33
+ pageType: string
34
+ order: string
35
+ themeColor?: string
36
+ icon?: string
37
+ appIcon?: string
38
+ tip?: string | null
39
+ disabled?: boolean
40
+ defaultCriteriaValue?: { [key: string]: any }
41
+ [key: string]: any
42
+ }
43
+
25
44
  // 列表字段配置
26
45
  export interface Columns {
27
46
  controlType: string