urit-qf-ui 0.2.0 → 0.2.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.
@@ -91,12 +91,41 @@ export interface TableApi {
91
91
  export?: string;
92
92
  }
93
93
  export interface TableDetail {
94
- position: 'left' | 'right' | 'top';
95
- formId: string;
94
+ enable?: boolean | string | number;
95
+ position?: 'left' | 'right' | 'top';
96
+ width?: number | string;
97
+ formId?: string;
98
+ }
99
+ export type TableButtonAction = 'add' | 'edit' | 'delete' | 'preview' | 'back';
100
+ export type TableButtonStyle = '' | 'default' | 'primary' | 'success' | 'warning' | 'info' | 'danger' | 'text';
101
+ export interface TableButton {
102
+ action: TableButtonAction | string;
103
+ form?: string;
104
+ text?: string;
105
+ style?: TableButtonStyle | string;
106
+ icon?: string;
107
+ confirm?: string;
108
+ url?: string;
109
+ disabled?: boolean;
110
+ }
111
+ export type ToolbarItem = TableButton;
112
+ export type TableActionItem = TableButton;
113
+ export interface TableActionPayload {
114
+ action: string;
115
+ item: TableButton;
116
+ row?: any;
96
117
  }
97
- export interface TableActions {
98
- edit?: string | false;
99
- delete?: string | false;
118
+ export interface TableConfig {
119
+ meta: TableMeta;
120
+ key?: string;
121
+ form?: string;
122
+ api: TableApi;
123
+ pagination?: 'page' | 'auto' | 'all';
124
+ detail?: TableDetail;
125
+ actions?: TableActionItem[];
126
+ toolbar?: ToolbarItem[];
127
+ search?: SearchField[];
128
+ columns: TableColumn[];
100
129
  }
101
130
  export interface SearchField {
102
131
  field: string;
@@ -123,32 +152,6 @@ export interface TableColumn {
123
152
  multiline?: boolean;
124
153
  defaultText?: string;
125
154
  }
126
- export interface ToolbarBuiltin {
127
- type: 'create' | 'import' | 'export' | 'edit' | 'delete';
128
- text?: string;
129
- icon?: string;
130
- primary?: boolean;
131
- }
132
- export interface ToolbarCustom {
133
- text: string;
134
- url: string;
135
- primary?: boolean;
136
- icon?: string;
137
- confirm?: string;
138
- }
139
- export type ToolbarItem = ToolbarBuiltin | ToolbarCustom;
140
- export interface TableConfig {
141
- meta: TableMeta;
142
- key?: string;
143
- form?: string;
144
- api: TableApi;
145
- pagination?: 'page' | 'auto' | 'all';
146
- detail?: TableDetail;
147
- actions?: TableActions;
148
- toolbar?: ToolbarItem[];
149
- search?: SearchField[];
150
- columns: TableColumn[];
151
- }
152
155
  export interface ListResponse {
153
156
  rows: any[];
154
157
  total: number;
@@ -157,11 +160,14 @@ export interface Pagination {
157
160
  page: number;
158
161
  pageSize: number;
159
162
  }
160
- export type MenuJumpType = 'route' | 'url' | 'yaml';
163
+ export type MenuJumpType = 'route' | 'url' | 'form' | 'table' | 'menu';
164
+ export type MenuOpenType = 'new' | 'self';
161
165
  export interface MenuItem {
162
166
  label: string;
163
167
  type?: MenuJumpType;
164
168
  path?: string;
169
+ id?: string;
170
+ open?: MenuOpenType;
165
171
  icon?: string;
166
172
  children?: MenuItem[];
167
173
  [key: string]: any;
@@ -186,7 +192,8 @@ export interface MenuClickPayload {
186
192
  path: string;
187
193
  route?: string;
188
194
  url?: string;
189
- fileId?: string;
195
+ open?: MenuOpenType;
196
+ id?: string;
190
197
  item: MenuItem;
191
198
  level: number;
192
199
  indexPath: string[];
@@ -1,5 +1,5 @@
1
1
  import { TableDataService } from './table-data-service';
2
- import { Pagination, SearchField, TableConfig } from './model';
2
+ import { Pagination, SearchField, TableButton, TableConfig } from './model';
3
3
  export declare class TableRenderData {
4
4
  tableConfig: TableConfig | null;
5
5
  rows: any[];
@@ -7,10 +7,12 @@ export declare class TableRenderData {
7
7
  loading: boolean;
8
8
  searchParams: Record<string, any>;
9
9
  pagination: Pagination;
10
- selectedRows: any[];
10
+ currentRow: any;
11
11
  detailVisible: boolean;
12
12
  detailData: any;
13
13
  detailLoading: boolean;
14
+ previewVisible: boolean;
15
+ previewRow: any;
14
16
  }
15
17
  export declare class TableRender {
16
18
  data: TableRenderData;
@@ -27,6 +29,11 @@ export declare class TableRender {
27
29
  * 获取列表数据
28
30
  */
29
31
  loadData(): Promise<void>;
32
+ /**
33
+ * 刷新后同步当前行 / 详情行 / 预览行的引用
34
+ * 按主键在最新 rows 里找同一条记录;找不到(被删了或翻页了)就清空
35
+ */
36
+ private syncRowRefs;
30
37
  /**
31
38
  * 搜索
32
39
  */
@@ -40,13 +47,13 @@ export declare class TableRender {
40
47
  */
41
48
  updateSearchParam(key: string, value: any): void;
42
49
  /**
43
- * 删除单行
50
+ * 删除一行(删除成功后:刷新 + 清空当前行/详情/预览)
44
51
  */
45
52
  deleteRow(row: any): Promise<void>;
46
53
  /**
47
- * 批量删除
54
+ * 判断两行是否同一条记录(按主键比对)
48
55
  */
49
- batchDelete(): Promise<void>;
56
+ isSameRow(a: any, b: any): boolean;
50
57
  /**
51
58
  * 切换分页
52
59
  */
@@ -56,9 +63,18 @@ export declare class TableRender {
56
63
  */
57
64
  changePageSize(pageSize: number): Promise<void>;
58
65
  /**
59
- * 选择行
66
+ * 设置当前行(点击表格行时调用)
67
+ * 同时驱动详情区展示
68
+ */
69
+ setCurrentRow(row: any): void;
70
+ /**
71
+ * 获取当前行
60
72
  */
61
- updateSelection(rows: any[]): void;
73
+ getCurrentRow(): any;
74
+ /**
75
+ * 当前行主键值(用于表格行高亮)
76
+ */
77
+ getCurrentKey(): any;
62
78
  /**
63
79
  * 导出数据
64
80
  */
@@ -85,21 +101,54 @@ export declare class TableRender {
85
101
  getDetailFormId(): string | undefined;
86
102
  /**
87
103
  * 是否显示详情
88
- * detail 配置必须包含 formId 或 position 才视为有效,避免空对象误判
104
+ * 判定顺序:
105
+ * enable === false → 不显示
106
+ * enable === true → 显示(固定侧栏模式)
107
+ * enable 为其它非空值 → 显示(抽屉模式)
108
+ * enable 未配置 → 兼容旧配置:写了 formId 或 position 才显示
89
109
  */
90
110
  hasDetail(): boolean;
111
+ /**
112
+ * 详情是否固定显示在表格一侧(detail.enable === true)
113
+ */
114
+ isDetailInline(): boolean;
115
+ /**
116
+ * 详情展示模式
117
+ * inline —— 固定侧栏;drawer —— 抽屉浮层
118
+ */
119
+ getDetailMode(): 'inline' | 'drawer';
120
+ /**
121
+ * 详情位置(固定侧栏只支持左右)
122
+ */
123
+ getDetailPosition(): 'left' | 'right' | 'top';
124
+ /**
125
+ * 详情宽度:数字按 px 处理,字符串原样使用,默认 400px
126
+ */
127
+ getDetailWidth(): string;
128
+ /**
129
+ * 抽屉弹出方向(el-drawer direction)
130
+ */
131
+ getDetailDirection(): 'ltr' | 'rtl' | 'ttb' | 'btt';
132
+ /**
133
+ * 详情是否处于展示中(固定侧栏模式常驻显示)
134
+ */
135
+ isDetailOpen(): boolean;
91
136
  /**
92
137
  * 打开详情
93
138
  */
94
139
  openDetail(row: any): void;
95
140
  /**
96
- * 关闭详情
141
+ * 关闭详情(固定侧栏模式下仅清空内容)
97
142
  */
98
143
  closeDetail(): void;
99
144
  /**
100
- * 是否显示工具栏批量操作(需要选择框)
145
+ * 打开预览抽屉(action: preview)
101
146
  */
102
- showSelection(): boolean;
147
+ openPreview(row: any): void;
148
+ /**
149
+ * 关闭预览抽屉
150
+ */
151
+ closePreview(): void;
103
152
  /**
104
153
  * 获取搜索字段配置
105
154
  */
@@ -109,13 +158,30 @@ export declare class TableRender {
109
158
  */
110
159
  getColumns(): import('./model').TableColumn[];
111
160
  /**
112
- * 获取工具栏配置
161
+ * 是否有搜索区(yaml 里没有 search 节点则不显示)
162
+ */
163
+ hasSearch(): boolean;
164
+ /**
165
+ * 获取工具栏配置(yaml 里没有 toolbar 节点则不显示)
166
+ */
167
+ getToolbar(): TableButton[];
168
+ /**
169
+ * 是否有工具栏
170
+ */
171
+ hasToolbar(): boolean;
172
+ /**
173
+ * 获取行操作配置(yaml 里没有 actions 节点则不显示操作列)
174
+ */
175
+ getActions(): TableButton[];
176
+ /**
177
+ * 是否有行操作按钮
113
178
  */
114
- getToolbar(): import('./model').ToolbarItem[];
179
+ hasActions(): boolean;
115
180
  /**
116
- * 获取行操作配置
181
+ * 取某个按钮实际使用的表单 id:按钮自己的 form 优先,否则用表格配置的 form
182
+ * 对应后端 config/forms/<form>.yaml
117
183
  */
118
- getActions(): import('./model').TableActions | undefined;
184
+ getButtonFormId(item: TableButton): string | undefined;
119
185
  /**
120
186
  * 获取分页方式
121
187
  */
@@ -1,15 +1,29 @@
1
1
  import { TableColumn } from '../ts/model';
2
2
  type __VLS_Props = {
3
- visible: boolean;
4
- loading?: boolean;
5
- position?: 'left' | 'right' | 'top';
3
+ showHeader?: boolean;
6
4
  title?: string;
5
+ loading?: boolean;
7
6
  rowData?: Record<string, any>;
8
7
  columns?: TableColumn[];
8
+ emptyText?: string;
9
9
  };
10
- declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
11
- close: () => any;
12
- }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
13
- onClose?: (() => any) | undefined;
14
- }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
10
+ declare function __VLS_template(): {
11
+ attrs: Partial<{}>;
12
+ slots: {
13
+ 'detail-extra'?(_: {
14
+ rowData: Record<string, any> | undefined;
15
+ columns: TableColumn[] | undefined;
16
+ }): any;
17
+ };
18
+ refs: {};
19
+ rootEl: HTMLDivElement;
20
+ };
21
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
22
+ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
23
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
15
24
  export default _default;
25
+ type __VLS_WithTemplateSlots<T, S> = T & {
26
+ new (): {
27
+ $slots: S;
28
+ };
29
+ };
@@ -1,30 +1,39 @@
1
- import { TableColumn } from '../ts/model';
1
+ import { TableActionPayload, TableButton, TableColumn } from '../ts/model';
2
2
  type __VLS_Props = {
3
3
  rows: any[];
4
4
  columns: TableColumn[];
5
5
  loading: boolean;
6
- actions?: {
7
- edit?: string | false;
8
- delete?: string | false;
9
- };
10
- formId?: string;
11
- apiDelete?: string;
6
+ actions?: TableButton[];
12
7
  keyField?: string;
13
8
  selection?: 'single' | 'multiple' | boolean;
14
9
  dictData?: Record<string, Array<{
15
10
  label: string;
16
11
  value: any;
17
12
  }>>;
13
+ activeKey?: string | number | null;
18
14
  };
19
- declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
20
- selectionChange: (rows: any[]) => any;
21
- rowEdit: (row: any) => any;
22
- rowDelete: (row: any) => any;
15
+ declare function __VLS_template(): {
16
+ attrs: Partial<{}>;
17
+ slots: Partial<Record<string, (_: any) => any>> & {
18
+ default?(_: {}): any;
19
+ };
20
+ refs: {};
21
+ rootEl: any;
22
+ };
23
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
24
+ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
25
+ rowAction: (payload: TableActionPayload) => any;
23
26
  rowClick: (row: any) => any;
27
+ selectionChange: (rows: any[]) => any;
24
28
  }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
25
- onSelectionChange?: ((rows: any[]) => any) | undefined;
26
- onRowEdit?: ((row: any) => any) | undefined;
27
- onRowDelete?: ((row: any) => any) | undefined;
29
+ onRowAction?: ((payload: TableActionPayload) => any) | undefined;
28
30
  onRowClick?: ((row: any) => any) | undefined;
29
- }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
31
+ onSelectionChange?: ((rows: any[]) => any) | undefined;
32
+ }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
33
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
30
34
  export default _default;
35
+ type __VLS_WithTemplateSlots<T, S> = T & {
36
+ new (): {
37
+ $slots: S;
38
+ };
39
+ };