UNPKG

dingtalk-jsapi

Version:

钉钉 模块化 多端统一 API

344 lines (343 loc) 11 kB
import "../entry/union"; declare enum EEmbeddedUINameEnum { LEAVEMESSAGE = "LeaveMessage" } export declare enum EResourcePickerItemType { /** 用户 */ USER = "USER", /** 部门 */ DEPARTMENT = "DEPARTMENT", /** 群聊 */ CONVERSATION = "CONVERSATION", /** 企业内用户 */ ORGUSER = "ORGUSER", /** 角色 */ ROLE = "ROLE", /** 邮箱 */ EMAIL = "EMAIL", /** 动态用户组 */ DYNAMICGROUP = "DYNAMICGROUP" } export declare enum EDataSourceId { /** 最近会话数据源 */ RECENT_CONVERSATION = "RecentConversation", /** 搜索数据源 */ SEARCH = "Search", /** 群里列表数据源 */ GROUP = "Group", /** 组织架构数据源 */ ORGANIZATION = "Organization", /** 批量导入数据源 */ BATCH_PHONE_ADD = "BatchPhoneAdd", /** 群内选人数据源 */ GROUPMEMBERS = "GroupMembers", /** 自定义用户数据源 */ CUSTOMUSERSDS = "CustomUsers" } export declare enum EPluginTypes { SelectItemDisabledPlugin = "selectItemDisabledPlugin", RoleSelectedPlugin = "roleSelectedPlugin", FilterSearchInternalGroupPlugin = "filterSearchInternalGroupPlugin", FilterTypePlugin = "filterTypePlugin", ShowRootOrgPlugin = "showRootOrgPlugin", REcentConvfilterGrouplugin = "RecentConvfilterGrouplugin", REcentConvfilterInternalGroupPlugin = "RecentConvfilterInternalGroupPlugin", REcentConvfilterSingleGroupPlugin = "RecentConvfilterSingleGroupPlugin", HideBreadCrumbPlugin = "hideBreadCrumbPlugin", GroupStatusPlugin = "groupStatusPlugin", LeaveOfficeSelectedPlugin = "leaveOfficeSelectedPlugin", RoleFilterPlugin = "roleFilterPlugin", OldRoleFilterPlugin = "oldRoleFilterPlugin", filterGroupOrgIdsPlugin = "filterGroupOrgIdsPlugin" } export interface IDeptIdDict { orgId?: string; corpId?: string; deptId: string; } export interface ISelectItemsModel { /** 已选的用户数组 */ uids?: string[]; /** 已选群聊id数组 */ cids?: string[]; /** 已选群聊数组*/ openConversationIds?: string[]; /** 已选的邮箱数组 */ emails?: string[]; /** 已选的角色数组 */ roleIds?: string[]; /** 已选的自定义数据数组 */ customDsIds?: any; /** 已选部门数组 */ deptIds?: IDeptIdDict[]; /** 已选组织内用户数组 */ orgStaffIds?: string[]; /** 已选动态用户组数组 */ groupIds?: string[]; } /** 数据源接口 */ export interface IPanelProps { /** 数据源id */ id: string; /** 数据源可选数据类型 */ types: EResourcePickerItemType[]; /** 数据源配置参数 */ props?: any; /** 数据源插件 */ pluginKeys?: Array<string | EPluginTypes>; viewInfo?: { iconUrl: string; name: string; }; } /** 已选数据设置 */ export interface ISelectConfig { /** 不可选数据设置 */ disabledItems?: ISelectItemsModel; /** 已选数据 */ selectedItems?: ISelectItemsModel; /** 必选数据 */ requiredItems?: ISelectItemsModel; /** 选择设置 */ selectOptions?: { /** 是否可以站看子级 */ canSelectSubNodes?: boolean; /** 是否隐藏必选数据 */ isHideRequiredItems?: boolean; }; } export interface IResourcePickerParams { /** 标题 */ title?: string; /** 组织id */ corpId: string; /** 最多选择数量,设置为1时为单选模式 */ maxCount?: number; /** 最少选择数量,默认为0 */ minCount?: number; /** 扩展模块,仅PC支持 */ embeddedUIName?: EEmbeddedUINameEnum; /** 扩展模块默认数据 */ embeddedUIDefaultData?: string; /** 是否由jsapi打开 */ fromJsAPi?: boolean; /** 已选数量司法计算部门内人数 */ cntDeptMembers?: boolean; /** 选择部门时,是否请求并返回部门里的员工 */ responseUserOnly?: boolean; /** 选人组件数据源框架 */ framework: { /** 当前数据源 */ currentPanel?: IRecentConversationDSType | IGroupMembersDSType | IGroupDSType | IOrganizationDSType | IBatchPhoneAddDSType | ICustomUsersDSType; /** 默认数据源面版 */ defaultPanel: IRecentConversationDSType | IGroupMembersDSType | IGroupDSType | IOrganizationDSType | IBatchPhoneAddDSType | ICustomUsersDSType; /** 可选数据源配置 */ navList?: (IRecentConversationDSType | IGroupMembersDSType | IGroupDSType | IOrganizationDSType | IBatchPhoneAddDSType | ICustomUsersDSType)[]; /** 搜索数据源配置 */ searchPanel?: ISearchDSType; isShowBtn?: boolean; }; /** 选择数据配置 */ select?: ISelectConfig; /** 扩展参数 */ [key: string]: any; } export interface IResourcePickerResult { selectedItem: { /** * 选择的用户数据 */ users?: Array<{ /** 头像地址 */ avatar: string; /** 名称 */ name: string; /** staffId */ emplId: string; /** 组织ID */ corpId: string; }>; /** * 选择的部门数据 */ departments?: Array<{ /** 部门人数 */ number: number; /** 部门名称 */ name: string; /** 部门id */ id: string; }>; /** * 选择的群聊数据 */ groups?: Array<{ /** 群头像 */ avatar: string; /** 群名称 */ name: string; /** 群id */ openConversationId: string; }>; /** * 选择的角色数据 */ roles?: Array<{ /** 角色名称 */ name: string; /** 角色ID */ roleId: string; }>; /** * 选择的动态用户数据 */ dynamicGroups?: Array<{ /** 动态用户组名称 */ name: string; /** 动态用户组id */ groupId: string; /** 动态用户组人员数量 */ number: number; }>; /** * 选择的邮箱数据 */ emails?: Array<{ /** 邮箱地址 */ email: string; }>; /** * 选择的扩展数据 */ customItems?: Array<any>; }; embeddedData: any; } /** 最近会话/群聊接口 */ export interface IRecentConversationDSType extends IPanelProps { /** 数据源id */ id: EDataSourceId.RECENT_CONVERSATION | EDataSourceId.GROUP; /** 可选数据类型 */ types: (EResourcePickerItemType.CONVERSATION | EResourcePickerItemType.USER)[]; props?: { /** 加载数量,最大1000,默认50 */ count?: number; /** 分页展示 默认 50 */ size?: number; /** 是否可以选择群内成员,默认 false */ selectGroupMembers?: number; /** 过滤最近会话类型 显示类型过滤,1只显示群聊,2只显示单聊 */ filterConvType?: number[]; /** 群状态设置 */ groupStatus?: { /** 是否显示checkbox */ isSelectable: false; /** 是否不可选择*/ isDisabled: true; }; /** 过滤指定组织下的会话 */ filterCorpIds?: string[]; }; pluginKeys?: (EPluginTypes.GroupStatusPlugin | EPluginTypes.REcentConvfilterSingleGroupPlugin | EPluginTypes.REcentConvfilterGrouplugin | EPluginTypes.filterGroupOrgIdsPlugin)[]; } /** 搜索数据源参数 */ export interface ISearchDSType extends IPanelProps { /** 数据源id */ id: EDataSourceId.SEARCH; types: (EResourcePickerItemType.CONVERSATION /** 搜索用户 */ | EResourcePickerItemType.ORGUSER /** 搜索邮箱 */ | EResourcePickerItemType.EMAIL /** 搜索部门 */ | EResourcePickerItemType.DEPARTMENT)[]; props?: { orgIds?: string[]; corpIds?: string[]; size?: number; customOptions?: {}; }; } /** 群聊列表数据源 */ export interface IGroupDSType extends IRecentConversationDSType { /** 数据源ID */ id: EDataSourceId.GROUP; /** 数据源可选类型 */ types: [EResourcePickerItemType.CONVERSATION]; } /** 组织架构数据源 */ export interface IOrganizationDSType extends IPanelProps { /** 组织架构数据源id */ id: EDataSourceId.ORGANIZATION; /** 可选类型 */ types: (EResourcePickerItemType.USER /** 部门 */ | EResourcePickerItemType.DEPARTMENT /** 动态用户组,仅部分组织有开启 */ | EResourcePickerItemType.DYNAMICGROUP /** 角色 */ | EResourcePickerItemType.ROLE)[]; /** 数据源配置 */ props?: { /** 指定组织 */ corpId?: string; /** 指定部门 */ deptId?: string; /** 在组织架构界面是否展示当前用户所在部门。默认为true */ isHideDepts?: boolean; /** 是否展示外部联系人 */ isShowExternal?: boolean; /** 是否可以通过角色选择人员 */ canselectUsersByRole?: boolean; /** 是否可以选择角色 */ canSelectRole?: boolean; /** 是否隐藏部门路径的面包屑 */ hideNodePath?: boolean; /** 是否显示根节点 */ showRootOrg?: boolean; /** 是否定位到特定部门并不能选择上级 需要配合deptId使用。默认false*/ hidePath?: boolean; /** 是否展示关联组织 默认true*/ showLinkedOrg?: boolean; /** 是否可以全选本组织 */ selectAll?: boolean; }; } /** 批量导入数据源 */ export interface IBatchPhoneAddDSType extends IPanelProps { id: EDataSourceId.BATCH_PHONE_ADD; props?: { /** 指定批量导入组织id */ corpId?: string; }; } /** 群聊内选人数据源 */ export interface IGroupMembersDSType extends IPanelProps { id: EDataSourceId.GROUPMEMBERS; types: EResourcePickerItemType.USER[]; props: { /** 群聊id,内部使用 */ cid?: string; /** 群聊id */ openConversationId?: string; /** 加载数量,最大1000,默认50 */ count?: number; /** 分页展示 默认 50 */ size?: number; }; } /** 自定义用户内选人 */ export interface ICustomUsersDSType extends IPanelProps { id: EDataSourceId.CUSTOMUSERSDS; types: EResourcePickerItemType.USER[]; props: { /** uid数组 */ uids?: string[]; /** 企业员工id数组 */ emplIds?: string[]; /** 自定义标题 */ customTitle?: string; }; } export declare const resourcePicker: (args: IResourcePickerParams) => Promise<IResourcePickerResult>; export {};