@56os/search-fields 0.1.0 → 0.1.1
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/README.md
CHANGED
|
@@ -8,11 +8,15 @@
|
|
|
8
8
|
## 安装
|
|
9
9
|
|
|
10
10
|
```bash
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
pnpm add @56os/search-fields
|
|
12
|
+
# 或
|
|
13
|
+
npm install @56os/search-fields
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
本地联调源码(可选):
|
|
13
17
|
|
|
14
|
-
|
|
15
|
-
|
|
18
|
+
```bash
|
|
19
|
+
pnpm add @56os/search-fields@file:../56os-search-fields
|
|
16
20
|
```
|
|
17
21
|
|
|
18
22
|
## 接入(子应用入口必须注入 API)
|
|
@@ -46,6 +50,7 @@ import type { SearchFieldSchemaItem } from '@56os/search-fields';
|
|
|
46
50
|
<BasicSearchFields
|
|
47
51
|
:model="queryParams"
|
|
48
52
|
:fields="visibleBasicFields"
|
|
53
|
+
:show-advanced="showAdvancedQuery"
|
|
49
54
|
@search="handleSearch"
|
|
50
55
|
@reset="handleReset"
|
|
51
56
|
@advanced="openAdvancedQuery"
|
|
@@ -54,8 +59,9 @@ import type { SearchFieldSchemaItem } from '@56os/search-fields';
|
|
|
54
59
|
|
|
55
60
|
- 配置区标签 / 高级查询:全部可查字段(同序)
|
|
56
61
|
- 页头:`orderedFields.slice(0, basicVisibleCount)`,默认前 4 个
|
|
62
|
+
- **高级查询入口**:`showAdvancedQuery = orderedFields.length > basicVisibleCount`;字段全在页头(如仅 3 个条件)时隐藏「高级查询」
|
|
57
63
|
- 排序落库:宿主 `Advancedquery` 负责;业务页只收 `onBasicOrderChange`
|
|
58
64
|
|
|
59
65
|
## 版本
|
|
60
66
|
|
|
61
|
-
遵循 semver。当前 `0.1.
|
|
67
|
+
遵循 semver。当前 `0.1.1`:新增 `showAdvancedQuery` / `BasicSearchFields.showAdvanced`(字段全在页头时隐藏高级查询)。
|
package/package.json
CHANGED
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
<slot name="actions">
|
|
67
67
|
<el-button type="primary" @click="emit('search')">查 询</el-button>
|
|
68
68
|
<el-button @click="emit('reset')">重 置</el-button>
|
|
69
|
-
<el-button @click="emit('advanced')">高级查询</el-button>
|
|
69
|
+
<el-button v-if="showAdvanced" @click="emit('advanced')">高级查询</el-button>
|
|
70
70
|
</slot>
|
|
71
71
|
</el-form-item>
|
|
72
72
|
</el-col>
|
|
@@ -90,13 +90,20 @@ interface Props {
|
|
|
90
90
|
fieldSpan?: number;
|
|
91
91
|
/** 操作按钮列宽;不传则自动计算 */
|
|
92
92
|
actionsSpan?: number;
|
|
93
|
+
/**
|
|
94
|
+
* 是否展示「高级查询」按钮。
|
|
95
|
+
* 约定:可查字段总数 ≤ basicVisibleCount(页头已全展示)时传 false。
|
|
96
|
+
* 由 useSearchFieldSchema 的 showAdvancedQuery 驱动。
|
|
97
|
+
*/
|
|
98
|
+
showAdvanced?: boolean;
|
|
93
99
|
}
|
|
94
100
|
|
|
95
101
|
const props = withDefaults(defineProps<Props>(), {
|
|
96
102
|
fields: () => [],
|
|
97
103
|
labelWidth: '80',
|
|
98
104
|
fieldSpan: undefined,
|
|
99
|
-
actionsSpan: undefined
|
|
105
|
+
actionsSpan: undefined,
|
|
106
|
+
showAdvanced: true
|
|
100
107
|
});
|
|
101
108
|
|
|
102
109
|
const emit = defineEmits<{
|
|
@@ -93,6 +93,12 @@ export function useSearchFieldSchema(
|
|
|
93
93
|
}))
|
|
94
94
|
);
|
|
95
95
|
|
|
96
|
+
/**
|
|
97
|
+
* 可查字段总数 ≤ 页头 N(默认 4)时,页头已展示全部字段,不提供高级查询入口。
|
|
98
|
+
* 仅当存在第 N+1 及以后的字段时才展示「高级查询」。
|
|
99
|
+
*/
|
|
100
|
+
const showAdvancedQuery = computed(() => orderedFields.value.length > basicVisibleCount);
|
|
101
|
+
|
|
96
102
|
const applyOrder = (orderedKeys: string[]) => {
|
|
97
103
|
userBasicOrder.value = Array.isArray(orderedKeys) ? [...orderedKeys] : [];
|
|
98
104
|
};
|
|
@@ -117,6 +123,7 @@ export function useSearchFieldSchema(
|
|
|
117
123
|
visibleBasicFields,
|
|
118
124
|
advancedFields,
|
|
119
125
|
basicFieldTags,
|
|
126
|
+
showAdvancedQuery,
|
|
120
127
|
applyOrder,
|
|
121
128
|
loadOrder,
|
|
122
129
|
basicVisibleCount
|