foggy-data-viewer 1.0.1-beta.45 → 1.0.1-beta.47

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
@@ -1,6 +1,8 @@
1
1
  # Foggy Data Viewer
2
2
 
3
- 一个基于 Vue 3 + TypeScript + vxe-table 的企业级数据表格组件库。
3
+ 一个基于 Vue 3 + TypeScript + vxe-table 的企业级数据表格组件库。
4
+
5
+ HTTP 鉴权接入(beta.47 起):从公共入口导入 `configureDataViewerHttp`,在应用挂载前配置动态 `getHeaders` 和 `onUnauthorized`。允许先导入 SDK 再配置,无需 patch Axios,也无需修改 generated 文件。详见 [HTTP 接入与 TMS 迁移指南](./docs/http-auth.md)。
4
6
 
5
7
  ## 特性
6
8
 
@@ -8,7 +10,7 @@
8
10
  - 📊 **动态列配置** - 基于 QM Schema + TableConfig 的灵活列配置
9
11
  - 🔍 **高级筛选** - 支持多种数据类型的筛选器(表头过滤 + 独立搜索工具栏)
10
12
  - 📈 **汇总行** - 自动计算选中行和全量汇总
11
- - 🎨 **自定义渲染** - 支持 `column-*` 插槽、自定义格式化和渲染函数
13
+ - 🎨 **自定义渲染** - 支持 `column-*` 插槽、自定义格式化和渲染函数
12
14
  - 🔧 **组合组件** - 提供 SearchToolbar + DataTable 的组合组件
13
15
  - ✅ **高测试覆盖** - 核心组件覆盖率 90%+
14
16
  - 📦 **按需引入** - ES Module 支持
@@ -102,6 +104,27 @@ function handlePageChange(page: number, pageSize: number) {
102
104
  </template>
103
105
  ```
104
106
 
107
+ ### 3. 展示“分”为“元”的金额字段
108
+
109
+ 金额单位必须由字段元数据显式声明;组件不会根据字段名、`MONEY` 类型或
110
+ `semanticScaleFactor` 推断。模型定义可直接复用公共导出:
111
+
112
+ ```typescript
113
+ import { MONEY_VIEWER } from 'foggy-data-viewer'
114
+
115
+ const amountField = {
116
+ name: 'amount',
117
+ type: 'MONEY',
118
+ extData: {
119
+ viewer: MONEY_VIEWER
120
+ }
121
+ }
122
+ ```
123
+
124
+ 此配置会把原始值 `3400` 展示为 `34.00`,并把筛选输入的 `34` 精确换算为
125
+ 提交给查询端的 `3400`。行数据、服务端汇总数据和排序值始终保持原始“分”值;
126
+ 已经返回“元”的字段不要配置 `MONEY_VIEWER`。
127
+
105
128
  ## 组件列表
106
129
 
107
130
  ### 核心组件
@@ -139,33 +162,33 @@ function handlePageChange(page: number, pageSize: number) {
139
162
  | columns | `EnhancedColumnSchema[]` | - | 列配置(必填) |
140
163
  | data | `any[]` | - | 表格数据(必填) |
141
164
  | total | `number` | - | 总数据量(必填) |
142
- | loading | `boolean` | `false` | 加载状态 |
143
- | pageSize | `number` | `50` | 每页显示数量 |
144
- | showFilters | `boolean` | `true` | 是否显示筛选器 |
145
- | localFilter | `boolean` | `true` | 是否把列头筛选条件应用到当前 `data` |
146
- | serverSummary | `object \| null` | `null` | 服务端汇总数据 |
147
- | initialSlice | `SliceCondition[]` | - | 初始筛选条件 |
148
- | filterOptionsLoader | `Function` | - | 筛选选项加载器 |
149
-
150
- `DataTableWithSearch` 在 `schema + fetchData` 服务端查询模式下默认 `localFilter=false`:列头筛选仍会提交给 `fetchData`,但返回数据不会再被前端二次过滤,避免聚合字段、派生字段、字典展示字段被简单本地比较误删。需要纯前端过滤时,可显式设置 `localFilter=true` 或 `schema.localFilter=true`。
151
-
152
- ### DataTableWithSearch tableInstanceId 默认查询配置
153
-
154
- `schema + fetchData` 模式支持按 `tableInstanceId` 加载默认查询配置。默认查询配置只负责默认展示列、排序、分页和筛选;`requiredRuntimeColumns`、`lockedColumns` 由 TM/QM 产出的 `TableSchema` 提供。
155
-
156
- ```vue
157
- <DataTableWithSearch
158
- :schema="{ ...tableSchema, qmModel: 'TicketQueryModel', tableInstanceId: 'ticket-list' }"
159
- :fetch-data="fetchTickets"
160
- :default-query-config-scope="{ userId: currentUser.id, tenantId: currentTenant.id, roleIds: currentRoleIds }"
161
- />
162
- ```
163
-
164
- 后端可通过 `foggy.data-viewer.table-defaults.system/tenants/roles` 配置 fallback;用户默认配置仍可通过 `listPreset` 覆盖。`requiredRuntimeColumns` 只会追加到 `fetchData(params).columns`,不会显示为普通列。
165
-
166
- ### DataTable Events
167
-
168
- | 事件名 | 参数 | 说明 |
165
+ | loading | `boolean` | `false` | 加载状态 |
166
+ | pageSize | `number` | `50` | 每页显示数量 |
167
+ | showFilters | `boolean` | `true` | 是否显示筛选器 |
168
+ | localFilter | `boolean` | `true` | 是否把列头筛选条件应用到当前 `data` |
169
+ | serverSummary | `object \| null` | `null` | 服务端汇总数据 |
170
+ | initialSlice | `SliceCondition[]` | - | 初始筛选条件 |
171
+ | filterOptionsLoader | `Function` | - | 筛选选项加载器 |
172
+
173
+ `DataTableWithSearch` 在 `schema + fetchData` 服务端查询模式下默认 `localFilter=false`:列头筛选仍会提交给 `fetchData`,但返回数据不会再被前端二次过滤,避免聚合字段、派生字段、字典展示字段被简单本地比较误删。需要纯前端过滤时,可显式设置 `localFilter=true` 或 `schema.localFilter=true`。
174
+
175
+ ### DataTableWithSearch tableInstanceId 默认查询配置
176
+
177
+ `schema + fetchData` 模式支持按 `tableInstanceId` 加载默认查询配置。默认查询配置只负责默认展示列、排序、分页和筛选;`requiredRuntimeColumns`、`lockedColumns` 由 TM/QM 产出的 `TableSchema` 提供。
178
+
179
+ ```vue
180
+ <DataTableWithSearch
181
+ :schema="{ ...tableSchema, qmModel: 'TicketQueryModel', tableInstanceId: 'ticket-list' }"
182
+ :fetch-data="fetchTickets"
183
+ :default-query-config-scope="{ userId: currentUser.id, tenantId: currentTenant.id, roleIds: currentRoleIds }"
184
+ />
185
+ ```
186
+
187
+ 后端可通过 `foggy.data-viewer.table-defaults.system/tenants/roles` 配置 fallback;用户默认配置仍可通过 `listPreset` 覆盖。`requiredRuntimeColumns` 只会追加到 `fetchData(params).columns`,不会显示为普通列。
188
+
189
+ ### DataTable Events
190
+
191
+ | 事件名 | 参数 | 说明 |
169
192
  |--------|------|------|
170
193
  | page-change | `(page, pageSize)` | 分页变化 |
171
194
  | sort-change | `(field, order)` | 排序变化 |
@@ -201,179 +224,179 @@ function buildTableColumns(
201
224
  - `showAll?: boolean` - 是否显示所有列
202
225
  - `customizations?: ColumnCustomization[]` - 列自定义配置
203
226
 
204
- **返回:**
205
- - `EnhancedColumnSchema[]` - 增强的列配置数组
206
-
207
- ## 列内容自定义
208
-
209
- ### `column-*` 插槽(推荐用于交互)
210
-
211
- 当业务列需要渲染成链接、按钮,或点击后交给上游页面打开详情、编辑弹窗时,推荐使用 `#column-{field}` 插槽。插槽参数为 `{ row, value, column }`。
212
-
213
- ```vue
214
- <script setup lang="ts">
215
- function openDetail(row: Record<string, unknown>) {
216
- // 由业务系统决定跳转、弹窗或其他处理方式
217
- }
218
- </script>
219
-
220
- <template>
221
- <DataTableWithSearch
222
- :columns="columns"
223
- :data="data"
224
- :total="total"
225
- :loading="loading"
226
- >
227
- <template #column-name="{ row, value }">
228
- <button type="button" class="link-cell" @click.stop="openDetail(row)">
229
- {{ value || '-' }}
230
- </button>
231
- </template>
232
- </DataTableWithSearch>
233
- </template>
234
- ```
235
-
236
- `foggy-gen` 生成的 QueryTable wrapper 也会透传 `column-*` / `filter-*` 动态插槽,因此业务页可以直接在生成组件上写同样的插槽:
237
-
238
- ```vue
239
- <VehicleCapacityProfileManagementQueryTable>
240
- <template #column-profileName="{ row, value }">
241
- <button type="button" class="link-cell" @click.stop="openProfile(row)">
242
- {{ value || '-' }}
243
- </button>
244
- </template>
245
- </VehicleCapacityProfileManagementQueryTable>
246
- ```
247
-
248
- ### `render` 函数(适合纯展示)
249
-
250
- 如果只是添加颜色、图标、标签等展示效果,也可以通过 `ColumnCustomization.render` 或生成组件的 `columnOverrides[field].render` 配置渲染函数:
251
-
252
- ```typescript
253
- import { h } from 'vue'
254
- import { buildTableColumns } from 'foggy-data-viewer'
255
-
256
- const columns = buildTableColumns(qmSchema, {
257
- visibleColumns: ['name', 'status'],
258
- customizations: [
259
- {
260
- name: 'status',
261
- render: ({ value, column }) => h(
262
- 'span',
263
- { class: value === 'active' ? 'status-ok' : 'status-muted' },
264
- `${column.title}: ${String(value ?? '-')}`
265
- )
266
- }
267
- ]
268
- })
269
- ```
270
-
271
- 选择原则:需要绑定业务事件时优先用 `column-*` 插槽;只改显示内容时使用 `render` 更轻。
272
-
273
- ### 全局列渲染器(应用级统一增强)
274
-
275
- 业务系统可以在应用启动时注册 `globalColumnRenderers`,按列元数据统一增强单元格展示。生成的 QueryTable wrapper 不需要批量修改。
276
-
277
- ```typescript
278
- import { h } from 'vue'
279
- import { globalColumnRenderers } from 'foggy-data-viewer'
280
-
281
- const dispose = globalColumnRenderers.add({
282
- id: 'app.orderNoLink',
283
- priority: 100,
284
- match: ({ column }) => column.name === 'orderNo' && /运单号/.test(column.title ?? ''),
285
- render: ({ value }) => {
286
- const text = String(value ?? '').trim()
287
- if (!text) return '-'
288
- return h('button', {
289
- type: 'button',
290
- class: 'data-viewer-link-cell',
291
- onClick: (event: MouseEvent) => {
292
- event.stopPropagation()
293
- // 在业务应用闭包里调用 router.push(...)
294
- }
295
- }, text)
296
- }
297
- })
298
-
299
- // 应用卸载或测试清理
300
- dispose()
301
- ```
302
-
303
- 渲染优先级固定为:`column-*` 插槽 > `column.customRender` > `globalColumnRenderers` > 默认渲染/字典/formatter。列级退出可设置 `column.uiConfig.disableGlobalRender = true`。
304
-
305
- ### 全局搜索生命周期 Hook
306
-
307
- `globalSearchHooks` 作用于搜索动作层,早于最终 `fetchData` 和 `globalQueryHooks.onBeforeQuery`。它可以区分搜索来源和触发原因,适合埋点、默认条件补充和无效查询拦截。
308
-
309
- ```typescript
310
- import { globalSearchHooks } from 'foggy-data-viewer'
311
-
312
- globalSearchHooks.register({
313
- beforeSearch: (ctx) => {
314
- if (ctx.trigger === 'search' && ctx.slice.length === 0) return false
315
- return {
316
- slice: [
317
- ...ctx.slice,
318
- { field: 'tenantId', op: '=', value: currentTenantId }
319
- ]
320
- }
321
- },
322
- afterSearch: (ctx, result) => {
323
- console.log(ctx.source, ctx.trigger, result.total)
324
- },
325
- searchError: (ctx, error) => {
326
- console.warn(ctx.source, ctx.trigger, error)
327
- }
328
- })
329
- ```
330
-
331
- `ctx.source` 为 `search-toolbar | query-panel | column-filter | external | api`,`ctx.trigger` 为 `search | reset | filter | sort | page | refresh | reload | mount`。
332
-
333
- ## 类型定义
334
-
335
- ```typescript
336
- import type { Component } from 'vue'
337
-
338
- interface ColumnSchema {
339
- name: string
340
- type: string
341
- title: string
342
- }
343
-
344
- interface CellRenderContext {
345
- row: Record<string, unknown>
346
- value: unknown
347
- column: EnhancedColumnSchema
348
- }
349
-
350
- type CellRenderFn = (params: CellRenderContext) => unknown
351
-
352
- interface ColumnCustomization {
353
- name: string
354
- width?: number
355
- minWidth?: number
356
- fixed?: 'left' | 'right'
357
- formatter?: (value: unknown) => string
358
- render?: CellRenderFn
359
- filterComponent?: Component | unknown
360
- }
361
-
362
- interface TableConfig {
227
+ **返回:**
228
+ - `EnhancedColumnSchema[]` - 增强的列配置数组
229
+
230
+ ## 列内容自定义
231
+
232
+ ### `column-*` 插槽(推荐用于交互)
233
+
234
+ 当业务列需要渲染成链接、按钮,或点击后交给上游页面打开详情、编辑弹窗时,推荐使用 `#column-{field}` 插槽。插槽参数为 `{ row, value, column }`。
235
+
236
+ ```vue
237
+ <script setup lang="ts">
238
+ function openDetail(row: Record<string, unknown>) {
239
+ // 由业务系统决定跳转、弹窗或其他处理方式
240
+ }
241
+ </script>
242
+
243
+ <template>
244
+ <DataTableWithSearch
245
+ :columns="columns"
246
+ :data="data"
247
+ :total="total"
248
+ :loading="loading"
249
+ >
250
+ <template #column-name="{ row, value }">
251
+ <button type="button" class="link-cell" @click.stop="openDetail(row)">
252
+ {{ value || '-' }}
253
+ </button>
254
+ </template>
255
+ </DataTableWithSearch>
256
+ </template>
257
+ ```
258
+
259
+ `foggy-gen` 生成的 QueryTable wrapper 也会透传 `column-*` / `filter-*` 动态插槽,因此业务页可以直接在生成组件上写同样的插槽:
260
+
261
+ ```vue
262
+ <VehicleCapacityProfileManagementQueryTable>
263
+ <template #column-profileName="{ row, value }">
264
+ <button type="button" class="link-cell" @click.stop="openProfile(row)">
265
+ {{ value || '-' }}
266
+ </button>
267
+ </template>
268
+ </VehicleCapacityProfileManagementQueryTable>
269
+ ```
270
+
271
+ ### `render` 函数(适合纯展示)
272
+
273
+ 如果只是添加颜色、图标、标签等展示效果,也可以通过 `ColumnCustomization.render` 或生成组件的 `columnOverrides[field].render` 配置渲染函数:
274
+
275
+ ```typescript
276
+ import { h } from 'vue'
277
+ import { buildTableColumns } from 'foggy-data-viewer'
278
+
279
+ const columns = buildTableColumns(qmSchema, {
280
+ visibleColumns: ['name', 'status'],
281
+ customizations: [
282
+ {
283
+ name: 'status',
284
+ render: ({ value, column }) => h(
285
+ 'span',
286
+ { class: value === 'active' ? 'status-ok' : 'status-muted' },
287
+ `${column.title}: ${String(value ?? '-')}`
288
+ )
289
+ }
290
+ ]
291
+ })
292
+ ```
293
+
294
+ 选择原则:需要绑定业务事件时优先用 `column-*` 插槽;只改显示内容时使用 `render` 更轻。
295
+
296
+ ### 全局列渲染器(应用级统一增强)
297
+
298
+ 业务系统可以在应用启动时注册 `globalColumnRenderers`,按列元数据统一增强单元格展示。生成的 QueryTable wrapper 不需要批量修改。
299
+
300
+ ```typescript
301
+ import { h } from 'vue'
302
+ import { globalColumnRenderers } from 'foggy-data-viewer'
303
+
304
+ const dispose = globalColumnRenderers.add({
305
+ id: 'app.orderNoLink',
306
+ priority: 100,
307
+ match: ({ column }) => column.name === 'orderNo' && /运单号/.test(column.title ?? ''),
308
+ render: ({ value }) => {
309
+ const text = String(value ?? '').trim()
310
+ if (!text) return '-'
311
+ return h('button', {
312
+ type: 'button',
313
+ class: 'data-viewer-link-cell',
314
+ onClick: (event: MouseEvent) => {
315
+ event.stopPropagation()
316
+ // 在业务应用闭包里调用 router.push(...)
317
+ }
318
+ }, text)
319
+ }
320
+ })
321
+
322
+ // 应用卸载或测试清理
323
+ dispose()
324
+ ```
325
+
326
+ 渲染优先级固定为:`column-*` 插槽 > `column.customRender` > `globalColumnRenderers` > 默认渲染/字典/formatter。列级退出可设置 `column.uiConfig.disableGlobalRender = true`。
327
+
328
+ ### 全局搜索生命周期 Hook
329
+
330
+ `globalSearchHooks` 作用于搜索动作层,早于最终 `fetchData` 和 `globalQueryHooks.onBeforeQuery`。它可以区分搜索来源和触发原因,适合埋点、默认条件补充和无效查询拦截。
331
+
332
+ ```typescript
333
+ import { globalSearchHooks } from 'foggy-data-viewer'
334
+
335
+ globalSearchHooks.register({
336
+ beforeSearch: (ctx) => {
337
+ if (ctx.trigger === 'search' && ctx.slice.length === 0) return false
338
+ return {
339
+ slice: [
340
+ ...ctx.slice,
341
+ { field: 'tenantId', op: '=', value: currentTenantId }
342
+ ]
343
+ }
344
+ },
345
+ afterSearch: (ctx, result) => {
346
+ console.log(ctx.source, ctx.trigger, result.total)
347
+ },
348
+ searchError: (ctx, error) => {
349
+ console.warn(ctx.source, ctx.trigger, error)
350
+ }
351
+ })
352
+ ```
353
+
354
+ `ctx.source` 为 `search-toolbar | query-panel | column-filter | external | api`,`ctx.trigger` 为 `search | reset | filter | sort | page | refresh | reload | mount`。
355
+
356
+ ## 类型定义
357
+
358
+ ```typescript
359
+ import type { Component } from 'vue'
360
+
361
+ interface ColumnSchema {
362
+ name: string
363
+ type: string
364
+ title: string
365
+ }
366
+
367
+ interface CellRenderContext {
368
+ row: Record<string, unknown>
369
+ value: unknown
370
+ column: EnhancedColumnSchema
371
+ }
372
+
373
+ type CellRenderFn = (params: CellRenderContext) => unknown
374
+
375
+ interface ColumnCustomization {
376
+ name: string
377
+ width?: number
378
+ minWidth?: number
379
+ fixed?: 'left' | 'right'
380
+ formatter?: (value: unknown) => string
381
+ render?: CellRenderFn
382
+ filterComponent?: Component | unknown
383
+ }
384
+
385
+ interface TableConfig {
363
386
  visibleColumns?: string[]
364
387
  showAll?: boolean
365
388
  customizations?: ColumnCustomization[]
366
389
  }
367
390
 
368
391
  interface EnhancedColumnSchema extends ColumnSchema {
369
- width?: number
370
- minWidth?: number
371
- fixed?: 'left' | 'right'
372
- customFormatter?: (value: unknown) => string
373
- customRender?: CellRenderFn
374
- customFilterComponent?: Component | unknown
375
- }
376
- ```
392
+ width?: number
393
+ minWidth?: number
394
+ fixed?: 'left' | 'right'
395
+ customFormatter?: (value: unknown) => string
396
+ customRender?: CellRenderFn
397
+ customFilterComponent?: Component | unknown
398
+ }
399
+ ```
377
400
 
378
401
  ## 开发
379
402
 
@@ -0,0 +1,20 @@
1
+ import type { AxiosRequestConfig } from 'axios';
2
+ export type DataViewerHttpHeaders = Record<string, string | null | undefined>;
3
+ export interface DataViewerHttpRequestOptions {
4
+ headers?: DataViewerHttpHeaders;
5
+ }
6
+ export interface DataViewerUnauthorizedContext {
7
+ status: 401;
8
+ method: string;
9
+ /** Path only: excludes credentials, query, fragment, headers and body. */
10
+ path: string;
11
+ }
12
+ export interface DataViewerHttpConfig {
13
+ getHeaders?: () => DataViewerHttpHeaders | Promise<DataViewerHttpHeaders>;
14
+ onUnauthorized?: (context: DataViewerUnauthorizedContext) => void | Promise<void>;
15
+ }
16
+ /** Replace configuration for all SDK clients, including already-created clients. */
17
+ export declare function configureDataViewerHttp(config: DataViewerHttpConfig): void;
18
+ export declare function httpOptions(options?: DataViewerHttpRequestOptions): AxiosRequestConfig;
19
+ /** Internal factory; response unwrapping remains owned by each existing API. */
20
+ export declare function createDataViewerHttpClient(baseURL: string): import("axios").AxiosInstance;
@@ -1,3 +1,4 @@
1
+ import type { DataViewerHttpRequestOptions } from './http';
1
2
  import type { ColumnViewSetting, ListPresetDef, ListPresetVisibility, QueryConditionPreset } from '@/types';
2
3
  export interface ListPresetScope {
3
4
  userId: string;
@@ -19,32 +20,32 @@ export type UpdateListPresetRequest = Partial<SaveListPresetRequest>;
19
20
  /**
20
21
  * 查询当前用户在指定 model/businessKey 下的自定义列表方案。
21
22
  */
22
- export declare function listPresets(scope: ListPresetScope): Promise<ListPresetDef[]>;
23
+ export declare function listPresets(scope: ListPresetScope, options?: DataViewerHttpRequestOptions): Promise<ListPresetDef[]>;
23
24
  /**
24
25
  * 查询当前用户在指定 model/businessKey 下的默认自定义列表。
25
26
  */
26
- export declare function getDefaultListPreset(scope: ListPresetScope): Promise<ListPresetDef | null>;
27
+ export declare function getDefaultListPreset(scope: ListPresetScope, options?: DataViewerHttpRequestOptions): Promise<ListPresetDef | null>;
27
28
  /**
28
29
  * 保存新的自定义列表方案。
29
30
  */
30
- export declare function createListPreset(scope: ListPresetScope, request: SaveListPresetRequest): Promise<ListPresetDef>;
31
+ export declare function createListPreset(scope: ListPresetScope, request: SaveListPresetRequest, options?: DataViewerHttpRequestOptions): Promise<ListPresetDef>;
31
32
  /**
32
33
  * 获取单个自定义列表详情。
33
34
  */
34
- export declare function getListPreset(userId: string, presetId: string): Promise<ListPresetDef>;
35
+ export declare function getListPreset(userId: string, presetId: string, options?: DataViewerHttpRequestOptions): Promise<ListPresetDef>;
35
36
  /**
36
37
  * 更新自定义列表方案。
37
38
  */
38
- export declare function updateListPreset(userId: string, presetId: string, request: UpdateListPresetRequest): Promise<ListPresetDef>;
39
+ export declare function updateListPreset(userId: string, presetId: string, request: UpdateListPresetRequest, options?: DataViewerHttpRequestOptions): Promise<ListPresetDef>;
39
40
  /**
40
41
  * 删除自定义列表方案。
41
42
  */
42
- export declare function deleteListPreset(userId: string, presetId: string): Promise<void>;
43
+ export declare function deleteListPreset(userId: string, presetId: string, options?: DataViewerHttpRequestOptions): Promise<void>;
43
44
  /**
44
45
  * 将某个自定义列表设为默认方案。
45
46
  */
46
- export declare function setDefaultListPreset(userId: string, presetId: string): Promise<ListPresetDef>;
47
+ export declare function setDefaultListPreset(userId: string, presetId: string, options?: DataViewerHttpRequestOptions): Promise<ListPresetDef>;
47
48
  /**
48
49
  * 清除当前 model/businessKey 下的默认方案。
49
50
  */
50
- export declare function clearDefaultListPreset(scope: ListPresetScope): Promise<void>;
51
+ export declare function clearDefaultListPreset(scope: ListPresetScope, options?: DataViewerHttpRequestOptions): Promise<void>;
@@ -1,2 +1,3 @@
1
+ import type { DataViewerHttpRequestOptions } from './http';
1
2
  import type { TableDefaultQueryConfig, TableDefaultQueryConfigScope } from '@/types';
2
- export declare function getTableDefaultQueryConfig(scope: TableDefaultQueryConfigScope): Promise<TableDefaultQueryConfig | null>;
3
+ export declare function getTableDefaultQueryConfig(scope: TableDefaultQueryConfigScope, options?: DataViewerHttpRequestOptions): Promise<TableDefaultQueryConfig | null>;
@@ -1,3 +1,4 @@
1
+ import type { DataViewerHttpRequestOptions } from './http';
1
2
  import type { QueryMetaResponse, ViewerQueryRequest, ViewerDataResponse, FilterOptionsResponse, ColumnSchema, FrontendMeta, MemberQueryRequest, MemberQueryResponse, OrderRequestDef } from '@/types';
2
3
  /**
3
4
  * 查询 payload(与 dataset.query_model 格式一致)
@@ -41,40 +42,40 @@ export interface CreateQueryResponse {
41
42
  /**
42
43
  * 创建查询(从 DSL 输入)
43
44
  */
44
- export declare function createQuery(request: CreateQueryRequest): Promise<CreateQueryResponse>;
45
+ export declare function createQuery(request: CreateQueryRequest, options?: DataViewerHttpRequestOptions): Promise<CreateQueryResponse>;
45
46
  /**
46
47
  * 获取查询元数据
47
48
  */
48
- export declare function fetchQueryMeta(model: string, queryId: string): Promise<QueryMetaResponse>;
49
+ export declare function fetchQueryMeta(model: string, queryId: string, options?: DataViewerHttpRequestOptions): Promise<QueryMetaResponse>;
49
50
  /**
50
51
  * 查询数据
51
52
  */
52
- export declare function fetchQueryData(model: string, queryId: string, request: ViewerQueryRequest): Promise<ViewerDataResponse>;
53
+ export declare function fetchQueryData(model: string, queryId: string, request: ViewerQueryRequest, options?: DataViewerHttpRequestOptions): Promise<ViewerDataResponse>;
53
54
  /**
54
55
  * 获取过滤选项(维度成员或字典项)
55
56
  */
56
- export declare function fetchFilterOptions(model: string, queryId: string, columnName: string): Promise<FilterOptionsResponse>;
57
+ export declare function fetchFilterOptions(model: string, queryId: string, columnName: string, options?: DataViewerHttpRequestOptions): Promise<FilterOptionsResponse>;
57
58
  /**
58
59
  * 获取 QM Schema(查询模型的字段元数据)
59
60
  */
60
- export declare function fetchQmSchema(qmModel: string): Promise<ColumnSchema[]>;
61
+ export declare function fetchQmSchema(qmModel: string, options?: DataViewerHttpRequestOptions): Promise<ColumnSchema[]>;
61
62
  /**
62
63
  * 直连查询数据(无需提前创建 queryId)
63
64
  *
64
65
  * 适用于生成组件的标准用法:只需 qmModel + 分页/筛选/排序/列集合即可查询。
65
66
  * 现有 fetchQueryData(model, queryId, request) 保留给 DataViewer / SavedQuery 场景。
66
67
  */
67
- export declare function fetchQueryDataDirect(qmModel: string, request: ViewerQueryRequest): Promise<ViewerDataResponse>;
68
+ export declare function fetchQueryDataDirect(qmModel: string, request: ViewerQueryRequest, options?: DataViewerHttpRequestOptions): Promise<ViewerDataResponse>;
68
69
  /**
69
70
  * 获取前端元数据契约 (frontend-meta v1)
70
71
  *
71
72
  * 返回面向前端渲染的标准元数据:fields 为有序数组、包含 memberLookup/category/uiHints。
72
73
  */
73
- export declare function fetchFrontendMeta(qmModel: string): Promise<FrontendMeta>;
74
+ export declare function fetchFrontendMeta(qmModel: string, options?: DataViewerHttpRequestOptions): Promise<FrontendMeta>;
74
75
  /**
75
76
  * 查询维度成员(远程搜索、分页、回填)
76
77
  *
77
78
  * 用于 SelectFilter 的 dimension 远程模式,替代旧的 fetchFilterOptions。
78
79
  * DSL slice 应使用返回的 selectionFieldName,而非 displayFieldName。
79
80
  */
80
- export declare function fetchMemberOptions(request: MemberQueryRequest): Promise<MemberQueryResponse>;
81
+ export declare function fetchMemberOptions(request: MemberQueryRequest, options?: DataViewerHttpRequestOptions): Promise<MemberQueryResponse>;
@@ -67,6 +67,8 @@ type __VLS_Slots = {
67
67
  row: Record<string, unknown>;
68
68
  column: EnhancedColumnSchema;
69
69
  value: unknown;
70
+ rawValue: unknown;
71
+ displayValue: string;
70
72
  }) => unknown;
71
73
  /** 自定义过滤器 */
72
74
  [key: `filter-${string}`]: (props: {
@@ -82,7 +84,7 @@ interface ClearSelectionOptions {
82
84
  }
83
85
  declare function clearTableSelection(options?: ClearSelectionOptions): void;
84
86
  declare function getAllFilterSlices(): SliceRequestDef[];
85
- declare function updateFilter(columnName: string, value: SliceRequestDef[] | null): void;
87
+ declare function setRawFilter(columnName: string, value: SliceRequestDef[] | null): void;
86
88
  declare function resetPagination(): void;
87
89
  declare function clearFilters(): void;
88
90
  declare const __VLS_component: import("vue").DefineComponent<Props, {
@@ -91,7 +93,7 @@ declare const __VLS_component: import("vue").DefineComponent<Props, {
91
93
  /** 获取当前过滤状态 (DSL slices) */
92
94
  getFilters: typeof getAllFilterSlices;
93
95
  /** 设置过滤值 */
94
- setFilter: typeof updateFilter;
96
+ setFilter: typeof setRawFilter;
95
97
  /** 获取 vxe-grid 实例 */
96
98
  getGridInstance: () => VxeGridInstance;
97
99
  /** 获取当前选中行数组 */
@@ -1,4 +1,4 @@
1
- import type { SliceRequestDef, MemberQueryRequest, MemberQueryResponse } from '@/types';
1
+ import type { FieldExtData, SliceRequestDef, MemberQueryRequest, MemberQueryResponse } from '@/types';
2
2
  /**
3
3
  * QueryPanel - 传统查询区组件
4
4
  *
@@ -21,6 +21,7 @@ export interface QueryFieldSchema {
21
21
  order?: number;
22
22
  span?: number;
23
23
  visible?: boolean;
24
+ extData?: FieldExtData;
24
25
  }
25
26
  export interface QueryPanelLayoutSchema {
26
27
  mode?: 'grid';
@@ -59,11 +60,12 @@ interface Props {
59
60
  qmModel?: string;
60
61
  }
61
62
  declare function handleSearch(): void;
63
+ declare function getRawSlices(): SliceRequestDef[];
62
64
  declare function handleReset(): void;
63
65
  declare const _default: import("vue").DefineComponent<Props, {
64
66
  search: typeof handleSearch;
65
67
  reset: typeof handleReset;
66
- getSlices: () => SliceRequestDef[];
68
+ getSlices: typeof getRawSlices;
67
69
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
68
70
  search: () => any;
69
71
  reset: () => any;
@@ -26,12 +26,13 @@ interface Props {
26
26
  /** QM 模型名称(远程成员加载所需) */
27
27
  qmModel?: string;
28
28
  }
29
+ declare function getRawFilterSlices(): SliceRequestDef[];
29
30
  declare function handleReset(): void;
30
31
  declare const _default: import("vue").DefineComponent<Props, {
31
32
  /** 清空所有筛选 */
32
33
  clearFilters: typeof handleReset;
33
34
  /** 获取当前筛选条件 */
34
- getFilters: () => SliceRequestDef[];
35
+ getFilters: typeof getRawFilterSlices;
35
36
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
36
37
  search: () => any;
37
38
  reset: () => any;
@@ -12,5 +12,5 @@ export declare function useTableSummary(columns: Ref<ColumnSchema[]>): {
12
12
  type?: string;
13
13
  }[], selectedSummary: Record<string, unknown>, fallbackTotal?: number) => (string | number | null)[][];
14
14
  setServerSummary: (data: Record<string, unknown> | null) => void;
15
- formatValue: (value: unknown, type?: string) => string;
15
+ formatValue: (value: unknown, typeOrColumn?: string | ColumnSchema) => string;
16
16
  };