@flatbiz/antd 4.5.47 → 4.5.49
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/esm/ace-editor-json/index.js +1 -1
- package/esm/ace-editor-json/index.js.map +1 -1
- package/esm/ace-editor-mysql/index.js +1 -1
- package/esm/ace-editor-mysql/index.js.map +1 -1
- package/esm/ace-editor-xml/index.js +1 -1
- package/esm/ace-editor-xml/index.js.map +1 -1
- package/esm/ai-search/index.css +0 -0
- package/esm/ai-search/index.js +11 -0
- package/esm/ai-search/index.js.map +1 -0
- package/esm/bootstrap/index.js +1 -1
- package/esm/bootstrap/index.js.map +1 -1
- package/esm/button-operate/index.js +1 -1
- package/esm/button-operate/index.js.map +1 -1
- package/esm/button-wrapper/index.js +1 -1
- package/esm/button-wrapper/index.js.map +1 -1
- package/esm/cascader-wrapper/index.js +1 -1
- package/esm/cascader-wrapper/index.js.map +1 -1
- package/esm/check-list/index.js +1 -1
- package/esm/check-list/index.js.map +1 -1
- package/esm/config-provider-wrapper/index.js +1 -1
- package/esm/date-range-picker-wrapper-form-item/index.js +1 -1
- package/esm/date-range-picker-wrapper-form-item/index.js.map +1 -1
- package/esm/dialog-alert/index.js +1 -1
- package/esm/dialog-alert/index.js.map +1 -1
- package/esm/dialog-confirm/index.js +1 -1
- package/esm/dialog-confirm/index.js.map +1 -1
- package/esm/dialog-drag-modal/index.js +1 -1
- package/esm/dialog-drag-modal/index.js.map +1 -1
- package/esm/dialog-drawer/index.js +1 -1
- package/esm/dialog-drawer/index.js.map +1 -1
- package/esm/dialog-drawer-content/index.js +1 -1
- package/esm/dialog-drawer-content/index.js.map +1 -1
- package/esm/dialog-loading/index.js +1 -1
- package/esm/dialog-loading/index.js.map +1 -1
- package/esm/dialog-modal/index.js +1 -1
- package/esm/dialog-modal/index.js.map +1 -1
- package/esm/dialog-preview-image/index.js +1 -1
- package/esm/dialog-preview-image/index.js.map +1 -1
- package/esm/drag-collapse/index.js +1 -1
- package/esm/drag-collapse/index.js.map +1 -1
- package/esm/drag-collapse-form-list/index.js +1 -1
- package/esm/drag-collapse-form-list/index.js.map +1 -1
- package/esm/drag-editable-card/index.css +1 -0
- package/esm/drag-editable-card/index.js +2 -2
- package/esm/drag-editable-card/index.js.map +1 -1
- package/esm/drag-editable-table/index.js +1 -1
- package/esm/drag-editable-table/index.js.map +1 -1
- package/esm/drag-editable-table-pro/index.js +1 -1
- package/esm/drag-editable-table-pro/index.js.map +1 -1
- package/esm/drag-form-list/index.js +1 -1
- package/esm/drag-form-list/index.js.map +1 -1
- package/esm/drawer-wrapper/index.js +1 -1
- package/esm/drawer-wrapper/index.js.map +1 -1
- package/esm/dropdown-menu-wrapper/index.js +1 -1
- package/esm/dropdown-menu-wrapper/index.js.map +1 -1
- package/esm/easy-form/index.js +1 -1
- package/esm/easy-form/index.js.map +1 -1
- package/esm/easy-table/index.js +1 -1
- package/esm/easy-table/index.js.map +1 -1
- package/esm/editable-card/index.css +1 -1
- package/esm/editable-card/index.js +2 -2
- package/esm/editable-card/index.js.map +1 -1
- package/esm/editable-field/index.js +1 -1
- package/esm/editable-field/index.js.map +1 -1
- package/esm/editable-table/index.js +1 -1
- package/esm/editable-table/index.js.map +1 -1
- package/esm/editable-table-pro/index.js +1 -1
- package/esm/editable-table-pro/index.js.map +1 -1
- package/esm/error-boundary-wrapper/index.js +1 -1
- package/esm/error-boundary-wrapper/index.js.map +1 -1
- package/esm/fba-app/index.js +1 -1
- package/esm/fba-app/index.js.map +1 -1
- package/esm/fba-hooks/index.js +1 -1
- package/esm/fba-hooks/index.js.map +1 -1
- package/esm/form-item-group/index.js +1 -1
- package/esm/form-item-group/index.js.map +1 -1
- package/esm/form-item-text/index.js +1 -1
- package/esm/form-item-text/index.js.map +1 -1
- package/esm/form-item-wrapper/index.js +1 -1
- package/esm/form-item-wrapper/index.js.map +1 -1
- package/esm/form-list-wrapper/index.js +1 -1
- package/esm/form-list-wrapper/index.js.map +1 -1
- package/esm/index.js +3 -1
- package/esm/input-search-wrapper/index.js +1 -1
- package/esm/input-search-wrapper/index.js.map +1 -1
- package/esm/input-text-area-wrapper/index.js +1 -1
- package/esm/input-text-area-wrapper/index.js.map +1 -1
- package/esm/input-wrapper/index.js +1 -1
- package/esm/input-wrapper/index.js.map +1 -1
- package/esm/json-editor/index.js +1 -1
- package/esm/json-editor/index.js.map +1 -1
- package/esm/label-value-render/index.js +1 -1
- package/esm/label-value-render/index.js.map +1 -1
- package/esm/local-loading/index.js +1 -1
- package/esm/local-loading/index.js.map +1 -1
- package/esm/mention-editor/index.js +1 -1
- package/esm/mention-editor/index.js.map +1 -1
- package/esm/mentions-wrapper/index.js +1 -1
- package/esm/mentions-wrapper/index.js.map +1 -1
- package/esm/modal-wrapper/index.js +1 -1
- package/esm/modal-wrapper/index.js.map +1 -1
- package/esm/number-range-form-item/index.js +1 -1
- package/esm/number-range-form-item/index.js.map +1 -1
- package/esm/pagination-wrapper/index.js +1 -1
- package/esm/pagination-wrapper/index.js.map +1 -1
- package/esm/pdf/index.js +1 -1
- package/esm/pdf/index.js.map +1 -1
- package/esm/pdf-preview/index.js +1 -1
- package/esm/pdf-preview/index.js.map +1 -1
- package/esm/relation-tree/index.js +1 -1
- package/esm/relation-tree/index.js.map +1 -1
- package/esm/resizable-drawer/index.css +1 -0
- package/esm/resizable-drawer/index.js +15 -0
- package/esm/resizable-drawer/index.js.map +1 -0
- package/esm/rich-text-editor/index.js +1 -1
- package/esm/rich-text-editor/index.js.map +1 -1
- package/esm/rich-text-viewer/index.js +1 -1
- package/esm/rich-text-viewer/index.js.map +1 -1
- package/esm/roll-location-center/index.js +1 -1
- package/esm/roll-location-center/index.js.map +1 -1
- package/esm/roll-location-in-view/index.js +1 -1
- package/esm/roll-location-in-view/index.js.map +1 -1
- package/esm/rule-describe/index.js +1 -1
- package/esm/rule-describe/index.js.map +1 -1
- package/esm/search-form/index.js +1 -1
- package/esm/search-form/index.js.map +1 -1
- package/esm/search-menu/index.js +1 -1
- package/esm/search-menu/index.js.map +1 -1
- package/esm/selector-wrapper/index.js +1 -1
- package/esm/selector-wrapper/index.js.map +1 -1
- package/esm/selector-wrapper-search/index.js +1 -1
- package/esm/selector-wrapper-search/index.js.map +1 -1
- package/esm/selector-wrapper-simple/index.js +1 -1
- package/esm/selector-wrapper-simple/index.js.map +1 -1
- package/esm/simple-layout/index.js +1 -1
- package/esm/simple-layout/index.js.map +1 -1
- package/esm/switch-confirm-wrapper/index.js +1 -1
- package/esm/switch-confirm-wrapper/index.js.map +1 -1
- package/esm/table-cell-render/index.js +1 -1
- package/esm/table-cell-render/index.js.map +1 -1
- package/esm/table-scrollbar/index.js +1 -1
- package/esm/table-scrollbar/index.js.map +1 -1
- package/esm/tag-group/index.js +1 -1
- package/esm/tag-group/index.js.map +1 -1
- package/esm/tag-wrapper/index.js +1 -1
- package/esm/tag-wrapper/index.js.map +1 -1
- package/esm/text-css-ellipsis/index.js +1 -1
- package/esm/text-css-ellipsis/index.js.map +1 -1
- package/esm/text-overflow/index.js +1 -1
- package/esm/text-overflow/index.js.map +1 -1
- package/esm/text-overflow-render/index.js +1 -1
- package/esm/text-overflow-render/index.js.map +1 -1
- package/esm/time-range-picker-wrapper-form-item/index.js +1 -1
- package/esm/time-range-picker-wrapper-form-item/index.js.map +1 -1
- package/esm/tips-title/index.css +1 -1
- package/esm/tips-title/index.js +1 -1
- package/esm/tips-title/index.js.map +1 -1
- package/esm/tree-modal/index.js +1 -1
- package/esm/tree-modal/index.js.map +1 -1
- package/esm/tree-modal-selector/index.js +1 -1
- package/esm/tree-modal-selector/index.js.map +1 -1
- package/esm/tree-selector-wrapper/index.js +1 -1
- package/esm/tree-selector-wrapper/index.js.map +1 -1
- package/esm/tree-wrapper/index.js +1 -1
- package/esm/tree-wrapper/index.js.map +1 -1
- package/esm/upload-wrapper/index.js +1 -1
- package/esm/upload-wrapper/index.js.map +1 -1
- package/index.d.ts +60 -8
- package/package.json +6 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["@flatbiz/antd/src/upload-wrapper/utils.ts","@flatbiz/antd/src/upload-wrapper/upload-wrapper.tsx"],"sourcesContent":["export const getBase64 = (file): Promise<string> =>\n new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.readAsDataURL(file);\n reader.onload = () => resolve(reader.result as string);\n reader.onerror = (error) => reject(error);\n });\n","import { PlusOutlined } from '@ant-design/icons';\nimport { isPlainObject } from '@dimjs/lang';\nimport { classNames, extend } from '@dimjs/utils';\nimport type { TAny, TPlainObject } from '@flatbiz/utils';\nimport { isUndefinedOrNull, openNewWindow, toArray } from '@flatbiz/utils';\nimport { hooks } from '@wove/react';\nimport type { UploadProps } from 'antd';\nimport { Button, Image, message, Upload } from 'antd';\nimport type { UploadChangeParam } from 'antd/lib/upload';\nimport type { UploadFile, UploadListType } from 'antd/lib/upload/interface';\nimport type { ReactElement, ReactNode } from 'react';\nimport { cloneElement, Fragment, useMemo, useState } from 'react';\nimport { flushSync } from 'react-dom';\nimport { ButtonWrapper } from '../button-wrapper';\nimport { fbaHooks } from '../fba-hooks';\nimport './style.less';\nimport { getBase64 } from './utils';\n\nexport type UploadWrapperFileItem = {\n uid: string;\n name: string;\n url?: string;\n};\n\nexport type UploadWrapperProps<T extends TPlainObject = TPlainObject> = {\n value?: T[] | T;\n onChange?: (value?: T[]) => void;\n onUploadError?: (message?: string) => void;\n onUploadChange?: (info: UploadChangeParam<UploadFile>) => void;\n /**\n * 属性取值映射\n */\n fieldNames?: {\n uid: string;\n name?: string;\n url?: string;\n /** 文件大小 */\n size?: string | number;\n };\n /**\n * 接口响应数据适配器,如果配置了fieldNames,适配器返回值会再进过fieldNames转换\n */\n onRequestResultAdapter?: (respData: TAny) => TPlainObject;\n /** 操作触发显示文本 */\n triggerText?: string;\n /** 超过maxCount 隐藏上传入口 */\n limitHidden?: boolean;\n /**\n * 自动提交,默认:true\n * ```\n * 1. 自定义beforeUpload配置后 autoSubmit 失效\n * ```\n */\n autoSubmit?: boolean;\n /** 图片预览开关, 重写 onPreview 方法后失效 */\n imagePreviewSwitch?: boolean;\n /** 图片预览文件类型,默认:['png', 'jpg', 'jpeg', 'gif', 'heic', 'heif'] */\n imagePreviewAccept?: string[];\n /**\n * 配置文件额外操作\n * ```\n * 额外操作超过两项后,listType为 picture-card、picture-circle 时会出现显示异常,需要自行修改覆盖样式\n * ```\n */\n extraOperate?: {\n icon: ReactElement;\n onClick: (file: UploadFile, fileList: UploadFile[], e) => void;\n }[];\n} & Omit<UploadProps, 'onChange' | 'fileList'>;\n\n/**\n * 文件上传\n * ```\n * demo: https://fex.qa.tcshuke.com/docs/admin/main/file/upload\n * 1. 可通过配置children替换默认上传触发布局\n * 2. 接口返回结构:\n * formData上传接口返回值\n * {\n * code: '0000',\n * data: {\n * uid: '唯一值,可使用fileKey值'\n * name: '文件名称'\n * url: '预览地址'\n * }\n * }\n * 3. 如果接口返回的不是上面的字段名称,可通过fieldNames配置接口返回字段名称映射\n *\n * 4. 最佳使用方式,与Form结合使用\n * <Form.Item name=\"attachmentList\" label=\"附件\">\n * <UploadWrapper action={uploadUrl} />\n * </Form.Item>\n *\n * 5. 回填数据结构\n * [{\n * uid: '唯一值',\n * name(非必填): 'image.png',\n * url: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',\n * }]\n * 1. 其中 uid、name、url 可为其他命名,通过 fieldNames 进行映射即可,\n * 2. 其他需要的字段可在对象中添加 responseData 对象\n * 例如:\n * [{\n * uid: '唯一值',\n * name(非必填): 'image.png',\n * url: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',\n * responseData: { 'xx':'xxx' }\n * }]\n * ```\n *\n */\nexport const UploadWrapper = (props: UploadWrapperProps) => {\n const {\n onChange,\n onUploadError,\n value,\n triggerText,\n limitHidden,\n autoSubmit,\n imagePreviewSwitch,\n imagePreviewAccept,\n extraOperate,\n ...otherProps\n } = props;\n const imagePreviewAcceptFt = isUndefinedOrNull(imagePreviewAccept)\n ? ['png', 'jpg', 'jpeg', 'gif', 'heic', 'heif']\n : imagePreviewAccept;\n const [previewImage, setPreviewImage] = useState<string>();\n const [uploadList, setUploadList] = useState<UploadWrapperFileItem[]>();\n const fieldNames = extend(\n {\n uid: 'uid',\n name: 'name',\n url: 'url',\n size: 'size',\n },\n props.fieldNames,\n );\n\n const valueList = useMemo(\n () => (isUndefinedOrNull(value) ? undefined : toArray<TPlainObject>(value)),\n [value],\n );\n\n fbaHooks.useEffectCustom(() => {\n const errorList = uploadList?.filter((item) => item['status'] === 'error') || [];\n let newList = [] as TAny[];\n valueList?.forEach((item) => {\n // 判断item 为 File类型\n if (item['lastModified']) {\n newList.push(item);\n } else {\n newList.push({\n uid: item[fieldNames.uid],\n name: item[fieldNames.name],\n url: item[fieldNames.url],\n size: item[fieldNames.size],\n responseData: item['responseData'],\n status: 'done',\n isOriginal: true,\n });\n }\n });\n if (errorList.length > 0) {\n const newErrorList = errorList.map((item) => {\n return {\n uid: item.uid,\n name: item.name,\n status: 'error',\n isOriginal: true,\n response: item['response'],\n };\n }) as TAny[];\n newList = newList.concat(newErrorList);\n }\n setUploadList(newList);\n }, [fieldNames.name, fieldNames.uid, fieldNames.url, valueList]);\n\n const handleResponse = (fileList: UploadFile<TAny>[]) => {\n const newFileList: TAny[] = [];\n let hasError = false;\n fileList.forEach((item) => {\n if (item['isOriginal']) {\n if (item['status'] !== 'error') {\n const target: TPlainObject = {\n [fieldNames.uid]: item.uid,\n [fieldNames.name]: item.name,\n [fieldNames.url]: item.url,\n };\n if (!isUndefinedOrNull(item.size)) {\n target[fieldNames.size] = item.size;\n }\n if (item['responseData']) {\n target.responseData = item['responseData'];\n }\n newFileList.push(target);\n }\n } else if (isPlainObject(item.response)) {\n if (item.response.code === '0000') {\n const respData = item.response.data;\n const result = (props.onRequestResultAdapter?.(respData) || respData) as TPlainObject;\n const target: TPlainObject = {\n [fieldNames.uid]: result[fieldNames.uid] || item.uid,\n [fieldNames.name]: result[fieldNames.name] || item.name,\n [fieldNames.url]: result[fieldNames.url],\n };\n if (!isUndefinedOrNull(result[fieldNames.size])) {\n target[fieldNames.size] = result[fieldNames.size];\n }\n newFileList.push({\n ...target,\n responseData: respData,\n });\n } else {\n const errorMsg = item.response.message || '上传失败';\n hasError = true;\n item.status = 'error';\n item.response = item.response.message || '上传失败';\n if (onUploadError) {\n onUploadError?.(errorMsg);\n } else {\n void message.error('上传操作失败...');\n }\n }\n }\n });\n if (hasError) {\n setUploadList([...fileList] as UploadWrapperFileItem[]);\n }\n onChange?.(newFileList);\n };\n\n const onUploadChange = hooks.useCallbackRef((info) => {\n const fileList = info.fileList as TPlainObject[];\n if (info.file.status === 'done') {\n const newFileList = [...info.fileList];\n const donwList = newFileList.filter((item) => item.status === 'done' || item['isOriginal']);\n\n const allDone = donwList.length === newFileList.length;\n if (allDone) {\n handleResponse(newFileList);\n }\n flushSync(() => setUploadList(newFileList));\n return;\n } else if (info.file.status === 'removed') {\n const uid = info.file.uid;\n const targetList = valueList !== undefined ? [...valueList] : [];\n const targetIndex = targetList.findIndex((item) => {\n const tempUid = item[fieldNames.uid] || item.uid;\n return tempUid === uid;\n });\n if (targetIndex >= 0) {\n targetList.splice(targetIndex, 1);\n }\n onChange?.(targetList);\n } else if (info.file.status === 'error') {\n if (onUploadError) {\n onUploadError();\n } else {\n void message.error('上传操作失败...');\n }\n }\n // https://github.com/ant-design/ant-design/issues/2423\n setUploadList([...fileList] as UploadWrapperFileItem[]);\n props.onUploadChange?.(info);\n });\n\n const hiddenEmtry = useMemo(() => {\n if (otherProps.maxCount === undefined || !limitHidden) return false;\n if (otherProps.maxCount === 0) return true;\n if (uploadList && uploadList.length >= otherProps.maxCount) return true;\n return false;\n }, [limitHidden, otherProps.maxCount, uploadList]);\n\n const beforeUpload = (_file, fileList) => {\n if (autoSubmit === false) {\n const maxCount = otherProps.maxCount;\n let mergeList = [...(valueList || []), ...fileList];\n let uploadListMerge = [...(uploadList || []), ...fileList];\n if (maxCount !== undefined && maxCount !== null) {\n if (mergeList.length > maxCount) {\n mergeList = mergeList.slice(mergeList.length - maxCount);\n uploadListMerge = uploadListMerge.slice(uploadListMerge.length - maxCount);\n }\n }\n setUploadList(uploadListMerge);\n props.onChange?.(mergeList);\n return false;\n }\n return true;\n };\n\n const handlePreview = async (file: UploadFile) => {\n const name = file.name || '';\n const extension = name.slice(name.lastIndexOf('.') + 1);\n const acceptTarget = imagePreviewAcceptFt?.find((item) => {\n return item.toLocaleLowerCase() === extension.toLocaleLowerCase();\n });\n if (acceptTarget) {\n if (!file.url && !file.preview) {\n file.preview = await getBase64(file.originFileObj);\n }\n setPreviewImage(file.url || (file.preview as string));\n } else {\n openNewWindow(file.url as string);\n }\n };\n\n return (\n <Fragment>\n <Upload\n beforeUpload={beforeUpload}\n onPreview={imagePreviewSwitch ? handlePreview : undefined}\n showUploadList\n itemRender={(originNode, file, fileList) => {\n if (!extraOperate || !extraOperate.length) return originNode;\n const countSign = `${otherProps.disabled ? 1 : 2}-${extraOperate.length}`;\n return (\n <div\n className={classNames(\n 'v-upload-list-item-actions-wrapper',\n `v-upload-list-item-extra-actions-${countSign}`,\n )}\n style={{ height: '100%' }}\n >\n {cloneElement(originNode, {\n children: [\n originNode.props.children,\n <div key=\"extra-actions\" className=\"v-upload-list-item-extra-actions\">\n {extraOperate.map((item, index) => {\n return (\n <ButtonWrapper\n key={index}\n size=\"small\"\n type=\"text\"\n icon={item.icon}\n onClick={item.onClick.bind(null, file, fileList)}\n />\n );\n })}\n </div>,\n ].filter(Boolean),\n })}\n </div>\n );\n }}\n {...otherProps}\n onChange={onUploadChange}\n fileList={uploadList}\n className={classNames('v-upload-wrapper', otherProps.className)}\n >\n {otherProps.disabled || hiddenEmtry ? null : (\n <UploadTrigger triggerText={triggerText} listType={otherProps.listType}>\n {props.children}\n </UploadTrigger>\n )}\n </Upload>\n {previewImage ? (\n <Image\n wrapperStyle={{ display: 'none' }}\n preview={{\n visible: !!previewImage,\n onVisibleChange: () => setPreviewImage(undefined),\n afterOpenChange: (visible) => !visible && setPreviewImage(''),\n }}\n src={previewImage}\n />\n ) : null}\n </Fragment>\n );\n};\n\nconst UploadTrigger = (props: {\n listType?: UploadListType;\n children?: ReactNode | ReactNode[];\n triggerText?: string;\n}) => {\n if (props.children) return <Fragment>{props.children}</Fragment>;\n if (props.listType === 'picture-card') {\n return (\n <div>\n <PlusOutlined />\n <div style={{ marginTop: 8 }}>{props.triggerText || '上传图片'}</div>\n </div>\n );\n }\n if (props.listType === 'picture') {\n return (\n <Button type=\"primary\" ghost>\n {props.triggerText || '选择图片上传'}\n </Button>\n );\n }\n return (\n <Button type=\"primary\" ghost>\n {props.triggerText || '选择文件上传'}\n </Button>\n );\n};\n"],"names":["getBase64","file","Promise","resolve","reject","reader","FileReader","readAsDataURL","onload","result","onerror","error","UploadWrapper","props","onChange","onUploadError","value","triggerText","limitHidden","autoSubmit","imagePreviewSwitch","imagePreviewAccept","extraOperate","otherProps","_objectWithoutPropertiesLoose","_excluded","imagePreviewAcceptFt","isUndefinedOrNull","_useState","useState","previewImage","setPreviewImage","_useState2","uploadList","setUploadList","fieldNames","_extend","uid","name","url","size","valueList","useMemo","undefined","toArray","fbaHooks","useEffectCustom","errorList","filter","item","newList","forEach","push","responseData","status","isOriginal","length","newErrorList","map","response","concat","handleResponse","fileList","newFileList","hasError","_target","target","_isPlainObject","code","_target3","respData","data","onRequestResultAdapter","_extends","errorMsg","message","onUploadChange","_hooks","useCallbackRef","info","donwList","allDone","flushSync","targetList","targetIndex","findIndex","tempUid","splice","hiddenEmtry","maxCount","beforeUpload","_file","mergeList","uploadListMerge","slice","handlePreview","$return","$error","extension","acceptTarget","lastIndexOf","find","toLocaleLowerCase","preview","originFileObj","then","$await_3","$If_2","call","this","$boundEx","bind","$If_1","openNewWindow","_jsxs","Fragment","children","_jsx","Upload","onPreview","showUploadList","itemRender","originNode","countSign","disabled","className","_classNames","style","height","cloneElement","index","ButtonWrapper","type","icon","onClick","Boolean","UploadTrigger","listType","Image","wrapperStyle","display","visible","onVisibleChange","afterOpenChange","src","_PlusOutlined","marginTop","Button","ghost"],"mappings":";w0CAAO,IAAMA,EAAY,SAAZA,EAAaC,GAAI,OAC5B,IAAIC,SAAQ,SAACC,EAASC,GACpB,IAAMC,EAAS,IAAIC,WACnBD,EAAOE,cAAcN,GACrBI,EAAOG,OAAS,WAAA,OAAML,EAAQE,EAAOI,OAAiB,EACtDJ,EAAOK,QAAU,SAACC,GAAK,OAAKP,EAAOO,EAAM,CAC3C,GAAE,mJCwGSC,EAAgB,SAAhBA,EAAiBC,GAC5B,IACEC,EAUED,EAVFC,SACAC,EASEF,EATFE,cACAC,EAQEH,EARFG,MACAC,EAOEJ,EAPFI,YACAC,EAMEL,EANFK,YACAC,EAKEN,EALFM,WACAC,EAIEP,EAJFO,mBACAC,EAGER,EAHFQ,mBACAC,EAEET,EAFFS,aACGC,EAAUC,EACXX,EAAKY,GACT,IAAMC,EAAuBC,EAAkBN,GAC3C,CAAC,MAAO,MAAO,OAAQ,MAAO,OAAQ,QACtCA,EACJ,IAAAO,EAAwCC,IAAjCC,EAAYF,EAAA,GAAEG,EAAeH,EAAA,GACpC,IAAAI,EAAoCH,IAA7BI,EAAUD,EAAA,GAAEE,EAAaF,EAAA,GAChC,IAAMG,EAAaC,EACjB,CACEC,IAAK,MACLC,KAAM,OACNC,IAAK,MACLC,KAAM,QAER3B,EAAMsB,YAGR,IAAMM,EAAYC,GAChB,WAAA,OAAOf,EAAkBX,GAAS2B,UAAYC,EAAsB5B,EAAM,GAC1E,CAACA,IAGH6B,EAASC,iBAAgB,WACvB,IAAMC,GAAYd,GAAU,UAAA,EAAVA,EAAYe,QAAO,SAACC,GAAI,OAAKA,EAAK,YAAc,OAAO,MAAK,GAC9E,IAAIC,EAAU,GACdT,SAAAA,EAAWU,SAAQ,SAACF,GAElB,GAAIA,EAAK,gBAAiB,CACxBC,EAAQE,KAAKH,EACf,KAAO,CACLC,E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pF,EAAKoF,KACXC,QAASrF,EAAKqF,QAAQvB,KAAK,KAAM9G,EAAM6D,IAJlCoE,OAJJ,kBAaTlF,OAAOuF,YAIjB,GACIhH,EAAU,CACdT,SAAU8D,EACVd,SAAU7B,EACV4F,UAAWC,EAAW,mBAAoBvG,EAAWsG,WAAWT,SAE/D7F,EAAWqG,UAAYpC,EAAc,KACpC6B,EAACmB,EAAa,CAACvH,YAAaA,EAAawH,SAAUlH,EAAWkH,SAASrB,SACpEvG,EAAMuG,cAIZtF,EACCuF,EAACqB,EAAK,CACJC,aAAc,CAAEC,QAAS,QACzBrC,QAAS,CACPsC,UAAW/G,EACXgH,gBAAiB,SAAjBA,IAAe,OAAQ/G,EAAgBY,UAAU,EACjDoG,gBAAiB,SAAjBA,EAAkBF,GAAO,OAAMA,GAAW9G,EAAgB,GAAG,GAE/DiH,IAAKlH,IAEL,OAGV,EAEA,IAAM0G,EAAgB,SAAhBA,EAAiB3H,GAKrB,GAAIA,EAAMuG,SAAU,OAAOC,EAACF,EAAQ,CAAAC,SAAEvG,EAAMuG,WAC5C,GAAIvG,EAAM4H,WAAa,eAAgB,CACrC,OACEvB,EAAA,MAAA,CAAAE,UACEC,EAAA4B,EAAe,CAAA,GACf5B,EAAA,MAAA,CAAKU,MAAO,CAAEmB,UAAW,GAAI9B,SAAEvG,EAAMI,aAAe,WAG1D,CACA,GAAIJ,EAAM4H,WAAa,UAAW,CAChC,OACEpB,EAAC8B,EAAM,CAACf,KAAK,UAAUgB,MAAK,KAAAhC,SACzBvG,EAAMI,aAAe,UAG5B,CACA,OACEoG,EAAC8B,EAAM,CAACf,KAAK,UAAUgB,MAAK,KAAAhC,SACzBvG,EAAMI,aAAe,UAG5B"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["@flatbiz/antd/src/upload-wrapper/utils.ts","@flatbiz/antd/src/upload-wrapper/upload-wrapper.tsx"],"sourcesContent":["export const getBase64 = (file): Promise<string> =>\n new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.readAsDataURL(file);\n reader.onload = () => resolve(reader.result as string);\n reader.onerror = (error) => reject(error);\n });\n","import { PlusOutlined } from '@ant-design/icons';\nimport { isPlainObject } from '@dimjs/lang';\nimport { classNames, extend } from '@dimjs/utils';\nimport type { TAny, TPlainObject } from '@flatbiz/utils';\nimport { isUndefinedOrNull, openNewWindow, toArray } from '@flatbiz/utils';\nimport { hooks } from '@wove/react';\nimport type { UploadProps } from 'antd';\nimport { Button, Image, message, Upload } from 'antd';\nimport type { UploadChangeParam } from 'antd/lib/upload';\nimport type { UploadFile, UploadListType } from 'antd/lib/upload/interface';\nimport type { ReactElement, ReactNode } from 'react';\nimport { cloneElement, Fragment, useMemo, useState } from 'react';\nimport { flushSync } from 'react-dom';\nimport { ButtonWrapper } from '../button-wrapper';\nimport { fbaHooks } from '../fba-hooks';\nimport './style.less';\nimport { getBase64 } from './utils';\n\nexport type UploadWrapperFileItem = {\n uid: string;\n name: string;\n url?: string;\n};\n\nexport type UploadWrapperProps<T extends TPlainObject = TPlainObject> = {\n value?: T[] | T;\n onChange?: (value?: T[]) => void;\n onUploadError?: (message?: string) => void;\n onUploadChange?: (info: UploadChangeParam<UploadFile>) => void;\n /**\n * 属性取值映射\n */\n fieldNames?: {\n uid: string;\n name?: string;\n url?: string;\n /** 文件大小 */\n size?: string | number;\n };\n /**\n * 接口响应数据适配器,如果配置了fieldNames,适配器返回值会再进过fieldNames转换\n */\n onRequestResultAdapter?: (respData: TAny) => TPlainObject;\n /** 操作触发显示文本 */\n triggerText?: string;\n /** 超过maxCount 隐藏上传入口 */\n limitHidden?: boolean;\n /**\n * 自动提交,默认:true\n * ```\n * 1. 自定义beforeUpload配置后 autoSubmit 失效\n * ```\n */\n autoSubmit?: boolean;\n /** 图片预览开关, 重写 onPreview 方法后失效 */\n imagePreviewSwitch?: boolean;\n /** 图片预览文件类型,默认:['png', 'jpg', 'jpeg', 'gif', 'heic', 'heif'] */\n imagePreviewAccept?: string[];\n /**\n * 配置文件额外操作\n * ```\n * 额外操作超过两项后,listType为 picture-card、picture-circle 时会出现显示异常,需要自行修改覆盖样式\n * ```\n */\n extraOperate?: {\n icon: ReactElement;\n onClick: (file: UploadFile, fileList: UploadFile[], e) => void;\n }[];\n} & Omit<UploadProps, 'onChange' | 'fileList'>;\n\n/**\n * 文件上传\n * ```\n * demo: https://fex.qa.tcshuke.com/docs/admin/main/file/upload\n * 1. 可通过配置children替换默认上传触发布局\n * 2. 接口返回结构:\n * formData上传接口返回值\n * {\n * code: '0000',\n * data: {\n * uid: '唯一值,可使用fileKey值'\n * name: '文件名称'\n * url: '预览地址'\n * }\n * }\n * 3. 如果接口返回的不是上面的字段名称,可通过fieldNames配置接口返回字段名称映射\n *\n * 4. 最佳使用方式,与Form结合使用\n * <Form.Item name=\"attachmentList\" label=\"附件\">\n * <UploadWrapper action={uploadUrl} />\n * </Form.Item>\n *\n * 5. 回填数据结构\n * [{\n * uid: '唯一值',\n * name(非必填): 'image.png',\n * url: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',\n * }]\n * 1. 其中 uid、name、url 可为其他命名,通过 fieldNames 进行映射即可,\n * 2. 其他需要的字段可在对象中添加 responseData 对象\n * 例如:\n * [{\n * uid: '唯一值',\n * name(非必填): 'image.png',\n * url: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',\n * responseData: { 'xx':'xxx' }\n * }]\n * ```\n *\n */\nexport const UploadWrapper = (props: UploadWrapperProps) => {\n const {\n onChange,\n onUploadError,\n value,\n triggerText,\n limitHidden,\n autoSubmit,\n imagePreviewSwitch,\n imagePreviewAccept,\n extraOperate,\n ...otherProps\n } = props;\n const imagePreviewAcceptFt = isUndefinedOrNull(imagePreviewAccept)\n ? ['png', 'jpg', 'jpeg', 'gif', 'heic', 'heif']\n : imagePreviewAccept;\n const [previewImage, setPreviewImage] = useState<string>();\n const [uploadList, setUploadList] = useState<UploadWrapperFileItem[]>();\n const fieldNames = extend(\n {\n uid: 'uid',\n name: 'name',\n url: 'url',\n size: 'size',\n },\n props.fieldNames,\n );\n\n const valueList = useMemo(\n () => (isUndefinedOrNull(value) ? undefined : toArray<TPlainObject>(value)),\n [value],\n );\n\n fbaHooks.useEffectCustom(() => {\n const errorList = uploadList?.filter((item) => item['status'] === 'error') || [];\n let newList = [] as TAny[];\n valueList?.forEach((item) => {\n // 判断item 为 File类型\n if (item['lastModified']) {\n newList.push(item);\n } else {\n newList.push({\n uid: item[fieldNames.uid],\n name: item[fieldNames.name],\n url: item[fieldNames.url],\n size: item[fieldNames.size],\n responseData: item['responseData'],\n status: 'done',\n isOriginal: true,\n });\n }\n });\n if (errorList.length > 0) {\n const newErrorList = errorList.map((item) => {\n return {\n uid: item.uid,\n name: item.name,\n status: 'error',\n isOriginal: true,\n response: item['response'],\n };\n }) as TAny[];\n newList = newList.concat(newErrorList);\n }\n setUploadList(newList);\n }, [fieldNames.name, fieldNames.uid, fieldNames.url, valueList]);\n\n const handleResponse = (fileList: UploadFile<TAny>[]) => {\n const newFileList: TAny[] = [];\n let hasError = false;\n fileList.forEach((item) => {\n if (item['isOriginal']) {\n if (item['status'] !== 'error') {\n const target: TPlainObject = {\n [fieldNames.uid]: item.uid,\n [fieldNames.name]: item.name,\n [fieldNames.url]: item.url,\n };\n if (!isUndefinedOrNull(item.size)) {\n target[fieldNames.size] = item.size;\n }\n if (item['responseData']) {\n target.responseData = item['responseData'];\n }\n newFileList.push(target);\n }\n } else if (isPlainObject(item.response)) {\n if (item.response.code === '0000') {\n const respData = item.response.data;\n const result = (props.onRequestResultAdapter?.(respData) || respData) as TPlainObject;\n const target: TPlainObject = {\n [fieldNames.uid]: result[fieldNames.uid] || item.uid,\n [fieldNames.name]: result[fieldNames.name] || item.name,\n [fieldNames.url]: result[fieldNames.url],\n };\n if (!isUndefinedOrNull(result[fieldNames.size])) {\n target[fieldNames.size] = result[fieldNames.size];\n }\n newFileList.push({\n ...target,\n responseData: respData,\n });\n } else {\n const errorMsg = item.response.message || '上传失败';\n hasError = true;\n item.status = 'error';\n item.response = item.response.message || '上传失败';\n if (onUploadError) {\n onUploadError?.(errorMsg);\n } else {\n void message.error('上传操作失败...');\n }\n }\n }\n });\n if (hasError) {\n setUploadList([...fileList] as UploadWrapperFileItem[]);\n }\n onChange?.(newFileList);\n };\n\n const onUploadChange = hooks.useCallbackRef((info) => {\n const fileList = info.fileList as TPlainObject[];\n if (info.file.status === 'done') {\n const newFileList = [...info.fileList];\n const donwList = newFileList.filter((item) => item.status === 'done' || item['isOriginal']);\n\n const allDone = donwList.length === newFileList.length;\n if (allDone) {\n handleResponse(newFileList);\n }\n flushSync(() => setUploadList(newFileList));\n return;\n } else if (info.file.status === 'removed') {\n const uid = info.file.uid;\n const targetList = valueList !== undefined ? [...valueList] : [];\n const targetIndex = targetList.findIndex((item) => {\n const tempUid = item[fieldNames.uid] || item.uid;\n return tempUid === uid;\n });\n if (targetIndex >= 0) {\n targetList.splice(targetIndex, 1);\n }\n onChange?.(targetList);\n } else if (info.file.status === 'error') {\n if (onUploadError) {\n onUploadError();\n } else {\n void message.error('上传操作失败...');\n }\n }\n // https://github.com/ant-design/ant-design/issues/2423\n setUploadList([...fileList] as UploadWrapperFileItem[]);\n props.onUploadChange?.(info);\n });\n\n const hiddenEmtry = useMemo(() => {\n if (otherProps.maxCount === undefined || !limitHidden) return false;\n if (otherProps.maxCount === 0) return true;\n if (uploadList && uploadList.length >= otherProps.maxCount) return true;\n return false;\n }, [limitHidden, otherProps.maxCount, uploadList]);\n\n const beforeUpload = (_file, fileList) => {\n if (autoSubmit === false) {\n const maxCount = otherProps.maxCount;\n let mergeList = [...(valueList || []), ...fileList];\n let uploadListMerge = [...(uploadList || []), ...fileList];\n if (maxCount !== undefined && maxCount !== null) {\n if (mergeList.length > maxCount) {\n mergeList = mergeList.slice(mergeList.length - maxCount);\n uploadListMerge = uploadListMerge.slice(uploadListMerge.length - maxCount);\n }\n }\n setUploadList(uploadListMerge);\n props.onChange?.(mergeList);\n return false;\n }\n return true;\n };\n\n const handlePreview = async (file: UploadFile) => {\n const name = file.name || '';\n const extension = name.slice(name.lastIndexOf('.') + 1);\n const acceptTarget = imagePreviewAcceptFt?.find((item) => {\n return item.toLocaleLowerCase() === extension.toLocaleLowerCase();\n });\n if (acceptTarget) {\n if (!file.url && !file.preview) {\n file.preview = await getBase64(file.originFileObj);\n }\n setPreviewImage(file.url || (file.preview as string));\n } else {\n openNewWindow(file.url as string);\n }\n };\n\n return (\n <Fragment>\n <Upload\n beforeUpload={beforeUpload}\n onPreview={imagePreviewSwitch ? handlePreview : undefined}\n showUploadList\n itemRender={(originNode, file, fileList) => {\n if (!extraOperate || !extraOperate.length) return originNode;\n const countSign = `${otherProps.disabled ? 1 : 2}-${extraOperate.length}`;\n return (\n <div\n className={classNames(\n 'v-upload-list-item-actions-wrapper',\n `v-upload-list-item-extra-actions-${countSign}`,\n )}\n style={{ height: '100%' }}\n >\n {cloneElement(originNode, {\n children: [\n originNode.props.children,\n <div key=\"extra-actions\" className=\"v-upload-list-item-extra-actions\">\n {extraOperate.map((item, index) => {\n return (\n <ButtonWrapper\n key={index}\n size=\"small\"\n type=\"text\"\n icon={item.icon}\n onClick={item.onClick.bind(null, file, fileList)}\n />\n );\n })}\n </div>,\n ].filter(Boolean),\n })}\n </div>\n );\n }}\n {...otherProps}\n onChange={onUploadChange}\n fileList={uploadList}\n className={classNames('v-upload-wrapper', otherProps.className)}\n >\n {otherProps.disabled || hiddenEmtry ? null : (\n <UploadTrigger triggerText={triggerText} listType={otherProps.listType}>\n {props.children}\n </UploadTrigger>\n )}\n </Upload>\n {previewImage ? (\n <Image\n wrapperStyle={{ display: 'none' }}\n preview={{\n visible: !!previewImage,\n onVisibleChange: () => setPreviewImage(undefined),\n afterOpenChange: (visible) => !visible && setPreviewImage(''),\n }}\n src={previewImage}\n />\n ) : null}\n </Fragment>\n );\n};\n\nconst UploadTrigger = (props: {\n listType?: UploadListType;\n children?: ReactNode | ReactNode[];\n triggerText?: string;\n}) => {\n if (props.children) return <Fragment>{props.children}</Fragment>;\n if (props.listType === 'picture-card') {\n return (\n <div>\n <PlusOutlined />\n <div style={{ marginTop: 8 }}>{props.triggerText || '上传图片'}</div>\n </div>\n );\n }\n if (props.listType === 'picture') {\n return (\n <Button type=\"primary\" ghost>\n {props.triggerText || '选择图片上传'}\n </Button>\n );\n }\n return (\n <Button type=\"primary\" ghost>\n {props.triggerText || '选择文件上传'}\n </Button>\n );\n};\n"],"names":["getBase64","file","Promise","resolve","reject","reader","FileReader","readAsDataURL","onload","result","onerror","error","UploadWrapper","props","onChange","onUploadError","value","triggerText","limitHidden","autoSubmit","imagePreviewSwitch","imagePreviewAccept","extraOperate","otherProps","_objectWithoutPropertiesLoose","_excluded","imagePreviewAcceptFt","isUndefinedOrNull","_useState","useState","previewImage","setPreviewImage","_useState2","uploadList","setUploadList","fieldNames","_extend","uid","name","url","size","valueList","useMemo","undefined","toArray","fbaHooks","useEffectCustom","errorList","filter","item","newList","forEach","push","responseData","status","isOriginal","length","newErrorList","map","response","concat","handleResponse","fileList","newFileList","hasError","_target","target","_isPlainObject","code","_target3","respData","data","onRequestResultAdapter","_extends","errorMsg","message","onUploadChange","_hooks","useCallbackRef","info","donwList","allDone","flushSync","targetList","targetIndex","findIndex","tempUid","splice","hiddenEmtry","maxCount","beforeUpload","_file","mergeList","uploadListMerge","slice","handlePreview","$return","$error","extension","acceptTarget","lastIndexOf","find","toLocaleLowerCase","preview","originFileObj","then","$await_3","$If_2","call","this","$boundEx","bind","$If_1","openNewWindow","_jsxs","Fragment","children","_jsx","Upload","onPreview","showUploadList","itemRender","originNode","countSign","disabled","className","_classNames","style","height","cloneElement","index","ButtonWrapper","type","icon","onClick","Boolean","UploadTrigger","listType","Image","wrapperStyle","display","visible","onVisibleChange","afterOpenChange","src","_PlusOutlined","marginTop","Button","ghost"],"mappings":";s2CAAO,IAAMA,EAAY,SAAZA,EAAaC,GAAI,OAC5B,IAAI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C,EAAW,mBAAoBvG,EAAWsG,WAAWT,SAE/D7F,EAAWqG,UAAYpC,EAAc,KACpC6B,EAACmB,EAAa,CAACvH,YAAaA,EAAawH,SAAUlH,EAAWkH,SAASrB,SACpEvG,EAAMuG,cAIZtF,EACCuF,EAACqB,EAAK,CACJC,aAAc,CAAEC,QAAS,QACzBrC,QAAS,CACPsC,UAAW/G,EACXgH,gBAAiB,SAAjBA,IAAe,OAAQ/G,EAAgBY,UAAU,EACjDoG,gBAAiB,SAAjBA,EAAkBF,GAAO,OAAMA,GAAW9G,EAAgB,GAAG,GAE/DiH,IAAKlH,IAEL,OAGV,EAEA,IAAM0G,EAAgB,SAAhBA,EAAiB3H,GAKrB,GAAIA,EAAMuG,SAAU,OAAOC,EAACF,EAAQ,CAAAC,SAAEvG,EAAMuG,WAC5C,GAAIvG,EAAM4H,WAAa,eAAgB,CACrC,OACEvB,EAAA,MAAA,CAAAE,UACEC,EAAA4B,EAAe,CAAA,GACf5B,EAAA,MAAA,CAAKU,MAAO,CAAEmB,UAAW,GAAI9B,SAAEvG,EAAMI,aAAe,WAG1D,CACA,GAAIJ,EAAM4H,WAAa,UAAW,CAChC,OACEpB,EAAC8B,EAAM,CAACf,KAAK,UAAUgB,MAAK,KAAAhC,SACzBvG,EAAMI,aAAe,UAG5B,CACA,OACEoG,EAAC8B,EAAM,CAACf,KAAK,UAAUgB,MAAK,KAAAhC,SACzBvG,EAAMI,aAAe,UAG5B"}
|
package/index.d.ts
CHANGED
|
@@ -13,8 +13,8 @@ import { CheckboxGroupProps } from 'antd/lib/checkbox';
|
|
|
13
13
|
import { SearchProps, TextAreaProps } from 'antd/lib/input';
|
|
14
14
|
import { UploadChangeParam } from 'antd/lib/upload';
|
|
15
15
|
import { UploadFile } from 'antd/lib/upload/interface';
|
|
16
|
-
import
|
|
17
|
-
import { CSSProperties, DependencyList, DetailedHTMLProps, FC, ForwardRefExoticComponent, ReactElement, ReactNode, RefAttributes } from 'react';
|
|
16
|
+
import React from 'react';
|
|
17
|
+
import { CSSProperties, Component, DependencyList, DetailedHTMLProps, FC, ForwardRefExoticComponent, ReactElement, ReactNode, RefAttributes } from 'react';
|
|
18
18
|
import { IAceEditorProps } from 'react-ace';
|
|
19
19
|
import { SplitProps } from 'react-split';
|
|
20
20
|
import { Editor as TinyMCEEditor } from 'tinymce';
|
|
@@ -188,6 +188,29 @@ export type AceEditorXmlProps = Omit<IAceEditorProps, "mode" | "value" | "onChan
|
|
|
188
188
|
* ```
|
|
189
189
|
*/
|
|
190
190
|
export declare const AceEditorXml: (props: AceEditorXmlProps) => import("react/jsx-runtime").JSX.Element;
|
|
191
|
+
export type AiSearchProps = {
|
|
192
|
+
className?: string;
|
|
193
|
+
style?: CSSProperties;
|
|
194
|
+
/** 获取AI提示词 */
|
|
195
|
+
getPromptValue: (inputValue: string) => string;
|
|
196
|
+
/** AI回调 */
|
|
197
|
+
onAiCallback: (dataList: TPlainObject[]) => void;
|
|
198
|
+
/** 输入框placeholder */
|
|
199
|
+
placeholder?: string;
|
|
200
|
+
/** 默认值:{ minRows: 3, maxRows: 3 } */
|
|
201
|
+
inputAutoSize?: {
|
|
202
|
+
minRows?: number;
|
|
203
|
+
maxRows?: number;
|
|
204
|
+
};
|
|
205
|
+
/** 是否使用流式交互 */
|
|
206
|
+
stream?: boolean;
|
|
207
|
+
/** 设置进度条跑完时间,单位秒,默认值:10秒 */
|
|
208
|
+
progressTime?: number;
|
|
209
|
+
};
|
|
210
|
+
/**
|
|
211
|
+
* 与AI的一次交互,没有上下文
|
|
212
|
+
*/
|
|
213
|
+
export declare const AiSearch: (props: AiSearchProps) => import("react/jsx-runtime").JSX.Element;
|
|
191
214
|
export type AlertWrapperProps = AlertProps & {
|
|
192
215
|
size?: "small" | "default" | "large";
|
|
193
216
|
};
|
|
@@ -1567,10 +1590,6 @@ export type EasyFormProps = Omit<FormWrapperProps, "children"> & {
|
|
|
1567
1590
|
* 是否为纯净模式,对EasyForm的子节点不做任何包装处理
|
|
1568
1591
|
*/
|
|
1569
1592
|
isPure?: boolean;
|
|
1570
|
-
/**
|
|
1571
|
-
* true: 当前EasyForm组件不使用Antd Form包裹,可在Form、EasyForm、FormWrapper内部使用
|
|
1572
|
-
*/
|
|
1573
|
-
nonuseFormWrapper?: boolean;
|
|
1574
1593
|
/**
|
|
1575
1594
|
* 栅格占位格数,最大值:24
|
|
1576
1595
|
* ```
|
|
@@ -1813,6 +1832,13 @@ export type EditableCardProps = {
|
|
|
1813
1832
|
* ```
|
|
1814
1833
|
*/
|
|
1815
1834
|
cardEasyFormProps?: Omit<EasyFormProps, "nonuseFormWrapper" | "isPure" | "children">;
|
|
1835
|
+
/**
|
|
1836
|
+
* 定义卡片网格水平跨度,最大值:24,默认值:24;设置 onCustomWrapper 后失效
|
|
1837
|
+
* ```
|
|
1838
|
+
* 1. 外层宽度在 xs、sm 时,强制为24
|
|
1839
|
+
* ```
|
|
1840
|
+
*/
|
|
1841
|
+
boxGridColSpan?: number;
|
|
1816
1842
|
/**
|
|
1817
1843
|
* 默认卡片右侧布局,设置 onCustomWrapper 后失效
|
|
1818
1844
|
* ```
|
|
@@ -3419,7 +3445,7 @@ export interface ErrorBoundaryStates {
|
|
|
3419
3445
|
componentStack?: string;
|
|
3420
3446
|
};
|
|
3421
3447
|
}
|
|
3422
|
-
declare class ErrorBoundary extends
|
|
3448
|
+
declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryStates> {
|
|
3423
3449
|
state: {
|
|
3424
3450
|
error: undefined;
|
|
3425
3451
|
info: {
|
|
@@ -3427,7 +3453,7 @@ declare class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBou
|
|
|
3427
3453
|
};
|
|
3428
3454
|
};
|
|
3429
3455
|
componentDidCatch(error: Error | null, info: object): void;
|
|
3430
|
-
render(): string | number | boolean | Iterable<
|
|
3456
|
+
render(): string | number | boolean | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element | null | undefined;
|
|
3431
3457
|
}
|
|
3432
3458
|
/**
|
|
3433
3459
|
* react 异常拦截
|
|
@@ -3618,6 +3644,7 @@ export declare const fbaHooks: {
|
|
|
3618
3644
|
];
|
|
3619
3645
|
useMemoCustom: <T>(fn: () => T, deps: import("react").DependencyList) => T;
|
|
3620
3646
|
useCopyRemoveSpace: (props?: CopyRemoveSpaceProps) => void;
|
|
3647
|
+
useUuid: () => string;
|
|
3621
3648
|
};
|
|
3622
3649
|
declare function attachPropertiesToComponent<C, P extends Record<string, unknown>>(component: C, properties: P): C & P;
|
|
3623
3650
|
export declare const fbaUtils: {
|
|
@@ -4845,6 +4872,30 @@ export type TRelationTreeOperate = {
|
|
|
4845
4872
|
onChange: (name: string, value: TAny) => void;
|
|
4846
4873
|
};
|
|
4847
4874
|
export declare const RelationTree: (props: RelationTreeProps) => import("react/jsx-runtime").JSX.Element;
|
|
4875
|
+
export type ResizableDrawerProps = {
|
|
4876
|
+
open?: boolean;
|
|
4877
|
+
onClose: () => void;
|
|
4878
|
+
title?: React.ReactNode;
|
|
4879
|
+
width?: number | string;
|
|
4880
|
+
children?: React.ReactNode;
|
|
4881
|
+
footer?: React.ReactNode | null;
|
|
4882
|
+
hidenFooter?: boolean;
|
|
4883
|
+
maskClosable?: boolean;
|
|
4884
|
+
mask?: boolean;
|
|
4885
|
+
className?: string;
|
|
4886
|
+
style?: React.CSSProperties;
|
|
4887
|
+
styles?: {
|
|
4888
|
+
header?: CSSProperties;
|
|
4889
|
+
body?: CSSProperties;
|
|
4890
|
+
footer?: CSSProperties;
|
|
4891
|
+
};
|
|
4892
|
+
headerExtraRender?: ReactElement;
|
|
4893
|
+
zIndex?: number;
|
|
4894
|
+
cancelText?: string;
|
|
4895
|
+
okText?: string;
|
|
4896
|
+
onOk?: (e: React.MouseEvent<HTMLElement>) => void | Promise<void>;
|
|
4897
|
+
};
|
|
4898
|
+
export declare const ResizableDrawer: React.FC<ResizableDrawerProps>;
|
|
4848
4899
|
export interface RichTextEditorProps extends Omit<IAllProps, "onChange" | "init"> {
|
|
4849
4900
|
/** 设置高度,默认:500 */
|
|
4850
4901
|
height?: number;
|
|
@@ -6041,6 +6092,7 @@ export type TipsTitleProps = {
|
|
|
6041
6092
|
style?: CSSProperties;
|
|
6042
6093
|
title: string | ReactElement;
|
|
6043
6094
|
titleStyle?: CSSProperties;
|
|
6095
|
+
contentStyle?: CSSProperties;
|
|
6044
6096
|
children: ReactNode;
|
|
6045
6097
|
size?: "default" | "small";
|
|
6046
6098
|
/** 自定义 help icon */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flatbiz/antd",
|
|
3
|
-
"version": "4.5.
|
|
3
|
+
"version": "4.5.49",
|
|
4
4
|
"description": "flat-biz ui components",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"typings": "index.d.ts",
|
|
@@ -37,7 +37,8 @@
|
|
|
37
37
|
"antd": ">=5.11.0",
|
|
38
38
|
"dayjs": ">=1.11.9",
|
|
39
39
|
"react": ">=18.2.0",
|
|
40
|
-
"react-dom": ">=18.2.0"
|
|
40
|
+
"react-dom": ">=18.2.0",
|
|
41
|
+
"@flatbiz/ai-request": ">=4.0.1"
|
|
41
42
|
},
|
|
42
43
|
"devDependencies": {
|
|
43
44
|
"@ant-design/icons": "^5.0.1",
|
|
@@ -57,9 +58,11 @@
|
|
|
57
58
|
"react-dom": "18.2.0",
|
|
58
59
|
"react-is": "^18.2.0",
|
|
59
60
|
"sql-formatter": "^15.0.2",
|
|
60
|
-
"xml-formatter": "^3.6.2"
|
|
61
|
+
"xml-formatter": "^3.6.2",
|
|
62
|
+
"@flatbiz/ai-request": "^4.0.1"
|
|
61
63
|
},
|
|
62
64
|
"dependencies": {
|
|
65
|
+
"react-resizable": "^3.0.5",
|
|
63
66
|
"@dnd-kit/core": "^6.0.8",
|
|
64
67
|
"@dnd-kit/modifiers": "^6.0.1",
|
|
65
68
|
"@dnd-kit/sortable": "^7.0.2",
|