bi-sdk-react 0.0.39 → 0.0.41
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/es/js/bi-sdk.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*! For license information please see bi-sdk.es.js.LICENSE.txt */
|
|
2
|
-
import*as e from"react";import t,{css as l}from"styled-components";import{AlignCenterOutlined as n,AlignLeftOutlined as r,AlignRightOutlined as a,AudioOutlined as i,CaretDownOutlined as o,CloseOutlined as s,CopyOutlined as d,DeleteOutlined as c,DesktopOutlined as u,EditOutlined as p,EyeInvisibleOutlined as x,EyeOutlined as m,FileExcelOutlined as h,HistoryOutlined as f,ImportOutlined as g,InboxOutlined as v,InfoCircleOutlined as j,MessageOutlined as b,MinusSquareOutlined as y,MobileOutlined as w,PlusOutlined as C,PlusSquareOutlined as S,RedoOutlined as k,RobotOutlined as z,SaveOutlined as I,SelectOutlined as N,SendOutlined as O,TabletOutlined as A,UndoOutlined as T,UploadOutlined as D,ZoomInOutlined as E,ZoomOutOutlined as B,createFromIconfontCN as R}from"@ant-design/icons";import{Avatar as L,Button as P,Card as M,Checkbox as _,Col as $,ColorPicker as F,DatePicker as Y,Divider as H,Drawer as G,Dropdown as J,Form as K,Input as W,InputNumber as U,Modal as q,Pagination as X,Popconfirm as V,Popover as Q,Radio as Z,Row as ee,Select as et,Skeleton as el,Space as en,Switch as er,Table as ea,Tag as ei,TimePicker as eo,Tooltip as es,Tree as ed,Typography as ec,Upload as eu,message as ep}from"antd";import ex from"react-dom";import em,{Editor as eh}from"@monaco-editor/react";import{v4 as ef}from"uuid";import eg from"dayjs";import*as ev from"echarts";var ej={290(e,t,l){var n=this&&this.__assign||function(){return(n=Object.assign||function(e){for(var t,l=1,n=arguments.length;l<n;l++)for(var r in t=arguments[l])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.bindAll=void 0;var r=l(352);function a(e){if(void 0!==e)return"boolean"==typeof e?{capture:e}:e}t.bindAll=function(e,t,l){var i=t.map(function(t){var i=null==l?t:n(n({},t),{options:n(n({},a(l)),a(t.options))});return(0,r.bind)(e,i)});return function(){i.forEach(function(e){return e()})}}},352(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.bind=void 0,t.bind=function(e,t){var l=t.type,n=t.listener,r=t.options;return e.addEventListener(l,n,r),function(){e.removeEventListener(l,n,r)}}},951(e,t,l){t.bindAll=t.bind=void 0;var n=l(352);Object.defineProperty(t,"bind",{enumerable:!0,get:function(){return n.bind}});var r=l(290);Object.defineProperty(t,"bindAll",{enumerable:!0,get:function(){return r.bindAll}})},965(e,t,l){var n=l(426),r={"text/plain":"Text","text/html":"Url",default:"Text"};e.exports=function(e,t){var l,a,i,o,s,d,c,u,p=!1;t||(t={}),i=t.debug||!1;try{if(s=n(),d=document.createRange(),c=document.getSelection(),(u=document.createElement("span")).textContent=e,u.ariaHidden="true",u.style.all="unset",u.style.position="fixed",u.style.top=0,u.style.clip="rect(0, 0, 0, 0)",u.style.whiteSpace="pre",u.style.webkitUserSelect="text",u.style.MozUserSelect="text",u.style.msUserSelect="text",u.style.userSelect="text",u.addEventListener("copy",function(l){if(l.stopPropagation(),t.format)if(l.preventDefault(),void 0===l.clipboardData){i&&console.warn("unable to use e.clipboardData"),i&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var n=r[t.format]||r.default;window.clipboardData.setData(n,e)}else l.clipboardData.clearData(),l.clipboardData.setData(t.format,e);t.onCopy&&(l.preventDefault(),t.onCopy(l.clipboardData))}),document.body.appendChild(u),d.selectNodeContents(u),c.addRange(d),!document.execCommand("copy"))throw Error("copy command was unsuccessful");p=!0}catch(n){i&&console.error("unable to copy using execCommand: ",n),i&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),p=!0}catch(n){i&&console.error("unable to copy using clipboardData: ",n),i&&console.error("falling back to prompt"),l="message"in t?t.message:"Copy to clipboard: #{key}, Enter",a=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C",o=l.replace(/#{\s*key\s*}/g,a),window.prompt(o,e)}}finally{c&&("function"==typeof c.removeRange?c.removeRange(d):c.removeAllRanges()),u&&document.body.removeChild(u),s()}return p}},20(e,t,l){var n=l(649),r=Symbol.for("react.element"),a=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,o=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function d(e,t,l){var n,a={},d=null,c=null;for(n in void 0!==l&&(d=""+l),void 0!==t.key&&(d=""+t.key),void 0!==t.ref&&(c=t.ref),t)i.call(t,n)&&!s.hasOwnProperty(n)&&(a[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps)void 0===a[n]&&(a[n]=t[n]);return{$$typeof:r,type:e,key:d,ref:c,props:a,_owner:o.current}}t.Fragment=a,t.jsx=d,t.jsxs=d},848(e,t,l){e.exports=l(20)},426(e){e.exports=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,l=[],n=0;n<e.rangeCount;n++)l.push(e.getRangeAt(n));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null}return e.removeAllRanges(),function(){"Caret"===e.type&&e.removeAllRanges(),e.rangeCount||l.forEach(function(t){e.addRange(t)}),t&&t.focus()}}},649(t){t.exports=e}},eb={};function ey(e){var t=eb[e];if(void 0!==t)return t.exports;var l=eb[e]={exports:{}};return ej[e].call(l.exports,l,l.exports,ey),l.exports}ey.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return ey.d(t,{a:t}),t},ey.d=(e,t)=>{for(var l in t)ey.o(t,l)&&!ey.o(e,l)&&Object.defineProperty(e,l,{enumerable:!0,get:t[l]})},ey.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),ey.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var ew={};(()=>{ey.d(ew,{NG:()=>eN.PropEditorProps,Nx:()=>ly,Ei:()=>tk,QE:()=>eI.PluginType,Ts:()=>eD,ps:()=>lu,V2:()=>eI.PageSchema,B7:()=>lo,NQ:()=>eT,ru:()=>tw});var e,ej,eb,eC,eS,ek,ez,eI={};ey.r(eI),ey.d(eI,{P:()=>ls});var eN={};ey.r(eN);var eO=ey(848),eA=ey(649);let eT=(0,eA.createContext)({pageId:"",designable:!1,plugins:[],schema:{info:{},datasources:[],scripts:[],variables:[],items:[]},selectedItem:null,atItems:null,setSchema:()=>{},setSelectedItem:()=>{},updateSelectedItem:()=>{},forceUpdate:()=>{},onAddAtItem:()=>{},onRemoveAtItem:()=>{},clearAtItems:()=>{},datasetSelector:void 0,datasetAdd:void 0,fetch:void 0,deviceWidth:0,setDeviceWidth:()=>{},initCallback:()=>{},handleCallback:()=>{},getVars:()=>({}),setVar:()=>{}}),eD=e=>{let{pageId:t,designable:l,plugins:n,schema:r,selectedItem:a,setSchema:i,setSelectedItem:o,datasetSelector:s,datasetAdd:d,fetch:c,children:u}=e,[p,x]=(0,eA.useState)(0),[m,h]=(0,eA.useState)([]),[f,g]=(0,eA.useState)({global:{},local:{}}),[v,j]=(0,eA.useState)({}),b=e=>({...f.global,...f.local[e||""]||{}});return(0,eA.useEffect)(()=>{let e={};(r.variables||[]).forEach(t=>{e[t.name]=t.value}),g(t=>({...t,global:e}))},[r.variables]),(0,eO.jsx)(eT.Provider,{value:{pageId:t,designable:!!l,plugins:n||[],schema:r,selectedItem:a,atItems:m,setSchema:i||(()=>{}),setSelectedItem:o||(()=>{}),updateSelectedItem:e=>{null==o||o(Object.assign(a,e||{})),null==i||i({...r})},datasetSelector:s,datasetAdd:d,fetch:c,forceUpdate:()=>{null==i||i({...r})},onAddAtItem:e=>{null!=m&&m.includes(e)||h([...m,e])},onRemoveAtItem:e=>{h(m.filter(t=>t!==e))},clearAtItems:()=>{h([])},deviceWidth:p,setDeviceWidth:x||(()=>{}),initCallback:e=>{let{id:t,callback:l}=e;j(e=>({...e,[t]:l}))},handleCallback:(e,t,l)=>{(e.cascadeIds||[]).forEach(e=>{let n=v[e];if("function"==typeof n){let r=n(t,b(e));if(r){let{target:e,data:t}=r;null==l||l(e,t)}}})},getVars:b,setVar:(e,t,l)=>{let n={...f};(e.cascadeIds||[]).forEach(e=>{n.local[e]=n.local[e]||{},n.local[e][t]=l})}},children:u})};function eE(e,t){(null==t||t>e.length)&&(t=e.length);for(var l=0,n=Array(t);l<t;l++)n[l]=e[l];return n}function eB(e,t){if(e){if("string"==typeof e)return eE(e,t);var l=({}).toString.call(e).slice(8,-1);return"Object"===l&&e.constructor&&(l=e.constructor.name),"Map"===l||"Set"===l?Array.from(e):"Arguments"===l||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(l)?eE(e,t):void 0}}function eR(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var l=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=l){var n,r,a,i,o=[],s=!0,d=!1;try{if(a=(l=l.call(e)).next,0===t){if(Object(l)!==l)return;s=!1}else for(;!(s=(n=a.call(l)).done)&&(o.push(n.value),o.length!==t);s=!0);}catch(e){d=!0,r=e}finally{try{if(!s&&null!=l.return&&(i=l.return(),Object(i)!==i))return}finally{if(d)throw r}}return o}}(e,t)||eB(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var eL=ey(951),eP="data-pdnd-honey-pot";function eM(e){return e instanceof Element&&e.hasAttribute(eP)}function e_(e){var t=eR(document.elementsFromPoint(e.x,e.y),2),l=t[0],n=t[1];return l?eM(l)?null!=n?n:null:l:null}function e$(e){return(e$="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function eF(e,t,l){var n;return(n=function(e,t){if("object"!=e$(e)||!e)return e;var l=e[Symbol.toPrimitive];if(void 0!==l){var n=l.call(e,t||"default");if("object"!=e$(n))return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==e$(n)?n:n+"")in e)?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}function eY(e,t){var l=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),l.push.apply(l,n)}return l}function eH(e){for(var t=1;t<arguments.length;t++){var l=null!=arguments[t]?arguments[t]:{};t%2?eY(Object(l),!0).forEach(function(t){eF(e,t,l[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(l)):eY(Object(l)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(l,t))})}return e}function eG(e){var t,l,n,r,a={x:Math.min((r={x:Math.max((n={x:(l={x:Math.floor((t=e.client).x),y:Math.floor(t.y)}).x-1,y:l.y-1}).x,0),y:Math.max(n.y,0)}).x,window.innerWidth-2),y:Math.min(r.y,window.innerHeight-2)};return DOMRect.fromRect({x:a.x,y:a.y,width:2,height:2})}function eJ(e){var t=e.clientRect;return{left:"".concat(t.left,"px"),top:"".concat(t.top,"px"),width:"".concat(t.width,"px"),height:"".concat(t.height,"px")}}function eK(e){return function(e){if(Array.isArray(e))return eE(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||eB(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function eW(e){var t=null;return function(){if(!t){for(var l=arguments.length,n=Array(l),r=0;r<l;r++)n[r]=arguments[r];t={result:e.apply(this,n)}}return t.result}}var eU=eW(function(){return navigator.userAgent.includes("Firefox")}),eq=eW(function(){var e=navigator.userAgent;return e.includes("AppleWebKit")&&!e.includes("Chrome")}),eX={isLeavingWindow:Symbol("leaving"),isEnteringWindow:Symbol("entering")};if("undefined"!=typeof window&&eq()){var eV=eQ();(0,eL.bindAll)(window,[{type:"dragstart",listener:function(){eV.enterCount=0,eV.isOverWindow=!0}},{type:"drop",listener:eZ},{type:"dragend",listener:eZ},{type:"dragenter",listener:function(e){eV.isOverWindow||0!==eV.enterCount||(e[eX.isEnteringWindow]=!0),eV.isOverWindow=!0,eV.enterCount++}},{type:"dragleave",listener:function(e){eV.enterCount--,eV.isOverWindow&&0===eV.enterCount&&(e[eX.isLeavingWindow]=!0,eV.isOverWindow=!1)}}],{capture:!0})}function eQ(){return{enterCount:0,isOverWindow:!1}}function eZ(){eV=eQ()}function e0(e){return{altKey:e.altKey,button:e.button,buttons:e.buttons,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey,clientX:e.clientX,clientY:e.clientY,pageX:e.pageX,pageY:e.pageY}}var e1=(e=function(e){return e()},ej=[],eb=null,(eC=function(){for(var t=arguments.length,l=Array(t),n=0;n<t;n++)l[n]=arguments[n];ej=l,eb||(eb=requestAnimationFrame(function(){eb=null,e.apply(void 0,ej)}))}).cancel=function(){eb&&(cancelAnimationFrame(eb),eb=null)},eC),e2=(eS=null,{schedule:function(e){eS={frameId:requestAnimationFrame(function(){eS=null,e()}),fn:e}},flush:function(){eS&&(cancelAnimationFrame(eS.frameId),eS.fn(),eS=null)}}),e4={isActive:!1};function e8(){return!e4.isActive}function e6(e){var t,l=e.event,n=null==(t=e.current[0])?void 0:t.dropEffect;null!=n&&l.dataTransfer&&(l.dataTransfer.dropEffect=n)}var e5=function(e){var t=e.event,l=e.dragType,n=e.getDropTargetsOver,r=e.dispatchEvent;if(e8()){var a,i,o=function(e){var t=e.event,l=e.dragType,n=e.getDropTargetsOver,r=e0(t);if("external"===l.startedFrom)return{input:r,dropTargets:[]};var a=n({input:r,source:l.payload,target:t.target,current:[]});return{input:r,dropTargets:a}}({event:t,dragType:l,getDropTargetsOver:n});e4.isActive=!0;var s={current:o};e6({event:t,current:o.dropTargets});var d=function(e){var t=e.source,l=e.initial,n=e.dispatchEvent,r={dropTargets:[]};function a(e){n(e),r={dropTargets:e.payload.location.current.dropTargets}}return{start:function(e){var n=e.nativeSetDragImage,i={current:l,previous:r,initial:l};a({eventName:"onGenerateDragPreview",payload:{source:t,location:i,nativeSetDragImage:n}}),e2.schedule(function(){a({eventName:"onDragStart",payload:{source:t,location:i}})})},dragUpdate:function(e){var n=e.current;e2.flush(),e1.cancel(),a({eventName:"onDropTargetChange",payload:{source:t,location:{initial:l,previous:r,current:n}}})},drag:function(e){var n=e.current;e1(function(){e2.flush(),a({eventName:"onDrag",payload:{source:t,location:{initial:l,previous:r,current:n}}})})},drop:function(e){var n=e.current,i=e.updatedSourcePayload;e2.flush(),e1.cancel(),a({eventName:"onDrop",payload:{source:null!=i?i:t,location:{current:n,previous:r,initial:l}}})}}}({source:l.payload,dispatchEvent:r,initial:o}),c=(0,eL.bindAll)(window,[{type:"dragover",listener:function(e){p(e),d.drag({current:s.current})}},{type:"dragenter",listener:p},{type:"dragleave",listener:function(e){(function(e){var t=e.dragLeave,l=t.type,n=t.relatedTarget;return"dragleave"===l&&(eq()?!!eq()&&t.hasOwnProperty(eX.isLeavingWindow):null==n||(eU()?"nodeName"in n&&n.ownerDocument!==document:n instanceof HTMLIFrameElement))})({dragLeave:e})&&(u({input:s.current.input,dropTargets:[]}),"external"===l.startedFrom&&x())}},{type:"drop",listener:function(e){(s.current={dropTargets:s.current.dropTargets,input:e0(e)},s.current.dropTargets.length)?(e.preventDefault(),e6({event:e,current:s.current.dropTargets}),d.drop({current:s.current,updatedSourcePayload:"external"===l.type?l.getDropPayload(e):null}),m()):x()}},{type:"dragend",listener:function(e){s.current={dropTargets:s.current.dropTargets,input:e0(e)},x()}}].concat(eK([{type:"pointermove",listener:(i=0,function(){i<20?i++:a()})},{type:"pointerdown",listener:a=x}])),{capture:!0});d.start({nativeSetDragImage:t.dataTransfer?t.dataTransfer.setDragImage.bind(t.dataTransfer):null})}function u(e){var t=function(e){var t=e.current,l=e.next;if(t.length!==l.length)return!0;for(var n=0;n<t.length;n++)if(t[n].element!==l[n].element)return!0;return!1}({current:s.current.dropTargets,next:e.dropTargets});s.current=e,t&&d.dragUpdate({current:s.current})}function p(e){var t=e0(e),r=n({target:eM(e.target)?e_({x:t.clientX,y:t.clientY}):e.target,input:t,source:l.payload,current:s.current.dropTargets});r.length&&(e.preventDefault(),e6({event:e,current:r})),u({dropTargets:r,input:t})}function x(){s.current.dropTargets.length&&u({dropTargets:[],input:s.current.input}),d.drop({current:s.current,updatedSourcePayload:null}),m()}function m(){e4.isActive=!1,c()}},e9=new Map;function e3(){for(var e=arguments.length,t=Array(e),l=0;l<e;l++)t[l]=arguments[l];return function(){t.forEach(function(e){return e()})}}function e7(e,t){var l=t.attribute,n=t.value;return e.setAttribute(l,n),function(){return e.removeAttribute(l)}}function te(e,t){var l=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),l.push.apply(l,n)}return l}function tt(e){for(var t=1;t<arguments.length;t++){var l=null!=arguments[t]?arguments[t]:{};t%2?te(Object(l),!0).forEach(function(t){eF(e,t,l[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(l)):te(Object(l)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(l,t))})}return e}function tl(e,t){var l="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!l){if(Array.isArray(e)||(l=function(e,t){if(e){if("string"==typeof e)return tn(e,void 0);var l=({}).toString.call(e).slice(8,-1);return"Object"===l&&e.constructor&&(l=e.constructor.name),"Map"===l||"Set"===l?Array.from(e):"Arguments"===l||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(l)?tn(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){l&&(e=l);var n=0,r=function(){};return{s:r,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:r}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,o=!1;return{s:function(){l=l.call(e)},n:function(){var e=l.next();return i=e.done,e},e:function(e){o=!0,a=e},f:function(){try{i||null==l.return||l.return()}finally{if(o)throw a}}}}function tn(e,t){(null==t||t>e.length)&&(t=e.length);for(var l=0,n=Array(t);l<t;l++)n[l]=e[l];return n}function tr(e){return e.slice(0).reverse()}function ta(e,t){(null==t||t>e.length)&&(t=e.length);for(var l=0,n=Array(t);l<t;l++)n[l]=e[l];return n}function ti(e,t){var l=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),l.push.apply(l,n)}return l}var to=eW(function(){return navigator.userAgent.toLocaleLowerCase().includes("android")}),ts="text/plain",td=new WeakMap,tc=(ek=null,{bindEvents:function(){return ek=null,(0,eL.bind)(window,{type:"pointermove",listener:function(e){ek={x:e.clientX,y:e.clientY}},options:{capture:!0}})},getOnPostDispatch:function(){var e=null;return function(t){var l=t.eventName,n=t.payload;if("onDragStart"===l){var r,a,i,o=n.location.initial.input,s=null!=ek?ek:{x:o.clientX,y:o.clientY};(r=document.createElement("div")).setAttribute(eP,"true"),a=eG({client:s}),Object.assign(r.style,eH(eH({backgroundColor:"transparent",position:"fixed",padding:0,margin:0,boxSizing:"border-box"},eJ({clientRect:a})),{},{pointerEvents:"auto",zIndex:0x7fffffff})),document.body.appendChild(r),i=(0,eL.bind)(window,{type:"pointermove",listener:function(e){a=eG({client:{x:e.clientX,y:e.clientY}}),Object.assign(r.style,eJ({clientRect:a}))},options:{capture:!0}}),e=function(e){var t,l,n,o=e.current;if(i(),l=(t={client:o,clientRect:a}).client,n=t.clientRect,l.x>=n.x&&l.x<=n.x+n.width&&l.y>=n.y&&l.y<=n.y+n.height)return void r.remove();function s(){d(),r.remove()}var d=(0,eL.bindAll)(window,[{type:"pointerdown",listener:s},{type:"pointermove",listener:s},{type:"focusin",listener:s},{type:"focusout",listener:s},{type:"dragstart",listener:s},{type:"dragenter",listener:s},{type:"dragover",listener:s}],{capture:!0})}}if("onDrop"===l){var d,c=n.location.current.input;null==(d=e)||d({current:{x:c.clientX,y:c.clientY}}),e=null,ek=null}}}}),tu=function(e){var t=e.typeKey,l=e.mount,n=e.dispatchEventToSource,r=e.onPostDispatch,a=e.defaultDropEffect,i=function(){var e=new Set,t=null;function l(e){t&&(!e.canMonitor||e.canMonitor(t.canMonitorArgs))&&t.active.add(e)}return{dispatchEvent:function(n){var r=n.eventName,a=n.payload;if("onGenerateDragPreview"===r){t={canMonitorArgs:{initial:a.location.initial,source:a.source},active:new Set};var i,o=function(e,t){var l="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!l){if(Array.isArray(e)||(l=function(e,t){if(e){if("string"==typeof e)return ta(e,void 0);var l=({}).toString.call(e).slice(8,-1);return"Object"===l&&e.constructor&&(l=e.constructor.name),"Map"===l||"Set"===l?Array.from(e):"Arguments"===l||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(l)?ta(e,void 0):void 0}}(e))){l&&(e=l);var n=0,r=function(){};return{s:r,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:r}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,o=!1;return{s:function(){l=l.call(e)},n:function(){var e=l.next();return i=e.done,e},e:function(e){o=!0,a=e},f:function(){try{i||null==l.return||l.return()}finally{if(o)throw a}}}}(e);try{for(o.s();!(i=o.n()).done;){var s=i.value;l(s)}}catch(e){o.e(e)}finally{o.f()}}if(t){for(var d=Array.from(t.active),c=0;c<d.length;c++){var u,p=d[c];t.active.has(p)&&(null==(u=p[r])||u.call(p,a))}"onDrop"===r&&(t.active.clear(),t=null)}},monitorForConsumers:function(n){var r=function(e){for(var t=1;t<arguments.length;t++){var l=null!=arguments[t]?arguments[t]:{};t%2?ti(Object(l),!0).forEach(function(t){eF(e,t,l[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(l)):ti(Object(l)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(l,t))})}return e}({},n);return e.add(r),l(r),eW(function(){e.delete(r),t&&t.active.delete(r)})}}}(),o=function(e){var t=e.typeKey,l=e.defaultDropEffect,n=new WeakMap,r="data-drop-target-for-".concat(t),a="[".concat(r,"]");function i(e){var t,l=e.eventName,r=e.payload,a=tl(r.location.current.dropTargets);try{for(a.s();!(t=a.n()).done;){var i,o=t.value,s=n.get(o.element),d=tt(tt({},r),{},{self:o});null==s||null==(i=s[l])||i.call(s,d)}}catch(e){a.e(e)}finally{a.f()}}var o={onGenerateDragPreview:i,onDrag:i,onDragStart:i,onDrop:i,onDropTargetChange:function(e){var t,l=e.payload,r=new Set(l.location.current.dropTargets.map(function(e){return e.element})),a=new Set,i=tl(l.location.previous.dropTargets);try{for(i.s();!(t=i.n()).done;){var o,s,d=t.value;a.add(d.element);var c=n.get(d.element),u=r.has(d.element),p=tt(tt({},l),{},{self:d});null==c||null==(o=c.onDropTargetChange)||o.call(c,p),u||null==c||null==(s=c.onDragLeave)||s.call(c,p)}}catch(e){i.e(e)}finally{i.f()}var x,m=tl(l.location.current.dropTargets);try{for(m.s();!(x=m.n()).done;){var h,f,g=x.value;if(!a.has(g.element)){var v=tt(tt({},l),{},{self:g}),j=n.get(g.element);null==j||null==(h=j.onDropTargetChange)||h.call(j,v),null==j||null==(f=j.onDragEnter)||f.call(j,v)}}}catch(e){m.e(e)}finally{m.f()}}};return{dropTargetForConsumers:function(e){return eW(e3(e7(e.element,{attribute:r,value:"true"}),(n.set(e.element,e),function(){return n.delete(e.element)})))},getIsOver:function(e){var t=e.source,r=e.target,i=e.input,o=e.current,s=function e(t){var r,i,o,s,d=t.source,c=t.target,u=t.input,p=t.result,x=void 0===p?[]:p;if(null==c)return x;if(!(c instanceof Element))return c instanceof Node?e({source:d,target:c.parentElement,input:u,result:x}):x;var m=c.closest(a);if(null==m)return x;var h=n.get(m);if(null==h)return x;var f={input:u,source:d,element:h.element};if(h.canDrop&&!h.canDrop(f))return e({source:d,target:h.element.parentElement,input:u,result:x});var g=null!=(r=null==(i=h.getData)?void 0:i.call(h,f))?r:{},v=null!=(o=null==(s=h.getDropEffect)?void 0:s.call(h,f))?o:l,j={data:g,element:h.element,dropEffect:v,isActiveDueToStickiness:!1};return e({source:d,target:h.element.parentElement,input:u,result:[].concat(eK(x),[j])})}({source:t,target:r,input:i});if(s.length>=o.length)return s;for(var d=tr(o),c=tr(s),u=[],p=0;p<d.length;p++){var x,m=d[p],h=c[p];if(null!=h){u.push(h);continue}var f=u[p-1],g=d[p-1];if((null==f?void 0:f.element)!==(null==g?void 0:g.element))break;var v=n.get(m.element);if(!v)break;var j={input:i,source:t,element:v.element};if(v.canDrop&&!v.canDrop(j)||!(null!=(x=v.getIsSticky)&&x.call(v,j)))break;u.push(tt(tt({},m),{},{isActiveDueToStickiness:!0}))}return tr(u)},dispatchEvent:function(e){o[e.eventName](e)}}}({typeKey:t,defaultDropEffect:a});function s(e){null==n||n(e),o.dispatchEvent(e),i.dispatchEvent(e),null==r||r(e)}function d(e){e5({event:e.event,dragType:e.dragType,getDropTargetsOver:o.getIsOver,dispatchEvent:s})}return{registerUsage:function(){var e,n;return n=function(e){var t=e.typeKey,l=e.mount,n=e9.get(t);if(n)return n.usageCount++,n;var r={typeKey:t,unmount:l(),usageCount:1};return e9.set(t,r),r}(e={typeKey:t,mount:function(){return l({canStart:e8,start:d})}}),function(){n.usageCount--,n.usageCount>0||(n.unmount(),e9.delete(e.typeKey))}},dropTarget:o.dropTargetForConsumers,monitor:i.monitorForConsumers}}({typeKey:"element",defaultDropEffect:"move",mount:function(e){return e3(tc.bindEvents(),(0,eL.bind)(document,{type:"dragstart",listener:function(t){if(e.canStart(t)&&!t.defaultPrevented&&t.dataTransfer){var l,n,r,a,i,o,s=t.target;if(s instanceof HTMLElement){var d=td.get(s);if(d){var c=e0(t),u={element:d.element,dragHandle:null!=(l=d.dragHandle)?l:null,input:c};if(d.canDrag&&!d.canDrag(u))return void t.preventDefault();if(d.dragHandle){var p=e_({x:c.clientX,y:c.clientY});if(!d.dragHandle.contains(p))return void t.preventDefault()}var x=null!=(n=null==(r=d.getInitialDataForExternal)?void 0:r.call(d,u))?n:null;if(x)for(var m=0,h=Object.entries(x);m<h.length;m++){var f=eR(h[m],2),g=f[0],v=f[1];t.dataTransfer.setData(g,null!=v?v:"")}!to()||t.dataTransfer.types.includes(ts)||t.dataTransfer.types.includes("text/uri-list")||t.dataTransfer.setData(ts,"pdnd:android-fallback"),t.dataTransfer.setData("application/vnd.pdnd","");var j={element:d.element,dragHandle:null!=(a=d.dragHandle)?a:null,data:null!=(i=null==(o=d.getInitialData)?void 0:o.call(d,u))?i:{}};e.start({event:t,dragType:{type:"element",payload:j,startedFrom:"internal"}})}}}}}))},dispatchEventToSource:function(e){var t,l,n=e.eventName,r=e.payload;null==(t=td.get(r.source.element))||null==(l=t[n])||l.call(t,r)},onPostDispatch:tc.getOnPostDispatch()}),tp=tu.dropTarget;function tx(e){return eW(e3(tu.registerUsage(),(td.set(e.element,e),function(){td.delete(e.element)}),e7(e.element,{attribute:"draggable",value:"true"})))}tu.monitor;let tm=R({scriptUrl:"https://at.alicdn.com/t/c/font_5072483_ufbwxczz8z.js"}),th=e=>{let{type:t,className:l="",style:n={}}=e;return(0,eO.jsx)(tm,{type:t,className:l,style:n})},tf=t.div`
|
|
2
|
+
import*as e from"react";import t,{css as l}from"styled-components";import{AlignCenterOutlined as n,AlignLeftOutlined as r,AlignRightOutlined as a,AudioOutlined as i,CaretDownOutlined as o,CloseOutlined as s,CopyOutlined as d,DeleteOutlined as c,DesktopOutlined as u,EditOutlined as p,EyeInvisibleOutlined as x,EyeOutlined as m,FileExcelOutlined as h,HistoryOutlined as f,ImportOutlined as g,InboxOutlined as v,InfoCircleOutlined as j,MessageOutlined as b,MinusSquareOutlined as y,MobileOutlined as w,PlusOutlined as C,PlusSquareOutlined as S,RedoOutlined as k,RobotOutlined as z,SaveOutlined as I,SelectOutlined as N,SendOutlined as O,TabletOutlined as A,UndoOutlined as E,UploadOutlined as T,ZoomInOutlined as D,ZoomOutOutlined as B,createFromIconfontCN as R}from"@ant-design/icons";import{Avatar as L,Button as P,Card as M,Checkbox as _,Col as $,ColorPicker as F,DatePicker as Y,Divider as H,Drawer as G,Dropdown as J,Form as K,Input as W,InputNumber as U,Modal as q,Pagination as X,Popconfirm as V,Popover as Q,Radio as Z,Row as ee,Select as et,Skeleton as el,Space as en,Switch as er,Table as ea,Tag as ei,TimePicker as eo,Tooltip as es,Tree as ed,Typography as ec,Upload as eu,message as ep}from"antd";import ex from"react-dom";import em,{Editor as eh}from"@monaco-editor/react";import{v4 as ef}from"uuid";import eg from"dayjs";import*as ev from"echarts";var ej={290(e,t,l){var n=this&&this.__assign||function(){return(n=Object.assign||function(e){for(var t,l=1,n=arguments.length;l<n;l++)for(var r in t=arguments[l])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.bindAll=void 0;var r=l(352);function a(e){if(void 0!==e)return"boolean"==typeof e?{capture:e}:e}t.bindAll=function(e,t,l){var i=t.map(function(t){var i=null==l?t:n(n({},t),{options:n(n({},a(l)),a(t.options))});return(0,r.bind)(e,i)});return function(){i.forEach(function(e){return e()})}}},352(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.bind=void 0,t.bind=function(e,t){var l=t.type,n=t.listener,r=t.options;return e.addEventListener(l,n,r),function(){e.removeEventListener(l,n,r)}}},951(e,t,l){t.bindAll=t.bind=void 0;var n=l(352);Object.defineProperty(t,"bind",{enumerable:!0,get:function(){return n.bind}});var r=l(290);Object.defineProperty(t,"bindAll",{enumerable:!0,get:function(){return r.bindAll}})},965(e,t,l){var n=l(426),r={"text/plain":"Text","text/html":"Url",default:"Text"};e.exports=function(e,t){var l,a,i,o,s,d,c,u,p=!1;t||(t={}),i=t.debug||!1;try{if(s=n(),d=document.createRange(),c=document.getSelection(),(u=document.createElement("span")).textContent=e,u.ariaHidden="true",u.style.all="unset",u.style.position="fixed",u.style.top=0,u.style.clip="rect(0, 0, 0, 0)",u.style.whiteSpace="pre",u.style.webkitUserSelect="text",u.style.MozUserSelect="text",u.style.msUserSelect="text",u.style.userSelect="text",u.addEventListener("copy",function(l){if(l.stopPropagation(),t.format)if(l.preventDefault(),void 0===l.clipboardData){i&&console.warn("unable to use e.clipboardData"),i&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var n=r[t.format]||r.default;window.clipboardData.setData(n,e)}else l.clipboardData.clearData(),l.clipboardData.setData(t.format,e);t.onCopy&&(l.preventDefault(),t.onCopy(l.clipboardData))}),document.body.appendChild(u),d.selectNodeContents(u),c.addRange(d),!document.execCommand("copy"))throw Error("copy command was unsuccessful");p=!0}catch(n){i&&console.error("unable to copy using execCommand: ",n),i&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),p=!0}catch(n){i&&console.error("unable to copy using clipboardData: ",n),i&&console.error("falling back to prompt"),l="message"in t?t.message:"Copy to clipboard: #{key}, Enter",a=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C",o=l.replace(/#{\s*key\s*}/g,a),window.prompt(o,e)}}finally{c&&("function"==typeof c.removeRange?c.removeRange(d):c.removeAllRanges()),u&&document.body.removeChild(u),s()}return p}},20(e,t,l){var n=l(649),r=Symbol.for("react.element"),a=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,o=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function d(e,t,l){var n,a={},d=null,c=null;for(n in void 0!==l&&(d=""+l),void 0!==t.key&&(d=""+t.key),void 0!==t.ref&&(c=t.ref),t)i.call(t,n)&&!s.hasOwnProperty(n)&&(a[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps)void 0===a[n]&&(a[n]=t[n]);return{$$typeof:r,type:e,key:d,ref:c,props:a,_owner:o.current}}t.Fragment=a,t.jsx=d,t.jsxs=d},848(e,t,l){e.exports=l(20)},426(e){e.exports=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,l=[],n=0;n<e.rangeCount;n++)l.push(e.getRangeAt(n));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null}return e.removeAllRanges(),function(){"Caret"===e.type&&e.removeAllRanges(),e.rangeCount||l.forEach(function(t){e.addRange(t)}),t&&t.focus()}}},649(t){t.exports=e}},eb={};function ey(e){var t=eb[e];if(void 0!==t)return t.exports;var l=eb[e]={exports:{}};return ej[e].call(l.exports,l,l.exports,ey),l.exports}ey.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return ey.d(t,{a:t}),t},ey.d=(e,t)=>{for(var l in t)ey.o(t,l)&&!ey.o(e,l)&&Object.defineProperty(e,l,{enumerable:!0,get:t[l]})},ey.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),ey.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var ew={};(()=>{ey.d(ew,{NG:()=>eN.PropEditorProps,Nx:()=>ly,Ei:()=>tk,QE:()=>eI.PluginType,Ts:()=>eT,ps:()=>lu,V2:()=>eI.PageSchema,B7:()=>lo,NQ:()=>eE,ru:()=>tw});var e,ej,eb,eC,eS,ek,ez,eI={};ey.r(eI),ey.d(eI,{P:()=>ls});var eN={};ey.r(eN);var eO=ey(848),eA=ey(649);let eE=(0,eA.createContext)({pageId:"",designable:!1,plugins:[],schema:{info:{},datasources:[],scripts:[],variables:[],items:[]},selectedItem:null,atItems:null,setSchema:()=>{},setSelectedItem:()=>{},updateSelectedItem:()=>{},forceUpdate:()=>{},onAddAtItem:()=>{},onRemoveAtItem:()=>{},clearAtItems:()=>{},datasetSelector:void 0,datasetAdd:void 0,fetch:void 0,deviceWidth:0,setDeviceWidth:()=>{},initCallback:()=>{},handleCallback:()=>{},getVars:()=>({}),setVar:()=>{}}),eT=e=>{let{pageId:t,designable:l,plugins:n,schema:r,selectedItem:a,setSchema:i,setSelectedItem:o,datasetSelector:s,datasetAdd:d,fetch:c,children:u}=e,[p,x]=(0,eA.useState)(0),[m,h]=(0,eA.useState)([]),[f,g]=(0,eA.useState)({global:{},local:{}}),[v,j]=(0,eA.useState)({}),b=e=>({...f.global,...f.local[e||""]||{}});return(0,eA.useEffect)(()=>{let e={};(r.variables||[]).forEach(t=>{e[t.name]=t.value}),g(t=>({...t,global:e}))},[r.variables]),(0,eO.jsx)(eE.Provider,{value:{pageId:t,designable:!!l,plugins:n||[],schema:r,selectedItem:a,atItems:m,setSchema:i||(()=>{}),setSelectedItem:o||(()=>{}),updateSelectedItem:e=>{null==o||o(Object.assign(a,e||{})),null==i||i({...r})},datasetSelector:s,datasetAdd:d,fetch:c,forceUpdate:()=>{null==i||i({...r})},onAddAtItem:e=>{null!=m&&m.includes(e)||h([...m,e])},onRemoveAtItem:e=>{h(m.filter(t=>t!==e))},clearAtItems:()=>{h([])},deviceWidth:p,setDeviceWidth:x||(()=>{}),initCallback:e=>{let{id:t,callback:l}=e;j(e=>({...e,[t]:l}))},handleCallback:(e,t,l)=>{(e.cascadeIds||[]).forEach(e=>{let n=v[e];if("function"==typeof n){let r=n(t,b(e));if(r){let{target:e,data:t}=r;null==l||l(e,t)}}})},getVars:b,setVar:(e,t,l)=>{let n={...f};(e.cascadeIds||[]).forEach(e=>{n.local[e]=n.local[e]||{},n.local[e][t]=l})}},children:u})};function eD(e,t){(null==t||t>e.length)&&(t=e.length);for(var l=0,n=Array(t);l<t;l++)n[l]=e[l];return n}function eB(e,t){if(e){if("string"==typeof e)return eD(e,t);var l=({}).toString.call(e).slice(8,-1);return"Object"===l&&e.constructor&&(l=e.constructor.name),"Map"===l||"Set"===l?Array.from(e):"Arguments"===l||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(l)?eD(e,t):void 0}}function eR(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var l=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=l){var n,r,a,i,o=[],s=!0,d=!1;try{if(a=(l=l.call(e)).next,0===t){if(Object(l)!==l)return;s=!1}else for(;!(s=(n=a.call(l)).done)&&(o.push(n.value),o.length!==t);s=!0);}catch(e){d=!0,r=e}finally{try{if(!s&&null!=l.return&&(i=l.return(),Object(i)!==i))return}finally{if(d)throw r}}return o}}(e,t)||eB(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var eL=ey(951),eP="data-pdnd-honey-pot";function eM(e){return e instanceof Element&&e.hasAttribute(eP)}function e_(e){var t=eR(document.elementsFromPoint(e.x,e.y),2),l=t[0],n=t[1];return l?eM(l)?null!=n?n:null:l:null}function e$(e){return(e$="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function eF(e,t,l){var n;return(n=function(e,t){if("object"!=e$(e)||!e)return e;var l=e[Symbol.toPrimitive];if(void 0!==l){var n=l.call(e,t||"default");if("object"!=e$(n))return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==e$(n)?n:n+"")in e)?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}function eY(e,t){var l=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),l.push.apply(l,n)}return l}function eH(e){for(var t=1;t<arguments.length;t++){var l=null!=arguments[t]?arguments[t]:{};t%2?eY(Object(l),!0).forEach(function(t){eF(e,t,l[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(l)):eY(Object(l)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(l,t))})}return e}function eG(e){var t,l,n,r,a={x:Math.min((r={x:Math.max((n={x:(l={x:Math.floor((t=e.client).x),y:Math.floor(t.y)}).x-1,y:l.y-1}).x,0),y:Math.max(n.y,0)}).x,window.innerWidth-2),y:Math.min(r.y,window.innerHeight-2)};return DOMRect.fromRect({x:a.x,y:a.y,width:2,height:2})}function eJ(e){var t=e.clientRect;return{left:"".concat(t.left,"px"),top:"".concat(t.top,"px"),width:"".concat(t.width,"px"),height:"".concat(t.height,"px")}}function eK(e){return function(e){if(Array.isArray(e))return eD(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||eB(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function eW(e){var t=null;return function(){if(!t){for(var l=arguments.length,n=Array(l),r=0;r<l;r++)n[r]=arguments[r];t={result:e.apply(this,n)}}return t.result}}var eU=eW(function(){return navigator.userAgent.includes("Firefox")}),eq=eW(function(){var e=navigator.userAgent;return e.includes("AppleWebKit")&&!e.includes("Chrome")}),eX={isLeavingWindow:Symbol("leaving"),isEnteringWindow:Symbol("entering")};if("undefined"!=typeof window&&eq()){var eV=eQ();(0,eL.bindAll)(window,[{type:"dragstart",listener:function(){eV.enterCount=0,eV.isOverWindow=!0}},{type:"drop",listener:eZ},{type:"dragend",listener:eZ},{type:"dragenter",listener:function(e){eV.isOverWindow||0!==eV.enterCount||(e[eX.isEnteringWindow]=!0),eV.isOverWindow=!0,eV.enterCount++}},{type:"dragleave",listener:function(e){eV.enterCount--,eV.isOverWindow&&0===eV.enterCount&&(e[eX.isLeavingWindow]=!0,eV.isOverWindow=!1)}}],{capture:!0})}function eQ(){return{enterCount:0,isOverWindow:!1}}function eZ(){eV=eQ()}function e0(e){return{altKey:e.altKey,button:e.button,buttons:e.buttons,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey,clientX:e.clientX,clientY:e.clientY,pageX:e.pageX,pageY:e.pageY}}var e1=(e=function(e){return e()},ej=[],eb=null,(eC=function(){for(var t=arguments.length,l=Array(t),n=0;n<t;n++)l[n]=arguments[n];ej=l,eb||(eb=requestAnimationFrame(function(){eb=null,e.apply(void 0,ej)}))}).cancel=function(){eb&&(cancelAnimationFrame(eb),eb=null)},eC),e2=(eS=null,{schedule:function(e){eS={frameId:requestAnimationFrame(function(){eS=null,e()}),fn:e}},flush:function(){eS&&(cancelAnimationFrame(eS.frameId),eS.fn(),eS=null)}}),e4={isActive:!1};function e8(){return!e4.isActive}function e6(e){var t,l=e.event,n=null==(t=e.current[0])?void 0:t.dropEffect;null!=n&&l.dataTransfer&&(l.dataTransfer.dropEffect=n)}var e5=function(e){var t=e.event,l=e.dragType,n=e.getDropTargetsOver,r=e.dispatchEvent;if(e8()){var a,i,o=function(e){var t=e.event,l=e.dragType,n=e.getDropTargetsOver,r=e0(t);if("external"===l.startedFrom)return{input:r,dropTargets:[]};var a=n({input:r,source:l.payload,target:t.target,current:[]});return{input:r,dropTargets:a}}({event:t,dragType:l,getDropTargetsOver:n});e4.isActive=!0;var s={current:o};e6({event:t,current:o.dropTargets});var d=function(e){var t=e.source,l=e.initial,n=e.dispatchEvent,r={dropTargets:[]};function a(e){n(e),r={dropTargets:e.payload.location.current.dropTargets}}return{start:function(e){var n=e.nativeSetDragImage,i={current:l,previous:r,initial:l};a({eventName:"onGenerateDragPreview",payload:{source:t,location:i,nativeSetDragImage:n}}),e2.schedule(function(){a({eventName:"onDragStart",payload:{source:t,location:i}})})},dragUpdate:function(e){var n=e.current;e2.flush(),e1.cancel(),a({eventName:"onDropTargetChange",payload:{source:t,location:{initial:l,previous:r,current:n}}})},drag:function(e){var n=e.current;e1(function(){e2.flush(),a({eventName:"onDrag",payload:{source:t,location:{initial:l,previous:r,current:n}}})})},drop:function(e){var n=e.current,i=e.updatedSourcePayload;e2.flush(),e1.cancel(),a({eventName:"onDrop",payload:{source:null!=i?i:t,location:{current:n,previous:r,initial:l}}})}}}({source:l.payload,dispatchEvent:r,initial:o}),c=(0,eL.bindAll)(window,[{type:"dragover",listener:function(e){p(e),d.drag({current:s.current})}},{type:"dragenter",listener:p},{type:"dragleave",listener:function(e){(function(e){var t=e.dragLeave,l=t.type,n=t.relatedTarget;return"dragleave"===l&&(eq()?!!eq()&&t.hasOwnProperty(eX.isLeavingWindow):null==n||(eU()?"nodeName"in n&&n.ownerDocument!==document:n instanceof HTMLIFrameElement))})({dragLeave:e})&&(u({input:s.current.input,dropTargets:[]}),"external"===l.startedFrom&&x())}},{type:"drop",listener:function(e){(s.current={dropTargets:s.current.dropTargets,input:e0(e)},s.current.dropTargets.length)?(e.preventDefault(),e6({event:e,current:s.current.dropTargets}),d.drop({current:s.current,updatedSourcePayload:"external"===l.type?l.getDropPayload(e):null}),m()):x()}},{type:"dragend",listener:function(e){s.current={dropTargets:s.current.dropTargets,input:e0(e)},x()}}].concat(eK([{type:"pointermove",listener:(i=0,function(){i<20?i++:a()})},{type:"pointerdown",listener:a=x}])),{capture:!0});d.start({nativeSetDragImage:t.dataTransfer?t.dataTransfer.setDragImage.bind(t.dataTransfer):null})}function u(e){var t=function(e){var t=e.current,l=e.next;if(t.length!==l.length)return!0;for(var n=0;n<t.length;n++)if(t[n].element!==l[n].element)return!0;return!1}({current:s.current.dropTargets,next:e.dropTargets});s.current=e,t&&d.dragUpdate({current:s.current})}function p(e){var t=e0(e),r=n({target:eM(e.target)?e_({x:t.clientX,y:t.clientY}):e.target,input:t,source:l.payload,current:s.current.dropTargets});r.length&&(e.preventDefault(),e6({event:e,current:r})),u({dropTargets:r,input:t})}function x(){s.current.dropTargets.length&&u({dropTargets:[],input:s.current.input}),d.drop({current:s.current,updatedSourcePayload:null}),m()}function m(){e4.isActive=!1,c()}},e9=new Map;function e3(){for(var e=arguments.length,t=Array(e),l=0;l<e;l++)t[l]=arguments[l];return function(){t.forEach(function(e){return e()})}}function e7(e,t){var l=t.attribute,n=t.value;return e.setAttribute(l,n),function(){return e.removeAttribute(l)}}function te(e,t){var l=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),l.push.apply(l,n)}return l}function tt(e){for(var t=1;t<arguments.length;t++){var l=null!=arguments[t]?arguments[t]:{};t%2?te(Object(l),!0).forEach(function(t){eF(e,t,l[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(l)):te(Object(l)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(l,t))})}return e}function tl(e,t){var l="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!l){if(Array.isArray(e)||(l=function(e,t){if(e){if("string"==typeof e)return tn(e,void 0);var l=({}).toString.call(e).slice(8,-1);return"Object"===l&&e.constructor&&(l=e.constructor.name),"Map"===l||"Set"===l?Array.from(e):"Arguments"===l||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(l)?tn(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){l&&(e=l);var n=0,r=function(){};return{s:r,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:r}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,o=!1;return{s:function(){l=l.call(e)},n:function(){var e=l.next();return i=e.done,e},e:function(e){o=!0,a=e},f:function(){try{i||null==l.return||l.return()}finally{if(o)throw a}}}}function tn(e,t){(null==t||t>e.length)&&(t=e.length);for(var l=0,n=Array(t);l<t;l++)n[l]=e[l];return n}function tr(e){return e.slice(0).reverse()}function ta(e,t){(null==t||t>e.length)&&(t=e.length);for(var l=0,n=Array(t);l<t;l++)n[l]=e[l];return n}function ti(e,t){var l=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),l.push.apply(l,n)}return l}var to=eW(function(){return navigator.userAgent.toLocaleLowerCase().includes("android")}),ts="text/plain",td=new WeakMap,tc=(ek=null,{bindEvents:function(){return ek=null,(0,eL.bind)(window,{type:"pointermove",listener:function(e){ek={x:e.clientX,y:e.clientY}},options:{capture:!0}})},getOnPostDispatch:function(){var e=null;return function(t){var l=t.eventName,n=t.payload;if("onDragStart"===l){var r,a,i,o=n.location.initial.input,s=null!=ek?ek:{x:o.clientX,y:o.clientY};(r=document.createElement("div")).setAttribute(eP,"true"),a=eG({client:s}),Object.assign(r.style,eH(eH({backgroundColor:"transparent",position:"fixed",padding:0,margin:0,boxSizing:"border-box"},eJ({clientRect:a})),{},{pointerEvents:"auto",zIndex:0x7fffffff})),document.body.appendChild(r),i=(0,eL.bind)(window,{type:"pointermove",listener:function(e){a=eG({client:{x:e.clientX,y:e.clientY}}),Object.assign(r.style,eJ({clientRect:a}))},options:{capture:!0}}),e=function(e){var t,l,n,o=e.current;if(i(),l=(t={client:o,clientRect:a}).client,n=t.clientRect,l.x>=n.x&&l.x<=n.x+n.width&&l.y>=n.y&&l.y<=n.y+n.height)return void r.remove();function s(){d(),r.remove()}var d=(0,eL.bindAll)(window,[{type:"pointerdown",listener:s},{type:"pointermove",listener:s},{type:"focusin",listener:s},{type:"focusout",listener:s},{type:"dragstart",listener:s},{type:"dragenter",listener:s},{type:"dragover",listener:s}],{capture:!0})}}if("onDrop"===l){var d,c=n.location.current.input;null==(d=e)||d({current:{x:c.clientX,y:c.clientY}}),e=null,ek=null}}}}),tu=function(e){var t=e.typeKey,l=e.mount,n=e.dispatchEventToSource,r=e.onPostDispatch,a=e.defaultDropEffect,i=function(){var e=new Set,t=null;function l(e){t&&(!e.canMonitor||e.canMonitor(t.canMonitorArgs))&&t.active.add(e)}return{dispatchEvent:function(n){var r=n.eventName,a=n.payload;if("onGenerateDragPreview"===r){t={canMonitorArgs:{initial:a.location.initial,source:a.source},active:new Set};var i,o=function(e,t){var l="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!l){if(Array.isArray(e)||(l=function(e,t){if(e){if("string"==typeof e)return ta(e,void 0);var l=({}).toString.call(e).slice(8,-1);return"Object"===l&&e.constructor&&(l=e.constructor.name),"Map"===l||"Set"===l?Array.from(e):"Arguments"===l||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(l)?ta(e,void 0):void 0}}(e))){l&&(e=l);var n=0,r=function(){};return{s:r,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:r}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,o=!1;return{s:function(){l=l.call(e)},n:function(){var e=l.next();return i=e.done,e},e:function(e){o=!0,a=e},f:function(){try{i||null==l.return||l.return()}finally{if(o)throw a}}}}(e);try{for(o.s();!(i=o.n()).done;){var s=i.value;l(s)}}catch(e){o.e(e)}finally{o.f()}}if(t){for(var d=Array.from(t.active),c=0;c<d.length;c++){var u,p=d[c];t.active.has(p)&&(null==(u=p[r])||u.call(p,a))}"onDrop"===r&&(t.active.clear(),t=null)}},monitorForConsumers:function(n){var r=function(e){for(var t=1;t<arguments.length;t++){var l=null!=arguments[t]?arguments[t]:{};t%2?ti(Object(l),!0).forEach(function(t){eF(e,t,l[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(l)):ti(Object(l)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(l,t))})}return e}({},n);return e.add(r),l(r),eW(function(){e.delete(r),t&&t.active.delete(r)})}}}(),o=function(e){var t=e.typeKey,l=e.defaultDropEffect,n=new WeakMap,r="data-drop-target-for-".concat(t),a="[".concat(r,"]");function i(e){var t,l=e.eventName,r=e.payload,a=tl(r.location.current.dropTargets);try{for(a.s();!(t=a.n()).done;){var i,o=t.value,s=n.get(o.element),d=tt(tt({},r),{},{self:o});null==s||null==(i=s[l])||i.call(s,d)}}catch(e){a.e(e)}finally{a.f()}}var o={onGenerateDragPreview:i,onDrag:i,onDragStart:i,onDrop:i,onDropTargetChange:function(e){var t,l=e.payload,r=new Set(l.location.current.dropTargets.map(function(e){return e.element})),a=new Set,i=tl(l.location.previous.dropTargets);try{for(i.s();!(t=i.n()).done;){var o,s,d=t.value;a.add(d.element);var c=n.get(d.element),u=r.has(d.element),p=tt(tt({},l),{},{self:d});null==c||null==(o=c.onDropTargetChange)||o.call(c,p),u||null==c||null==(s=c.onDragLeave)||s.call(c,p)}}catch(e){i.e(e)}finally{i.f()}var x,m=tl(l.location.current.dropTargets);try{for(m.s();!(x=m.n()).done;){var h,f,g=x.value;if(!a.has(g.element)){var v=tt(tt({},l),{},{self:g}),j=n.get(g.element);null==j||null==(h=j.onDropTargetChange)||h.call(j,v),null==j||null==(f=j.onDragEnter)||f.call(j,v)}}}catch(e){m.e(e)}finally{m.f()}}};return{dropTargetForConsumers:function(e){return eW(e3(e7(e.element,{attribute:r,value:"true"}),(n.set(e.element,e),function(){return n.delete(e.element)})))},getIsOver:function(e){var t=e.source,r=e.target,i=e.input,o=e.current,s=function e(t){var r,i,o,s,d=t.source,c=t.target,u=t.input,p=t.result,x=void 0===p?[]:p;if(null==c)return x;if(!(c instanceof Element))return c instanceof Node?e({source:d,target:c.parentElement,input:u,result:x}):x;var m=c.closest(a);if(null==m)return x;var h=n.get(m);if(null==h)return x;var f={input:u,source:d,element:h.element};if(h.canDrop&&!h.canDrop(f))return e({source:d,target:h.element.parentElement,input:u,result:x});var g=null!=(r=null==(i=h.getData)?void 0:i.call(h,f))?r:{},v=null!=(o=null==(s=h.getDropEffect)?void 0:s.call(h,f))?o:l,j={data:g,element:h.element,dropEffect:v,isActiveDueToStickiness:!1};return e({source:d,target:h.element.parentElement,input:u,result:[].concat(eK(x),[j])})}({source:t,target:r,input:i});if(s.length>=o.length)return s;for(var d=tr(o),c=tr(s),u=[],p=0;p<d.length;p++){var x,m=d[p],h=c[p];if(null!=h){u.push(h);continue}var f=u[p-1],g=d[p-1];if((null==f?void 0:f.element)!==(null==g?void 0:g.element))break;var v=n.get(m.element);if(!v)break;var j={input:i,source:t,element:v.element};if(v.canDrop&&!v.canDrop(j)||!(null!=(x=v.getIsSticky)&&x.call(v,j)))break;u.push(tt(tt({},m),{},{isActiveDueToStickiness:!0}))}return tr(u)},dispatchEvent:function(e){o[e.eventName](e)}}}({typeKey:t,defaultDropEffect:a});function s(e){null==n||n(e),o.dispatchEvent(e),i.dispatchEvent(e),null==r||r(e)}function d(e){e5({event:e.event,dragType:e.dragType,getDropTargetsOver:o.getIsOver,dispatchEvent:s})}return{registerUsage:function(){var e,n;return n=function(e){var t=e.typeKey,l=e.mount,n=e9.get(t);if(n)return n.usageCount++,n;var r={typeKey:t,unmount:l(),usageCount:1};return e9.set(t,r),r}(e={typeKey:t,mount:function(){return l({canStart:e8,start:d})}}),function(){n.usageCount--,n.usageCount>0||(n.unmount(),e9.delete(e.typeKey))}},dropTarget:o.dropTargetForConsumers,monitor:i.monitorForConsumers}}({typeKey:"element",defaultDropEffect:"move",mount:function(e){return e3(tc.bindEvents(),(0,eL.bind)(document,{type:"dragstart",listener:function(t){if(e.canStart(t)&&!t.defaultPrevented&&t.dataTransfer){var l,n,r,a,i,o,s=t.target;if(s instanceof HTMLElement){var d=td.get(s);if(d){var c=e0(t),u={element:d.element,dragHandle:null!=(l=d.dragHandle)?l:null,input:c};if(d.canDrag&&!d.canDrag(u))return void t.preventDefault();if(d.dragHandle){var p=e_({x:c.clientX,y:c.clientY});if(!d.dragHandle.contains(p))return void t.preventDefault()}var x=null!=(n=null==(r=d.getInitialDataForExternal)?void 0:r.call(d,u))?n:null;if(x)for(var m=0,h=Object.entries(x);m<h.length;m++){var f=eR(h[m],2),g=f[0],v=f[1];t.dataTransfer.setData(g,null!=v?v:"")}!to()||t.dataTransfer.types.includes(ts)||t.dataTransfer.types.includes("text/uri-list")||t.dataTransfer.setData(ts,"pdnd:android-fallback"),t.dataTransfer.setData("application/vnd.pdnd","");var j={element:d.element,dragHandle:null!=(a=d.dragHandle)?a:null,data:null!=(i=null==(o=d.getInitialData)?void 0:o.call(d,u))?i:{}};e.start({event:t,dragType:{type:"element",payload:j,startedFrom:"internal"}})}}}}}))},dispatchEventToSource:function(e){var t,l,n=e.eventName,r=e.payload;null==(t=td.get(r.source.element))||null==(l=t[n])||l.call(t,r)},onPostDispatch:tc.getOnPostDispatch()}),tp=tu.dropTarget;function tx(e){return eW(e3(tu.registerUsage(),(td.set(e.element,e),function(){td.delete(e.element)}),e7(e.element,{attribute:"draggable",value:"true"})))}tu.monitor;let tm=R({scriptUrl:"https://at.alicdn.com/t/c/font_5072483_ufbwxczz8z.js"}),th=e=>{let{type:t,className:l="",style:n={}}=e;return(0,eO.jsx)(tm,{type:t,className:l,style:n})},tf=t.div`
|
|
3
3
|
display: flex;
|
|
4
4
|
flex-direction: row;
|
|
5
5
|
align-items: flex-end;
|
|
@@ -40,7 +40,7 @@ import*as e from"react";import t,{css as l}from"styled-components";import{AlignC
|
|
|
40
40
|
background-color: rgb(24, 144, 255, 1);
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
`,tg=e=>{let{item:t,ancestors:l,onAddAt:n,onDelete:r,onUpdate:a,onSelect:i}=e,[o,s]=(0,eA.useState)(JSON.stringify(t||{},null,2)),[d,u]=(0,eA.useState)(!1),p=(0,eA.useRef)(null),x=(0,eO.jsx)(ec.Text,{children:t.name||t.type+`(${t.id})`});return(0,eO.jsxs)(eO.Fragment,{children:[(0,eO.jsx)(q,{title:`源码编辑(${t.name||t.type+`(${t.id})`})`,open:d,width:700,onCancel:()=>{u(!1),p.current=null},styles:{body:{margin:"0 -24px"}},footer:(0,eO.jsxs)(en,{children:[(0,eO.jsx)(P,{onClick:()=>{u(!1),p.current=null},children:"取消"}),(0,eO.jsx)(P,{onClick:()=>{s(JSON.stringify(t||{},null,2))},children:"重置"}),(0,eO.jsx)(P,{onClick:()=>{var e,t;let l=null==(e=p.current)?void 0:e.editor;null==l||null==(t=l.getAction("editor.action.formatDocument"))||t.run()},children:"格式化"}),(0,eO.jsx)(P,{type:"primary",onClick:()=>{u(!1),Object.assign(t,JSON.parse(o)),a&&a()},children:"保存"})]}),children:(0,eO.jsx)(eh,{height:"400px",defaultLanguage:"json",value:o,onChange:e=>s(e||""),options:{minimap:{enabled:!1}},onMount:e=>{p.current={editor:e}}})}),(0,eO.jsxs)(tf,{children:[(null==l?void 0:l.length)?(0,eO.jsx)(J,{placement:"topLeft",menu:{style:{borderRadius:0,padding:0,background:"none",boxShadow:"none"},items:l.map(e=>({label:(null==e?void 0:e.name)||(null==e?void 0:e.type)+`(${null==e?void 0:e.id})`,key:null==e?void 0:e.id,onClick:()=>{null==i||i(e)}}))},styles:{item:{borderRadius:2,background:"rgba(24, 144, 255, 0.8)",padding:"2px 8px",color:"#fff",fontSize:12,marginTop:2}},children:x}):x,n&&(0,eO.jsx)(es,{title:"添加到对话",children:(0,eO.jsx)("a",{onClick:n,children:(0,eO.jsx)(th,{type:"icon-number"})})}),(0,eO.jsx)(es,{title:"源码编辑",children:(0,eO.jsx)("a",{onClick:()=>u(!0),children:(0,eO.jsx)(th,{type:"icon-json"})})}),(0,eO.jsx)(es,{title:"删除",children:(0,eO.jsx)("a",{onClick:r,children:(0,eO.jsx)(c,{})})})]})]})},tv=e=>{var t,l;let{item:n,onDelete:r,ancestors:a,parentList:i,onListChange:o,index:s}=e,{designable:d,selectedItem:c,setSelectedItem:u,plugins:p,onAddAtItem:x,onRemoveAtItem:m,forceUpdate:h,fetch:f}=(0,eA.useContext)(
|
|
43
|
+
`,tg=e=>{let{item:t,ancestors:l,onAddAt:n,onDelete:r,onUpdate:a,onSelect:i}=e,[o,s]=(0,eA.useState)(JSON.stringify(t||{},null,2)),[d,u]=(0,eA.useState)(!1),p=(0,eA.useRef)(null),x=(0,eO.jsx)(ec.Text,{children:t.name||t.type+`(${t.id})`});return(0,eO.jsxs)(eO.Fragment,{children:[(0,eO.jsx)(q,{title:`源码编辑(${t.name||t.type+`(${t.id})`})`,open:d,width:700,onCancel:()=>{u(!1),p.current=null},styles:{body:{margin:"0 -24px"}},footer:(0,eO.jsxs)(en,{children:[(0,eO.jsx)(P,{onClick:()=>{u(!1),p.current=null},children:"取消"}),(0,eO.jsx)(P,{onClick:()=>{s(JSON.stringify(t||{},null,2))},children:"重置"}),(0,eO.jsx)(P,{onClick:()=>{var e,t;let l=null==(e=p.current)?void 0:e.editor;null==l||null==(t=l.getAction("editor.action.formatDocument"))||t.run()},children:"格式化"}),(0,eO.jsx)(P,{type:"primary",onClick:()=>{u(!1),Object.assign(t,JSON.parse(o)),a&&a()},children:"保存"})]}),children:(0,eO.jsx)(eh,{height:"400px",defaultLanguage:"json",value:o,onChange:e=>s(e||""),options:{minimap:{enabled:!1}},onMount:e=>{p.current={editor:e}}})}),(0,eO.jsxs)(tf,{children:[(null==l?void 0:l.length)?(0,eO.jsx)(J,{placement:"topLeft",menu:{style:{borderRadius:0,padding:0,background:"none",boxShadow:"none"},items:l.map(e=>({label:(null==e?void 0:e.name)||(null==e?void 0:e.type)+`(${null==e?void 0:e.id})`,key:null==e?void 0:e.id,onClick:()=>{null==i||i(e)}}))},styles:{item:{borderRadius:2,background:"rgba(24, 144, 255, 0.8)",padding:"2px 8px",color:"#fff",fontSize:12,marginTop:2}},children:x}):x,n&&(0,eO.jsx)(es,{title:"添加到对话",children:(0,eO.jsx)("a",{onClick:n,children:(0,eO.jsx)(th,{type:"icon-number"})})}),(0,eO.jsx)(es,{title:"源码编辑",children:(0,eO.jsx)("a",{onClick:()=>u(!0),children:(0,eO.jsx)(th,{type:"icon-json"})})}),(0,eO.jsx)(es,{title:"删除",children:(0,eO.jsx)("a",{onClick:r,children:(0,eO.jsx)(c,{})})})]})]})},tv=e=>{var t,l;let{item:n,onDelete:r,ancestors:a,parentList:i,onListChange:o,index:s}=e,{designable:d,selectedItem:c,setSelectedItem:u,plugins:p,onAddAtItem:x,onRemoveAtItem:m,forceUpdate:h,fetch:f}=(0,eA.useContext)(eE),[g,v]=(0,eA.useState)(!1),[j,b]=(0,eA.useState)(null),y=null==(t=p.find(e=>e.key===n.type))?void 0:t.component;return((0,eA.useEffect)(()=>{let e=()=>{if(!t.current)return;let e=document.getElementById(`page-item-${n.id}`);if(!e)return void l();let r=e.getBoundingClientRect();if(0===r.width&&0===r.height){t.current.style.display="none";return}t.current.style.display="flex";let a=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0,i=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;t.current.style.top=`${r.top+a-22}px`,t.current.style.left=`${r.left+i-1}px`},t={current:null},l=()=>{t.current&&(document.body.contains(t.current)&&document.body.removeChild(t.current),t.current=null,b(null),window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e))};if(c&&c===n&&d){let n=document.createElement("div");return n.style.position="absolute",n.style.zIndex="1000",n.style.display="flex",n.style.gap="4px",document.body.appendChild(n),t.current=n,b(n),e(),window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),()=>l()}},[c,d,n]),(0,eA.useEffect)(()=>{let e=document.getElementById(`page-item-${n.id}`);if(!e||!d)return;let t=tx({element:e,getInitialData:()=>({id:n.id,index:s,list:i,onListChange:o,data:n}),canDrag:()=>!!d,onDragStart:()=>{v(!0)},onDrop:()=>{v(!1)}}),l=e=>{e.stopPropagation(),u&&u(n)};return d&&e.addEventListener("click",l),()=>{t(),d&&e.removeEventListener("click",l)}},[d,n,s,i]),y)?(0,eO.jsxs)(eO.Fragment,{children:[(0,eO.jsx)(y,{id:`page-item-${n.id}`,"data-item-id":n.id,...n.props||{},item:n,className:`page-item-component ${d?"designable":""} ${c===n?"selected":""}`,ancestors:a,style:{...n.style||{},opacity:g?.5:1}}),j&&ex.createPortal((0,eO.jsx)(tg,{item:n,ancestors:a,onAddAt:(null==f||null==(l=f.ai)?void 0:l.chat)?e=>{e.stopPropagation(),x&&x(n)}:void 0,onDelete:e=>{e.stopPropagation(),q.confirm({title:"确认删除吗?",okText:"确认",cancelText:"取消",okType:"danger",onOk:()=>{r&&r(),m&&m(n)}})},onUpdate:h,onSelect:u}),j)]}):null},tj=t.div`
|
|
44
44
|
position: absolute;
|
|
45
45
|
background: #1890ff;
|
|
46
46
|
pointer-events: none;
|
|
@@ -82,7 +82,7 @@ import*as e from"react";import t,{css as l}from"styled-components";import{AlignC
|
|
|
82
82
|
&::before { left: -3px; top: -4px; }
|
|
83
83
|
&::after { left: -3px; bottom: -4px; }
|
|
84
84
|
`}
|
|
85
|
-
`,tb=(e,t,l,n)=>{let r=e.getBoundingClientRect(),a=Array.from(e.children).filter(e=>!e.classList.contains("drop-indicator")&&e.getBoundingClientRect().width>0),i=(e=>{let t=Array.from(e.children).filter(e=>!e.classList.contains("drop-indicator")&&e.getBoundingClientRect().width>0);if(0===t.length){let t=window.getComputedStyle(e),{display:l,flexDirection:n}=t;return"flex"===l||"inline-flex"===l?!n.includes("column"):"grid"===l&&!t.gridAutoFlow.includes("column")}if(1===t.length){let l=window.getComputedStyle(t[0]),n=window.getComputedStyle(e);return"flex"===n.display||"inline-flex"===n.display?!n.flexDirection.includes("column"):!!["inline","inline-block","inline-flex"].includes(l.display)||"none"!==l.float}let l=0,n=0,r=t.map(e=>{let t=e.getBoundingClientRect(),r=t.left+t.width/2,a=t.top+t.height/2;return l+=r,n+=a,{cx:r,cy:a}}),a=l/t.length,i=n/t.length,o=0,s=0;return r.forEach(e=>{o+=(e.cx-a)**2,s+=(e.cy-i)**2}),o>=s})(e),o=e.scrollLeft,s=e.scrollTop;if(0===a.length)return{index:0,indicatorOffset:15,isHorizontal:i};let d=(e,t)=>i?(t?e.left:e.right)-r.left+o+(t?-4:4):(t?e.top:e.bottom)-r.top+s+(t?-4:4),c=e=>{let t=e.getAttribute("data-item-id");if(t){let e=n.findIndex(e=>e.id===t);if(-1!==e)return e}return a.indexOf(e)};for(let e=0;e<a.length;e++){let n=a[e].getBoundingClientRect();if(t>=n.left-5&&t<=n.right+5&&l>=n.top-5&&l<=n.bottom+5){let r=i?t<n.left+n.width/2:l<n.top+n.height/2,o=c(a[e]);return{index:r?o:o+1,indicatorOffset:d(n,r),isHorizontal:i}}}let u=1/0,p=!1,x=null,m=null;for(let e=0;e<a.length;e++){let n=a[e].getBoundingClientRect(),r=n.left+n.width/2,o=n.top+n.height/2,s=(t-r)**2+(l-o)**2;s<u&&(u=s,x=n,m=a[e],p=i?t<r:l<o)}if(m&&x){let e=c(m);return{index:p?e:e+1,indicatorOffset:d(x,p),isHorizontal:i}}let h=a[a.length-1].getBoundingClientRect();return{index:n.length,indicatorOffset:d(h,!1),isHorizontal:i}},ty=e=>{let{rootComponent:t="div",rootData:l={},list:n=[],ancestors:r=[],item:a,onListChange:i,className:o}=e,{designable:s,selectedItem:d,setSelectedItem:c,forceUpdate:u}=(0,eA.useContext)(
|
|
85
|
+
`,tb=(e,t,l,n)=>{let r=e.getBoundingClientRect(),a=Array.from(e.children).filter(e=>!e.classList.contains("drop-indicator")&&e.getBoundingClientRect().width>0),i=(e=>{let t=Array.from(e.children).filter(e=>!e.classList.contains("drop-indicator")&&e.getBoundingClientRect().width>0);if(0===t.length){let t=window.getComputedStyle(e),{display:l,flexDirection:n}=t;return"flex"===l||"inline-flex"===l?!n.includes("column"):"grid"===l&&!t.gridAutoFlow.includes("column")}if(1===t.length){let l=window.getComputedStyle(t[0]),n=window.getComputedStyle(e);return"flex"===n.display||"inline-flex"===n.display?!n.flexDirection.includes("column"):!!["inline","inline-block","inline-flex"].includes(l.display)||"none"!==l.float}let l=0,n=0,r=t.map(e=>{let t=e.getBoundingClientRect(),r=t.left+t.width/2,a=t.top+t.height/2;return l+=r,n+=a,{cx:r,cy:a}}),a=l/t.length,i=n/t.length,o=0,s=0;return r.forEach(e=>{o+=(e.cx-a)**2,s+=(e.cy-i)**2}),o>=s})(e),o=e.scrollLeft,s=e.scrollTop;if(0===a.length)return{index:0,indicatorOffset:15,isHorizontal:i};let d=(e,t)=>i?(t?e.left:e.right)-r.left+o+(t?-4:4):(t?e.top:e.bottom)-r.top+s+(t?-4:4),c=e=>{let t=e.getAttribute("data-item-id");if(t){let e=n.findIndex(e=>e.id===t);if(-1!==e)return e}return a.indexOf(e)};for(let e=0;e<a.length;e++){let n=a[e].getBoundingClientRect();if(t>=n.left-5&&t<=n.right+5&&l>=n.top-5&&l<=n.bottom+5){let r=i?t<n.left+n.width/2:l<n.top+n.height/2,o=c(a[e]);return{index:r?o:o+1,indicatorOffset:d(n,r),isHorizontal:i}}}let u=1/0,p=!1,x=null,m=null;for(let e=0;e<a.length;e++){let n=a[e].getBoundingClientRect(),r=n.left+n.width/2,o=n.top+n.height/2,s=(t-r)**2+(l-o)**2;s<u&&(u=s,x=n,m=a[e],p=i?t<r:l<o)}if(m&&x){let e=c(m);return{index:p?e:e+1,indicatorOffset:d(x,p),isHorizontal:i}}let h=a[a.length-1].getBoundingClientRect();return{index:n.length,indicatorOffset:d(h,!1),isHorizontal:i}},ty=e=>{let{rootComponent:t="div",rootData:l={},list:n=[],ancestors:r=[],item:a,onListChange:i,className:o}=e,{designable:s,selectedItem:d,setSelectedItem:c,forceUpdate:u}=(0,eA.useContext)(eE),p=(0,eA.useRef)(null),[x,m]=(0,eA.useState)(!1),[h,f]=(0,eA.useState)(0),[g,v]=(0,eA.useState)(!1),[j,b]=(0,eA.useState)(!1),y=(0,eA.useRef)(n),w=(0,eA.useRef)(i);(0,eA.useEffect)(()=>{y.current=n,w.current=i},[n,i]);let C=(0,eA.useMemo)(()=>n||[],[n]);(0,eA.useEffect)(()=>{let e=p.current;if(!e)return;let t=tp({element:e,canDrop:e=>{let{source:t,element:l}=e;if(!s)return!1;let{data:n}=t.data||{};return(!l.classList.contains("ant-row")||(null==n?void 0:n.type)==="b-col")&&(!!l.classList.contains("ant-row")||(null==n?void 0:n.type)!=="b-col")},getData:()=>({localList:y.current}),onDragEnter:t=>{if(!s)return!1;let[l]=t.location.current.dropTargets;if((null==l?void 0:l.element)!==e)return;m(!0),b(!0);let n=t.location.current.input.clientY,{indicatorOffset:r,isHorizontal:a}=tb(e,t.location.current.input.clientX,n,y.current||[]);f(r),v(a)},onDrag:t=>{if(!s)return!1;let[l]=t.location.current.dropTargets;if((null==l?void 0:l.element)!==e){m(!1),b(!1);return}m(!0),b(!0);let n=t.location.current.input.clientY,{indicatorOffset:r,isHorizontal:a}=tb(e,t.location.current.input.clientX,n,y.current||[]);f(r),v(a)},onDragLeave:()=>{if(!s)return!1;m(!1),b(!1)},onDrop(t){if(!s)return!1;let[l]=t.location.current.dropTargets;if((null==l?void 0:l.element)!==e)return;m(!1),b(!1);let{data:n,list:r,onListChange:a,index:i}=t.source.data;null==c||c(n);let o=y.current||[],d=w.current,u=r===o||o.some(e=>e.id===n.id),p=t.location.current.input.clientY,{index:x}=tb(e,t.location.current.input.clientX,p,o);if(r)if(u){let e=[...o],t=e.findIndex(e=>e.id===n.id);if(-1!==t){let[l]=e.splice(t,1);e.splice(x>t?x-1:x,0,l),null==d||d(e)}else e.splice(x,0,n),null==d||d(e)}else{a&&r&&a(r.filter(e=>e.id!==n.id));let e=[...o];e.some(e=>e.id===n.id)||(e.splice(x,0,n),null==d||d(e))}else{let e=[...o];e.splice(x,0,n),null==d||d(e)}}});return()=>t()},[]);let S=[o,"drag-container","page-item-component",!n.length?"empty-container":"",d===a?"selected":"",s?"designable":""].filter(Boolean).join(" ");return(0,eO.jsxs)(t,{...l||{},ref:p,className:S,style:{...null==l?void 0:l.style,position:"relative",minHeight:s?24:void 0,outline:x?"1px dashed #1890ff":void 0},children:[s&&(0,eO.jsx)(tj,{className:"drop-indicator",$offset:h,$vertical:g,$visible:j}),(Array.isArray(C)?C:[]).filter(Boolean).map((e,t)=>(0,eO.jsx)(tv,{item:e,ancestors:r,parentList:C,onListChange:i,index:t,onDelete:()=>null==i?void 0:i(C.filter(t=>t.id!==e.id))},e.id||t))]})},tw=ty,tC=t.div`
|
|
86
86
|
.empty-container.designable {
|
|
87
87
|
min-width: 10px;
|
|
88
88
|
min-height: 30px;
|
|
@@ -115,7 +115,7 @@ import*as e from"react";import t,{css as l}from"styled-components";import{AlignC
|
|
|
115
115
|
z-index: 2;
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
|
-
`,tS=eA.default.forwardRef((e,t)=>{let{device:l="desktop"}=e,{schema:n,forceUpdate:r,setDeviceWidth:a}=(0,eA.useContext)(
|
|
118
|
+
`,tS=eA.default.forwardRef((e,t)=>{let{device:l="desktop"}=e,{schema:n,forceUpdate:r,setDeviceWidth:a}=(0,eA.useContext)(eE),i=(0,eA.useRef)(null),o=(0,eA.useMemo)(()=>n.items||[],[n.items]),[s,d]=(0,eA.useState)(o);(0,eA.useEffect)(()=>{d(n.items||[])},[n.items]);let c=()=>{var e;let t=null==(e=i.current)?void 0:e.parentElement,l=null==t?void 0:t.getBoundingClientRect(),n=(null==l?void 0:l.width)||0;n<=100?setTimeout(c,10):a(n?n-36:0)};return(0,eA.useEffect)(()=>{c()},[l]),(0,eA.useEffect)(()=>{let e=()=>c();return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),(0,eA.useImperativeHandle)(t,()=>({handleResize(){c()},get dom(){return i.current}})),(0,eO.jsx)(tC,{ref:i,children:(0,eO.jsx)(ty,{ancestors:[],list:s,onListChange:e=>{let t=[...e];n.items=t,d(t),null==r||r()},className:"page-canvas"})})}),tk=tS,tz=e=>{if(!e)return"";let t=new Date(e),l=new Date,n=l.getTime()-t.getTime();if(n<6e4)return"刚刚";if(n<36e5)return`${Math.floor(n/6e4)}分钟前`;let r=e=>e.toString().padStart(2,"0"),a=r(t.getHours()),i=r(t.getMinutes());if(t.getDate()===l.getDate()&&t.getMonth()===l.getMonth()&&t.getFullYear()===l.getFullYear())return`${a}:${i}`;let o=r(t.getMonth()+1),s=r(t.getDate());if(t.getFullYear()===l.getFullYear())return`${o}-${s} ${a}:${i}`;let d=t.getFullYear();return`${d}-${o}-${s} ${a}:${i}`},tI=t.div`
|
|
119
119
|
max-height: 400px;
|
|
120
120
|
overflow: auto;
|
|
121
121
|
background: #fff;
|
|
@@ -360,7 +360,7 @@ import*as e from"react";import t,{css as l}from"styled-components";import{AlignC
|
|
|
360
360
|
.send-btn.send-btn-active {
|
|
361
361
|
background-color: var(--ant-color-primary);
|
|
362
362
|
}
|
|
363
|
-
`,tO=[],tA=[],
|
|
363
|
+
`,tO=[],tA=[],tE=["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","audio/wav"],tT=[".xlsx",".wav"],tD=e=>{let{open:t,onCancel:l,onOk:n,allowedExtensions:r,allowedMimeTypes:a}=e,[o,s]=(0,eA.useState)([]);(0,eA.useEffect)(()=>{t&&s([])},[t]);let d=[...tT,...tE].join(",");return(0,eO.jsxs)(q,{title:"上传文件",open:t,okText:"上传",cancelText:"取消",onOk:()=>{n(o),l()},onCancel:l,width:600,children:[(0,eO.jsx)("div",{style:{marginBottom:16},children:(0,eO.jsxs)(ec.Text,{type:"secondary",children:["支持的文件类型:",r.join(", "),(0,eO.jsx)("br",{}),"单次支持上传多个文件,请确保文件内容合规。",(0,eO.jsx)("br",{}),"Excel 暂不支持加密文件。",(0,eO.jsx)("br",{}),"不支持 xls 电子表格,请自行转换为 xlsx 格式。",(0,eO.jsx)("br",{}),"Excel 仅支持第一行为表头、第二行开始为数据,不支持合并单元格。"]})}),(0,eO.jsxs)(eu.Dragger,{...{name:"file",multiple:!0,accept:d,fileList:[],beforeUpload:e=>{let t=a.includes(e.type)||!e.type,l=(e.name||"").substring(e.name.lastIndexOf(".")).toLowerCase(),n=r.includes(l);return t||n?(s(t=>[...t,e]),!1):(ep.error(`不支持的文件类型: ${e.name}`),eu.LIST_IGNORE)}},children:[(0,eO.jsx)("p",{className:"ant-upload-drag-icon",children:(0,eO.jsx)(v,{})}),(0,eO.jsx)("p",{className:"ant-upload-text",children:"点击或将文件拖拽到此处上传"}),(0,eO.jsx)("p",{className:"ant-upload-hint",children:"支持上传Excel表格数据或音频文件进行分析"})]}),o.length>0&&(0,eO.jsxs)("div",{style:{marginTop:16},children:[(0,eO.jsxs)(ec.Title,{level:5,style:{fontSize:14,marginBottom:8},children:["已选文件 (",o.length,")"]}),(0,eO.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:8,maxHeight:200,overflowY:"auto"},children:o.map((e,t)=>(0,eO.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",background:"#f5f5f5",borderRadius:4},children:[(0,eO.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,overflow:"hidden"},children:[e.name.endsWith(".xlsx")?(0,eO.jsx)(h,{style:{color:"#52c41a"}}):(0,eO.jsx)(i,{style:{color:"#1890ff"}}),(0,eO.jsx)(ec.Text,{ellipsis:!0,style:{maxWidth:300},children:e.name}),(0,eO.jsxs)(ec.Text,{type:"secondary",style:{fontSize:12},children:["(",(e.size/1024).toFixed(1)," KB)"]})]}),(0,eO.jsx)(P,{type:"text",size:"small",icon:(0,eO.jsx)(c,{}),onClick:()=>{s(e=>e.filter((e,l)=>l!==t))},danger:!0})]},`${e.name}-${t}`))})]})]})},tB=eA.default.forwardRef((e,t)=>{let{value:l="",placeholder:n="请输入需求,例如:分析 2025 年人口结构并生成可视化报告",disabled:r=!1,sending:a=!1,rows:i=6,agentList:o=tO,agentId:s=null,attachments:d=tA,atItems:u=null,onInput:p,onSubmit:x,onUpdateAgentId:m,onUpdateAttachments:h,onUploading:f,onRemoveAtItem:g,style:v={}}=e,j=(0,eA.useRef)(null),[b,y]=(0,eA.useState)([]),[w,C]=(0,eA.useState)(l||""),[S,k]=(0,eA.useState)(0),[z,I]=(0,eA.useState)(Array.isArray(d)?d:[]),[N,A]=(0,eA.useState)(!1),E=(0,eA.useMemo)(()=>!1,[]);(0,eA.useImperativeHandle)(t,()=>({focus(){var e;null==(e=j.current)||e.focus()}})),(0,eA.useEffect)(()=>C(l||""),[l]),(0,eA.useEffect)(()=>{p&&p(w)},[w]),(0,eA.useEffect)(()=>I(Array.isArray(d)?d:[]),[d]);let T=!!(w&&w.trim()),D=async e=>{if(A(!1),!f||!e.length)return;let t=[];for(let l of e)try{let e=await f(l);e&&t.push({id:e.id,name:l.name,size:l.size})}catch(e){console.error(e)}I([...z,...t]),h&&h([...z,...t])},B=()=>{if(!T||a)return;let e=Date.now();if(e-S<400)return;k(e);let t=(w||"").trim();if(!t)return;let l={message:t,agents:b.map(e=>({id:e.id,name:e.name})),files:z.map(e=>({id:e.id,name:e.name,extension:e.name.substring(e.name.lastIndexOf("."))}))};x&&x(l),C(""),I([])},R=(0,eO.jsx)(tI,{children:(0,eO.jsx)("ul",{className:"agent-list",children:o.map(e=>(0,eO.jsx)("li",{children:(0,eO.jsx)("a",{onClick:()=>{let t;return t=e.id||null,void(m&&m(t),y(t=>[...t,e]))},children:e.name})},String(e.id)))})});return(0,eO.jsx)(tN,{style:v,children:(0,eO.jsxs)("div",{className:"chat-input",children:[(0,eO.jsxs)("div",{className:"input-stack",children:[z.length>0&&(0,eO.jsx)("div",{className:"attachment-bar beautified_scrollbar",children:z.map(e=>(0,eO.jsxs)("div",{className:"attachment-card",children:[e.name.endsWith(".xlsx")?(0,eO.jsx)(th,{type:"icon-excel"}):(0,eO.jsx)(th,{type:"icon-audio"}),(0,eO.jsx)(ec.Text,{className:"name",ellipsis:{tooltip:e.name},children:e.name}),(0,eO.jsx)("a",{className:"remove",onClick:()=>{var t;let l;return t=e.id,void(I(l=z.filter(e=>e.id!==t)),h&&h(l))},children:(0,eO.jsx)(c,{})})]},e.id))}),b.length>0&&(0,eO.jsx)("div",{className:"agent-info",children:b.map((e,t)=>(0,eO.jsxs)("div",{children:[(0,eO.jsxs)("span",{className:"name",children:[(0,eO.jsx)(th,{type:"icon-at"}),e.name]}),(0,eO.jsx)("a",{className:"remove",onClick:()=>{m&&m(null),y(e=>e.filter((e,l)=>l!==t))},children:"\xd7"})]},String(e.id)))}),!!(null==u?void 0:u.length)&&(0,eO.jsx)("div",{className:"agent-info",children:u.map((e,t)=>(0,eO.jsxs)("div",{children:[(0,eO.jsxs)("span",{className:"name",children:[(0,eO.jsx)(th,{type:"icon-number"}),e.name||e.id]}),(0,eO.jsx)("a",{className:"remove",onClick:()=>null==g?void 0:g(e,t),children:"\xd7"})]},String(e.id)))}),(0,eO.jsx)(W.TextArea,{ref:j,className:"input textarea-stacked",placeholder:n,disabled:r||a,autoSize:{minRows:i,maxRows:i},value:w,onPressEnter:e=>{"Enter"===e.key&&(e.shiftKey||(e.preventDefault(),B()))},onChange:e=>C(e.target.value)})]}),(0,eO.jsxs)("div",{className:"footer",children:[(0,eO.jsxs)("div",{className:"left",children:[!!(null==o?void 0:o.length)&&(0,eO.jsx)(J,{trigger:["click"],popupRender:()=>R,placement:"topLeft",styles:{root:{boxShadow:"var(--ant-box-shadow-card)"}},children:(0,eO.jsx)(es,{title:"选择助理",children:(0,eO.jsx)(P,{className:"agent-trigger",onClick:e=>e.preventDefault(),children:(0,eO.jsx)(th,{type:"icon-at"})})})}),f&&(0,eO.jsxs)(eO.Fragment,{children:[(0,eO.jsx)(es,{title:"上传文件",children:(0,eO.jsx)(P,{className:"attach-upload",onClick:()=>A(!0),disabled:r||a,children:(0,eO.jsx)(th,{type:"icon-paper-clip"})})}),(0,eO.jsx)(tD,{open:N,onCancel:()=>A(!1),onOk:D,allowedExtensions:tT,allowedMimeTypes:tE})]})]}),(0,eO.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6},children:[!E&&(0,eO.jsx)("div",{className:"tips",children:"按 Enter 发送,Shift+Enter 换行"}),(0,eO.jsx)("a",{className:`send-btn ${!a&&(null==w?void 0:w.length)>0?"send-btn-active":""}`,onClick:B,children:(0,eO.jsx)(O,{})})]})]})]})})}),tR=t.div`
|
|
364
364
|
width: 100%;
|
|
365
365
|
padding: 0 12px;
|
|
366
366
|
border-bottom: solid 1px #e8e8e8;
|
|
@@ -417,7 +417,7 @@ import*as e from"react";import t,{css as l}from"styled-components";import{AlignC
|
|
|
417
417
|
.conversation-list li small {
|
|
418
418
|
white-space: nowrap;
|
|
419
419
|
}
|
|
420
|
-
`,tM=[],t_="bi-design",t$=e=>{let t,l,n,r,a,i,o,{agentList:s=tM,headExtra:d,style:u={},onEffect:p}=e,{pageId:x,schema:m,fetch:h,atItems:g,onRemoveAtItem:v,clearAtItems:j}=(0,eA.useContext)(
|
|
420
|
+
`,tM=[],t_="bi-design",t$=e=>{let t,l,n,r,a,i,o,{agentList:s=tM,headExtra:d,style:u={},onEffect:p}=e,{pageId:x,schema:m,fetch:h,atItems:g,onRemoveAtItem:v,clearAtItems:j}=(0,eA.useContext)(eE);if(!h)return null;let[y,w]=(0,eA.useState)(null),[C,S]=(0,eA.useState)([]),[k,z]=(0,eA.useState)([]),I=eA.default.useRef(null),N=()=>{setTimeout(()=>{I.current&&I.current.scrollToBottom()},100)},O=()=>{w(null),z([])},A=async e=>{q.confirm({title:"确认删除该对话吗?",okText:"确认",cancelText:"取消",onOk:async()=>{var t;await (null==(t=h.ai)?void 0:t.removeConversation(e)),S(t=>t.filter(t=>t.id!==e)),z(t=>t.filter(t=>t.conversationId!==e)),y===e&&O()}})},E=async e=>{var t,l,n;w(e),S(t=>t.map(t=>({...t,isActived:t.id===e}))),await (null==(l=h.ai)||null==(t=l.activateConversation)?void 0:t.call(l,e)),z(await (null==(n=h.ai)?void 0:n.messageList(e))||[]),N()},T=async e=>{var t;let l={id:ef(),question:e.message,createdAt:new Date().toISOString(),files:e.files||[],agents:e.agents||[],atItems:JSON.stringify(g),sending:!0};z(e=>[...e,l]),N();let n=!y;j();let{id:r,answer:a,createdAt:i,conversation:o}=await (null==(t=h.ai)?void 0:t.chat(t_,x,y,{...e,page:m,pageItems:g||[]}));w((null==o?void 0:o.id)||""),S(e=>[n?o||{}:null,...e].filter(e=>null!==e)),Object.assign(l,{id:r,answer:a,createdAt:i,conversationId:(null==o?void 0:o.id)||"",sending:!1}),a.effect&&(null==p||p(a.effect)),z(e=>[...e]),N()},D=async e=>{var t;await (null==(t=h.ai)?void 0:t.removeMessage(e)),z(t=>t.filter(t=>t.id!==e))},B=(t=new Date,l=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),(n=new Date(t)).setDate(t.getDate()-1),r=[],a=[],i=[],o=[],C.forEach(e=>{let s=new Date(e.createdAt);if(l(s,t))r.push(e);else if(l(s,n))a.push(e);else s.getFullYear()===t.getFullYear()&&s.getMonth()===t.getMonth()?i.push(e):o.push(e)}),[{title:"今天",items:r},{title:"昨天",items:a},{title:"本月内",items:i},{title:"很久以前",items:o}].filter(e=>e.items.length>0)),R=async()=>{try{var e,t;let l=await (null==(e=h.ai)?void 0:e.conversationList(t_,x));S(l||[]);let n=null==l?void 0:l.find(e=>e.isActived);if(n){w(n.id);let e=await (null==(t=h.ai)?void 0:t.messageList(n.id));z(e||[]),N()}}catch(e){console.error(e)}};return(0,eA.useEffect)(()=>{R()},[h]),(0,eA.useEffect)(()=>{N()},[]),(0,eO.jsxs)(tP,{style:u,children:[(0,eO.jsx)(tL,{title:"智能助理",extra:(0,eO.jsxs)(en,{children:[(0,eO.jsx)(es,{title:"新对话",placement:"topRight",children:(0,eO.jsx)("a",{onClick:O,children:(0,eO.jsx)(th,{type:"icon-chat-plus"})})}),(0,eO.jsx)(J,{trigger:["click"],styles:{root:{boxShadow:"var(--ant-box-shadow-drawer-up)",backgroundColor:"#ffffff",borderRadius:"var(--ant-border-radius)"}},popupRender:()=>(0,eO.jsx)(tH,{children:B.map(e=>(0,eO.jsxs)("div",{className:"group",children:[(0,eO.jsx)("div",{className:"group-title",children:e.title}),(0,eO.jsx)("ul",{className:"group-list",children:e.items.map(e=>(0,eO.jsxs)("li",{className:e.isActived?"actived":"",children:[(0,eO.jsx)("a",{onClick:()=>E(e.id),children:e.name}),(0,eO.jsx)("small",{children:(0,eO.jsx)("a",{onClick:()=>A(e.id),children:(0,eO.jsx)(c,{})})})]},e.id))})]},e.title))}),placement:"topRight",children:(0,eO.jsx)("a",{children:(0,eO.jsx)(f,{})})}),d]}),style:{width:"initial"}}),(0,eO.jsxs)("div",{className:"body",children:[(0,eO.jsx)("div",{style:{flex:"1 1 auto",overflowY:"auto"},children:k.length?(0,eO.jsx)(tJ,{ref:I,list:k,onDeleteMessage:D}):(0,eO.jsx)(tY,{})}),0===k.length&&C.length>0&&(0,eO.jsx)(M,{title:"历史记录",size:"small",variant:"borderless",styles:{header:{padding:0,border:"none"},body:{padding:0}},style:{padding:"12px 12px 0 12px"},children:(0,eO.jsx)("ul",{className:"conversation-list",children:C.slice(0,3).map(e=>(0,eO.jsxs)("li",{children:[(0,eO.jsxs)("a",{children:[(0,eO.jsx)(b,{}),e.name]}),(0,eO.jsx)("small",{children:tz(e.createdAt)})]},e.id))})}),(0,eO.jsx)(tB,{agentList:s,style:{padding:12},atItems:g,onUploading:null==h?void 0:h.upload,onSubmit:T,onRemoveAtItem:v})]})]})},tF=t.div`
|
|
421
421
|
flex: 1 1 auto;
|
|
422
422
|
display: flex;
|
|
423
423
|
align-items: center;
|
|
@@ -671,7 +671,7 @@ import*as e from"react";import t,{css as l}from"styled-components";import{AlignC
|
|
|
671
671
|
font-size: 16px;
|
|
672
672
|
color: var(--ant-color-text-secondary);
|
|
673
673
|
}
|
|
674
|
-
`,tW=e=>{let{}=e,{schema:t,selectedItem:l,setSelectedItem:n,plugins:r,forceUpdate:a}=(0,eA.useContext)(
|
|
674
|
+
`,tW=e=>{let{}=e,{schema:t,selectedItem:l,setSelectedItem:n,plugins:r,forceUpdate:a}=(0,eA.useContext)(eE),i=(0,eA.useMemo)(()=>(r||[]).reduce((e,t)=>(e[t.key]=t,e),{}),[r]),s=(0,eA.useMemo)(()=>{let e=[],l=t=>{Array.isArray(t)&&t.forEach(t=>{e.push(t),Array.isArray(t.children)?l(t.children):"object"==typeof t.children&&t.children&&Object.keys(t.children).forEach(e=>l(t.children[e]))})};return l((null==t?void 0:t.items)||[]),e},[t]),d=(0,eA.useMemo)(()=>s.reduce((e,t)=>(t.id&&(e[t.id]=t),e),{}),[s]),u=e=>{l&&(n(Object.assign(l,{cascadeIds:e})),a())};return(0,eO.jsxs)(tK,{className:"cascade-panel",children:[(0,eO.jsx)(tL,{title:"联动",extra:(null==l?void 0:l.cascadeIds)?(0,eO.jsx)(en,{children:(0,eO.jsx)(J,{menu:{onClick:e=>{let{key:t}=e,n=[...(null==l?void 0:l.cascadeIds)||[]];n.push(String(t)),u&&u(n)},items:s.map(e=>{var t,l;return{key:e.id,label:(0,eO.jsxs)("a",{children:[(0,eO.jsx)(th,{type:null==(t=i[e.type])?void 0:t.icon})," ",e.name||(null==(l=i[e.type])?void 0:l.label)," (",e.id,")"]})}})},placement:"bottomLeft",trigger:["click"],children:(0,eO.jsxs)("a",{className:"toolbar",children:[(0,eO.jsx)(C,{}),(0,eO.jsx)(o,{style:{fontSize:8,verticalAlign:"sub"}})]})})}):null}),(0,eO.jsx)("div",{className:"body beautified_scrollbar",children:(null==l?void 0:l.cascadeIds)&&(0,eO.jsx)("ul",{children:(l.cascadeIds||[]).map((e,t)=>{var n,r,a,o,s;return(0,eO.jsxs)("li",{children:[(0,eO.jsxs)("div",{children:[(0,eO.jsx)(th,{type:null==(n=i[null==(r=d[e])?void 0:r.type])?void 0:n.icon})," ",(null==(a=d[e])?void 0:a.name)||(null==(o=i[null==(s=d[e])?void 0:s.type])?void 0:o.label)," (",e,")"]}),(0,eO.jsx)(V,{title:"确认删除吗?",okText:"确认",cancelText:"取消",onConfirm:()=>{let e=[...l.cascadeIds||[]];e.splice(t,1),u&&u(e)},children:(0,eO.jsx)("a",{children:(0,eO.jsx)(c,{})})})]},e)})})})]})};var tU=ey(965),tq=ey.n(tU);let tX=()=>{let{schema:e}=(0,eA.useContext)(eE),t=(0,eA.useMemo)(()=>JSON.stringify(e||{},null,2),[e]);return(0,eO.jsxs)("div",{className:"code-panel",style:{display:"flex",flexDirection:"column",height:"100%"},children:[(0,eO.jsx)(tL,{title:"代码",extra:(0,eO.jsx)(en,{children:(0,eO.jsx)(es,{title:"复制到剪切板",children:(0,eO.jsx)("a",{className:"toolbar",onClick:()=>{tq()(t||"")&&ep.success("复制成功")},children:(0,eO.jsx)(d,{})})})})}),(0,eO.jsx)("div",{className:"body",style:{flex:"1 1 auto",display:"flex"},children:(0,eO.jsx)(em,{height:"100%",defaultLanguage:"json",value:t,options:{lineNumbers:"off",readOnly:!0,minimap:{enabled:!1}}})})]})},tV=t.div`
|
|
675
675
|
display: flex;
|
|
676
676
|
flex-direction: column;
|
|
677
677
|
height: 100%;
|
|
@@ -713,7 +713,7 @@ import*as e from"react";import t,{css as l}from"styled-components";import{AlignC
|
|
|
713
713
|
overflow: hidden;
|
|
714
714
|
font-size: 12px;
|
|
715
715
|
}
|
|
716
|
-
`,tQ=e=>{let{plugin:t}=e,l=(0,eA.useRef)(null);return(0,eA.useEffect)(()=>{let e=l.current;if(!e)return;let n=tx({element:e,getInitialData:()=>{let e={id:ef(),type:t.key,name:t.label,...JSON.parse(JSON.stringify(t.defaultOptions||{}))};return{id:e.id,data:e}},canDrag:()=>!0,onDragStart:()=>{},onDrop:()=>{}});return()=>n()},[]),(0,eO.jsxs)("div",{className:"plugin drag-move",ref:l,children:[(0,eO.jsx)(th,{className:"icon",type:t.icon}),(0,eO.jsx)("div",{className:"label",children:t.label})]})},tZ=()=>{let{plugins:e}=(0,eA.useContext)(
|
|
716
|
+
`,tQ=e=>{let{plugin:t}=e,l=(0,eA.useRef)(null);return(0,eA.useEffect)(()=>{let e=l.current;if(!e)return;let n=tx({element:e,getInitialData:()=>{let e={id:ef(),type:t.key,name:t.label,...JSON.parse(JSON.stringify(t.defaultOptions||{}))};return{id:e.id,data:e}},canDrag:()=>!0,onDragStart:()=>{},onDrop:()=>{}});return()=>n()},[]),(0,eO.jsxs)("div",{className:"plugin drag-move",ref:l,children:[(0,eO.jsx)(th,{className:"icon",type:t.icon}),(0,eO.jsx)("div",{className:"label",children:t.label})]})},tZ=()=>{let{plugins:e}=(0,eA.useContext)(eE),t=(0,eA.useMemo)(()=>{let t=[];return e.forEach(e=>{let l=t.find(t=>t.group===e.group);l?l.items.push(e):t.push({group:e.group,items:[e]})}),t},[e]);return(0,eO.jsxs)(tV,{className:"component-panel",children:[(0,eO.jsx)(tL,{title:"组件库"}),(0,eO.jsx)("div",{className:"body beautified_scrollbar",children:t.map(e=>(0,eO.jsxs)("div",{className:"plugin-group",children:[(0,eO.jsx)("div",{className:"group-title",children:e.group}),(0,eO.jsx)("div",{className:"plugin-list",children:e.items.map(e=>(0,eO.jsx)(tQ,{plugin:e},e.key))})]},e.group))})]})},t0=t.div`
|
|
717
717
|
display: flex;
|
|
718
718
|
flex-direction: column;
|
|
719
719
|
height: 100%;
|
|
@@ -750,7 +750,7 @@ import*as e from"react";import t,{css as l}from"styled-components";import{AlignC
|
|
|
750
750
|
.margin-bottom-0 {
|
|
751
751
|
margin-bottom: 0;
|
|
752
752
|
}
|
|
753
|
-
`,t1=()=>{let{schema:e,setSchema:t}=(0,eA.useContext)(
|
|
753
|
+
`,t1=()=>{let{schema:e,setSchema:t}=(0,eA.useContext)(eE),[l,n]=(0,eA.useState)(!1),[r,a]=(0,eA.useState)(!1),[i,s]=(0,eA.useState)(-1),[d,u]=(0,eA.useState)({id:ef(),type:"api",name:"",url:"",method:"GET",headers:[],formData:[],body:""}),[x,m]=(0,eA.useState)({id:ef(),type:"sql",name:"",query:""}),h=(0,eA.useMemo)(()=>e.datasources,[e.datasources]),f=l=>{t({...e,datasources:l})},g=[{title:"键",dataIndex:"name",render:(e,t,l)=>(0,eO.jsx)(W,{size:"small",value:t.name,onChange:e=>{let t=[...d.headers];t[l]={...t[l],name:e.target.value},u({...d,headers:t})}})},{title:"值",dataIndex:"value",render:(e,t,l)=>(0,eO.jsx)(W,{size:"small",value:t.value,onChange:e=>{let t=[...d.headers];t[l]={...t[l],value:e.target.value},u({...d,headers:t})}})},{title:"操作",width:50,align:"center",render:(e,t,l)=>(0,eO.jsx)(en,{children:(0,eO.jsx)("a",{onClick:()=>{let e=[...d.headers];e.splice(l,1),u({...d,headers:e})},children:(0,eO.jsx)(c,{})})})}];return(0,eO.jsxs)(t0,{className:"datasource-panel",children:[(0,eO.jsx)(tL,{title:"数据源",extra:(0,eO.jsx)(en,{children:(0,eO.jsx)(J,{menu:{onClick:e=>{let{key:t}=e;"api"===t?(s(-1),u({id:ef(),type:"api",name:"",url:"",method:"GET",headers:[],formData:[],body:""}),n(!0)):(s(-1),m({id:ef(),type:"sql",name:"",query:""}),a(!0))},items:[{key:"api",label:(0,eO.jsx)("a",{children:"API接口"})},{key:"sql",label:(0,eO.jsx)("a",{children:"SQL查询"})}]},placement:"bottom",children:(0,eO.jsxs)("a",{className:"toolbar",children:[(0,eO.jsx)(C,{}),(0,eO.jsx)(o,{style:{fontSize:8,verticalAlign:"sub"}})]})})})}),(0,eO.jsx)("div",{className:"body beautified_scrollbar",children:(0,eO.jsx)("ul",{children:h.map((e,t)=>(0,eO.jsxs)("li",{children:[(0,eO.jsxs)("div",{title:e.name,children:[(0,eO.jsx)(th,{type:"icon-drag"})," ",e.name]}),(0,eO.jsxs)(en,{children:[(0,eO.jsx)("a",{onClick:()=>{s(t),"api"===e.type?(u({...e}),n(!0)):(m({...e}),a(!0))},children:(0,eO.jsx)(p,{})}),(0,eO.jsx)(V,{title:"确认删除吗?",okText:"确认",cancelText:"取消",onConfirm:()=>{let e;(e=[...h]).splice(t,1),f&&f(e)},children:(0,eO.jsx)("a",{children:(0,eO.jsx)(c,{})})})]})]},e.id))})}),(0,eO.jsx)(q,{title:"添加API接口",open:l,width:600,styles:{body:{maxHeight:"calc(100vh - 250px)",overflow:"auto"}},onCancel:()=>n(!1),footer:(0,eO.jsxs)(en,{children:[(0,eO.jsx)(P,{type:"primary",onClick:()=>{if(!d.name||!d.url)return;let e=[...h];-1===i?e.push(d):e[i]=d,f&&f(e),n(!1)},children:"确定"}),(0,eO.jsx)(P,{onClick:()=>n(!1),children:"取消"})]}),children:(0,eO.jsxs)(K,{labelCol:{span:24},wrapperCol:{span:24},children:[(0,eO.jsx)(K.Item,{label:"接口名称",required:!0,children:(0,eO.jsx)(W,{value:d.name,onChange:e=>u({...d,name:e.target.value})})}),(0,eO.jsx)(K.Item,{label:"接口URL",required:!0,children:(0,eO.jsx)(W,{value:d.url,onChange:e=>u({...d,url:e.target.value})})}),(0,eO.jsx)(K.Item,{label:"请求方法",children:(0,eO.jsxs)(Z.Group,{value:d.method,onChange:e=>u({...d,method:e.target.value}),children:[(0,eO.jsx)(Z.Button,{value:"GET",children:"GET"}),(0,eO.jsx)(Z.Button,{value:"POST",children:"POST"}),(0,eO.jsx)(Z.Button,{value:"PUT",children:"PUT"}),(0,eO.jsx)(Z.Button,{value:"DELETE",children:"DELETE"})]})}),(0,eO.jsx)("label",{style:{display:"block",color:"#000000d9",padding:"8px 0"},children:"请求头"}),(0,eO.jsx)(ea,{columns:g,dataSource:d.headers,pagination:!1,locale:{emptyText:"暂无数据"},size:"small",bordered:!0,rowKey:(e,t)=>String(t)}),(0,eO.jsx)(P,{size:"small",block:!0,onClick:()=>u({...d,headers:[...d.headers,{name:"",value:""}]}),children:"添加"}),(0,eO.jsx)("label",{style:{display:"block",color:"#000000d9",padding:"8px 0"},children:"表单数据"}),(0,eO.jsx)(ea,{columns:g,dataSource:d.formData,pagination:!1,locale:{emptyText:"暂无数据"},size:"small",bordered:!0,rowKey:(e,t)=>`f-${t}`}),(0,eO.jsx)(P,{size:"small",block:!0,onClick:()=>u({...d,formData:[...d.formData,{name:"",value:""}]}),children:"添加"}),(0,eO.jsx)(K.Item,{label:"请求体",children:(0,eO.jsx)("div",{style:{border:"1px solid var(--ant-color-border)",borderRadius:"var(--ant-border-radius)",padding:1},children:(0,eO.jsx)(em,{height:"300px",defaultLanguage:"json",value:d.body,onChange:e=>u({...d,body:e||""}),options:{minimap:{enabled:!1},scrollBeyondLastLine:!1,tabSize:2}})})})]})}),(0,eO.jsx)(q,{title:"添加SQL查询",open:r,width:600,styles:{body:{maxHeight:"calc(100vh - 250px)",overflow:"auto"}},onCancel:()=>a(!1),footer:(0,eO.jsxs)(en,{children:[(0,eO.jsx)(P,{type:"primary",onClick:()=>{if(!x.name||!x.query)return;let e=[...h];-1===i?e.push(x):e[i]=x,f&&f(e),a(!1)},children:"确定"}),(0,eO.jsx)(P,{onClick:()=>a(!1),children:"取消"})]}),children:(0,eO.jsxs)(K,{layout:"vertical",children:[(0,eO.jsx)(K.Item,{label:"查询名称",required:!0,children:(0,eO.jsx)(W,{value:x.name,onChange:e=>m({...x,name:e.target.value})})}),(0,eO.jsx)(K.Item,{label:"查询语句",required:!0,children:(0,eO.jsx)("div",{style:{border:"1px solid var(--ant-color-border)",borderRadius:"var(--ant-border-radius)",padding:1},children:(0,eO.jsx)(em,{height:"300px",defaultLanguage:"sql",value:x.query,onChange:e=>m({...x,query:e||""}),options:{minimap:{enabled:!1},scrollBeyondLastLine:!1,tabSize:2}})})})]})})]})},t2=t.div`
|
|
754
754
|
display: flex;
|
|
755
755
|
flex-direction: column;
|
|
756
756
|
height: 100%;
|
|
@@ -772,7 +772,7 @@ import*as e from"react";import t,{css as l}from"styled-components";import{AlignC
|
|
|
772
772
|
overflow: hidden;
|
|
773
773
|
text-overflow: ellipsis;
|
|
774
774
|
}
|
|
775
|
-
`,t8=()=>{let{schema:e,setSchema:t,selectedItem:l,setSelectedItem:n,plugins:r}=(0,eA.useContext)(
|
|
775
|
+
`,t8=()=>{let{schema:e,setSchema:t,selectedItem:l,setSelectedItem:n,plugins:r}=(0,eA.useContext)(eE),[a,i]=(0,eA.useState)([]),o=(0,eA.useMemo)(()=>l?[l.id]:[],[l]),s=(0,eA.useMemo)(()=>{let t=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.map(e=>{let l,{id:n,type:r,children:a}=e;return Array.isArray(a)?l=t(a):"object"==typeof a&&a&&(l=[],Object.keys(a).forEach(e=>{Array.isArray(a[e])&&l.push({key:ef(),type:"slot",title:"插槽-"+e,slot:e,origin:a,children:t(a[e])})})),{key:n,title:e.name,item:e,type:r,children:l}})};return t(e.items)},[e]),d=(0,eA.useMemo)(()=>{let e=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return t.map(t=>{var l,n,a;return{key:t.key,title:(0,eO.jsx)(eO.Fragment,{children:(null==t?void 0:t.title)||(l=t.type,n=t.slot,"slot"===l?"插槽-"+n:(null==(a=r.find(e=>e.key===l))?void 0:a.label)||l)}),children:t.children?e(t.children):void 0,dataRef:t}})};return e(s)},[s]);return(0,eO.jsxs)(t2,{className:"layer-panel",children:[(0,eO.jsx)(tL,{title:"图层",extra:(0,eO.jsxs)(en,{children:[(0,eO.jsx)(es,{title:"全部展开",children:(0,eO.jsx)("a",{className:"toolbar",onClick:()=>{let t=[],l=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];e.forEach(e=>{var n;t.push(e.id),(null==(n=e.children)?void 0:n.length)&&l(e.children)})};l(e.items),i(t)},children:(0,eO.jsx)(S,{})})}),(0,eO.jsx)(es,{title:"全部收起",children:(0,eO.jsx)("a",{className:"toolbar",onClick:()=>i([]),children:(0,eO.jsx)(y,{})})})]})}),(0,eO.jsx)("div",{className:"body beautified_scrollbar",children:(0,eO.jsx)(t4,{draggable:{icon:!1,nodeDraggable:e=>!1},showIcon:!1,showLine:{showLeafIcon:!1},treeData:d,selectedKeys:o,expandedKeys:a,onSelect:(e,t)=>{"slot"!==t.node.dataRef.type&&n&&n(t.node.dataRef.item)},onDrop:l=>{let n;if(!(e=>{let t=e.node,l=e.dragNode;if("slot"===l.dataRef.type||!e.dropToGap&&!["b-row","b-col","b-card","slot"].includes(t.dataRef.type))return!1;if("b-col"===l.dataRef.type)if(!e.dropToGap)return"b-row"===t.dataRef.type;else return"b-col"===t.dataRef.type;return("b-col"!==t.dataRef.type||!e.dropToGap)&&("b-row"!==t.dataRef.type||!!e.dropToGap)||"b-col"===l.dataRef.type})(l))return;let r=l.node.key,a=l.dragNode.key,i=l.node.pos.split("-"),o=l.dropPosition-Number(i[i.length-1]),s=(e,t,l)=>{e.forEach((e,n,r)=>{if(e.id===t)return(e.children=e.children||[],"slot"===e.type)?l(e,n,r,e.children[e.slot]):l(e,n,r,e.children);if(Array.isArray(e.children))return s(e.children,t,l);if("object"==typeof e.children)for(let n in e.children)Array.isArray(e.children[n])&&s(e.children[n],t,l)})},d=e.items;if(s(d,a,(e,t,l)=>{l.splice(t,1),n=e}),l.dropToGap)if((l.node.children||[]).length>0&&l.node.expanded&&1===o)s(d,r,(e,t,l)=>{e.children=e.children||[],e.children.unshift(n)});else{let e=[],t=0;s(d,r,(l,n,r)=>{e=r,t=n}),-1===o?e.splice(t,0,n):e.splice(t+1,0,n)}else{if("slot"===l.node.dataRef.type){let{slot:e,origin:t}=l.node.dataRef;t[e]=t[e]||[],t[e].push(n)}s(d,r,e=>{e.children=e.children||[],e.children.push(n)})}t&&t({...e,items:d})},onExpand:e=>i(e)})})]})},t6=t.div`
|
|
776
776
|
display: flex;
|
|
777
777
|
flex-direction: column;
|
|
778
778
|
height: 100%;
|
|
@@ -802,7 +802,7 @@ import*as e from"react";import t,{css as l}from"styled-components";import{AlignC
|
|
|
802
802
|
margin: 0;
|
|
803
803
|
}
|
|
804
804
|
}
|
|
805
|
-
`,t5=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=[],l=e=>{Array.isArray(e)&&e.forEach(e=>{t.push(e),Array.isArray(e.children)?l(e.children):"object"==typeof e.children&&e.children&&Object.keys(e.children).forEach(t=>l(e.children[t]))})};return l(e||[]),t},t9=e=>{var t,l,n,r,a,i,o;let{datasourceEnable:d=!0}=e,{plugins:u,selectedItem:p,updateSelectedItem:x,schema:m,setSchema:h,datasetSelector:f,datasetAdd:g}=(0,eA.useContext)(
|
|
805
|
+
`,t5=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=[],l=e=>{Array.isArray(e)&&e.forEach(e=>{t.push(e),Array.isArray(e.children)?l(e.children):"object"==typeof e.children&&e.children&&Object.keys(e.children).forEach(t=>l(e.children[t]))})};return l(e||[]),t},t9=e=>{var t,l,n,r,a,i,o;let{datasourceEnable:d=!0}=e,{plugins:u,selectedItem:p,updateSelectedItem:x,schema:m,setSchema:h,datasetSelector:f,datasetAdd:g}=(0,eA.useContext)(eE),j=(0,eA.useRef)(null),[b,y]=(0,eA.useState)("1"),w=(0,eA.useMemo)(()=>t5((null==m?void 0:m.items)||[]),[m]),S=(0,eA.useMemo)(()=>p&&w.find(e=>e.id===p.id),[w,p]),k=S?b:"1",z=(0,eA.useMemo)(()=>u.find(e=>e.key===(null==p?void 0:p.type)),[u,p]),I=null==z?void 0:z.formComponent,O=(null==p?void 0:p.props)||{},A=(null==p?void 0:p.style)||{},[E,T]=(0,eA.useState)((null==m?void 0:m.info)||{}),[D,B]=(0,eA.useState)((null==p?void 0:p.datasource)||{}),[R,L]=(0,eA.useState)(!1),[M,_]=(0,eA.useState)(!1),$=e=>{h({...m,info:e})},F={Authorization:`Bearer ${localStorage.getItem("ASKDATA_TOKEN")||""}`};return eA.default.useEffect(()=>{y(p?"2":"1"),B((null==p?void 0:p.datasource)||{})},[p]),(0,eO.jsxs)(t6,{className:"properties-panel",children:[(0,eO.jsx)(tL,{title:"属性",extra:(0,eO.jsxs)(Z.Group,{value:k,size:"small",buttonStyle:"outline",onChange:e=>y(e.target.value),children:[(0,eO.jsx)(Z.Button,{value:"1",children:"页面"}),S&&(0,eO.jsx)(Z.Button,{value:"2",children:"组件"})]})}),(0,eO.jsxs)("div",{className:"body beautified_scrollbar always",children:["1"===k&&(0,eO.jsxs)(K,{labelCol:{span:24},wrapperCol:{span:24},className:"ant-form-compact",children:[(0,eO.jsx)(K.Item,{label:"页面名称",children:(0,eO.jsx)(W,{size:"small",value:null==E?void 0:E.name,placeholder:"请输入页面名称",onChange:e=>{let t={...E,name:e.target.value};T(t),$&&$(t)}})}),(0,eO.jsx)(K.Item,{label:"页面描述",children:(0,eO.jsx)(W.TextArea,{size:"small",value:null==E?void 0:E.description,placeholder:"请输入页面描述",onChange:e=>{let t={...E,description:e.target.value};T(t),$&&$(t)}})}),(0,eO.jsxs)(K.Item,{label:"封面",children:[(0,eO.jsxs)(eu.Dragger,{name:"file",multiple:!1,accept:".png,.jpg,.jpeg",headers:F,action:"/api/datareport/upload",showUploadList:!1,beforeUpload:e=>e.type.startsWith("image/"),onChange:e=>{if("done"===e.file.status){var t;let l={url:null==(t=e.file.response)?void 0:t.data,name:e.file.name},n={...E,cover:l};T(n),$&&$(n)}},children:[(0,eO.jsx)("p",{className:"ant-upload-drag-icon",children:(0,eO.jsx)(v,{})}),(0,eO.jsx)("p",{className:"ant-upload-text",children:"点击或将文件拖拽到此区域进行上传"}),(0,eO.jsx)("p",{className:"ant-upload-hint",children:"严禁上传公司数据或其他被禁止的文件。"})]}),(null==E||null==(t=E.cover)?void 0:t.url)&&(0,eO.jsxs)("div",{style:{marginTop:10,textAlign:"left"},children:[(0,eO.jsxs)("div",{style:{display:"flex",justifyContent:"space-between"},children:[(0,eO.jsx)("label",{children:"封面预览"}),(0,eO.jsx)("a",{onClick:()=>{let e={...E,cover:null};T(e),$&&$(e)},children:(0,eO.jsx)(c,{})})]}),(0,eO.jsx)("img",{src:E.cover.url,style:{width:"100%",maxHeight:200}})]})]})]}),"2"===k&&(0,eO.jsxs)(eO.Fragment,{children:[(0,eO.jsx)(H,{children:"基础属性"}),(0,eO.jsxs)(K,{labelCol:{span:24},wrapperCol:{span:24},className:"ant-form-compact",children:[(0,eO.jsx)(K.Item,{label:"组件标识",labelCol:{span:5},wrapperCol:{span:19},children:(null==p?void 0:p.id)||""}),(0,eO.jsx)(K.Item,{label:"组件名称",children:(0,eO.jsx)(W,{size:"small",value:null==p?void 0:p.name,onChange:e=>x&&x({...p,name:e.target.value})})}),(0,eO.jsx)(K.Item,{label:"组件描述",children:(0,eO.jsx)(W.TextArea,{size:"small",value:null==p?void 0:p.description,onChange:e=>x&&x({...p,description:e.target.value})})})]}),(null==p?void 0:p.datasource)&&(0,eO.jsx)(H,{children:"数据源"}),(null==p?void 0:p.datasource)&&(0,eO.jsxs)(K,{className:"ant-form-compact",children:[(0,eO.jsx)(K.Item,{label:(0,eO.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:"数据来源"}),labelCol:{span:5},wrapperCol:{span:19},colon:!1,children:(0,eO.jsxs)(Z.Group,{size:"small",value:null==D?void 0:D.source,onChange:e=>{let t={...D||{},source:e.target.value};B(t),x&&x({...p,datasource:t})},children:[!!f&&(0,eO.jsx)(Z.Button,{value:"dataset",children:"数据集"}),d&&(0,eO.jsx)(Z.Button,{value:"define",children:"数据源"}),(0,eO.jsx)(Z.Button,{value:"custom",children:"自定义"})]})}),(null==D?void 0:D.source)==="dataset"&&f&&(0,eO.jsx)(eO.Fragment,{children:(0,eO.jsx)(K.Item,{label:"数据集",labelCol:{span:5},wrapperCol:{span:19},children:(0,eO.jsxs)(en.Compact,{children:[(0,eO.jsx)(W,{size:"small",readOnly:!0,value:(null==D||null==(l=D.dataset)?void 0:l.name)||"",style:{width:90}}),!!(null==D||null==(r=D.dataset)||null==(n=r.id)?void 0:n.length)&&(null==D||null==(a=D.dataset)?void 0:a.output)&&(0,eO.jsx)(Q,{title:"输出类型",placement:"left",content:(0,eO.jsx)("div",{style:{padding:"0 12px",maxWidth:500,maxHeight:500,overflow:"auto"},children:(0,eO.jsx)(t3,{output:D.dataset.output})}),children:(0,eO.jsx)(P,{size:"small",style:{color:"var(--ant-color-text-tertiary)"},title:"查看输出类型",children:(0,eO.jsx)(th,{type:"icon-json"})})}),!!(null==D||null==(o=D.dataset)||null==(i=o.id)?void 0:i.length)&&(0,eO.jsx)(P,{size:"small",icon:(0,eO.jsx)(s,{}),onClick:()=>{let e={...D||{},dataset:{id:"",name:"",output:{fields:[]}}};B(e),x&&x({...p,datasource:e})},title:"删除数据集",style:{color:"var(--ant-color-text-tertiary)"}}),g&&(0,eO.jsx)(P,{size:"small",icon:(0,eO.jsx)(C,{}),title:"新建数据集",onClick:()=>_(!0)}),(0,eO.jsx)(P,{size:"small",icon:(0,eO.jsx)(N,{}),title:"选择数据集",onClick:()=>L(!0)})]})})}),(null==D?void 0:D.source)==="define"&&(0,eO.jsxs)(eO.Fragment,{children:[(0,eO.jsx)(K.Item,{label:"数据源",layout:"vertical",children:(0,eO.jsx)(et,{size:"small",value:null==D?void 0:D.datasourceId,onChange:e=>{let t={...D||{},datasourceId:e};B(t),x&&x({...p,datasource:t})},children:((null==m?void 0:m.datasources)||[]).map(e=>(0,eO.jsx)(et.Option,{value:e.id,children:e.name},e.id))})}),(0,eO.jsx)(K.Item,{label:"数据处理脚本",labelCol:{span:24},wrapperCol:{span:24},children:(0,eO.jsx)(et,{size:"small",value:null==D?void 0:D.scriptId,onChange:e=>{let t={...D||{},scriptId:e};B(t),x&&x({...p,datasource:t})},children:((null==m?void 0:m.scripts)||[]).map(e=>(0,eO.jsx)(et.Option,{value:e.id,children:e.name},e.id))})})]}),(null==D?void 0:D.source)==="custom"&&(0,eO.jsx)(eO.Fragment,{children:(0,eO.jsx)(K.Item,{label:(0,eO.jsxs)(eO.Fragment,{children:["自定义",(0,eO.jsxs)("a",{onClick:()=>{var e,t;let l=null==(e=j.current)?void 0:e.editor;null==l||null==(t=l.getAction("editor.action.formatDocument"))||t.run()},children:[(0,eO.jsx)(th,{type:"icon-formate"})," 格式化"]})]}),labelCol:{span:24},wrapperCol:{span:24},className:"ant-form-item-label-space",children:(0,eO.jsx)("div",{style:{border:"1px solid var(--ant-color-border)",borderRadius:"var(--ant-border-radius)",padding:1},children:(0,eO.jsx)(em,{height:"200px",onMount:e=>{j.current={editor:e}},defaultLanguage:"json",value:(null==D?void 0:D.custom)||"",onChange:e=>{let t={...D||{},custom:e||""};B(t),x&&x({...p,datasource:t})},options:{minimap:{enabled:!1},scrollBeyondLastLine:!1,tabSize:2}})})})})]}),I&&(0,eO.jsx)(H,{children:"特有属性"}),I&&(0,eO.jsx)(I,{model:O,customStyle:A,onChange:e=>{p&&x&&x({...p,props:e})}})]})]}),!!f&&p&&(0,eO.jsx)(G,{title:"选择数据集",size:800,open:R,onClose:()=>{L(!1)},children:f(e=>{D.dataset=e,x({...p,datasource:{...p.datasource,dataset:e}}),L(!1)})}),!!g&&p&&M&&g(p,e=>{D.dataset=e,x({...p,datasource:{...p.datasource,dataset:e}}),_(!1)},()=>{_(!1)})]})},t3=e=>{let{output:t}=e,l=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e&&0!==e.length?(0,eO.jsxs)(eO.Fragment,{children:["{",e.map((n,r)=>(0,eO.jsxs)("div",{style:{paddingLeft:"1em"},children:[(0,eO.jsx)("span",{style:{color:"var(--ant-color-primary)"},children:n.key}),":"," ","ARRAY"===n.type?(0,eO.jsxs)(eO.Fragment,{children:["Array","<",n.schema?l(n.schema.fields,t+1):(0,eO.jsx)("span",{children:"any"}),">"]}):"OBJECT"===n.type?n.schema?l(n.schema.fields,t+1):(0,eO.jsx)("span",{children:"{}"}):(0,eO.jsx)("span",{style:{color:"var(--ant-color-success)"},children:(n.type||"string").toLowerCase()}),r<e.length-1?",":""]},n.key||r)),"}"]}):(0,eO.jsx)("span",{children:"{}"})};return(0,eO.jsx)("pre",{style:{margin:"8px 0",padding:"8px",background:"var(--ant-color-fill-alter)",borderRadius:"var(--ant-border-radius-sm)",fontSize:"12px",fontFamily:"monospace",overflowX:"auto",border:"1px solid var(--ant-color-border-secondary)"},children:l(t.fields)})},t7=t.div`
|
|
806
806
|
display: flex;
|
|
807
807
|
flex-direction: column;
|
|
808
808
|
height: 100%;
|
|
@@ -841,7 +841,7 @@ import*as e from"react";import t,{css as l}from"styled-components";import{AlignC
|
|
|
841
841
|
font-size: 14px;
|
|
842
842
|
padding: 0 50px;
|
|
843
843
|
}
|
|
844
|
-
`,le=()=>{let{schema:e,setSchema:t}=(0,eA.useContext)(
|
|
844
|
+
`,le=()=>{let{schema:e,setSchema:t}=(0,eA.useContext)(eE),[l,n]=eA.default.useState(!1),[r,a]=eA.default.useState(-1),[i]=K.useForm(),o=(0,eA.useMemo)(()=>e.scripts||[],[e]),s=l=>{t({...e,scripts:l})},d=async()=>{let e=await i.validateFields().catch(()=>null);if(!e)return;let t=[...o];-1===r?t.push({id:Math.random().toString(36).slice(2,10),...e}):t[r]={...t[r],...e},s&&s(t),n(!1),a(-1),i.resetFields()};return(0,eO.jsxs)(t7,{className:"script-panel",children:[(0,eO.jsx)(tL,{title:"脚本",extra:(0,eO.jsx)(en,{children:(0,eO.jsx)("a",{className:"toolbar",onClick:()=>{a(-1),i.setFieldsValue({name:"",script:"return {};"}),n(!0)},children:"+"})})}),(0,eO.jsx)("div",{className:"body beautified_scrollbar",children:(0,eO.jsx)("ul",{children:o.map((e,t)=>(0,eO.jsxs)("li",{children:[(0,eO.jsxs)("div",{title:e.name,children:[(0,eO.jsx)(th,{type:"icon-drag"})," ",e.name]}),(0,eO.jsxs)(en,{children:[(0,eO.jsx)("a",{onClick:()=>{a(t),i.setFieldsValue({name:e.name,script:e.script}),n(!0)},children:(0,eO.jsx)(p,{})}),(0,eO.jsx)("a",{onClick:()=>{let e=[...o];e.splice(t,1),s&&s(e)},children:(0,eO.jsx)(c,{})})]})]},e.id||t))})}),(0,eO.jsx)(q,{title:"添加脚本",open:l,width:600,styles:{body:{maxHeight:"calc(100vh - 250px)",overflow:"auto"}},onCancel:()=>n(!1),footer:(0,eO.jsxs)(en,{children:[(0,eO.jsx)(P,{type:"primary",onClick:d,children:"确定"}),(0,eO.jsx)(P,{onClick:()=>n(!1),children:"取消"})]}),children:(0,eO.jsxs)(K,{form:i,layout:"vertical",children:[(0,eO.jsx)(K.Item,{label:"脚本名称",name:"name",rules:[{required:!0,message:"请输入脚本名称"}],children:(0,eO.jsx)(W,{})}),(0,eO.jsx)(K.Item,{label:"脚本语句",name:"script",rules:[{required:!0,message:"请输入脚本语句"}],children:(0,eO.jsxs)("div",{style:{border:"1px solid #d9d9d9",padding:"0 10px"},children:[(0,eO.jsxs)("div",{className:"function-wrapper",children:["function fixed(data) ","{"]}),(0,eO.jsx)(em,{height:"200px",defaultLanguage:"javascript",value:i.getFieldValue("script"),onChange:e=>i.setFieldsValue({script:e||""}),options:{minimap:{enabled:!1},scrollBeyondLastLine:!1,tabSize:2}}),(0,eO.jsx)("div",{className:"function-wrapper",children:"}"})]})})]})})]})},lt=t.div`
|
|
845
845
|
display: flex;
|
|
846
846
|
flex-direction: column;
|
|
847
847
|
height: 100%;
|
|
@@ -852,7 +852,7 @@ import*as e from"react";import t,{css as l}from"styled-components";import{AlignC
|
|
|
852
852
|
gap: 12px;
|
|
853
853
|
padding: 12px;
|
|
854
854
|
}
|
|
855
|
-
`,ll=()=>{let{schema:e,setSchema:t}=(0,eA.useContext)(
|
|
855
|
+
`,ll=()=>{let{schema:e,setSchema:t}=(0,eA.useContext)(eE),[l,n]=eA.default.useState(!1),[r,a]=eA.default.useState(-1),[i]=K.useForm(),o=(0,eA.useMemo)(()=>e.variables||[],[e.variables]),s=l=>{t({...e,variables:l})},d=[{title:"名称",dataIndex:"name",render:(e,t)=>(0,eO.jsxs)("div",{title:e,children:[(0,eO.jsx)(th,{type:"icon-drag"})," ",e]})},{title:"值",dataIndex:"value"},{title:"操作",width:60,align:"center",render:(e,t,l)=>(0,eO.jsxs)(en,{children:[(0,eO.jsx)("a",{onClick:()=>{a(l),i.setFieldsValue({name:t.name,value:t.value}),n(!0)},children:(0,eO.jsx)(p,{})}),(0,eO.jsx)(V,{title:"确认删除吗?",okText:"确认",cancelText:"取消",onConfirm:()=>{let e=[...o];e.splice(l,1),s&&s(e)},children:(0,eO.jsx)("a",{children:(0,eO.jsx)(c,{})})})]})}],u=async()=>{let e=await i.validateFields().catch(()=>null);if(!e)return;let t=[...o];-1===r?t.push({...e}):t[r]={...t[r],...e},s&&s(t),n(!1),a(-1),i.resetFields()};return(0,eO.jsxs)(lt,{children:[(0,eO.jsx)(tL,{title:"环境变量",extra:(0,eO.jsx)(en,{children:(0,eO.jsx)("a",{className:"toolbar",onClick:()=>{a(-1),i.resetFields(),n(!0)},children:"+"})})}),(0,eO.jsx)("div",{className:"body beautified_scrollbar",children:(0,eO.jsx)(ea,{rowKey:e=>e.id||e.name,dataSource:o,columns:d,pagination:!1,size:"small",locale:{emptyText:"暂无环境变量"}})}),(0,eO.jsx)(q,{title:"添加环境变量",open:l,width:600,styles:{body:{maxHeight:"calc(100vh - 250px)",overflow:"auto"}},onCancel:()=>n(!1),footer:(0,eO.jsxs)(en,{children:[(0,eO.jsx)(P,{type:"primary",onClick:u,children:"确定"}),(0,eO.jsx)(P,{onClick:()=>n(!1),children:"取消"})]}),children:(0,eO.jsxs)(K,{form:i,layout:"vertical",children:[(0,eO.jsx)(K.Item,{label:"环境变量名称",name:"name",rules:[{required:!0,message:"请输入环境变量名称"}],children:(0,eO.jsx)(W,{})}),(0,eO.jsx)(K.Item,{label:"环境变量值",name:"value",rules:[{required:!0,message:"请输入环境变量值"}],children:(0,eO.jsx)(W,{})})]})})]})},ln=t.div`
|
|
856
856
|
display: flex;
|
|
857
857
|
flex-direction: column;
|
|
858
858
|
height: 100%;
|
|
@@ -984,7 +984,7 @@ import*as e from"react";import t,{css as l}from"styled-components";import{AlignC
|
|
|
984
984
|
background: transparent;
|
|
985
985
|
}
|
|
986
986
|
}
|
|
987
|
-
`,li=e=>{let{open:t,onCancel:l,onOk:n}=e,[r,a]=(0,eA.useState)(JSON.stringify({info:{},datasources:[],scripts:[],variables:[],items:[]}));return(0,eO.jsx)(q,{title:"导入页面",open:t,width:800,onCancel:l,onOk:()=>null==n?void 0:n(JSON.parse(r)),okText:"导入",cancelText:"取消",styles:{body:{height:"calc(100vh - 250px)",overflow:"auto"}},children:(0,eO.jsx)("div",{className:"body",style:{flex:"1 1 auto",display:"flex",height:"100%"},children:(0,eO.jsx)(eh,{height:"100%",defaultLanguage:"json",value:r,options:{minimap:{enabled:!1}},onChange:e=>a(e||"")})})})},lo=eA.default.forwardRef((e,t)=>{var l;let n,{pageId:r,agentList:a=[],plugins:i=[],headerExtra:o,datasourceEnable:d=!0,scriptEnable:c=!0,datasetPanel:p,datasetSelector:h,datasetAdd:f,fetch:v,onSave:j,loading:b=!1}=e,y=(0,eA.useRef)(null),C=(0,eA.useRef)(null),[S,z]=(0,eA.useState)(1),[N,O]=(0,eA.useState)([]),[D,R]=(0,eA.useState)([]),[L,M]=(0,eA.useState)(!1),[_,$]=(0,eA.useState)("desktop"),[F,Y]=(0,eA.useState)("component"),[J,K]=(0,eA.useState)((null==v?void 0:v.ai)?"ai":"props"),[W,U]=(0,eA.useState)(!0),[q,X]=(0,eA.useState)(!0),[V,Q]=(0,eA.useState)(null),[ee,et]=(0,eA.useState)({info:{},datasources:[],scripts:[],variables:[],items:[]}),[el,er]=(0,eA.useState)(!0),[ea,ei]=(0,eA.useState)(!1),[eo,ed]=(0,eA.useState)(!1),ec=(0,eA.useMemo)(()=>{let e=W?"250px":"",t=q?"400px":"";return{gridTemplateColumns:`${e} 1fr ${t}`}},[W,q]),eu=(0,eA.useMemo)(()=>({display:W?"flex":"none"}),[W]),ep=(0,eA.useMemo)(()=>({display:q?"flex":"none"}),[q]);l=[ee],(n=(0,eA.useRef)()).current===JSON.stringify(l)&&n.current||(n.current=JSON.stringify(l),(()=>{L||(O(e=>e.length?[...e,JSON.parse(JSON.stringify(ee))].slice(-50):[JSON.parse(JSON.stringify(ee))]),R([]))})()),(0,eA.useImperativeHandle)(t,()=>({handleOpen(e){M(!0),ex(e.items),et(e),O([JSON.parse(JSON.stringify(e))]),R([]),setTimeout(()=>M(!1),0)}}));let ex=(e,t)=>{e&&e.forEach(e=>{e.id||(e.id=t||ef()),Array.isArray(e.children)?ex(e.children):"object"==typeof e.children&&e.children&&Object.keys(e.children).forEach(t=>{Array.isArray(e.children[t])&&ex(e.children[t],ef())})})},em=e=>{var t,l,n;if((null==(t=e.datasets)?void 0:t.length)&&(null==C||null==(l=C.current)?void 0:l.reload)&&C.current.reload(),e.schema){let t=JSON.parse(JSON.stringify(e.schema));ex(t.items),et(t)}else if(null==(n=e.pageItems)?void 0:n.length){let t=new Map(e.pageItems.map(e=>[e.targetId,e])),l=JSON.parse(JSON.stringify(ee)),n=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];e.forEach((l,r)=>{if(t.has(l.id)){let{position:n,insertSlot:d,pageItem:c}=t.get(l.id);switch(n){case"before":e.splice(r,0,c);break;case"after":e.splice(r+1,0,c);break;case"replace":Object.keys(l).forEach(e=>{"id"!==e&&delete l[e]}),Object.assign(l,c);break;case"insert":var a,o,s;let u=i.find(e=>e.key===l.type);Array.isArray(null==u||null==(a=u.defaultOptions)?void 0:a.children)?l.children=[...l.children||[],c]:"object"==typeof(null==u||null==(o=u.defaultOptions)?void 0:o.children)&&d&&(l.children={...l.children||{},[d]:[...(null==(s=l.children)?void 0:s[d])||[],c]})}}Array.isArray(l.children)?n(l.children):"object"==typeof l.children&&l.children&&Object.keys(l.children).forEach(e=>{Array.isArray(l.children[e])&&n(l.children[e])})})};n(l.items),et(l)}},eh=(0,eA.useMemo)(()=>"cascade"!==J||(null==V?void 0:V.cascadeIds)?J:"props",[V,J]);return(0,eO.jsxs)(eD,{pageId:r,designable:el,plugins:i,schema:ee,selectedItem:V,setSchema:et,setSelectedItem:Q,datasetSelector:h,datasetAdd:f,fetch:v,children:[(0,eO.jsxs)("div",{style:{display:"flex",flexDirection:"column",height:"100%"},children:[(0,eO.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 24px",borderBottom:"solid 1px #e8e8e8"},children:[(0,eO.jsxs)(en,{children:[(0,eO.jsx)("span",{style:{fontSize:16,fontWeight:500},children:"创建数据报表"}),(0,eO.jsx)(H,{orientation:"vertical"}),(0,eO.jsx)(es,{title:"保存",children:(0,eO.jsx)(P,{type:"link",className:"toolbar",onClick:()=>{null==j||j(ee)},loading:b,children:(0,eO.jsx)(I,{})})}),(0,eO.jsx)(H,{orientation:"vertical"}),(0,eO.jsx)(es,{title:"撤销",children:(0,eO.jsx)("a",{className:`toolbar ${N.length>1?"active":""}`,onClick:()=>{O(e=>{if(e.length<=1)return e;M(!0);let t=e[e.length-2];return R(e=>[...e,JSON.parse(JSON.stringify(ee))]),et(t),Q(null),setTimeout(()=>M(!1),0),e.slice(0,-1)})},children:(0,eO.jsx)(T,{})})}),(0,eO.jsx)(es,{title:"重做",children:(0,eO.jsx)("a",{className:`toolbar ${D.length>0?"active":""}`,onClick:()=>{R(e=>e.length?(M(!0),O(e=>[...e,JSON.parse(JSON.stringify(ee))]),et(e[e.length-1]),Q(null),setTimeout(()=>M(!1),0),e.slice(0,-1)):e)},children:(0,eO.jsx)(k,{})})}),(0,eO.jsx)(H,{orientation:"vertical"}),(0,eO.jsx)(es,{title:"导入JSON",children:(0,eO.jsx)("a",{className:`toolbar ${D.length>0?"active":""}`,onClick:()=>{ei(!0)},children:(0,eO.jsx)(g,{})})})]}),(0,eO.jsxs)(en,{children:[(0,eO.jsx)(es,{title:"缩小",children:(0,eO.jsx)("a",{className:"toolbar",onClick:()=>z(parseFloat(Math.max(S-.1,.5).toFixed(1))),children:(0,eO.jsx)(B,{})})}),(0,eO.jsxs)("div",{style:{fontSize:12,color:"#999",userSelect:"none"},children:[(100*S).toFixed(0),"%"]}),(0,eO.jsx)(es,{title:"放大",children:(0,eO.jsx)("a",{className:"toolbar",onClick:()=>z(parseFloat(Math.min(S+.1,2).toFixed(1))),children:(0,eO.jsx)(E,{})})}),(0,eO.jsx)(es,{title:"重置缩放",children:(0,eO.jsx)("a",{className:"toolbar",onClick:()=>z(1),children:(0,eO.jsx)(th,{type:"icon-zoom-reset"})})}),(0,eO.jsx)(H,{orientation:"vertical"}),(0,eO.jsx)(es,{title:"切换左侧栏",children:(0,eO.jsx)("a",{className:`toolbar ${W?"active":""}`,onClick:()=>{U(e=>!e),setTimeout(()=>{var e,t;return null==(t=y.current)||null==(e=t.handleResize)?void 0:e.call(t)},0)},children:(0,eO.jsx)(th,{type:"icon-sider-l"})})}),(0,eO.jsx)(es,{title:"切换右侧栏",children:(0,eO.jsx)("a",{className:`toolbar ${q?"active":""}`,onClick:()=>{X(e=>!e),setTimeout(()=>{var e,t;return null==(t=y.current)||null==(e=t.handleResize)?void 0:e.call(t)},0)},children:(0,eO.jsx)(th,{type:"icon-sider-r"})})}),o]})]}),(0,eO.jsxs)(la,{style:ec,children:[(0,eO.jsxs)("div",{className:"left",style:eu,children:[(0,eO.jsx)("div",{style:{padding:"22px 1px 22px 0",borderRight:"solid 1px #e8e8e8"},children:(0,eO.jsxs)(Z.Group,{value:F,onChange:e=>Y(e.target.value),buttonStyle:"outline",style:{fontWeight:"normal",display:"inline-flex",flexDirection:"column",gap:14},className:"left-pane-tabs",children:[(0,eO.jsx)(Z.Button,{value:"component",children:(0,eO.jsx)(es,{title:"组件",placement:"right",children:(0,eO.jsx)(th,{type:"icon-puzzle"})})}),(0,eO.jsx)(Z.Button,{value:"layer",children:(0,eO.jsx)(es,{title:"图层",placement:"right",children:(0,eO.jsx)(th,{type:"icon-outline"})})}),!!p&&(0,eO.jsx)(Z.Button,{value:"dataset",children:(0,eO.jsx)(es,{title:"数据集",placement:"right",children:(0,eO.jsx)(th,{type:"icon-dataset"})})}),d&&(0,eO.jsx)(Z.Button,{value:"datasource",title:"数据源",children:(0,eO.jsx)(es,{title:"数据源",placement:"right",children:(0,eO.jsx)(th,{type:"icon-datasource"})})}),c&&(0,eO.jsx)(Z.Button,{value:"script",children:(0,eO.jsx)(es,{title:"脚本",placement:"right",children:(0,eO.jsx)(th,{type:"icon-js"})})}),(0,eO.jsx)(Z.Button,{value:"env",children:(0,eO.jsx)(es,{title:"环境变量",placement:"right",children:(0,eO.jsx)(th,{type:"icon-variable"})})}),(0,eO.jsx)(Z.Button,{value:"code",children:(0,eO.jsx)(es,{title:"源码",placement:"right",children:(0,eO.jsx)(th,{type:"icon-json"})})})]})}),(0,eO.jsxs)("div",{style:{flex:"1 1 auto",display:"flex",flexDirection:"column",width:"calc(100% - 47px)"},children:["component"===F&&(0,eO.jsx)(tZ,{}),"layer"===F&&(0,eO.jsx)(t8,{}),d&&"datasource"===F&&(0,eO.jsx)(t1,{}),c&&"script"===F&&(0,eO.jsx)(le,{}),"env"===F&&(0,eO.jsx)(ll,{}),"code"===F&&(0,eO.jsx)(tX,{}),!!p&&"dataset"===F&&(0,eO.jsx)(lr,{ref:C,renderNode:p})]})]}),(0,eO.jsxs)("div",{className:"center",style:{flex:"1 1 auto"},children:[(0,eO.jsx)(tL,{title:"页面",extra:(0,eO.jsxs)(en,{children:[(0,eO.jsx)(P,{size:"small",type:el?"default":"primary",icon:el?(0,eO.jsx)(x,{}):(0,eO.jsx)(m,{}),onClick:()=>er(!el)}),(0,eO.jsxs)(Z.Group,{value:_,onChange:e=>$(e.target.value),size:"small",buttonStyle:"outline",children:[(0,eO.jsx)(Z.Button,{value:"desktop",title:"桌面",children:(0,eO.jsx)(u,{})}),(0,eO.jsx)(Z.Button,{value:"mobile",title:"移动设备",children:(0,eO.jsx)(w,{})}),(0,eO.jsx)(Z.Button,{value:"tablet",title:"平板设备",children:(0,eO.jsx)(A,{})})]})]})}),(0,eO.jsx)("div",{className:["body beautified_scrollbar always",_].join(" "),children:(0,eO.jsx)("div",{style:{transform:`scale(${S})`,transformOrigin:"top center"},children:(0,eO.jsx)(tS,{ref:y,device:_})})})]}),(0,eO.jsxs)("div",{className:"right",style:ep,children:[(0,eO.jsxs)("div",{style:{flex:"1 1 auto",display:"flex",flexDirection:"column",width:"calc(100% - 47px)"},children:[(0,eO.jsx)(t$,{agentList:a,onEffect:em,style:{display:"ai"===eh&&(null==v?void 0:v.ai)?void 0:"none"}}),"props"===eh&&(0,eO.jsx)(t9,{datasourceEnable:d}),"cascade"===eh&&(null==V?void 0:V.cascadeIds)&&(0,eO.jsx)(tW,{})]}),(0,eO.jsx)("div",{style:{padding:"22px 0",borderLeft:"solid 1px #e8e8e8",display:"flex",flexDirection:"column",justifyContent:"space-between",alignItems:"center"},children:(0,eO.jsxs)(Z.Group,{value:eh,onChange:e=>K(e.target.value),buttonStyle:"outline",style:{fontWeight:"normal",display:"inline-flex",flexDirection:"column",gap:14},className:"right-pane-tabs",children:[(null==v?void 0:v.ai)&&(0,eO.jsx)(Z.Button,{value:"ai",children:(0,eO.jsx)(es,{title:"智能助理",placement:"right",children:(0,eO.jsx)(th,{type:"icon-assistant"})})}),(0,eO.jsx)(Z.Button,{value:"props",children:(0,eO.jsx)(es,{title:"属性",placement:"right",children:(0,eO.jsx)(th,{type:"icon-info"})})}),(null==V?void 0:V.cascadeIds)&&(0,eO.jsx)(Z.Button,{value:"cascade",children:(0,eO.jsx)(es,{title:"联动",placement:"right",children:(0,eO.jsx)(th,{type:"icon-cascade"})})})]})})]})]})]}),(0,eO.jsx)(li,{open:ea,onOk:e=>{ei(!1),et(e)},onCancel:()=>ei(!1)}),(0,eO.jsx)(G,{open:eo,size:400,mask:!1,title:null,closable:!1,styles:{body:{padding:0}},onClose:()=>ed(!1),children:(0,eO.jsx)(t$,{agentList:a,headExtra:(0,eO.jsx)(P,{type:"link",icon:(0,eO.jsx)(s,{}),onClick:()=>ed(!1)}),onEffect:em})})]})});var ls=((ez={}).STRING="STRING",ez.NUMBER="NUMBER",ez.BOOLEAN="BOOLEAN",ez.OBJECT="OBJECT",ez.ARRAY="ARRAY",ez);let ld=t(j)`
|
|
987
|
+
`,li=e=>{let{open:t,onCancel:l,onOk:n}=e,[r,a]=(0,eA.useState)(JSON.stringify({info:{},datasources:[],scripts:[],variables:[],items:[]}));return(0,eO.jsx)(q,{title:"导入页面",open:t,width:800,onCancel:l,onOk:()=>null==n?void 0:n(JSON.parse(r)),okText:"导入",cancelText:"取消",styles:{body:{height:"calc(100vh - 250px)",overflow:"auto"}},children:(0,eO.jsx)("div",{className:"body",style:{flex:"1 1 auto",display:"flex",height:"100%"},children:(0,eO.jsx)(eh,{height:"100%",defaultLanguage:"json",value:r,options:{minimap:{enabled:!1}},onChange:e=>a(e||"")})})})},lo=eA.default.forwardRef((e,t)=>{var l;let n,{pageId:r,agentList:a=[],plugins:i=[],headerExtra:o,datasourceEnable:d=!0,scriptEnable:c=!0,datasetPanel:p,datasetSelector:h,datasetAdd:f,fetch:v,onSave:j,loading:b=!1}=e,y=(0,eA.useRef)(null),C=(0,eA.useRef)(null),[S,z]=(0,eA.useState)(1),[N,O]=(0,eA.useState)([]),[T,R]=(0,eA.useState)([]),[L,M]=(0,eA.useState)(!1),[_,$]=(0,eA.useState)("desktop"),[F,Y]=(0,eA.useState)("component"),[J,K]=(0,eA.useState)((null==v?void 0:v.ai)?"ai":"props"),[W,U]=(0,eA.useState)(!0),[q,X]=(0,eA.useState)(!0),[V,Q]=(0,eA.useState)(null),[ee,et]=(0,eA.useState)({info:{},datasources:[],scripts:[],variables:[],items:[]}),[el,er]=(0,eA.useState)(!0),[ea,ei]=(0,eA.useState)(!1),[eo,ed]=(0,eA.useState)(!1),ec=(0,eA.useMemo)(()=>{let e=W?"250px":"",t=q?"400px":"";return{gridTemplateColumns:`${e} 1fr ${t}`}},[W,q]),eu=(0,eA.useMemo)(()=>({display:W?"flex":"none"}),[W]),ep=(0,eA.useMemo)(()=>({display:q?"flex":"none"}),[q]);l=[ee],(n=(0,eA.useRef)()).current===JSON.stringify(l)&&n.current||(n.current=JSON.stringify(l),(()=>{L||(O(e=>e.length?[...e,JSON.parse(JSON.stringify(ee))].slice(-50):[JSON.parse(JSON.stringify(ee))]),R([]))})()),(0,eA.useImperativeHandle)(t,()=>({handleOpen(e){M(!0),ex(e.items),et(e),O([JSON.parse(JSON.stringify(e))]),R([]),setTimeout(()=>M(!1),0)}}));let ex=(e,t)=>{e&&e.forEach(e=>{e.id||(e.id=t||ef()),Array.isArray(e.children)?ex(e.children):"object"==typeof e.children&&e.children&&Object.keys(e.children).forEach(t=>{Array.isArray(e.children[t])&&ex(e.children[t],ef())})})},em=e=>{var t,l,n;if((null==(t=e.datasets)?void 0:t.length)&&(null==C||null==(l=C.current)?void 0:l.reload)&&C.current.reload(),e.schema){let t=JSON.parse(JSON.stringify(e.schema));ex(t.items),et(t)}else if(null==(n=e.pageItems)?void 0:n.length){let t=new Map;e.pageItems.forEach(e=>{t.has(e.targetId)||t.set(e.targetId,[]),t.get(e.targetId).push(e)});let l=JSON.parse(JSON.stringify(ee)),n=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];e.forEach((l,r)=>{t.has(l.id)&&t.get(l.id).forEach(t=>{let{position:n,insertSlot:a,pageItem:o}=t;switch(n){case"before":e.splice(r,0,o);break;case"after":e.splice(r+1,0,o);break;case"replace":Object.keys(l).forEach(e=>{"id"!==e&&delete l[e]}),Object.assign(l,o);break;case"insert":var s,d,c;let u=i.find(e=>e.key===l.type);Array.isArray(null==u||null==(s=u.defaultOptions)?void 0:s.children)?l.children=[...l.children||[],o]:"object"==typeof(null==u||null==(d=u.defaultOptions)?void 0:d.children)&&a&&(l.children={...l.children||{},[a]:[...(null==(c=l.children)?void 0:c[a])||[],o]})}}),Array.isArray(l.children)?n(l.children):"object"==typeof l.children&&l.children&&Object.keys(l.children).forEach(e=>{Array.isArray(l.children[e])&&n(l.children[e])})})};n(l.items),et(l)}},eh=(0,eA.useMemo)(()=>"cascade"!==J||(null==V?void 0:V.cascadeIds)?J:"props",[V,J]);return(0,eO.jsxs)(eT,{pageId:r,designable:el,plugins:i,schema:ee,selectedItem:V,setSchema:et,setSelectedItem:Q,datasetSelector:h,datasetAdd:f,fetch:v,children:[(0,eO.jsxs)("div",{style:{display:"flex",flexDirection:"column",height:"100%"},children:[(0,eO.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 24px",borderBottom:"solid 1px #e8e8e8"},children:[(0,eO.jsxs)(en,{children:[(0,eO.jsx)("span",{style:{fontSize:16,fontWeight:500},children:"创建数据报表"}),(0,eO.jsx)(H,{orientation:"vertical"}),(0,eO.jsx)(es,{title:"保存",children:(0,eO.jsx)(P,{type:"link",className:"toolbar",onClick:()=>{null==j||j(ee)},loading:b,children:(0,eO.jsx)(I,{})})}),(0,eO.jsx)(H,{orientation:"vertical"}),(0,eO.jsx)(es,{title:"撤销",children:(0,eO.jsx)("a",{className:`toolbar ${N.length>1?"active":""}`,onClick:()=>{O(e=>{if(e.length<=1)return e;M(!0);let t=e[e.length-2];return R(e=>[...e,JSON.parse(JSON.stringify(ee))]),et(t),Q(null),setTimeout(()=>M(!1),0),e.slice(0,-1)})},children:(0,eO.jsx)(E,{})})}),(0,eO.jsx)(es,{title:"重做",children:(0,eO.jsx)("a",{className:`toolbar ${T.length>0?"active":""}`,onClick:()=>{R(e=>e.length?(M(!0),O(e=>[...e,JSON.parse(JSON.stringify(ee))]),et(e[e.length-1]),Q(null),setTimeout(()=>M(!1),0),e.slice(0,-1)):e)},children:(0,eO.jsx)(k,{})})}),(0,eO.jsx)(H,{orientation:"vertical"}),(0,eO.jsx)(es,{title:"导入JSON",children:(0,eO.jsx)("a",{className:`toolbar ${T.length>0?"active":""}`,onClick:()=>{ei(!0)},children:(0,eO.jsx)(g,{})})})]}),(0,eO.jsxs)(en,{children:[(0,eO.jsx)(es,{title:"缩小",children:(0,eO.jsx)("a",{className:"toolbar",onClick:()=>z(parseFloat(Math.max(S-.1,.5).toFixed(1))),children:(0,eO.jsx)(B,{})})}),(0,eO.jsxs)("div",{style:{fontSize:12,color:"#999",userSelect:"none"},children:[(100*S).toFixed(0),"%"]}),(0,eO.jsx)(es,{title:"放大",children:(0,eO.jsx)("a",{className:"toolbar",onClick:()=>z(parseFloat(Math.min(S+.1,2).toFixed(1))),children:(0,eO.jsx)(D,{})})}),(0,eO.jsx)(es,{title:"重置缩放",children:(0,eO.jsx)("a",{className:"toolbar",onClick:()=>z(1),children:(0,eO.jsx)(th,{type:"icon-zoom-reset"})})}),(0,eO.jsx)(H,{orientation:"vertical"}),(0,eO.jsx)(es,{title:"切换左侧栏",children:(0,eO.jsx)("a",{className:`toolbar ${W?"active":""}`,onClick:()=>{U(e=>!e),setTimeout(()=>{var e,t;return null==(t=y.current)||null==(e=t.handleResize)?void 0:e.call(t)},0)},children:(0,eO.jsx)(th,{type:"icon-sider-l"})})}),(0,eO.jsx)(es,{title:"切换右侧栏",children:(0,eO.jsx)("a",{className:`toolbar ${q?"active":""}`,onClick:()=>{X(e=>!e),setTimeout(()=>{var e,t;return null==(t=y.current)||null==(e=t.handleResize)?void 0:e.call(t)},0)},children:(0,eO.jsx)(th,{type:"icon-sider-r"})})}),o]})]}),(0,eO.jsxs)(la,{style:ec,children:[(0,eO.jsxs)("div",{className:"left",style:eu,children:[(0,eO.jsx)("div",{style:{padding:"22px 1px 22px 0",borderRight:"solid 1px #e8e8e8"},children:(0,eO.jsxs)(Z.Group,{value:F,onChange:e=>Y(e.target.value),buttonStyle:"outline",style:{fontWeight:"normal",display:"inline-flex",flexDirection:"column",gap:14},className:"left-pane-tabs",children:[(0,eO.jsx)(Z.Button,{value:"component",children:(0,eO.jsx)(es,{title:"组件",placement:"right",children:(0,eO.jsx)(th,{type:"icon-puzzle"})})}),(0,eO.jsx)(Z.Button,{value:"layer",children:(0,eO.jsx)(es,{title:"图层",placement:"right",children:(0,eO.jsx)(th,{type:"icon-outline"})})}),!!p&&(0,eO.jsx)(Z.Button,{value:"dataset",children:(0,eO.jsx)(es,{title:"数据集",placement:"right",children:(0,eO.jsx)(th,{type:"icon-dataset"})})}),d&&(0,eO.jsx)(Z.Button,{value:"datasource",title:"数据源",children:(0,eO.jsx)(es,{title:"数据源",placement:"right",children:(0,eO.jsx)(th,{type:"icon-datasource"})})}),c&&(0,eO.jsx)(Z.Button,{value:"script",children:(0,eO.jsx)(es,{title:"脚本",placement:"right",children:(0,eO.jsx)(th,{type:"icon-js"})})}),(0,eO.jsx)(Z.Button,{value:"env",children:(0,eO.jsx)(es,{title:"环境变量",placement:"right",children:(0,eO.jsx)(th,{type:"icon-variable"})})}),(0,eO.jsx)(Z.Button,{value:"code",children:(0,eO.jsx)(es,{title:"源码",placement:"right",children:(0,eO.jsx)(th,{type:"icon-json"})})})]})}),(0,eO.jsxs)("div",{style:{flex:"1 1 auto",display:"flex",flexDirection:"column",width:"calc(100% - 47px)"},children:["component"===F&&(0,eO.jsx)(tZ,{}),"layer"===F&&(0,eO.jsx)(t8,{}),d&&"datasource"===F&&(0,eO.jsx)(t1,{}),c&&"script"===F&&(0,eO.jsx)(le,{}),"env"===F&&(0,eO.jsx)(ll,{}),"code"===F&&(0,eO.jsx)(tX,{}),!!p&&"dataset"===F&&(0,eO.jsx)(lr,{ref:C,renderNode:p})]})]}),(0,eO.jsxs)("div",{className:"center",style:{flex:"1 1 auto"},children:[(0,eO.jsx)(tL,{title:"页面",extra:(0,eO.jsxs)(en,{children:[(0,eO.jsx)(P,{size:"small",type:el?"default":"primary",icon:el?(0,eO.jsx)(x,{}):(0,eO.jsx)(m,{}),onClick:()=>er(!el)}),(0,eO.jsxs)(Z.Group,{value:_,onChange:e=>$(e.target.value),size:"small",buttonStyle:"outline",children:[(0,eO.jsx)(Z.Button,{value:"desktop",title:"桌面",children:(0,eO.jsx)(u,{})}),(0,eO.jsx)(Z.Button,{value:"mobile",title:"移动设备",children:(0,eO.jsx)(w,{})}),(0,eO.jsx)(Z.Button,{value:"tablet",title:"平板设备",children:(0,eO.jsx)(A,{})})]})]})}),(0,eO.jsx)("div",{className:["body beautified_scrollbar always",_].join(" "),children:(0,eO.jsx)("div",{style:{transform:`scale(${S})`,transformOrigin:"top center"},children:(0,eO.jsx)(tS,{ref:y,device:_})})})]}),(0,eO.jsxs)("div",{className:"right",style:ep,children:[(0,eO.jsxs)("div",{style:{flex:"1 1 auto",display:"flex",flexDirection:"column",width:"calc(100% - 47px)"},children:[(0,eO.jsx)(t$,{agentList:a,onEffect:em,style:{display:"ai"===eh&&(null==v?void 0:v.ai)?void 0:"none"}}),"props"===eh&&(0,eO.jsx)(t9,{datasourceEnable:d}),"cascade"===eh&&(null==V?void 0:V.cascadeIds)&&(0,eO.jsx)(tW,{})]}),(0,eO.jsx)("div",{style:{padding:"22px 0",borderLeft:"solid 1px #e8e8e8",display:"flex",flexDirection:"column",justifyContent:"space-between",alignItems:"center"},children:(0,eO.jsxs)(Z.Group,{value:eh,onChange:e=>K(e.target.value),buttonStyle:"outline",style:{fontWeight:"normal",display:"inline-flex",flexDirection:"column",gap:14},className:"right-pane-tabs",children:[(null==v?void 0:v.ai)&&(0,eO.jsx)(Z.Button,{value:"ai",children:(0,eO.jsx)(es,{title:"智能助理",placement:"right",children:(0,eO.jsx)(th,{type:"icon-assistant"})})}),(0,eO.jsx)(Z.Button,{value:"props",children:(0,eO.jsx)(es,{title:"属性",placement:"right",children:(0,eO.jsx)(th,{type:"icon-info"})})}),(null==V?void 0:V.cascadeIds)&&(0,eO.jsx)(Z.Button,{value:"cascade",children:(0,eO.jsx)(es,{title:"联动",placement:"right",children:(0,eO.jsx)(th,{type:"icon-cascade"})})})]})})]})]})]}),(0,eO.jsx)(li,{open:ea,onOk:e=>{ei(!1),et(e)},onCancel:()=>ei(!1)}),(0,eO.jsx)(G,{open:eo,size:400,mask:!1,title:null,closable:!1,styles:{body:{padding:0}},onClose:()=>ed(!1),children:(0,eO.jsx)(t$,{agentList:a,headExtra:(0,eO.jsx)(P,{type:"link",icon:(0,eO.jsx)(s,{}),onClick:()=>ed(!1)}),onEffect:em})})]})});var ls=((ez={}).STRING="STRING",ez.NUMBER="NUMBER",ez.BOOLEAN="BOOLEAN",ez.OBJECT="OBJECT",ez.ARRAY="ARRAY",ez);let ld=t(j)`
|
|
988
988
|
vertical-align: middle;
|
|
989
989
|
margin-left: 2px;
|
|
990
990
|
color: var(--ant-color-text-description);
|
|
@@ -1008,7 +1008,7 @@ import*as e from"react";import t,{css as l}from"styled-components";import{AlignC
|
|
|
1008
1008
|
color: #999;
|
|
1009
1009
|
font-size: 12px;
|
|
1010
1010
|
}
|
|
1011
|
-
`,lu=e=>{let{item:t,signal:l}=e,{fetch:n,getVars:r}=(0,eA.useContext)(
|
|
1011
|
+
`,lu=e=>{let{item:t,signal:l}=e,{fetch:n,getVars:r}=(0,eA.useContext)(eE),[a,i]=(0,eA.useState)(null);return(0,eA.useEffect)(()=>{if(!(null==t?void 0:t.datasource))return void i(null);switch((null==t?void 0:t.datasource.source)||"custom"){case"custom":try{var e;i(JSON.parse((null==t||null==(e=t.datasource)?void 0:e.custom)||"[]"))}catch(e){i(null)}break;case"dataset":if(!(null==t?void 0:t.datasource.dataset)||!(null==n?void 0:n.dataset)){console.warn("dataset source detected but config or fetcher is missing",{datasetConfig:null==t?void 0:t.datasource.dataset,hasFetchDataset:!!(null==n?void 0:n.dataset)}),i(null);return}let l=r(t.id||"");n.dataset(null==t?void 0:t.datasource.dataset.id,l).then(e=>{i(e||null)}).catch(e=>{console.error("dataset fetch error",e),i(null)});break;default:i(null)}},[null==t?void 0:t.datasource,l]),a},lp=t.div`
|
|
1012
1012
|
box-sizing: border-box;
|
|
1013
1013
|
margin: 0;
|
|
1014
1014
|
padding: 0;
|
|
@@ -1075,7 +1075,7 @@ import*as e from"react";import t,{css as l}from"styled-components";import{AlignC
|
|
|
1075
1075
|
margin-top: 16px;
|
|
1076
1076
|
text-align: right;
|
|
1077
1077
|
padding: ${e=>e.$bordered?"0 24px 24px":"0"};
|
|
1078
|
-
`;let lj=e=>{let{item:t,split:l,padding:n}=e;return(0,eO.jsx)(lx,{$split:l,$padding:n,children:(0,eO.jsxs)(lm,{children:[t.avatar&&(0,eO.jsx)(lh,{children:(0,eO.jsx)(L,{src:t.avatar})}),(0,eO.jsxs)(lf,{children:[t.title&&(0,eO.jsx)(lg,{children:t.href?(0,eO.jsx)("a",{href:t.href,children:t.title}):t.title}),t.description&&(0,eO.jsx)(lv,{children:t.description})]})]})})},lb=e=>{let{list:t=[],split:l,bordered:n,size:r,itemLayout:a,style:i,className:o}=e,s=(0,eA.useMemo)(()=>"small"===r?"8px 16px":n?"12px 24px":"12px 0",[r,n]);return(0,eO.jsx)(lp,{$bordered:n,$split:l,$size:r,style:i,$itemLayout:a,className:o,children:t.map((e,t)=>(0,eO.jsx)(lj,{item:e,split:l,padding:s},String(t)))})},ly=[{group:"基础组件",key:"b-text",label:"文本",icon:"icon-text",component:e=>{let{id:t,text:l,item:n,style:r={},customStyle:a={},className:i,classNames:o=[]}=e,s=(0,eA.useMemo)(()=>({...(null==n?void 0:n.style)||{},...a||{},...r||{}}),[n,a,r]);return(0,eO.jsx)("span",{id:t,style:s,className:(o||[]).join(" ")+" "+i,children:l})},formComponent:e=>{var t,l,n,r,a,i;let{model:o,onChange:s}=e,d=(e,t)=>s&&s({...o,[e]:t}),c=(e,t)=>{let l={...o.customStyle||{},[e]:t};s&&s({...o,customStyle:l})};return(0,eO.jsxs)(K,{layout:"vertical",children:[(0,eO.jsx)(K.Item,{label:"文本内容",children:(0,eO.jsx)(W.TextArea,{size:"small",value:o.text,onChange:e=>d("text",e.target.value)})}),(0,eO.jsx)(K.Item,{label:"类名",children:(0,eO.jsx)(et,{size:"small",value:o.classNames,mode:"tags",onChange:e=>d("classNames",e)})}),(0,eO.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,eO.jsxs)(en.Compact,{children:[(0,eO.jsxs)(et,{size:"small",value:null==(t=o.customStyle)?void 0:t.fontFamily,style:{width:90},onChange:e=>c("fontFamily",e),children:[(0,eO.jsx)(et.Option,{value:"'黑体', 'SimHei', sans-serif",children:"黑体"}),(0,eO.jsx)(et.Option,{value:"'宋体', 'SimSun', serif",children:"宋体"}),(0,eO.jsx)(et.Option,{value:"'仿宋', 'FangSong', serif",children:"仿宋"}),(0,eO.jsx)(et.Option,{value:"'楷体', 'KaiTi', serif",children:"楷体"}),(0,eO.jsx)(et.Option,{value:"Arial, sans-serif",children:"Arial"})]}),(0,eO.jsx)(et,{size:"small",value:null==(l=o.customStyle)?void 0:l.fontSize,style:{width:90},onChange:e=>c("fontSize",e),children:["12px","14px","16px","20px","22px","24px","32px","48px"].map(e=>(0,eO.jsx)(et.Option,{value:e,children:e},e))}),(0,eO.jsx)(F,{size:"small",value:null==(n=o.customStyle)?void 0:n.color,onChange:e=>c("color",e.toHexString()),allowClear:!0})]}),(0,eO.jsxs)(en.Compact,{children:[(0,eO.jsx)(P,{type:(null==(r=o.customStyle)?void 0:r.fontWeight)==="bold"?"primary":void 0,size:"small",onClick:()=>{var e;return c("fontWeight",(null==(e=o.customStyle)?void 0:e.fontWeight)==="bold"?"normal":"bold")},children:"B"}),(0,eO.jsx)(P,{type:(null==(a=o.customStyle)?void 0:a.fontStyle)==="italic"?"primary":void 0,size:"small",onClick:()=>{var e;return c("fontStyle",(null==(e=o.customStyle)?void 0:e.fontStyle)==="italic"?"normal":"italic")},children:"I"}),(0,eO.jsx)(P,{type:(null==(i=o.customStyle)?void 0:i.textDecoration)==="underline"?"primary":void 0,size:"small",onClick:()=>{var e;return c("textDecoration",(null==(e=o.customStyle)?void 0:e.textDecoration)==="underline"?"none":"underline")},children:"U"})]})]})]})},defaultOptions:{style:{},props:{text:"文本内容",classNames:[],customStyle:{fontSize:14,color:"#444444",fontFamily:"'宋体', 'SimSun', serif",fontWeight:"normal",fontStyle:"normal",textDecoration:"none"}}}},{group:"基础组件",key:"b-image",label:"图片",icon:"icon-image",component:e=>{let{id:t,src:l,alt:n,width:r,height:a,href:i,className:o}=e,s=(0,eO.jsx)("img",{id:t,src:l,alt:n,style:{width:r,height:a},className:o});return i&&i.length?(0,eO.jsx)("a",{href:i,target:"_blank",rel:"noreferrer",children:s}):(0,eO.jsx)("div",{children:s})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n}),r={Authorization:`Bearer ${localStorage.getItem("ASKDATA_TOKEN")||""}`};return(0,eO.jsxs)(K,{labelCol:{span:24},wrapperCol:{span:24},children:[(0,eO.jsx)(K.Item,{label:(0,eO.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:["图片URL",(0,eO.jsx)(eu,{name:"file",multiple:!1,accept:".png,.jpg,.jpeg",headers:r,action:"/api/datareport/upload",showUploadList:!1,beforeUpload:e=>{let t=e.type.startsWith("image/");return t||ep.error("上传封面只能是图片文件"),t},onChange:e=>{if("done"===e.file.status){var t;n("src",null==(t=e.file.response)?void 0:t.data),ep.success("上传成功")}else"error"===e.file.status&&ep.error("上传失败")},children:(0,eO.jsx)(P,{size:"small",type:"link",icon:(0,eO.jsx)(
|
|
1078
|
+
`;let lj=e=>{let{item:t,split:l,padding:n}=e;return(0,eO.jsx)(lx,{$split:l,$padding:n,children:(0,eO.jsxs)(lm,{children:[t.avatar&&(0,eO.jsx)(lh,{children:(0,eO.jsx)(L,{src:t.avatar})}),(0,eO.jsxs)(lf,{children:[t.title&&(0,eO.jsx)(lg,{children:t.href?(0,eO.jsx)("a",{href:t.href,children:t.title}):t.title}),t.description&&(0,eO.jsx)(lv,{children:t.description})]})]})})},lb=e=>{let{list:t=[],split:l,bordered:n,size:r,itemLayout:a,style:i,className:o}=e,s=(0,eA.useMemo)(()=>"small"===r?"8px 16px":n?"12px 24px":"12px 0",[r,n]);return(0,eO.jsx)(lp,{$bordered:n,$split:l,$size:r,style:i,$itemLayout:a,className:o,children:t.map((e,t)=>(0,eO.jsx)(lj,{item:e,split:l,padding:s},String(t)))})},ly=[{group:"基础组件",key:"b-text",label:"文本",icon:"icon-text",component:e=>{let{id:t,text:l,item:n,style:r={},customStyle:a={},className:i,classNames:o=[]}=e,s=(0,eA.useMemo)(()=>({...(null==n?void 0:n.style)||{},...a||{},...r||{}}),[n,a,r]);return(0,eO.jsx)("span",{id:t,style:s,className:(o||[]).join(" ")+" "+i,children:l})},formComponent:e=>{var t,l,n,r,a,i;let{model:o,onChange:s}=e,d=(e,t)=>s&&s({...o,[e]:t}),c=(e,t)=>{let l={...o.customStyle||{},[e]:t};s&&s({...o,customStyle:l})};return(0,eO.jsxs)(K,{layout:"vertical",children:[(0,eO.jsx)(K.Item,{label:"文本内容",children:(0,eO.jsx)(W.TextArea,{size:"small",value:o.text,onChange:e=>d("text",e.target.value)})}),(0,eO.jsx)(K.Item,{label:"类名",children:(0,eO.jsx)(et,{size:"small",value:o.classNames,mode:"tags",onChange:e=>d("classNames",e)})}),(0,eO.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,eO.jsxs)(en.Compact,{children:[(0,eO.jsxs)(et,{size:"small",value:null==(t=o.customStyle)?void 0:t.fontFamily,style:{width:90},onChange:e=>c("fontFamily",e),children:[(0,eO.jsx)(et.Option,{value:"'黑体', 'SimHei', sans-serif",children:"黑体"}),(0,eO.jsx)(et.Option,{value:"'宋体', 'SimSun', serif",children:"宋体"}),(0,eO.jsx)(et.Option,{value:"'仿宋', 'FangSong', serif",children:"仿宋"}),(0,eO.jsx)(et.Option,{value:"'楷体', 'KaiTi', serif",children:"楷体"}),(0,eO.jsx)(et.Option,{value:"Arial, sans-serif",children:"Arial"})]}),(0,eO.jsx)(et,{size:"small",value:null==(l=o.customStyle)?void 0:l.fontSize,style:{width:90},onChange:e=>c("fontSize",e),children:["12px","14px","16px","20px","22px","24px","32px","48px"].map(e=>(0,eO.jsx)(et.Option,{value:e,children:e},e))}),(0,eO.jsx)(F,{size:"small",value:null==(n=o.customStyle)?void 0:n.color,onChange:e=>c("color",e.toHexString()),allowClear:!0})]}),(0,eO.jsxs)(en.Compact,{children:[(0,eO.jsx)(P,{type:(null==(r=o.customStyle)?void 0:r.fontWeight)==="bold"?"primary":void 0,size:"small",onClick:()=>{var e;return c("fontWeight",(null==(e=o.customStyle)?void 0:e.fontWeight)==="bold"?"normal":"bold")},children:"B"}),(0,eO.jsx)(P,{type:(null==(a=o.customStyle)?void 0:a.fontStyle)==="italic"?"primary":void 0,size:"small",onClick:()=>{var e;return c("fontStyle",(null==(e=o.customStyle)?void 0:e.fontStyle)==="italic"?"normal":"italic")},children:"I"}),(0,eO.jsx)(P,{type:(null==(i=o.customStyle)?void 0:i.textDecoration)==="underline"?"primary":void 0,size:"small",onClick:()=>{var e;return c("textDecoration",(null==(e=o.customStyle)?void 0:e.textDecoration)==="underline"?"none":"underline")},children:"U"})]})]})]})},defaultOptions:{style:{},props:{text:"文本内容",classNames:[],customStyle:{fontSize:14,color:"#444444",fontFamily:"'宋体', 'SimSun', serif",fontWeight:"normal",fontStyle:"normal",textDecoration:"none"}}}},{group:"基础组件",key:"b-image",label:"图片",icon:"icon-image",component:e=>{let{id:t,src:l,alt:n,width:r,height:a,href:i,className:o}=e,s=(0,eO.jsx)("img",{id:t,src:l,alt:n,style:{width:r,height:a},className:o});return i&&i.length?(0,eO.jsx)("a",{href:i,target:"_blank",rel:"noreferrer",children:s}):(0,eO.jsx)("div",{children:s})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n}),r={Authorization:`Bearer ${localStorage.getItem("ASKDATA_TOKEN")||""}`};return(0,eO.jsxs)(K,{labelCol:{span:24},wrapperCol:{span:24},children:[(0,eO.jsx)(K.Item,{label:(0,eO.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:["图片URL",(0,eO.jsx)(eu,{name:"file",multiple:!1,accept:".png,.jpg,.jpeg",headers:r,action:"/api/datareport/upload",showUploadList:!1,beforeUpload:e=>{let t=e.type.startsWith("image/");return t||ep.error("上传封面只能是图片文件"),t},onChange:e=>{if("done"===e.file.status){var t;n("src",null==(t=e.file.response)?void 0:t.data),ep.success("上传成功")}else"error"===e.file.status&&ep.error("上传失败")},children:(0,eO.jsx)(P,{size:"small",type:"link",icon:(0,eO.jsx)(T,{})})})]}),children:(0,eO.jsx)(W,{size:"small",value:t.src,onChange:e=>n("src",e.target.value)})}),(0,eO.jsx)(K.Item,{label:"图片替代文本",children:(0,eO.jsx)(W,{size:"small",value:t.alt,onChange:e=>n("alt",e.target.value)})}),(0,eO.jsx)(K.Item,{label:"图片链接",children:(0,eO.jsx)(W,{size:"small",value:t.href,onChange:e=>n("href",e.target.value)})}),(0,eO.jsx)(K.Item,{label:"图片宽度",children:(0,eO.jsx)(W,{size:"small",value:t.width,onChange:e=>n("width",e.target.value)})}),(0,eO.jsx)(K.Item,{label:"图片高度",children:(0,eO.jsx)(W,{size:"small",value:t.height,onChange:e=>n("height",e.target.value)})})]})},defaultOptions:{props:{src:"https://gw.alipayobjects.com/zos/rmsportal/JiqGstEfoWAOHiTxclqi.png",alt:"",href:"",width:"100%",height:"auto"}}},{group:"基础组件",key:"b-button",label:"按钮",icon:"icon-button",component:e=>{let{id:t,text:l="按钮",type:n="middle",icon:r,size:a,block:i=!1,shape:o="default",ghost:s=!1,item:d,style:c,className:u}=e,{handleCallback:p}=(0,eA.useContext)(eE),x="danger"===n,m="string"==typeof r?r?(0,eO.jsx)(th,{type:r}):void 0:r;return(0,eO.jsx)(P,{id:t,type:x?"default":n,icon:m,size:a,block:i,shape:["round","circle"].includes(o)?o:void 0,ghost:s,danger:x,onClick:()=>{p(d,!1,(e,t)=>{console.log("点击回调:",{target:e,data:t})})},style:c,className:u,children:l})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n});return(0,eO.jsxs)(K,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,eO.jsx)(K.Item,{label:"文本",children:(0,eO.jsx)(W,{size:"small",value:t.text,onChange:e=>n("text",e.target.value),placeholder:"请输入按钮文本"})}),(0,eO.jsx)(K.Item,{label:"图标",children:(0,eO.jsx)(W,{size:"small",value:t.icon,onChange:e=>n("icon",e.target.value),placeholder:"请输入按钮图标(antdv 1.7.8)"})}),(0,eO.jsx)(K.Item,{label:"类型",children:(0,eO.jsxs)(Z.Group,{size:"small",value:t.type,onChange:e=>n("type",e.target.value),children:[(0,eO.jsx)(Z.Button,{value:"default",children:"默认"}),(0,eO.jsx)(Z.Button,{value:"primary",children:"主要"}),(0,eO.jsx)(Z.Button,{value:"link",children:"链接"}),(0,eO.jsx)(Z.Button,{value:"dashed",children:"虚线"}),(0,eO.jsx)(Z.Button,{value:"text",children:"文本"})]})}),(0,eO.jsx)(K.Item,{label:"大小",children:(0,eO.jsxs)(Z.Group,{size:"small",value:t.size,onChange:e=>n("size",e.target.value),children:[(0,eO.jsx)(Z.Button,{value:"small",children:"小"}),(0,eO.jsx)(Z.Button,{value:"middle",children:"中"}),(0,eO.jsx)(Z.Button,{value:"large",children:"大"})]})}),(0,eO.jsx)(K.Item,{label:"形状",children:(0,eO.jsxs)(Z.Group,{size:"small",value:t.shape,onChange:e=>n("shape",e.target.value),children:[(0,eO.jsx)(Z.Button,{value:"default",children:"默认"}),(0,eO.jsx)(Z.Button,{value:"round",children:"圆角"}),(0,eO.jsx)(Z.Button,{value:"circle",children:"圆形"})]})}),(0,eO.jsx)(K.Item,{label:"块级",children:(0,eO.jsx)(er,{size:"small",checked:!!t.block,onChange:e=>n("block",e)})}),(0,eO.jsx)(K.Item,{label:"幽灵",children:(0,eO.jsx)(er,{size:"small",checked:!!t.ghost,onChange:e=>n("ghost",e)})})]})},defaultOptions:{props:{type:"primary",size:"default",shape:"default",block:!1,ghost:!1,text:"按钮文本",icon:""},cascadeIds:[]}},{group:"基础组件",key:"b-page-header",label:"页面标题",icon:"icon-page-header",component:e=>{let{id:t,title:l,subTitle:n,item:r,ancestors:a,style:i={},className:o}=e,s=(0,eA.useMemo)(()=>!r.children||Array.isArray(r.children)||"object"!=typeof r.children?null:r.children.extra||[],[r]),[d,c]=(0,eA.useState)(s||[]);return(0,eA.useEffect)(()=>{c(s||[])},[s]),(0,eO.jsxs)(lc,{id:t,style:{...i},className:o,children:[(0,eO.jsxs)("div",{className:"title",children:[(0,eO.jsx)("span",{className:"main",children:l}),n&&(0,eO.jsx)("span",{className:"sub",children:n})]}),(0,eO.jsx)("div",{children:(0,eO.jsx)(ty,{list:d,ancestors:[...a,r],onListChange:e=>{let t=[...e];r.children.extra=t,c(t)}})})]})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n});return(0,eO.jsxs)(K,{layout:"vertical",children:[(0,eO.jsx)(K.Item,{label:"标题",children:(0,eO.jsx)(W,{size:"small",value:t.title,onChange:e=>n("title",e.target.value),placeholder:"请输入标题"})}),(0,eO.jsx)(K.Item,{label:"副标题",children:(0,eO.jsx)(W,{size:"small",value:t.subTitle,onChange:e=>n("subTitle",e.target.value),placeholder:"请输入副标题"})})]})},defaultOptions:{props:{title:"标题",subTitle:"副标题"},children:{extra:[]}}},{group:"基础组件",key:"b-table",label:"数据表格",icon:"icon-table",component:e=>{let{id:t,item:l,dataSource:n=[],columns:r=[],pageSize:a=10,bordered:i=!0,size:o,showHeader:s=!0,style:d={},className:c}=e,{initCallback:u}=(0,eA.useContext)(eE),p=!!a&&!(a<=n.length)&&{total:n.length,pageSize:a,size:o,showSizeChanger:!0,showQuickJumper:!0,hideOnSinglePage:!0,pageSizeOptions:["10","20","30","40"],showTotal:(e,t)=>`共 ${e} 条记录,显示第 ${t[0]}-${t[1]} 条`},x=r.map(e=>({...e,render:e.customRender&&("string"!=typeof e.customRender||""!==e.customRender.trim())?(t,l,n)=>Function("console","Math","Date","Array","Object","String","Number","Boolean","text","record","index",`
|
|
1079
1079
|
"use strict";
|
|
1080
1080
|
const window = undefined;
|
|
1081
1081
|
const document = undefined;
|
|
@@ -1085,7 +1085,7 @@ import*as e from"react";import t,{css as l}from"styled-components";import{AlignC
|
|
|
1085
1085
|
const module = undefined;
|
|
1086
1086
|
const exports = undefined;
|
|
1087
1087
|
${e.customRender}
|
|
1088
|
-
`)(console,Math,Date,Array,Object,String,Number,Boolean,t,l,n):e.render})),m=()=>{console.log("callback table")};return(0,eA.useEffect)(()=>{u({id:l.id,callback:m})},[]),(0,eO.jsx)(ea,{id:t,dataSource:n,columns:x,pagination:p,bordered:i,size:o,showHeader:"boolean"!=typeof s||s,rowKey:(e,t)=>String(t),style:{padding:1,...d},className:c})},formComponent:e=>{let{model:t,onChange:l}=e,i=(e,n)=>l&&l({...t,[e]:n}),o=(e,l)=>{let n=[...t.columns||[]];n[e]={...n[e],...l},i("columns",n)},[s,d]=(0,eA.useState)(!1),[u,x]=(0,eA.useState)(null),m=null!=u&&t.columns[u]?t.columns[u]:{title:"",dataIndex:"",width:"",align:"left",ellipsis:!1},h=[{title:"列名",dataIndex:"title"},{title:"数据索引",dataIndex:"dataIndex"},{title:"操作",width:80,align:"center",render:(e,l,n)=>(0,eO.jsxs)(en,{children:[(0,eO.jsx)("a",{onClick:()=>{x(n),d(!0)},children:(0,eO.jsx)(p,{})}),(0,eO.jsx)("a",{onClick:()=>{let e;(e=[...t.columns||[]]).splice(n,1),i("columns",e)},children:(0,eO.jsx)(c,{})})]})}];return(0,eO.jsxs)("div",{children:[(0,eO.jsxs)(K,{labelCol:{span:12},wrapperCol:{span:12},children:[(0,eO.jsx)(K.Item,{label:"大小",children:(0,eO.jsxs)(Z.Group,{size:"small",value:t.size,onChange:e=>i("size",e.target.value),children:[(0,eO.jsx)(Z.Button,{value:"small",children:"小"}),(0,eO.jsx)(Z.Button,{value:"middle",children:"中"}),(0,eO.jsx)(Z.Button,{value:"large",children:"大"})]})}),(0,eO.jsx)(K.Item,{label:"边框",children:(0,eO.jsx)(er,{size:"small",checked:!!t.bordered,onChange:e=>i("bordered",e)})}),(0,eO.jsx)(K.Item,{label:"显示表头",children:(0,eO.jsx)(er,{size:"small",checked:!!t.showHeader,onChange:e=>i("showHeader",e)})}),(0,eO.jsx)(K.Item,{label:"分页大小",children:(0,eO.jsx)(U,{size:"small",value:t.pageSize,onChange:e=>i("pageSize",e)})})]}),(0,eO.jsx)(H,{children:"表格列设置"}),(0,eO.jsx)(ea,{size:"small",dataSource:t.columns,rowKey:(e,t)=>String(t),columns:h,pagination:!1,bordered:!0}),(0,eO.jsx)(P,{size:"small",onClick:()=>{i("columns",[...t.columns||[],{title:"",dataIndex:"",width:"",align:"left",ellipsis:!1}])},block:!0,children:"添加列"}),(0,eO.jsx)(q,{title:"编辑列",open:s,footer:null,width:400,onCancel:()=>d(!1),children:(0,eO.jsx)(K,{layout:"vertical",children:(0,eO.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12},children:[(0,eO.jsx)(K.Item,{label:"列名",children:(0,eO.jsx)(W,{value:m.title,onChange:e=>o(u,{title:e.target.value})})}),(0,eO.jsx)(K.Item,{label:"数据索引",children:(0,eO.jsx)(W,{value:m.dataIndex,onChange:e=>o(u,{dataIndex:e.target.value})})}),(0,eO.jsx)(K.Item,{label:"宽度",children:(0,eO.jsx)(W,{value:m.width,onChange:e=>o(u,{width:e.target.value})})}),(0,eO.jsx)(K.Item,{label:"对齐",children:(0,eO.jsxs)(Z.Group,{value:m.align,onChange:e=>o(u,{align:e.target.value}),children:[(0,eO.jsx)(Z.Button,{value:"left",children:(0,eO.jsx)(r,{})}),(0,eO.jsx)(Z.Button,{value:"center",children:(0,eO.jsx)(n,{})}),(0,eO.jsx)(Z.Button,{value:"right",children:(0,eO.jsx)(a,{})})]})}),(0,eO.jsx)(K.Item,{label:"省略",children:(0,eO.jsx)(er,{checked:!!m.ellipsis,onChange:e=>o(u,{ellipsis:e})})})]})})})]})},defaultOptions:{datasource:{source:"custom",datasourceId:null,scriptId:null,custom:null},props:{size:"default",bordered:!0,showHeader:!0,pageSize:10,dataSource:[{name:"苹果",count:12},{name:"华为",count:803},{name:"OPPO",count:654},{name:"vivo",count:719}],columns:[{title:"品牌",dataIndex:"name"},{title:"日销量(件)",dataIndex:"count"}]}}},{group:"基础组件",key:"b-list",label:"列表",icon:"icon-unordered-list",component:e=>{let{id:t,pageSize:l=10,bordered:n=!0,size:r="default",itemLayout:a="horizontal",item:i,split:o=!0,style:s={},className:d}=e,{initCallback:c}=(0,eA.useContext)(
|
|
1088
|
+
`)(console,Math,Date,Array,Object,String,Number,Boolean,t,l,n):e.render})),m=()=>{console.log("callback table")};return(0,eA.useEffect)(()=>{u({id:l.id,callback:m})},[]),(0,eO.jsx)(ea,{id:t,dataSource:n,columns:x,pagination:p,bordered:i,size:o,showHeader:"boolean"!=typeof s||s,rowKey:(e,t)=>String(t),style:{padding:1,...d},className:c})},formComponent:e=>{let{model:t,onChange:l}=e,i=(e,n)=>l&&l({...t,[e]:n}),o=(e,l)=>{let n=[...t.columns||[]];n[e]={...n[e],...l},i("columns",n)},[s,d]=(0,eA.useState)(!1),[u,x]=(0,eA.useState)(null),m=null!=u&&t.columns[u]?t.columns[u]:{title:"",dataIndex:"",width:"",align:"left",ellipsis:!1},h=[{title:"列名",dataIndex:"title"},{title:"数据索引",dataIndex:"dataIndex"},{title:"操作",width:80,align:"center",render:(e,l,n)=>(0,eO.jsxs)(en,{children:[(0,eO.jsx)("a",{onClick:()=>{x(n),d(!0)},children:(0,eO.jsx)(p,{})}),(0,eO.jsx)("a",{onClick:()=>{let e;(e=[...t.columns||[]]).splice(n,1),i("columns",e)},children:(0,eO.jsx)(c,{})})]})}];return(0,eO.jsxs)("div",{children:[(0,eO.jsxs)(K,{labelCol:{span:12},wrapperCol:{span:12},children:[(0,eO.jsx)(K.Item,{label:"大小",children:(0,eO.jsxs)(Z.Group,{size:"small",value:t.size,onChange:e=>i("size",e.target.value),children:[(0,eO.jsx)(Z.Button,{value:"small",children:"小"}),(0,eO.jsx)(Z.Button,{value:"middle",children:"中"}),(0,eO.jsx)(Z.Button,{value:"large",children:"大"})]})}),(0,eO.jsx)(K.Item,{label:"边框",children:(0,eO.jsx)(er,{size:"small",checked:!!t.bordered,onChange:e=>i("bordered",e)})}),(0,eO.jsx)(K.Item,{label:"显示表头",children:(0,eO.jsx)(er,{size:"small",checked:!!t.showHeader,onChange:e=>i("showHeader",e)})}),(0,eO.jsx)(K.Item,{label:"分页大小",children:(0,eO.jsx)(U,{size:"small",value:t.pageSize,onChange:e=>i("pageSize",e)})})]}),(0,eO.jsx)(H,{children:"表格列设置"}),(0,eO.jsx)(ea,{size:"small",dataSource:t.columns,rowKey:(e,t)=>String(t),columns:h,pagination:!1,bordered:!0}),(0,eO.jsx)(P,{size:"small",onClick:()=>{i("columns",[...t.columns||[],{title:"",dataIndex:"",width:"",align:"left",ellipsis:!1}])},block:!0,children:"添加列"}),(0,eO.jsx)(q,{title:"编辑列",open:s,footer:null,width:400,onCancel:()=>d(!1),children:(0,eO.jsx)(K,{layout:"vertical",children:(0,eO.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12},children:[(0,eO.jsx)(K.Item,{label:"列名",children:(0,eO.jsx)(W,{value:m.title,onChange:e=>o(u,{title:e.target.value})})}),(0,eO.jsx)(K.Item,{label:"数据索引",children:(0,eO.jsx)(W,{value:m.dataIndex,onChange:e=>o(u,{dataIndex:e.target.value})})}),(0,eO.jsx)(K.Item,{label:"宽度",children:(0,eO.jsx)(W,{value:m.width,onChange:e=>o(u,{width:e.target.value})})}),(0,eO.jsx)(K.Item,{label:"对齐",children:(0,eO.jsxs)(Z.Group,{value:m.align,onChange:e=>o(u,{align:e.target.value}),children:[(0,eO.jsx)(Z.Button,{value:"left",children:(0,eO.jsx)(r,{})}),(0,eO.jsx)(Z.Button,{value:"center",children:(0,eO.jsx)(n,{})}),(0,eO.jsx)(Z.Button,{value:"right",children:(0,eO.jsx)(a,{})})]})}),(0,eO.jsx)(K.Item,{label:"省略",children:(0,eO.jsx)(er,{checked:!!m.ellipsis,onChange:e=>o(u,{ellipsis:e})})})]})})})]})},defaultOptions:{datasource:{source:"custom",datasourceId:null,scriptId:null,custom:null},props:{size:"default",bordered:!0,showHeader:!0,pageSize:10,dataSource:[{name:"苹果",count:12},{name:"华为",count:803},{name:"OPPO",count:654},{name:"vivo",count:719}],columns:[{title:"品牌",dataIndex:"name"},{title:"日销量(件)",dataIndex:"count"}]}}},{group:"基础组件",key:"b-list",label:"列表",icon:"icon-unordered-list",component:e=>{let{id:t,pageSize:l=10,bordered:n=!0,size:r="default",itemLayout:a="horizontal",item:i,split:o=!0,style:s={},className:d}=e,{initCallback:c}=(0,eA.useContext)(eE),[u,p]=(0,eA.useState)(0),x=lu({item:i,signal:u}),m=(0,eA.useMemo)(()=>x||[],[x]),h=(0,eA.useMemo)(()=>!!l&&!(l<=m.length)&&{total:m.length,pageSize:l,size:"default"===r?void 0:r,showSizeChanger:!0,showQuickJumper:!0,hideOnSinglePage:!0,pageSizeOptions:["10","20","30","40"],showTotal:(e,t)=>`共 ${e} 条记录,显示第 ${t[0]}-${t[1]} 条`},[l,m.length,r]),f=["p-list",a?`p-list--${a}`:void 0,r?`p-list--${r}`:void 0,o?"p-list--split":void 0,n?"p-list--bordered":void 0,d],g=function(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];return e&&p(e=>e+1),{target:i,data:x}};return(0,eA.useEffect)(()=>{c({id:i.id,callback:g})},[]),(0,eO.jsxs)("div",{id:t,style:{display:"flex",flexDirection:"column",...s},className:f.filter(Boolean).join(" "),children:[(0,eO.jsx)(lb,{list:m,split:o,bordered:n,size:r,itemLayout:a}),h&&(0,eO.jsx)(X,{...h})]})},formComponent:e=>{let{model:t,onChange:l}=e,[n]=K.useForm();return(0,eA.useEffect)(()=>{n.setFieldsValue({size:t.size||"default",itemLayout:t.itemLayout||"horizontal",bordered:t.bordered??!1,split:t.split??!0,pageSize:t.pageSize||10})},[t,n]),(0,eO.jsxs)(K,{form:n,labelCol:{span:12},wrapperCol:{span:12},onValuesChange:e=>{null==l||l({...t,...e})},children:[(0,eO.jsx)(K.Item,{label:"大小",name:"size",children:(0,eO.jsxs)(Z.Group,{size:"small",buttonStyle:"solid",children:[(0,eO.jsx)(Z.Button,{value:"default",children:"默认"}),(0,eO.jsx)(Z.Button,{value:"small",children:"小"})]})}),(0,eO.jsx)(K.Item,{label:"布局",name:"itemLayout",children:(0,eO.jsxs)(Z.Group,{size:"small",buttonStyle:"solid",children:[(0,eO.jsx)(Z.Button,{value:"horizontal",children:"水平"}),(0,eO.jsx)(Z.Button,{value:"vertical",children:"垂直"})]})}),(0,eO.jsx)(K.Item,{label:"边框",name:"bordered",valuePropName:"checked",children:(0,eO.jsx)(er,{size:"small"})}),(0,eO.jsx)(K.Item,{label:"分割线",name:"split",valuePropName:"checked",children:(0,eO.jsx)(er,{size:"small"})}),(0,eO.jsx)(K.Item,{label:"分页大小",name:"pageSize",children:(0,eO.jsx)(U,{size:"small"})})]})},defaultOptions:{datasource:{source:"custom",custom:"[]"},props:{size:"default",itemLayout:"horizontal",bordered:!0,split:!0,pageSize:10}}},{group:"基础组件",key:"b-html",label:"HTML",icon:"icon-html",component:e=>{let{id:t,template:l="",item:n,style:r,className:a,classNames:i=[]}=e,{initCallback:o}=(0,eA.useContext)(eE),[s,d]=(0,eA.useState)(0),c=lu({item:n,signal:s}),u=(0,eA.useMemo)(()=>Object.keys(c||{}),[c]),p=(0,eA.useMemo)(()=>u.map(e=>null==c?void 0:c[e]),[u,c]),x=(0,eA.useMemo)(()=>(l||"").replace(/##\s*([^#]+)\s*##/g,(e,t)=>{try{return Function(...u,`
|
|
1089
1089
|
"use strict";
|
|
1090
1090
|
const window = undefined;
|
|
1091
1091
|
const document = undefined;
|
|
@@ -1095,7 +1095,7 @@ import*as e from"react";import t,{css as l}from"styled-components";import{AlignC
|
|
|
1095
1095
|
const module = undefined;
|
|
1096
1096
|
const exports = undefined;
|
|
1097
1097
|
return ${t};
|
|
1098
|
-
`)(...p)}catch{return""}}),[l,p]),m=function(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];return e&&d(e=>e+1),{target:n,data:c}};return(0,eA.useEffect)(()=>{o({id:n.id,callback:m})},[]),(0,eO.jsx)("div",{id:t,style:r,className:(i||[]).join(" ")+" "+a,dangerouslySetInnerHTML:{__html:x}})},formComponent:e=>{let{model:t,onChange:l}=e,n=(0,eA.useRef)(null),r=(e,n)=>l&&l({...t,[e]:n});return(0,eO.jsx)("div",{children:(0,eO.jsxs)(K,{layout:"vertical",children:[(0,eO.jsx)(K.Item,{label:"类名",children:(0,eO.jsx)(et,{size:"small",value:t.classNames,mode:"tags",onChange:e=>r("classNames",e)})}),(0,eO.jsx)(K.Item,{label:(0,eO.jsxs)(eO.Fragment,{children:["模板",(0,eO.jsxs)("a",{onClick:()=>{var e,t;let l=null==(e=n.current)?void 0:e.editor;null==l||null==(t=l.getAction("editor.action.formatDocument"))||t.run()},children:[(0,eO.jsx)(th,{type:"icon-formate"})," 格式化"]})]}),className:"ant-form-item-label-space",children:(0,eO.jsx)("div",{style:{border:"1px solid #d9d9d9",borderRadius:4,textAlign:"left"},children:(0,eO.jsx)(em,{onMount:e=>{n.current={editor:e}},height:"300px",defaultLanguage:"html",value:t.template,onChange:e=>r("template",e||""),options:{minimap:{enabled:!1},scrollBeyondLastLine:!1,tabSize:2}})})})]})})},defaultOptions:{datasource:{source:"custom",datasourceId:null,scriptId:null,custom:'{"name": "Confucius"}'},props:{template:"<div>{{name}}, welcome to the world of programming.</div>"}}},{group:"基础组件",key:"b-echarts",label:"图表",icon:"icon-echarts",component:e=>{let{id:t,script:l="",item:n,height:r=400,style:a,className:i}=e,{initCallback:o}=(0,eA.useContext)(
|
|
1098
|
+
`)(...p)}catch{return""}}),[l,p]),m=function(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];return e&&d(e=>e+1),{target:n,data:c}};return(0,eA.useEffect)(()=>{o({id:n.id,callback:m})},[]),(0,eO.jsx)("div",{id:t,style:r,className:(i||[]).join(" ")+" "+a,dangerouslySetInnerHTML:{__html:x}})},formComponent:e=>{let{model:t,onChange:l}=e,n=(0,eA.useRef)(null),r=(e,n)=>l&&l({...t,[e]:n});return(0,eO.jsx)("div",{children:(0,eO.jsxs)(K,{layout:"vertical",children:[(0,eO.jsx)(K.Item,{label:"类名",children:(0,eO.jsx)(et,{size:"small",value:t.classNames,mode:"tags",onChange:e=>r("classNames",e)})}),(0,eO.jsx)(K.Item,{label:(0,eO.jsxs)(eO.Fragment,{children:["模板",(0,eO.jsxs)("a",{onClick:()=>{var e,t;let l=null==(e=n.current)?void 0:e.editor;null==l||null==(t=l.getAction("editor.action.formatDocument"))||t.run()},children:[(0,eO.jsx)(th,{type:"icon-formate"})," 格式化"]})]}),className:"ant-form-item-label-space",children:(0,eO.jsx)("div",{style:{border:"1px solid #d9d9d9",borderRadius:4,textAlign:"left"},children:(0,eO.jsx)(em,{onMount:e=>{n.current={editor:e}},height:"300px",defaultLanguage:"html",value:t.template,onChange:e=>r("template",e||""),options:{minimap:{enabled:!1},scrollBeyondLastLine:!1,tabSize:2}})})})]})})},defaultOptions:{datasource:{source:"custom",datasourceId:null,scriptId:null,custom:'{"name": "Confucius"}'},props:{template:"<div>{{name}}, welcome to the world of programming.</div>"}}},{group:"基础组件",key:"b-echarts",label:"图表",icon:"icon-echarts",component:e=>{let{id:t,script:l="",item:n,height:r=400,style:a,className:i}=e,{initCallback:o}=(0,eA.useContext)(eE),s=(0,eA.useRef)(null),[d,c]=(0,eA.useState)(null),[u,p]=(0,eA.useState)(0),x=lu({item:n,signal:u}),m=function(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];return arguments.length>1&&arguments[1],e&&p(e=>e+1),{target:n,data:x}};return(0,eA.useEffect)(()=>{let e=(e=>{try{return JSON.parse(e)}catch(t){try{return Function("echarts","console","Math","Date","Array","Object","String","Number","Boolean","data",`
|
|
1099
1099
|
"use strict";
|
|
1100
1100
|
const window = undefined;
|
|
1101
1101
|
const document = undefined;
|
|
@@ -1111,4 +1111,4 @@ return {
|
|
|
1111
1111
|
yAxis: { type: 'value' },
|
|
1112
1112
|
series: [{ data: data.map(i => i.value), type: 'line' }]
|
|
1113
1113
|
}
|
|
1114
|
-
`}}},{group:"表单组件",key:"b-input",label:"输入框",icon:"icon-form-input",component:e=>{let{id:t,var:l="",placeholder:n="",prefix:r,suffix:a,size:i,allowClear:o=!1,search:s=!1,item:d,value:c,onChange:u,onSearch:p,style:x={},className:m}=e,{handleCallback:h,setVar:f}=(0,eA.useContext)(eT),g=e=>{u&&u(e),d&&l&&f(d,l,e)};return s?(0,eO.jsx)(W.Search,{id:t,value:c,size:i,allowClear:o,placeholder:n,onChange:e=>g(e.target.value),onSearch:()=>{p&&p(c||""),h(d)},style:{...x},className:m}):(0,eO.jsx)(W,{id:t,value:c,size:i,allowClear:o,placeholder:n,prefix:"string"==typeof r?void 0:r,suffix:"string"==typeof a?void 0:a,onChange:e=>g(e.target.value),style:{...x},className:m})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n});return(0,eO.jsxs)(K,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,eO.jsx)(K.Item,{label:"搜索框",children:(0,eO.jsx)(er,{size:"small",checked:!!t.search,onChange:e=>n("search",e)})}),(0,eO.jsx)(K.Item,{label:"变量名",children:(0,eO.jsx)(W,{size:"small",value:t.var,onChange:e=>n("var",e.target.value),placeholder:"请输入变量名"})}),(0,eO.jsx)(K.Item,{label:"占位符",children:(0,eO.jsx)(W,{size:"small",value:t.placeholder,onChange:e=>n("placeholder",e.target.value),placeholder:"请输入占位符"})}),!t.search&&(0,eO.jsxs)(eO.Fragment,{children:[(0,eO.jsx)(K.Item,{label:"前缀",children:(0,eO.jsx)(W,{size:"small",value:t.prefix,onChange:e=>n("prefix",e.target.value),placeholder:"请输入前缀"})}),(0,eO.jsx)(K.Item,{label:"后缀",children:(0,eO.jsx)(W,{size:"small",value:t.suffix,onChange:e=>n("suffix",e.target.value),placeholder:"请输入后缀"})})]}),(0,eO.jsx)(K.Item,{label:"大小",children:(0,eO.jsxs)(Z.Group,{size:"small",value:t.size,onChange:e=>n("size",e.target.value),children:[(0,eO.jsx)(Z.Button,{value:"small",children:"小"}),(0,eO.jsx)(Z.Button,{value:"middle",children:"中"}),(0,eO.jsx)(Z.Button,{value:"large",children:"大"})]})}),(0,eO.jsx)(K.Item,{label:"清除图标",children:(0,eO.jsx)(er,{size:"small",checked:!!t.allowClear,onChange:e=>n("allowClear",e)})})]})},defaultOptions:{props:{var:"",size:"default",allowClear:!0,search:!1,prefix:"",suffix:"",placeholder:"请输入"},cascadeIds:[]}},{group:"表单组件",key:"b-input-number",label:"数字输入框",icon:"icon-form-input-number",component:e=>{let{id:t,var:l="",value:n,size:r,placeholder:a="请输入",min:i=0,max:o=Number.MAX_SAFE_INTEGER,step:s=1,precision:d=0,item:c,onChange:u,style:p={},className:x}=e,{handleCallback:m,setVar:h}=(0,eA.useContext)(eT);return(0,eO.jsx)(U,{id:t,value:n,placeholder:a,size:r,min:i,max:o,step:s,precision:d,onChange:e=>{var t;return t=e??void 0,void(u&&u(t),c&&l&&h(c,l,t),m(c))},style:{width:"100%",...p},className:x})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n});return(0,eO.jsxs)(K,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,eO.jsx)(K.Item,{label:"变量名",children:(0,eO.jsx)(W,{size:"small",value:t.var,onChange:e=>n("var",e.target.value)})}),(0,eO.jsx)(K.Item,{label:"最小值",children:(0,eO.jsx)(U,{size:"small",value:t.min,onChange:e=>n("min",e)})}),(0,eO.jsx)(K.Item,{label:"最大值",children:(0,eO.jsx)(U,{size:"small",value:t.max,onChange:e=>n("max",e)})}),(0,eO.jsx)(K.Item,{label:"步长",children:(0,eO.jsx)(U,{size:"small",value:t.step,onChange:e=>n("step",e)})})]})},defaultOptions:{props:{var:"",size:"default",allowClear:!0,prefix:"",suffix:"",placeholder:"请输入",step:1,min:0,max:100,precision:0},cascadeIds:[]}},{group:"表单组件",key:"b-select",label:"选择框",icon:"icon-form-select",component:e=>{let{id:t,var:l="",size:n,placeholder:r="请选择",allowClear:a=!1,multiple:i=!1,options:o=[],item:s,value:d,onChange:c,style:u={},className:p}=e,{handleCallback:x,setVar:m}=(0,eA.useContext)(eT);return(0,eO.jsx)(et,{id:t,value:d,size:n,placeholder:r,allowClear:a,mode:i?"multiple":void 0,options:o,onChange:e=>{c&&c(e),s&&l&&m(s,l,e),x(s)},style:{width:"100%",...u},className:p})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n}),r=(e,l,r)=>{let a=[...t.options||[]];a[e]={...a[e],[l]:r},n("options",a)},a=[{title:"选项标签",dataIndex:"label",render:(e,t,l)=>(0,eO.jsx)(W,{size:"small",value:t.label,onChange:e=>r(l,"label",e.target.value)})},{title:"选项值",dataIndex:"value",render:(e,t,l)=>(0,eO.jsx)(W,{size:"small",value:t.value,onChange:e=>r(l,"value",e.target.value)})},{title:"操作",render:(e,l,r)=>(0,eO.jsx)(en,{children:(0,eO.jsx)(P,{danger:!0,size:"small",onClick:()=>{let e;(e=[...t.options||[]]).splice(r,1),n("options",e)},children:(0,eO.jsx)(c,{})})})}];return(0,eO.jsxs)(K,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,eO.jsx)(K.Item,{label:"变量名",children:(0,eO.jsx)(W,{size:"small",value:t.var,onChange:e=>n("var",e.target.value),placeholder:"请输入变量名"})}),(0,eO.jsx)(K.Item,{label:"占位符",children:(0,eO.jsx)(W,{size:"small",value:t.placeholder,onChange:e=>n("placeholder",e.target.value),placeholder:"请输入占位符"})}),(0,eO.jsx)(K.Item,{label:"大小",children:(0,eO.jsxs)(Z.Group,{size:"small",value:t.size,onChange:e=>n("size",e.target.value),children:[(0,eO.jsx)(Z.Button,{value:"small",children:"小"}),(0,eO.jsx)(Z.Button,{value:"middle",children:"中"}),(0,eO.jsx)(Z.Button,{value:"large",children:"大"})]})}),(0,eO.jsx)(K.Item,{label:"清除图标",children:(0,eO.jsx)(er,{size:"small",checked:!!t.allowClear,onChange:e=>n("allowClear",e)})}),(0,eO.jsx)(K.Item,{label:"多选",children:(0,eO.jsx)(er,{size:"small",checked:!!t.multiple,onChange:e=>n("multiple",e)})}),(0,eO.jsxs)(K.Item,{labelCol:{span:24},wrapperCol:{span:24},children:[(0,eO.jsx)(ea,{size:"small",dataSource:t.options,columns:a,pagination:!1,rowKey:(e,t)=>String(t),bordered:!0}),(0,eO.jsx)(P,{size:"small",block:!0,onClick:()=>{n("options",[...t.options||[],{label:"",value:""}])},children:"添加选项"})]})]})},defaultOptions:{props:{var:"",size:"default",allowClear:!0,multiple:!1,options:[{label:"选项1",value:"1"},{label:"选项2",value:"2"}]},cascadeIds:[]}},{group:"表单组件",key:"b-capsule",label:"胶囊选择框",icon:"icon-form-capsule",component:e=>{let{id:t,var:l="",size:n="middle",options:r=[],item:a,onChange:i,style:o,className:s}=e,{handleCallback:d,setVar:c}=(0,eA.useContext)(eT);return(0,eO.jsx)("span",{id:t,children:(0,eO.jsx)(Z.Group,{id:t,size:n,buttonStyle:"solid",onChange:e=>{var t;return t=e.target.value,void(i&&i(t),a&&l&&c(a,l,t),d(a))},style:o,className:s,children:r.map(e=>(0,eO.jsx)(Z.Button,{value:e.value,children:e.label},e.value))})})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n}),r=(e,l,r)=>{let a=[...t.options||[]];a[e]={...a[e],[l]:r},n("options",a)},a=[{title:"选项标签",dataIndex:"label",render:(e,t,l)=>(0,eO.jsx)(W,{size:"small",value:t.label,onChange:e=>r(l,"label",e.target.value)})},{title:"选项值",dataIndex:"value",render:(e,t,l)=>(0,eO.jsx)(W,{size:"small",value:t.value,onChange:e=>r(l,"value",e.target.value)})},{title:"操作",render:(e,l,r)=>(0,eO.jsx)(en,{children:(0,eO.jsx)(P,{danger:!0,size:"small",onClick:()=>{let e;(e=[...t.options||[]]).splice(r,1),n("options",e)},children:(0,eO.jsx)(c,{})})})}];return(0,eO.jsxs)(K,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,eO.jsx)(K.Item,{label:"变量名",children:(0,eO.jsx)(W,{size:"small",value:t.var,onChange:e=>n("var",e.target.value),placeholder:"请输入变量名"})}),(0,eO.jsx)(K.Item,{label:"大小",children:(0,eO.jsxs)(Z.Group,{size:"small",value:t.size,onChange:e=>n("size",e.target.value),children:[(0,eO.jsx)(Z.Button,{value:"small",children:"小"}),(0,eO.jsx)(Z.Button,{value:"middle",children:"中"}),(0,eO.jsx)(Z.Button,{value:"large",children:"大"})]})}),(0,eO.jsxs)(K.Item,{labelCol:{span:24},wrapperCol:{span:24},children:[(0,eO.jsx)(ea,{size:"small",dataSource:t.options,columns:a,pagination:!1,rowKey:(e,t)=>String(t),bordered:!0}),(0,eO.jsx)(P,{size:"small",block:!0,onClick:()=>{n("options",[...t.options||[],{label:"",value:""}])},children:"添加选项"})]})]})},defaultOptions:{props:{var:"",size:"default",allowClear:!0,multiple:!1,options:[{label:"选项1",value:"1"},{label:"选项2",value:"2"}]},cascadeIds:[]}},{group:"表单组件",key:"b-checkbox",label:"复选框",icon:"icon-form-checkbox",component:e=>{let{id:t,var:l="",layout:n="horizontal",lineNumber:r=3,options:a=[],item:i,onChange:o,style:s,className:d}=e,{handleCallback:c,setVar:u}=(0,eA.useContext)(eT),p={...s,display:"grid"===n?"grid":"flex",gap:"grid"===n?void 0:"8px",flexDirection:"vertical"===n?"column":"row",gridTemplateColumns:"grid"===n?`repeat(${r}, 1fr)`:void 0};return(0,eO.jsx)("span",{id:t,children:(0,eO.jsx)(_.Group,{onChange:e=>{o&&o(e),i&&l&&u(i,l,e),c(i)},style:p,className:d,children:a.map(e=>(0,eO.jsx)(_,{value:e.value,children:e.label},e.value))})})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n}),r=(e,l,r)=>{let a=[...t.options||[]];a[e]={...a[e],[l]:r},n("options",a)},a=[{title:"选项标签",dataIndex:"label",render:(e,t,l)=>(0,eO.jsx)(W,{size:"small",value:t.label,onChange:e=>r(l,"label",e.target.value)})},{title:"选项值",dataIndex:"value",render:(e,t,l)=>(0,eO.jsx)(W,{size:"small",value:t.value,onChange:e=>r(l,"value",e.target.value)})},{title:"操作",render:(e,l,r)=>(0,eO.jsx)(en,{children:(0,eO.jsx)(P,{danger:!0,size:"small",onClick:()=>{let e;(e=[...t.options||[]]).splice(r,1),n("options",e)},children:(0,eO.jsx)(c,{})})})}];return(0,eO.jsxs)(K,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,eO.jsx)(K.Item,{label:"变量名",children:(0,eO.jsx)(W,{size:"small",value:t.var,onChange:e=>n("var",e.target.value),placeholder:"请输入变量名"})}),(0,eO.jsx)(K.Item,{label:"布局",children:(0,eO.jsxs)(Z.Group,{size:"small",value:t.layout,onChange:e=>n("layout",e.target.value),children:[(0,eO.jsx)(Z.Button,{value:"horizontal",children:"水平"}),(0,eO.jsx)(Z.Button,{value:"vertical",children:"垂直"}),(0,eO.jsx)(Z.Button,{value:"grid",children:"网格"})]})}),"grid"===t.layout&&(0,eO.jsx)(K.Item,{label:"网格行数",children:(0,eO.jsx)(U,{size:"small",value:t.lineNumber,onChange:e=>n("lineNumber",e),min:1,max:10})}),(0,eO.jsxs)(K.Item,{labelCol:{span:24},wrapperCol:{span:24},children:[(0,eO.jsx)(ea,{size:"small",dataSource:t.options,columns:a,pagination:!1,rowKey:(e,t)=>String(t),bordered:!0}),(0,eO.jsx)(P,{size:"small",block:!0,onClick:()=>{n("options",[...t.options||[],{label:"",value:""}])},children:"添加选项"})]})]})},defaultOptions:{props:{var:"",layout:"horizontal",lineNumber:3,options:[{label:"选项1",value:"1"},{label:"选项2",value:"2"}]},cascadeIds:[]}},{group:"表单组件",key:"b-date-picker",label:"日期选择器",icon:"icon-form-date-picker",component:e=>{let{id:t,var:l="",size:n,allowClear:r=!1,type:a="date",showTime:i=!1,value:o,item:s,onChange:d,style:c={},className:u}=e,{handleCallback:p,setVar:x}=(0,eA.useContext)(eT),m=e=>{d&&d(e),s&&l&&x(s,l,e),p(s)};if("time"===a){let e="string"==typeof o&&o?eg(o,"HH:mm"):void 0;return(0,eO.jsx)(eo,{id:t,value:e,format:"HH:mm",placeholder:"请选择时间",size:n,allowClear:r,onChange:e=>m(e?e.format("HH:mm"):void 0),style:{...(null==s?void 0:s.style)||{},...c},className:u})}if("month"===a||"year"===a){let e="month"===a?"YYYY-MM":"YYYY",l="string"==typeof o&&o?eg(o,e):void 0;return(0,eO.jsx)(Y,{id:t,picker:a,value:l,format:e,placeholder:"month"===a?"请选择月份":"请选择年份",size:n,allowClear:r,onChange:t=>m(t?t.format(e):void 0),onPanelChange:t=>m(t?t.format(e):void 0),style:{...(null==s?void 0:s.style)||{},...c},className:u})}if("range"===a){let e=i?"YYYY-MM-DD HH:mm":"YYYY-MM-DD",l=Array.isArray(o)&&o[0]?eg(o[0],e):void 0,a=Array.isArray(o)&&o[1]?eg(o[1],e):void 0;return(0,eO.jsx)(Y.RangePicker,{id:t,value:[l,a],format:e,placeholder:["开始日期","结束日期"],size:n,allowClear:r,showTime:i,onChange:t=>m(t&&t[0]&&t[1]?[t[0].format(e),t[1].format(e)]:void 0),style:{...(null==s?void 0:s.style)||{},...c},className:u})}let h=i?"YYYY-MM-DD HH:mm":"YYYY-MM-DD",f="string"==typeof o&&o?eg(o,h):void 0;return(0,eO.jsx)(Y,{id:t,value:f,format:h,placeholder:"请选择日期",size:n,allowClear:r,showTime:i,style:{...(null==s?void 0:s.style)||{},...c},className:u,onChange:e=>m(e?e.format(h):void 0)})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n});return(0,eO.jsxs)(K,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,eO.jsx)(K.Item,{label:"变量名",children:(0,eO.jsx)(W,{size:"small",value:t.var,onChange:e=>n("var",e.target.value),placeholder:"请输入变量名"})}),(0,eO.jsx)(K.Item,{label:"类型",children:(0,eO.jsxs)(Z.Group,{size:"small",value:t.type,onChange:e=>n("type",e.target.value),children:[(0,eO.jsx)(Z.Button,{value:"date",children:"日期"}),(0,eO.jsx)(Z.Button,{value:"time",children:"时间"}),(0,eO.jsx)(Z.Button,{value:"month",children:"月份"}),(0,eO.jsx)(Z.Button,{value:"year",children:"年份"}),(0,eO.jsx)(Z.Button,{value:"range",children:"日期范围"})]})}),(0,eO.jsx)(K.Item,{label:"大小",children:(0,eO.jsxs)(Z.Group,{size:"small",value:t.size,onChange:e=>n("size",e.target.value),children:[(0,eO.jsx)(Z.Button,{value:"small",children:"小"}),(0,eO.jsx)(Z.Button,{value:"middle",children:"中"}),(0,eO.jsx)(Z.Button,{value:"large",children:"大"})]})}),(0,eO.jsx)(K.Item,{label:"清除图标",children:(0,eO.jsx)(er,{size:"small",checked:!!t.allowClear,onChange:e=>n("allowClear",e)})}),(0,eO.jsx)(K.Item,{label:"显示时间",children:(0,eO.jsx)(er,{size:"small",checked:!!t.showTime,onChange:e=>n("showTime",e)})})]})},defaultOptions:{props:{var:"",size:"default",allowClear:!0,showTime:!1,type:"date"},cascadeIds:[]}},{group:"表单组件",key:"b-switch",label:"开关",icon:"icon-form-switch",component:e=>{let{id:t,var:l="",checked:n,disabled:r,size:a="default",checkedChildren:i,unCheckedChildren:o,item:s,onChange:d,style:c={},className:u}=e,{handleCallback:p,setVar:x}=(0,eA.useContext)(eT);return(0,eO.jsx)("span",{children:(0,eO.jsx)(er,{id:t,checked:n,disabled:r,size:"small"===a?"small":void 0,checkedChildren:i,unCheckedChildren:o,onChange:e=>{d&&d(e),s&&l&&x(s,l,e),p(s)},style:c,className:u})})},formComponent:e=>{let{model:t,onChange:l}=e;return(0,eO.jsx)(K,{labelCol:{span:6},wrapperCol:{span:18},children:(0,eO.jsx)(K.Item,{label:"变量名",children:(0,eO.jsx)(W,{size:"small",value:t.var,onChange:e=>{let n;return n=e.target.value,l&&l({...t,var:n})},placeholder:"请输入变量名"})})})},defaultOptions:{props:{var:"",size:"default",checkedChildren:"开",unCheckedChildren:"关"},cascadeIds:[]}},{group:"容器组件",key:"b-space",label:"容器",icon:"icon-space",component:e=>{let{id:t,align:l="start",size:n="small",direction:r="horizontal",item:a,ancestors:i,style:o={},className:s}=e,[d,c]=(0,eA.useState)(a.children||[]),u=(0,eA.useMemo)(()=>({...o,...a.style||{},alignItems:l,flexDirection:r,gap:n}),[a,l,n,r]);return(0,eA.useEffect)(()=>{c(a.children||[])},[a.children]),(0,eO.jsx)(ty,{rootComponent:en,rootData:{id:t,style:u,className:s},item:a,ancestors:[...i,a],list:d,onListChange:e=>{a.children=e,c(e)}})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n});return(0,eO.jsxs)(K,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,eO.jsx)(K.Item,{label:"方向",children:(0,eO.jsxs)(Z.Group,{size:"small",value:t.direction,onChange:e=>n("direction",e.target.value),children:[(0,eO.jsx)(Z.Button,{value:"horizontal",children:"水平"}),(0,eO.jsx)(Z.Button,{value:"vertical",children:"垂直"})]})}),(0,eO.jsx)(K.Item,{label:"大小",children:(0,eO.jsxs)(Z.Group,{size:"small",value:t.size,onChange:e=>n("size",e.target.value),children:[(0,eO.jsx)(Z.Button,{value:"small",children:"小"}),(0,eO.jsx)(Z.Button,{value:"middle",children:"中"}),(0,eO.jsx)(Z.Button,{value:"large",children:"大"})]})}),(0,eO.jsx)(K.Item,{label:"对齐",children:(0,eO.jsxs)(Z.Group,{size:"small",value:t.align,onChange:e=>n("align",e.target.value),children:[(0,eO.jsx)(Z.Button,{value:"start",children:"开始"}),(0,eO.jsx)(Z.Button,{value:"end",children:"结束"}),(0,eO.jsx)(Z.Button,{value:"center",children:"居中"}),(0,eO.jsx)(Z.Button,{value:"baseline",children:"基线"})]})})]})},defaultOptions:{props:{align:"flex-start",direction:"row",size:"8px"},children:[]}},{group:"容器组件",key:"b-card",label:"卡片",icon:"icon-card",component:e=>{let{id:t,bordered:l=!1,size:n="default",title:r,hoverable:a=!1,shadow:i=!0,item:o,ancestors:s,style:d,className:c}=e,u=(0,eA.useMemo)(()=>!o.children||Array.isArray(o.children)||"object"!=typeof o.children?null:o.children.title||[],[o]),[p,x]=(0,eA.useState)(u||[]),m=(0,eA.useMemo)(()=>!o.children||Array.isArray(o.children)||"object"!=typeof o.children?null:o.children.extra||[],[o]),[h,f]=(0,eA.useState)(m||[]),g=(0,eA.useMemo)(()=>o.children?Array.isArray(o.children)?o.children:"object"!=typeof o.children?null:o.children.body||[]:null,[o]),[v,j]=(0,eA.useState)(g||[]),b=(0,eA.useMemo)(()=>!o.children||Array.isArray(o.children)||"object"!=typeof o.children?null:o.children.actions||[],[o]),[y,w]=(0,eA.useState)(b||[]);return(0,eA.useEffect)(()=>{x(u||[])},[u]),(0,eA.useEffect)(()=>{f(m||[])},[m]),(0,eA.useEffect)(()=>{j(g||[])},[g]),(0,eA.useEffect)(()=>{w(b||[])},[b]),(0,eO.jsx)(M,{id:t,variant:l?"outlined":"borderless",size:n,hoverable:a,className:[i?"ant-card-shadow":void 0,c].filter(Boolean).join(" "),title:(null==r?void 0:r.length)&&!(null==u?void 0:u.length)?r:u?(0,eO.jsx)(ty,{ancestors:[...s,o],list:p,onListChange:e=>{o.children.title=e,x(e)}}):r,extra:m&&(0,eO.jsx)(ty,{ancestors:[...s,o],list:h,onListChange:e=>{o.children.extra=e,f(e)}}),actions:b&&[(0,eO.jsx)(ty,{ancestors:[...s,o],list:y,onListChange:e=>{o.children.actions=e,w(e)}})],styles:{header:{borderBottom:"none"}},style:d,children:g&&(0,eO.jsx)(ty,{ancestors:[...s,o],list:v,onListChange:e=>{Array.isArray(o.children)?o.children=e:o.children.body=e,j(e)}})})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n});return(0,eO.jsxs)(K,{labelCol:{span:12},wrapperCol:{span:12},children:[(0,eO.jsx)(K.Item,{label:"标题",children:(0,eO.jsx)(W,{size:"small",value:t.title,onChange:e=>n("title",e.target.value)})}),(0,eO.jsx)(K.Item,{label:"边框",children:(0,eO.jsx)(er,{size:"small",checked:!!t.bordered,onChange:e=>n("bordered",e)})}),(0,eO.jsx)(K.Item,{label:"悬停效果",children:(0,eO.jsx)(er,{size:"small",checked:!!t.hoverable,onChange:e=>n("hoverable",e)})}),(0,eO.jsx)(K.Item,{label:"阴影",children:(0,eO.jsx)(er,{size:"small",checked:!!t.shadow,onChange:e=>n("shadow",e)})}),(0,eO.jsx)(K.Item,{label:"大小",children:(0,eO.jsxs)(Z.Group,{size:"small",value:t.size,onChange:e=>n("size",e.target.value),children:[(0,eO.jsx)(Z.Button,{value:"default",children:"默认"}),(0,eO.jsx)(Z.Button,{value:"small",children:"小"})]})})]})},defaultOptions:{props:{title:"标题",bordered:!0,hoverable:!0,shadow:!0,size:"default"},children:{title:[],extra:[],body:[],actions:[]}}},{group:"容器组件",key:"b-row",label:"栅格行",icon:"icon-grid-row",component:e=>{let{id:t,gutter:l,item:n,ancestors:r,style:a,className:i}=e,[o,s]=(0,eA.useState)(n.children||[]);return(0,eA.useEffect)(()=>{s(n.children||[])},[n.children]),(0,eO.jsx)(ty,{rootComponent:ee,rootData:{id:t,gutter:l,style:n.style||a,className:n.className||i},item:n,ancestors:[...r,n],list:o,onListChange:e=>{n.children=e,s(e)}})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n}),r=t.gutter||[0,0];return(0,eO.jsxs)(K,{labelCol:{span:12},wrapperCol:{span:12},children:[(0,eO.jsx)(K.Item,{label:"列间距",children:(0,eO.jsx)(U,{size:"small",value:r[0],min:0,step:4,onChange:e=>n("gutter",[e||0,r[1]])})}),(0,eO.jsx)(K.Item,{label:"行间距",children:(0,eO.jsx)(U,{size:"small",value:r[1],min:0,step:4,onChange:e=>n("gutter",[r[0],e||0])})})]})},defaultOptions:{props:{gutter:[12,12]},children:[]}},{group:"容器组件",key:"b-col",label:"栅格列",icon:"icon-grid-columns",component:e=>{let{id:t,span:l=24,xs:n,sm:r,md:a,lg:i,xl:o,xxl:s,item:d,ancestors:c,style:u={},className:p}=e,{deviceWidth:x}=(0,eA.useContext)(eT),[m,h]=(0,eA.useState)(d.children||[]),f=(0,eA.useMemo)(()=>{let e=x||1600,t=null;return e<576&&n&&(t=n),e>=576&&r&&(t=r),e>=768&&a&&(t=a),e>=992&&i&&(t=i),e>=1200&&o&&(t=o),e>=1600&&s&&(t=s),t||l},[n,r,a,i,o,s,l,x]);return(0,eA.useEffect)(()=>{h(d.children||[])},[d.children]),(0,eO.jsx)(ty,{rootComponent:$,rootData:{id:t||d.id,span:f,style:{...d.style||{},...u},className:p},item:d,ancestors:[...c,d],list:m,onListChange:e=>{d.children=e,h(e)}})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n});return(0,eO.jsxs)(K,{labelCol:{span:12},wrapperCol:{span:12},children:[(0,eO.jsx)(K.Item,{label:"默认列数",children:(0,eO.jsx)(U,{size:"small",value:t.span,min:0,max:24,step:4,onChange:e=>n("span",e||0)})}),(0,eO.jsx)(K.Item,{label:(0,eO.jsxs)(eO.Fragment,{children:["xs"," ",(0,eO.jsx)(es,{title:"<576px 响应式栅格",children:(0,eO.jsx)(ld,{})})]}),children:(0,eO.jsx)(U,{size:"small",value:t.xs,min:0,max:24,step:4,onChange:e=>n("xs",e||0)})}),(0,eO.jsx)(K.Item,{label:(0,eO.jsxs)(eO.Fragment,{children:["sm"," ",(0,eO.jsx)(es,{title:"≥576px 响应式栅格",children:(0,eO.jsx)(ld,{})})]}),children:(0,eO.jsx)(U,{size:"small",value:t.sm,min:0,max:24,step:4,onChange:e=>n("sm",e||0)})}),(0,eO.jsx)(K.Item,{label:(0,eO.jsxs)(eO.Fragment,{children:["md"," ",(0,eO.jsx)(es,{title:"≥768px 响应式栅格",children:(0,eO.jsx)(ld,{})})]}),children:(0,eO.jsx)(U,{size:"small",value:t.md,min:0,max:24,step:4,onChange:e=>n("md",e||0)})}),(0,eO.jsx)(K.Item,{label:(0,eO.jsxs)(eO.Fragment,{children:["lg"," ",(0,eO.jsx)(es,{title:"≥992px 响应式栅格",children:(0,eO.jsx)(ld,{})})]}),children:(0,eO.jsx)(U,{size:"small",value:t.lg,min:0,max:24,step:4,onChange:e=>n("lg",e||0)})}),(0,eO.jsx)(K.Item,{label:(0,eO.jsxs)(eO.Fragment,{children:["xl"," ",(0,eO.jsx)(es,{title:"≥1200px 响应式栅格",children:(0,eO.jsx)(ld,{})})]}),children:(0,eO.jsx)(U,{size:"small",value:t.xl,min:0,max:24,step:4,onChange:e=>n("xl",e||0)})}),(0,eO.jsx)(K.Item,{label:(0,eO.jsxs)(eO.Fragment,{children:["xxl"," ",(0,eO.jsx)(es,{title:"≥1600px 响应式栅格",children:(0,eO.jsx)(ld,{})})]}),children:(0,eO.jsx)(U,{size:"small",value:t.xxl,min:0,max:24,step:4,onChange:e=>n("xxl",e||0)})})]})},defaultOptions:{props:{xs:24,sm:12,md:12,lg:6,xl:6,xxl:6,span:8},children:[]}}]})();var eC=ew.ru,eS=ew.Ei,ek=ew.NQ,ez=ew.B7,eI=ew.Ts,eN=ew.V2,eO=ew.QE,eA=ew.NG,eT=ew.Nx,eD=ew.ps;export{eC as DropContainer,eS as PageCanvas,ek as PageContext,ez as PageDesigner,eI as PageProvider,eN as PageSchema,eO as PluginType,eA as PropEditorProps,eT as plugins,eD as useDatasource};
|
|
1114
|
+
`}}},{group:"表单组件",key:"b-input",label:"输入框",icon:"icon-form-input",component:e=>{let{id:t,var:l="",placeholder:n="",prefix:r,suffix:a,size:i,allowClear:o=!1,search:s=!1,item:d,value:c,onChange:u,onSearch:p,style:x={},className:m}=e,{handleCallback:h,setVar:f}=(0,eA.useContext)(eE),g=e=>{u&&u(e),d&&l&&f(d,l,e)};return s?(0,eO.jsx)(W.Search,{id:t,value:c,size:i,allowClear:o,placeholder:n,onChange:e=>g(e.target.value),onSearch:()=>{p&&p(c||""),h(d)},style:{...x},className:m}):(0,eO.jsx)(W,{id:t,value:c,size:i,allowClear:o,placeholder:n,prefix:"string"==typeof r?void 0:r,suffix:"string"==typeof a?void 0:a,onChange:e=>g(e.target.value),style:{...x},className:m})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n});return(0,eO.jsxs)(K,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,eO.jsx)(K.Item,{label:"搜索框",children:(0,eO.jsx)(er,{size:"small",checked:!!t.search,onChange:e=>n("search",e)})}),(0,eO.jsx)(K.Item,{label:"变量名",children:(0,eO.jsx)(W,{size:"small",value:t.var,onChange:e=>n("var",e.target.value),placeholder:"请输入变量名"})}),(0,eO.jsx)(K.Item,{label:"占位符",children:(0,eO.jsx)(W,{size:"small",value:t.placeholder,onChange:e=>n("placeholder",e.target.value),placeholder:"请输入占位符"})}),!t.search&&(0,eO.jsxs)(eO.Fragment,{children:[(0,eO.jsx)(K.Item,{label:"前缀",children:(0,eO.jsx)(W,{size:"small",value:t.prefix,onChange:e=>n("prefix",e.target.value),placeholder:"请输入前缀"})}),(0,eO.jsx)(K.Item,{label:"后缀",children:(0,eO.jsx)(W,{size:"small",value:t.suffix,onChange:e=>n("suffix",e.target.value),placeholder:"请输入后缀"})})]}),(0,eO.jsx)(K.Item,{label:"大小",children:(0,eO.jsxs)(Z.Group,{size:"small",value:t.size,onChange:e=>n("size",e.target.value),children:[(0,eO.jsx)(Z.Button,{value:"small",children:"小"}),(0,eO.jsx)(Z.Button,{value:"middle",children:"中"}),(0,eO.jsx)(Z.Button,{value:"large",children:"大"})]})}),(0,eO.jsx)(K.Item,{label:"清除图标",children:(0,eO.jsx)(er,{size:"small",checked:!!t.allowClear,onChange:e=>n("allowClear",e)})})]})},defaultOptions:{props:{var:"",size:"default",allowClear:!0,search:!1,prefix:"",suffix:"",placeholder:"请输入"},cascadeIds:[]}},{group:"表单组件",key:"b-input-number",label:"数字输入框",icon:"icon-form-input-number",component:e=>{let{id:t,var:l="",value:n,size:r,placeholder:a="请输入",min:i=0,max:o=Number.MAX_SAFE_INTEGER,step:s=1,precision:d=0,item:c,onChange:u,style:p={},className:x}=e,{handleCallback:m,setVar:h}=(0,eA.useContext)(eE);return(0,eO.jsx)(U,{id:t,value:n,placeholder:a,size:r,min:i,max:o,step:s,precision:d,onChange:e=>{var t;return t=e??void 0,void(u&&u(t),c&&l&&h(c,l,t),m(c))},style:{width:"100%",...p},className:x})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n});return(0,eO.jsxs)(K,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,eO.jsx)(K.Item,{label:"变量名",children:(0,eO.jsx)(W,{size:"small",value:t.var,onChange:e=>n("var",e.target.value)})}),(0,eO.jsx)(K.Item,{label:"最小值",children:(0,eO.jsx)(U,{size:"small",value:t.min,onChange:e=>n("min",e)})}),(0,eO.jsx)(K.Item,{label:"最大值",children:(0,eO.jsx)(U,{size:"small",value:t.max,onChange:e=>n("max",e)})}),(0,eO.jsx)(K.Item,{label:"步长",children:(0,eO.jsx)(U,{size:"small",value:t.step,onChange:e=>n("step",e)})})]})},defaultOptions:{props:{var:"",size:"default",allowClear:!0,prefix:"",suffix:"",placeholder:"请输入",step:1,min:0,max:100,precision:0},cascadeIds:[]}},{group:"表单组件",key:"b-select",label:"选择框",icon:"icon-form-select",component:e=>{let{id:t,var:l="",size:n,placeholder:r="请选择",allowClear:a=!1,multiple:i=!1,options:o=[],item:s,value:d,onChange:c,style:u={},className:p}=e,{handleCallback:x,setVar:m}=(0,eA.useContext)(eE);return(0,eO.jsx)(et,{id:t,value:d,size:n,placeholder:r,allowClear:a,mode:i?"multiple":void 0,options:o,onChange:e=>{c&&c(e),s&&l&&m(s,l,e),x(s)},style:{width:"100%",...u},className:p})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n}),r=(e,l,r)=>{let a=[...t.options||[]];a[e]={...a[e],[l]:r},n("options",a)},a=[{title:"选项标签",dataIndex:"label",render:(e,t,l)=>(0,eO.jsx)(W,{size:"small",value:t.label,onChange:e=>r(l,"label",e.target.value)})},{title:"选项值",dataIndex:"value",render:(e,t,l)=>(0,eO.jsx)(W,{size:"small",value:t.value,onChange:e=>r(l,"value",e.target.value)})},{title:"操作",render:(e,l,r)=>(0,eO.jsx)(en,{children:(0,eO.jsx)(P,{danger:!0,size:"small",onClick:()=>{let e;(e=[...t.options||[]]).splice(r,1),n("options",e)},children:(0,eO.jsx)(c,{})})})}];return(0,eO.jsxs)(K,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,eO.jsx)(K.Item,{label:"变量名",children:(0,eO.jsx)(W,{size:"small",value:t.var,onChange:e=>n("var",e.target.value),placeholder:"请输入变量名"})}),(0,eO.jsx)(K.Item,{label:"占位符",children:(0,eO.jsx)(W,{size:"small",value:t.placeholder,onChange:e=>n("placeholder",e.target.value),placeholder:"请输入占位符"})}),(0,eO.jsx)(K.Item,{label:"大小",children:(0,eO.jsxs)(Z.Group,{size:"small",value:t.size,onChange:e=>n("size",e.target.value),children:[(0,eO.jsx)(Z.Button,{value:"small",children:"小"}),(0,eO.jsx)(Z.Button,{value:"middle",children:"中"}),(0,eO.jsx)(Z.Button,{value:"large",children:"大"})]})}),(0,eO.jsx)(K.Item,{label:"清除图标",children:(0,eO.jsx)(er,{size:"small",checked:!!t.allowClear,onChange:e=>n("allowClear",e)})}),(0,eO.jsx)(K.Item,{label:"多选",children:(0,eO.jsx)(er,{size:"small",checked:!!t.multiple,onChange:e=>n("multiple",e)})}),(0,eO.jsxs)(K.Item,{labelCol:{span:24},wrapperCol:{span:24},children:[(0,eO.jsx)(ea,{size:"small",dataSource:t.options,columns:a,pagination:!1,rowKey:(e,t)=>String(t),bordered:!0}),(0,eO.jsx)(P,{size:"small",block:!0,onClick:()=>{n("options",[...t.options||[],{label:"",value:""}])},children:"添加选项"})]})]})},defaultOptions:{props:{var:"",size:"default",allowClear:!0,multiple:!1,options:[{label:"选项1",value:"1"},{label:"选项2",value:"2"}]},cascadeIds:[]}},{group:"表单组件",key:"b-capsule",label:"胶囊选择框",icon:"icon-form-capsule",component:e=>{let{id:t,var:l="",size:n="middle",options:r=[],item:a,onChange:i,style:o,className:s}=e,{handleCallback:d,setVar:c}=(0,eA.useContext)(eE);return(0,eO.jsx)("span",{id:t,children:(0,eO.jsx)(Z.Group,{id:t,size:n,buttonStyle:"solid",onChange:e=>{var t;return t=e.target.value,void(i&&i(t),a&&l&&c(a,l,t),d(a))},style:o,className:s,children:r.map(e=>(0,eO.jsx)(Z.Button,{value:e.value,children:e.label},e.value))})})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n}),r=(e,l,r)=>{let a=[...t.options||[]];a[e]={...a[e],[l]:r},n("options",a)},a=[{title:"选项标签",dataIndex:"label",render:(e,t,l)=>(0,eO.jsx)(W,{size:"small",value:t.label,onChange:e=>r(l,"label",e.target.value)})},{title:"选项值",dataIndex:"value",render:(e,t,l)=>(0,eO.jsx)(W,{size:"small",value:t.value,onChange:e=>r(l,"value",e.target.value)})},{title:"操作",render:(e,l,r)=>(0,eO.jsx)(en,{children:(0,eO.jsx)(P,{danger:!0,size:"small",onClick:()=>{let e;(e=[...t.options||[]]).splice(r,1),n("options",e)},children:(0,eO.jsx)(c,{})})})}];return(0,eO.jsxs)(K,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,eO.jsx)(K.Item,{label:"变量名",children:(0,eO.jsx)(W,{size:"small",value:t.var,onChange:e=>n("var",e.target.value),placeholder:"请输入变量名"})}),(0,eO.jsx)(K.Item,{label:"大小",children:(0,eO.jsxs)(Z.Group,{size:"small",value:t.size,onChange:e=>n("size",e.target.value),children:[(0,eO.jsx)(Z.Button,{value:"small",children:"小"}),(0,eO.jsx)(Z.Button,{value:"middle",children:"中"}),(0,eO.jsx)(Z.Button,{value:"large",children:"大"})]})}),(0,eO.jsxs)(K.Item,{labelCol:{span:24},wrapperCol:{span:24},children:[(0,eO.jsx)(ea,{size:"small",dataSource:t.options,columns:a,pagination:!1,rowKey:(e,t)=>String(t),bordered:!0}),(0,eO.jsx)(P,{size:"small",block:!0,onClick:()=>{n("options",[...t.options||[],{label:"",value:""}])},children:"添加选项"})]})]})},defaultOptions:{props:{var:"",size:"default",allowClear:!0,multiple:!1,options:[{label:"选项1",value:"1"},{label:"选项2",value:"2"}]},cascadeIds:[]}},{group:"表单组件",key:"b-checkbox",label:"复选框",icon:"icon-form-checkbox",component:e=>{let{id:t,var:l="",layout:n="horizontal",lineNumber:r=3,options:a=[],item:i,onChange:o,style:s,className:d}=e,{handleCallback:c,setVar:u}=(0,eA.useContext)(eE),p={...s,display:"grid"===n?"grid":"flex",gap:"grid"===n?void 0:"8px",flexDirection:"vertical"===n?"column":"row",gridTemplateColumns:"grid"===n?`repeat(${r}, 1fr)`:void 0};return(0,eO.jsx)("span",{id:t,children:(0,eO.jsx)(_.Group,{onChange:e=>{o&&o(e),i&&l&&u(i,l,e),c(i)},style:p,className:d,children:a.map(e=>(0,eO.jsx)(_,{value:e.value,children:e.label},e.value))})})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n}),r=(e,l,r)=>{let a=[...t.options||[]];a[e]={...a[e],[l]:r},n("options",a)},a=[{title:"选项标签",dataIndex:"label",render:(e,t,l)=>(0,eO.jsx)(W,{size:"small",value:t.label,onChange:e=>r(l,"label",e.target.value)})},{title:"选项值",dataIndex:"value",render:(e,t,l)=>(0,eO.jsx)(W,{size:"small",value:t.value,onChange:e=>r(l,"value",e.target.value)})},{title:"操作",render:(e,l,r)=>(0,eO.jsx)(en,{children:(0,eO.jsx)(P,{danger:!0,size:"small",onClick:()=>{let e;(e=[...t.options||[]]).splice(r,1),n("options",e)},children:(0,eO.jsx)(c,{})})})}];return(0,eO.jsxs)(K,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,eO.jsx)(K.Item,{label:"变量名",children:(0,eO.jsx)(W,{size:"small",value:t.var,onChange:e=>n("var",e.target.value),placeholder:"请输入变量名"})}),(0,eO.jsx)(K.Item,{label:"布局",children:(0,eO.jsxs)(Z.Group,{size:"small",value:t.layout,onChange:e=>n("layout",e.target.value),children:[(0,eO.jsx)(Z.Button,{value:"horizontal",children:"水平"}),(0,eO.jsx)(Z.Button,{value:"vertical",children:"垂直"}),(0,eO.jsx)(Z.Button,{value:"grid",children:"网格"})]})}),"grid"===t.layout&&(0,eO.jsx)(K.Item,{label:"网格行数",children:(0,eO.jsx)(U,{size:"small",value:t.lineNumber,onChange:e=>n("lineNumber",e),min:1,max:10})}),(0,eO.jsxs)(K.Item,{labelCol:{span:24},wrapperCol:{span:24},children:[(0,eO.jsx)(ea,{size:"small",dataSource:t.options,columns:a,pagination:!1,rowKey:(e,t)=>String(t),bordered:!0}),(0,eO.jsx)(P,{size:"small",block:!0,onClick:()=>{n("options",[...t.options||[],{label:"",value:""}])},children:"添加选项"})]})]})},defaultOptions:{props:{var:"",layout:"horizontal",lineNumber:3,options:[{label:"选项1",value:"1"},{label:"选项2",value:"2"}]},cascadeIds:[]}},{group:"表单组件",key:"b-date-picker",label:"日期选择器",icon:"icon-form-date-picker",component:e=>{let{id:t,var:l="",size:n,allowClear:r=!1,type:a="date",showTime:i=!1,value:o,item:s,onChange:d,style:c={},className:u}=e,{handleCallback:p,setVar:x}=(0,eA.useContext)(eE),m=e=>{d&&d(e),s&&l&&x(s,l,e),p(s)};if("time"===a){let e="string"==typeof o&&o?eg(o,"HH:mm"):void 0;return(0,eO.jsx)(eo,{id:t,value:e,format:"HH:mm",placeholder:"请选择时间",size:n,allowClear:r,onChange:e=>m(e?e.format("HH:mm"):void 0),style:{...(null==s?void 0:s.style)||{},...c},className:u})}if("month"===a||"year"===a){let e="month"===a?"YYYY-MM":"YYYY",l="string"==typeof o&&o?eg(o,e):void 0;return(0,eO.jsx)(Y,{id:t,picker:a,value:l,format:e,placeholder:"month"===a?"请选择月份":"请选择年份",size:n,allowClear:r,onChange:t=>m(t?t.format(e):void 0),onPanelChange:t=>m(t?t.format(e):void 0),style:{...(null==s?void 0:s.style)||{},...c},className:u})}if("range"===a){let e=i?"YYYY-MM-DD HH:mm":"YYYY-MM-DD",l=Array.isArray(o)&&o[0]?eg(o[0],e):void 0,a=Array.isArray(o)&&o[1]?eg(o[1],e):void 0;return(0,eO.jsx)(Y.RangePicker,{id:t,value:[l,a],format:e,placeholder:["开始日期","结束日期"],size:n,allowClear:r,showTime:i,onChange:t=>m(t&&t[0]&&t[1]?[t[0].format(e),t[1].format(e)]:void 0),style:{...(null==s?void 0:s.style)||{},...c},className:u})}let h=i?"YYYY-MM-DD HH:mm":"YYYY-MM-DD",f="string"==typeof o&&o?eg(o,h):void 0;return(0,eO.jsx)(Y,{id:t,value:f,format:h,placeholder:"请选择日期",size:n,allowClear:r,showTime:i,style:{...(null==s?void 0:s.style)||{},...c},className:u,onChange:e=>m(e?e.format(h):void 0)})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n});return(0,eO.jsxs)(K,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,eO.jsx)(K.Item,{label:"变量名",children:(0,eO.jsx)(W,{size:"small",value:t.var,onChange:e=>n("var",e.target.value),placeholder:"请输入变量名"})}),(0,eO.jsx)(K.Item,{label:"类型",children:(0,eO.jsxs)(Z.Group,{size:"small",value:t.type,onChange:e=>n("type",e.target.value),children:[(0,eO.jsx)(Z.Button,{value:"date",children:"日期"}),(0,eO.jsx)(Z.Button,{value:"time",children:"时间"}),(0,eO.jsx)(Z.Button,{value:"month",children:"月份"}),(0,eO.jsx)(Z.Button,{value:"year",children:"年份"}),(0,eO.jsx)(Z.Button,{value:"range",children:"日期范围"})]})}),(0,eO.jsx)(K.Item,{label:"大小",children:(0,eO.jsxs)(Z.Group,{size:"small",value:t.size,onChange:e=>n("size",e.target.value),children:[(0,eO.jsx)(Z.Button,{value:"small",children:"小"}),(0,eO.jsx)(Z.Button,{value:"middle",children:"中"}),(0,eO.jsx)(Z.Button,{value:"large",children:"大"})]})}),(0,eO.jsx)(K.Item,{label:"清除图标",children:(0,eO.jsx)(er,{size:"small",checked:!!t.allowClear,onChange:e=>n("allowClear",e)})}),(0,eO.jsx)(K.Item,{label:"显示时间",children:(0,eO.jsx)(er,{size:"small",checked:!!t.showTime,onChange:e=>n("showTime",e)})})]})},defaultOptions:{props:{var:"",size:"default",allowClear:!0,showTime:!1,type:"date"},cascadeIds:[]}},{group:"表单组件",key:"b-switch",label:"开关",icon:"icon-form-switch",component:e=>{let{id:t,var:l="",checked:n,disabled:r,size:a="default",checkedChildren:i,unCheckedChildren:o,item:s,onChange:d,style:c={},className:u}=e,{handleCallback:p,setVar:x}=(0,eA.useContext)(eE);return(0,eO.jsx)("span",{children:(0,eO.jsx)(er,{id:t,checked:n,disabled:r,size:"small"===a?"small":void 0,checkedChildren:i,unCheckedChildren:o,onChange:e=>{d&&d(e),s&&l&&x(s,l,e),p(s)},style:c,className:u})})},formComponent:e=>{let{model:t,onChange:l}=e;return(0,eO.jsx)(K,{labelCol:{span:6},wrapperCol:{span:18},children:(0,eO.jsx)(K.Item,{label:"变量名",children:(0,eO.jsx)(W,{size:"small",value:t.var,onChange:e=>{let n;return n=e.target.value,l&&l({...t,var:n})},placeholder:"请输入变量名"})})})},defaultOptions:{props:{var:"",size:"default",checkedChildren:"开",unCheckedChildren:"关"},cascadeIds:[]}},{group:"容器组件",key:"b-space",label:"容器",icon:"icon-space",component:e=>{let{id:t,align:l="start",size:n="small",direction:r="horizontal",item:a,ancestors:i,style:o={},className:s}=e,[d,c]=(0,eA.useState)(a.children||[]),u=(0,eA.useMemo)(()=>({...o,...a.style||{},alignItems:l,flexDirection:r,gap:n}),[a,l,n,r]);return(0,eA.useEffect)(()=>{c(a.children||[])},[a.children]),(0,eO.jsx)(ty,{rootComponent:en,rootData:{id:t,style:u,className:s},item:a,ancestors:[...i,a],list:d,onListChange:e=>{a.children=e,c(e)}})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n});return(0,eO.jsxs)(K,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,eO.jsx)(K.Item,{label:"方向",children:(0,eO.jsxs)(Z.Group,{size:"small",value:t.direction,onChange:e=>n("direction",e.target.value),children:[(0,eO.jsx)(Z.Button,{value:"horizontal",children:"水平"}),(0,eO.jsx)(Z.Button,{value:"vertical",children:"垂直"})]})}),(0,eO.jsx)(K.Item,{label:"大小",children:(0,eO.jsxs)(Z.Group,{size:"small",value:t.size,onChange:e=>n("size",e.target.value),children:[(0,eO.jsx)(Z.Button,{value:"small",children:"小"}),(0,eO.jsx)(Z.Button,{value:"middle",children:"中"}),(0,eO.jsx)(Z.Button,{value:"large",children:"大"})]})}),(0,eO.jsx)(K.Item,{label:"对齐",children:(0,eO.jsxs)(Z.Group,{size:"small",value:t.align,onChange:e=>n("align",e.target.value),children:[(0,eO.jsx)(Z.Button,{value:"start",children:"开始"}),(0,eO.jsx)(Z.Button,{value:"end",children:"结束"}),(0,eO.jsx)(Z.Button,{value:"center",children:"居中"}),(0,eO.jsx)(Z.Button,{value:"baseline",children:"基线"})]})})]})},defaultOptions:{props:{align:"flex-start",direction:"row",size:"8px"},children:[]}},{group:"容器组件",key:"b-card",label:"卡片",icon:"icon-card",component:e=>{let{id:t,bordered:l=!1,size:n="default",title:r,hoverable:a=!1,shadow:i=!0,item:o,ancestors:s,style:d,className:c}=e,u=(0,eA.useMemo)(()=>!o.children||Array.isArray(o.children)||"object"!=typeof o.children?null:o.children.title||[],[o]),[p,x]=(0,eA.useState)(u||[]),m=(0,eA.useMemo)(()=>!o.children||Array.isArray(o.children)||"object"!=typeof o.children?null:o.children.extra||[],[o]),[h,f]=(0,eA.useState)(m||[]),g=(0,eA.useMemo)(()=>o.children?Array.isArray(o.children)?o.children:"object"!=typeof o.children?null:o.children.body||[]:null,[o]),[v,j]=(0,eA.useState)(g||[]),b=(0,eA.useMemo)(()=>!o.children||Array.isArray(o.children)||"object"!=typeof o.children?null:o.children.actions||[],[o]),[y,w]=(0,eA.useState)(b||[]);return(0,eA.useEffect)(()=>{x(u||[])},[u]),(0,eA.useEffect)(()=>{f(m||[])},[m]),(0,eA.useEffect)(()=>{j(g||[])},[g]),(0,eA.useEffect)(()=>{w(b||[])},[b]),(0,eO.jsx)(M,{id:t,variant:l?"outlined":"borderless",size:n,hoverable:a,className:[i?"ant-card-shadow":void 0,c].filter(Boolean).join(" "),title:(null==r?void 0:r.length)&&!(null==u?void 0:u.length)?r:u?(0,eO.jsx)(ty,{ancestors:[...s,o],list:p,onListChange:e=>{o.children.title=e,x(e)}}):r,extra:m&&(0,eO.jsx)(ty,{ancestors:[...s,o],list:h,onListChange:e=>{o.children.extra=e,f(e)}}),actions:b&&[(0,eO.jsx)(ty,{ancestors:[...s,o],list:y,onListChange:e=>{o.children.actions=e,w(e)}})],styles:{header:{borderBottom:"none"}},style:d,children:g&&(0,eO.jsx)(ty,{ancestors:[...s,o],list:v,onListChange:e=>{Array.isArray(o.children)?o.children=e:o.children.body=e,j(e)}})})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n});return(0,eO.jsxs)(K,{labelCol:{span:12},wrapperCol:{span:12},children:[(0,eO.jsx)(K.Item,{label:"标题",children:(0,eO.jsx)(W,{size:"small",value:t.title,onChange:e=>n("title",e.target.value)})}),(0,eO.jsx)(K.Item,{label:"边框",children:(0,eO.jsx)(er,{size:"small",checked:!!t.bordered,onChange:e=>n("bordered",e)})}),(0,eO.jsx)(K.Item,{label:"悬停效果",children:(0,eO.jsx)(er,{size:"small",checked:!!t.hoverable,onChange:e=>n("hoverable",e)})}),(0,eO.jsx)(K.Item,{label:"阴影",children:(0,eO.jsx)(er,{size:"small",checked:!!t.shadow,onChange:e=>n("shadow",e)})}),(0,eO.jsx)(K.Item,{label:"大小",children:(0,eO.jsxs)(Z.Group,{size:"small",value:t.size,onChange:e=>n("size",e.target.value),children:[(0,eO.jsx)(Z.Button,{value:"default",children:"默认"}),(0,eO.jsx)(Z.Button,{value:"small",children:"小"})]})})]})},defaultOptions:{props:{title:"标题",bordered:!0,hoverable:!0,shadow:!0,size:"default"},children:{title:[],extra:[],body:[],actions:[]}}},{group:"容器组件",key:"b-row",label:"栅格行",icon:"icon-grid-row",component:e=>{let{id:t,gutter:l,item:n,ancestors:r,style:a,className:i}=e,[o,s]=(0,eA.useState)(n.children||[]);return(0,eA.useEffect)(()=>{s(n.children||[])},[n.children]),(0,eO.jsx)(ty,{rootComponent:ee,rootData:{id:t,gutter:l,style:n.style||a,className:n.className||i},item:n,ancestors:[...r,n],list:o,onListChange:e=>{n.children=e,s(e)}})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n}),r=t.gutter||[0,0];return(0,eO.jsxs)(K,{labelCol:{span:12},wrapperCol:{span:12},children:[(0,eO.jsx)(K.Item,{label:"列间距",children:(0,eO.jsx)(U,{size:"small",value:r[0],min:0,step:4,onChange:e=>n("gutter",[e||0,r[1]])})}),(0,eO.jsx)(K.Item,{label:"行间距",children:(0,eO.jsx)(U,{size:"small",value:r[1],min:0,step:4,onChange:e=>n("gutter",[r[0],e||0])})})]})},defaultOptions:{props:{gutter:[12,12]},children:[]}},{group:"容器组件",key:"b-col",label:"栅格列",icon:"icon-grid-columns",component:e=>{let{id:t,span:l=24,xs:n,sm:r,md:a,lg:i,xl:o,xxl:s,item:d,ancestors:c,style:u={},className:p}=e,{deviceWidth:x}=(0,eA.useContext)(eE),[m,h]=(0,eA.useState)(d.children||[]),f=(0,eA.useMemo)(()=>{let e=x||1600,t=null;return e<576&&n&&(t=n),e>=576&&r&&(t=r),e>=768&&a&&(t=a),e>=992&&i&&(t=i),e>=1200&&o&&(t=o),e>=1600&&s&&(t=s),t||l},[n,r,a,i,o,s,l,x]);return(0,eA.useEffect)(()=>{h(d.children||[])},[d.children]),(0,eO.jsx)(ty,{rootComponent:$,rootData:{id:t||d.id,span:f,style:{...d.style||{},...u},className:p},item:d,ancestors:[...c,d],list:m,onListChange:e=>{d.children=e,h(e)}})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n});return(0,eO.jsxs)(K,{labelCol:{span:12},wrapperCol:{span:12},children:[(0,eO.jsx)(K.Item,{label:"默认列数",children:(0,eO.jsx)(U,{size:"small",value:t.span,min:0,max:24,step:4,onChange:e=>n("span",e||0)})}),(0,eO.jsx)(K.Item,{label:(0,eO.jsxs)(eO.Fragment,{children:["xs"," ",(0,eO.jsx)(es,{title:"<576px 响应式栅格",children:(0,eO.jsx)(ld,{})})]}),children:(0,eO.jsx)(U,{size:"small",value:t.xs,min:0,max:24,step:4,onChange:e=>n("xs",e||0)})}),(0,eO.jsx)(K.Item,{label:(0,eO.jsxs)(eO.Fragment,{children:["sm"," ",(0,eO.jsx)(es,{title:"≥576px 响应式栅格",children:(0,eO.jsx)(ld,{})})]}),children:(0,eO.jsx)(U,{size:"small",value:t.sm,min:0,max:24,step:4,onChange:e=>n("sm",e||0)})}),(0,eO.jsx)(K.Item,{label:(0,eO.jsxs)(eO.Fragment,{children:["md"," ",(0,eO.jsx)(es,{title:"≥768px 响应式栅格",children:(0,eO.jsx)(ld,{})})]}),children:(0,eO.jsx)(U,{size:"small",value:t.md,min:0,max:24,step:4,onChange:e=>n("md",e||0)})}),(0,eO.jsx)(K.Item,{label:(0,eO.jsxs)(eO.Fragment,{children:["lg"," ",(0,eO.jsx)(es,{title:"≥992px 响应式栅格",children:(0,eO.jsx)(ld,{})})]}),children:(0,eO.jsx)(U,{size:"small",value:t.lg,min:0,max:24,step:4,onChange:e=>n("lg",e||0)})}),(0,eO.jsx)(K.Item,{label:(0,eO.jsxs)(eO.Fragment,{children:["xl"," ",(0,eO.jsx)(es,{title:"≥1200px 响应式栅格",children:(0,eO.jsx)(ld,{})})]}),children:(0,eO.jsx)(U,{size:"small",value:t.xl,min:0,max:24,step:4,onChange:e=>n("xl",e||0)})}),(0,eO.jsx)(K.Item,{label:(0,eO.jsxs)(eO.Fragment,{children:["xxl"," ",(0,eO.jsx)(es,{title:"≥1600px 响应式栅格",children:(0,eO.jsx)(ld,{})})]}),children:(0,eO.jsx)(U,{size:"small",value:t.xxl,min:0,max:24,step:4,onChange:e=>n("xxl",e||0)})})]})},defaultOptions:{props:{xs:24,sm:12,md:12,lg:6,xl:6,xxl:6,span:8},children:[]}}]})();var eC=ew.ru,eS=ew.Ei,ek=ew.NQ,ez=ew.B7,eI=ew.Ts,eN=ew.V2,eO=ew.QE,eA=ew.NG,eE=ew.Nx,eT=ew.ps;export{eC as DropContainer,eS as PageCanvas,ek as PageContext,ez as PageDesigner,eI as PageProvider,eN as PageSchema,eO as PluginType,eA as PropEditorProps,eE as plugins,eT as useDatasource};
|
|
@@ -77,6 +77,7 @@ export type FetchType = {
|
|
|
77
77
|
ai?: {
|
|
78
78
|
chat: (bizType: string, bizId: string, conversationId: string | null, request: ChatRequestType) => Promise<ChatResponseType>;
|
|
79
79
|
conversationList: (bizType: string, bizId: string) => Promise<ChatConversationType[]>;
|
|
80
|
+
activateConversation?: (conversationId: string) => Promise<boolean>;
|
|
80
81
|
messageList: (conversationId: string, prevId?: string) => Promise<ChatMessageType[]>;
|
|
81
82
|
removeConversation: (conversationId: string) => Promise<boolean>;
|
|
82
83
|
removeMessage: (messageId: string) => Promise<boolean>;
|
|
@@ -417,7 +417,7 @@
|
|
|
417
417
|
.conversation-list li small {
|
|
418
418
|
white-space: nowrap;
|
|
419
419
|
}
|
|
420
|
-
`,eY=[],e_="bi-design",eq=e=>{let t,l,n,r,a,i,o,{agentList:s=eY,headExtra:u,style:p={},onEffect:x}=e,{pageId:h,schema:g,fetch:v,atItems:j,onRemoveAtItem:b,clearAtItems:y}=(0,c.useContext)(f);if(!v)return null;let[w,C]=(0,c.useState)(null),[S,I]=(0,c.useState)([]),[k,z]=(0,c.useState)([]),O=m().useRef(null),N=()=>{setTimeout(()=>{O.current&&O.current.scrollToBottom()},100)},T=()=>{C(null),z([])},F=async e=>{ep.Modal.confirm({title:"确认删除该对话吗?",okText:"确认",cancelText:"取消",onOk:async()=>{var t;await (null==(t=v.ai)?void 0:t.removeConversation(e)),I(t=>t.filter(t=>t.id!==e)),z(t=>t.filter(t=>t.conversationId!==e)),w===e&&T()}})},D=async e=>{var t;C(e),I(t=>t.map(t=>({...t,isActived:t.id===e}))),z(await (null==(
|
|
420
|
+
`,eY=[],e_="bi-design",eq=e=>{let t,l,n,r,a,i,o,{agentList:s=eY,headExtra:u,style:p={},onEffect:x}=e,{pageId:h,schema:g,fetch:v,atItems:j,onRemoveAtItem:b,clearAtItems:y}=(0,c.useContext)(f);if(!v)return null;let[w,C]=(0,c.useState)(null),[S,I]=(0,c.useState)([]),[k,z]=(0,c.useState)([]),O=m().useRef(null),N=()=>{setTimeout(()=>{O.current&&O.current.scrollToBottom()},100)},T=()=>{C(null),z([])},F=async e=>{ep.Modal.confirm({title:"确认删除该对话吗?",okText:"确认",cancelText:"取消",onOk:async()=>{var t;await (null==(t=v.ai)?void 0:t.removeConversation(e)),I(t=>t.filter(t=>t.id!==e)),z(t=>t.filter(t=>t.conversationId!==e)),w===e&&T()}})},D=async e=>{var t,l,n;C(e),I(t=>t.map(t=>({...t,isActived:t.id===e}))),await (null==(l=v.ai)||null==(t=l.activateConversation)?void 0:t.call(l,e)),z(await (null==(n=v.ai)?void 0:n.messageList(e))||[]),N()},R=async e=>{var t;let l={id:eO(),question:e.message,createdAt:new Date().toISOString(),files:e.files||[],agents:e.agents||[],atItems:JSON.stringify(j),sending:!0};z(e=>[...e,l]),N();let n=!w;y();let{id:r,answer:a,createdAt:i,conversation:o}=await (null==(t=v.ai)?void 0:t.chat(e_,h,w,{...e,page:g,pageItems:j||[]}));C((null==o?void 0:o.id)||""),I(e=>[n?o||{}:null,...e].filter(e=>null!==e)),Object.assign(l,{id:r,answer:a,createdAt:i,conversationId:(null==o?void 0:o.id)||"",sending:!1}),a.effect&&(null==x||x(a.effect)),z(e=>[...e]),N()},A=async e=>{var t;await (null==(t=v.ai)?void 0:t.removeMessage(e)),z(t=>t.filter(t=>t.id!==e))},E=(t=new Date,l=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),(n=new Date(t)).setDate(t.getDate()-1),r=[],a=[],i=[],o=[],S.forEach(e=>{let s=new Date(e.createdAt);if(l(s,t))r.push(e);else if(l(s,n))a.push(e);else s.getFullYear()===t.getFullYear()&&s.getMonth()===t.getMonth()?i.push(e):o.push(e)}),[{title:"今天",items:r},{title:"昨天",items:a},{title:"本月内",items:i},{title:"很久以前",items:o}].filter(e=>e.items.length>0)),B=async()=>{try{var e,t;let l=await (null==(e=v.ai)?void 0:e.conversationList(e_,h));I(l||[]);let n=null==l?void 0:l.find(e=>e.isActived);if(n){C(n.id);let e=await (null==(t=v.ai)?void 0:t.messageList(n.id));z(e||[]),N()}}catch(e){console.error(e)}};return(0,c.useEffect)(()=>{B()},[v]),(0,c.useEffect)(()=>{N()},[]),(0,d.jsxs)(e$,{style:p,children:[(0,d.jsx)(eL,{title:"智能助理",extra:(0,d.jsxs)(ep.Space,{children:[(0,d.jsx)(ep.Tooltip,{title:"新对话",placement:"topRight",children:(0,d.jsx)("a",{onClick:T,children:(0,d.jsx)(eu,{type:"icon-chat-plus"})})}),(0,d.jsx)(ep.Dropdown,{trigger:["click"],styles:{root:{boxShadow:"var(--ant-box-shadow-drawer-up)",backgroundColor:"#ffffff",borderRadius:"var(--ant-border-radius)"}},popupRender:()=>(0,d.jsx)(eU,{children:E.map(e=>(0,d.jsxs)("div",{className:"group",children:[(0,d.jsx)("div",{className:"group-title",children:e.title}),(0,d.jsx)("ul",{className:"group-list",children:e.items.map(e=>(0,d.jsxs)("li",{className:e.isActived?"actived":"",children:[(0,d.jsx)("a",{onClick:()=>D(e.id),children:e.name}),(0,d.jsx)("small",{children:(0,d.jsx)("a",{onClick:()=>F(e.id),children:(0,d.jsx)(ed.DeleteOutlined,{})})})]},e.id))})]},e.title))}),placement:"topRight",children:(0,d.jsx)("a",{children:(0,d.jsx)(ed.HistoryOutlined,{})})}),u]}),style:{width:"initial"}}),(0,d.jsxs)("div",{className:"body",children:[(0,d.jsx)("div",{style:{flex:"1 1 auto",overflowY:"auto"},children:k.length?(0,d.jsx)(eK,{ref:O,list:k,onDeleteMessage:A}):(0,d.jsx)(eG,{})}),0===k.length&&S.length>0&&(0,d.jsx)(ep.Card,{title:"历史记录",size:"small",variant:"borderless",styles:{header:{padding:0,border:"none"},body:{padding:0}},style:{padding:"12px 12px 0 12px"},children:(0,d.jsx)("ul",{className:"conversation-list",children:S.slice(0,3).map(e=>(0,d.jsxs)("li",{children:[(0,d.jsxs)("a",{children:[(0,d.jsx)(ed.MessageOutlined,{}),e.name]}),(0,d.jsx)("small",{children:eN(e.createdAt)})]},e.id))})}),(0,d.jsx)(eM,{agentList:s,style:{padding:12},atItems:j,onUploading:null==v?void 0:v.upload,onSubmit:R,onRemoveAtItem:b})]})]})},eH=h().div`
|
|
421
421
|
flex: 1 1 auto;
|
|
422
422
|
display: flex;
|
|
423
423
|
align-items: center;
|
|
@@ -984,7 +984,7 @@
|
|
|
984
984
|
background: transparent;
|
|
985
985
|
}
|
|
986
986
|
}
|
|
987
|
-
`,td=e=>{let{open:t,onCancel:l,onOk:n}=e,[r,a]=(0,c.useState)(JSON.stringify({info:{},datasources:[],scripts:[],variables:[],items:[]}));return(0,d.jsx)(ep.Modal,{title:"导入页面",open:t,width:800,onCancel:l,onOk:()=>null==n?void 0:n(JSON.parse(r)),okText:"导入",cancelText:"取消",styles:{body:{height:"calc(100vh - 250px)",overflow:"auto"}},children:(0,d.jsx)("div",{className:"body",style:{flex:"1 1 auto",display:"flex",height:"100%"},children:(0,d.jsx)(eh.Editor,{height:"100%",defaultLanguage:"json",value:r,options:{minimap:{enabled:!1}},onChange:e=>a(e||"")})})})},tc=m().forwardRef((e,t)=>{var l;let n,{pageId:r,agentList:a=[],plugins:i=[],headerExtra:o,datasourceEnable:s=!0,scriptEnable:u=!0,datasetPanel:p,datasetSelector:m,datasetAdd:x,fetch:h,onSave:f,loading:v=!1}=e,j=(0,c.useRef)(null),b=(0,c.useRef)(null),[y,w]=(0,c.useState)(1),[C,S]=(0,c.useState)([]),[I,k]=(0,c.useState)([]),[z,O]=(0,c.useState)(!1),[N,T]=(0,c.useState)("desktop"),[F,D]=(0,c.useState)("component"),[R,A]=(0,c.useState)((null==h?void 0:h.ai)?"ai":"props"),[E,B]=(0,c.useState)(!0),[M,P]=(0,c.useState)(!0),[L,$]=(0,c.useState)(null),[Y,_]=(0,c.useState)({info:{},datasources:[],scripts:[],variables:[],items:[]}),[q,H]=(0,c.useState)(!0),[G,U]=(0,c.useState)(!1),[J,K]=(0,c.useState)(!1),W=(0,c.useMemo)(()=>{let e=E?"250px":"",t=M?"400px":"";return{gridTemplateColumns:`${e} 1fr ${t}`}},[E,M]),X=(0,c.useMemo)(()=>({display:E?"flex":"none"}),[E]),V=(0,c.useMemo)(()=>({display:M?"flex":"none"}),[M]);l=[Y],(n=(0,c.useRef)()).current===JSON.stringify(l)&&n.current||(n.current=JSON.stringify(l),(()=>{z||(S(e=>e.length?[...e,JSON.parse(JSON.stringify(Y))].slice(-50):[JSON.parse(JSON.stringify(Y))]),k([]))})()),(0,c.useImperativeHandle)(t,()=>({handleOpen(e){O(!0),Q(e.items),_(e),S([JSON.parse(JSON.stringify(e))]),k([]),setTimeout(()=>O(!1),0)}}));let Q=(e,t)=>{e&&e.forEach(e=>{e.id||(e.id=t||eO()),Array.isArray(e.children)?Q(e.children):"object"==typeof e.children&&e.children&&Object.keys(e.children).forEach(t=>{Array.isArray(e.children[t])&&Q(e.children[t],eO())})})},Z=e=>{var t,l,n;if((null==(t=e.datasets)?void 0:t.length)&&(null==b||null==(l=b.current)?void 0:l.reload)&&b.current.reload(),e.schema){let t=JSON.parse(JSON.stringify(e.schema));Q(t.items),_(t)}else if(null==(n=e.pageItems)?void 0:n.length){let t=new Map(e.pageItems.map(e=>[e.targetId,e])),l=JSON.parse(JSON.stringify(Y)),n=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];e.forEach((l,r)=>{if(t.has(l.id)){let{position:n,insertSlot:d,pageItem:c}=t.get(l.id);switch(n){case"before":e.splice(r,0,c);break;case"after":e.splice(r+1,0,c);break;case"replace":Object.keys(l).forEach(e=>{"id"!==e&&delete l[e]}),Object.assign(l,c);break;case"insert":var a,o,s;let u=i.find(e=>e.key===l.type);Array.isArray(null==u||null==(a=u.defaultOptions)?void 0:a.children)?l.children=[...l.children||[],c]:"object"==typeof(null==u||null==(o=u.defaultOptions)?void 0:o.children)&&d&&(l.children={...l.children||{},[d]:[...(null==(s=l.children)?void 0:s[d])||[],c]})}}Array.isArray(l.children)?n(l.children):"object"==typeof l.children&&l.children&&Object.keys(l.children).forEach(e=>{Array.isArray(l.children[e])&&n(l.children[e])})})};n(l.items),_(l)}},ee=(0,c.useMemo)(()=>"cascade"!==R||(null==L?void 0:L.cascadeIds)?R:"props",[L,R]);return(0,d.jsxs)(g,{pageId:r,designable:q,plugins:i,schema:Y,selectedItem:L,setSchema:_,setSelectedItem:$,datasetSelector:m,datasetAdd:x,fetch:h,children:[(0,d.jsxs)("div",{style:{display:"flex",flexDirection:"column",height:"100%"},children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 24px",borderBottom:"solid 1px #e8e8e8"},children:[(0,d.jsxs)(ep.Space,{children:[(0,d.jsx)("span",{style:{fontSize:16,fontWeight:500},children:"创建数据报表"}),(0,d.jsx)(ep.Divider,{orientation:"vertical"}),(0,d.jsx)(ep.Tooltip,{title:"保存",children:(0,d.jsx)(ep.Button,{type:"link",className:"toolbar",onClick:()=>{null==f||f(Y)},loading:v,children:(0,d.jsx)(ed.SaveOutlined,{})})}),(0,d.jsx)(ep.Divider,{orientation:"vertical"}),(0,d.jsx)(ep.Tooltip,{title:"撤销",children:(0,d.jsx)("a",{className:`toolbar ${C.length>1?"active":""}`,onClick:()=>{S(e=>{if(e.length<=1)return e;O(!0);let t=e[e.length-2];return k(e=>[...e,JSON.parse(JSON.stringify(Y))]),_(t),$(null),setTimeout(()=>O(!1),0),e.slice(0,-1)})},children:(0,d.jsx)(ed.UndoOutlined,{})})}),(0,d.jsx)(ep.Tooltip,{title:"重做",children:(0,d.jsx)("a",{className:`toolbar ${I.length>0?"active":""}`,onClick:()=>{k(e=>e.length?(O(!0),S(e=>[...e,JSON.parse(JSON.stringify(Y))]),_(e[e.length-1]),$(null),setTimeout(()=>O(!1),0),e.slice(0,-1)):e)},children:(0,d.jsx)(ed.RedoOutlined,{})})}),(0,d.jsx)(ep.Divider,{orientation:"vertical"}),(0,d.jsx)(ep.Tooltip,{title:"导入JSON",children:(0,d.jsx)("a",{className:`toolbar ${I.length>0?"active":""}`,onClick:()=>{U(!0)},children:(0,d.jsx)(ed.ImportOutlined,{})})})]}),(0,d.jsxs)(ep.Space,{children:[(0,d.jsx)(ep.Tooltip,{title:"缩小",children:(0,d.jsx)("a",{className:"toolbar",onClick:()=>w(parseFloat(Math.max(y-.1,.5).toFixed(1))),children:(0,d.jsx)(ed.ZoomOutOutlined,{})})}),(0,d.jsxs)("div",{style:{fontSize:12,color:"#999",userSelect:"none"},children:[(100*y).toFixed(0),"%"]}),(0,d.jsx)(ep.Tooltip,{title:"放大",children:(0,d.jsx)("a",{className:"toolbar",onClick:()=>w(parseFloat(Math.min(y+.1,2).toFixed(1))),children:(0,d.jsx)(ed.ZoomInOutlined,{})})}),(0,d.jsx)(ep.Tooltip,{title:"重置缩放",children:(0,d.jsx)("a",{className:"toolbar",onClick:()=>w(1),children:(0,d.jsx)(eu,{type:"icon-zoom-reset"})})}),(0,d.jsx)(ep.Divider,{orientation:"vertical"}),(0,d.jsx)(ep.Tooltip,{title:"切换左侧栏",children:(0,d.jsx)("a",{className:`toolbar ${E?"active":""}`,onClick:()=>{B(e=>!e),setTimeout(()=>{var e,t;return null==(t=j.current)||null==(e=t.handleResize)?void 0:e.call(t)},0)},children:(0,d.jsx)(eu,{type:"icon-sider-l"})})}),(0,d.jsx)(ep.Tooltip,{title:"切换右侧栏",children:(0,d.jsx)("a",{className:`toolbar ${M?"active":""}`,onClick:()=>{P(e=>!e),setTimeout(()=>{var e,t;return null==(t=j.current)||null==(e=t.handleResize)?void 0:e.call(t)},0)},children:(0,d.jsx)(eu,{type:"icon-sider-r"})})}),o]})]}),(0,d.jsxs)(ts,{style:W,children:[(0,d.jsxs)("div",{className:"left",style:X,children:[(0,d.jsx)("div",{style:{padding:"22px 1px 22px 0",borderRight:"solid 1px #e8e8e8"},children:(0,d.jsxs)(ep.Radio.Group,{value:F,onChange:e=>D(e.target.value),buttonStyle:"outline",style:{fontWeight:"normal",display:"inline-flex",flexDirection:"column",gap:14},className:"left-pane-tabs",children:[(0,d.jsx)(ep.Radio.Button,{value:"component",children:(0,d.jsx)(ep.Tooltip,{title:"组件",placement:"right",children:(0,d.jsx)(eu,{type:"icon-puzzle"})})}),(0,d.jsx)(ep.Radio.Button,{value:"layer",children:(0,d.jsx)(ep.Tooltip,{title:"图层",placement:"right",children:(0,d.jsx)(eu,{type:"icon-outline"})})}),!!p&&(0,d.jsx)(ep.Radio.Button,{value:"dataset",children:(0,d.jsx)(ep.Tooltip,{title:"数据集",placement:"right",children:(0,d.jsx)(eu,{type:"icon-dataset"})})}),s&&(0,d.jsx)(ep.Radio.Button,{value:"datasource",title:"数据源",children:(0,d.jsx)(ep.Tooltip,{title:"数据源",placement:"right",children:(0,d.jsx)(eu,{type:"icon-datasource"})})}),u&&(0,d.jsx)(ep.Radio.Button,{value:"script",children:(0,d.jsx)(ep.Tooltip,{title:"脚本",placement:"right",children:(0,d.jsx)(eu,{type:"icon-js"})})}),(0,d.jsx)(ep.Radio.Button,{value:"env",children:(0,d.jsx)(ep.Tooltip,{title:"环境变量",placement:"right",children:(0,d.jsx)(eu,{type:"icon-variable"})})}),(0,d.jsx)(ep.Radio.Button,{value:"code",children:(0,d.jsx)(ep.Tooltip,{title:"源码",placement:"right",children:(0,d.jsx)(eu,{type:"icon-json"})})})]})}),(0,d.jsxs)("div",{style:{flex:"1 1 auto",display:"flex",flexDirection:"column",width:"calc(100% - 47px)"},children:["component"===F&&(0,d.jsx)(e2,{}),"layer"===F&&(0,d.jsx)(e9,{}),s&&"datasource"===F&&(0,d.jsx)(e8,{}),u&&"script"===F&&(0,d.jsx)(tn,{}),"env"===F&&(0,d.jsx)(ta,{}),"code"===F&&(0,d.jsx)(eZ,{}),!!p&&"dataset"===F&&(0,d.jsx)(to,{ref:b,renderNode:p})]})]}),(0,d.jsxs)("div",{className:"center",style:{flex:"1 1 auto"},children:[(0,d.jsx)(eL,{title:"页面",extra:(0,d.jsxs)(ep.Space,{children:[(0,d.jsx)(ep.Button,{size:"small",type:q?"default":"primary",icon:q?(0,d.jsx)(ed.EyeInvisibleOutlined,{}):(0,d.jsx)(ed.EyeOutlined,{}),onClick:()=>H(!q)}),(0,d.jsxs)(ep.Radio.Group,{value:N,onChange:e=>T(e.target.value),size:"small",buttonStyle:"outline",children:[(0,d.jsx)(ep.Radio.Button,{value:"desktop",title:"桌面",children:(0,d.jsx)(ed.DesktopOutlined,{})}),(0,d.jsx)(ep.Radio.Button,{value:"mobile",title:"移动设备",children:(0,d.jsx)(ed.MobileOutlined,{})}),(0,d.jsx)(ep.Radio.Button,{value:"tablet",title:"平板设备",children:(0,d.jsx)(ed.TabletOutlined,{})})]})]})}),(0,d.jsx)("div",{className:["body beautified_scrollbar always",N].join(" "),children:(0,d.jsx)("div",{style:{transform:`scale(${y})`,transformOrigin:"top center"},children:(0,d.jsx)(eI,{ref:j,device:N})})})]}),(0,d.jsxs)("div",{className:"right",style:V,children:[(0,d.jsxs)("div",{style:{flex:"1 1 auto",display:"flex",flexDirection:"column",width:"calc(100% - 47px)"},children:[(0,d.jsx)(eq,{agentList:a,onEffect:Z,style:{display:"ai"===ee&&(null==h?void 0:h.ai)?void 0:"none"}}),"props"===ee&&(0,d.jsx)(te,{datasourceEnable:s}),"cascade"===ee&&(null==L?void 0:L.cascadeIds)&&(0,d.jsx)(eX,{})]}),(0,d.jsx)("div",{style:{padding:"22px 0",borderLeft:"solid 1px #e8e8e8",display:"flex",flexDirection:"column",justifyContent:"space-between",alignItems:"center"},children:(0,d.jsxs)(ep.Radio.Group,{value:ee,onChange:e=>A(e.target.value),buttonStyle:"outline",style:{fontWeight:"normal",display:"inline-flex",flexDirection:"column",gap:14},className:"right-pane-tabs",children:[(null==h?void 0:h.ai)&&(0,d.jsx)(ep.Radio.Button,{value:"ai",children:(0,d.jsx)(ep.Tooltip,{title:"智能助理",placement:"right",children:(0,d.jsx)(eu,{type:"icon-assistant"})})}),(0,d.jsx)(ep.Radio.Button,{value:"props",children:(0,d.jsx)(ep.Tooltip,{title:"属性",placement:"right",children:(0,d.jsx)(eu,{type:"icon-info"})})}),(null==L?void 0:L.cascadeIds)&&(0,d.jsx)(ep.Radio.Button,{value:"cascade",children:(0,d.jsx)(ep.Tooltip,{title:"联动",placement:"right",children:(0,d.jsx)(eu,{type:"icon-cascade"})})})]})})]})]})]}),(0,d.jsx)(td,{open:G,onOk:e=>{U(!1),_(e)},onCancel:()=>U(!1)}),(0,d.jsx)(ep.Drawer,{open:J,size:400,mask:!1,title:null,closable:!1,styles:{body:{padding:0}},onClose:()=>K(!1),children:(0,d.jsx)(eq,{agentList:a,headExtra:(0,d.jsx)(ep.Button,{type:"link",icon:(0,d.jsx)(ed.CloseOutlined,{}),onClick:()=>K(!1)}),onEffect:Z})})]})});var tu=((i={}).STRING="STRING",i.NUMBER="NUMBER",i.BOOLEAN="BOOLEAN",i.OBJECT="OBJECT",i.ARRAY="ARRAY",i);let tp=h()(ed.InfoCircleOutlined)`
|
|
987
|
+
`,td=e=>{let{open:t,onCancel:l,onOk:n}=e,[r,a]=(0,c.useState)(JSON.stringify({info:{},datasources:[],scripts:[],variables:[],items:[]}));return(0,d.jsx)(ep.Modal,{title:"导入页面",open:t,width:800,onCancel:l,onOk:()=>null==n?void 0:n(JSON.parse(r)),okText:"导入",cancelText:"取消",styles:{body:{height:"calc(100vh - 250px)",overflow:"auto"}},children:(0,d.jsx)("div",{className:"body",style:{flex:"1 1 auto",display:"flex",height:"100%"},children:(0,d.jsx)(eh.Editor,{height:"100%",defaultLanguage:"json",value:r,options:{minimap:{enabled:!1}},onChange:e=>a(e||"")})})})},tc=m().forwardRef((e,t)=>{var l;let n,{pageId:r,agentList:a=[],plugins:i=[],headerExtra:o,datasourceEnable:s=!0,scriptEnable:u=!0,datasetPanel:p,datasetSelector:m,datasetAdd:x,fetch:h,onSave:f,loading:v=!1}=e,j=(0,c.useRef)(null),b=(0,c.useRef)(null),[y,w]=(0,c.useState)(1),[C,S]=(0,c.useState)([]),[I,k]=(0,c.useState)([]),[z,O]=(0,c.useState)(!1),[N,T]=(0,c.useState)("desktop"),[F,D]=(0,c.useState)("component"),[R,A]=(0,c.useState)((null==h?void 0:h.ai)?"ai":"props"),[E,B]=(0,c.useState)(!0),[M,P]=(0,c.useState)(!0),[L,$]=(0,c.useState)(null),[Y,_]=(0,c.useState)({info:{},datasources:[],scripts:[],variables:[],items:[]}),[q,H]=(0,c.useState)(!0),[G,U]=(0,c.useState)(!1),[J,K]=(0,c.useState)(!1),W=(0,c.useMemo)(()=>{let e=E?"250px":"",t=M?"400px":"";return{gridTemplateColumns:`${e} 1fr ${t}`}},[E,M]),X=(0,c.useMemo)(()=>({display:E?"flex":"none"}),[E]),V=(0,c.useMemo)(()=>({display:M?"flex":"none"}),[M]);l=[Y],(n=(0,c.useRef)()).current===JSON.stringify(l)&&n.current||(n.current=JSON.stringify(l),(()=>{z||(S(e=>e.length?[...e,JSON.parse(JSON.stringify(Y))].slice(-50):[JSON.parse(JSON.stringify(Y))]),k([]))})()),(0,c.useImperativeHandle)(t,()=>({handleOpen(e){O(!0),Q(e.items),_(e),S([JSON.parse(JSON.stringify(e))]),k([]),setTimeout(()=>O(!1),0)}}));let Q=(e,t)=>{e&&e.forEach(e=>{e.id||(e.id=t||eO()),Array.isArray(e.children)?Q(e.children):"object"==typeof e.children&&e.children&&Object.keys(e.children).forEach(t=>{Array.isArray(e.children[t])&&Q(e.children[t],eO())})})},Z=e=>{var t,l,n;if((null==(t=e.datasets)?void 0:t.length)&&(null==b||null==(l=b.current)?void 0:l.reload)&&b.current.reload(),e.schema){let t=JSON.parse(JSON.stringify(e.schema));Q(t.items),_(t)}else if(null==(n=e.pageItems)?void 0:n.length){let t=new Map;e.pageItems.forEach(e=>{t.has(e.targetId)||t.set(e.targetId,[]),t.get(e.targetId).push(e)});let l=JSON.parse(JSON.stringify(Y)),n=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];e.forEach((l,r)=>{t.has(l.id)&&t.get(l.id).forEach(t=>{let{position:n,insertSlot:a,pageItem:o}=t;switch(n){case"before":e.splice(r,0,o);break;case"after":e.splice(r+1,0,o);break;case"replace":Object.keys(l).forEach(e=>{"id"!==e&&delete l[e]}),Object.assign(l,o);break;case"insert":var s,d,c;let u=i.find(e=>e.key===l.type);Array.isArray(null==u||null==(s=u.defaultOptions)?void 0:s.children)?l.children=[...l.children||[],o]:"object"==typeof(null==u||null==(d=u.defaultOptions)?void 0:d.children)&&a&&(l.children={...l.children||{},[a]:[...(null==(c=l.children)?void 0:c[a])||[],o]})}}),Array.isArray(l.children)?n(l.children):"object"==typeof l.children&&l.children&&Object.keys(l.children).forEach(e=>{Array.isArray(l.children[e])&&n(l.children[e])})})};n(l.items),_(l)}},ee=(0,c.useMemo)(()=>"cascade"!==R||(null==L?void 0:L.cascadeIds)?R:"props",[L,R]);return(0,d.jsxs)(g,{pageId:r,designable:q,plugins:i,schema:Y,selectedItem:L,setSchema:_,setSelectedItem:$,datasetSelector:m,datasetAdd:x,fetch:h,children:[(0,d.jsxs)("div",{style:{display:"flex",flexDirection:"column",height:"100%"},children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 24px",borderBottom:"solid 1px #e8e8e8"},children:[(0,d.jsxs)(ep.Space,{children:[(0,d.jsx)("span",{style:{fontSize:16,fontWeight:500},children:"创建数据报表"}),(0,d.jsx)(ep.Divider,{orientation:"vertical"}),(0,d.jsx)(ep.Tooltip,{title:"保存",children:(0,d.jsx)(ep.Button,{type:"link",className:"toolbar",onClick:()=>{null==f||f(Y)},loading:v,children:(0,d.jsx)(ed.SaveOutlined,{})})}),(0,d.jsx)(ep.Divider,{orientation:"vertical"}),(0,d.jsx)(ep.Tooltip,{title:"撤销",children:(0,d.jsx)("a",{className:`toolbar ${C.length>1?"active":""}`,onClick:()=>{S(e=>{if(e.length<=1)return e;O(!0);let t=e[e.length-2];return k(e=>[...e,JSON.parse(JSON.stringify(Y))]),_(t),$(null),setTimeout(()=>O(!1),0),e.slice(0,-1)})},children:(0,d.jsx)(ed.UndoOutlined,{})})}),(0,d.jsx)(ep.Tooltip,{title:"重做",children:(0,d.jsx)("a",{className:`toolbar ${I.length>0?"active":""}`,onClick:()=>{k(e=>e.length?(O(!0),S(e=>[...e,JSON.parse(JSON.stringify(Y))]),_(e[e.length-1]),$(null),setTimeout(()=>O(!1),0),e.slice(0,-1)):e)},children:(0,d.jsx)(ed.RedoOutlined,{})})}),(0,d.jsx)(ep.Divider,{orientation:"vertical"}),(0,d.jsx)(ep.Tooltip,{title:"导入JSON",children:(0,d.jsx)("a",{className:`toolbar ${I.length>0?"active":""}`,onClick:()=>{U(!0)},children:(0,d.jsx)(ed.ImportOutlined,{})})})]}),(0,d.jsxs)(ep.Space,{children:[(0,d.jsx)(ep.Tooltip,{title:"缩小",children:(0,d.jsx)("a",{className:"toolbar",onClick:()=>w(parseFloat(Math.max(y-.1,.5).toFixed(1))),children:(0,d.jsx)(ed.ZoomOutOutlined,{})})}),(0,d.jsxs)("div",{style:{fontSize:12,color:"#999",userSelect:"none"},children:[(100*y).toFixed(0),"%"]}),(0,d.jsx)(ep.Tooltip,{title:"放大",children:(0,d.jsx)("a",{className:"toolbar",onClick:()=>w(parseFloat(Math.min(y+.1,2).toFixed(1))),children:(0,d.jsx)(ed.ZoomInOutlined,{})})}),(0,d.jsx)(ep.Tooltip,{title:"重置缩放",children:(0,d.jsx)("a",{className:"toolbar",onClick:()=>w(1),children:(0,d.jsx)(eu,{type:"icon-zoom-reset"})})}),(0,d.jsx)(ep.Divider,{orientation:"vertical"}),(0,d.jsx)(ep.Tooltip,{title:"切换左侧栏",children:(0,d.jsx)("a",{className:`toolbar ${E?"active":""}`,onClick:()=>{B(e=>!e),setTimeout(()=>{var e,t;return null==(t=j.current)||null==(e=t.handleResize)?void 0:e.call(t)},0)},children:(0,d.jsx)(eu,{type:"icon-sider-l"})})}),(0,d.jsx)(ep.Tooltip,{title:"切换右侧栏",children:(0,d.jsx)("a",{className:`toolbar ${M?"active":""}`,onClick:()=>{P(e=>!e),setTimeout(()=>{var e,t;return null==(t=j.current)||null==(e=t.handleResize)?void 0:e.call(t)},0)},children:(0,d.jsx)(eu,{type:"icon-sider-r"})})}),o]})]}),(0,d.jsxs)(ts,{style:W,children:[(0,d.jsxs)("div",{className:"left",style:X,children:[(0,d.jsx)("div",{style:{padding:"22px 1px 22px 0",borderRight:"solid 1px #e8e8e8"},children:(0,d.jsxs)(ep.Radio.Group,{value:F,onChange:e=>D(e.target.value),buttonStyle:"outline",style:{fontWeight:"normal",display:"inline-flex",flexDirection:"column",gap:14},className:"left-pane-tabs",children:[(0,d.jsx)(ep.Radio.Button,{value:"component",children:(0,d.jsx)(ep.Tooltip,{title:"组件",placement:"right",children:(0,d.jsx)(eu,{type:"icon-puzzle"})})}),(0,d.jsx)(ep.Radio.Button,{value:"layer",children:(0,d.jsx)(ep.Tooltip,{title:"图层",placement:"right",children:(0,d.jsx)(eu,{type:"icon-outline"})})}),!!p&&(0,d.jsx)(ep.Radio.Button,{value:"dataset",children:(0,d.jsx)(ep.Tooltip,{title:"数据集",placement:"right",children:(0,d.jsx)(eu,{type:"icon-dataset"})})}),s&&(0,d.jsx)(ep.Radio.Button,{value:"datasource",title:"数据源",children:(0,d.jsx)(ep.Tooltip,{title:"数据源",placement:"right",children:(0,d.jsx)(eu,{type:"icon-datasource"})})}),u&&(0,d.jsx)(ep.Radio.Button,{value:"script",children:(0,d.jsx)(ep.Tooltip,{title:"脚本",placement:"right",children:(0,d.jsx)(eu,{type:"icon-js"})})}),(0,d.jsx)(ep.Radio.Button,{value:"env",children:(0,d.jsx)(ep.Tooltip,{title:"环境变量",placement:"right",children:(0,d.jsx)(eu,{type:"icon-variable"})})}),(0,d.jsx)(ep.Radio.Button,{value:"code",children:(0,d.jsx)(ep.Tooltip,{title:"源码",placement:"right",children:(0,d.jsx)(eu,{type:"icon-json"})})})]})}),(0,d.jsxs)("div",{style:{flex:"1 1 auto",display:"flex",flexDirection:"column",width:"calc(100% - 47px)"},children:["component"===F&&(0,d.jsx)(e2,{}),"layer"===F&&(0,d.jsx)(e9,{}),s&&"datasource"===F&&(0,d.jsx)(e8,{}),u&&"script"===F&&(0,d.jsx)(tn,{}),"env"===F&&(0,d.jsx)(ta,{}),"code"===F&&(0,d.jsx)(eZ,{}),!!p&&"dataset"===F&&(0,d.jsx)(to,{ref:b,renderNode:p})]})]}),(0,d.jsxs)("div",{className:"center",style:{flex:"1 1 auto"},children:[(0,d.jsx)(eL,{title:"页面",extra:(0,d.jsxs)(ep.Space,{children:[(0,d.jsx)(ep.Button,{size:"small",type:q?"default":"primary",icon:q?(0,d.jsx)(ed.EyeInvisibleOutlined,{}):(0,d.jsx)(ed.EyeOutlined,{}),onClick:()=>H(!q)}),(0,d.jsxs)(ep.Radio.Group,{value:N,onChange:e=>T(e.target.value),size:"small",buttonStyle:"outline",children:[(0,d.jsx)(ep.Radio.Button,{value:"desktop",title:"桌面",children:(0,d.jsx)(ed.DesktopOutlined,{})}),(0,d.jsx)(ep.Radio.Button,{value:"mobile",title:"移动设备",children:(0,d.jsx)(ed.MobileOutlined,{})}),(0,d.jsx)(ep.Radio.Button,{value:"tablet",title:"平板设备",children:(0,d.jsx)(ed.TabletOutlined,{})})]})]})}),(0,d.jsx)("div",{className:["body beautified_scrollbar always",N].join(" "),children:(0,d.jsx)("div",{style:{transform:`scale(${y})`,transformOrigin:"top center"},children:(0,d.jsx)(eI,{ref:j,device:N})})})]}),(0,d.jsxs)("div",{className:"right",style:V,children:[(0,d.jsxs)("div",{style:{flex:"1 1 auto",display:"flex",flexDirection:"column",width:"calc(100% - 47px)"},children:[(0,d.jsx)(eq,{agentList:a,onEffect:Z,style:{display:"ai"===ee&&(null==h?void 0:h.ai)?void 0:"none"}}),"props"===ee&&(0,d.jsx)(te,{datasourceEnable:s}),"cascade"===ee&&(null==L?void 0:L.cascadeIds)&&(0,d.jsx)(eX,{})]}),(0,d.jsx)("div",{style:{padding:"22px 0",borderLeft:"solid 1px #e8e8e8",display:"flex",flexDirection:"column",justifyContent:"space-between",alignItems:"center"},children:(0,d.jsxs)(ep.Radio.Group,{value:ee,onChange:e=>A(e.target.value),buttonStyle:"outline",style:{fontWeight:"normal",display:"inline-flex",flexDirection:"column",gap:14},className:"right-pane-tabs",children:[(null==h?void 0:h.ai)&&(0,d.jsx)(ep.Radio.Button,{value:"ai",children:(0,d.jsx)(ep.Tooltip,{title:"智能助理",placement:"right",children:(0,d.jsx)(eu,{type:"icon-assistant"})})}),(0,d.jsx)(ep.Radio.Button,{value:"props",children:(0,d.jsx)(ep.Tooltip,{title:"属性",placement:"right",children:(0,d.jsx)(eu,{type:"icon-info"})})}),(null==L?void 0:L.cascadeIds)&&(0,d.jsx)(ep.Radio.Button,{value:"cascade",children:(0,d.jsx)(ep.Tooltip,{title:"联动",placement:"right",children:(0,d.jsx)(eu,{type:"icon-cascade"})})})]})})]})]})]}),(0,d.jsx)(td,{open:G,onOk:e=>{U(!1),_(e)},onCancel:()=>U(!1)}),(0,d.jsx)(ep.Drawer,{open:J,size:400,mask:!1,title:null,closable:!1,styles:{body:{padding:0}},onClose:()=>K(!1),children:(0,d.jsx)(eq,{agentList:a,headExtra:(0,d.jsx)(ep.Button,{type:"link",icon:(0,d.jsx)(ed.CloseOutlined,{}),onClick:()=>K(!1)}),onEffect:Z})})]})});var tu=((i={}).STRING="STRING",i.NUMBER="NUMBER",i.BOOLEAN="BOOLEAN",i.OBJECT="OBJECT",i.ARRAY="ARRAY",i);let tp=h()(ed.InfoCircleOutlined)`
|
|
988
988
|
vertical-align: middle;
|
|
989
989
|
margin-left: 2px;
|
|
990
990
|
color: var(--ant-color-text-description);
|
package/package.json
CHANGED
|
@@ -51,6 +51,7 @@ import {
|
|
|
51
51
|
DatasetAddFunction,
|
|
52
52
|
DatasetSelectorFunction,
|
|
53
53
|
FetchType,
|
|
54
|
+
PageItemEffectType,
|
|
54
55
|
PageSchema,
|
|
55
56
|
PluginType,
|
|
56
57
|
SchemaItemType,
|
|
@@ -404,44 +405,54 @@ export const PageDesigner = React.forwardRef<any, PageDesignerProps>(
|
|
|
404
405
|
ensureIds(newSchema.items);
|
|
405
406
|
setSchema(newSchema);
|
|
406
407
|
} else if (effect.pageItems?.length) {
|
|
407
|
-
const effectItemMap = new Map(
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
408
|
+
const effectItemMap = new Map<string, PageItemEffectType[]>();
|
|
409
|
+
effect.pageItems.forEach((item) => {
|
|
410
|
+
if (!effectItemMap.has(item.targetId)) {
|
|
411
|
+
effectItemMap.set(item.targetId, []);
|
|
412
|
+
}
|
|
413
|
+
effectItemMap.get(item.targetId)!.push(item);
|
|
414
|
+
});
|
|
415
|
+
const cloneSchema: PageSchema = JSON.parse(JSON.stringify(schema));
|
|
411
416
|
const loop = (list: any[] = []) => {
|
|
412
417
|
list.forEach((item, index) => {
|
|
413
418
|
if (effectItemMap.has(item.id)) {
|
|
414
|
-
const
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
419
|
+
const items = effectItemMap.get(item.id)!;
|
|
420
|
+
items.forEach(({ position, insertSlot, pageItem }) => {
|
|
421
|
+
switch (position) {
|
|
422
|
+
case "before":
|
|
423
|
+
list.splice(index, 0, pageItem);
|
|
424
|
+
break;
|
|
425
|
+
case "after":
|
|
426
|
+
list.splice(index + 1, 0, pageItem);
|
|
427
|
+
break;
|
|
428
|
+
case "replace":
|
|
429
|
+
Object.keys(item).forEach((k) => {
|
|
430
|
+
if (k !== "id") {
|
|
431
|
+
delete item[k];
|
|
432
|
+
}
|
|
433
|
+
});
|
|
434
|
+
Object.assign(item, pageItem!);
|
|
435
|
+
break;
|
|
436
|
+
case "insert":
|
|
437
|
+
const plugin = plugins.find((p) => p.key === item.type);
|
|
438
|
+
if (Array.isArray(plugin?.defaultOptions?.children)) {
|
|
439
|
+
item.children = [...(item.children || []), pageItem];
|
|
440
|
+
} else if (
|
|
441
|
+
typeof plugin?.defaultOptions?.children === "object" &&
|
|
442
|
+
insertSlot
|
|
443
|
+
) {
|
|
444
|
+
item.children = {
|
|
445
|
+
...(item.children || {}),
|
|
446
|
+
[insertSlot]: [
|
|
447
|
+
...(item.children?.[insertSlot] || []),
|
|
448
|
+
pageItem,
|
|
449
|
+
],
|
|
450
|
+
};
|
|
428
451
|
}
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
const plugin = plugins.find((p) => p.key === item.type);
|
|
434
|
-
if (Array.isArray(plugin?.defaultOptions?.children)) {
|
|
435
|
-
item.children = [...(item.children || []), pageItem];
|
|
436
|
-
} else if (typeof plugin?.defaultOptions?.children === "object" && insertSlot) {
|
|
437
|
-
item.children = {
|
|
438
|
-
...(item.children || {}),
|
|
439
|
-
[insertSlot]: [...(item.children?.[insertSlot] || []), pageItem],
|
|
440
|
-
};
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
break;
|
|
444
|
-
}
|
|
452
|
+
|
|
453
|
+
break;
|
|
454
|
+
}
|
|
455
|
+
});
|
|
445
456
|
}
|
|
446
457
|
if (Array.isArray(item.children)) {
|
|
447
458
|
loop(item.children);
|
|
@@ -140,6 +140,7 @@ export const AiPanel: React.FC<AiPanelProps> = ({
|
|
|
140
140
|
setConversationList((list) =>
|
|
141
141
|
list.map((i) => ({ ...i, isActived: i.id === id })),
|
|
142
142
|
);
|
|
143
|
+
await fetch.ai?.activateConversation?.(id);
|
|
143
144
|
const messages = await fetch.ai?.messageList(id);
|
|
144
145
|
setMessageList(messages || []);
|
|
145
146
|
scrollToBottom();
|
package/src/components/typing.ts
CHANGED
|
@@ -74,6 +74,7 @@ export type FetchType = {
|
|
|
74
74
|
bizType: string,
|
|
75
75
|
bizId: string,
|
|
76
76
|
) => Promise<ChatConversationType[]>;
|
|
77
|
+
activateConversation?: (conversationId: string) => Promise<boolean>;
|
|
77
78
|
messageList: (conversationId: string, prevId?: string) => Promise<ChatMessageType[]>;
|
|
78
79
|
removeConversation: (conversationId: string) => Promise<boolean>;
|
|
79
80
|
removeMessage: (messageId: string) => Promise<boolean>;
|