bi-components-library 1.0.6 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bi-components-library.css +1 -1
- package/dist/index.es.js +1204 -1178
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +6 -6
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(X,
|
|
1
|
+
(function(X,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("react"),require("antd"),require("@ant-design/icons"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","antd","@ant-design/icons","react-dom"],s):(X=typeof globalThis<"u"?globalThis:X||self,s(X.SealSeekBIComponents={},X.React,X.antd,X.AntdIcons,X.ReactDOM))})(this,function(X,s,G,ue,Me){"use strict";var ye={exports:{}},fe={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var
|
|
9
|
+
*/var we;function Be(){if(we)return fe;we=1;var t=Symbol.for("react.transitional.element"),f=Symbol.for("react.fragment");function u(l,i,m){var C=null;if(m!==void 0&&(C=""+m),i.key!==void 0&&(C=""+i.key),"key"in i){m={};for(var h in i)h!=="key"&&(m[h]=i[h])}else m=i;return i=m.ref,{$$typeof:t,type:l,key:C,ref:i!==void 0?i:null,props:m}}return fe.Fragment=f,fe.jsx=u,fe.jsxs=u,fe}var me={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,20 +14,20 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var
|
|
17
|
+
*/var Ee;function De(){return Ee||(Ee=1,process.env.NODE_ENV!=="production"&&function(){function t(c){if(c==null)return null;if(typeof c=="function")return c.$$typeof===K?null:c.displayName||c.name||null;if(typeof c=="string")return c;switch(c){case v:return"Fragment";case w:return"Profiler";case g:return"StrictMode";case E:return"Suspense";case q:return"SuspenseList";case P:return"Activity"}if(typeof c=="object")switch(typeof c.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),c.$$typeof){case A:return"Portal";case b:return(c.displayName||"Context")+".Provider";case I:return(c._context.displayName||"Context")+".Consumer";case T:var V=c.render;return c=c.displayName,c||(c=V.displayName||V.name||"",c=c!==""?"ForwardRef("+c+")":"ForwardRef"),c;case B:return V=c.displayName||null,V!==null?V:t(c.type)||"Memo";case D:V=c._payload,c=c._init;try{return t(c(V))}catch{}}return null}function f(c){return""+c}function u(c){try{f(c);var V=!1}catch{V=!0}if(V){V=console;var z=V.error,Q=typeof Symbol=="function"&&Symbol.toStringTag&&c[Symbol.toStringTag]||c.constructor.name||"Object";return z.call(V,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",Q),f(c)}}function l(c){if(c===v)return"<>";if(typeof c=="object"&&c!==null&&c.$$typeof===D)return"<...>";try{var V=t(c);return V?"<"+V+">":"<...>"}catch{return"<...>"}}function i(){var c=F.A;return c===null?null:c.getOwner()}function m(){return Error("react-stack-top-frame")}function C(c){if(Y.call(c,"key")){var V=Object.getOwnPropertyDescriptor(c,"key").get;if(V&&V.isReactWarning)return!1}return c.key!==void 0}function h(c,V){function z(){L||(L=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",V))}z.isReactWarning=!0,Object.defineProperty(c,"key",{get:z,configurable:!0})}function e(){var c=t(this.type);return U[c]||(U[c]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),c=this.props.ref,c!==void 0?c:null}function r(c,V,z,Q,oe,ee,de,a){return z=ee.ref,c={$$typeof:n,type:c,key:V,props:ee,_owner:oe},(z!==void 0?z:null)!==null?Object.defineProperty(c,"ref",{enumerable:!1,get:e}):Object.defineProperty(c,"ref",{enumerable:!1,value:null}),c._store={},Object.defineProperty(c._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(c,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(c,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:de}),Object.defineProperty(c,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:a}),Object.freeze&&(Object.freeze(c.props),Object.freeze(c)),c}function N(c,V,z,Q,oe,ee,de,a){var o=V.children;if(o!==void 0)if(Q)if($(o)){for(Q=0;Q<o.length;Q++)p(o[Q]);Object.freeze&&Object.freeze(o)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else p(o);if(Y.call(V,"key")){o=t(c);var y=Object.keys(V).filter(function(x){return x!=="key"});Q=0<y.length?"{key: someKey, "+y.join(": ..., ")+": ...}":"{key: someKey}",le[o+Q]||(y=0<y.length?"{"+y.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
18
|
let props = %s;
|
|
19
19
|
<%s {...props} />
|
|
20
20
|
React keys must be passed directly to JSX without using spread:
|
|
21
21
|
let props = %s;
|
|
22
|
-
<%s key={someKey} {...props} />`,Q,h,v,h),se[h+Q]=!0)}if(h=null,z!==void 0&&(d(z),h=""+z),S(O)&&(d(O.key),h=""+O.key),"key"in O){z={};for(var k in O)k!=="key"&&(z[k]=O[k])}else z=O;return h&&g(z,typeof i=="function"?i.displayName||i.name||"Unknown":i),a(i,h,u,re,c(),z,m,s)}function n(i){typeof i=="object"&&i!==null&&i.$$typeof===o&&i._store&&(i._store.validated=1)}var A=r,o=Symbol.for("react.transitional.element"),j=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),b=Symbol.for("react.strict_mode"),x=Symbol.for("react.profiler"),N=Symbol.for("react.consumer"),w=Symbol.for("react.context"),T=Symbol.for("react.forward_ref"),I=Symbol.for("react.suspense"),q=Symbol.for("react.suspense_list"),M=Symbol.for("react.memo"),F=Symbol.for("react.lazy"),D=Symbol.for("react.activity"),H=Symbol.for("react.client.reference"),P=A.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,U=Object.prototype.hasOwnProperty,ee=Array.isArray,E=console.createTask?console.createTask:function(){return null};A={react_stack_bottom_frame:function(i){return i()}};var V,K={},J=A.react_stack_bottom_frame.bind(A,y)(),oe=E(l(y)),se={};pe.Fragment=C,pe.jsx=function(i,O,z,Q,re){var u=1e4>P.recentlyCreatedOwnerStacks++;return R(i,O,z,!1,Q,re,u?Error("react-stack-top-frame"):J,u?E(l(i)):oe)},pe.jsxs=function(i,O,z,Q,re){var u=1e4>P.recentlyCreatedOwnerStacks++;return R(i,O,z,!0,Q,re,u?Error("react-stack-top-frame"):J,u?E(l(i)):oe)}}()),pe}var we;function De(){return we||(we=1,process.env.NODE_ENV==="production"?fe.exports=qe():fe.exports=Me()),fe.exports}var p=De();const Ee=({variant:t="primary",loading:f=!1,children:d,...l})=>{const c=y=>{switch(y){case"primary":return"primary";case"ghost":return"default";case"dashed":return"dashed";case"link":return"link";case"text":return"text";default:return"primary"}};return p.jsx(B.Button,{...l,type:c(t),loading:f,ghost:t==="ghost",children:d})};Ee.__docgenInfo={displayName:"Button",description:"基础按钮,用于触发操作",props:{variant:{name:"variant",required:!1,description:"视觉风格",type:{name:"ButtonVariant",raw:'"primary" | "ghost" | "dashed" | "link" | "text"'},defaultValue:{value:'"primary"'}},loading:{name:"loading",required:!1,description:"是否加载中",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"false"}},children:{name:"children",required:!1,description:"按钮内容",type:{name:"ReactNode",raw:"React.ReactNode"}},size:{name:"size",required:!1,description:"按钮大小",type:{name:"ButtonSize",raw:'"small" | "middle" | "large"'}},disabled:{name:"disabled",required:!1,description:"是否禁用",type:{name:"boolean",raw:"boolean"}},onClick:{name:"onClick",required:!1,description:"点击事件",type:{name:"function",raw:"(event: MouseEvent) => void"}}}};const ke=({title:t,children:f,bordered:d=!0,hoverable:l=!1,size:c="default",...y})=>p.jsx(B.Card,{...y,title:t,bordered:d,hoverable:l,size:c,children:f});ke.__docgenInfo={displayName:"Card",description:"卡片容器,用于分组内容",props:{title:{name:"title",required:!1,description:"标题",type:{name:"ReactNode",raw:"React.ReactNode"}},children:{name:"children",required:!1,description:"内容区域",type:{name:"ReactNode",raw:"React.ReactNode"}},bordered:{name:"bordered",required:!1,description:"是否显示边框",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},hoverable:{name:"hoverable",required:!1,description:"是否可悬停",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"false"}},size:{name:"size",required:!1,description:"卡片大小",type:{name:"CardSize",raw:'"default" | "small"'},defaultValue:{value:'"default"'}},loading:{name:"loading",required:!1,description:"是否加载中",type:{name:"boolean",raw:"boolean"}},actions:{name:"actions",required:!1,description:"卡片操作组",type:{name:"ReactNode[]",raw:"React.ReactNode[]"}}}};const Te=({showDefaultFooter:t=!0,...f})=>{const d=f.footer!==void 0?f.footer:t?(l,{OkBtn:c,CancelBtn:y})=>p.jsxs(p.Fragment,{children:[p.jsx(c,{}),p.jsx(y,{})]}):null;return p.jsx(B.Modal,{...f,footer:d})};Te.__docgenInfo={displayName:"AppModal",description:"应用级模态框组件,基于 Ant Design Modal 封装",props:{showDefaultFooter:{name:"showDefaultFooter",required:!1,description:"是否显示默认的确定和取消按钮",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},title:{name:"title",required:!1,description:"模态框标题",type:{name:"ReactNode",raw:"React.ReactNode"}},open:{name:"open",required:!1,description:"是否显示模态框",type:{name:"boolean",raw:"boolean"}},onCancel:{name:"onCancel",required:!1,description:"取消按钮点击事件",type:{name:"function",raw:"(e: React.MouseEvent<HTMLElement>) => void"}},onOk:{name:"onOk",required:!1,description:"确定按钮点击事件",type:{name:"function",raw:"(e: React.MouseEvent<HTMLElement>) => void"}},children:{name:"children",required:!1,description:"模态框内容",type:{name:"ReactNode",raw:"React.ReactNode"}},width:{name:"width",required:!1,description:"模态框宽度",type:{name:"string | number",raw:"string | number"}},centered:{name:"centered",required:!1,description:"是否居中显示",type:{name:"boolean",raw:"boolean"}},maskClosable:{name:"maskClosable",required:!1,description:"点击蒙层是否允许关闭",type:{name:"boolean",raw:"boolean"}}}};const Ce=({scrollX:t,showPagination:f=!0,defaultPageSize:d=10,...l})=>p.jsx(B.Table,{...l,scroll:{x:t||"max-content",y:"50vh"},pagination:f?{hideOnSinglePage:!0,showSizeChanger:!0,showQuickJumper:!0,defaultPageSize:d,...l.pagination}:!1});Ce.__docgenInfo={displayName:"PageTable",description:"页面级表格组件,高度铺满容器,自动滚动",props:{scrollX:{name:"scrollX",required:!1,description:"水平滚动宽度",type:{name:"number",raw:"number"}},showPagination:{name:"showPagination",required:!1,description:"是否显示分页器",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},defaultPageSize:{name:"defaultPageSize",required:!1,description:"默认页面大小",type:{name:"number",raw:"number"},defaultValue:{value:"10"}},columns:{name:"columns",required:!1,description:"表格列配置",type:{name:"ColumnType[]",raw:"ColumnType<any>[]"}},dataSource:{name:"dataSource",required:!1,description:"数据源",type:{name:"any[]",raw:"any[]"}},loading:{name:"loading",required:!1,description:"是否加载中",type:{name:"boolean",raw:"boolean"}},rowKey:{name:"rowKey",required:!1,description:"行数据的 Key",type:{name:"string | function",raw:"string | ((record: any) => string)"}}}};const Pe=ce.createFromIconfontCN({scriptUrl:["https://at.alicdn.com/t/c/font_4968458_eh91gfr4j9e.js"]}),Ne=({name:t,size:f,color:d,style:l,...c})=>{const y={fontSize:f,color:d,...l};return p.jsx(Pe,{...c,type:t,style:y})};Ne.__docgenInfo={displayName:"XcIcon",description:"自定义图标组件,基于 iconfont",props:{name:{name:"name",required:!0,description:"图标名称",type:{name:"string",raw:"string"}},size:{name:"size",required:!1,description:"图标大小",type:{name:"number | string",raw:"number | string"}},color:{name:"color",required:!1,description:"图标颜色",type:{name:"string",raw:"string"}},className:{name:"className",required:!1,description:"自定义类名",type:{name:"string",raw:"string"}},style:{name:"style",required:!1,description:"自定义样式",type:{name:"CSSProperties",raw:"React.CSSProperties"}}}};const Se=({loading:t,description:f="暂无数据",className:d,emptyChildren:l,loadingText:c,emptyImage:y})=>t?p.jsxs(B.Flex,{className:`pt-10 w-full ${d||""}`,align:"center",justify:"center",vertical:!0,children:[p.jsx(B.Spin,{size:"large"}),c&&p.jsx("div",{className:"mt-4 text-gray-500",children:c})]}):p.jsx(B.Flex,{className:`pt-10 w-full ${d||""}`,align:"center",justify:"center",children:p.jsx(B.Empty,{image:y,description:f,imageStyle:{height:180},children:l})});Se.__docgenInfo={displayName:"EmptyAndSpin",description:"空状态和加载状态组合组件",props:{loading:{name:"loading",required:!0,description:"是否加载中",type:{name:"boolean",raw:"boolean"}},description:{name:"description",required:!1,description:"空状态描述",type:{name:"ReactNode",raw:"React.ReactNode"},defaultValue:{value:'"暂无数据"'}},className:{name:"className",required:!1,description:"自定义类名",type:{name:"string",raw:"string"}},emptyChildren:{name:"emptyChildren",required:!1,description:"空状态额外内容",type:{name:"ReactNode",raw:"React.ReactNode"}},loadingText:{name:"loadingText",required:!1,description:"加载中提示文字",type:{name:"string",raw:"string"}},emptyImage:{name:"emptyImage",required:!1,description:"空状态图片",type:{name:"string",raw:"string"}}}};const Re=({onClick:t,showText:f=!1,className:d,size:l="small",type:c="default"})=>p.jsx(B.Button,{size:l,type:c,icon:p.jsx(ce.LeftOutlined,{}),className:`cursor-pointer ${d||""}`,onClick:t,children:f&&"返回"});Re.__docgenInfo={displayName:"BackButton",description:"返回按钮组件",props:{onClick:{name:"onClick",required:!1,description:"点击事件",type:{name:"function",raw:"() => void"}},showText:{name:"showText",required:!1,description:"是否显示文字",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"false"}},className:{name:"className",required:!1,description:"自定义类名",type:{name:"string",raw:"string"}},size:{name:"size",required:!1,description:"按钮大小",type:{name:"ButtonSize",raw:'"small" | "middle" | "large"'},defaultValue:{value:'"small"'}},type:{name:"type",required:!1,description:"按钮类型",type:{name:"ButtonType",raw:'"primary" | "default" | "dashed" | "link" | "text"'},defaultValue:{value:'"default"'}}}};const Ae=({removePadding:t=!0,className:f,...d})=>{const l=t?`px-0 h-auto ${f||""}`:f;return p.jsx(B.Button,{type:"link",...d,className:l,children:d.children})};Ae.__docgenInfo={displayName:"LinkButton",description:"链接样式按钮组件,适用于表格操作列",props:{removePadding:{name:"removePadding",required:!1,description:"是否去除默认内边距",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},children:{name:"children",required:!1,description:"按钮内容",type:{name:"ReactNode",raw:"React.ReactNode"}},onClick:{name:"onClick",required:!1,description:"点击事件",type:{name:"function",raw:"(event: React.MouseEvent<HTMLButtonElement>) => void"}},disabled:{name:"disabled",required:!1,description:"是否禁用",type:{name:"boolean",raw:"boolean"}},className:{name:"className",required:!1,description:"自定义类名",type:{name:"string",raw:"string"}}}};const{Option:Be}=B.Select,Ie=({columns:t,request:f,searchFields:d=[],showSearch:l=!0,showRefresh:c=!0,defaultPageSize:y=10,pageSizeOptions:S=["10","20","50","100"],autoLoad:g=!0,externalParams:e={},...a})=>{const[R,n]=r.useState([]),[A,o]=r.useState(!1),[j,C]=r.useState({current:1,pageSize:y,total:0}),[b,x]=r.useState({}),[N,w]=r.useState({}),[T]=B.Form.useForm(),I=r.useRef(j);I.current=j;const q=r.useRef(e);q.current=e;const M=r.useRef(!1),F=r.useMemo(()=>t.map(E=>{const{sortable:V,render:K,...J}=E;return{...J,sorter:V?!0:void 0,render:K||(oe=>oe)}}),[t]),D=r.useCallback(async(E={})=>{if(f){o(!0);try{const V={page:I.current.current,pageSize:I.current.pageSize,sortField:N.field,sortOrder:N.order,searchParams:{...b,...q.current},...E},K=await f(V);K.success&&(n(K.data),C(J=>({...J,total:K.total,current:V.page||J.current})))}catch(V){console.error("加载数据失败:",V)}finally{o(!1)}}},[f,N,b]),H=r.useCallback(E=>{x(E),C(V=>({...V,current:1}))},[]),P=r.useCallback(()=>{T.resetFields(),x({}),C(E=>({...E,current:1}))},[T]),U=r.useCallback(()=>{D()},[D]),ee=r.useCallback((E,V,K)=>{const J={current:E.current||1,pageSize:E.pageSize||y,total:E.total||0},oe={field:K?.field,order:K?.order};C(J),w(oe)},[y]);return r.useEffect(()=>{const E=Object.keys(e).length>0;(g&&!M.current||E)&&(D(),M.current=!0)},[g,e,D]),p.jsxs("div",{children:[l&&d.length>0&&p.jsx(B.Card,{size:"small",style:{marginBottom:16},children:p.jsxs(B.Form,{form:T,layout:"inline",onFinish:H,initialValues:d.reduce((E,V)=>(V.defaultValue!==void 0&&(E[V.key]=V.defaultValue),E),{}),children:[d.map(E=>p.jsx(B.Form.Item,{name:E.key,label:E.label,children:E.type==="input"?p.jsx(B.Input,{placeholder:E.placeholder||`请输入${E.label}`,style:{width:200}}):p.jsx(B.Select,{placeholder:E.placeholder||`请选择${E.label}`,style:{width:200},allowClear:!0,children:E.options?.map(V=>p.jsx(Be,{value:V.value,children:V.label},V.value))})},E.key)),p.jsx(B.Form.Item,{children:p.jsxs(B.Space,{children:[p.jsx(B.Button,{type:"primary",htmlType:"submit",icon:p.jsx(ce.SearchOutlined,{}),children:"查询"}),p.jsx(B.Button,{onClick:P,children:"重置"}),c&&p.jsx(B.Button,{icon:p.jsx(ce.ReloadOutlined,{}),onClick:U,children:"刷新"})]})})]})}),p.jsx(B.Table,{...a,columns:F,dataSource:R,loading:A,pagination:{...j,showSizeChanger:!0,showQuickJumper:!0,showTotal:(E,V)=>`第 ${V[0]}-${V[1]} 条/共 ${E} 条`,pageSizeOptions:S},onChange:ee,scroll:{x:"max-content",y:"50vh"}})]})};Ie.__docgenInfo={displayName:"AdvancedTable",description:"高阶表格组件,支持异步请求、搜索、排序等功能",props:{columns:{name:"columns",required:!0,description:"列配置",type:{name:"AdvancedColumnType[]",raw:"AdvancedColumnType<any>[]"}},request:{name:"request",required:!1,description:"异步请求函数",type:{name:"function",raw:"(params: RequestParams) => Promise<RequestResponse>"}},searchFields:{name:"searchFields",required:!1,description:"搜索字段配置",type:{name:"SearchFieldConfig[]",raw:"SearchFieldConfig[]"},defaultValue:{value:"[]"}},showSearch:{name:"showSearch",required:!1,description:"是否显示搜索区域",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},showRefresh:{name:"showRefresh",required:!1,description:"是否显示刷新按钮",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},defaultPageSize:{name:"defaultPageSize",required:!1,description:"默认页面大小",type:{name:"number",raw:"number"},defaultValue:{value:"10"}},pageSizeOptions:{name:"pageSizeOptions",required:!1,description:"页面大小选项",type:{name:"string[]",raw:"string[]"},defaultValue:{value:'["10", "20", "50", "100"]'}},autoLoad:{name:"autoLoad",required:!1,description:"是否自动加载",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},externalParams:{name:"externalParams",required:!1,description:"外部请求参数",type:{name:"Record<string, any>",raw:"Record<string, any>"},defaultValue:{value:"{}"}}}};function me(t,f,d){if(!t.current)return;const l=new Set,c={};for(const n of f)n.exclusionGroup&&n.exclusionGroup!=="separator"&&(l.add(n.exclusionGroup),c[n.exclusionGroup]||(c[n.exclusionGroup]=[]),c[n.exclusionGroup].push({type:n.type,key:n.key,exclusionGroup:n.exclusionGroup}));const y={};for(const n of l){y[n]=!1;for(const A of c[n])if(A.type==="upload"&&A.key){if(d[A.key]!==null&&d[A.key]!==void 0){y[n]=!0;break}}else if(A.type==="variable"&&A.key){const o=t.current.querySelector(`[data-type="variable"][data-key="${A.key}"]`);if(o&&o.innerText.replace(/[\u200B\n]/g,"").trim().length>0){y[n]=!0;break}}}const S=f.some(n=>n.exclusionGroup==="separator"),e=Object.keys(y).filter(n=>y[n]).length>0;let a=null;if(e&&S){for(const n of f)if(n.exclusionGroup&&n.exclusionGroup!=="separator"&&y[n.exclusionGroup]){a=n.exclusionGroup;break}}for(const n of l){const A=t.current.querySelectorAll(`[data-group="${n}"]`);S&&e&&a?n===a?A.forEach(o=>{o.classList.contains("required-upload-group")?o.style.setProperty("display","inline-flex","important"):(o.classList.contains("exclusion-wrapper"),o.style.setProperty("display","inline-block","important"))}):A.forEach(o=>{o.style.display="none",o.style.setProperty("display","none","important")}):A.forEach(o=>{o.classList.contains("required-upload-group")?o.style.setProperty("display","inline-flex","important"):(o.classList.contains("exclusion-wrapper"),o.style.setProperty("display","inline-block","important"))})}t.current.querySelectorAll('[data-group="separator"]').forEach(n=>{n.style.display=e?"none":"inline"})}function ye(t,f,d,l){if(!t.current){l(!1);return}const c=[];for(let e=0;e<f.length;e++){const a=f[e];if((a.type==="variable"||a.type==="upload"||a.type==="multi-variable")&&a.required&&a.key){c.push({exclusionGroup:a.exclusionGroup||"",key:a.key,type:a.type==="multi-variable"?"variable":a.type,isMultiVariable:a.type==="multi-variable"});continue}if(a.type==="text"&&a.className?.includes("rte-text-required")&&a.exclusionGroup)for(let R=e+1;R<f.length;R++){const n=f[R];if(n.exclusionGroup===a.exclusionGroup&&(n.type==="variable"||n.type==="upload")&&n.key){c.push({exclusionGroup:a.exclusionGroup,key:n.key,type:n.type});break}}}const y=f.some(e=>e.exclusionGroup==="separator");let S=!1;if(y&&c.length>1){const e=f.findIndex(n=>n.exclusionGroup==="separator"),a=c.filter(n=>f.findIndex(o=>(o.type==="variable"||o.type==="upload")&&o.key===n.key&&o.exclusionGroup===n.exclusionGroup)<e),R=c.filter(n=>f.findIndex(o=>(o.type==="variable"||o.type==="upload")&&o.key===n.key&&o.exclusionGroup===n.exclusionGroup)>e);S=a.length>0&&R.length>0}if(c.length===0){l(!0);return}const g=c.filter(e=>{if(!t.current)return!1;const a=t.current.querySelectorAll(`[data-group="${e.exclusionGroup}"]`);return a.length===0?!1:a[0].style.display!=="none"});if(g.length===0){l(!0);return}if(S){let e=!1;for(const a of g)if(a.type==="upload"&&a.key){if(d[a.key]!==null&&d[a.key]!==void 0){e=!0;break}}else if(a.type==="variable"&&a.key)if(a.isMultiVariable){const R=t.current.querySelectorAll(`[data-type="variable"][data-multi-key="${a.key}"]`);let n=!1;for(const A of Array.from(R))if(A.innerText.replace(/[\u200B\n]/g,"").trim().length>0){n=!0;break}if(n){e=!0;break}}else{const R=t.current.querySelector(`[data-type="variable"][data-key="${a.key}"]`);if(R&&R.innerText.replace(/[\u200B\n]/g,"").trim().length>0){e=!0;break}}l(e)}else{let e=!0;for(const a of g)if(a.type==="upload"&&a.key){if(d[a.key]===null||d[a.key]===void 0){e=!1;break}}else if(a.type==="variable"&&a.key)if(a.isMultiVariable){const R=t.current.querySelectorAll(`[data-type="variable"][data-multi-key="${a.key}"]`);let n=!1;for(const A of Array.from(R))if(A.innerText.replace(/[\u200B\n]/g,"").trim().length>0){n=!0;break}if(!n){e=!1;break}}else{const R=t.current.querySelector(`[data-type="variable"][data-key="${a.key}"]`);if(!R){e=!1;break}if(R.innerText.replace(/[\u200B\n]/g,"").trim().length===0){e=!1;break}}l(e)}}function he(t,f){if(!t.current)return;t.current.querySelectorAll('[data-type="variable"]').forEach(l=>{const c=l.innerText.replace(/\n/g,"");c.replace(/\u200B/g,"")?l.classList.remove("show-placeholder"):(c!==""&&(l.innerText=""),l.classList.add("show-placeholder"))})}function Fe(t,f,d,l,c,y={}){if(!t.current)return;let S="",g=0;for(;g<f.length;){const e=f[g],a=g+1<f.length?f[g+1]:null;if(e.type==="text"&&(e.text?.includes("icon-bitian")||e.className==="rte-text-required")&&a){const C=a.type==="upload"&&a.exclusionGroup==="fileInput"&&e.exclusionGroup==="fileInput"&&e.exclusionGroup===a.exclusionGroup,b=a.type==="variable"&&a.exclusionGroup==="textInput"&&e.exclusionGroup==="textInput"&&e.exclusionGroup===a.exclusionGroup;if(C){const N=`<span ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper required-upload-group">`,w="</span>";let T="";e.className?T=`<span class="${e.className}">${e.text??""}</span>`:T=e.text??"";const I=a,q=d[I.key]!==null&&d[I.key]!==void 0,M=q?d[I.key]?.name:I.text,F=q?"":"hidden",D=I.tooltip&&!q?"":"hidden",H=q?"has-file":"",P=q&&M?` data-file-name="${M.replace(/"/g,""")}"`:"",U=`<span contenteditable="false" data-type="upload" data-key="${I.key}" class="upload-chip"><span class="upload-inner-wrapper ${H}"><span class="upload-icon">${q?"<i class='iconfont icon-exlwenjian'></i>":"<i class='iconfont icon-shangchuan1'></i>"}</span><span class="upload-label"${P}>${M||I.text}</span>${I.tooltip?`<i contenteditable="false" class="iconfont icon-tishi upload-info-icon ${D}" data-upload-key="${I.key}" data-tooltip="${I.tooltip}" title="提示"></i>`:""}<span class="file-remove-btn ${F}" title="移除文件">×</span></span></span>`;S+=N+T+U+w,g+=2;continue}if(b){const N=`<span ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper required-upload-group">`,w="</span>";let T="";e.className?T=`<span class="${e.className}">${e.text??""}</span>`:T=e.text??"";const I=a,M=(I.key?c[I.key]:void 0)||I.text||"",F=!M,D=F?"":M,H=F?"show-placeholder":"",P=I.exclusionGroup?` data-group="${I.exclusionGroup}"`:"",U=I.tooltip?` data-tooltip="${I.tooltip.replace(/"/g,""")}" data-variable-key="${I.key||""}"`:"",ee=I.tooltip&&F?"":"hidden",E=`<span contenteditable="true" data-type="variable" data-key="${I.key}" data-placeholder="${I.placeholder||""}"${P}${U} class="variable-chip ${H}">${D}${I.tooltip?`<i contenteditable="false" class="iconfont icon-tishi variable-info-icon ${ee}" data-variable-key="${I.key}" data-tooltip="${I.tooltip.replace(/"/g,""")}" title="提示"></i>`:""}</span>`;S+=N+T+E+w,g+=2;continue}}const n=e.exclusionGroup?`data-group="${e.exclusionGroup}"`:"",A=e.exclusionGroup?`<span ${n} class="exclusion-wrapper">`:"",o=e.exclusionGroup?"</span>":"";let j="";if(e.type==="tag"){const C=l?"":'<span class="tag-close-btn" title="Clear (ESC)"><svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"><path d="M18 6L6 18M6 6l12 12"/></svg></span>',b=l?' data-locked="true"':"",x=e.tooltip?` data-tooltip="${e.tooltip.replace(/"/g,""")}" data-tag-key="${e.key||""}"`:"";j=`<span contenteditable="false" class="tag-node group"${b}${x}><span class="tag-label">${e.text}</span>${C}</span>`}else if(e.type==="text"){const C=l?' data-locked="true" contenteditable="false"':' contenteditable="false"';e.className?j=`<span class="${e.className}"${C}>${e.text??""}</span>`:j=l?`<span${C}>${e.text??""}</span>`:`<span contenteditable="false">${e.text??""}</span>`}else if(e.type==="variable"&&e.key){const b=c[e.key]||e.text||"",x=!b,N=x?"":b,w=x?"show-placeholder":"",T=e.exclusionGroup?` data-group="${e.exclusionGroup}"`:"",I=e.tooltip?` data-tooltip="${e.tooltip.replace(/"/g,""")}" data-variable-key="${e.key||""}"`:"",q=e.tooltip&&x?"":"hidden",M=`<span contenteditable="true" data-type="variable" data-key="${e.key}" data-placeholder="${e.placeholder||""}"${T}${I} class="variable-chip ${w}">${N}${e.tooltip?`<i contenteditable="false" class="iconfont icon-tishi variable-info-icon ${q}" data-variable-key="${e.key}" data-tooltip="${e.tooltip.replace(/"/g,""")}" title="提示"></i>`:""}</span>`;e.required?j=`<span ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper required-upload-group"><span class="rte-text-required"><i class='iconfont icon-bitian' style='font-size: 10px;'></i></span>${M}</span>`:j=M}else if(e.type==="upload"&&e.key){const C=d[e.key]!==null&&d[e.key]!==void 0,b=C?d[e.key]?.name:e.text,x=C?"":"hidden",N=e.tooltip&&!C?"":"hidden",w=C?"has-file":"",T=C&&b?` data-file-name="${b.replace(/"/g,""")}"`:"",I=`<span contenteditable="false" data-type="upload" data-key="${e.key}" class="upload-chip"><span class="upload-inner-wrapper ${w}"><span class="upload-icon">${C?"<i class='iconfont icon-exlwenjian'></i>":"<i class='iconfont icon-shangchuan1'></i>"}</span><span class="upload-label"${T}>${b||e.text}</span>${e.tooltip?`<i contenteditable="false" class="iconfont icon-tishi upload-info-icon ${N}" data-upload-key="${e.key}" data-tooltip="${e.tooltip}" title="提示"></i>`:""}<span class="file-remove-btn ${x}" title="移除文件">×</span></span></span>`;e.required?j=`<span ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper required-upload-group"><span class="rte-text-required"><i class='iconfont icon-bitian' style='font-size: 10px;'></i></span>${I}</span>`:j=I}else if(e.type==="multi-variable"&&e.key){const C=e.maxCount||9,b=y[e.key]||1,x=Math.min(b,C);let N="";for(let w=0;w<x;w++){const T=`${e.key}_${w}`,I=c[T]||"",q=!I,M=q?"":I,F=q?"show-placeholder":"",D=e.tooltip?` data-tooltip="${e.tooltip.replace(/"/g,""")}" data-variable-key="${e.key||""}"`:"",H=e.tooltip&&q?"":"hidden",P=`<span contenteditable="true" data-type="variable" data-key="${T}" data-multi-key="${e.key}" data-index="${w}" data-placeholder="${e.placeholder||""}"${D} class="variable-chip ${F}">${M}${e.tooltip?`<i contenteditable="false" class="iconfont icon-tishi variable-info-icon ${H}" data-variable-key="${e.key}" data-tooltip="${e.tooltip.replace(/"/g,""")}" title="提示"></i>`:""}</span>`;N+=P}e.required?j=`<span ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper required-upload-group"><span class="rte-text-required"><i class='iconfont icon-bitian' style='font-size: 10px;'></i></span>${N}</span>`:j=N}S+=A+j+o,g++}t.current&&(t.current.innerHTML=S,setTimeout(()=>{if(!t.current)return;t.current.querySelectorAll('[data-type="variable"]').forEach(a=>{const R=a.innerText.replace(/\n/g,"");R.replace(/\u200B/g,"")?a.classList.remove("show-placeholder"):(R!==""&&(a.innerText=""),a.classList.add("show-placeholder"))})},0))}function Ge(t,f,d,l,c={},y,S){const g=r.useCallback(()=>{if(!t.current)return;if(f.length===0){t.current.innerHTML="";return}let e={};const a=t.current,R=a.__tempVariableValues;if(R?(e=R,delete a.__tempVariableValues):t.current.querySelectorAll('[data-type="variable"]').forEach(A=>{const o=A.dataset.key;if(o){const j=A.innerText.replace(/[\u200B\n]/g,"").trim();j&&(e[o]=j)}}),Fe(t,f,d,l,e,c),y?.current){const{key:n,offset:A}=y.current;setTimeout(()=>{if(!t.current)return;const o=t.current.querySelector(`[data-type="variable"][data-key="${n}"]`);if(o){try{const j=document.createRange(),C=document.createTreeWalker(o,NodeFilter.SHOW_TEXT,null);let b=0,x=null,N=0;for(;C.nextNode();){const w=C.currentNode,T=w.textContent?.length||0;if(b+T>=A){x=w,N=A-b;break}b+=T}if(x){j.setStart(x,Math.min(N,x.textContent?.length||0)),j.collapse(!0);const w=window.getSelection();w&&(w.removeAllRanges(),w.addRange(j),o.focus())}else{j.selectNodeContents(o),j.collapse(!1);const w=window.getSelection();w&&(w.removeAllRanges(),w.addRange(j),o.focus())}}catch{const j=document.createRange();j.selectNodeContents(o),j.collapse(!1);const C=window.getSelection();C&&(C.removeAllRanges(),C.addRange(j),o.focus())}y.current=null}},0)}},[f,d,l,t,c,y,S]);r.useEffect(()=>{g()},[g])}function ze(t,f,d,l){r.useEffect(()=>{const c=t.current;if(!c)return;const y=g=>{const e=g.target?.closest(".upload-info-icon");if(e&&e.classList.contains("upload-info-icon")){const a=e.dataset.uploadKey;a&&l({key:a,anchorEl:e,type:"upload"})}},S=g=>{const e=g.target?.closest(".upload-info-icon"),a=g.relatedTarget;e&&e.classList.contains("upload-info-icon")&&(!a||!c.contains(a)?l(null):a.closest(".upload-info-icon")||l(null))};return c.addEventListener("mouseover",y,!0),c.addEventListener("mouseout",S,!0),()=>{c.removeEventListener("mouseover",y,!0),c.removeEventListener("mouseout",S,!0)}},[f,d,t,l])}function He(t,f,d){r.useEffect(()=>{if(!t.current)return;const l=g=>{const e=g.currentTarget,a=e.dataset.tooltip,R=e.dataset.tagKey||"";a&&d({key:R,anchorEl:e,type:"tag"})},c=()=>{d(null)};let y;const S=()=>{if(!t.current)return;t.current.querySelectorAll(".tag-node[data-tooltip]").forEach(e=>{e.addEventListener("mouseenter",l),e.addEventListener("mouseleave",c)})};return y=requestAnimationFrame(()=>{y=requestAnimationFrame(S)}),()=>{cancelAnimationFrame(y),t.current&&t.current.querySelectorAll(".tag-node[data-tooltip]").forEach(e=>{e.removeEventListener("mouseenter",l),e.removeEventListener("mouseleave",c)})}},[f,t,d])}function We(t,f,d){r.useEffect(()=>{const l=t.current;if(!l)return;const c=S=>{const g=S.target?.closest(".variable-info-icon");if(g&&g.classList.contains("variable-info-icon")){const e=g.dataset.variableKey;e&&d({key:e,anchorEl:g,type:"variable"})}},y=S=>{const g=S.target?.closest(".variable-info-icon"),e=S.relatedTarget;g&&g.classList.contains("variable-info-icon")&&(!e||!l.contains(e)?d(null):e.closest(".variable-info-icon")||d(null))};return l.addEventListener("mouseover",c,!0),l.addEventListener("mouseout",y,!0),()=>{l.removeEventListener("mouseover",c,!0),l.removeEventListener("mouseout",y,!0)}},[f,t,d])}function Xe(t,f,d,l){r.useEffect(()=>{if(!t.current)return;const c=e=>{const a=e.currentTarget;a.dataset.fileName&&l({key:"",anchorEl:a,type:"upload-label"})},y=()=>{l(null)};let S;const g=()=>{if(!t.current)return;t.current.querySelectorAll(".upload-label[data-file-name]").forEach(a=>{a.addEventListener("mouseenter",c),a.addEventListener("mouseleave",y)})};return S=requestAnimationFrame(()=>{S=requestAnimationFrame(g)}),()=>{cancelAnimationFrame(S),t.current&&t.current.querySelectorAll(".upload-label[data-file-name]").forEach(a=>{a.removeEventListener("mouseenter",c),a.removeEventListener("mouseleave",y)})}},[f,d,t,l])}function Ke(t,f,d,l){r.useEffect(()=>{me(t,f,d),ye(t,f,d,l)},[d,f,t,l])}function Ye(t,f){r.useEffect(()=>{if(!t.current)return;let d=!1,l=0;const c=()=>{d=!0},y=()=>{d=!1,l=Date.now()};let S=!1,g=0;const e=()=>{S=!0},a=()=>{S=!1,g=Date.now()},R=()=>{g=Date.now()},n=()=>{if(!t.current)return;const o=window.getSelection();if(!o||o.rangeCount===0||f.current||d||S||Date.now()-g<500)return;const j=o.getRangeAt(0);if(!j.collapsed){t.current.contains(j.commonAncestorContainer)||o.removeAllRanges();return}const C=o.anchorNode;if(!C)return;if(!t.current.contains(C)){o.removeAllRanges();return}let b=null;if(C.nodeType===Node.ELEMENT_NODE?b=C.closest('[data-type="variable"]'):C.nodeType===Node.TEXT_NODE&&C.parentElement&&(b=C.parentElement.closest('[data-type="variable"]')),!b){if(Date.now()-l>500)return;const x=t.current.querySelectorAll('[data-type="variable"]');if(x.length>0){let N=null;for(const w of Array.from(x))if(w.style.display!=="none"){N=w;break}if(!N&&x.length>0&&(N=x[0]),N){const w=document.createRange();w.selectNodeContents(N),w.collapse(!1),o.removeAllRanges(),o.addRange(w),N.focus()}else o.removeAllRanges()}else o.removeAllRanges()}},A=t.current;return A&&(A.addEventListener("compositionstart",e),A.addEventListener("compositionend",a),A.addEventListener("input",R)),document.addEventListener("mousedown",c),document.addEventListener("mouseup",y),document.addEventListener("selectionchange",n),()=>{const o=t.current;o&&(o.removeEventListener("compositionstart",e),o.removeEventListener("compositionend",a),o.removeEventListener("input",R)),document.removeEventListener("mousedown",c),document.removeEventListener("mouseup",y),document.removeEventListener("selectionchange",n)}},[t,f])}const _e=({config:t,onSend:f,isProcessing:d=!1,disabled:l=!1,width:c,lockStructure:y=!1,agentOptions:S=[],onAgentSelect:g,onAgentExit:e,loading:a=!1,placeholder:R})=>{const n=r.useRef(null),A=r.useRef(null),[o,j]=r.useState({}),[C,b]=r.useState(null),[x,N]=r.useState(null),w=r.useRef(!1),T=r.useRef(null),[I,q]=r.useState(!1),M=r.useRef(null),[F,D]=r.useState(!0),[H,P]=r.useState(()=>{const u={};return t.forEach(m=>{m.type==="multi-variable"&&m.key&&(u[m.key]=1)}),u});r.useEffect(()=>{P(u=>{const m={};return t.forEach(s=>{s.type==="multi-variable"&&s.key&&(m[s.key]=u[s.key]||1)}),m})},[t]),Ge(n,t,o,y,H,M),ze(n,t,o,N),He(n,t,N),Xe(n,t,o,N),We(n,t,N),Ke(n,t,o,q),Ye(n,w),r.useEffect(()=>{if(t.length>0){D(!1);return}const u=()=>{if(!n.current){D(!0);return}const s=n.current.textContent?.replace(/[\u200B\n]/g,"").trim()||"",h=n.current.querySelectorAll('[data-type="variable"]'),v=n.current.querySelectorAll('[data-type="upload"]');let k=!1;h.forEach(L=>{(L.textContent?.replace(/[\u200B\n]/g,"").trim()||"")&&(k=!0)}),v.forEach(L=>{L.querySelector(".upload-inner-wrapper.has-file")&&(k=!0)});const _=!s&&!k;D(_),t.length===0&&q(!_)};u();const m=new MutationObserver(u);return n.current&&m.observe(n.current,{childList:!0,subtree:!0,characterData:!0}),()=>{m.disconnect()}},[t]);const U=u=>{if(l){u.preventDefault();return}u.preventDefault();const m=u.clipboardData.getData("text/plain"),s=window.getSelection();if(s&&s.rangeCount>0){const h=s.anchorNode;if(h){let v=null;if(h.nodeType===Node.ELEMENT_NODE?v=h.closest('[data-type="variable"]'):h.nodeType===Node.TEXT_NODE&&h.parentElement&&(v=h.parentElement.closest('[data-type="variable"]')),v){const k=v.dataset.multiKey;if(k){const _=m.split(/[,\n\r\t]+/).map(L=>L.trim()).filter(L=>L.length>0);if(_.length>1){const L=parseInt(v.dataset.index||"0",10),G=t.find(te=>te.type==="multi-variable"&&te.key===k)?.maxCount||9,Y=H[k]||1,$=Math.min(L+_.length,G);$>Y&&P(Z=>({...Z,[k]:$})),setTimeout(()=>{n.current&&(_.forEach((Z,te)=>{const ae=L+te;if(ae>=G)return;const W=`${k}_${ae}`,ne=n.current.querySelector(`[data-type="variable"][data-key="${W}"]`);ne&&(ne.innerText=Z,ne.classList.remove("show-placeholder"))}),i())},0);return}}}}}document.execCommand("insertText",!1,m),i()},ee=u=>{if(u.target.files&&u.target.files[0]&&C){const m=u.target.files[0],s=C;j(h=>({...h,[s]:m}))}u.target&&(u.target.value=""),b(null)},E=u=>{j(m=>{const s={...m};return delete s[u],s})},V=u=>{const m=u.target;if(m.closest(".tag-close-btn")){if(u.preventDefault(),u.stopPropagation(),y)return;N(null),e?e():n.current&&(n.current.innerHTML="",n.current.focus());return}if(y){const v=m.closest(".tag-node"),k=m.closest('[data-type="text"]');if(v||k){u.preventDefault(),u.stopPropagation();const _=window.getSelection();_&&_.removeAllRanges();return}}m.closest('[data-type="variable"]')||(T.current={x:u.clientX,y:u.clientY},w.current=!1,m.closest(".file-remove-btn")&&(u.preventDefault(),u.stopPropagation()))},K=u=>{if(!u.target.closest('[data-type="variable"]')&&T.current){const h=Math.abs(u.clientX-T.current.x),v=Math.abs(u.clientY-T.current.y);(h>3||v>3)&&(w.current=!0)}},J=u=>{if(u.target.closest('[data-type="variable"]')){T.current=null,w.current=!1;return}T.current=null,w.current=!1},oe=u=>{if(l)return;const m=u.target;if(m.closest(".tag-close-btn")){u.preventDefault(),u.stopPropagation();return}if(t.length===0)return;if(m.closest('[data-type="text"]')){u.preventDefault(),u.stopPropagation();const L=window.getSelection();L&&L.removeAllRanges();return}if(y&&m.closest(".tag-node")){u.preventDefault(),u.stopPropagation();const G=window.getSelection();G&&G.removeAllRanges();return}if(m.closest('[data-type="variable"]')){if(w.current)return;setTimeout(()=>{const L=window.getSelection();L&&!L.isCollapsed||he(n)},10);return}const k=m.closest(".file-remove-btn");if(k){u.preventDefault(),u.stopPropagation();const G=k.closest('[data-type="upload"]')?.dataset.key;G&&E(G);return}const _=m.closest('[data-type="upload"]');if(_){const L=_.dataset.key;L&&(b(L),A.current?.click());return}},se=u=>{const s=u.target.closest('[data-type="variable"]');if(s){const h=window.getSelection();if(h){const v=document.createRange(),k=s.textContent||"";if(k.replace(/\u200B/g,"")){let L=0,G=k.length;k.startsWith("")&&(L=1),k.endsWith("")&&k.length>1&&(G=k.length-1);const Y=s.firstChild;Y&&Y.nodeType===Node.TEXT_NODE?(v.setStart(Y,L),v.setEnd(Y,G)):v.selectNodeContents(s)}else v.selectNodeContents(s),v.collapse(!0);h.removeAllRanges(),h.addRange(v)}}},i=()=>{if(t.length===0){if(n.current){const s=!(n.current.textContent?.replace(/[\u200B\n]/g,"").trim()||"");D(s),q(!s)}return}if(he(n),n.current&&n.current.querySelectorAll('[data-type="variable"]').forEach(s=>{const h=s.querySelector(".variable-info-icon");if(h){let v=!1;const k=document.createTreeWalker(s,NodeFilter.SHOW_TEXT,{acceptNode:_=>h.contains(_)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT});for(;k.nextNode();)if(k.currentNode.textContent?.replace(/[\u200B\n]/g,"").trim()){v=!0;break}v?h.classList.add("hidden"):h.classList.remove("hidden")}}),me(n,t,o),ye(n,t,o,q),!n.current)return;t.filter(m=>m.type==="multi-variable"&&m.key).forEach(m=>{if(!m.key)return;const s=m.maxCount||9,h=H[m.key]||1,v=[];for(let Y=0;Y<h;Y++){const $=`${m.key}_${Y}`,Z=n.current.querySelector(`[data-type="variable"][data-key="${$}"][data-multi-key="${m.key}"]`);if(Z){const te=Z.innerText.replace(/[\u200B\n]/g,"").trim();v.push(te)}}const _=(v[v.length-1]||"")==="";let L=!1,G=-1;for(let Y=0;Y<v.length-1;Y++)if(v[Y]===""){L=!0,G=Y;break}if(L&&G>=0){const Y=window.getSelection();if(Y&&Y.rangeCount>0){const W=Y.getRangeAt(0),ne=W.startContainer,le=ne.nodeType===Node.ELEMENT_NODE?ne.closest('[data-type="variable"][data-multi-key]'):ne.parentElement?.closest('[data-type="variable"][data-multi-key]');if(le){const ie=le.dataset.key;if(ie){const ue=document.createRange();ue.setStartBefore(le),ue.setEnd(W.startContainer,W.startOffset);const be=ue.toString().length;M.current={key:ie,offset:be}}}}const $=[...v];for(let W=G;W<$.length-1;W++)$[W]=$[W+1];$.pop();const Z={};$.forEach((W,ne)=>{W&&(Z[`${m.key}_${ne}`]=W)});const te=Math.max(_?$.length:$.length+1,1);n.current.querySelectorAll('[data-type="variable"]').forEach(W=>{const ne=W.dataset.key,le=W.dataset.multiKey;if(ne&&le!==m.key){const ie=W.innerText.replace(/[\u200B\n]/g,"").trim();ie&&(Z[ne]=ie)}}),n.current.__tempVariableValues=Z,P(W=>({...W,[m.key]:te}));return}if(!_){const Y=h-1,$=`${m.key}_${Y}`,Z=n.current.querySelector(`[data-type="variable"][data-key="${$}"][data-multi-key="${m.key}"]`);if(Z&&Z.innerText.replace(/[\u200B\n]/g,"").trim().length>0&&h<s){const ae=window.getSelection();if(ae&&ae.rangeCount>0){const W=ae.getRangeAt(0),ne=W.startContainer,le=ne.nodeType===Node.ELEMENT_NODE?ne.closest('[data-type="variable"][data-multi-key]'):ne.parentElement?.closest('[data-type="variable"][data-multi-key]');if(le){const ie=le.dataset.key;if(ie){const ue=document.createRange();ue.setStartBefore(le),ue.setEnd(W.startContainer,W.startOffset);const be=ue.toString().length;M.current={key:ie,offset:be}}}}P(W=>({...W,[m.key]:h+1}))}}})},O=()=>{n.current&&(he(n),me(n,t,o),ye(n,t,o,q))},z=u=>{if(l){u.preventDefault();return}const m=window.getSelection();if(m&&m.rangeCount>0){const s=m.anchorNode;let h=null;if(s&&(s.nodeType===Node.ELEMENT_NODE?h=s.closest('[data-type="text"]'):s.nodeType===Node.TEXT_NODE&&s.parentElement&&(h=s.parentElement.closest('[data-type="text"]'))),h){if(u.preventDefault(),u.stopPropagation(),n.current){const v=n.current.querySelector('[data-type="variable"], [data-type="upload"]');v&&v.focus()}return}}if(y&&m&&m.rangeCount>0){const s=m.anchorNode;let h=null;if(s&&(s.nodeType===Node.ELEMENT_NODE?h=s.closest(".tag-node"):s.nodeType===Node.TEXT_NODE&&s.parentElement&&(h=s.parentElement.closest(".tag-node"))),h){if(u.preventDefault(),u.stopPropagation(),n.current){const v=n.current.querySelector('[data-type="variable"], [data-type="upload"]');v&&v.focus()}return}}if(u.key==="Enter"&&!u.shiftKey&&(u.preventDefault(),Q()),u.key==="Escape"&&n.current){if(y){u.preventDefault();return}n.current.innerHTML="",n.current.focus()}if(u.key==="Backspace"){const s=window.getSelection();if(s&&s.rangeCount>0){const h=s.getRangeAt(0),v=s.anchorNode;if(y){let _=null,L=null;if(v&&(v.nodeType===Node.ELEMENT_NODE?(_=v.closest(".tag-node"),L=v.closest('[data-type="text"]')):v.nodeType===Node.TEXT_NODE&&v.parentElement&&(_=v.parentElement.closest(".tag-node"),L=v.parentElement.closest('[data-type="text"]'))),(_||L)&&h.collapsed&&h.startOffset===0){u.preventDefault();return}}let k=null;if(v&&(v.nodeType===Node.ELEMENT_NODE?k=v.closest('[data-type="variable"]'):v.nodeType===Node.TEXT_NODE&&v.parentElement&&(k=v.parentElement.closest('[data-type="variable"]'))),k){if(!h.collapsed)return;const _=k.innerText;if(_===""||_===""){u.preventDefault();return}if(h.startOffset===0){u.preventDefault();return}if(_.startsWith("")&&h.startOffset===1){u.preventDefault();return}}}}},Q=()=>{if(d||l||a||!I||!n.current)return;if(t.length===0){const k=n.current.textContent?.replace(/[\u200B\n]/g,"").trim()||"";if(!k)return;f(k,k);return}const u=n.current;let m="";const s={},h=k=>{if(!(k.nodeType===Node.ELEMENT_NODE&&k.style.display==="none")){if(k.nodeType===Node.TEXT_NODE)m+=(k.textContent||"").replace(/\u200B/g,"");else if(k.nodeType===Node.ELEMENT_NODE){const _=k,L=_.dataset.type,G=_.dataset.key;if(L==="variable"&&G){let Y="";const $=document.createTreeWalker(_,NodeFilter.SHOW_TEXT,{acceptNode:te=>{const ae=_.querySelector(".variable-info-icon");return ae&&ae.contains(te)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}});for(;$.nextNode();)Y+=$.currentNode.textContent||"";const Z=Y.replace(/[\u200B\n]/g,"").trim();if(Z){const te=_.dataset.multiKey;if(te){s[te]||(s[te]=[]);const ae=s[te];ae.push(Z),ae.length>1&&(m+=" "),m+=Z}else s[G]=Z,m+=Z}}else if(L==="upload"&&G)s[G]=o[G]??null,o[G]&&(m+=` [附带文件: ${o[G]?.name}] `);else{if(_.classList.contains("tag-close-btn")||_.classList.contains("file-remove-btn"))return;_.getAttribute("contenteditable")==="false"&&!L&&_.classList.contains("tag-node")?m+=_.innerText:_.childNodes.forEach(h)}}}};if(u.childNodes.forEach(h),m=m.trim(),!m)return;const v=new FormData;v.append("fullPrompt",m),Object.keys(s).forEach(k=>{const _=s[k];_!=null&&(_ instanceof File?v.append(k,_):Array.isArray(_)?_.forEach((L,G)=>{L!=null&&(L instanceof File?v.append(`${k}[${G}]`,L):typeof L=="string"?v.append(`${k}[${G}]`,L):v.append(`${k}[${G}]`,String(L)))}):typeof _=="string"?v.append(k,_):v.append(k,String(_)))}),f(v,m)},re=c?{width:typeof c=="number"?`${c}px`:c}:{};return p.jsxs("div",{className:"rich-text-editor",style:re,"data-disabled":l,children:[p.jsx("div",{ref:n,className:`rte-editor ${t.length===0?"rte-editor-default":""} ${F&&R?"rte-editor-empty":""}`,contentEditable:t.length===0,suppressContentEditableWarning:!0,"data-placeholder":R,onMouseDown:V,onMouseMove:K,onMouseUp:J,onClick:oe,onDoubleClick:se,onInput:i,onKeyDown:z,onPaste:U,onBlur:O}),p.jsx("input",{type:"file",ref:A,className:"rte-file-input",accept:".csv,.xlsx,.xls,.txt,.pdf,image/*",onChange:ee}),p.jsxs("div",{className:"rich-text-editor-footer",children:[p.jsx("div",{className:"rich-text-editor-footer-left",children:p.jsxs("div",{className:"rich-text-editor-brand",children:[p.jsxs("div",{className:"rte-brand-badge",children:[p.jsx("img",{src:"https://oospublic.sealseek.cn/file/website/ball.png",alt:""}),p.jsx("span",{className:"rte-brand-text",children:"SealSeek 1.0"})]}),p.jsx(B.Dropdown,{placement:"top",menu:{items:S.map(u=>({key:u.key,label:p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[u.icon&&p.jsx("i",{className:u.icon}),p.jsx("span",{children:u.label})]}),onClick:()=>{g?.(u)}}))},trigger:["click"],disabled:l||d,children:p.jsxs("div",{className:"rte-agent-badge",style:{cursor:S.length>0?"pointer":"default"},children:[p.jsx("i",{className:"iconfont icon-zhinengti"}),p.jsx("span",{className:"rte-agent-text",children:"智能体"})]})})]})}),p.jsx("button",{type:"button",onClick:Q,disabled:d||l||a||!I,className:"rich-text-editor-send-button",children:d||a?p.jsx("span",{className:"rte-send-spinner"}):p.jsx("i",{className:"iconfont icon-fasong"})})]}),x?.anchorEl&&(()=>{if(!document.body.contains(x.anchorEl))return null;let u="";return x.type==="upload"?u=t.find(s=>s.type==="upload"&&s.key===x.key)?.tooltip||"":x.type==="tag"?u=x.anchorEl.dataset.tooltip||"":x.type==="upload-label"?u=x.anchorEl.dataset.fileName||"":x.type==="variable"&&(u=x.anchorEl.dataset.tooltip||""),Oe.createPortal(p.jsx(B.Tooltip,{arrow:!1,title:p.jsx("div",{style:{maxWidth:"200px",fontSize:"12px",color:"#fff"},children:u}),open:!0,placement:"top",getPopupContainer:()=>document.body,overlayInnerStyle:{background:"var(--neutral-800, #262626)"},children:p.jsx("div",{style:{position:"fixed",left:`${x.anchorEl.getBoundingClientRect().left}px`,top:`${x.anchorEl.getBoundingClientRect().top}px`,width:`${x.anchorEl.offsetWidth}px`,height:`${x.anchorEl.offsetHeight}px`,pointerEvents:"none"}})}),document.body)})()]})};_e.__docgenInfo={displayName:"RichTextEditor",description:"结构化富文本输入组件,支持标签、变量输入块、文件上传以及互斥显示逻辑。",props:{config:{name:"config",required:!0,description:"结构化输入配置节点数组",type:{name:"InputNode[]",raw:"InputNode[]"}},onSend:{name:"onSend",required:!0,description:"点击发送按钮时的回调,返回数据与拼接后的 Prompt",type:{name:"function",raw:"(data: Record<string, any>, fullPrompt: string) => void"}},isProcessing:{name:"isProcessing",required:!1,description:"是否处于处理状态(禁用输入与发送)",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"false"}}}};const je=({texts:t=[],placeholder:f="请输入内容",animationSpeed:d=100,autoPlay:l=!0,value:c,onChange:y,...S})=>{const[g,e]=r.useState(""),[a,R]=r.useState(0),[n,A]=r.useState(!1),[o,j]=r.useState(!1),[C,b]=r.useState(!1),x=r.useRef(void 0),N=r.useRef(void 0),w=r.useRef(t),T=r.useRef(a),I=r.useRef(o),q=r.useRef(g);r.useEffect(()=>{w.current=t,T.current=a,I.current=o,q.current=g});const M=r.useCallback((E,V)=>{let K=0;b(!0);const J=()=>{K<E.length?(e(E.slice(0,K+1)),K++,N.current=window.setTimeout(J,d)):(b(!1),V?.())};J()},[d]),F=r.useCallback(E=>{let V=q.current.length;const K=()=>{V>0?(e(q.current.slice(0,V-1)),V--,N.current=window.setTimeout(K,d/2)):E?.()};K()},[d]),D=r.useCallback(()=>{if(w.current.length===0||I.current)return;A(!0);const E=w.current[T.current];q.current?F(()=>{M(E,()=>{x.current=window.setTimeout(()=>{R(V=>(V+1)%w.current.length),A(!1)},2e3)})}):M(E,()=>{x.current=window.setTimeout(()=>{R(V=>(V+1)%w.current.length),A(!1)},2e3)})},[F,M]);r.useEffect(()=>(l&&t.length>0&&!o&&D(),()=>{x.current&&window.clearTimeout(x.current),N.current&&window.clearTimeout(N.current)}),[a,o,l,t.length,D]),r.useEffect(()=>{!n&&l&&t.length>0&&!o&&D()},[a,n,l,t.length,o,D]);const H=E=>{j(!0),x.current&&window.clearTimeout(x.current),N.current&&window.clearTimeout(N.current),A(!1),b(!1),S.onFocus?.(E)},P=E=>{j(!1),!c&&t.length>0&&(e(""),R(0)),S.onBlur?.(E)},U=E=>{y?.(E.target.value),S.onChange?.(E)},ee=()=>o||c?f:g||f;return p.jsxs("div",{style:{position:"relative"},children:[p.jsx(B.Input,{...S,value:c,onChange:U,onFocus:H,onBlur:P,placeholder:ee(),style:{...S.style,position:"relative",zIndex:1}}),!o&&!c&&g&&p.jsxs("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",paddingLeft:11,paddingRight:11,color:"#bfbfbf",pointerEvents:"none",zIndex:2,fontSize:14,fontFamily:"inherit"},children:[p.jsx("span",{children:g}),C&&p.jsx("span",{style:{display:"inline-block",width:1,height:"1.2em",backgroundColor:"#1890ff",marginLeft:2,animation:"blink 1s infinite"}})]}),p.jsx("style",{children:`
|
|
22
|
+
<%s key={someKey} {...props} />`,Q,o,y,o),le[o+Q]=!0)}if(o=null,z!==void 0&&(u(z),o=""+z),C(V)&&(u(V.key),o=""+V.key),"key"in V){z={};for(var R in V)R!=="key"&&(z[R]=V[R])}else z=V;return o&&h(z,typeof c=="function"?c.displayName||c.name||"Unknown":c),r(c,o,ee,oe,i(),z,de,a)}function p(c){typeof c=="object"&&c!==null&&c.$$typeof===n&&c._store&&(c._store.validated=1)}var S=s,n=Symbol.for("react.transitional.element"),A=Symbol.for("react.portal"),v=Symbol.for("react.fragment"),g=Symbol.for("react.strict_mode"),w=Symbol.for("react.profiler"),I=Symbol.for("react.consumer"),b=Symbol.for("react.context"),T=Symbol.for("react.forward_ref"),E=Symbol.for("react.suspense"),q=Symbol.for("react.suspense_list"),B=Symbol.for("react.memo"),D=Symbol.for("react.lazy"),P=Symbol.for("react.activity"),K=Symbol.for("react.client.reference"),F=S.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y=Object.prototype.hasOwnProperty,$=Array.isArray,k=console.createTask?console.createTask:function(){return null};S={react_stack_bottom_frame:function(c){return c()}};var L,U={},J=S.react_stack_bottom_frame.bind(S,m)(),se=k(l(m)),le={};me.Fragment=v,me.jsx=function(c,V,z,Q,oe){var ee=1e4>F.recentlyCreatedOwnerStacks++;return N(c,V,z,!1,Q,oe,ee?Error("react-stack-top-frame"):J,ee?k(l(c)):se)},me.jsxs=function(c,V,z,Q,oe){var ee=1e4>F.recentlyCreatedOwnerStacks++;return N(c,V,z,!0,Q,oe,ee?Error("react-stack-top-frame"):J,ee?k(l(c)):se)}}()),me}var ke;function Pe(){return ke||(ke=1,process.env.NODE_ENV==="production"?ye.exports=Be():ye.exports=De()),ye.exports}var d=Pe();const Te=({variant:t="primary",loading:f=!1,children:u,...l})=>{const i=m=>{switch(m){case"primary":return"primary";case"ghost":return"default";case"dashed":return"dashed";case"link":return"link";case"text":return"text";default:return"primary"}};return d.jsx(G.Button,{...l,type:i(t),loading:f,ghost:t==="ghost",children:u})};Te.__docgenInfo={displayName:"Button",description:"基础按钮,用于触发操作",props:{variant:{name:"variant",required:!1,description:"视觉风格",type:{name:"ButtonVariant",raw:'"primary" | "ghost" | "dashed" | "link" | "text"'},defaultValue:{value:'"primary"'}},loading:{name:"loading",required:!1,description:"是否加载中",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"false"}},children:{name:"children",required:!1,description:"按钮内容",type:{name:"ReactNode",raw:"React.ReactNode"}},size:{name:"size",required:!1,description:"按钮大小",type:{name:"ButtonSize",raw:'"small" | "middle" | "large"'}},disabled:{name:"disabled",required:!1,description:"是否禁用",type:{name:"boolean",raw:"boolean"}},onClick:{name:"onClick",required:!1,description:"点击事件",type:{name:"function",raw:"(event: MouseEvent) => void"}}}};const Ce=({title:t,children:f,bordered:u=!0,hoverable:l=!1,size:i="default",...m})=>d.jsx(G.Card,{...m,title:t,bordered:u,hoverable:l,size:i,children:f});Ce.__docgenInfo={displayName:"Card",description:"卡片容器,用于分组内容",props:{title:{name:"title",required:!1,description:"标题",type:{name:"ReactNode",raw:"React.ReactNode"}},children:{name:"children",required:!1,description:"内容区域",type:{name:"ReactNode",raw:"React.ReactNode"}},bordered:{name:"bordered",required:!1,description:"是否显示边框",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},hoverable:{name:"hoverable",required:!1,description:"是否可悬停",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"false"}},size:{name:"size",required:!1,description:"卡片大小",type:{name:"CardSize",raw:'"default" | "small"'},defaultValue:{value:'"default"'}},loading:{name:"loading",required:!1,description:"是否加载中",type:{name:"boolean",raw:"boolean"}},actions:{name:"actions",required:!1,description:"卡片操作组",type:{name:"ReactNode[]",raw:"React.ReactNode[]"}}}};const Ne=({showDefaultFooter:t=!0,...f})=>{const u=f.footer!==void 0?f.footer:t?(l,{OkBtn:i,CancelBtn:m})=>d.jsxs(d.Fragment,{children:[d.jsx(i,{}),d.jsx(m,{})]}):null;return d.jsx(G.Modal,{...f,footer:u})};Ne.__docgenInfo={displayName:"AppModal",description:"应用级模态框组件,基于 Ant Design Modal 封装",props:{showDefaultFooter:{name:"showDefaultFooter",required:!1,description:"是否显示默认的确定和取消按钮",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},title:{name:"title",required:!1,description:"模态框标题",type:{name:"ReactNode",raw:"React.ReactNode"}},open:{name:"open",required:!1,description:"是否显示模态框",type:{name:"boolean",raw:"boolean"}},onCancel:{name:"onCancel",required:!1,description:"取消按钮点击事件",type:{name:"function",raw:"(e: React.MouseEvent<HTMLElement>) => void"}},onOk:{name:"onOk",required:!1,description:"确定按钮点击事件",type:{name:"function",raw:"(e: React.MouseEvent<HTMLElement>) => void"}},children:{name:"children",required:!1,description:"模态框内容",type:{name:"ReactNode",raw:"React.ReactNode"}},width:{name:"width",required:!1,description:"模态框宽度",type:{name:"string | number",raw:"string | number"}},centered:{name:"centered",required:!1,description:"是否居中显示",type:{name:"boolean",raw:"boolean"}},maskClosable:{name:"maskClosable",required:!1,description:"点击蒙层是否允许关闭",type:{name:"boolean",raw:"boolean"}}}};const Se=({scrollX:t,showPagination:f=!0,defaultPageSize:u=10,...l})=>d.jsx(G.Table,{...l,scroll:{x:t||"max-content",y:"50vh"},pagination:f?{hideOnSinglePage:!0,showSizeChanger:!0,showQuickJumper:!0,defaultPageSize:u,...l.pagination}:!1});Se.__docgenInfo={displayName:"PageTable",description:"页面级表格组件,高度铺满容器,自动滚动",props:{scrollX:{name:"scrollX",required:!1,description:"水平滚动宽度",type:{name:"number",raw:"number"}},showPagination:{name:"showPagination",required:!1,description:"是否显示分页器",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},defaultPageSize:{name:"defaultPageSize",required:!1,description:"默认页面大小",type:{name:"number",raw:"number"},defaultValue:{value:"10"}},columns:{name:"columns",required:!1,description:"表格列配置",type:{name:"ColumnType[]",raw:"ColumnType<any>[]"}},dataSource:{name:"dataSource",required:!1,description:"数据源",type:{name:"any[]",raw:"any[]"}},loading:{name:"loading",required:!1,description:"是否加载中",type:{name:"boolean",raw:"boolean"}},rowKey:{name:"rowKey",required:!1,description:"行数据的 Key",type:{name:"string | function",raw:"string | ((record: any) => string)"}}}};const Fe=ue.createFromIconfontCN({scriptUrl:["https://at.alicdn.com/t/c/font_4968458_eh91gfr4j9e.js"]}),Re=({name:t,size:f,color:u,style:l,...i})=>{const m={fontSize:f,color:u,...l};return d.jsx(Fe,{...i,type:t,style:m})};Re.__docgenInfo={displayName:"XcIcon",description:"自定义图标组件,基于 iconfont",props:{name:{name:"name",required:!0,description:"图标名称",type:{name:"string",raw:"string"}},size:{name:"size",required:!1,description:"图标大小",type:{name:"number | string",raw:"number | string"}},color:{name:"color",required:!1,description:"图标颜色",type:{name:"string",raw:"string"}},className:{name:"className",required:!1,description:"自定义类名",type:{name:"string",raw:"string"}},style:{name:"style",required:!1,description:"自定义样式",type:{name:"CSSProperties",raw:"React.CSSProperties"}}}};const Ae=({loading:t,description:f="暂无数据",className:u,emptyChildren:l,loadingText:i,emptyImage:m})=>t?d.jsxs(G.Flex,{className:`pt-10 w-full ${u||""}`,align:"center",justify:"center",vertical:!0,children:[d.jsx(G.Spin,{size:"large"}),i&&d.jsx("div",{className:"mt-4 text-gray-500",children:i})]}):d.jsx(G.Flex,{className:`pt-10 w-full ${u||""}`,align:"center",justify:"center",children:d.jsx(G.Empty,{image:m,description:f,imageStyle:{height:180},children:l})});Ae.__docgenInfo={displayName:"EmptyAndSpin",description:"空状态和加载状态组合组件",props:{loading:{name:"loading",required:!0,description:"是否加载中",type:{name:"boolean",raw:"boolean"}},description:{name:"description",required:!1,description:"空状态描述",type:{name:"ReactNode",raw:"React.ReactNode"},defaultValue:{value:'"暂无数据"'}},className:{name:"className",required:!1,description:"自定义类名",type:{name:"string",raw:"string"}},emptyChildren:{name:"emptyChildren",required:!1,description:"空状态额外内容",type:{name:"ReactNode",raw:"React.ReactNode"}},loadingText:{name:"loadingText",required:!1,description:"加载中提示文字",type:{name:"string",raw:"string"}},emptyImage:{name:"emptyImage",required:!1,description:"空状态图片",type:{name:"string",raw:"string"}}}};const Ie=({onClick:t,showText:f=!1,className:u,size:l="small",type:i="default"})=>d.jsx(G.Button,{size:l,type:i,icon:d.jsx(ue.LeftOutlined,{}),className:`cursor-pointer ${u||""}`,onClick:t,children:f&&"返回"});Ie.__docgenInfo={displayName:"BackButton",description:"返回按钮组件",props:{onClick:{name:"onClick",required:!1,description:"点击事件",type:{name:"function",raw:"() => void"}},showText:{name:"showText",required:!1,description:"是否显示文字",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"false"}},className:{name:"className",required:!1,description:"自定义类名",type:{name:"string",raw:"string"}},size:{name:"size",required:!1,description:"按钮大小",type:{name:"ButtonSize",raw:'"small" | "middle" | "large"'},defaultValue:{value:'"small"'}},type:{name:"type",required:!1,description:"按钮类型",type:{name:"ButtonType",raw:'"primary" | "default" | "dashed" | "link" | "text"'},defaultValue:{value:'"default"'}}}};const _e=({removePadding:t=!0,className:f,...u})=>{const l=t?`px-0 h-auto ${f||""}`:f;return d.jsx(G.Button,{type:"link",...u,className:l,children:u.children})};_e.__docgenInfo={displayName:"LinkButton",description:"链接样式按钮组件,适用于表格操作列",props:{removePadding:{name:"removePadding",required:!1,description:"是否去除默认内边距",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},children:{name:"children",required:!1,description:"按钮内容",type:{name:"ReactNode",raw:"React.ReactNode"}},onClick:{name:"onClick",required:!1,description:"点击事件",type:{name:"function",raw:"(event: React.MouseEvent<HTMLButtonElement>) => void"}},disabled:{name:"disabled",required:!1,description:"是否禁用",type:{name:"boolean",raw:"boolean"}},className:{name:"className",required:!1,description:"自定义类名",type:{name:"string",raw:"string"}}}};const{Option:Ge}=G.Select,je=({columns:t,request:f,searchFields:u=[],showSearch:l=!0,showRefresh:i=!0,defaultPageSize:m=10,pageSizeOptions:C=["10","20","50","100"],autoLoad:h=!0,externalParams:e={},...r})=>{const[N,p]=s.useState([]),[S,n]=s.useState(!1),[A,v]=s.useState({current:1,pageSize:m,total:0}),[g,w]=s.useState({}),[I,b]=s.useState({}),[T]=G.Form.useForm(),E=s.useRef(A);E.current=A;const q=s.useRef(e);q.current=e;const B=s.useRef(!1),D=s.useMemo(()=>t.map(k=>{const{sortable:L,render:U,...J}=k;return{...J,sorter:L?!0:void 0,render:U||(se=>se)}}),[t]),P=s.useCallback(async(k={})=>{if(f){n(!0);try{const L={page:E.current.current,pageSize:E.current.pageSize,sortField:I.field,sortOrder:I.order,searchParams:{...g,...q.current},...k},U=await f(L);U.success&&(p(U.data),v(J=>({...J,total:U.total,current:L.page||J.current})))}catch(L){console.error("加载数据失败:",L)}finally{n(!1)}}},[f,I,g]),K=s.useCallback(k=>{w(k),v(L=>({...L,current:1}))},[]),F=s.useCallback(()=>{T.resetFields(),w({}),v(k=>({...k,current:1}))},[T]),Y=s.useCallback(()=>{P()},[P]),$=s.useCallback((k,L,U)=>{const J={current:k.current||1,pageSize:k.pageSize||m,total:k.total||0},se={field:U?.field,order:U?.order};v(J),b(se)},[m]);return s.useEffect(()=>{const k=Object.keys(e).length>0;(h&&!B.current||k)&&(P(),B.current=!0)},[h,e,P]),d.jsxs("div",{children:[l&&u.length>0&&d.jsx(G.Card,{size:"small",style:{marginBottom:16},children:d.jsxs(G.Form,{form:T,layout:"inline",onFinish:K,initialValues:u.reduce((k,L)=>(L.defaultValue!==void 0&&(k[L.key]=L.defaultValue),k),{}),children:[u.map(k=>d.jsx(G.Form.Item,{name:k.key,label:k.label,children:k.type==="input"?d.jsx(G.Input,{placeholder:k.placeholder||`请输入${k.label}`,style:{width:200}}):d.jsx(G.Select,{placeholder:k.placeholder||`请选择${k.label}`,style:{width:200},allowClear:!0,children:k.options?.map(L=>d.jsx(Ge,{value:L.value,children:L.label},L.value))})},k.key)),d.jsx(G.Form.Item,{children:d.jsxs(G.Space,{children:[d.jsx(G.Button,{type:"primary",htmlType:"submit",icon:d.jsx(ue.SearchOutlined,{}),children:"查询"}),d.jsx(G.Button,{onClick:F,children:"重置"}),i&&d.jsx(G.Button,{icon:d.jsx(ue.ReloadOutlined,{}),onClick:Y,children:"刷新"})]})})]})}),d.jsx(G.Table,{...r,columns:D,dataSource:N,loading:S,pagination:{...A,showSizeChanger:!0,showQuickJumper:!0,showTotal:(k,L)=>`第 ${L[0]}-${L[1]} 条/共 ${k} 条`,pageSizeOptions:C},onChange:$,scroll:{x:"max-content",y:"50vh"}})]})};je.__docgenInfo={displayName:"AdvancedTable",description:"高阶表格组件,支持异步请求、搜索、排序等功能",props:{columns:{name:"columns",required:!0,description:"列配置",type:{name:"AdvancedColumnType[]",raw:"AdvancedColumnType<any>[]"}},request:{name:"request",required:!1,description:"异步请求函数",type:{name:"function",raw:"(params: RequestParams) => Promise<RequestResponse>"}},searchFields:{name:"searchFields",required:!1,description:"搜索字段配置",type:{name:"SearchFieldConfig[]",raw:"SearchFieldConfig[]"},defaultValue:{value:"[]"}},showSearch:{name:"showSearch",required:!1,description:"是否显示搜索区域",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},showRefresh:{name:"showRefresh",required:!1,description:"是否显示刷新按钮",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},defaultPageSize:{name:"defaultPageSize",required:!1,description:"默认页面大小",type:{name:"number",raw:"number"},defaultValue:{value:"10"}},pageSizeOptions:{name:"pageSizeOptions",required:!1,description:"页面大小选项",type:{name:"string[]",raw:"string[]"},defaultValue:{value:'["10", "20", "50", "100"]'}},autoLoad:{name:"autoLoad",required:!1,description:"是否自动加载",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},externalParams:{name:"externalParams",required:!1,description:"外部请求参数",type:{name:"Record<string, any>",raw:"Record<string, any>"},defaultValue:{value:"{}"}}}};function he(t,f,u){if(!t.current)return;const l=new Set,i={};for(const p of f)p.exclusionGroup&&p.exclusionGroup!=="separator"&&(l.add(p.exclusionGroup),i[p.exclusionGroup]||(i[p.exclusionGroup]=[]),i[p.exclusionGroup].push({type:p.type,key:p.key,exclusionGroup:p.exclusionGroup}));const m={};for(const p of l){m[p]=!1;for(const S of i[p])if(S.type==="upload"&&S.key){if(u[S.key]!==null&&u[S.key]!==void 0){m[p]=!0;break}}else if(S.type==="variable"&&S.key){const n=t.current.querySelector(`[data-type="variable"][data-key="${S.key}"]`);if(n&&n.innerText.replace(/[\u200B\n]/g,"").trim().length>0){m[p]=!0;break}}}const C=f.some(p=>p.exclusionGroup==="separator"),e=Object.keys(m).filter(p=>m[p]).length>0;let r=null;if(e&&C){for(const p of f)if(p.exclusionGroup&&p.exclusionGroup!=="separator"&&m[p.exclusionGroup]){r=p.exclusionGroup;break}}for(const p of l){const S=t.current.querySelectorAll(`[data-group="${p}"]`);C&&e&&r?p===r?S.forEach(n=>{n.classList.contains("required-upload-group")?n.style.setProperty("display","inline-flex","important"):(n.classList.contains("exclusion-wrapper"),n.style.setProperty("display","inline-block","important"))}):S.forEach(n=>{n.style.display="none",n.style.setProperty("display","none","important")}):S.forEach(n=>{n.classList.contains("required-upload-group")?n.style.setProperty("display","inline-flex","important"):(n.classList.contains("exclusion-wrapper"),n.style.setProperty("display","inline-block","important"))})}t.current.querySelectorAll('[data-group="separator"]').forEach(p=>{p.style.display=e?"none":"inline"})}function ge(t,f,u,l){if(!t.current){l(!1);return}const i=[];for(let e=0;e<f.length;e++){const r=f[e];if((r.type==="variable"||r.type==="upload"||r.type==="multi-variable")&&r.required&&r.key){i.push({exclusionGroup:r.exclusionGroup||"",key:r.key,type:r.type==="multi-variable"?"variable":r.type,isMultiVariable:r.type==="multi-variable"});continue}if(r.type==="text"&&r.className?.includes("rte-text-required")&&r.exclusionGroup)for(let N=e+1;N<f.length;N++){const p=f[N];if(p.exclusionGroup===r.exclusionGroup&&(p.type==="variable"||p.type==="upload")&&p.key){i.push({exclusionGroup:r.exclusionGroup,key:p.key,type:p.type});break}}}const m=f.some(e=>e.exclusionGroup==="separator");let C=!1;if(m&&i.length>1){const e=f.findIndex(p=>p.exclusionGroup==="separator"),r=i.filter(p=>f.findIndex(n=>(n.type==="variable"||n.type==="upload")&&n.key===p.key&&n.exclusionGroup===p.exclusionGroup)<e),N=i.filter(p=>f.findIndex(n=>(n.type==="variable"||n.type==="upload")&&n.key===p.key&&n.exclusionGroup===p.exclusionGroup)>e);C=r.length>0&&N.length>0}if(i.length===0){if(f.length===0){if(!t.current){l(!1);return}const e=t.current.textContent?.replace(/[\u200B\n]/g,"").trim()||"";l(e.length>0);return}l(!0);return}const h=i.filter(e=>{if(!t.current)return!1;const r=t.current.querySelectorAll(`[data-group="${e.exclusionGroup}"]`);return r.length===0?!1:r[0].style.display!=="none"});if(h.length===0){l(!0);return}if(C){let e=!1;for(const r of h)if(r.type==="upload"&&r.key){if(u[r.key]!==null&&u[r.key]!==void 0){e=!0;break}}else if(r.type==="variable"&&r.key)if(r.isMultiVariable){const N=t.current.querySelectorAll(`[data-type="variable"][data-multi-key="${r.key}"]`);let p=!1;for(const S of Array.from(N))if(S.innerText.replace(/[\u200B\n]/g,"").trim().length>0){p=!0;break}if(p){e=!0;break}}else{const N=t.current.querySelector(`[data-type="variable"][data-key="${r.key}"]`);if(N&&N.innerText.replace(/[\u200B\n]/g,"").trim().length>0){e=!0;break}}l(e)}else{let e=!0;for(const r of h)if(r.type==="upload"&&r.key){if(u[r.key]===null||u[r.key]===void 0){e=!1;break}}else if(r.type==="variable"&&r.key)if(r.isMultiVariable){const N=t.current.querySelectorAll(`[data-type="variable"][data-multi-key="${r.key}"]`);let p=!1;for(const S of Array.from(N))if(S.innerText.replace(/[\u200B\n]/g,"").trim().length>0){p=!0;break}if(!p){e=!1;break}}else{const N=t.current.querySelector(`[data-type="variable"][data-key="${r.key}"]`);if(!N){e=!1;break}if(N.innerText.replace(/[\u200B\n]/g,"").trim().length===0){e=!1;break}}l(e)}}function be(t,f){if(!t.current)return;t.current.querySelectorAll('[data-type="variable"]').forEach(l=>{const i=l.innerText.replace(/\n/g,"");i.replace(/\u200B/g,"")?l.classList.remove("show-placeholder"):(i!==""&&(l.innerText=""),l.classList.add("show-placeholder"))})}function ze(t,f,u,l,i,m={}){if(!t.current)return;let C="",h=0;for(;h<f.length;){const e=f[h],r=h+1<f.length?f[h+1]:null;if(e.type==="text"&&(e.text?.includes("icon-bitian")||e.className==="rte-text-required")&&r){const v=r.type==="upload"&&r.exclusionGroup==="fileInput"&&e.exclusionGroup==="fileInput"&&e.exclusionGroup===r.exclusionGroup,g=r.type==="variable"&&r.exclusionGroup==="textInput"&&e.exclusionGroup==="textInput"&&e.exclusionGroup===r.exclusionGroup;if(v){const I=`<span ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper required-upload-group">`,b="</span>";let T="";e.className?T=`<span class="${e.className}">${e.text??""}</span>`:T=e.text??"";const E=r,q=u[E.key]!==null&&u[E.key]!==void 0,B=q?u[E.key]?.name:E.text,D=q?"":"hidden",P=E.tooltip&&!q?"":"hidden",K=q?"has-file":"",F=q&&B?` data-file-name="${B.replace(/"/g,""")}"`:"",Y=`<span contenteditable="false" data-type="upload" data-key="${E.key}" class="upload-chip"><span class="upload-inner-wrapper ${K}"><span class="upload-icon">${q?"<i class='iconfont icon-exlwenjian'></i>":"<i class='iconfont icon-shangchuan1'></i>"}</span><span class="upload-label"${F}>${B||E.text}</span>${E.tooltip?`<i contenteditable="false" class="iconfont icon-tishi upload-info-icon ${P}" data-upload-key="${E.key}" data-tooltip="${E.tooltip}" title="提示"></i>`:""}<span class="file-remove-btn ${D}" title="移除文件">×</span></span></span>`;C+=I+T+Y+b,h+=2;continue}if(g){const I=`<span ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper required-upload-group">`,b="</span>";let T="";e.className?T=`<span class="${e.className}">${e.text??""}</span>`:T=e.text??"";const E=r,B=(E.key?i[E.key]:void 0)||E.text||"",D=!B,P=D?"":B,K=D?"show-placeholder":"",F=E.exclusionGroup?` data-group="${E.exclusionGroup}"`:"",Y=E.tooltip?` data-tooltip="${E.tooltip.replace(/"/g,""")}" data-variable-key="${E.key||""}"`:"",$=E.tooltip&&D?"":"hidden",k=`<span contenteditable="true" data-type="variable" data-key="${E.key}" data-placeholder="${E.placeholder||""}"${F}${Y} class="variable-chip ${K}">${P}${E.tooltip?`<i contenteditable="false" class="iconfont icon-tishi variable-info-icon ${$}" data-variable-key="${E.key}" data-tooltip="${E.tooltip.replace(/"/g,""")}" title="提示"></i>`:""}</span>`;C+=I+T+k+b,h+=2;continue}}const p=e.exclusionGroup?`data-group="${e.exclusionGroup}"`:"",S=e.exclusionGroup?`<span ${p} class="exclusion-wrapper">`:"",n=e.exclusionGroup?"</span>":"";let A="";if(e.type==="tag"){const v=l?"":'<span class="tag-close-btn" title="Clear (ESC)"><svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"><path d="M18 6L6 18M6 6l12 12"/></svg></span>',g=l?' data-locked="true"':"",w=e.tooltip?` data-tooltip="${e.tooltip.replace(/"/g,""")}" data-tag-key="${e.key||""}"`:"";A=`<span contenteditable="false" class="tag-node group"${g}${w}><span class="tag-label">${e.text}</span>${v}</span>`}else if(e.type==="text"){const v=l?' data-locked="true" contenteditable="false"':' contenteditable="false"';e.className?A=`<span class="${e.className}"${v}>${e.text??""}</span>`:A=l?`<span${v}>${e.text??""}</span>`:`<span contenteditable="false">${e.text??""}</span>`}else if(e.type==="variable"&&e.key){const g=i[e.key]||e.text||"",w=!g,I=w?"":g,b=w?"show-placeholder":"",T=e.exclusionGroup?` data-group="${e.exclusionGroup}"`:"",E=e.tooltip?` data-tooltip="${e.tooltip.replace(/"/g,""")}" data-variable-key="${e.key||""}"`:"",q=e.tooltip&&w?"":"hidden",B=`<span contenteditable="true" data-type="variable" data-key="${e.key}" data-placeholder="${e.placeholder||""}"${T}${E} class="variable-chip ${b}">${I}${e.tooltip?`<i contenteditable="false" class="iconfont icon-tishi variable-info-icon ${q}" data-variable-key="${e.key}" data-tooltip="${e.tooltip.replace(/"/g,""")}" title="提示"></i>`:""}</span>`;e.required?A=`<span ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper required-upload-group"><span class="rte-text-required"><i class='iconfont icon-bitian' style='font-size: 10px;'></i></span>${B}</span>`:A=B}else if(e.type==="upload"&&e.key){const v=u[e.key]!==null&&u[e.key]!==void 0,g=v?u[e.key]?.name:e.text,w=v?"":"hidden",I=e.tooltip&&!v?"":"hidden",b=v?"has-file":"",T=v&&g?` data-file-name="${g.replace(/"/g,""")}"`:"",E=`<span contenteditable="false" data-type="upload" data-key="${e.key}" class="upload-chip"><span class="upload-inner-wrapper ${b}"><span class="upload-icon">${v?"<i class='iconfont icon-exlwenjian'></i>":"<i class='iconfont icon-shangchuan1'></i>"}</span><span class="upload-label"${T}>${g||e.text}</span>${e.tooltip?`<i contenteditable="false" class="iconfont icon-tishi upload-info-icon ${I}" data-upload-key="${e.key}" data-tooltip="${e.tooltip}" title="提示"></i>`:""}<span class="file-remove-btn ${w}" title="移除文件">×</span></span></span>`;e.required?A=`<span ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper required-upload-group"><span class="rte-text-required"><i class='iconfont icon-bitian' style='font-size: 10px;'></i></span>${E}</span>`:A=E}else if(e.type==="multi-variable"&&e.key){const v=e.maxCount||9,g=m[e.key]||1,w=Math.min(g,v);let I="";for(let b=0;b<w;b++){const T=`${e.key}_${b}`,E=i[T]||"",q=!E,B=q?"":E,D=q?"show-placeholder":"",P=e.tooltip?` data-tooltip="${e.tooltip.replace(/"/g,""")}" data-variable-key="${e.key||""}"`:"",K=e.tooltip&&q?"":"hidden",F=`<span contenteditable="true" data-type="variable" data-key="${T}" data-multi-key="${e.key}" data-index="${b}" data-placeholder="${e.placeholder||""}"${P} class="variable-chip ${D}">${B}${e.tooltip?`<i contenteditable="false" class="iconfont icon-tishi variable-info-icon ${K}" data-variable-key="${e.key}" data-tooltip="${e.tooltip.replace(/"/g,""")}" title="提示"></i>`:""}</span>`;I+=F}e.required?A=`<span ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper required-upload-group"><span class="rte-text-required"><i class='iconfont icon-bitian' style='font-size: 10px;'></i></span>${I}</span>`:A=I}C+=S+A+n,h++}t.current&&(t.current.innerHTML=C,setTimeout(()=>{if(!t.current)return;t.current.querySelectorAll('[data-type="variable"]').forEach(r=>{const N=r.innerText.replace(/\n/g,"");N.replace(/\u200B/g,"")?r.classList.remove("show-placeholder"):(N!==""&&(r.innerText=""),r.classList.add("show-placeholder"))})},0))}function He(t,f,u,l,i={},m,C){const h=s.useCallback(()=>{if(!t.current)return;if(f.length===0){t.current.innerHTML="";return}let e={};const r=t.current,N=r.__tempVariableValues;if(N?(e=N,delete r.__tempVariableValues):t.current.querySelectorAll('[data-type="variable"]').forEach(S=>{const n=S.dataset.key;if(n){const A=S.innerText.replace(/[\u200B\n]/g,"").trim();A&&(e[n]=A)}}),ze(t,f,u,l,e,i),m?.current){const{key:p,offset:S}=m.current;setTimeout(()=>{if(!t.current)return;const n=t.current.querySelector(`[data-type="variable"][data-key="${p}"]`);if(n){try{const A=document.createRange(),v=document.createTreeWalker(n,NodeFilter.SHOW_TEXT,null);let g=0,w=null,I=0;for(;v.nextNode();){const b=v.currentNode,T=b.textContent?.length||0;if(g+T>=S){w=b,I=S-g;break}g+=T}if(w){A.setStart(w,Math.min(I,w.textContent?.length||0)),A.collapse(!0);const b=window.getSelection();b&&(b.removeAllRanges(),b.addRange(A),n.focus())}else{A.selectNodeContents(n),A.collapse(!1);const b=window.getSelection();b&&(b.removeAllRanges(),b.addRange(A),n.focus())}}catch{const A=document.createRange();A.selectNodeContents(n),A.collapse(!1);const v=window.getSelection();v&&(v.removeAllRanges(),v.addRange(A),n.focus())}m.current=null}},0)}},[f,u,l,t,i,m,C]);s.useEffect(()=>{h()},[h])}function We(t,f,u,l){s.useEffect(()=>{const i=t.current;if(!i)return;const m=h=>{const e=h.target?.closest(".upload-info-icon");if(e&&e.classList.contains("upload-info-icon")){const r=e.dataset.uploadKey;r&&l({key:r,anchorEl:e,type:"upload"})}},C=h=>{const e=h.target?.closest(".upload-info-icon"),r=h.relatedTarget;e&&e.classList.contains("upload-info-icon")&&(!r||!i.contains(r)?l(null):r.closest(".upload-info-icon")||l(null))};return i.addEventListener("mouseover",m,!0),i.addEventListener("mouseout",C,!0),()=>{i.removeEventListener("mouseover",m,!0),i.removeEventListener("mouseout",C,!0)}},[f,u,t,l])}function Xe(t,f,u){s.useEffect(()=>{if(!t.current)return;const l=h=>{const e=h.currentTarget,r=e.dataset.tooltip,N=e.dataset.tagKey||"";r&&u({key:N,anchorEl:e,type:"tag"})},i=()=>{u(null)};let m;const C=()=>{if(!t.current)return;t.current.querySelectorAll(".tag-node[data-tooltip]").forEach(e=>{e.addEventListener("mouseenter",l),e.addEventListener("mouseleave",i)})};return m=requestAnimationFrame(()=>{m=requestAnimationFrame(C)}),()=>{cancelAnimationFrame(m),t.current&&t.current.querySelectorAll(".tag-node[data-tooltip]").forEach(e=>{e.removeEventListener("mouseenter",l),e.removeEventListener("mouseleave",i)})}},[f,t,u])}function Ke(t,f,u){s.useEffect(()=>{const l=t.current;if(!l)return;const i=C=>{const h=C.target?.closest(".variable-info-icon");if(h&&h.classList.contains("variable-info-icon")){const e=h.dataset.variableKey;e&&u({key:e,anchorEl:h,type:"variable"})}},m=C=>{const h=C.target?.closest(".variable-info-icon"),e=C.relatedTarget;h&&h.classList.contains("variable-info-icon")&&(!e||!l.contains(e)?u(null):e.closest(".variable-info-icon")||u(null))};return l.addEventListener("mouseover",i,!0),l.addEventListener("mouseout",m,!0),()=>{l.removeEventListener("mouseover",i,!0),l.removeEventListener("mouseout",m,!0)}},[f,t,u])}function Ye(t,f,u,l){s.useEffect(()=>{if(!t.current)return;const i=e=>{const r=e.currentTarget;r.dataset.fileName&&l({key:"",anchorEl:r,type:"upload-label"})},m=()=>{l(null)};let C;const h=()=>{if(!t.current)return;t.current.querySelectorAll(".upload-label[data-file-name]").forEach(r=>{r.addEventListener("mouseenter",i),r.addEventListener("mouseleave",m)})};return C=requestAnimationFrame(()=>{C=requestAnimationFrame(h)}),()=>{cancelAnimationFrame(C),t.current&&t.current.querySelectorAll(".upload-label[data-file-name]").forEach(r=>{r.removeEventListener("mouseenter",i),r.removeEventListener("mouseleave",m)})}},[f,u,t,l])}function Ue(t,f,u,l){s.useEffect(()=>{he(t,f,u),ge(t,f,u,l)},[u,f,t,l])}function Je(t,f){s.useEffect(()=>{if(!t.current)return;let u=!1,l=0;const i=()=>{u=!0},m=()=>{u=!1,l=Date.now()};let C=!1,h=0;const e=()=>{C=!0},r=()=>{C=!1,h=Date.now()},N=()=>{h=Date.now()},p=()=>{if(!t.current)return;const n=window.getSelection();if(!n||n.rangeCount===0||f.current||u||C||Date.now()-h<500)return;const A=n.getRangeAt(0);if(!A.collapsed){t.current.contains(A.commonAncestorContainer)||n.removeAllRanges();return}const v=n.anchorNode;if(!v)return;if(!t.current.contains(v)){n.removeAllRanges();return}let g=null;if(v.nodeType===Node.ELEMENT_NODE?g=v.closest('[data-type="variable"]'):v.nodeType===Node.TEXT_NODE&&v.parentElement&&(g=v.parentElement.closest('[data-type="variable"]')),!g){if(Date.now()-l>500)return;const w=t.current.querySelectorAll('[data-type="variable"]');if(w.length>0){let I=null;for(const b of Array.from(w))if(b.style.display!=="none"){I=b;break}if(!I&&w.length>0&&(I=w[0]),I){const b=document.createRange();b.selectNodeContents(I),b.collapse(!1),n.removeAllRanges(),n.addRange(b),I.focus()}else n.removeAllRanges()}else n.removeAllRanges()}},S=t.current;return S&&(S.addEventListener("compositionstart",e),S.addEventListener("compositionend",r),S.addEventListener("input",N)),document.addEventListener("mousedown",i),document.addEventListener("mouseup",m),document.addEventListener("selectionchange",p),()=>{const n=t.current;n&&(n.removeEventListener("compositionstart",e),n.removeEventListener("compositionend",r),n.removeEventListener("input",N)),document.removeEventListener("mousedown",i),document.removeEventListener("mouseup",m),document.removeEventListener("selectionchange",p)}},[t,f])}const Le=({config:t,onSend:f,isProcessing:u=!1,disabled:l=!1,width:i,lockStructure:m=!1,agentOptions:C=[],onAgentSelect:h,onAgentExit:e,loading:r=!1,placeholder:N,border:p,background:S="transparent"})=>{const n=s.useRef(null),A=s.useRef(null),[v,g]=s.useState({}),[w,I]=s.useState(null),[b,T]=s.useState(null),E=s.useRef(!1),q=s.useRef(null),[B,D]=s.useState(!1),P=s.useRef(null),[K,F]=s.useState(!0),[Y,$]=s.useState(()=>{const a={};return t.forEach(o=>{o.type==="multi-variable"&&o.key&&(a[o.key]=1)}),a});s.useEffect(()=>{$(a=>{const o={};return t.forEach(y=>{y.type==="multi-variable"&&y.key&&(o[y.key]=a[y.key]||1)}),o})},[t]),He(n,t,v,m,Y,P),We(n,t,v,T),Xe(n,t,T),Ye(n,t,v,T),Ke(n,t,T),Ue(n,t,v,D),Je(n,E),s.useEffect(()=>{if(t.length>0){F(!1);return}const a=()=>{if(!n.current){F(!0);return}const y=n.current.textContent?.replace(/[\u200B\n]/g,"").trim()||"",R=n.current.querySelectorAll('[data-type="variable"]'),x=n.current.querySelectorAll('[data-type="upload"]');let _=!1;R.forEach(M=>{(M.textContent?.replace(/[\u200B\n]/g,"").trim()||"")&&(_=!0)}),x.forEach(M=>{M.querySelector(".upload-inner-wrapper.has-file")&&(_=!0)});const j=!y&&!_;F(j),t.length===0&&D(!j)};a();const o=new MutationObserver(a);return n.current&&o.observe(n.current,{childList:!0,subtree:!0,characterData:!0}),()=>{o.disconnect()}},[t]);const k=a=>{if(l){a.preventDefault();return}a.preventDefault();const o=a.clipboardData.getData("text/plain"),y=window.getSelection();if(y&&y.rangeCount>0){const R=y.anchorNode;if(R){let x=null;if(R.nodeType===Node.ELEMENT_NODE?x=R.closest('[data-type="variable"]'):R.nodeType===Node.TEXT_NODE&&R.parentElement&&(x=R.parentElement.closest('[data-type="variable"]')),x){const _=x.dataset.multiKey;if(_){const j=o.split(/[,\n\r\t]+/).map(M=>M.trim()).filter(M=>M.length>0);if(j.length>1){const M=parseInt(x.dataset.index||"0",10),O=t.find(ne=>ne.type==="multi-variable"&&ne.key===_)?.maxCount||9,H=Y[_]||1,te=Math.min(M+j.length,O);te>H&&$(Z=>({...Z,[_]:te})),setTimeout(()=>{n.current&&(j.forEach((Z,ne)=>{const re=M+ne;if(re>=O)return;const W=`${_}_${re}`,ae=n.current.querySelector(`[data-type="variable"][data-key="${W}"]`);ae&&(ae.innerText=Z,ae.classList.remove("show-placeholder"))}),z())},0);return}}}}}document.execCommand("insertText",!1,o),z()},L=a=>{if(a.target.files&&a.target.files[0]&&w){const o=a.target.files[0],y=w;g(R=>({...R,[y]:o}))}a.target&&(a.target.value=""),I(null)},U=a=>{g(o=>{const y={...o};return delete y[a],y})},J=a=>{const o=a.target;if(o.closest(".tag-close-btn")){if(a.preventDefault(),a.stopPropagation(),m)return;T(null),e?e():n.current&&(n.current.innerHTML="",n.current.focus());return}if(m){const x=o.closest(".tag-node"),_=o.closest('[data-type="text"]');if(x||_){a.preventDefault(),a.stopPropagation();const j=window.getSelection();j&&j.removeAllRanges();return}}o.closest('[data-type="variable"]')||(q.current={x:a.clientX,y:a.clientY},E.current=!1,o.closest(".file-remove-btn")&&(a.preventDefault(),a.stopPropagation()))},se=a=>{if(!a.target.closest('[data-type="variable"]')&&q.current){const R=Math.abs(a.clientX-q.current.x),x=Math.abs(a.clientY-q.current.y);(R>3||x>3)&&(E.current=!0)}},le=a=>{if(a.target.closest('[data-type="variable"]')){q.current=null,E.current=!1;return}q.current=null,E.current=!1},c=a=>{if(l)return;const o=a.target;if(o.closest(".tag-close-btn")){a.preventDefault(),a.stopPropagation();return}if(t.length===0)return;if(o.closest('[data-type="text"]')){a.preventDefault(),a.stopPropagation();const M=window.getSelection();M&&M.removeAllRanges();return}if(m&&o.closest(".tag-node")){a.preventDefault(),a.stopPropagation();const O=window.getSelection();O&&O.removeAllRanges();return}if(o.closest('[data-type="variable"]')){if(E.current)return;setTimeout(()=>{const M=window.getSelection();M&&!M.isCollapsed||be(n)},10);return}const _=o.closest(".file-remove-btn");if(_){a.preventDefault(),a.stopPropagation();const O=_.closest('[data-type="upload"]')?.dataset.key;O&&U(O);return}const j=o.closest('[data-type="upload"]');if(j){const M=j.dataset.key;M&&(I(M),A.current?.click());return}},V=a=>{const y=a.target.closest('[data-type="variable"]');if(y){const R=window.getSelection();if(R){const x=document.createRange(),_=y.textContent||"";if(_.replace(/\u200B/g,"")){let M=0,O=_.length;_.startsWith("")&&(M=1),_.endsWith("")&&_.length>1&&(O=_.length-1);const H=y.firstChild;H&&H.nodeType===Node.TEXT_NODE?(x.setStart(H,M),x.setEnd(H,O)):x.selectNodeContents(y)}else x.selectNodeContents(y),x.collapse(!0);R.removeAllRanges(),R.addRange(x)}}},z=()=>{if(t.length===0){if(n.current){const y=!(n.current.textContent?.replace(/[\u200B\n]/g,"").trim()||"");F(y),D(!y)}return}if(be(n),n.current&&n.current.querySelectorAll('[data-type="variable"]').forEach(y=>{const R=y.querySelector(".variable-info-icon");if(R){let x=!1;const _=document.createTreeWalker(y,NodeFilter.SHOW_TEXT,{acceptNode:j=>R.contains(j)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT});for(;_.nextNode();)if(_.currentNode.textContent?.replace(/[\u200B\n]/g,"").trim()){x=!0;break}x?R.classList.add("hidden"):R.classList.remove("hidden")}}),he(n,t,v),ge(n,t,v,D),!n.current)return;t.filter(o=>o.type==="multi-variable"&&o.key).forEach(o=>{if(!o.key)return;const y=o.maxCount||9,R=Y[o.key]||1,x=[];for(let H=0;H<R;H++){const te=`${o.key}_${H}`,Z=n.current.querySelector(`[data-type="variable"][data-key="${te}"][data-multi-key="${o.key}"]`);if(Z){const ne=Z.innerText.replace(/[\u200B\n]/g,"").trim();x.push(ne)}}const j=(x[x.length-1]||"")==="";let M=!1,O=-1;for(let H=0;H<x.length-1;H++)if(x[H]===""){M=!0,O=H;break}if(M&&O>=0){const H=window.getSelection();if(H&&H.rangeCount>0){const W=H.getRangeAt(0),ae=W.startContainer,ie=ae.nodeType===Node.ELEMENT_NODE?ae.closest('[data-type="variable"][data-multi-key]'):ae.parentElement?.closest('[data-type="variable"][data-multi-key]');if(ie){const ce=ie.dataset.key;if(ce){const pe=document.createRange();pe.setStartBefore(ie),pe.setEnd(W.startContainer,W.startOffset);const xe=pe.toString().length;P.current={key:ce,offset:xe}}}}const te=[...x];for(let W=O;W<te.length-1;W++)te[W]=te[W+1];te.pop();const Z={};te.forEach((W,ae)=>{W&&(Z[`${o.key}_${ae}`]=W)});const ne=Math.max(j?te.length:te.length+1,1);n.current.querySelectorAll('[data-type="variable"]').forEach(W=>{const ae=W.dataset.key,ie=W.dataset.multiKey;if(ae&&ie!==o.key){const ce=W.innerText.replace(/[\u200B\n]/g,"").trim();ce&&(Z[ae]=ce)}}),n.current.__tempVariableValues=Z,$(W=>({...W,[o.key]:ne}));return}if(!j){const H=R-1,te=`${o.key}_${H}`,Z=n.current.querySelector(`[data-type="variable"][data-key="${te}"][data-multi-key="${o.key}"]`);if(Z&&Z.innerText.replace(/[\u200B\n]/g,"").trim().length>0&&R<y){const re=window.getSelection();if(re&&re.rangeCount>0){const W=re.getRangeAt(0),ae=W.startContainer,ie=ae.nodeType===Node.ELEMENT_NODE?ae.closest('[data-type="variable"][data-multi-key]'):ae.parentElement?.closest('[data-type="variable"][data-multi-key]');if(ie){const ce=ie.dataset.key;if(ce){const pe=document.createRange();pe.setStartBefore(ie),pe.setEnd(W.startContainer,W.startOffset);const xe=pe.toString().length;P.current={key:ce,offset:xe}}}}$(W=>({...W,[o.key]:R+1}))}}})},Q=()=>{if(n.current){if(t.length===0){const a=n.current.textContent?.replace(/[\u200B\n]/g,"").trim()||"";D(a.length>0);return}be(n),he(n,t,v),ge(n,t,v,D)}},oe=a=>{if(l){a.preventDefault();return}const o=window.getSelection();if(o&&o.rangeCount>0){const y=o.anchorNode;let R=null;if(y&&(y.nodeType===Node.ELEMENT_NODE?R=y.closest('[data-type="text"]'):y.nodeType===Node.TEXT_NODE&&y.parentElement&&(R=y.parentElement.closest('[data-type="text"]'))),R){if(a.preventDefault(),a.stopPropagation(),n.current){const x=n.current.querySelector('[data-type="variable"], [data-type="upload"]');x&&x.focus()}return}}if(m&&o&&o.rangeCount>0){const y=o.anchorNode;let R=null;if(y&&(y.nodeType===Node.ELEMENT_NODE?R=y.closest(".tag-node"):y.nodeType===Node.TEXT_NODE&&y.parentElement&&(R=y.parentElement.closest(".tag-node"))),R){if(a.preventDefault(),a.stopPropagation(),n.current){const x=n.current.querySelector('[data-type="variable"], [data-type="upload"]');x&&x.focus()}return}}if(a.key==="Enter"&&!a.shiftKey&&(a.preventDefault(),ee()),a.key==="Escape"&&n.current){if(m){a.preventDefault();return}n.current.innerHTML="",n.current.focus()}if(a.key==="Backspace"){const y=window.getSelection();if(y&&y.rangeCount>0){const R=y.getRangeAt(0),x=y.anchorNode;if(m){let j=null,M=null;if(x&&(x.nodeType===Node.ELEMENT_NODE?(j=x.closest(".tag-node"),M=x.closest('[data-type="text"]')):x.nodeType===Node.TEXT_NODE&&x.parentElement&&(j=x.parentElement.closest(".tag-node"),M=x.parentElement.closest('[data-type="text"]'))),(j||M)&&R.collapsed&&R.startOffset===0){a.preventDefault();return}}let _=null;if(x&&(x.nodeType===Node.ELEMENT_NODE?_=x.closest('[data-type="variable"]'):x.nodeType===Node.TEXT_NODE&&x.parentElement&&(_=x.parentElement.closest('[data-type="variable"]'))),_){if(!R.collapsed)return;const j=_.innerText;if(j===""||j===""){a.preventDefault();return}if(R.startOffset===0){a.preventDefault();return}if(j.startsWith("")&&R.startOffset===1){a.preventDefault();return}}}}},ee=()=>{if(u||l||r||!B||!n.current)return;if(t.length===0){const _=n.current.textContent?.replace(/[\u200B\n]/g,"").trim()||"";if(!_)return;f(_,_);return}const a=n.current;let o="";const y={},R=_=>{if(!(_.nodeType===Node.ELEMENT_NODE&&_.style.display==="none")){if(_.nodeType===Node.TEXT_NODE)o+=(_.textContent||"").replace(/\u200B/g,"");else if(_.nodeType===Node.ELEMENT_NODE){const j=_,M=j.dataset.type,O=j.dataset.key;if(M==="variable"&&O){let H="";const te=document.createTreeWalker(j,NodeFilter.SHOW_TEXT,{acceptNode:ne=>{const re=j.querySelector(".variable-info-icon");return re&&re.contains(ne)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}});for(;te.nextNode();)H+=te.currentNode.textContent||"";const Z=H.replace(/[\u200B\n]/g,"").trim();if(Z){const ne=j.dataset.multiKey;if(ne){y[ne]||(y[ne]=[]);const re=y[ne];re.push(Z),re.length>1&&(o+=" "),o+=Z}else y[O]=Z,o+=Z}}else if(M==="upload"&&O)y[O]=v[O]??null,v[O]&&(o+=` [附带文件: ${v[O]?.name}] `);else{if(j.classList.contains("tag-close-btn")||j.classList.contains("file-remove-btn"))return;j.getAttribute("contenteditable")==="false"&&!M&&j.classList.contains("tag-node")?o+=j.innerText:j.childNodes.forEach(R)}}}};if(a.childNodes.forEach(R),o=o.trim(),!o)return;const x=new FormData;x.append("fullPrompt",o),Object.keys(y).forEach(_=>{const j=y[_];j!=null&&(j instanceof File?x.append(_,j):Array.isArray(j)?t.some(O=>O.type==="multi-variable"&&O.key===_)?j.forEach(O=>{O!=null&&O!==""&&x.append(_,String(O))}):j.forEach((O,H)=>{O!=null&&(O instanceof File?x.append(`${_}[${H}]`,O):typeof O=="string"?x.append(`${_}[${H}]`,O):x.append(`${_}[${H}]`,String(O)))}):typeof j=="string"?x.append(_,j):x.append(_,String(j)))}),f(x,o)},de={...i?{width:typeof i=="number"?`${i}px`:i}:{},...p?{border:p}:{},...S?{background:S}:{}};return d.jsxs("div",{className:"rich-text-editor",style:de,"data-disabled":l,children:[d.jsx("div",{ref:n,className:`rte-editor ${t.length===0?"rte-editor-default":""} ${K&&N?"rte-editor-empty":""}`,contentEditable:t.length===0,suppressContentEditableWarning:!0,"data-placeholder":N,onMouseDown:J,onMouseMove:se,onMouseUp:le,onClick:c,onDoubleClick:V,onInput:z,onKeyDown:oe,onPaste:k,onBlur:Q}),d.jsx("input",{type:"file",ref:A,className:"rte-file-input",accept:".csv,.xlsx,.xls,.txt,.pdf,image/*",onChange:L}),d.jsxs("div",{className:"rich-text-editor-footer",children:[d.jsx("div",{className:"rich-text-editor-footer-left",children:d.jsxs("div",{className:"rich-text-editor-brand",children:[d.jsxs("div",{className:"rte-brand-badge",children:[d.jsx("img",{src:"https://oospublic.sealseek.cn/file/website/ball.png",alt:""}),d.jsx("span",{className:"rte-brand-text",children:"SealSeek 1.0"})]}),d.jsx(G.Dropdown,{placement:"top",menu:{items:C.map(a=>({key:a.key,label:d.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[a.icon&&d.jsx("i",{className:a.icon}),d.jsx("span",{children:a.label})]}),onClick:()=>{h?.(a)}}))},trigger:["click"],disabled:l||u,children:d.jsxs("div",{className:"rte-agent-badge",style:{cursor:C.length>0?"pointer":"default"},children:[d.jsx("i",{className:"iconfont icon-zhinengti"}),d.jsx("span",{className:"rte-agent-text",children:"智能体"})]})})]})}),d.jsx("button",{type:"button",onClick:ee,disabled:u||l||r||!B,className:"rich-text-editor-send-button",children:u||r?d.jsx("span",{className:"rte-send-spinner"}):d.jsx("i",{className:"iconfont icon-fasong"})})]}),b?.anchorEl&&(()=>{if(!document.body.contains(b.anchorEl))return null;let a="";return b.type==="upload"?a=t.find(y=>y.type==="upload"&&y.key===b.key)?.tooltip||"":b.type==="tag"?a=b.anchorEl.dataset.tooltip||"":b.type==="upload-label"?a=b.anchorEl.dataset.fileName||"":b.type==="variable"&&(a=b.anchorEl.dataset.tooltip||""),Me.createPortal(d.jsx(G.Tooltip,{arrow:!1,title:d.jsx("div",{style:{maxWidth:"200px",fontSize:"12px",color:"#fff"},children:a}),open:!0,placement:"top",getPopupContainer:()=>document.body,overlayInnerStyle:{background:"var(--neutral-800, #262626)"},children:d.jsx("div",{style:{position:"fixed",left:`${b.anchorEl.getBoundingClientRect().left}px`,top:`${b.anchorEl.getBoundingClientRect().top}px`,width:`${b.anchorEl.offsetWidth}px`,height:`${b.anchorEl.offsetHeight}px`,pointerEvents:"none"}})}),document.body)})()]})};Le.__docgenInfo={displayName:"RichTextEditor",description:"结构化富文本输入组件,支持标签、变量输入块、文件上传以及互斥显示逻辑。",props:{config:{name:"config",required:!0,description:"结构化输入配置节点数组",type:{name:"InputNode[]",raw:"InputNode[]"}},onSend:{name:"onSend",required:!0,description:"点击发送按钮时的回调,返回数据与拼接后的 Prompt",type:{name:"function",raw:"(data: Record<string, any>, fullPrompt: string) => void"}},isProcessing:{name:"isProcessing",required:!1,description:"是否处于处理状态(禁用输入与发送)",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"false"}}}};const Ve=({texts:t=[],placeholder:f="请输入内容",animationSpeed:u=100,autoPlay:l=!0,value:i,onChange:m,...C})=>{const[h,e]=s.useState(""),[r,N]=s.useState(0),[p,S]=s.useState(!1),[n,A]=s.useState(!1),[v,g]=s.useState(!1),w=s.useRef(void 0),I=s.useRef(void 0),b=s.useRef(t),T=s.useRef(r),E=s.useRef(n),q=s.useRef(h);s.useEffect(()=>{b.current=t,T.current=r,E.current=n,q.current=h});const B=s.useCallback((k,L)=>{let U=0;g(!0);const J=()=>{U<k.length?(e(k.slice(0,U+1)),U++,I.current=window.setTimeout(J,u)):(g(!1),L?.())};J()},[u]),D=s.useCallback(k=>{let L=q.current.length;const U=()=>{L>0?(e(q.current.slice(0,L-1)),L--,I.current=window.setTimeout(U,u/2)):k?.()};U()},[u]),P=s.useCallback(()=>{if(b.current.length===0||E.current)return;S(!0);const k=b.current[T.current];q.current?D(()=>{B(k,()=>{w.current=window.setTimeout(()=>{N(L=>(L+1)%b.current.length),S(!1)},2e3)})}):B(k,()=>{w.current=window.setTimeout(()=>{N(L=>(L+1)%b.current.length),S(!1)},2e3)})},[D,B]);s.useEffect(()=>(l&&t.length>0&&!n&&P(),()=>{w.current&&window.clearTimeout(w.current),I.current&&window.clearTimeout(I.current)}),[r,n,l,t.length,P]),s.useEffect(()=>{!p&&l&&t.length>0&&!n&&P()},[r,p,l,t.length,n,P]);const K=k=>{A(!0),w.current&&window.clearTimeout(w.current),I.current&&window.clearTimeout(I.current),S(!1),g(!1),C.onFocus?.(k)},F=k=>{A(!1),!i&&t.length>0&&(e(""),N(0)),C.onBlur?.(k)},Y=k=>{m?.(k.target.value),C.onChange?.(k)},$=()=>n||i?f:h||f;return d.jsxs("div",{style:{position:"relative"},children:[d.jsx(G.Input,{...C,value:i,onChange:Y,onFocus:K,onBlur:F,placeholder:$(),style:{...C.style,position:"relative",zIndex:1}}),!n&&!i&&h&&d.jsxs("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",paddingLeft:11,paddingRight:11,color:"#bfbfbf",pointerEvents:"none",zIndex:2,fontSize:14,fontFamily:"inherit"},children:[d.jsx("span",{children:h}),v&&d.jsx("span",{style:{display:"inline-block",width:1,height:"1.2em",backgroundColor:"#1890ff",marginLeft:2,animation:"blink 1s infinite"}})]}),d.jsx("style",{children:`
|
|
23
23
|
@keyframes blink {
|
|
24
24
|
0%, 50% { opacity: 1; }
|
|
25
25
|
51%, 100% { opacity: 0; }
|
|
26
26
|
}
|
|
27
|
-
`})]})};
|
|
27
|
+
`})]})};Ve.__docgenInfo={displayName:"DynamicInput",description:"动态文案输入框组件,支持流式文字动画效果",props:{texts:{name:"texts",required:!0,description:"动态展示的文案数组",type:{name:"string[]",raw:"string[]"}},placeholder:{name:"placeholder",required:!1,description:"输入框占位符",type:{name:"string",raw:"string"},defaultValue:{value:'"请输入内容"'}},animationSpeed:{name:"animationSpeed",required:!1,description:"动画速度(毫秒)",type:{name:"number",raw:"number"},defaultValue:{value:"100"}},autoPlay:{name:"autoPlay",required:!1,description:"是否自动播放动画",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},value:{name:"value",required:!1,description:"输入框值",type:{name:"string",raw:"string"}},onChange:{name:"onChange",required:!1,description:"输入框变化回调",type:{name:"function",raw:"(value: string) => void"}}}};const Oe=({texts:t=[],placeholder:f="请输入内容",animationSpeed:u=100,autoPlay:l=!0,value:i="",onChange:m,onSubmit:C,maxLength:h=500,showCount:e=!0,submitText:r="发送",disabled:N=!1,rows:p=4,style:S,...n})=>{const[A,v]=s.useState(""),[g,w]=s.useState(0),[I,b]=s.useState(!1),[T,E]=s.useState(!1),[q,B]=s.useState(!1),[D,P]=s.useState(i||""),K=s.useRef(void 0),F=s.useRef(void 0),Y=s.useRef(t),$=s.useRef(g),k=s.useRef(T),L=s.useRef(A),U=s.useRef(null);s.useEffect(()=>{Y.current=t,$.current=g,k.current=T,L.current=A});const J=s.useCallback((a,o)=>{let y=0;B(!0);const R=()=>{y<a.length?(v(a.slice(0,y+1)),y++,F.current=window.setTimeout(R,u)):(B(!1),o?.())};R()},[u]),se=s.useCallback(a=>{let o=L.current.length;const y=()=>{o>0?(v(L.current.slice(0,o-1)),o--,F.current=window.setTimeout(y,u/2)):a?.()};y()},[u]),le=s.useCallback(()=>{if(Y.current.length===0||k.current)return;b(!0);const a=Y.current[$.current];L.current?se(()=>{J(a,()=>{K.current=window.setTimeout(()=>{w(o=>(o+1)%Y.current.length),b(!1)},2e3)})}):J(a,()=>{K.current=window.setTimeout(()=>{w(o=>(o+1)%Y.current.length),b(!1)},2e3)})},[se,J]);s.useEffect(()=>(l&&t.length>0&&!T&&le(),()=>{K.current&&window.clearTimeout(K.current),F.current&&window.clearTimeout(F.current)}),[g,T,l,t.length,le]),s.useEffect(()=>{!I&&l&&t.length>0&&!T&&le()},[g,I,l,t.length,T,le]);const c=a=>{E(!0),K.current&&window.clearTimeout(K.current),F.current&&window.clearTimeout(F.current),b(!1),B(!1),n.onFocus?.(a)},V=a=>{E(!1),!i&&t.length>0&&(v(""),w(0)),n.onBlur?.(a)},z=a=>{const o=a.target.value;h&&o.length>h||(m?m(o):P(o),n.onChange?.(a))},Q=()=>{const a=m?i:D;a.trim()&&!N&&(C?.(a),m||P(""))},oe=a=>{(a.ctrlKey||a.metaKey)&&a.key==="Enter"&&(a.preventDefault(),Q()),n.onKeyDown?.(a)},ee=m?i:D,de=N||!ee.trim()||(h?ee.length>h:!1);return d.jsxs("div",{style:{position:"relative",...S},children:[d.jsxs("div",{style:{position:"relative"},children:[d.jsx("textarea",{ref:U,value:m?i:D,onChange:z,onFocus:a=>{a.target.style.borderColor="#1890ff",a.target.style.boxShadow="0 0 0 2px rgba(24, 144, 255, 0.2)",c(a)},onBlur:a=>{a.target.style.borderColor="#d9d9d9",a.target.style.boxShadow="none",V(a)},onKeyDown:oe,placeholder:T||ee?f:"",maxLength:h,rows:p,disabled:N,style:{width:"100%",minHeight:`${p*24+16}px`,padding:"8px 60px 8px 12px",border:"1px solid #d9d9d9",borderRadius:"6px",fontSize:"14px",lineHeight:"1.5",fontFamily:"inherit",resize:"vertical",outline:"none",transition:"border-color 0.3s, box-shadow 0.3s",backgroundColor:"#fff",...n.style},...n}),!T&&!ee&&A&&d.jsxs("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"flex-start",paddingTop:8,paddingLeft:12,paddingRight:12,color:"#bfbfbf",pointerEvents:"none",zIndex:2,fontSize:14,fontFamily:"inherit",lineHeight:"1.5"},children:[d.jsx("span",{children:A}),q&&d.jsx("span",{style:{display:"inline-block",width:1,height:"1.2em",backgroundColor:"#1890ff",marginLeft:2,animation:"blink 1s infinite"}})]}),d.jsx("div",{style:{position:"absolute",bottom:8,right:8,zIndex:3},children:d.jsx(G.Button,{type:"primary",size:"small",icon:d.jsx(ue.SendOutlined,{}),onClick:Q,disabled:de,style:{borderRadius:6,minWidth:32,height:32,display:"flex",alignItems:"center",justifyContent:"center"},children:r})})]}),e&&d.jsxs("div",{style:{marginTop:4,textAlign:"right",fontSize:"12px",color:"#999"},children:[ee.length,"/",h]}),d.jsx("style",{children:`
|
|
28
28
|
@keyframes blink {
|
|
29
29
|
0%, 50% { opacity: 1; }
|
|
30
30
|
51%, 100% { opacity: 0; }
|
|
31
31
|
}
|
|
32
|
-
`})]})};
|
|
32
|
+
`})]})};Oe.__docgenInfo={displayName:"DynamicTextArea",description:"动态文案文本域组件,支持流式文字动画效果",props:{texts:{name:"texts",required:!0,description:"动态展示的文案数组",type:{name:"string[]",raw:"string[]"}},placeholder:{name:"placeholder",required:!1,description:"输入框占位符",type:{name:"string",raw:"string"},defaultValue:{value:'"请输入内容"'}},animationSpeed:{name:"animationSpeed",required:!1,description:"动画速度(毫秒)",type:{name:"number",raw:"number"},defaultValue:{value:"100"}},autoPlay:{name:"autoPlay",required:!1,description:"是否自动播放动画",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},value:{name:"value",required:!1,description:"输入框值",type:{name:"string",raw:"string"}},onChange:{name:"onChange",required:!1,description:"输入框变化回调",type:{name:"function",raw:"(value: string) => void"}},onSubmit:{name:"onSubmit",required:!1,description:"提交回调",type:{name:"function",raw:"(value: string) => void"}},maxLength:{name:"maxLength",required:!1,description:"最大输入字数",type:{name:"number",raw:"number"},defaultValue:{value:"500"}},showCount:{name:"showCount",required:!1,description:"是否显示字数统计",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},submitText:{name:"submitText",required:!1,description:"提交按钮文本",type:{name:"string",raw:"string"},defaultValue:{value:'"发送"'}},disabled:{name:"disabled",required:!1,description:"是否禁用提交按钮",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"false"}},rows:{name:"rows",required:!1,description:"文本域行数",type:{name:"number",raw:"number"},defaultValue:{value:"4"}}}};const ve=({src:t,poster:f,width:u=300,height:l,videoWidth:i,videoHeight:m,showPlayButton:C=!0,autoPlayOnHover:h=!0,onClick:e,onVideoLoaded:r,onVideoPlay:N,onVideoPause:p,onVideoEnded:S,className:n,style:A,...v})=>{const g=s.useRef(null),[w,I]=s.useState(!1),[b,T]=s.useState(!1),[E,q]=s.useState(!1),B=s.useCallback(()=>{g.current&&(g.current.play(),I(!0),N?.())},[N]),D=s.useCallback(()=>{g.current&&(g.current.pause(),I(!1),p?.())},[p]),P=s.useCallback(J=>{J.stopPropagation(),w?D():B()},[w,B,D]),K=s.useCallback(()=>{T(!0),h&&!w&&B()},[h,w,B]),F=s.useCallback(()=>{T(!1),h&&w&&D()},[h,w,D]),Y=s.useCallback(()=>{q(!0),r?.()},[r]),$=s.useCallback(()=>{I(!0),N?.()},[N]),k=s.useCallback(()=>{I(!1),p?.()},[p]),L=s.useCallback(()=>{I(!1),S?.()},[S]),U=s.useCallback(J=>{e?.(J)},[e]);return d.jsx(G.Card,{...v,className:`video-card ${n||""}`,style:{width:u,height:l,padding:0,overflow:"hidden",cursor:e?"pointer":"default",border:"none",borderRadius:0,...A},bordered:!1,onMouseEnter:K,onMouseLeave:F,onClick:U,children:d.jsxs("div",{className:"video-card-container",children:[d.jsx("video",{ref:g,src:t,poster:f,preload:"metadata",onLoadedData:Y,onPlay:$,onPause:k,onEnded:L,muted:!0,loop:!0}),C&&d.jsx("div",{className:`video-play-button ${b?"hovered":""}`,onClick:P,children:w?d.jsx(ue.PauseCircleOutlined,{className:"play-icon"}):d.jsx(ue.PlayCircleOutlined,{className:"play-icon"})}),!E&&d.jsx("div",{className:"video-loading-mask",children:d.jsx("div",{className:"loading-spinner"})})]})})};ve.__docgenInfo={displayName:"VideoCard",description:"视频卡片组件,支持鼠标悬浮播放控制",props:{src:{name:"src",required:!0,description:"视频源地址",type:{name:"string",raw:"string"}},poster:{name:"poster",required:!1,description:"视频海报图片",type:{name:"string",raw:"string"}},width:{name:"width",required:!1,description:"卡片宽度",type:{name:"number | string",raw:"number | string"},defaultValue:{value:"300"}},height:{name:"height",required:!1,description:"卡片高度",type:{name:"number | string",raw:"number | string"}},videoWidth:{name:"videoWidth",required:!1,description:"视频宽度",type:{name:"number | string",raw:"number | string"},defaultValue:{value:'"100%"'}},videoHeight:{name:"videoHeight",required:!1,description:"视频高度",type:{name:"number | string",raw:"number | string"},defaultValue:{value:'"100%"'}},showPlayButton:{name:"showPlayButton",required:!1,description:"是否显示播放按钮",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},autoPlayOnHover:{name:"autoPlayOnHover",required:!1,description:"是否自动播放(鼠标悬浮时)",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},onClick:{name:"onClick",required:!1,description:"点击事件",type:{name:"function",raw:"(event: React.MouseEvent<HTMLDivElement>) => void"}},onVideoLoaded:{name:"onVideoLoaded",required:!1,description:"视频加载完成事件",type:{name:"function",raw:"() => void"}},onVideoPlay:{name:"onVideoPlay",required:!1,description:"视频播放事件",type:{name:"function",raw:"() => void"}},onVideoPause:{name:"onVideoPause",required:!1,description:"视频暂停事件",type:{name:"function",raw:"() => void"}},onVideoEnded:{name:"onVideoEnded",required:!1,description:"视频结束事件",type:{name:"function",raw:"() => void"}},className:{name:"className",required:!1,description:"自定义样式类名",type:{name:"string",raw:"string"}},style:{name:"style",required:!1,description:"自定义样式",type:{name:"CSSProperties",raw:"React.CSSProperties"}}}};const Qe=t=>[".mp4",".webm",".ogg",".mov",".avi",".wmv",".flv",".mkv"].some(u=>t.toLowerCase().includes(u)),Ze=t=>t.type?t.type:Qe(t.url)?"video":"image",qe=({items:t,columns:f,gap:u=0,responsive:l=!0,breakpoints:i={xs:1,sm:2,md:3,lg:4,xl:5,xxl:6},className:m,style:C,onClick:h})=>{const e=s.useRef(null),[r,N]=s.useState(f||i.md||3),p=s.useRef(new Map),S=s.useCallback(()=>{if(!l||f)return f||i.md||3;const g=window.innerWidth;return g<576?i.xs||1:g<768?i.sm||2:g<992?i.md||3:g<1200?i.lg||4:g<1600?i.xl||5:i.xxl||6},[l,f,i]),n=s.useCallback(()=>{if(!e.current)return;const g=r,w=e.current,b=(w.offsetWidth-u*(g-1))/g,T=new Array(g).fill(0);t.forEach((q,B)=>{const D=q.id||B,P=p.current.get(D);if(!P)return;const K=Math.min(...T),F=T.indexOf(K),Y=F*(b+u),$=T[F];P.style.position="absolute",P.style.left=`${Y}px`,P.style.top=`${$}px`,P.style.width=`${b}px`,T[F]+=P.offsetHeight+u});const E=Math.max(...T);w.style.height=`${E}px`},[t,r,u]);s.useEffect(()=>{const g=()=>{const w=S();w!==r&&N(w)};if(l)return window.addEventListener("resize",g),g(),()=>window.removeEventListener("resize",g)},[l,S,r]),s.useEffect(()=>{const g=setTimeout(()=>{n()},100);return()=>clearTimeout(g)},[t,r,n]);const A=s.useCallback(()=>{n()},[n]),v=s.useCallback(g=>{h&&h(g),g.onClick?.(g)},[h]);return d.jsx("div",{ref:e,className:`waterfall-container ${m||""}`,style:{position:"relative",width:"100%",...C},children:t.map((g,w)=>{const I=g.id||w,b=Ze(g);return d.jsx("div",{ref:T=>{T?p.current.set(I,T):p.current.delete(I)},className:"waterfall-item",children:b==="video"?d.jsx("div",{style:{width:"100%",position:"relative",paddingBottom:"56.25%",cursor:h||g.onClick?"pointer":"default"},children:d.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%"},children:d.jsx(ve,{src:g.url,poster:g.poster,width:"100%",height:"100%",onClick:()=>v(g),onVideoLoaded:A,autoPlayOnHover:!0,showPlayButton:!1})})}):d.jsx("div",{className:"waterfall-image-wrapper",onClick:()=>v(g),style:{cursor:h||g.onClick?"pointer":"default"},children:d.jsx("img",{src:g.url,alt:`瀑布流图片 ${w+1}`,className:"waterfall-image",onLoad:A,onError:A,style:{display:"block",width:"100%",height:"auto"}})})},I)})})};qe.__docgenInfo={displayName:"Waterfall",description:"瀑布流布局组件,支持图片和视频混合展示",props:{items:{name:"items",required:!0,description:"媒体资源数组",type:{name:"WaterfallItem[]",raw:"WaterfallItem[]"}},columns:{name:"columns",required:!1,description:"列数(默认会根据屏幕宽度自动响应)",type:{name:"number",raw:"number"}},gap:{name:"gap",required:!1,description:"间隔大小",type:{name:"number",raw:"number"},defaultValue:{value:"0"}},responsive:{name:"responsive",required:!1,description:"是否启用响应式布局",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},breakpoints:{name:"breakpoints",required:!1,description:"响应式断点配置",type:{name:"object",raw:"{ xs?: number; sm?: number; md?: number; lg?: number; xl?: number; xxl?: number; }"}},className:{name:"className",required:!1,description:"自定义类名",type:{name:"string",raw:"string"}},style:{name:"style",required:!1,description:"自定义样式",type:{name:"CSSProperties",raw:"React.CSSProperties"}},onClick:{name:"onClick",required:!1,description:"点击回调",type:{name:"function",raw:"(item: any) => void"}}}};const $e={algorithm:G.theme.defaultAlgorithm,token:{colorPrimary:"#3b82f6",colorSuccess:"#10b981",colorWarning:"#f59e0b",colorError:"#ef4444",colorInfo:"#3b82f6",colorBgBase:"#ffffff",colorBgContainer:"#ffffff",colorBgElevated:"#ffffff",colorBgLayout:"#f8fafc",colorTextBase:"#1e293b",colorText:"#1e293b",colorTextSecondary:"#64748b",colorTextTertiary:"#94a3b8",colorTextQuaternary:"#cbd5e1",colorBorder:"#e2e8f0",colorBorderSecondary:"#f1f5f9",boxShadow:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)",boxShadowSecondary:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",borderRadius:8,borderRadiusLG:12,borderRadiusSM:6,fontFamily:"Inter, system-ui, Arial, sans-serif",fontSize:14,fontSizeLG:16,fontSizeSM:12,padding:16,paddingLG:24,paddingSM:12,paddingXS:8,controlHeight:32,controlHeightLG:40,controlHeightSM:24},components:{Button:{borderRadius:8,controlHeight:32,fontWeight:500},Card:{borderRadiusLG:12,boxShadow:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)"},Input:{borderRadius:8,controlHeight:32},Table:{borderRadiusLG:8,headerBg:"#f8fafc",headerColor:"#374151"}}};X.AdvancedTable=je,X.AppModal=Ne,X.BackButton=Ie,X.Button=Te,X.Card=Ce,X.DynamicInput=Ve,X.DynamicTextArea=Oe,X.EmptyAndSpin=Ae,X.LinkButton=_e,X.PageTable=Se,X.RichTextEditor=Le,X.VideoCard=ve,X.Waterfall=qe,X.XcIcon=Re,X.lightTheme=$e,Object.defineProperty(X,Symbol.toStringTag,{value:"Module"})});
|
|
33
33
|
//# sourceMappingURL=index.umd.js.map
|