@mxmweb/xviewer 1.3.2 → 1.4.6

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/lib_enter.d.ts CHANGED
@@ -23,6 +23,9 @@ declare type AppFn = {
23
23
  addSubTable: (parentId: string) => void;
24
24
  deleteSubTable: (parentId: string) => void;
25
25
  removeSubTableRow: (id: string, tableId: string) => void;
26
+ /** 主表 loading 控制(通用暴露,业务层网络请求可用) */
27
+ startTableLoading?: (timeoutMs?: number, minDurationMs?: number) => void;
28
+ finishTableLoading?: () => void;
26
29
  };
27
30
 
28
31
  declare interface AppStatusManager {
@@ -56,7 +59,7 @@ export declare interface CustomComponents {
56
59
  EmptyData?: default_2.ComponentType<any>;
57
60
  }
58
61
 
59
- declare type DataSource = TableDataItem[] | CardDataItem[] | FormDataItem[] | default_2.ReactElement | undefined;
62
+ declare type DataSource = TableDataItem[] | CardDataItem[] | FormDataItem[] | ListItem[] | default_2.ReactElement | undefined;
60
63
 
61
64
  declare interface DynamicDashDataCoreRef {
62
65
  appFn: AppFn;
@@ -88,6 +91,60 @@ declare interface FormDataItem {
88
91
  [key: string]: any;
89
92
  }
90
93
 
94
+ declare type HeaderItem = HeaderItemCustomized;
95
+
96
+ declare type HeaderItemBase = {
97
+ key: string;
98
+ /** header 位置,默认 left;left/right 分别占据两侧容器 */
99
+ position?: 'left' | 'right';
100
+ };
101
+
102
+ declare type HeaderItemCustomized = HeaderItemBase & {
103
+ type: 'customized';
104
+ /**
105
+ * 自定义组件:
106
+ * - React 组件类型
107
+ * - JSX 元素
108
+ * - 字符串 key(通过 styles.customizeComponents 注册表解析)
109
+ */
110
+ component: default_2.ComponentType<any> | default_2.ReactElement | string;
111
+ /**
112
+ * 组件 props:
113
+ * - 对象:静态 props
114
+ * - 函数:根据上下文动态计算 props(如 viewId / appFn)
115
+ */
116
+ componentProps?: Record<string, any> | ((ctx: {
117
+ viewId: string;
118
+ appFn: AppFn;
119
+ }) => Record<string, any>);
120
+ };
121
+
122
+ declare interface ListItem {
123
+ id: string;
124
+ type: 'text' | 'image' | 'customized' | string;
125
+ content?: string;
126
+ title?: string;
127
+ description?: string;
128
+ imageUrl?: string;
129
+ imageAlt?: string;
130
+ actions?: Array<{
131
+ key: string;
132
+ label: string;
133
+ icon?: default_2.ReactNode;
134
+ disabled?: boolean;
135
+ [key: string]: any;
136
+ }>;
137
+ selectable?: boolean;
138
+ draggable?: boolean;
139
+ size?: 'sm' | 'md' | 'lg';
140
+ spacing?: 'tight' | 'normal' | 'loose';
141
+ className?: string;
142
+ style?: default_2.CSSProperties;
143
+ component?: default_2.ReactElement | default_2.ComponentType<any>;
144
+ componentProps?: Record<string, any>;
145
+ [key: string]: any;
146
+ }
147
+
91
148
  declare interface TableDataItem {
92
149
  id: string;
93
150
  [key: string]: any;
@@ -107,6 +164,8 @@ declare type ToolbarItem = {
107
164
  onAction: (action: string, data: any) => void;
108
165
  [key: string]: any;
109
166
  }>;
167
+ /** customized 组件的额外 props(如 role 等)*/
168
+ componentProps?: Record<string, any>;
110
169
  searchKeys?: (string | string[])[];
111
170
  btnType?: 'primary' | 'default' | 'error' | 'text';
112
171
  disabled?: boolean;
@@ -123,7 +182,7 @@ declare interface ViewType {
123
182
  label: string;
124
183
  icon?: default_2.ReactNode;
125
184
  id: string;
126
- type?: 'table' | 'form' | 'card' | 'customized' | 'timeline' | 'column' | string;
185
+ type?: 'table' | 'form' | 'card' | 'customized' | 'timeline' | 'column' | 'list' | string;
127
186
  columns?: Array<{
128
187
  title: string;
129
188
  id: string;
@@ -139,6 +198,15 @@ declare interface ViewType {
139
198
  formConfig?: any;
140
199
  formWidth?: string;
141
200
  toolbar?: ToolbarItem[];
201
+ /** 视图头部:渲染在 toolbar 下方、内容区域上方(仅 table/card/form 等叶子节点生效) */
202
+ header?: HeaderItem[];
203
+ /**
204
+ * 视图头部高度规格(用于高度计算,固定像素):
205
+ * - 'sm':小高度,一行紧凑面包屑
206
+ * - 'md':默认高度
207
+ * - 'lg':较高,可容纳两行内容
208
+ */
209
+ headerSize?: 'sm' | 'md' | 'lg';
142
210
  allowMultiSelect?: boolean;
143
211
  size?: 'sm' | 'md';
144
212
  total?: number;
@@ -148,6 +216,14 @@ declare interface ViewType {
148
216
  paginationLocale?: 'zh' | 'en' | 'ja';
149
217
  /** 分页文案覆盖(可选) */
150
218
  paginationMessages?: Record<string, string>;
219
+ /** 表格空数据提示文案(表头下展示,参考 antd Table) */
220
+ emptyText?: string;
221
+ /** 表格空数据提示组件(自定义 React 节点或组件,组件可接收 { description?: string }) */
222
+ emptyComponent?: default_2.ReactNode | default_2.ComponentType<{
223
+ description?: string;
224
+ }>;
225
+ listLayout?: 'vertical' | 'horizontal';
226
+ listItems?: ListItem[];
151
227
  }
152
228
 
153
229
  export declare const Xviwer: default_2.ForwardRefExoticComponent<Omit<DynamicDashView, "ref"> & default_2.RefAttributes<DynamicDashDataCoreRef>>;
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "style": "assets/style.css",
6
6
  "types": "lib_enter.d.ts",
7
7
  "private": false,
8
- "version": "1.3.2",
8
+ "version": "1.4.6",
9
9
  "author": "hanfeng_Zhang",
10
10
  "type": "module",
11
11
  "peerDependencies": {