@steedos-widgets/amis-object 6.10.52-beta.9 → 6.10.52

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/dist/assets.json CHANGED
@@ -3,8 +3,8 @@
3
3
  {
4
4
  "package": "@steedos-widgets/amis-object",
5
5
  "urls": [
6
- "https://unpkg.com/@steedos-widgets/amis-object@6.10.52-beta.9/dist/amis-object.umd.js",
7
- "https://unpkg.com/@steedos-widgets/amis-object@6.10.52-beta.9/dist/amis-object.umd.css"
6
+ "https://unpkg.com/@steedos-widgets/amis-object@6.10.52/dist/amis-object.umd.js",
7
+ "https://unpkg.com/@steedos-widgets/amis-object@6.10.52/dist/amis-object.umd.css"
8
8
  ],
9
9
  "library": "BuilderAmisObject"
10
10
  }
@@ -15,10 +15,10 @@
15
15
  "npm": {
16
16
  "package": "@steedos-widgets/amis-object"
17
17
  },
18
- "url": "https://unpkg.com/@steedos-widgets/amis-object@6.10.52-beta.9/dist/meta.js",
18
+ "url": "https://unpkg.com/@steedos-widgets/amis-object@6.10.52/dist/meta.js",
19
19
  "urls": {
20
- "default": "https://unpkg.com/@steedos-widgets/amis-object@6.10.52-beta.9/dist/meta.js",
21
- "design": "https://unpkg.com/@steedos-widgets/amis-object@6.10.52-beta.9/dist/meta.js"
20
+ "default": "https://unpkg.com/@steedos-widgets/amis-object@6.10.52/dist/meta.js",
21
+ "design": "https://unpkg.com/@steedos-widgets/amis-object@6.10.52/dist/meta.js"
22
22
  }
23
23
  }
24
24
  ]
@@ -0,0 +1,137 @@
1
+ import React from 'react';
2
+ import './ApprovalTreeMenu.css';
3
+ /**
4
+ * 接口返回的原始菜单项数据结构(来自 /api/approve_workflow/workflow/nav)
5
+ *
6
+ * 接口实际返回字段:
7
+ * - label → 节点显示名称
8
+ * - tag → 角标数字
9
+ * - value → 路由地址(同时也用作节点唯一 key)
10
+ * - options.to → 备用路由地址
11
+ * - icon, unfolded, children 字段名与代码一致
12
+ */
13
+ export interface NavItem {
14
+ /** 节点显示名称(接口字段) */
15
+ label?: string;
16
+ /** 角标数字(接口字段) */
17
+ tag?: number;
18
+ /** 路由地址,同时作为节点唯一标识(接口字段) */
19
+ value?: string;
20
+ /** 扩展选项,含备用路由 to 等(接口字段) */
21
+ options?: {
22
+ to?: string;
23
+ level?: number;
24
+ value?: string;
25
+ name?: string;
26
+ [key: string]: any;
27
+ };
28
+ /** 图标类型(FontAwesome类名或自定义类型字符串) */
29
+ icon?: string;
30
+ /** 是否默认展开 */
31
+ unfolded?: boolean;
32
+ /** 子菜单项 */
33
+ children?: NavItem[];
34
+ /** @deprecated 使用 label 代替 */
35
+ name?: string;
36
+ /** @deprecated 使用 tag 代替 */
37
+ badge?: number;
38
+ /** @deprecated 使用 value 代替 */
39
+ url?: string;
40
+ /** @deprecated 使用 value 代替 */
41
+ _id?: string;
42
+ /** 角标颜色:'red' | 'blue' | 'gray' */
43
+ badgeColor?: 'red' | 'blue' | 'gray';
44
+ /** 节点类型(group/category/workflow/leaf等) */
45
+ type?: string;
46
+ /** 其他额外字段 */
47
+ [key: string]: any;
48
+ }
49
+ /**
50
+ * onSelect 回调函数参数
51
+ */
52
+ export interface SelectInfo {
53
+ /** 选中的路由地址 */
54
+ url: string;
55
+ /** 原始菜单项数据 */
56
+ data: NavItem;
57
+ /** 选中的 key */
58
+ key: string;
59
+ }
60
+ /**
61
+ * ApprovalTreeMenu 组件 Props
62
+ */
63
+ export interface ApprovalTreeMenuProps {
64
+ /**
65
+ * 当前应用 ID(可选)。用于跨应用集成时,将菜单 URL 中的 approve_workflow 替换为当前应用 code。
66
+ *
67
+ * 取值优先级:
68
+ * 1. 显式传入的 appId prop(优先级最高)
69
+ * 2. amis 作用域自动注入的 data.context.appId(推荐,无需额外配置)
70
+ *
71
+ * 如果都未提供,则不做 URL 替换,保持原有行为。
72
+ * 仅在非审批中心应用中集成时才会触发 URL 替换逻辑。
73
+ */
74
+ appId?: string;
75
+ /**
76
+ * 接口地址(可选)。
77
+ * 推荐不配置,组件会自动根据 resolvedAppId 拼接:`/api/${appId}/workflow/nav`
78
+ * @deprecated 组件内部会自动根据 appId 拼接,无需手动传入
79
+ */
80
+ apiUrl?: string;
81
+ /**
82
+ * 外部控制的选中项 key(唯一标识)
83
+ */
84
+ selectedKey?: string;
85
+ /**
86
+ * 选中节点时的回调,返回路由地址和原始数据
87
+ */
88
+ onSelect?: (info: SelectInfo) => void;
89
+ /**
90
+ * 路由跳转方式:
91
+ * - 'location': 使用 window.location.href 跳转
92
+ * - 'router': 使用 window.navigate 进行 SPA 路由跳转(默认)
93
+ * - 'postMessage': 通过 window.postMessage 通知父框架
94
+ * - 'none': 不自动跳转,仅触发 onSelect 回调
95
+ */
96
+ navigateMode?: 'location' | 'router' | 'postMessage' | 'none';
97
+ /**
98
+ * 自定义样式
99
+ */
100
+ style?: React.CSSProperties;
101
+ /**
102
+ * 自定义 className
103
+ */
104
+ className?: string;
105
+ /**
106
+ * 自定义请求头,用于认证(可选,默认会自动从 Builder.settings 或 localStorage 读取)
107
+ */
108
+ headers?: Record<string, string>;
109
+ data?: any;
110
+ env?: any;
111
+ }
112
+ /**
113
+ * ApprovalTreeMenu - 审批中心左侧树菜单组件
114
+ *
115
+ * 功能:
116
+ * - 从接口 /api/approve_workflow/workflow/nav 动态获取菜单数据
117
+ * - 使用 antd Tree 组件渲染,支持多层嵌套结构
118
+ * - 图标支持 FontAwesome icon 名称映射到 antd icon
119
+ * - 角标数字,颜色支持红色、蓝色、灰色
120
+ * - 支持选中高亮、折叠展开
121
+ * - 支持外部 selectedKey 控制选中项
122
+ * - 支持 onSelect 回调(返回路由地址和原始数据)
123
+ * - 支持 SPA 路由跳转(window.navigate)
124
+ * - 支持根据当前 URL 自动匹配选中菜单项
125
+ * - 支持监听 ROUTE_CHANGE postMessage 实现路由变化同步选中
126
+ * - 支持监听 approval-tree-menu:reload postMessage 外部触发数据刷新
127
+ *
128
+ * @example
129
+ * ```tsx
130
+ * <ApprovalTreeMenu
131
+ * onSelect={({ url, data }) => console.log('selected:', url, data)}
132
+ * navigateMode="router"
133
+ * />
134
+ * ```
135
+ */
136
+ export declare const ApprovalTreeMenu: React.FC<ApprovalTreeMenuProps>;
137
+ export default ApprovalTreeMenu;
@@ -0,0 +1,38 @@
1
+ import React from 'react';
2
+ interface MobileDrawerProps {
3
+ visible: boolean;
4
+ multiple: boolean;
5
+ loading: boolean;
6
+ users: any[];
7
+ searchKeyword: string;
8
+ searchInputValue: string;
9
+ tempSelectedUsers: any[];
10
+ clearable: boolean;
11
+ rootDeptInfo: {
12
+ id: string;
13
+ name: string;
14
+ } | null;
15
+ deptPath: Array<{
16
+ id: string;
17
+ name: string;
18
+ }>;
19
+ currentLevelDepts: any[];
20
+ showSelectedPanel: boolean;
21
+ onDrillDown: (deptId: string, deptName: string) => void;
22
+ onMobileBack: () => void;
23
+ onDrillBack: (targetIndex: number) => void;
24
+ onBackToRoot: () => void;
25
+ onToggleSelectedPanel: () => void;
26
+ onUserSearch: (value: string) => void;
27
+ onAddUser: (user: any) => void;
28
+ onRemoveUser: (userId: string) => void;
29
+ onToggleUser: (user: any) => void;
30
+ onToggleSelectAll: () => void;
31
+ onReorderUsers: (fromIndex: number, toIndex: number) => void;
32
+ onOk: () => void;
33
+ onCancel: () => void;
34
+ onClearAll: () => void;
35
+ zIndex?: number;
36
+ }
37
+ export declare const MobileDrawerContent: React.FC<MobileDrawerProps>;
38
+ export {};
@@ -0,0 +1,32 @@
1
+ import React from 'react';
2
+ import type { UploadFile } from 'antd/es/upload/interface';
3
+ interface SteedosFileUploadProps {
4
+ /** 上传接口 URL */
5
+ action?: string;
6
+ /** 额外的请求头 */
7
+ headers?: Record<string, string>;
8
+ /** 上传时附带的额外 formData 参数 */
9
+ extraData?: Record<string, string>;
10
+ /** 是否支持多文件 */
11
+ multiple?: boolean;
12
+ /** 最大文件数量 */
13
+ maxCount?: number;
14
+ /** 按钮文字 */
15
+ btnLabel?: string;
16
+ /** 标签 */
17
+ label?: string;
18
+ /** 上传成功回调 */
19
+ onUploadSuccess?: (file: UploadFile, response: any) => void;
20
+ /** 上传失败回调 */
21
+ onUploadError?: (file: UploadFile, error: any) => void;
22
+ /** amis 相关 props */
23
+ dispatchEvent?: (eventName: string, data: any, ref: any) => Promise<any>;
24
+ data?: any;
25
+ name?: string;
26
+ style?: React.CSSProperties;
27
+ className?: string;
28
+ disabled?: boolean;
29
+ [key: string]: any;
30
+ }
31
+ export declare const SteedosFileUpload: React.FC<SteedosFileUploadProps>;
32
+ export {};
@@ -1,14 +1,25 @@
1
1
  import React from 'react';
2
+ interface OrgValueItem {
3
+ id: string;
4
+ name: string;
5
+ fullname: string;
6
+ }
2
7
  interface DeptGroupSelectorProps {
3
- value?: string | string[];
4
- onChange?: (value: string | string[]) => void;
8
+ name?: string;
9
+ value?: OrgValueItem | OrgValueItem[] | string | string[];
10
+ onChange?: (value: OrgValueItem | OrgValueItem[] | string | string[] | null) => void;
5
11
  multiple?: boolean;
12
+ valueFormat?: 'string' | 'object';
6
13
  placeholder?: string;
7
14
  fetchDeptTree?: (parentId?: string, keyword?: string) => Promise<any[]>;
8
15
  style?: React.CSSProperties;
9
- dispatchEvent?: (eventName: string, data: any, ref: any) => void;
10
- onEvent: any;
16
+ dispatchEvent?: (eventName: string, data: any, ref: any) => Promise<void>;
17
+ onEvent?: any;
11
18
  data?: any;
19
+ clearable?: boolean;
20
+ readonly?: boolean;
21
+ disabled?: boolean;
22
+ [key: string]: any;
12
23
  }
13
24
  export declare const SteedosOrgSelector: React.FC<DeptGroupSelectorProps>;
14
25
  export {};
@@ -1,14 +1,18 @@
1
1
  import React from 'react';
2
2
  interface UserSelectorProps {
3
- value?: string | string[];
4
- onChange?: (value: string | string[]) => void;
3
+ value?: any | any[];
4
+ onChange?: (value: any) => void;
5
5
  multiple?: boolean;
6
+ valueFormat?: 'string' | 'object';
6
7
  placeholder?: string;
7
8
  fetchUsers?: (organizationId?: string, keyword?: string) => Promise<any[]>;
8
9
  fetchDeptTree?: (parentId?: string, keyword?: string) => Promise<any[]>;
9
10
  style?: React.CSSProperties;
10
11
  dispatchEvent?: (eventName: string, data: any, ref: any) => Promise<void>;
11
12
  data?: any;
13
+ clearable?: boolean;
14
+ readonly?: boolean;
15
+ disabled?: boolean;
12
16
  [key: string]: any;
13
17
  }
14
18
  export declare const SteedosUserSelector: React.FC<UserSelectorProps>;
@@ -12,3 +12,5 @@ export * from './SteedosFieldSet';
12
12
  export * from './SteedosObject';
13
13
  export * from './SteedosOrgSelector';
14
14
  export * from './SteedosUserSelector';
15
+ export * from './ApprovalTreeMenu';
16
+ export * from './SteedosFileUpload';