@lark-project/ui-kit-plugin
Version:
Lark Project UI Kit Plugin
111 lines (103 loc) • 3.62 kB
TypeScript
/**
* Copyright (c) 2024 Lark Technologies Pte. Ltd.
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted,provided that the above copyright notice and this permission notice appear in all copies.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
import { CSSProperties } from 'react';
import { ReactElement } from 'react';
import { WorkItemFinderOptions } from '@lark-project/js-sdk';
/**
* dom 通用属性
*/
declare interface IBaseDOMProps {
/**
* 类名
*/
className?: string;
/**
* 样式
*/
style?: CSSProperties;
}
/**
* 对标基础组件库 api 设置
*/
declare interface IBasePopoverProps {
/**
* 自定义 trigger dom 元素
*
* 满足与semi Popover 一致的约定,以下描述引用自semi:
*
* Popover 需要将 DOM 事件监听器应用到 children 中,如果子元素是自定义的组件,你需要确保它能将属性传递至底层的 DOM 元素
*
* 同时为了计算弹出层的定位,需要获取到 children 的真实 DOM 元素,因此 Popover 支持如下类型的 children
*
* 1. Class Component,不强制绑定ref,但需要确保 props 可被透传至真实的 DOM 节点上
* 2. 使用 forwardRef 包裹后的函数式组件,将 props 与 ref 透传到 children 内真实的 DOM 节点上
* 3. 真实 DOM 节点, 如 span,div,p...
*/
children?: ReactElement;
}
/**
* 通用错误表达结构
*/
declare interface IError {
/**
* 错误码,一般非0表示存在错误
*/
c: number;
/**
* 当有错误时,提供对应的错误描述信息
*/
m: string;
}
export declare function init(): Promise<void>;
export declare interface IWorkItemFinderProps extends IBaseDOMProps, IBasePopoverProps, Omit<WorkItemFinderOptions, 'forceCreateNewSearchId' | 'title'> {
/**
* 是否禁用,禁用状态下不能打开配置界面
*/
disabled?: boolean;
/**
* 修改配置触发
* @param params total:筛选条件数量
* @returns
*/
onChange?: (params: {
total: number;
}) => void;
/**
* 保存提交
* @param params searchId 筛选条件id
* @returns
*/
onSubmit?: (params: {
searchId: string;
}) => void;
/**
* 非阻塞异常,以下情况会触发此回调:
* 1. { c: 1, m: 'searchId not match spaceId or workObjectId' }
* @param err
* @returns
*/
onValidateError?: (err: IError) => void;
/**
* 阻塞异常,比如保存失败
* @param err
* @returns
*/
onError?: (err: IError) => void;
}
/**
* [mobile] >=7.36.0
* [业务组件] 工作项筛选器
*/
export declare function WorkItemFinder({ className, style, children, disabled, onChange, onSubmit, onValidateError, onError, searchId, spaceId, workObjectId, backfill, }: IWorkItemFinderProps): ReactElement;
export { }