@flatbiz/antd 4.5.54 → 4.5.56
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-groovy/index.js +1 -1
- package/esm/ace-editor-groovy/index.js.map +1 -1
- package/esm/ace-editor-java/index.js +1 -1
- package/esm/ace-editor-java/index.js.map +1 -1
- 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/anchor-steps/index.js +1 -1
- package/esm/anchor-steps/index.js.map +1 -1
- package/esm/bootstrap/index.js +1 -1
- package/esm/bootstrap/index.js.map +1 -1
- package/esm/box-grid/index.js +1 -1
- package/esm/box-grid/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/card-layout/index.js +1 -1
- package/esm/card-layout/index.js.map +1 -1
- package/esm/cascader-wrapper/index.css +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/checkbox-wrapper/index.js +1 -1
- package/esm/checkbox-wrapper/index.js.map +1 -1
- package/esm/code-render/index.css +1 -0
- package/esm/code-render/index.js +5 -0
- package/esm/code-render/index.js.map +1 -0
- package/esm/color-picker-wrapper/index.css +1 -1
- package/esm/color-picker-wrapper/index.js +1 -1
- package/esm/color-picker-wrapper/index.js.map +1 -1
- package/esm/config-provider-wrapper/index.js +1 -1
- package/esm/copy-wrapper/index.js +1 -1
- package/esm/copy-wrapper/index.js.map +1 -1
- package/esm/date-picker-wrapper/index.js +1 -1
- package/esm/date-picker-wrapper/index.js.map +1 -1
- package/esm/date-range-picker-wrapper/index.js +1 -1
- package/esm/date-range-picker-wrapper/index.js.map +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/delete-node/index.js +1 -1
- package/esm/delete-node/index.js.map +1 -1
- package/esm/dialog-alert/index.js +1 -1
- package/esm/dialog-confirm/index.js +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.js +1 -1
- 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/drag-table/index.js +1 -1
- package/esm/drag-table/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.js +1 -1
- 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/editor-wrapper/index.js +1 -1
- package/esm/editor-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/fba-utils/index.js +1 -1
- package/esm/fba-utils/index.js.map +1 -1
- package/esm/file-export/index.js +1 -1
- package/esm/file-export/index.js.map +1 -1
- package/esm/file-import/index.js +1 -1
- package/esm/file-import/index.js.map +1 -1
- package/esm/file-select/index.js +1 -1
- package/esm/file-select/index.js.map +1 -1
- package/esm/flex-layout/index.js +1 -1
- package/esm/flex-layout/index.js.map +1 -1
- package/esm/form-grid/index.js +1 -1
- package/esm/form-grid/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/form-wrapper/index.js +1 -1
- package/esm/form-wrapper/index.js.map +1 -1
- package/esm/full-screen/index.js +1 -1
- package/esm/full-screen/index.js.map +1 -1
- package/esm/icon-wrapper/index.js +1 -1
- package/esm/icon-wrapper/index.js.map +1 -1
- package/esm/index-636a568e.js +8 -0
- package/esm/index-636a568e.js.map +1 -0
- package/esm/{index-83bede1b.js → index-853b36e6.js} +2 -2
- package/esm/{index-83bede1b.js.map → index-853b36e6.js.map} +1 -1
- package/esm/index.js +2 -2
- 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-layout/index.js +1 -1
- package/esm/label-value-layout/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-action/index.js +1 -1
- package/esm/modal-action/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/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/radio-group-wrapper/index.js +1 -1
- package/esm/radio-group-wrapper/index.js.map +1 -1
- package/esm/relation-tree/index.js +1 -1
- package/esm/relation-tree/index.js.map +1 -1
- package/esm/request-status/index.css +1 -1
- package/esm/request-status/index.js +2 -1
- package/esm/request-status/index.js.map +1 -1
- package/esm/resizable-drawer/index.js +1 -6
- package/esm/resizable-drawer/index.js.map +1 -1
- 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.css +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/sms-count-down/index.js +1 -1
- package/esm/sms-count-down/index.js.map +1 -1
- package/esm/split-wrapper/index.js +1 -1
- package/esm/split-wrapper/index.js.map +1 -1
- package/esm/styles/index.css +1 -1
- package/esm/svg-http-view/index.js +1 -1
- package/esm/svg-http-view/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/switch-wrapper/index.js +1 -1
- package/esm/switch-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/tabs-sticky/index.js +1 -1
- package/esm/tabs-sticky/index.js.map +1 -1
- package/esm/tabs-wrapper/index.js +1 -1
- package/esm/tabs-wrapper/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-list-render/index.js +1 -1
- package/esm/tag-list-render/index.js.map +1 -1
- package/esm/tag-list-select/index.js +1 -1
- package/esm/tag-list-select/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-symbol-wrapper/index.js +1 -1
- package/esm/text-symbol-wrapper/index.js.map +1 -1
- package/esm/time-ea73b2fb.js +3 -0
- package/esm/{time-53b3f55f.js.map → time-ea73b2fb.js.map} +1 -1
- package/esm/time-picker-wrapper/index.js +1 -1
- package/esm/time-picker-wrapper/index.js.map +1 -1
- package/esm/time-range-picker-wrapper/index.js +1 -1
- package/esm/time-range-picker-wrapper/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/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 +2 -2
- 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/esm/use-responsive-point-1e6d93d9.js +3 -0
- package/esm/{use-responsive-point-21b8c601.js.map → use-responsive-point-1e6d93d9.js.map} +1 -1
- package/esm/x-mind-preview/index.js +1 -1
- package/esm/x-mind-preview/index.js.map +1 -1
- package/index.d.ts +51 -28
- package/package.json +4 -5
- package/esm/ai-search/index.css +0 -0
- package/esm/ai-search/index.js +0 -11
- package/esm/ai-search/index.js.map +0 -1
- package/esm/time-53b3f55f.js +0 -3
- package/esm/use-responsive-point-21b8c601.js +0 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-responsive-point-
|
|
1
|
+
{"version":3,"file":"use-responsive-point-1e6d93d9.js","sources":["@flatbiz/antd/src/fba-hooks/use-responsive-point.ts"],"sourcesContent":["import { Grid } from 'antd';\nimport { useMemo } from 'react';\n\n/**\n * 获取响应式节点\n * ```\n * xs < 576px\n * sm ≥ 576px\n * md ≥ 768px\n * lg ≥ 992px\n * xl ≥ 1200px\n * xxl ≥ 1600px\n * ```\n */\nexport const useResponsivePoint = () => {\n const screens = Grid.useBreakpoint();\n return useMemo(() => {\n const filter = Object.keys(screens).filter((key) => {\n return screens[key] === true;\n });\n const order = ['xxl', 'xl', 'lg', 'md', 'sm', 'xs'];\n const targetIndex = order.findIndex((key) => filter.includes(key));\n return order[targetIndex] as string | undefined;\n }, [screens]);\n};\n"],"names":["useResponsivePoint","screens","Grid","useBreakpoint","useMemo","filter","Object","keys","key","order","targetIndex","findIndex","includes"],"mappings":";gEAcaA,EAAqB,SAArBA,IACX,IAAMC,EAAUC,EAAKC,gBACrB,OAAOC,EAAQ,WACb,IAAMC,EAASC,OAAOC,KAAKN,GAASI,OAAO,SAACG,GAC1C,OAAOP,EAAQO,KAAS,IAC1B,GACA,IAAMC,EAAQ,CAAC,MAAO,KAAM,KAAM,KAAM,KAAM,MAC9C,IAAMC,EAAcD,EAAME,UAAU,SAACH,GAAG,OAAKH,EAAOO,SAASJ,KAC7D,OAAOC,EAAMC,EACf,EAAG,CAACT,GACN"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
2
|
import './index.css';
|
|
3
3
|
/*! @flatjs/forge MIT @flatbiz/antd */
|
|
4
|
-
import{classNames as r}from"@dimjs/utils/cjs/class-names";import{getUuid as e}from"@flatbiz/utils";import{useDebounceFn as n}from"ahooks";import{useRef as t,useCallback as i,useState as a,useEffect as o}from"react";import{createRoot as u}from"react-dom/client";import d from"simple-mind-map";import{jsx as c}from"react/jsx-runtime";function m(r){var e=t(r);e.current=r;return i(
|
|
4
|
+
import{classNames as r}from"@dimjs/utils/cjs/class-names";import{getUuid as e}from"@flatbiz/utils";import{useDebounceFn as n}from"ahooks";import{useRef as t,useCallback as i,useState as a,useEffect as o}from"react";import{createRoot as u}from"react-dom/client";import d from"simple-mind-map";import{jsx as c}from"react/jsx-runtime";function m(r){var e=t(r);e.current=r;return i(function(){for(var r=arguments.length,n=new Array(r),t=0;t<r;t++){n[t]=arguments[t]}return e.current==null?void 0:e.current.apply(e,n)},[])}var l=function i(l){var f=l.data,s=l.className,v=l.style,p=l.renderNode;var w=a(false),h=w[0],y=w[1];var M=t({id:"",mindMap:{}});if(!M.current.id){M.current.id="mindMapContainer-"+e()}o(function(){var r=new d({el:document.getElementById(M.current.id),fit:true,data:f,readonly:true,isUseCustomNodeContent:!!p,customCreateNodeContent:function r(e){var n=p==null?void 0:p(e.nodeData);if(!n)return null;var t=document.createElement("div");var i=n.width,a=n.height,o=n.reactNode;t.style.width=(i||200)+"px";t.style.height=(a||22)+"px";var d=u(t);d.render(o);return t}});M.current.mindMap=r;f&&y(true);return function(){r.destroy()}},[]);o(function(){var r=M.current.mindMap;if(!r)return;!h&&g("node_tree_render_end",function(){r.view.fit();y(true)});r.setData(f||{})},[f]);o(function(){window.addEventListener("resize",C);return function(){window.removeEventListener("resize",C)}},[]);var N=n(function(){var r;M==null||(r=M.current.mindMap)==null||r.resize()}),x=N.run;var C=m(x);var g=m(function(r,e){var n=function t(){e();M.current.mindMap.off(r,n)};M.current.mindMap.on(r,n)});return c("div",{className:r("x-mind-preview-panel-wrap",s),style:v,children:c("div",{id:M.current.id})})};export{l as XMindPreview};
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["@flatbiz/antd/src/x-mind-preview/_hooks/use-callback-ref.tsx","@flatbiz/antd/src/x-mind-preview/x-mind-preview.tsx"],"sourcesContent":["import { useCallback, useRef } from 'react';\n\nexport function useCallbackRef<T extends (...args) => unknown>(fn: T | undefined): T {\n const ref = useRef(fn);\n\n ref.current = fn;\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return useCallback(((...args) => ref.current?.(...args)) as T, []);\n}\n","import { classNames } from '@dimjs/utils';\nimport { getUuid } from '@flatbiz/utils';\nimport { useDebounceFn } from 'ahooks';\nimport { useEffect, useRef, useState, type FC } from 'react';\nimport { createRoot } from 'react-dom/client';\nimport MindMap from 'simple-mind-map';\nimport type { TXMindTreeItem } from './type';\nimport './x-mind-preview.less';\nimport { useCallbackRef } from './_hooks/use-callback-ref';\n\nexport interface IXMindPreviewProps {\n data?: TXMindTreeItem;\n className?: string;\n style?: React.CSSProperties;\n /**\n * 自定义节点渲染内容:\n * 默认情况 xmind 会自动计算节点的宽高,\n * 自定义渲染react组件,因为初始拿不到宽高,所以要返回一个节点宽高\n * - 默认宽高 200 22\n * - 返回值为空则使用默认渲染\n * @param node\n * @returns\n */\n renderNode?: (node: TXMindTreeItem) => {\n width?: number;\n height?: number;\n reactNode: React.ReactNode;\n } | void;\n}\nexport const XMindPreview: FC<IXMindPreviewProps> = (props) => {\n const { data, className, style, renderNode } = props;\n const [isInitData, setIsInitData] = useState(false);\n\n const comRef = useRef({\n id: '',\n mindMap: {} as MindMap,\n });\n /** 防止dom id重复,id在一个组件内需要时唯一的 */\n if (!comRef.current.id) {\n comRef.current.id = `mindMapContainer-${getUuid()}`;\n }\n\n useEffect(() => {\n const mindMap = new MindMap({\n el: document.getElementById(comRef.current.id),\n fit: true,\n data,\n readonly: true,\n isUseCustomNodeContent: !!renderNode,\n customCreateNodeContent: (node) => {\n const customRenderOption = renderNode?.(node.nodeData);\n // 默认渲染\n if (!customRenderOption) return null;\n\n const el = document.createElement('div');\n // 自定义渲染\n const { width, height, reactNode } = customRenderOption;\n el.style.width = `${width || 200}px`;\n el.style.height = `${height || 22}px`;\n const root = createRoot(el);\n root.render(reactNode);\n\n return el;\n },\n } as ConstructorParameters<typeof MindMap>[0]);\n comRef.current.mindMap = mindMap;\n data && setIsInitData(true);\n\n return () => {\n mindMap.destroy();\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n /** 数据更新重置状态 */\n useEffect(() => {\n const { mindMap } = comRef.current;\n if (!mindMap) return;\n\n /** 只有第一次渲染的时候更新画布位置 */\n !isInitData &&\n handleListenOnce('node_tree_render_end', () => {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n mindMap.view.fit();\n setIsInitData(true);\n });\n mindMap.setData(data || {});\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [data]);\n\n // 屏幕自适应\n useEffect(() => {\n window.addEventListener('resize', handleResize);\n return () => {\n window.removeEventListener('resize', handleResize);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n const { run: handleResizeDebounce } = useDebounceFn(() => {\n comRef?.current.mindMap?.resize();\n });\n const handleResize = useCallbackRef(handleResizeDebounce);\n\n // 监听一次事件\n const handleListenOnce = useCallbackRef((eventName: string, callback: () => void) => {\n const fun = () => {\n callback();\n comRef.current.mindMap.off(eventName, fun);\n };\n comRef.current.mindMap.on(eventName, fun);\n });\n\n return (\n <div className={classNames('x-mind-preview-panel-wrap', className)} style={style}>\n <div id={comRef.current.id}></div>\n </div>\n );\n};\n"],"names":["useCallbackRef","fn","ref","useRef","current","useCallback","_len","arguments","length","args","Array","_key","apply","XMindPreview","props","data","className","style","renderNode","_useState","useState","isInitData","setIsInitData","comRef","id","mindMap","getUuid","useEffect","MindMap","el","document","getElementById","fit","readonly","isUseCustomNodeContent","customCreateNodeContent","node","customRenderOption","nodeData","createElement","width","height","reactNode","root","createRoot","render","destroy","handleListenOnce","view","setData","window","addEventListener","handleResize","removeEventListener","_useDebounceFn","useDebounceFn","_comRef$current$mindM","resize","handleResizeDebounce","run","eventName","callback","fun","off","on","_jsx","_classNames","children"],"mappings":";4UAEO,SAASA,EAA+CC,GAC7D,IAAMC,EAAMC,EAAOF,GAEnBC,EAAIE,QAAUH,EAGd,OAAOI,
|
|
1
|
+
{"version":3,"file":"index.js","sources":["@flatbiz/antd/src/x-mind-preview/_hooks/use-callback-ref.tsx","@flatbiz/antd/src/x-mind-preview/x-mind-preview.tsx"],"sourcesContent":["import { useCallback, useRef } from 'react';\n\nexport function useCallbackRef<T extends (...args) => unknown>(fn: T | undefined): T {\n const ref = useRef(fn);\n\n ref.current = fn;\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return useCallback(((...args) => ref.current?.(...args)) as T, []);\n}\n","import { classNames } from '@dimjs/utils';\nimport { getUuid } from '@flatbiz/utils';\nimport { useDebounceFn } from 'ahooks';\nimport { useEffect, useRef, useState, type FC } from 'react';\nimport { createRoot } from 'react-dom/client';\nimport MindMap from 'simple-mind-map';\nimport type { TXMindTreeItem } from './type';\nimport './x-mind-preview.less';\nimport { useCallbackRef } from './_hooks/use-callback-ref';\n\nexport interface IXMindPreviewProps {\n data?: TXMindTreeItem;\n className?: string;\n style?: React.CSSProperties;\n /**\n * 自定义节点渲染内容:\n * 默认情况 xmind 会自动计算节点的宽高,\n * 自定义渲染react组件,因为初始拿不到宽高,所以要返回一个节点宽高\n * - 默认宽高 200 22\n * - 返回值为空则使用默认渲染\n * @param node\n * @returns\n */\n renderNode?: (node: TXMindTreeItem) => {\n width?: number;\n height?: number;\n reactNode: React.ReactNode;\n } | void;\n}\nexport const XMindPreview: FC<IXMindPreviewProps> = (props) => {\n const { data, className, style, renderNode } = props;\n const [isInitData, setIsInitData] = useState(false);\n\n const comRef = useRef({\n id: '',\n mindMap: {} as MindMap,\n });\n /** 防止dom id重复,id在一个组件内需要时唯一的 */\n if (!comRef.current.id) {\n comRef.current.id = `mindMapContainer-${getUuid()}`;\n }\n\n useEffect(() => {\n const mindMap = new MindMap({\n el: document.getElementById(comRef.current.id),\n fit: true,\n data,\n readonly: true,\n isUseCustomNodeContent: !!renderNode,\n customCreateNodeContent: (node) => {\n const customRenderOption = renderNode?.(node.nodeData);\n // 默认渲染\n if (!customRenderOption) return null;\n\n const el = document.createElement('div');\n // 自定义渲染\n const { width, height, reactNode } = customRenderOption;\n el.style.width = `${width || 200}px`;\n el.style.height = `${height || 22}px`;\n const root = createRoot(el);\n root.render(reactNode);\n\n return el;\n },\n } as ConstructorParameters<typeof MindMap>[0]);\n comRef.current.mindMap = mindMap;\n data && setIsInitData(true);\n\n return () => {\n mindMap.destroy();\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n /** 数据更新重置状态 */\n useEffect(() => {\n const { mindMap } = comRef.current;\n if (!mindMap) return;\n\n /** 只有第一次渲染的时候更新画布位置 */\n !isInitData &&\n handleListenOnce('node_tree_render_end', () => {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n mindMap.view.fit();\n setIsInitData(true);\n });\n mindMap.setData(data || {});\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [data]);\n\n // 屏幕自适应\n useEffect(() => {\n window.addEventListener('resize', handleResize);\n return () => {\n window.removeEventListener('resize', handleResize);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n const { run: handleResizeDebounce } = useDebounceFn(() => {\n comRef?.current.mindMap?.resize();\n });\n const handleResize = useCallbackRef(handleResizeDebounce);\n\n // 监听一次事件\n const handleListenOnce = useCallbackRef((eventName: string, callback: () => void) => {\n const fun = () => {\n callback();\n comRef.current.mindMap.off(eventName, fun);\n };\n comRef.current.mindMap.on(eventName, fun);\n });\n\n return (\n <div className={classNames('x-mind-preview-panel-wrap', className)} style={style}>\n <div id={comRef.current.id}></div>\n </div>\n );\n};\n"],"names":["useCallbackRef","fn","ref","useRef","current","useCallback","_len","arguments","length","args","Array","_key","apply","XMindPreview","props","data","className","style","renderNode","_useState","useState","isInitData","setIsInitData","comRef","id","mindMap","getUuid","useEffect","MindMap","el","document","getElementById","fit","readonly","isUseCustomNodeContent","customCreateNodeContent","node","customRenderOption","nodeData","createElement","width","height","reactNode","root","createRoot","render","destroy","handleListenOnce","view","setData","window","addEventListener","handleResize","removeEventListener","_useDebounceFn","useDebounceFn","_comRef$current$mindM","resize","handleResizeDebounce","run","eventName","callback","fun","off","on","_jsx","_classNames","children"],"mappings":";4UAEO,SAASA,EAA+CC,GAC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c,MAEtB,OAAO,WACLG,EAAQqB,UAGX,EAAE,IAGHnB,EAAU,WACR,IAAQF,EAAYF,EAAOnB,QAAnBqB,QACR,IAAKA,EAAS,QAGbJ,GACC0B,EAAiB,uBAAwB,WAGvCtB,EAAQuB,KAAKhB,MACbV,EAAc,KAChB,GACFG,EAAQwB,QAAQlC,GAAQ,CAAA,EAE1B,EAAG,CAACA,IAGJY,EAAU,WACRuB,OAAOC,iBAAiB,SAAUC,GAClC,OAAO,WACLF,OAAOG,oBAAoB,SAAUD,GAGxC,EAAE,IACH,IAAAE,EAAsCC,EAAc,WAAM,IAAAC,EACxDjC,GAAMiC,OAAAA,EAANjC,EAAQnB,QAAQqB,UAAhB+B,MAAAA,EAAyBC,QAC3B,GAFaC,EAAoBJ,EAAzBK,IAGR,IAAMP,EAAepD,EAAe0D,GAGpC,IAAMX,EAAmB/C,EAAe,SAAC4D,EAAmBC,GAC1D,IAAMC,EAAM,SAANA,IACJD,IACAtC,EAAOnB,QAAQqB,QAAQsC,IAAIH,EAAWE,IAExCvC,EAAOnB,QAAQqB,QAAQuC,GAAGJ,EAAWE,EACvC,GAEA,OACEG,EAAA,MAAA,CAAKjD,UAAWkD,EAAW,4BAA6BlD,GAAYC,MAAOA,EAAMkD,SAC/EF,EAAA,MAAA,CAAKzC,GAAID,EAAOnB,QAAQoB,MAG9B"}
|
package/index.d.ts
CHANGED
|
@@ -188,29 +188,6 @@ 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;
|
|
214
191
|
export type AlertWrapperProps = AlertProps & {
|
|
215
192
|
size?: "small" | "default" | "large";
|
|
216
193
|
};
|
|
@@ -701,7 +678,7 @@ export declare const CardLayout: {
|
|
|
701
678
|
* @returns
|
|
702
679
|
*/
|
|
703
680
|
export declare const CardWrapper: (props: CardProps) => import("react/jsx-runtime").JSX.Element;
|
|
704
|
-
export type TRequestStatus = "request-init" | "request-progress" | "request-success" | "request-error" | "no-dependencies-params";
|
|
681
|
+
export type TRequestStatus = "request-init" | "request-progress" | "request-success" | "request-error" | "request-search-keyword-empty" | "no-dependencies-params";
|
|
705
682
|
export type TRequestStatusProps = {
|
|
706
683
|
status?: TRequestStatus;
|
|
707
684
|
errorButton?: ReactElement;
|
|
@@ -870,6 +847,37 @@ export type CheckboxWrapperProps = Omit<CheckboxProps, "checked" | "defaultCheck
|
|
|
870
847
|
* ```
|
|
871
848
|
*/
|
|
872
849
|
export declare const CheckboxWrapper: (props: CheckboxWrapperProps) => import("react/jsx-runtime").JSX.Element;
|
|
850
|
+
export type CodeRenderProps = {
|
|
851
|
+
code?: string;
|
|
852
|
+
className?: string;
|
|
853
|
+
style?: React.CSSProperties;
|
|
854
|
+
};
|
|
855
|
+
/**
|
|
856
|
+
* 代码、json格式化渲染
|
|
857
|
+
* ```
|
|
858
|
+
* 例如:
|
|
859
|
+
* // json数据渲染
|
|
860
|
+
* <CodeWrapper code={JSON.stringify(data, null, 2)}/>
|
|
861
|
+
*
|
|
862
|
+
* // 代码渲染
|
|
863
|
+
* <CodeWrapper code={`def results=[];
|
|
864
|
+
def datas=表单字段.dataList;
|
|
865
|
+
for index,data in datas do
|
|
866
|
+
def item = [
|
|
867
|
+
'a':data.DomainName,
|
|
868
|
+
'b':data.Owner,
|
|
869
|
+
'userName': 流程参数.发起人账号
|
|
870
|
+
];
|
|
871
|
+
results = results+item;
|
|
872
|
+
end
|
|
873
|
+
return results;
|
|
874
|
+
`
|
|
875
|
+
}/>
|
|
876
|
+
*
|
|
877
|
+
* ```
|
|
878
|
+
*
|
|
879
|
+
*/
|
|
880
|
+
export declare const CodeRender: (props: CodeRenderProps) => import("react/jsx-runtime").JSX.Element;
|
|
873
881
|
export type ColorPickerWrapperProps = Omit<ColorPickerProps, "value" | "onChange"> & {
|
|
874
882
|
/** 格式:#1677ff */
|
|
875
883
|
value?: string;
|
|
@@ -1736,7 +1744,7 @@ export type EditableCardColumnItem = {
|
|
|
1736
1744
|
* dataIndex: ['abc', 'xyz']
|
|
1737
1745
|
* ```
|
|
1738
1746
|
*/
|
|
1739
|
-
dataIndex: EditableCardDataIndex;
|
|
1747
|
+
dataIndex: EditableCardDataIndex | undefined;
|
|
1740
1748
|
/** 是否可编辑 */
|
|
1741
1749
|
editable: boolean | ((operation: Pick<EditableCardOperation, "index" | "getCurrentRowData">, index: number) => boolean);
|
|
1742
1750
|
/**
|
|
@@ -2090,11 +2098,14 @@ export type SelectorWrapperProps = Omit<SelectProps, "onSearch" | "notFoundConte
|
|
|
2090
2098
|
* ```
|
|
2091
2099
|
*/
|
|
2092
2100
|
useCache?: boolean;
|
|
2101
|
+
/** 是否显示刷新图标 */
|
|
2102
|
+
showRefreshIcon?: boolean;
|
|
2093
2103
|
};
|
|
2094
2104
|
/**
|
|
2095
2105
|
* 选择器包装组件
|
|
2096
2106
|
* ```
|
|
2097
2107
|
* 1. 不支持搜索调用服务模式,可使用组件 SelectorWrapperSearch
|
|
2108
|
+
* 2. 修改文案【未获取到必要的查询条件】,通过参数 requestMessageConfig={{'no-dependencies-params': '自定义文案'}} 配置
|
|
2098
2109
|
* ```
|
|
2099
2110
|
*/
|
|
2100
2111
|
export declare const SelectorWrapper: (props: SelectorWrapperProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -4345,7 +4356,7 @@ export type TLabelValueItem = {
|
|
|
4345
4356
|
label: string | ReactElement;
|
|
4346
4357
|
value?: string | number | ReactElement;
|
|
4347
4358
|
/** 根据LabelValueRender.column配置,当前item占几列 */
|
|
4348
|
-
span?: 1 | 2 | 3 | 4 | 6;
|
|
4359
|
+
span?: 1 | 2 | 3 | 4 | 6 | 12;
|
|
4349
4360
|
/** 是否隐藏 */
|
|
4350
4361
|
hidden?: boolean;
|
|
4351
4362
|
/** 超出宽度是否隐藏 */
|
|
@@ -4386,10 +4397,11 @@ export type LabelValueRenderProps = {
|
|
|
4386
4397
|
* 3: { xs: 24, sm: 12, md: 12, lg: 8, xl: 8, xxl: 8 },
|
|
4387
4398
|
* 4: { xs: 24, sm: 12, md: 12, lg: 6, xl: 6, xxl: 6 },
|
|
4388
4399
|
* 6: { xs: 24, sm: 12, md: 8, lg: 6, xl: 4, xxl: 4 },
|
|
4400
|
+
* 12: { xs: 24, sm: 12, md: 12, lg: 4, xl: 2, xxl: 2 },
|
|
4389
4401
|
* };
|
|
4390
4402
|
* ```
|
|
4391
4403
|
*/
|
|
4392
|
-
column?: 1 | 2 | 3 | 4 | 6;
|
|
4404
|
+
column?: 1 | 2 | 3 | 4 | 6 | 12;
|
|
4393
4405
|
/**
|
|
4394
4406
|
* 强制定义一行显示几列,不考虑响应式
|
|
4395
4407
|
* ```
|
|
@@ -5258,6 +5270,8 @@ export declare function SearchMenu(props: ISearchMenuProps & Pick<IListViewProps
|
|
|
5258
5270
|
export type SelectorWrapperSearchServiceConfig = {
|
|
5259
5271
|
params?: TPlainObject;
|
|
5260
5272
|
onRequest: (params?: TAny) => TAny;
|
|
5273
|
+
/** 与 params 配合使用 */
|
|
5274
|
+
requiredParamsKeys?: string[];
|
|
5261
5275
|
onRequestResultAdapter?: (respData: TAny) => TPlainObject[];
|
|
5262
5276
|
};
|
|
5263
5277
|
export type SelectorWrapperSearchProps = Omit<SelectProps, "onSearch" | "notFoundContent" | "options" | "fieldNames" | "loading"> & {
|
|
@@ -5293,7 +5307,9 @@ export type SelectorWrapperSearchProps = Omit<SelectProps, "onSearch" | "notFoun
|
|
|
5293
5307
|
onSelectorRequestError?: (error: Error) => void;
|
|
5294
5308
|
/** 交互文案配置 */
|
|
5295
5309
|
requestMessageConfig?: TRequestStatusProps["messageConfig"];
|
|
5310
|
+
/** label渲染适配器 */
|
|
5296
5311
|
onLabelRenderAdapter?: (dataItem: TPlainObject) => string | ReactElement;
|
|
5312
|
+
/** 自定义keyword值 */
|
|
5297
5313
|
customKeyword?: string;
|
|
5298
5314
|
};
|
|
5299
5315
|
/**
|
|
@@ -5304,6 +5320,8 @@ export type SelectorWrapperSearchProps = Omit<SelectProps, "onSearch" | "notFoun
|
|
|
5304
5320
|
* 1. 只支持 search + 服务 功能
|
|
5305
5321
|
* 2. 不会缓存接口数据
|
|
5306
5322
|
* 3. 不会对value、onChange做任何处理
|
|
5323
|
+
* 4. 修改文案【未获取到必要的查询条件】,通过参数 requestMessageConfig={{'no-dependencies-params': '自定义文案'}} 配置
|
|
5324
|
+
* 5. 通过设置 fieldNames.searchKeyword 可修改关键字key值,默认值:searchKeyword
|
|
5307
5325
|
* ```
|
|
5308
5326
|
*/
|
|
5309
5327
|
export declare const SelectorWrapperSearch: (props: SelectorWrapperSearchProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -5628,8 +5646,13 @@ export declare const tableCellRender: {
|
|
|
5628
5646
|
* table 序号展示,如果存在pageSize、pageNo参数可分页展示累加序号,否则每页都从1开始
|
|
5629
5647
|
* ```
|
|
5630
5648
|
* render: tableCellRender.serialNumberCell(() => {
|
|
5631
|
-
* return {
|
|
5649
|
+
* return {
|
|
5650
|
+
* pageNo: easyTableApi.getRequestParams().pageNo,
|
|
5651
|
+
* pageSize: easyTableApi.getRequestParams().pageSize,
|
|
5652
|
+
* }
|
|
5632
5653
|
* }),
|
|
5654
|
+
* 参考:
|
|
5655
|
+
* https://gitlab.itcjf.com/flatjs/flat-os/flat-oss-demo/blob/master/src/modules/crud/demo1/home/table.tsx
|
|
5633
5656
|
* ```
|
|
5634
5657
|
*/
|
|
5635
5658
|
serialNumberCell: (method?: () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flatbiz/antd",
|
|
3
|
-
"version": "4.5.
|
|
3
|
+
"version": "4.5.56",
|
|
4
4
|
"description": "flat-biz ui components",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"typings": "index.d.ts",
|
|
@@ -31,14 +31,13 @@
|
|
|
31
31
|
"@dimjs/model": ">=1.2.3",
|
|
32
32
|
"@dimjs/model-react": ">=1.2.3",
|
|
33
33
|
"@dimjs/utils": ">=1.5.1",
|
|
34
|
-
"@flatbiz/utils": ">=4.0.
|
|
34
|
+
"@flatbiz/utils": ">=4.0.34",
|
|
35
35
|
"@wove/react": ">=1.2.23",
|
|
36
36
|
"ahooks": ">=3.7.11",
|
|
37
37
|
"antd": ">=5.11.0",
|
|
38
38
|
"dayjs": ">=1.11.9",
|
|
39
39
|
"react": ">=18.2.0",
|
|
40
|
-
"react-dom": ">=18.2.0"
|
|
41
|
-
"@flatbiz/ai-request": ">=4.0.1"
|
|
40
|
+
"react-dom": ">=18.2.0"
|
|
42
41
|
},
|
|
43
42
|
"devDependencies": {
|
|
44
43
|
"@ant-design/icons": "^5.0.1",
|
|
@@ -46,7 +45,7 @@
|
|
|
46
45
|
"@dimjs/model": "^1.2.3",
|
|
47
46
|
"@dimjs/model-react": "^1.2.3",
|
|
48
47
|
"@dimjs/utils": "^1.5.1",
|
|
49
|
-
"@flatbiz/utils": "^4.0.
|
|
48
|
+
"@flatbiz/utils": "^4.0.34",
|
|
50
49
|
"@wove/react": "^1.2.23",
|
|
51
50
|
"ace-builds": "^1.32.2",
|
|
52
51
|
"ahooks": "^3.7.11",
|
package/esm/ai-search/index.css
DELETED
|
File without changes
|
package/esm/ai-search/index.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
import './../button-wrapper/index.css';
|
|
3
|
-
import './../config-provider-wrapper/index.css';
|
|
4
|
-
import './../fba-hooks/index.css';
|
|
5
|
-
import './../types/index.css';
|
|
6
|
-
import './../fba-utils/index.css';
|
|
7
|
-
import './../flex-layout/index.css';
|
|
8
|
-
import './index.css';
|
|
9
|
-
/*! @flatjs/forge MIT @flatbiz/antd */
|
|
10
|
-
import{classNames as r}from"@dimjs/utils/cjs/class-names";import{aiRequestStop as e,aiRequest as t}from"@flatbiz/ai-request";import{isNotEmptyArray as i}from"@flatbiz/utils";import{Spin as o,Input as n,Progress as a,message as s}from"antd";import{useState as l,useEffect as m}from"react";import{ButtonWrapper as u}from"../button-wrapper/index.js";import{FlexLayout as c}from"../flex-layout/index.js";import{jsxs as p,jsx as d}from"react/jsx-runtime";import"@ant-design/icons/es/icons/LoadingOutlined";import"../_rollupPluginBabelHelpers-c0dbec57.js";import"@dimjs/lang/cjs/is-promise";import"@wove/react/cjs/hooks";import"../index-83bede1b.js";import"antd/es/locale/en_US";import"antd/es/locale/zh_CN";import"dayjs";import"dayjs/locale/en";import"dayjs/locale/zh-cn";import"dayjs/plugin/advancedFormat";import"dayjs/plugin/customParseFormat";import"dayjs/plugin/localeData";import"dayjs/plugin/utc";import"dayjs/plugin/weekday";import"dayjs/plugin/weekOfYear";import"dayjs/plugin/weekYear";import"../fba-hooks/index.js";import"@dimjs/lang/cjs/is-array";import"../use-responsive-point-21b8c601.js";import"@dimjs/utils/cjs/uuid";import"@dimjs/utils/cjs/extend";import"../fba-utils/index.js";import"@dimjs/model";var f=function f(j){var y=l(0),g=y[0],v=y[1];var h=l(false),x=h[0],w=h[1];var b=l(),k=b[0],z=b[1];var C=l(false),A=C[0],I=C[1];var P=(j.progressTime||10)*1e3/100;m((function(){if(x){var r=setTimeout((function(){var r=g+1;v(r>95?95:r)}),P);return function(){clearInterval(r)}}else{v(0)}return function(){}}),[x,g,P]);var T=function r(){return new Promise((function(r,e){var o,n,a;I(true);if(!k)return r();var l=function(){try{return r()}catch(r){return e(r)}};var m=function(r){try{void s.error((r==null?void 0:r["message"])||"AI搜索异常");w(false);return l()}catch(r){return e(r)}};try{w(true);o=Date.now();return Promise.resolve(t({questionContent:j.getPromptValue(k),stream:j.stream})).then((function(r){try{n=r;w(false);if(i(n)){j.onAiCallback(n)}else{j.onAiCallback([]);void s.warning("AI搜索结果为空")}a=Date.now();console.log("AI智能查询耗时",(a-o)/1e3);return l()}catch(r){return m(r)}}),m)}catch(r){m(r)}}))};return p("div",{className:r("ai-search",j.className),style:j.style,children:[p("div",{style:{position:"relative"},children:[d(o,{spinning:x,children:d(n.TextArea,{placeholder:j.placeholder,autoSize:j.inputAutoSize||{minRows:3,maxRows:3},status:A&&!k?"error":undefined,onChange:function r(e){z(e.target.value)}})}),d("div",{style:{position:"absolute",left:0,right:0,zIndex:99,bottom:-20},children:g>0?d(a,{percent:g,strokeColor:{"0%":"#108ee9","100%":"#87d068"},style:{margin:0}}):null})]}),p(c,{fullIndex:[0,1],direction:"horizontal",gap:15,style:{marginTop:20},children:[d(u,{type:"primary",ghost:true,onClick:function r(){e();w(false)},children:"停止"}),d(u,{type:"primary",onClick:T,loadingPosition:"center",children:"查询"})]})]})};export{f as AiSearch};
|
|
11
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["@flatbiz/antd/src/ai-search/ai-search.tsx"],"sourcesContent":["import { classNames } from '@dimjs/utils';\nimport { aiRequest, aiRequestStop } from '@flatbiz/ai-request';\nimport { isNotEmptyArray, type TPlainObject } from '@flatbiz/utils';\nimport { Input, message, Progress, Spin } from 'antd';\nimport { useEffect, useState, type CSSProperties } from 'react';\nimport { ButtonWrapper } from '../button-wrapper';\nimport { FlexLayout } from '../flex-layout';\n\ntype AiSearchProps = {\n className?: string;\n style?: CSSProperties;\n /** 获取AI提示词 */\n getPromptValue: (inputValue: string) => string;\n /** AI回调 */\n onAiCallback: (dataList: TPlainObject[]) => void;\n /** 输入框placeholder */\n placeholder?: string;\n /** 默认值:{ minRows: 3, maxRows: 3 } */\n inputAutoSize?: { minRows?: number; maxRows?: number };\n /** 是否使用流式交互 */\n stream?: boolean;\n /** 设置进度条跑完时间,单位秒,默认值:10秒 */\n progressTime?: number;\n};\n\n/**\n * 与AI的一次交互,没有上下文\n */\nexport const AiSearch = (props: AiSearchProps) => {\n const [percent, setPercent] = useState(0);\n const [loading, setLoading] = useState(false);\n const [value, setValue] = useState<string | undefined>();\n const [submitFlag, setSubmitFlag] = useState<boolean>(false);\n\n const timeoutCount = ((props.progressTime || 10) * 1000) / 100;\n\n useEffect(() => {\n if (loading) {\n const interval = setTimeout(() => {\n const progress = percent + 1;\n setPercent(progress > 95 ? 95 : progress);\n }, timeoutCount);\n return () => {\n clearInterval(interval);\n };\n } else {\n setPercent(0);\n }\n return () => {\n //\n };\n }, [loading, percent, timeoutCount]);\n\n const onRequest = async () => {\n setSubmitFlag(true);\n if (!value) return;\n try {\n setLoading(true);\n const timeStart = Date.now();\n const respData = await aiRequest({\n questionContent: props.getPromptValue(value),\n stream: props.stream,\n });\n setLoading(false);\n if (isNotEmptyArray(respData)) {\n props.onAiCallback(respData);\n } else {\n props.onAiCallback([]);\n void message.warning('AI搜索结果为空');\n }\n const timeEnd = Date.now();\n console.log('AI智能查询耗时', (timeEnd - timeStart) / 1000);\n } catch (error) {\n void message.error(error?.['message'] || 'AI搜索异常');\n setLoading(false);\n }\n };\n\n return (\n <div className={classNames('ai-search', props.className)} style={props.style}>\n <div style={{ position: 'relative' }}>\n <Spin spinning={loading}>\n <Input.TextArea\n placeholder={props.placeholder}\n autoSize={props.inputAutoSize || { minRows: 3, maxRows: 3 }}\n status={submitFlag && !value ? 'error' : undefined}\n onChange={(e) => {\n setValue(e.target.value);\n }}\n />\n </Spin>\n <div\n style={{\n position: 'absolute',\n left: 0,\n right: 0,\n zIndex: 99,\n bottom: -20,\n }}\n >\n {percent > 0 ? (\n <Progress\n percent={percent}\n strokeColor={{\n '0%': '#108ee9',\n '100%': '#87d068',\n }}\n style={{ margin: 0 }}\n />\n ) : null}\n </div>\n </div>\n <FlexLayout fullIndex={[0, 1]} direction=\"horizontal\" gap={15} style={{ marginTop: 20 }}>\n <ButtonWrapper\n type=\"primary\"\n ghost\n onClick={() => {\n aiRequestStop();\n setLoading(false);\n }}\n >\n 停止\n </ButtonWrapper>\n <ButtonWrapper type=\"primary\" onClick={onRequest} loadingPosition=\"center\">\n 查询\n </ButtonWrapper>\n </FlexLayout>\n </div>\n );\n};\n"],"names":["AiSearch","props","_useState","useState","percent","setPercent","_useState2","loading","setLoading","_useState3","value","setValue","_useState4","submitFlag","setSubmitFlag","timeoutCount","progressTime","useEffect","interval","setTimeout","progress","clearInterval","onRequest","Promise","$return","$error","timeStart","respData","timeEnd","$Try_1_Post","$boundEx","$Try_1_Catch","error","message","Date","now","resolve","aiRequest","questionContent","getPromptValue","stream","then","$await_2","isNotEmptyArray","onAiCallback","warning","console","log","_jsxs","className","_classNames","style","children","position","_jsx","Spin","spinning","Input","TextArea","placeholder","autoSize","inputAutoSize","minRows","maxRows","status","undefined","onChange","e","target","left","right","zIndex","bottom","Progress","strokeColor","margin","FlexLayout","fullIndex","direction","gap","marginTop","ButtonWrapper","type","ghost","onClick","aiRequestStop","loadingPosition"],"mappings":";8rCA4BaA,EAAW,SAAXA,EAAYC,GACvB,IAAAC,EAA8BC,EAAS,GAAhCC,EAAOF,EAAA,GAAEG,EAAUH,EAAA,GAC1B,IAAAI,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YY-MM-DD HH:mm";r["YMDH"]="YYYY-MM-DD HH";r["YMD"]="YYYY-MM-DD";return r}({});var i=function(r){r["Hms"]="HH:mm:ss";r["Hm"]="HH:mm";r["H"]="HH";r["ms"]="mm:ss";r["m"]="mm";r["s"]="ss";return r}({});var t=function r(i,t){var e=[];for(var n=i;n<=t;n++){e.push(n)}return e};var e=function i(e,n){var a,m;if(!n||!e)return[];var u=0;var f=23;if(((a=n.minDateTime)==null?void 0:a.format(r.YMD))===e.format(r.YMD)){u=n.minDateTime.get("hour")}if(((m=n.maxDateTime)==null?void 0:m.format(r.YMD))===e.format(r.YMD)){f=n.maxDateTime.get("hour")}var o=t(u,f);if(n.disabledHourList){o=o.filter((function(r){var i;return!((i=n.disabledHourList)!=null&&i.includes(r))}))}return t(0,23).filter((function(r){return!o.includes(r)}))};var n=function i(e,n){var a,m;if(!n||!e)return[];var u=0;var f=59;if(((a=n.minDateTime)==null?void 0:a.format(r.YMDH))===e.format(r.YMDH)){u=n.minDateTime.get("minute")}if(((m=n.maxDateTime)==null?void 0:m.format(r.YMDH))===e.format(r.YMDH)){f=n.maxDateTime.get("minute")}var o=t(u,f);if(n.disabledMinuteList){o=o.filter((function(r){var i;return!((i=n.disabledMinuteList)!=null&&i.includes(r))}))}return t(0,59).filter((function(r){return!o.includes(r)}))};var a=function i(e,n){var a,m;if(!n||!e)return[];var u=0;var f=59;if(((a=n.minDateTime)==null?void 0:a.format(r.YMDHm))===e.format(r.YMDHm)){u=n.minDateTime.get("second")}if(((m=n.maxDateTime)==null?void 0:m.format(r.YMDHm))===e.format(r.YMDHm)){f=n.maxDateTime.get("second")}var o=t(u,f);if(n.disabledSecondList){o=o.filter((function(r){var i;return!((i=n.disabledSecondList)!=null&&i.includes(r))}))}return t(0,59).filter((function(r){return!o.includes(r)}))};export{r as D,n as a,a as b,i as c,e as g};
|
|
3
|
-
//# sourceMappingURL=time-53b3f55f.js.map
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
/*! @flatjs/forge MIT @flatbiz/antd */
|
|
2
|
-
import{Grid as r}from"antd";import{useMemo as n}from"react";var t=function t(){var e=r.useBreakpoint();return n((function(){var r=Object.keys(e).filter((function(r){return e[r]===true}));var n=["xxl","xl","lg","md","sm","xs"];var t=n.findIndex((function(n){return r.includes(n)}));return n[t]}),[e])};export{t as u};
|
|
3
|
-
//# sourceMappingURL=use-responsive-point-21b8c601.js.map
|