bi-sdk-react 0.0.11 → 0.0.13
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 +14 -14
- package/dist/types/components/plugins/@antd/item-props/EchartsProps.d.ts +1 -0
- package/dist/umd/js/bi-sdk.umd.min.js +2 -2
- package/package.json +1 -1
- package/src/components/PageDesigner.tsx +1 -1
- package/src/components/plugins/@antd/item-props/EchartsProps.tsx +21 -3
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 y,MinusSquareOutlined as b,MobileOutlined as w,PlusOutlined as C,PlusSquareOutlined as S,RedoOutlined as z,RobotOutlined as k,SaveOutlined as I,SelectOutlined as N,SendOutlined as O,TabletOutlined as T,UndoOutlined as E,UploadOutlined as D,ZoomInOutlined as A,ZoomOutOutlined as B,createFromIconfontCN as R}from"@ant-design/icons";import{Avatar as L,Button as _,Card as M,Checkbox as P,Col as $,ColorPicker as F,DatePicker as Y,Divider as H,Drawer as G,Dropdown as W,Form as K,Input as U,InputNumber as J,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{v4 as ex}from"uuid";import em,{Editor as eh}from"@monaco-editor/react";import ef from"dayjs";import*as eg from"echarts";var ev={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}},ej={};function ey(e){var t=ej[e];if(void 0!==t)return t.exports;var l=ej[e]={exports:{}};return ev[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 eb={};(()=>{ey.d(eb,{NG:()=>eI.PropEditorProps,Wg:()=>tI,R3:()=>tv,Nx:()=>lC,Ei:()=>tw,QE:()=>ek.PluginType,Ts:()=>tp,V2:()=>ek.PageSchema,B7:()=>ld,NQ:()=>tu,ru:()=>tg});var e,ev,ej,ew,eC,eS,ez,ek={};ey.r(ek),ey.d(ek,{P:()=>lc});var eI={};ey.r(eI);var eN=ey(848),eO=ey(649);function eT(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 eE(e,t){if(e){if("string"==typeof e)return eT(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)?eT(e,t):void 0}}function eD(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)||eE(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 eA=ey(951),eB="data-pdnd-honey-pot";function eR(e){return e instanceof Element&&e.hasAttribute(eB)}function eL(e){var t=eD(document.elementsFromPoint(e.x,e.y),2),l=t[0],n=t[1];return l?eR(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 eM(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 eP(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 e$(e){for(var t=1;t<arguments.length;t++){var l=null!=arguments[t]?arguments[t]:{};t%2?eP(Object(l),!0).forEach(function(t){eM(e,t,l[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(l)):eP(Object(l)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(l,t))})}return e}function eF(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 eY(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 eH(e){return function(e){if(Array.isArray(e))return eT(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||eE(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 eG(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 eW=eG(function(){return navigator.userAgent.includes("Firefox")}),eK=eG(function(){var e=navigator.userAgent;return e.includes("AppleWebKit")&&!e.includes("Chrome")}),eU={isLeavingWindow:Symbol("leaving"),isEnteringWindow:Symbol("entering")};if("undefined"!=typeof window&&eK()){var eJ=eq();(0,eA.bindAll)(window,[{type:"dragstart",listener:function(){eJ.enterCount=0,eJ.isOverWindow=!0}},{type:"drop",listener:eX},{type:"dragend",listener:eX},{type:"dragenter",listener:function(e){eJ.isOverWindow||0!==eJ.enterCount||(e[eU.isEnteringWindow]=!0),eJ.isOverWindow=!0,eJ.enterCount++}},{type:"dragleave",listener:function(e){eJ.enterCount--,eJ.isOverWindow&&0===eJ.enterCount&&(e[eU.isLeavingWindow]=!0,eJ.isOverWindow=!1)}}],{capture:!0})}function eq(){return{enterCount:0,isOverWindow:!1}}function eX(){eJ=eq()}function eV(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 eQ=(e=function(e){return e()},ev=[],ej=null,(ew=function(){for(var t=arguments.length,l=Array(t),n=0;n<t;n++)l[n]=arguments[n];ev=l,ej||(ej=requestAnimationFrame(function(){ej=null,e.apply(void 0,ev)}))}).cancel=function(){ej&&(cancelAnimationFrame(ej),ej=null)},ew),eZ=(eC=null,{schedule:function(e){eC={frameId:requestAnimationFrame(function(){eC=null,e()}),fn:e}},flush:function(){eC&&(cancelAnimationFrame(eC.frameId),eC.fn(),eC=null)}}),e0={isActive:!1};function e1(){return!e0.isActive}function e2(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 e4=function(e){var t=e.event,l=e.dragType,n=e.getDropTargetsOver,r=e.dispatchEvent;if(e1()){var a,i,o=function(e){var t=e.event,l=e.dragType,n=e.getDropTargetsOver,r=eV(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});e0.isActive=!0;var s={current:o};e2({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}}),eZ.schedule(function(){a({eventName:"onDragStart",payload:{source:t,location:i}})})},dragUpdate:function(e){var n=e.current;eZ.flush(),eQ.cancel(),a({eventName:"onDropTargetChange",payload:{source:t,location:{initial:l,previous:r,current:n}}})},drag:function(e){var n=e.current;eQ(function(){eZ.flush(),a({eventName:"onDrag",payload:{source:t,location:{initial:l,previous:r,current:n}}})})},drop:function(e){var n=e.current,i=e.updatedSourcePayload;eZ.flush(),eQ.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,eA.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&&(eK()?!!eK()&&t.hasOwnProperty(eU.isLeavingWindow):null==n||(eW()?"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:eV(e)},s.current.dropTargets.length)?(e.preventDefault(),e2({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:eV(e)},x()}}].concat(eH([{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=eV(e),r=n({target:eR(e.target)?eL({x:t.clientX,y:t.clientY}):e.target,input:t,source:l.payload,current:s.current.dropTargets});r.length&&(e.preventDefault(),e2({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(){e0.isActive=!1,c()}},e8=new Map;function e6(){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 e9(e,t){var l=t.attribute,n=t.value;return e.setAttribute(l,n),function(){return e.removeAttribute(l)}}function e5(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 e3(e){for(var t=1;t<arguments.length;t++){var l=null!=arguments[t]?arguments[t]:{};t%2?e5(Object(l),!0).forEach(function(t){eM(e,t,l[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(l)):e5(Object(l)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(l,t))})}return e}function e7(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 te(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)?te(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 te(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 tt(e){return e.slice(0).reverse()}function tl(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 tn(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 tr=eG(function(){return navigator.userAgent.toLocaleLowerCase().includes("android")}),ta="text/plain",ti=new WeakMap,to=(eS=null,{bindEvents:function(){return eS=null,(0,eA.bind)(window,{type:"pointermove",listener:function(e){eS={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!=eS?eS:{x:o.clientX,y:o.clientY};(r=document.createElement("div")).setAttribute(eB,"true"),a=eF({client:s}),Object.assign(r.style,e$(e$({backgroundColor:"transparent",position:"fixed",padding:0,margin:0,boxSizing:"border-box"},eY({clientRect:a})),{},{pointerEvents:"auto",zIndex:0x7fffffff})),document.body.appendChild(r),i=(0,eA.bind)(window,{type:"pointermove",listener:function(e){a=eF({client:{x:e.clientX,y:e.clientY}}),Object.assign(r.style,eY({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,eA.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,eS=null}}}}),ts=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 tl(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)?tl(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?tn(Object(l),!0).forEach(function(t){eM(e,t,l[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(l)):tn(Object(l)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(l,t))})}return e}({},n);return e.add(r),l(r),eG(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=e7(r.location.current.dropTargets);try{for(a.s();!(t=a.n()).done;){var i,o=t.value,s=n.get(o.element),d=e3(e3({},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=e7(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=e3(e3({},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=e7(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=e3(e3({},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 eG(e6(e9(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(eH(x),[j])})}({source:t,target:r,input:i});if(s.length>=o.length)return s;for(var d=tt(o),c=tt(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(e3(e3({},m),{},{isActiveDueToStickiness:!0}))}return tt(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){e4({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=e8.get(t);if(n)return n.usageCount++,n;var r={typeKey:t,unmount:l(),usageCount:1};return e8.set(t,r),r}(e={typeKey:t,mount:function(){return l({canStart:e1,start:d})}}),function(){n.usageCount--,n.usageCount>0||(n.unmount(),e8.delete(e.typeKey))}},dropTarget:o.dropTargetForConsumers,monitor:i.monitorForConsumers}}({typeKey:"element",defaultDropEffect:"move",mount:function(e){return e6(to.bindEvents(),(0,eA.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=ti.get(s);if(d){var c=eV(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=eL({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=eD(h[m],2),g=f[0],v=f[1];t.dataTransfer.setData(g,null!=v?v:"")}!tr()||t.dataTransfer.types.includes(ta)||t.dataTransfer.types.includes("text/uri-list")||t.dataTransfer.setData(ta,"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=ti.get(r.source.element))||null==(l=t[n])||l.call(t,r)},onPostDispatch:to.getOnPostDispatch()}),td=ts.dropTarget;function tc(e){return eG(e6(ts.registerUsage(),(ti.set(e.element,e),function(){ti.delete(e.element)}),e9(e.element,{attribute:"draggable",value:"true"})))}ts.monitor;let tu=(0,eO.createContext)({pageId:"",designable:!1,plugins:[],schema:{info:{},datasources:[],scripts:[],variables:[],items:[]},selectedItem:null,setSchema:()=>{},setSelectedItem:()=>{},updateSelectedItem:()=>{},forceUpdate:()=>{},datasetSelector:void 0,fetch:void 0}),tp=e=>{let{pageId:t,designable:l,plugins:n,schema:r,selectedItem:a,setSchema:i,setSelectedItem:o,datasetSelector:s,fetch:d,children:c}=e;return(0,eN.jsx)(tu.Provider,{value:{pageId:t,designable:!!l,plugins:n||[],schema:r,selectedItem:a,setSchema:i||(()=>{}),setSelectedItem:o||(()=>{}),updateSelectedItem:e=>{null==o||o(Object.assign(a,e||{})),null==i||i({...r})},datasetSelector:s,fetch:d,forceUpdate:()=>{null==i||i({...r})}},children:c})},tx=e=>{var t;let{item:l,onDelete:n,parentList:r,onListChange:a,index:i}=e,{designable:o,selectedItem:s,setSelectedItem:d,plugins:c}=(0,eO.useContext)(tu),[u,p]=(0,eO.useState)(!1),x=null==(t=c.find(e=>e.key===l.type))?void 0:t.component;return((0,eO.useEffect)(()=>{let e=()=>{if(!t.current)return;let e=document.getElementById(`page-item-${l.id}`);if(!e)return void r();let n=e.getBoundingClientRect();if(0===n.width&&0===n.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=`${n.top+a-22}px`,t.current.style.left=`${n.left+i-1}px`},t={current:null},r=()=>{if(t.current){let l=t.current.querySelector("a");l&&l.removeEventListener("click",a),document.body.contains(t.current)&&document.body.removeChild(t.current),t.current=null,window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e)}},a=e=>{e.stopPropagation(),n&&n()};if(s&&s===l&&o){let n=document.createElement("div");n.style.position="absolute",n.style.zIndex="1000",n.style.display="flex",n.style.gap="4px";let i=document.createElement("span");i.innerText=l.name||l.type+`(${l.id})`,i.style.background="#1890ff",i.style.color="#fff",i.style.fontSize="12px",i.style.borderTopLeftRadius="4px",i.style.borderTopRightRadius="4px",i.style.padding="2px 8px",i.style.cursor="pointer",i.style.userSelect="none",n.appendChild(i);let o=document.createElement("a");return o.innerText="X",o.style.background="#1890ff",o.style.color="#fff",o.style.fontSize="12px",o.style.borderTopLeftRadius="4px",o.style.borderTopRightRadius="4px",o.style.padding="2px 8px",o.style.cursor="pointer",o.style.userSelect="none",n.appendChild(o),o.addEventListener("click",a),document.body.appendChild(n),t.current=n,e(),window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),()=>r()}},[s,o,l,n]),(0,eO.useEffect)(()=>{let e=document.getElementById(`page-item-${l.id}`);if(!e||!o)return;let t=tc({element:e,getInitialData:()=>({id:l.id,index:i,list:r,onListChange:a,data:l}),canDrag:()=>!!o,onDragStart:()=>{p(!0)},onDrop:()=>{p(!1)}}),n=e=>{e.stopPropagation(),d&&d(l)};return o&&e.addEventListener("click",n),()=>{t(),o&&e.removeEventListener("click",n)}},[o,l,i,r]),x)?(0,eN.jsx)(x,{id:`page-item-${l.id}`,"data-item-id":l.id,...l.props||{},item:l,className:`page-item-component ${o?"designable":""} ${s===l?"selected":""}`,style:{...l.style||{},opacity:u?.5:1}}):null},tm=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 y,MinusSquareOutlined as b,MobileOutlined as w,PlusOutlined as C,PlusSquareOutlined as S,RedoOutlined as z,RobotOutlined as k,SaveOutlined as I,SelectOutlined as N,SendOutlined as O,TabletOutlined as T,UndoOutlined as E,UploadOutlined as D,ZoomInOutlined as A,ZoomOutOutlined as B,createFromIconfontCN as R}from"@ant-design/icons";import{Avatar as L,Button as _,Card as M,Checkbox as P,Col as $,ColorPicker as F,DatePicker as Y,Divider as H,Drawer as G,Dropdown as W,Form as K,Input as J,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{v4 as ex}from"uuid";import em,{Editor as eh}from"@monaco-editor/react";import ef from"dayjs";import*as eg from"echarts";var ev={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}},ej={};function ey(e){var t=ej[e];if(void 0!==t)return t.exports;var l=ej[e]={exports:{}};return ev[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 eb={};(()=>{ey.d(eb,{NG:()=>eI.PropEditorProps,Wg:()=>tI,R3:()=>tv,Nx:()=>lC,Ei:()=>tw,QE:()=>ek.PluginType,Ts:()=>tp,V2:()=>ek.PageSchema,B7:()=>ld,NQ:()=>tu,ru:()=>tg});var e,ev,ej,ew,eC,eS,ez,ek={};ey.r(ek),ey.d(ek,{P:()=>lc});var eI={};ey.r(eI);var eN=ey(848),eO=ey(649);function eT(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 eE(e,t){if(e){if("string"==typeof e)return eT(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)?eT(e,t):void 0}}function eD(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)||eE(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 eA=ey(951),eB="data-pdnd-honey-pot";function eR(e){return e instanceof Element&&e.hasAttribute(eB)}function eL(e){var t=eD(document.elementsFromPoint(e.x,e.y),2),l=t[0],n=t[1];return l?eR(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 eM(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 eP(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 e$(e){for(var t=1;t<arguments.length;t++){var l=null!=arguments[t]?arguments[t]:{};t%2?eP(Object(l),!0).forEach(function(t){eM(e,t,l[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(l)):eP(Object(l)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(l,t))})}return e}function eF(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 eY(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 eH(e){return function(e){if(Array.isArray(e))return eT(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||eE(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 eG(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 eW=eG(function(){return navigator.userAgent.includes("Firefox")}),eK=eG(function(){var e=navigator.userAgent;return e.includes("AppleWebKit")&&!e.includes("Chrome")}),eJ={isLeavingWindow:Symbol("leaving"),isEnteringWindow:Symbol("entering")};if("undefined"!=typeof window&&eK()){var eU=eq();(0,eA.bindAll)(window,[{type:"dragstart",listener:function(){eU.enterCount=0,eU.isOverWindow=!0}},{type:"drop",listener:eX},{type:"dragend",listener:eX},{type:"dragenter",listener:function(e){eU.isOverWindow||0!==eU.enterCount||(e[eJ.isEnteringWindow]=!0),eU.isOverWindow=!0,eU.enterCount++}},{type:"dragleave",listener:function(e){eU.enterCount--,eU.isOverWindow&&0===eU.enterCount&&(e[eJ.isLeavingWindow]=!0,eU.isOverWindow=!1)}}],{capture:!0})}function eq(){return{enterCount:0,isOverWindow:!1}}function eX(){eU=eq()}function eV(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 eQ=(e=function(e){return e()},ev=[],ej=null,(ew=function(){for(var t=arguments.length,l=Array(t),n=0;n<t;n++)l[n]=arguments[n];ev=l,ej||(ej=requestAnimationFrame(function(){ej=null,e.apply(void 0,ev)}))}).cancel=function(){ej&&(cancelAnimationFrame(ej),ej=null)},ew),eZ=(eC=null,{schedule:function(e){eC={frameId:requestAnimationFrame(function(){eC=null,e()}),fn:e}},flush:function(){eC&&(cancelAnimationFrame(eC.frameId),eC.fn(),eC=null)}}),e0={isActive:!1};function e1(){return!e0.isActive}function e2(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 e4=function(e){var t=e.event,l=e.dragType,n=e.getDropTargetsOver,r=e.dispatchEvent;if(e1()){var a,i,o=function(e){var t=e.event,l=e.dragType,n=e.getDropTargetsOver,r=eV(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});e0.isActive=!0;var s={current:o};e2({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}}),eZ.schedule(function(){a({eventName:"onDragStart",payload:{source:t,location:i}})})},dragUpdate:function(e){var n=e.current;eZ.flush(),eQ.cancel(),a({eventName:"onDropTargetChange",payload:{source:t,location:{initial:l,previous:r,current:n}}})},drag:function(e){var n=e.current;eQ(function(){eZ.flush(),a({eventName:"onDrag",payload:{source:t,location:{initial:l,previous:r,current:n}}})})},drop:function(e){var n=e.current,i=e.updatedSourcePayload;eZ.flush(),eQ.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,eA.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&&(eK()?!!eK()&&t.hasOwnProperty(eJ.isLeavingWindow):null==n||(eW()?"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:eV(e)},s.current.dropTargets.length)?(e.preventDefault(),e2({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:eV(e)},x()}}].concat(eH([{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=eV(e),r=n({target:eR(e.target)?eL({x:t.clientX,y:t.clientY}):e.target,input:t,source:l.payload,current:s.current.dropTargets});r.length&&(e.preventDefault(),e2({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(){e0.isActive=!1,c()}},e8=new Map;function e6(){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 e9(e,t){var l=t.attribute,n=t.value;return e.setAttribute(l,n),function(){return e.removeAttribute(l)}}function e5(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 e3(e){for(var t=1;t<arguments.length;t++){var l=null!=arguments[t]?arguments[t]:{};t%2?e5(Object(l),!0).forEach(function(t){eM(e,t,l[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(l)):e5(Object(l)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(l,t))})}return e}function e7(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 te(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)?te(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 te(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 tt(e){return e.slice(0).reverse()}function tl(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 tn(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 tr=eG(function(){return navigator.userAgent.toLocaleLowerCase().includes("android")}),ta="text/plain",ti=new WeakMap,to=(eS=null,{bindEvents:function(){return eS=null,(0,eA.bind)(window,{type:"pointermove",listener:function(e){eS={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!=eS?eS:{x:o.clientX,y:o.clientY};(r=document.createElement("div")).setAttribute(eB,"true"),a=eF({client:s}),Object.assign(r.style,e$(e$({backgroundColor:"transparent",position:"fixed",padding:0,margin:0,boxSizing:"border-box"},eY({clientRect:a})),{},{pointerEvents:"auto",zIndex:0x7fffffff})),document.body.appendChild(r),i=(0,eA.bind)(window,{type:"pointermove",listener:function(e){a=eF({client:{x:e.clientX,y:e.clientY}}),Object.assign(r.style,eY({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,eA.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,eS=null}}}}),ts=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 tl(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)?tl(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?tn(Object(l),!0).forEach(function(t){eM(e,t,l[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(l)):tn(Object(l)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(l,t))})}return e}({},n);return e.add(r),l(r),eG(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=e7(r.location.current.dropTargets);try{for(a.s();!(t=a.n()).done;){var i,o=t.value,s=n.get(o.element),d=e3(e3({},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=e7(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=e3(e3({},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=e7(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=e3(e3({},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 eG(e6(e9(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(eH(x),[j])})}({source:t,target:r,input:i});if(s.length>=o.length)return s;for(var d=tt(o),c=tt(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(e3(e3({},m),{},{isActiveDueToStickiness:!0}))}return tt(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){e4({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=e8.get(t);if(n)return n.usageCount++,n;var r={typeKey:t,unmount:l(),usageCount:1};return e8.set(t,r),r}(e={typeKey:t,mount:function(){return l({canStart:e1,start:d})}}),function(){n.usageCount--,n.usageCount>0||(n.unmount(),e8.delete(e.typeKey))}},dropTarget:o.dropTargetForConsumers,monitor:i.monitorForConsumers}}({typeKey:"element",defaultDropEffect:"move",mount:function(e){return e6(to.bindEvents(),(0,eA.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=ti.get(s);if(d){var c=eV(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=eL({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=eD(h[m],2),g=f[0],v=f[1];t.dataTransfer.setData(g,null!=v?v:"")}!tr()||t.dataTransfer.types.includes(ta)||t.dataTransfer.types.includes("text/uri-list")||t.dataTransfer.setData(ta,"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=ti.get(r.source.element))||null==(l=t[n])||l.call(t,r)},onPostDispatch:to.getOnPostDispatch()}),td=ts.dropTarget;function tc(e){return eG(e6(ts.registerUsage(),(ti.set(e.element,e),function(){ti.delete(e.element)}),e9(e.element,{attribute:"draggable",value:"true"})))}ts.monitor;let tu=(0,eO.createContext)({pageId:"",designable:!1,plugins:[],schema:{info:{},datasources:[],scripts:[],variables:[],items:[]},selectedItem:null,setSchema:()=>{},setSelectedItem:()=>{},updateSelectedItem:()=>{},forceUpdate:()=>{},datasetSelector:void 0,fetch:void 0}),tp=e=>{let{pageId:t,designable:l,plugins:n,schema:r,selectedItem:a,setSchema:i,setSelectedItem:o,datasetSelector:s,fetch:d,children:c}=e;return(0,eN.jsx)(tu.Provider,{value:{pageId:t,designable:!!l,plugins:n||[],schema:r,selectedItem:a,setSchema:i||(()=>{}),setSelectedItem:o||(()=>{}),updateSelectedItem:e=>{null==o||o(Object.assign(a,e||{})),null==i||i({...r})},datasetSelector:s,fetch:d,forceUpdate:()=>{null==i||i({...r})}},children:c})},tx=e=>{var t;let{item:l,onDelete:n,parentList:r,onListChange:a,index:i}=e,{designable:o,selectedItem:s,setSelectedItem:d,plugins:c}=(0,eO.useContext)(tu),[u,p]=(0,eO.useState)(!1),x=null==(t=c.find(e=>e.key===l.type))?void 0:t.component;return((0,eO.useEffect)(()=>{let e=()=>{if(!t.current)return;let e=document.getElementById(`page-item-${l.id}`);if(!e)return void r();let n=e.getBoundingClientRect();if(0===n.width&&0===n.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=`${n.top+a-22}px`,t.current.style.left=`${n.left+i-1}px`},t={current:null},r=()=>{if(t.current){let l=t.current.querySelector("a");l&&l.removeEventListener("click",a),document.body.contains(t.current)&&document.body.removeChild(t.current),t.current=null,window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e)}},a=e=>{e.stopPropagation(),n&&n()};if(s&&s===l&&o){let n=document.createElement("div");n.style.position="absolute",n.style.zIndex="1000",n.style.display="flex",n.style.gap="4px";let i=document.createElement("span");i.innerText=l.name||l.type+`(${l.id})`,i.style.background="#1890ff",i.style.color="#fff",i.style.fontSize="12px",i.style.borderTopLeftRadius="4px",i.style.borderTopRightRadius="4px",i.style.padding="2px 8px",i.style.cursor="pointer",i.style.userSelect="none",n.appendChild(i);let o=document.createElement("a");return o.innerText="X",o.style.background="#1890ff",o.style.color="#fff",o.style.fontSize="12px",o.style.borderTopLeftRadius="4px",o.style.borderTopRightRadius="4px",o.style.padding="2px 8px",o.style.cursor="pointer",o.style.userSelect="none",n.appendChild(o),o.addEventListener("click",a),document.body.appendChild(n),t.current=n,e(),window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),()=>r()}},[s,o,l,n]),(0,eO.useEffect)(()=>{let e=document.getElementById(`page-item-${l.id}`);if(!e||!o)return;let t=tc({element:e,getInitialData:()=>({id:l.id,index:i,list:r,onListChange:a,data:l}),canDrag:()=>!!o,onDragStart:()=>{p(!0)},onDrop:()=>{p(!1)}}),n=e=>{e.stopPropagation(),d&&d(l)};return o&&e.addEventListener("click",n),()=>{t(),o&&e.removeEventListener("click",n)}},[o,l,i,r]),x)?(0,eN.jsx)(x,{id:`page-item-${l.id}`,"data-item-id":l.id,...l.props||{},item:l,className:`page-item-component ${o?"designable":""} ${s===l?"selected":""}`,style:{...l.style||{},opacity:u?.5:1}}):null},tm=t.div`
|
|
3
3
|
position: absolute;
|
|
4
4
|
background: #1890ff;
|
|
5
5
|
pointer-events: none;
|
|
@@ -316,7 +316,7 @@ import*as e from"react";import t,{css as l}from"styled-components";import{AlignC
|
|
|
316
316
|
.send-btn.send-btn-active {
|
|
317
317
|
background-color: var(--ant-color-primary);
|
|
318
318
|
}
|
|
319
|
-
`,tE=[],tD=[],tA=["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","audio/wav"],tB=[".xlsx",".wav"],tR=e=>{let{open:t,onCancel:l,onOk:n,allowedExtensions:r,allowedMimeTypes:a}=e,[o,s]=(0,eO.useState)([]);(0,eO.useEffect)(()=>{t&&s([])},[t]);let d=[...tB,...tA].join(",");return(0,eN.jsxs)(q,{title:"上传文件",open:t,okText:"上传",cancelText:"取消",onOk:()=>{n(o),l()},onCancel:l,width:600,children:[(0,eN.jsx)("div",{style:{marginBottom:16},children:(0,eN.jsxs)(ec.Text,{type:"secondary",children:["支持的文件类型:",r.join(", "),(0,eN.jsx)("br",{}),"单次支持上传多个文件,请确保文件内容合规。",(0,eN.jsx)("br",{}),"Excel 暂不支持加密文件。",(0,eN.jsx)("br",{}),"不支持 xls 电子表格,请自行转换为 xlsx 格式。",(0,eN.jsx)("br",{}),"Excel 仅支持第一行为表头、第二行开始为数据,不支持合并单元格。"]})}),(0,eN.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,eN.jsx)("p",{className:"ant-upload-drag-icon",children:(0,eN.jsx)(v,{})}),(0,eN.jsx)("p",{className:"ant-upload-text",children:"点击或将文件拖拽到此处上传"}),(0,eN.jsx)("p",{className:"ant-upload-hint",children:"支持上传Excel表格数据或音频文件进行分析"})]}),o.length>0&&(0,eN.jsxs)("div",{style:{marginTop:16},children:[(0,eN.jsxs)(ec.Title,{level:5,style:{fontSize:14,marginBottom:8},children:["已选文件 (",o.length,")"]}),(0,eN.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:8,maxHeight:200,overflowY:"auto"},children:o.map((e,t)=>(0,eN.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",background:"#f5f5f5",borderRadius:4},children:[(0,eN.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,overflow:"hidden"},children:[e.name.endsWith(".xlsx")?(0,eN.jsx)(h,{style:{color:"#52c41a"}}):(0,eN.jsx)(i,{style:{color:"#1890ff"}}),(0,eN.jsx)(ec.Text,{ellipsis:!0,style:{maxWidth:300},children:e.name}),(0,eN.jsxs)(ec.Text,{type:"secondary",style:{fontSize:12},children:["(",(e.size/1024).toFixed(1)," KB)"]})]}),(0,eN.jsx)(_,{type:"text",size:"small",icon:(0,eN.jsx)(c,{}),onClick:()=>{s(e=>e.filter((e,l)=>l!==t))},danger:!0})]},`${e.name}-${t}`))})]})]})},tL=eO.default.forwardRef((e,t)=>{let{value:l="",placeholder:n="请输入需求,例如:分析 2025 年人口结构并生成可视化报告",disabled:r=!1,sending:a=!1,rows:i=6,agentList:o=tE,agentId:s=null,attachments:d=tD,onInput:u,onSubmit:p,onUpdateAgentId:x,onUpdateAttachments:m,onUploading:h,style:f={}}=e,g=(0,eO.useRef)(null),[v,j]=(0,eO.useState)([]),[y,b]=(0,eO.useState)(l||""),[w,C]=(0,eO.useState)(0),[S,z]=(0,eO.useState)(Array.isArray(d)?d:[]),[k,I]=(0,eO.useState)(!1),N=(0,eO.useMemo)(()=>!1,[]);(0,eO.useImperativeHandle)(t,()=>({focus(){var e;null==(e=g.current)||e.focus()}})),(0,eO.useEffect)(()=>b(l||""),[l]),(0,eO.useEffect)(()=>{u&&u(y)},[y]),(0,eO.useEffect)(()=>z(Array.isArray(d)?d:[]),[d]);let T=!!(y&&y.trim()),E=async e=>{if(I(!1),!h||!e.length)return;let t=[];for(let l of e)try{let e=await h(l);e&&t.push({id:e.id,name:l.name,size:l.size})}catch(e){console.error(e)}z([...S,...t]),m&&m([...S,...t])},D=()=>{if(!T||a)return;let e=Date.now();if(e-w<400)return;C(e);let t=(y||"").trim();if(!t)return;let l={message:t,agents:v.map(e=>({id:e.id,name:e.name})),files:S.map(e=>({id:e.id,name:e.name,extension:e.name.substring(e.name.lastIndexOf("."))}))};p&&p(l),b("")},A=(0,eN.jsx)(tO,{children:(0,eN.jsx)("ul",{className:"agent-list",children:o.map(e=>(0,eN.jsx)("li",{children:(0,eN.jsx)("a",{onClick:()=>{let t;return t=e.id||null,void(x&&x(t),j(t=>[...t,e]))},children:e.name})},String(e.id)))})});return(0,eN.jsx)(tT,{style:f,children:(0,eN.jsxs)("div",{className:"chat-input",children:[(0,eN.jsxs)("div",{className:"input-stack",children:[S.length>0&&(0,eN.jsx)("div",{className:"attachment-bar",children:S.map(e=>(0,eN.jsxs)("div",{className:"attachment-card",children:[e.name.endsWith(".xlsx")?(0,eN.jsx)(tS,{type:"icon-excel"}):(0,eN.jsx)(tS,{type:"icon-audio"}),(0,eN.jsx)(ec.Text,{className:"name",ellipsis:{tooltip:e.name},children:e.name}),(0,eN.jsx)("a",{className:"remove",onClick:()=>{var t;let l;return t=e.id,void(z(l=S.filter(e=>e.id!==t)),m&&m(l))},children:(0,eN.jsx)(c,{})})]},e.id))}),v.length>0&&(0,eN.jsx)("div",{className:"agent-info",children:v.map((e,t)=>(0,eN.jsxs)("div",{children:[(0,eN.jsxs)("span",{className:"name",children:[(0,eN.jsx)(tS,{type:"icon-at"}),e.name]}),(0,eN.jsx)("a",{className:"remove",onClick:()=>{x&&x(null),j(e=>e.filter((e,l)=>l!==t))},children:"\xd7"})]},String(e.id)))}),(0,eN.jsx)(
|
|
319
|
+
`,tE=[],tD=[],tA=["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","audio/wav"],tB=[".xlsx",".wav"],tR=e=>{let{open:t,onCancel:l,onOk:n,allowedExtensions:r,allowedMimeTypes:a}=e,[o,s]=(0,eO.useState)([]);(0,eO.useEffect)(()=>{t&&s([])},[t]);let d=[...tB,...tA].join(",");return(0,eN.jsxs)(q,{title:"上传文件",open:t,okText:"上传",cancelText:"取消",onOk:()=>{n(o),l()},onCancel:l,width:600,children:[(0,eN.jsx)("div",{style:{marginBottom:16},children:(0,eN.jsxs)(ec.Text,{type:"secondary",children:["支持的文件类型:",r.join(", "),(0,eN.jsx)("br",{}),"单次支持上传多个文件,请确保文件内容合规。",(0,eN.jsx)("br",{}),"Excel 暂不支持加密文件。",(0,eN.jsx)("br",{}),"不支持 xls 电子表格,请自行转换为 xlsx 格式。",(0,eN.jsx)("br",{}),"Excel 仅支持第一行为表头、第二行开始为数据,不支持合并单元格。"]})}),(0,eN.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,eN.jsx)("p",{className:"ant-upload-drag-icon",children:(0,eN.jsx)(v,{})}),(0,eN.jsx)("p",{className:"ant-upload-text",children:"点击或将文件拖拽到此处上传"}),(0,eN.jsx)("p",{className:"ant-upload-hint",children:"支持上传Excel表格数据或音频文件进行分析"})]}),o.length>0&&(0,eN.jsxs)("div",{style:{marginTop:16},children:[(0,eN.jsxs)(ec.Title,{level:5,style:{fontSize:14,marginBottom:8},children:["已选文件 (",o.length,")"]}),(0,eN.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:8,maxHeight:200,overflowY:"auto"},children:o.map((e,t)=>(0,eN.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",background:"#f5f5f5",borderRadius:4},children:[(0,eN.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,overflow:"hidden"},children:[e.name.endsWith(".xlsx")?(0,eN.jsx)(h,{style:{color:"#52c41a"}}):(0,eN.jsx)(i,{style:{color:"#1890ff"}}),(0,eN.jsx)(ec.Text,{ellipsis:!0,style:{maxWidth:300},children:e.name}),(0,eN.jsxs)(ec.Text,{type:"secondary",style:{fontSize:12},children:["(",(e.size/1024).toFixed(1)," KB)"]})]}),(0,eN.jsx)(_,{type:"text",size:"small",icon:(0,eN.jsx)(c,{}),onClick:()=>{s(e=>e.filter((e,l)=>l!==t))},danger:!0})]},`${e.name}-${t}`))})]})]})},tL=eO.default.forwardRef((e,t)=>{let{value:l="",placeholder:n="请输入需求,例如:分析 2025 年人口结构并生成可视化报告",disabled:r=!1,sending:a=!1,rows:i=6,agentList:o=tE,agentId:s=null,attachments:d=tD,onInput:u,onSubmit:p,onUpdateAgentId:x,onUpdateAttachments:m,onUploading:h,style:f={}}=e,g=(0,eO.useRef)(null),[v,j]=(0,eO.useState)([]),[y,b]=(0,eO.useState)(l||""),[w,C]=(0,eO.useState)(0),[S,z]=(0,eO.useState)(Array.isArray(d)?d:[]),[k,I]=(0,eO.useState)(!1),N=(0,eO.useMemo)(()=>!1,[]);(0,eO.useImperativeHandle)(t,()=>({focus(){var e;null==(e=g.current)||e.focus()}})),(0,eO.useEffect)(()=>b(l||""),[l]),(0,eO.useEffect)(()=>{u&&u(y)},[y]),(0,eO.useEffect)(()=>z(Array.isArray(d)?d:[]),[d]);let T=!!(y&&y.trim()),E=async e=>{if(I(!1),!h||!e.length)return;let t=[];for(let l of e)try{let e=await h(l);e&&t.push({id:e.id,name:l.name,size:l.size})}catch(e){console.error(e)}z([...S,...t]),m&&m([...S,...t])},D=()=>{if(!T||a)return;let e=Date.now();if(e-w<400)return;C(e);let t=(y||"").trim();if(!t)return;let l={message:t,agents:v.map(e=>({id:e.id,name:e.name})),files:S.map(e=>({id:e.id,name:e.name,extension:e.name.substring(e.name.lastIndexOf("."))}))};p&&p(l),b("")},A=(0,eN.jsx)(tO,{children:(0,eN.jsx)("ul",{className:"agent-list",children:o.map(e=>(0,eN.jsx)("li",{children:(0,eN.jsx)("a",{onClick:()=>{let t;return t=e.id||null,void(x&&x(t),j(t=>[...t,e]))},children:e.name})},String(e.id)))})});return(0,eN.jsx)(tT,{style:f,children:(0,eN.jsxs)("div",{className:"chat-input",children:[(0,eN.jsxs)("div",{className:"input-stack",children:[S.length>0&&(0,eN.jsx)("div",{className:"attachment-bar",children:S.map(e=>(0,eN.jsxs)("div",{className:"attachment-card",children:[e.name.endsWith(".xlsx")?(0,eN.jsx)(tS,{type:"icon-excel"}):(0,eN.jsx)(tS,{type:"icon-audio"}),(0,eN.jsx)(ec.Text,{className:"name",ellipsis:{tooltip:e.name},children:e.name}),(0,eN.jsx)("a",{className:"remove",onClick:()=>{var t;let l;return t=e.id,void(z(l=S.filter(e=>e.id!==t)),m&&m(l))},children:(0,eN.jsx)(c,{})})]},e.id))}),v.length>0&&(0,eN.jsx)("div",{className:"agent-info",children:v.map((e,t)=>(0,eN.jsxs)("div",{children:[(0,eN.jsxs)("span",{className:"name",children:[(0,eN.jsx)(tS,{type:"icon-at"}),e.name]}),(0,eN.jsx)("a",{className:"remove",onClick:()=>{x&&x(null),j(e=>e.filter((e,l)=>l!==t))},children:"\xd7"})]},String(e.id)))}),(0,eN.jsx)(J.TextArea,{ref:g,className:"input textarea-stacked",placeholder:n,disabled:r||a,autoSize:{minRows:i,maxRows:i},value:y,onPressEnter:e=>{"Enter"===e.key&&(e.shiftKey||(e.preventDefault(),D()))},onChange:e=>b(e.target.value)})]}),(0,eN.jsxs)("div",{className:"footer",children:[(0,eN.jsxs)("div",{className:"left",children:[!!(null==o?void 0:o.length)&&(0,eN.jsx)(W,{trigger:["click"],popupRender:()=>A,placement:"topLeft",styles:{root:{boxShadow:"var(--ant-box-shadow-card)"}},children:(0,eN.jsx)(es,{title:"选择助理",children:(0,eN.jsx)(_,{className:"agent-trigger",onClick:e=>e.preventDefault(),children:(0,eN.jsx)(tS,{type:"icon-at"})})})}),h&&(0,eN.jsxs)(eN.Fragment,{children:[(0,eN.jsx)(es,{title:"上传文件",children:(0,eN.jsx)(_,{className:"attach-upload",onClick:()=>I(!0),disabled:r||a,children:(0,eN.jsx)(tS,{type:"icon-paper-clip"})})}),(0,eN.jsx)(tR,{open:k,onCancel:()=>I(!1),onOk:E,allowedExtensions:tB,allowedMimeTypes:tA})]})]}),(0,eN.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6},children:[!N&&(0,eN.jsx)("div",{className:"tips",children:"按 Enter 发送,Shift+Enter 换行"}),(0,eN.jsx)("a",{className:`send-btn ${!a&&(null==y?void 0:y.length)>0?"send-btn-active":""}`,onClick:D,children:(0,eN.jsx)(O,{})})]})]})]})})}),t_=t.div`
|
|
320
320
|
width: 100%;
|
|
321
321
|
padding: 0 12px;
|
|
322
322
|
border-bottom: solid 1px #e8e8e8;
|
|
@@ -373,7 +373,7 @@ import*as e from"react";import t,{css as l}from"styled-components";import{AlignC
|
|
|
373
373
|
.conversation-list li small {
|
|
374
374
|
white-space: nowrap;
|
|
375
375
|
}
|
|
376
|
-
`,t$=[],tF="bi-design",tY=e=>{let t,l,n,r,a,i,o,{agentList:s=t$,headExtra:d,style:u={},onEffect:p}=e,{pageId:x,fetch:m}=(0,eO.useContext)(tu);if(!m)return null;let[h,g]=(0,eO.useState)(null),[v,j]=(0,eO.useState)([]),[b,w]=(0,eO.useState)([]),C=eO.default.useRef(null),S=()=>{setTimeout(()=>{C.current&&C.current.scrollToBottom()},100)},z=()=>{g(null),w([])},k=async e=>{q.confirm({title:"确认删除该对话吗?",okText:"确认",cancelText:"取消",onOk:async()=>{var t;await (null==(t=m.ai)?void 0:t.removeConversation(tF,x,e)),j(t=>t.filter(t=>t.id!==e)),w(t=>t.filter(t=>t.conversationId!==e)),h===e&&z()}})},I=async e=>{var t;g(e),j(t=>t.map(t=>({...t,isActived:t.id===e}))),w(await (null==(t=m.ai)?void 0:t.messageList(tF,x,e))||[])},N=async e=>{var t;let l={id:ex(),question:e.message,createdAt:new Date().toISOString(),files:e.files||[],agents:e.agents||[],sending:!0};w(e=>[...e,l]),S();let n=!h,{id:r,answer:a,createdAt:i,conversation:o}=await (null==(t=m.ai)?void 0:t.chat(tF,x,h,e));g((null==o?void 0:o.id)||""),j(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)),w(e=>[...e]),S()},O=async e=>{var t;await (null==(t=m.ai)?void 0:t.removeMessage(tF,x,e)),w(t=>t.filter(t=>t.id!==e))},T=(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=[],v.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)),E=async()=>{try{var e,t;let l=await (null==(e=m.ai)?void 0:e.conversationList(tF,x));j(l||[]);let n=null==l?void 0:l.find(e=>e.isActived);if(n){g(n.id);let e=await (null==(t=m.ai)?void 0:t.messageList(tF,x,n.id));w(e||[])}}catch(e){console.error(e)}};return(0,eO.useEffect)(()=>{E()},[m]),(0,eO.useEffect)(()=>{S()},[]),(0,eN.jsxs)(tP,{style:u,children:[(0,eN.jsx)(tM,{title:"智能助理",extra:(0,eN.jsxs)(en,{children:[(0,eN.jsx)(es,{title:"新对话",placement:"topRight",children:(0,eN.jsx)("a",{onClick:z,children:(0,eN.jsx)(tS,{type:"icon-chat-plus"})})}),(0,eN.jsx)(W,{trigger:["click"],styles:{root:{boxShadow:"var(--ant-box-shadow-drawer-up)",backgroundColor:"#ffffff",borderRadius:"var(--ant-border-radius)"}},popupRender:()=>(0,eN.jsx)(tW,{children:T.map(e=>(0,eN.jsxs)("div",{className:"group",children:[(0,eN.jsx)("div",{className:"group-title",children:e.title}),(0,eN.jsx)("ul",{className:"group-list",children:e.items.map(e=>(0,eN.jsxs)("li",{className:e.isActived?"actived":"",children:[(0,eN.jsx)("a",{onClick:()=>I(e.id),children:e.name}),(0,eN.jsx)("small",{children:(0,eN.jsx)("a",{onClick:()=>k(e.id),children:(0,eN.jsx)(c,{})})})]},e.id))})]},e.title))}),placement:"topRight",children:(0,eN.jsx)("a",{children:(0,eN.jsx)(f,{})})}),d]}),style:{width:"initial"}}),(0,eN.jsxs)("div",{className:"body",children:[(0,eN.jsx)("div",{style:{flex:"1 1 auto",overflowY:"auto"},children:b.length?(0,eN.jsx)(
|
|
376
|
+
`,t$=[],tF="bi-design",tY=e=>{let t,l,n,r,a,i,o,{agentList:s=t$,headExtra:d,style:u={},onEffect:p}=e,{pageId:x,fetch:m}=(0,eO.useContext)(tu);if(!m)return null;let[h,g]=(0,eO.useState)(null),[v,j]=(0,eO.useState)([]),[b,w]=(0,eO.useState)([]),C=eO.default.useRef(null),S=()=>{setTimeout(()=>{C.current&&C.current.scrollToBottom()},100)},z=()=>{g(null),w([])},k=async e=>{q.confirm({title:"确认删除该对话吗?",okText:"确认",cancelText:"取消",onOk:async()=>{var t;await (null==(t=m.ai)?void 0:t.removeConversation(tF,x,e)),j(t=>t.filter(t=>t.id!==e)),w(t=>t.filter(t=>t.conversationId!==e)),h===e&&z()}})},I=async e=>{var t;g(e),j(t=>t.map(t=>({...t,isActived:t.id===e}))),w(await (null==(t=m.ai)?void 0:t.messageList(tF,x,e))||[])},N=async e=>{var t;let l={id:ex(),question:e.message,createdAt:new Date().toISOString(),files:e.files||[],agents:e.agents||[],sending:!0};w(e=>[...e,l]),S();let n=!h,{id:r,answer:a,createdAt:i,conversation:o}=await (null==(t=m.ai)?void 0:t.chat(tF,x,h,e));g((null==o?void 0:o.id)||""),j(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)),w(e=>[...e]),S()},O=async e=>{var t;await (null==(t=m.ai)?void 0:t.removeMessage(tF,x,e)),w(t=>t.filter(t=>t.id!==e))},T=(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=[],v.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)),E=async()=>{try{var e,t;let l=await (null==(e=m.ai)?void 0:e.conversationList(tF,x));j(l||[]);let n=null==l?void 0:l.find(e=>e.isActived);if(n){g(n.id);let e=await (null==(t=m.ai)?void 0:t.messageList(tF,x,n.id));w(e||[])}}catch(e){console.error(e)}};return(0,eO.useEffect)(()=>{E()},[m]),(0,eO.useEffect)(()=>{S()},[]),(0,eN.jsxs)(tP,{style:u,children:[(0,eN.jsx)(tM,{title:"智能助理",extra:(0,eN.jsxs)(en,{children:[(0,eN.jsx)(es,{title:"新对话",placement:"topRight",children:(0,eN.jsx)("a",{onClick:z,children:(0,eN.jsx)(tS,{type:"icon-chat-plus"})})}),(0,eN.jsx)(W,{trigger:["click"],styles:{root:{boxShadow:"var(--ant-box-shadow-drawer-up)",backgroundColor:"#ffffff",borderRadius:"var(--ant-border-radius)"}},popupRender:()=>(0,eN.jsx)(tW,{children:T.map(e=>(0,eN.jsxs)("div",{className:"group",children:[(0,eN.jsx)("div",{className:"group-title",children:e.title}),(0,eN.jsx)("ul",{className:"group-list",children:e.items.map(e=>(0,eN.jsxs)("li",{className:e.isActived?"actived":"",children:[(0,eN.jsx)("a",{onClick:()=>I(e.id),children:e.name}),(0,eN.jsx)("small",{children:(0,eN.jsx)("a",{onClick:()=>k(e.id),children:(0,eN.jsx)(c,{})})})]},e.id))})]},e.title))}),placement:"topRight",children:(0,eN.jsx)("a",{children:(0,eN.jsx)(f,{})})}),d]}),style:{width:"initial"}}),(0,eN.jsxs)("div",{className:"body",children:[(0,eN.jsx)("div",{style:{flex:"1 1 auto",overflowY:"auto"},children:b.length?(0,eN.jsx)(tJ,{ref:C,list:b,onDeleteMessage:O}):(0,eN.jsx)(tG,{})}),0===b.length&&v.length>0&&(0,eN.jsx)(M,{title:"历史记录",size:"small",variant:"borderless",styles:{header:{padding:0,border:"none"},body:{padding:0}},style:{padding:"12px 12px 0 12px"},children:(0,eN.jsx)("ul",{className:"conversation-list",children:v.slice(0,3).map(e=>(0,eN.jsxs)("li",{children:[(0,eN.jsxs)("a",{children:[(0,eN.jsx)(y,{}),e.name]}),(0,eN.jsx)("small",{children:tN(e.createdAt)})]},e.id))})}),(0,eN.jsx)(tL,{agentList:s,style:{padding:12},onUploading:null==m?void 0:m.upload,onSubmit:N})]})]})},tH=t.div`
|
|
377
377
|
flex: 1 1 auto;
|
|
378
378
|
display: flex;
|
|
379
379
|
align-items: center;
|
|
@@ -581,7 +581,7 @@ import*as e from"react";import t,{css as l}from"styled-components";import{AlignC
|
|
|
581
581
|
}
|
|
582
582
|
}
|
|
583
583
|
}
|
|
584
|
-
`,
|
|
584
|
+
`,tJ=(0,eO.forwardRef)((e,t)=>{let{list:l,onDeleteMessage:n}=e,r=(0,eO.useRef)(null),a=()=>{setTimeout(()=>{r.current&&(r.current.scrollTop=r.current.scrollHeight)},100)};return(0,eO.useImperativeHandle)(t,()=>({scrollToBottom:a})),(0,eN.jsx)(tK,{className:"message-list beautified_scrollbar",ref:r,children:l.map(e=>{var t,l,r,a,i,o,s,d,u;return(0,eN.jsxs)("div",{className:"msg",children:[(0,eN.jsxs)("div",{className:"user-message",children:[(0,eN.jsx)(en,{size:4,orientation:"vertical",className:"msg-tools",children:(0,eN.jsx)(V,{title:"确认删除吗?",okText:"确认",cancelText:"取消",onConfirm:()=>n(e.id),children:(0,eN.jsx)(es,{title:"删除",children:(0,eN.jsx)(_,{type:"link",size:"small",icon:(0,eN.jsx)(c,{})})})})}),(0,eN.jsx)("div",{className:"msg-header",children:(0,eN.jsx)("span",{children:tN(e.createdAt)})}),(0,eN.jsxs)("div",{className:"msg-section",children:[(0,eN.jsx)("div",{className:"msg-content",children:e.question}),(null==(t=e.files)?void 0:t.length)||(null==(l=e.agents)?void 0:l.length)?(0,eN.jsxs)("div",{className:"msg-meta",children:[null==(r=e.files)?void 0:r.map(e=>(0,eN.jsxs)(ei,{color:"processing",children:[(0,eN.jsx)(tS,{type:"icon-paper-clip"})," ",e.name]},e.id)),null==(a=e.agents)?void 0:a.map(e=>(0,eN.jsxs)(ei,{color:"blue",children:[(0,eN.jsx)(tS,{type:"icon-at"})," ",e.name]},e.id))]}):null]})]}),(0,eN.jsxs)("div",{className:"assistant-message",children:[(0,eN.jsx)("div",{className:"msg-header",children:(0,eN.jsxs)("span",{className:"msg-title",children:[(0,eN.jsx)(k,{})," 智能助理"]})}),(0,eN.jsx)("div",{className:"msg-section",children:e.sending?(0,eN.jsx)(el,{active:!0}):(0,eN.jsxs)(eN.Fragment,{children:[(0,eN.jsx)("div",{className:"msg-content",children:(null==(i=e.answer)?void 0:i.answer)||""}),!!(null==(s=e.answer)||null==(o=s.plans)?void 0:o.length)&&(0,eN.jsxs)("details",{className:"msg-ai-meta",open:!0,children:[(0,eN.jsx)("summary",{className:"msg-ai-meta-title",children:"PLANS:"}),(0,eN.jsx)("div",{className:"msg-ai-meta-list",children:e.answer.plans.map((e,t)=>(0,eN.jsx)(es,{title:e.description,children:(0,eN.jsx)(ei,{color:"blue",children:e.name})},t))})]}),!!(null==(u=e.answer)||null==(d=u.extra)?void 0:d.length)&&(0,eN.jsxs)("details",{className:"msg-ai-meta",open:!0,children:[(0,eN.jsx)("summary",{className:"msg-ai-meta-title",children:"ACTIONS:"}),(0,eN.jsx)("div",{className:"msg-ai-meta-list vertical",children:e.answer.extra.map((e,t)=>(0,eN.jsxs)("div",{className:"msg-ai-meta-list-item",children:[(0,eN.jsx)(ei,{color:"gold",children:e.element}),(0,eN.jsx)("span",{children:e.action})]},t))})]})]})})]})]},e.id)})})}),tU=t.div`
|
|
585
585
|
display: flex;
|
|
586
586
|
flex-direction: column;
|
|
587
587
|
height: 100%;
|
|
@@ -620,7 +620,7 @@ import*as e from"react";import t,{css as l}from"styled-components";import{AlignC
|
|
|
620
620
|
font-size: 16px;
|
|
621
621
|
color: var(--ant-color-text-secondary);
|
|
622
622
|
}
|
|
623
|
-
`,tq=e=>{let{}=e,{schema:t,selectedItem:l,setSelectedItem:n,plugins:r,forceUpdate:a}=(0,eO.useContext)(tu),i=(0,eO.useMemo)(()=>(r||[]).reduce((e,t)=>(e[t.key]=t,e),{}),[r]),s=(0,eO.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,eO.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,eN.jsxs)(
|
|
623
|
+
`,tq=e=>{let{}=e,{schema:t,selectedItem:l,setSelectedItem:n,plugins:r,forceUpdate:a}=(0,eO.useContext)(tu),i=(0,eO.useMemo)(()=>(r||[]).reduce((e,t)=>(e[t.key]=t,e),{}),[r]),s=(0,eO.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,eO.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,eN.jsxs)(tU,{className:"cascade-panel",children:[(0,eN.jsx)(tM,{title:"联动",extra:(null==l?void 0:l.cascadeIds)?(0,eN.jsx)(en,{children:(0,eN.jsx)(W,{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,eN.jsxs)("a",{children:[(0,eN.jsx)(tS,{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,eN.jsxs)("a",{className:"toolbar",children:[(0,eN.jsx)(C,{}),(0,eN.jsx)(o,{style:{fontSize:8,verticalAlign:"sub"}})]})})}):null}),(0,eN.jsx)("div",{className:"body beautified_scrollbar",children:(null==l?void 0:l.cascadeIds)&&(0,eN.jsx)("ul",{children:(l.cascadeIds||[]).map((e,t)=>{var n,r,a,o,s;return(0,eN.jsxs)("li",{children:[(0,eN.jsxs)("div",{children:[(0,eN.jsx)(tS,{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,eN.jsx)(V,{title:"确认删除吗?",okText:"确认",cancelText:"取消",onConfirm:()=>{let e=[...l.cascadeIds||[]];e.splice(t,1),u&&u(e)},children:(0,eN.jsx)("a",{children:(0,eN.jsx)(c,{})})})]},e)})})})]})};var tX=ey(965),tV=ey.n(tX);let tQ=()=>{let{schema:e}=(0,eO.useContext)(tu),t=(0,eO.useMemo)(()=>JSON.stringify(e||{},null,2),[e]);return(0,eN.jsxs)("div",{className:"code-panel",style:{display:"flex",flexDirection:"column",height:"100%"},children:[(0,eN.jsx)(tM,{title:"代码",extra:(0,eN.jsx)(en,{children:(0,eN.jsx)(es,{title:"复制到剪切板",children:(0,eN.jsx)("a",{className:"toolbar",onClick:()=>{tV()(t||"")&&ep.success("复制成功")},children:(0,eN.jsx)(d,{})})})})}),(0,eN.jsx)("div",{className:"body",style:{flex:"1 1 auto",display:"flex"},children:(0,eN.jsx)(em,{height:"100%",defaultLanguage:"json",value:t,options:{lineNumbers:"off",readOnly:!0,minimap:{enabled:!1}}})})]})},tZ=t.div`
|
|
624
624
|
display: flex;
|
|
625
625
|
flex-direction: column;
|
|
626
626
|
height: 100%;
|
|
@@ -699,7 +699,7 @@ import*as e from"react";import t,{css as l}from"styled-components";import{AlignC
|
|
|
699
699
|
.margin-bottom-0 {
|
|
700
700
|
margin-bottom: 0;
|
|
701
701
|
}
|
|
702
|
-
`,t4=()=>{let{schema:e,setSchema:t}=(0,eO.useContext)(tu),[l,n]=(0,eO.useState)(!1),[r,a]=(0,eO.useState)(!1),[i,s]=(0,eO.useState)(-1),[d,u]=(0,eO.useState)({id:ex(),type:"api",name:"",url:"",method:"GET",headers:[],formData:[],body:""}),[x,m]=(0,eO.useState)({id:ex(),type:"sql",name:"",query:""}),h=(0,eO.useMemo)(()=>e.datasources,[e.datasources]),f=l=>{t({...e,datasources:l})},g=[{title:"键",dataIndex:"name",render:(e,t,l)=>(0,eN.jsx)(
|
|
702
|
+
`,t4=()=>{let{schema:e,setSchema:t}=(0,eO.useContext)(tu),[l,n]=(0,eO.useState)(!1),[r,a]=(0,eO.useState)(!1),[i,s]=(0,eO.useState)(-1),[d,u]=(0,eO.useState)({id:ex(),type:"api",name:"",url:"",method:"GET",headers:[],formData:[],body:""}),[x,m]=(0,eO.useState)({id:ex(),type:"sql",name:"",query:""}),h=(0,eO.useMemo)(()=>e.datasources,[e.datasources]),f=l=>{t({...e,datasources:l})},g=[{title:"键",dataIndex:"name",render:(e,t,l)=>(0,eN.jsx)(J,{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,eN.jsx)(J,{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,eN.jsx)(en,{children:(0,eN.jsx)("a",{onClick:()=>{let e=[...d.headers];e.splice(l,1),u({...d,headers:e})},children:(0,eN.jsx)(c,{})})})}];return(0,eN.jsxs)(t2,{className:"datasource-panel",children:[(0,eN.jsx)(tM,{title:"数据源",extra:(0,eN.jsx)(en,{children:(0,eN.jsx)(W,{menu:{onClick:e=>{let{key:t}=e;"api"===t?(s(-1),u({id:ex(),type:"api",name:"",url:"",method:"GET",headers:[],formData:[],body:""}),n(!0)):(s(-1),m({id:ex(),type:"sql",name:"",query:""}),a(!0))},items:[{key:"api",label:(0,eN.jsx)("a",{children:"API接口"})},{key:"sql",label:(0,eN.jsx)("a",{children:"SQL查询"})}]},placement:"bottom",children:(0,eN.jsxs)("a",{className:"toolbar",children:[(0,eN.jsx)(C,{}),(0,eN.jsx)(o,{style:{fontSize:8,verticalAlign:"sub"}})]})})})}),(0,eN.jsx)("div",{className:"body beautified_scrollbar",children:(0,eN.jsx)("ul",{children:h.map((e,t)=>(0,eN.jsxs)("li",{children:[(0,eN.jsxs)("div",{title:e.name,children:[(0,eN.jsx)(tS,{type:"icon-drag"})," ",e.name]}),(0,eN.jsxs)(en,{children:[(0,eN.jsx)("a",{onClick:()=>{s(t),"api"===e.type?(u({...e}),n(!0)):(m({...e}),a(!0))},children:(0,eN.jsx)(p,{})}),(0,eN.jsx)(V,{title:"确认删除吗?",okText:"确认",cancelText:"取消",onConfirm:()=>{let e;(e=[...h]).splice(t,1),f&&f(e)},children:(0,eN.jsx)("a",{children:(0,eN.jsx)(c,{})})})]})]},e.id))})}),(0,eN.jsx)(q,{title:"添加API接口",open:l,width:600,styles:{body:{maxHeight:"calc(100vh - 250px)",overflow:"auto"}},onCancel:()=>n(!1),footer:(0,eN.jsxs)(en,{children:[(0,eN.jsx)(_,{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,eN.jsx)(_,{onClick:()=>n(!1),children:"取消"})]}),children:(0,eN.jsxs)(K,{labelCol:{span:24},wrapperCol:{span:24},children:[(0,eN.jsx)(K.Item,{label:"接口名称",required:!0,children:(0,eN.jsx)(J,{value:d.name,onChange:e=>u({...d,name:e.target.value})})}),(0,eN.jsx)(K.Item,{label:"接口URL",required:!0,children:(0,eN.jsx)(J,{value:d.url,onChange:e=>u({...d,url:e.target.value})})}),(0,eN.jsx)(K.Item,{label:"请求方法",children:(0,eN.jsxs)(Z.Group,{value:d.method,onChange:e=>u({...d,method:e.target.value}),children:[(0,eN.jsx)(Z.Button,{value:"GET",children:"GET"}),(0,eN.jsx)(Z.Button,{value:"POST",children:"POST"}),(0,eN.jsx)(Z.Button,{value:"PUT",children:"PUT"}),(0,eN.jsx)(Z.Button,{value:"DELETE",children:"DELETE"})]})}),(0,eN.jsx)("label",{style:{display:"block",color:"#000000d9",padding:"8px 0"},children:"请求头"}),(0,eN.jsx)(ea,{columns:g,dataSource:d.headers,pagination:!1,locale:{emptyText:"暂无数据"},size:"small",bordered:!0,rowKey:(e,t)=>String(t)}),(0,eN.jsx)(_,{size:"small",block:!0,onClick:()=>u({...d,headers:[...d.headers,{name:"",value:""}]}),children:"添加"}),(0,eN.jsx)("label",{style:{display:"block",color:"#000000d9",padding:"8px 0"},children:"表单数据"}),(0,eN.jsx)(ea,{columns:g,dataSource:d.formData,pagination:!1,locale:{emptyText:"暂无数据"},size:"small",bordered:!0,rowKey:(e,t)=>`f-${t}`}),(0,eN.jsx)(_,{size:"small",block:!0,onClick:()=>u({...d,formData:[...d.formData,{name:"",value:""}]}),children:"添加"}),(0,eN.jsx)(K.Item,{label:"请求体",children:(0,eN.jsx)("div",{style:{border:"1px solid var(--ant-color-border)",borderRadius:"var(--ant-border-radius)",padding:1},children:(0,eN.jsx)(em,{height:"300px",defaultLanguage:"json",value:d.body,onChange:e=>u({...d,body:e||""}),options:{minimap:{enabled:!1},scrollBeyondLastLine:!1,tabSize:2}})})})]})}),(0,eN.jsx)(q,{title:"添加SQL查询",open:r,width:600,styles:{body:{maxHeight:"calc(100vh - 250px)",overflow:"auto"}},onCancel:()=>a(!1),footer:(0,eN.jsxs)(en,{children:[(0,eN.jsx)(_,{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,eN.jsx)(_,{onClick:()=>a(!1),children:"取消"})]}),children:(0,eN.jsxs)(K,{layout:"vertical",children:[(0,eN.jsx)(K.Item,{label:"查询名称",required:!0,children:(0,eN.jsx)(J,{value:x.name,onChange:e=>m({...x,name:e.target.value})})}),(0,eN.jsx)(K.Item,{label:"查询语句",required:!0,children:(0,eN.jsx)("div",{style:{border:"1px solid var(--ant-color-border)",borderRadius:"var(--ant-border-radius)",padding:1},children:(0,eN.jsx)(em,{height:"300px",defaultLanguage:"sql",value:x.query,onChange:e=>m({...x,query:e||""}),options:{minimap:{enabled:!1},scrollBeyondLastLine:!1,tabSize:2}})})})]})})]})},t8=t.div`
|
|
703
703
|
display: flex;
|
|
704
704
|
flex-direction: column;
|
|
705
705
|
height: 100%;
|
|
@@ -751,7 +751,7 @@ import*as e from"react";import t,{css as l}from"styled-components";import{AlignC
|
|
|
751
751
|
margin: 0;
|
|
752
752
|
}
|
|
753
753
|
}
|
|
754
|
-
`,t3=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},t7=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}=(0,eO.useContext)(tu),g=(0,eO.useRef)(null),[j,y]=(0,eO.useState)("1"),b=(0,eO.useMemo)(()=>t3((null==m?void 0:m.items)||[]),[m]),w=(0,eO.useMemo)(()=>p&&b.find(e=>e.id===p.id),[b,p]),C=w?j:"1",S=(0,eO.useMemo)(()=>u.find(e=>e.key===(null==p?void 0:p.type)),[u,p]),z=null==S?void 0:S.formComponent,k=(null==p?void 0:p.props)||{},I=(null==p?void 0:p.style)||{},[O,T]=(0,eO.useState)((null==m?void 0:m.info)||{}),[E,D]=(0,eO.useState)((null==p?void 0:p.datasource)||{}),[A,B]=(0,eO.useState)(!1),R=e=>{h({...m,info:e})},L={Authorization:`Bearer ${localStorage.getItem("ASKDATA_TOKEN")||""}`};return eO.default.useEffect(()=>{y(p?"2":"1"),D((null==p?void 0:p.datasource)||{})},[p]),(0,eN.jsxs)(t5,{className:"properties-panel",children:[(0,eN.jsx)(tM,{title:"属性",extra:(0,eN.jsxs)(Z.Group,{value:C,size:"small",buttonStyle:"outline",onChange:e=>y(e.target.value),children:[(0,eN.jsx)(Z.Button,{value:"1",children:"页面"}),w&&(0,eN.jsx)(Z.Button,{value:"2",children:"组件"})]})}),(0,eN.jsxs)("div",{className:"body beautified_scrollbar",children:["1"===C&&(0,eN.jsxs)(K,{labelCol:{span:24},wrapperCol:{span:24},className:"ant-form-compact",children:[(0,eN.jsx)(K.Item,{label:"页面名称",children:(0,eN.jsx)(
|
|
754
|
+
`,t3=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},t7=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}=(0,eO.useContext)(tu),g=(0,eO.useRef)(null),[j,y]=(0,eO.useState)("1"),b=(0,eO.useMemo)(()=>t3((null==m?void 0:m.items)||[]),[m]),w=(0,eO.useMemo)(()=>p&&b.find(e=>e.id===p.id),[b,p]),C=w?j:"1",S=(0,eO.useMemo)(()=>u.find(e=>e.key===(null==p?void 0:p.type)),[u,p]),z=null==S?void 0:S.formComponent,k=(null==p?void 0:p.props)||{},I=(null==p?void 0:p.style)||{},[O,T]=(0,eO.useState)((null==m?void 0:m.info)||{}),[E,D]=(0,eO.useState)((null==p?void 0:p.datasource)||{}),[A,B]=(0,eO.useState)(!1),R=e=>{h({...m,info:e})},L={Authorization:`Bearer ${localStorage.getItem("ASKDATA_TOKEN")||""}`};return eO.default.useEffect(()=>{y(p?"2":"1"),D((null==p?void 0:p.datasource)||{})},[p]),(0,eN.jsxs)(t5,{className:"properties-panel",children:[(0,eN.jsx)(tM,{title:"属性",extra:(0,eN.jsxs)(Z.Group,{value:C,size:"small",buttonStyle:"outline",onChange:e=>y(e.target.value),children:[(0,eN.jsx)(Z.Button,{value:"1",children:"页面"}),w&&(0,eN.jsx)(Z.Button,{value:"2",children:"组件"})]})}),(0,eN.jsxs)("div",{className:"body beautified_scrollbar",children:["1"===C&&(0,eN.jsxs)(K,{labelCol:{span:24},wrapperCol:{span:24},className:"ant-form-compact",children:[(0,eN.jsx)(K.Item,{label:"页面名称",children:(0,eN.jsx)(J,{size:"small",value:null==O?void 0:O.name,placeholder:"请输入页面名称",onChange:e=>{let t={...O,name:e.target.value};T(t),R&&R(t)}})}),(0,eN.jsx)(K.Item,{label:"页面描述",children:(0,eN.jsx)(J.TextArea,{size:"small",value:null==O?void 0:O.description,placeholder:"请输入页面描述",onChange:e=>{let t={...O,description:e.target.value};T(t),R&&R(t)}})}),(0,eN.jsxs)(K.Item,{label:"封面",children:[(0,eN.jsxs)(eu.Dragger,{name:"file",multiple:!1,accept:".png,.jpg,.jpeg",headers:L,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={...O,cover:l};T(n),R&&R(n)}},children:[(0,eN.jsx)("p",{className:"ant-upload-drag-icon",children:(0,eN.jsx)(v,{})}),(0,eN.jsx)("p",{className:"ant-upload-text",children:"点击或将文件拖拽到此区域进行上传"}),(0,eN.jsx)("p",{className:"ant-upload-hint",children:"严禁上传公司数据或其他被禁止的文件。"})]}),(null==O||null==(t=O.cover)?void 0:t.url)&&(0,eN.jsxs)("div",{style:{marginTop:10,textAlign:"left"},children:[(0,eN.jsxs)("div",{style:{display:"flex",justifyContent:"space-between"},children:[(0,eN.jsx)("label",{children:"封面预览"}),(0,eN.jsx)("a",{onClick:()=>{let e={...O,cover:null};T(e),R&&R(e)},children:(0,eN.jsx)(c,{})})]}),(0,eN.jsx)("img",{src:O.cover.url,style:{width:"100%",maxHeight:200}})]})]})]}),"2"===C&&(0,eN.jsxs)(eN.Fragment,{children:[(0,eN.jsx)(H,{children:"基础属性"}),(0,eN.jsxs)(K,{labelCol:{span:24},wrapperCol:{span:24},className:"ant-form-compact",children:[(0,eN.jsx)(K.Item,{label:"组件标识",labelCol:{span:5},wrapperCol:{span:19},children:(null==p?void 0:p.id)||""}),(0,eN.jsx)(K.Item,{label:"组件名称",children:(0,eN.jsx)(J,{size:"small",value:null==p?void 0:p.name,onChange:e=>x&&x({...p,name:e.target.value})})}),(0,eN.jsx)(K.Item,{label:"组件描述",children:(0,eN.jsx)(J.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,eN.jsx)(H,{children:"数据源"}),(null==p?void 0:p.datasource)&&(0,eN.jsxs)(K,{className:"ant-form-compact",children:[(0,eN.jsx)(K.Item,{label:(0,eN.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:"数据来源"}),labelCol:{span:5},wrapperCol:{span:19},colon:!1,children:(0,eN.jsxs)(Z.Group,{size:"small",value:null==E?void 0:E.source,onChange:e=>{let t={...E||{},source:e.target.value};D(t),x&&x({...p,datasource:t})},children:[!!f&&(0,eN.jsx)(Z.Button,{value:"dataset",children:"数据集"}),d&&(0,eN.jsx)(Z.Button,{value:"define",children:"数据源"}),(0,eN.jsx)(Z.Button,{value:"custom",children:"自定义"})]})}),(null==E?void 0:E.source)==="dataset"&&f&&(0,eN.jsx)(eN.Fragment,{children:(0,eN.jsx)(K.Item,{label:"数据集",labelCol:{span:5},wrapperCol:{span:19},children:(0,eN.jsxs)(en.Compact,{children:[(0,eN.jsx)(J,{size:"small",readOnly:!0,value:(null==E||null==(l=E.dataset)?void 0:l.name)||"",style:{width:90}}),!!(null==E||null==(r=E.dataset)||null==(n=r.id)?void 0:n.length)&&(null==E||null==(a=E.dataset)?void 0:a.output)&&(0,eN.jsx)(Q,{title:"输出类型",placement:"left",content:(0,eN.jsx)("div",{style:{padding:"0 12px",maxWidth:500,maxHeight:500,overflow:"auto"},children:(0,eN.jsx)(le,{output:E.dataset.output})}),children:(0,eN.jsx)(_,{size:"small",style:{color:"var(--ant-color-text-tertiary)"},title:"查看输出类型",children:(0,eN.jsx)(tS,{type:"icon-json"})})}),!!(null==E||null==(o=E.dataset)||null==(i=o.id)?void 0:i.length)&&(0,eN.jsx)(_,{size:"small",icon:(0,eN.jsx)(s,{}),onClick:()=>{let e={...E||{},dataset:{id:"",name:"",output:{fields:[]}}};D(e),x&&x({...p,datasource:e})},title:"删除数据集",style:{color:"var(--ant-color-text-tertiary)"}}),(0,eN.jsx)(_,{size:"small",icon:(0,eN.jsx)(N,{}),title:"选择数据集",onClick:()=>B(!0)})]})})}),(null==E?void 0:E.source)==="define"&&(0,eN.jsxs)(eN.Fragment,{children:[(0,eN.jsx)(K.Item,{label:"数据源",layout:"vertical",children:(0,eN.jsx)(et,{size:"small",value:null==E?void 0:E.datasourceId,onChange:e=>{let t={...E||{},datasourceId:e};D(t),x&&x({...p,datasource:t})},children:((null==m?void 0:m.datasources)||[]).map(e=>(0,eN.jsx)(et.Option,{value:e.id,children:e.name},e.id))})}),(0,eN.jsx)(K.Item,{label:"数据处理脚本",labelCol:{span:24},wrapperCol:{span:24},children:(0,eN.jsx)(et,{size:"small",value:null==E?void 0:E.scriptId,onChange:e=>{let t={...E||{},scriptId:e};D(t),x&&x({...p,datasource:t})},children:((null==m?void 0:m.scripts)||[]).map(e=>(0,eN.jsx)(et.Option,{value:e.id,children:e.name},e.id))})})]}),(null==E?void 0:E.source)==="custom"&&(0,eN.jsx)(eN.Fragment,{children:(0,eN.jsx)(K.Item,{label:(0,eN.jsxs)(eN.Fragment,{children:["自定义",(0,eN.jsxs)("a",{onClick:()=>{var e,t;let l=null==(e=g.current)?void 0:e.editor;null==l||null==(t=l.getAction("editor.action.formatDocument"))||t.run()},children:[(0,eN.jsx)(tS,{type:"icon-formate"})," 格式化"]})]}),labelCol:{span:24},wrapperCol:{span:24},className:"ant-form-item-label-space",children:(0,eN.jsx)("div",{style:{border:"1px solid var(--ant-color-border)",borderRadius:"var(--ant-border-radius)",padding:1},children:(0,eN.jsx)(em,{height:"200px",onMount:e=>{g.current={editor:e}},defaultLanguage:"json",value:(null==E?void 0:E.custom)||"",onChange:e=>{let t={...E||{},custom:e||""};D(t),x&&x({...p,datasource:t})},options:{minimap:{enabled:!1},scrollBeyondLastLine:!1,tabSize:2}})})})})]}),z&&(0,eN.jsx)(H,{children:"特有属性"}),z&&(0,eN.jsx)(z,{model:k,customStyle:I,onChange:e=>{p&&x&&x({...p,props:e})}})]})]}),!!f&&(0,eN.jsx)(G,{title:"选择数据集",size:800,open:A,onClose:()=>{B(!1)},children:f(e=>{E.dataset=e,B(!1)})})]})},le=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,eN.jsxs)(eN.Fragment,{children:["{",e.map((n,r)=>(0,eN.jsxs)("div",{style:{paddingLeft:"1em"},children:[(0,eN.jsx)("span",{style:{color:"var(--ant-color-primary)"},children:n.key}),":"," ","ARRAY"===n.type?(0,eN.jsxs)(eN.Fragment,{children:["Array","<",n.schema?l(n.schema.fields,t+1):(0,eN.jsx)("span",{children:"any"}),">"]}):"OBJECT"===n.type?n.schema?l(n.schema.fields,t+1):(0,eN.jsx)("span",{children:"{}"}):(0,eN.jsx)("span",{style:{color:"var(--ant-color-success)"},children:(n.type||"string").toLowerCase()}),r<e.length-1?",":""]},n.key||r)),"}"]}):(0,eN.jsx)("span",{children:"{}"})};return(0,eN.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)})},lt=t.div`
|
|
755
755
|
display: flex;
|
|
756
756
|
flex-direction: column;
|
|
757
757
|
height: 100%;
|
|
@@ -790,7 +790,7 @@ import*as e from"react";import t,{css as l}from"styled-components";import{AlignC
|
|
|
790
790
|
font-size: 14px;
|
|
791
791
|
padding: 0 50px;
|
|
792
792
|
}
|
|
793
|
-
`,ll=()=>{let{schema:e,setSchema:t}=(0,eO.useContext)(tu),[l,n]=eO.default.useState(!1),[r,a]=eO.default.useState(-1),[i]=K.useForm(),o=(0,eO.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,eN.jsxs)(lt,{className:"script-panel",children:[(0,eN.jsx)(tM,{title:"脚本",extra:(0,eN.jsx)(en,{children:(0,eN.jsx)("a",{className:"toolbar",onClick:()=>{a(-1),i.setFieldsValue({name:"",script:"return {};"}),n(!0)},children:"+"})})}),(0,eN.jsx)("div",{className:"body beautified_scrollbar",children:(0,eN.jsx)("ul",{children:o.map((e,t)=>(0,eN.jsxs)("li",{children:[(0,eN.jsxs)("div",{title:e.name,children:[(0,eN.jsx)(tS,{type:"icon-drag"})," ",e.name]}),(0,eN.jsxs)(en,{children:[(0,eN.jsx)("a",{onClick:()=>{a(t),i.setFieldsValue({name:e.name,script:e.script}),n(!0)},children:(0,eN.jsx)(p,{})}),(0,eN.jsx)("a",{onClick:()=>{let e=[...o];e.splice(t,1),s&&s(e)},children:(0,eN.jsx)(c,{})})]})]},e.id||t))})}),(0,eN.jsx)(q,{title:"添加脚本",open:l,width:600,styles:{body:{maxHeight:"calc(100vh - 250px)",overflow:"auto"}},onCancel:()=>n(!1),footer:(0,eN.jsxs)(en,{children:[(0,eN.jsx)(_,{type:"primary",onClick:d,children:"确定"}),(0,eN.jsx)(_,{onClick:()=>n(!1),children:"取消"})]}),children:(0,eN.jsxs)(K,{form:i,layout:"vertical",children:[(0,eN.jsx)(K.Item,{label:"脚本名称",name:"name",rules:[{required:!0,message:"请输入脚本名称"}],children:(0,eN.jsx)(
|
|
793
|
+
`,ll=()=>{let{schema:e,setSchema:t}=(0,eO.useContext)(tu),[l,n]=eO.default.useState(!1),[r,a]=eO.default.useState(-1),[i]=K.useForm(),o=(0,eO.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,eN.jsxs)(lt,{className:"script-panel",children:[(0,eN.jsx)(tM,{title:"脚本",extra:(0,eN.jsx)(en,{children:(0,eN.jsx)("a",{className:"toolbar",onClick:()=>{a(-1),i.setFieldsValue({name:"",script:"return {};"}),n(!0)},children:"+"})})}),(0,eN.jsx)("div",{className:"body beautified_scrollbar",children:(0,eN.jsx)("ul",{children:o.map((e,t)=>(0,eN.jsxs)("li",{children:[(0,eN.jsxs)("div",{title:e.name,children:[(0,eN.jsx)(tS,{type:"icon-drag"})," ",e.name]}),(0,eN.jsxs)(en,{children:[(0,eN.jsx)("a",{onClick:()=>{a(t),i.setFieldsValue({name:e.name,script:e.script}),n(!0)},children:(0,eN.jsx)(p,{})}),(0,eN.jsx)("a",{onClick:()=>{let e=[...o];e.splice(t,1),s&&s(e)},children:(0,eN.jsx)(c,{})})]})]},e.id||t))})}),(0,eN.jsx)(q,{title:"添加脚本",open:l,width:600,styles:{body:{maxHeight:"calc(100vh - 250px)",overflow:"auto"}},onCancel:()=>n(!1),footer:(0,eN.jsxs)(en,{children:[(0,eN.jsx)(_,{type:"primary",onClick:d,children:"确定"}),(0,eN.jsx)(_,{onClick:()=>n(!1),children:"取消"})]}),children:(0,eN.jsxs)(K,{form:i,layout:"vertical",children:[(0,eN.jsx)(K.Item,{label:"脚本名称",name:"name",rules:[{required:!0,message:"请输入脚本名称"}],children:(0,eN.jsx)(J,{})}),(0,eN.jsx)(K.Item,{label:"脚本语句",name:"script",rules:[{required:!0,message:"请输入脚本语句"}],children:(0,eN.jsxs)("div",{style:{border:"1px solid #d9d9d9",padding:"0 10px"},children:[(0,eN.jsxs)("div",{className:"function-wrapper",children:["function fixed(data) ","{"]}),(0,eN.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,eN.jsx)("div",{className:"function-wrapper",children:"}"})]})})]})})]})},ln=t.div`
|
|
794
794
|
display: flex;
|
|
795
795
|
flex-direction: column;
|
|
796
796
|
height: 100%;
|
|
@@ -801,7 +801,7 @@ import*as e from"react";import t,{css as l}from"styled-components";import{AlignC
|
|
|
801
801
|
gap: 12px;
|
|
802
802
|
padding: 12px;
|
|
803
803
|
}
|
|
804
|
-
`,lr=()=>{let{schema:e,setSchema:t}=(0,eO.useContext)(tu),[l,n]=eO.default.useState(!1),[r,a]=eO.default.useState(-1),[i]=K.useForm(),o=(0,eO.useMemo)(()=>e.variables||[],[e.variables]),s=l=>{t({...e,variables:l})},d=[{title:"名称",dataIndex:"name",render:(e,t)=>(0,eN.jsxs)("div",{title:e,children:[(0,eN.jsx)(tS,{type:"icon-drag"})," ",e]})},{title:"值",dataIndex:"value"},{title:"操作",width:60,align:"center",render:(e,t,l)=>(0,eN.jsxs)(en,{children:[(0,eN.jsx)("a",{onClick:()=>{a(l),i.setFieldsValue({name:t.name,value:t.value}),n(!0)},children:(0,eN.jsx)(p,{})}),(0,eN.jsx)(V,{title:"确认删除吗?",okText:"确认",cancelText:"取消",onConfirm:()=>{let e=[...o];e.splice(l,1),s&&s(e)},children:(0,eN.jsx)("a",{children:(0,eN.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,eN.jsxs)(ln,{children:[(0,eN.jsx)(tM,{title:"环境变量",extra:(0,eN.jsx)(en,{children:(0,eN.jsx)("a",{className:"toolbar",onClick:()=>{a(-1),i.resetFields(),n(!0)},children:"+"})})}),(0,eN.jsx)("div",{className:"body beautified_scrollbar",children:(0,eN.jsx)(ea,{rowKey:e=>e.id||e.name,dataSource:o,columns:d,pagination:!1,size:"small",locale:{emptyText:"暂无环境变量"}})}),(0,eN.jsx)(q,{title:"添加环境变量",open:l,width:600,styles:{body:{maxHeight:"calc(100vh - 250px)",overflow:"auto"}},onCancel:()=>n(!1),footer:(0,eN.jsxs)(en,{children:[(0,eN.jsx)(_,{type:"primary",onClick:u,children:"确定"}),(0,eN.jsx)(_,{onClick:()=>n(!1),children:"取消"})]}),children:(0,eN.jsxs)(K,{form:i,layout:"vertical",children:[(0,eN.jsx)(K.Item,{label:"环境变量名称",name:"name",rules:[{required:!0,message:"请输入环境变量名称"}],children:(0,eN.jsx)(
|
|
804
|
+
`,lr=()=>{let{schema:e,setSchema:t}=(0,eO.useContext)(tu),[l,n]=eO.default.useState(!1),[r,a]=eO.default.useState(-1),[i]=K.useForm(),o=(0,eO.useMemo)(()=>e.variables||[],[e.variables]),s=l=>{t({...e,variables:l})},d=[{title:"名称",dataIndex:"name",render:(e,t)=>(0,eN.jsxs)("div",{title:e,children:[(0,eN.jsx)(tS,{type:"icon-drag"})," ",e]})},{title:"值",dataIndex:"value"},{title:"操作",width:60,align:"center",render:(e,t,l)=>(0,eN.jsxs)(en,{children:[(0,eN.jsx)("a",{onClick:()=>{a(l),i.setFieldsValue({name:t.name,value:t.value}),n(!0)},children:(0,eN.jsx)(p,{})}),(0,eN.jsx)(V,{title:"确认删除吗?",okText:"确认",cancelText:"取消",onConfirm:()=>{let e=[...o];e.splice(l,1),s&&s(e)},children:(0,eN.jsx)("a",{children:(0,eN.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,eN.jsxs)(ln,{children:[(0,eN.jsx)(tM,{title:"环境变量",extra:(0,eN.jsx)(en,{children:(0,eN.jsx)("a",{className:"toolbar",onClick:()=>{a(-1),i.resetFields(),n(!0)},children:"+"})})}),(0,eN.jsx)("div",{className:"body beautified_scrollbar",children:(0,eN.jsx)(ea,{rowKey:e=>e.id||e.name,dataSource:o,columns:d,pagination:!1,size:"small",locale:{emptyText:"暂无环境变量"}})}),(0,eN.jsx)(q,{title:"添加环境变量",open:l,width:600,styles:{body:{maxHeight:"calc(100vh - 250px)",overflow:"auto"}},onCancel:()=>n(!1),footer:(0,eN.jsxs)(en,{children:[(0,eN.jsx)(_,{type:"primary",onClick:u,children:"确定"}),(0,eN.jsx)(_,{onClick:()=>n(!1),children:"取消"})]}),children:(0,eN.jsxs)(K,{form:i,layout:"vertical",children:[(0,eN.jsx)(K.Item,{label:"环境变量名称",name:"name",rules:[{required:!0,message:"请输入环境变量名称"}],children:(0,eN.jsx)(J,{})}),(0,eN.jsx)(K.Item,{label:"环境变量值",name:"value",rules:[{required:!0,message:"请输入环境变量值"}],children:(0,eN.jsx)(J,{})})]})})]})},la=t.div`
|
|
805
805
|
display: flex;
|
|
806
806
|
flex-direction: column;
|
|
807
807
|
height: 100%;
|
|
@@ -927,7 +927,7 @@ import*as e from"react";import t,{css as l}from"styled-components";import{AlignC
|
|
|
927
927
|
background: transparent;
|
|
928
928
|
}
|
|
929
929
|
}
|
|
930
|
-
`,ls=e=>{let{open:t,onCancel:l,onOk:n}=e,[r,a]=(0,eO.useState)(JSON.stringify({info:{},datasources:[],scripts:[],variables:[],items:[]}));return(0,eN.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,eN.jsx)("div",{className:"body",style:{flex:"1 1 auto",display:"flex",height:"100%"},children:(0,eN.jsx)(eh,{height:"100%",defaultLanguage:"json",value:r,options:{minimap:{enabled:!1}},onChange:e=>a(e||"")})})})},ld=eO.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,fetch:f,onSave:v,loading:j=!1}=e,y=(0,eO.useRef)(null),b=(0,eO.useRef)(null),[C,S]=(0,eO.useState)(1),[k,N]=(0,eO.useState)([]),[O,D]=(0,eO.useState)([]),[R,L]=(0,eO.useState)(!1),[M,P]=(0,eO.useState)("desktop"),[$,F]=(0,eO.useState)("component"),[Y,W]=(0,eO.useState)((null==f?void 0:f.ai)?"ai":"props"),[K,
|
|
930
|
+
`,ls=e=>{let{open:t,onCancel:l,onOk:n}=e,[r,a]=(0,eO.useState)(JSON.stringify({info:{},datasources:[],scripts:[],variables:[],items:[]}));return(0,eN.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,eN.jsx)("div",{className:"body",style:{flex:"1 1 auto",display:"flex",height:"100%"},children:(0,eN.jsx)(eh,{height:"100%",defaultLanguage:"json",value:r,options:{minimap:{enabled:!1}},onChange:e=>a(e||"")})})})},ld=eO.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,fetch:f,onSave:v,loading:j=!1}=e,y=(0,eO.useRef)(null),b=(0,eO.useRef)(null),[C,S]=(0,eO.useState)(1),[k,N]=(0,eO.useState)([]),[O,D]=(0,eO.useState)([]),[R,L]=(0,eO.useState)(!1),[M,P]=(0,eO.useState)("desktop"),[$,F]=(0,eO.useState)("component"),[Y,W]=(0,eO.useState)((null==f?void 0:f.ai)?"ai":"props"),[K,J]=(0,eO.useState)(!0),[U,q]=(0,eO.useState)(!0),[X,V]=(0,eO.useState)(null),[Q,ee]=(0,eO.useState)({info:{},datasources:[],scripts:[],variables:[],items:[]}),[et,el]=(0,eO.useState)(!0),[er,ea]=(0,eO.useState)(!1),[ei,eo]=(0,eO.useState)(!1),ed=(0,eO.useMemo)(()=>{let e=K?"250px":"",t=U?"400px":"";return{gridTemplateColumns:`${e} 1fr ${t}`}},[K,U]),ec=(0,eO.useMemo)(()=>({display:K?"flex":"none"}),[K]),eu=(0,eO.useMemo)(()=>({display:U?"flex":"none"}),[U]);l=[Q],(n=(0,eO.useRef)()).current===JSON.stringify(l)&&n.current||(n.current=JSON.stringify(l),(()=>{R||(N(e=>e.length?[...e,JSON.parse(JSON.stringify(Q))].slice(-50):[JSON.parse(JSON.stringify(Q))]),D([]))})()),(0,eO.useImperativeHandle)(t,()=>({handleOpen(e){L(!0),ep(e.items),ee(e),N([JSON.parse(JSON.stringify(e))]),D([]),setTimeout(()=>L(!1),0)}}));let ep=(e,t)=>{e&&e.forEach(e=>{e.id||(e.id=t||Math.random().toString(36).slice(2,10)),Array.isArray(e.children)?ep(e.children):"object"==typeof e.children&&e.children&&Object.keys(e.children).forEach(t=>{Array.isArray(e.children[t])&&ep(e.children[t],Math.random().toString(36).slice(2,10))})})},ex=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)ee(JSON.parse(JSON.stringify(e.schema)));else if(null==(n=e.pageItems)?void 0:n.length){let t=new Map(e.pageItems.map(e=>[e.id,e])),l=JSON.parse(JSON.stringify(Q)),n=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];e.forEach(e=>{t.has(e.id)&&(Object.keys(e).forEach(t=>{"id"!==t&&delete e[t]}),Object.assign(e,t.get(e.id))),Array.isArray(e.children)?n(e.children):"object"==typeof e.children&&e.children&&Object.keys(e.children).forEach(t=>{Array.isArray(e.children[t])&&n(e.children[t])})})};n(l.items),ee(l)}},em=(0,eO.useMemo)(()=>"cascade"!==Y||(null==X?void 0:X.cascadeIds)?Y:"props",[X,Y]);return(0,eN.jsxs)(tp,{pageId:r,designable:et,plugins:i,schema:Q,selectedItem:X,setSchema:ee,setSelectedItem:V,datasetSelector:h,fetch:f,children:[(0,eN.jsxs)("div",{style:{display:"flex",flexDirection:"column",height:"100%"},children:[(0,eN.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 24px",borderBottom:"solid 1px #e8e8e8"},children:[(0,eN.jsxs)(en,{children:[(0,eN.jsx)("span",{style:{fontSize:16,fontWeight:500},children:"创建数据报表"}),(0,eN.jsx)(H,{orientation:"vertical"}),(0,eN.jsx)(es,{title:"保存",children:(0,eN.jsx)(_,{type:"link",className:"toolbar",onClick:()=>{null==v||v(Q)},loading:j,children:(0,eN.jsx)(I,{})})}),(0,eN.jsx)(H,{orientation:"vertical"}),(0,eN.jsx)(es,{title:"撤销",children:(0,eN.jsx)("a",{className:`toolbar ${k.length>1?"active":""}`,onClick:()=>{N(e=>{if(e.length<=1)return e;L(!0);let t=e[e.length-2];return D(e=>[...e,JSON.parse(JSON.stringify(Q))]),ee(t),V(null),setTimeout(()=>L(!1),0),e.slice(0,-1)})},children:(0,eN.jsx)(E,{})})}),(0,eN.jsx)(es,{title:"重做",children:(0,eN.jsx)("a",{className:`toolbar ${O.length>0?"active":""}`,onClick:()=>{D(e=>e.length?(L(!0),N(e=>[...e,JSON.parse(JSON.stringify(Q))]),ee(e[e.length-1]),V(null),setTimeout(()=>L(!1),0),e.slice(0,-1)):e)},children:(0,eN.jsx)(z,{})})}),(0,eN.jsx)(H,{orientation:"vertical"}),(0,eN.jsx)(es,{title:"导入JSON",children:(0,eN.jsx)("a",{className:`toolbar ${O.length>0?"active":""}`,onClick:()=>{ea(!0)},children:(0,eN.jsx)(g,{})})})]}),(0,eN.jsxs)(en,{children:[(0,eN.jsx)(es,{title:"缩小",children:(0,eN.jsx)("a",{className:"toolbar",onClick:()=>S(parseFloat(Math.max(C-.1,.5).toFixed(1))),children:(0,eN.jsx)(B,{})})}),(0,eN.jsxs)("div",{style:{fontSize:12,color:"#999",userSelect:"none"},children:[(100*C).toFixed(0),"%"]}),(0,eN.jsx)(es,{title:"放大",children:(0,eN.jsx)("a",{className:"toolbar",onClick:()=>S(parseFloat(Math.min(C+.1,2).toFixed(1))),children:(0,eN.jsx)(A,{})})}),(0,eN.jsx)(es,{title:"重置缩放",children:(0,eN.jsx)("a",{className:"toolbar",onClick:()=>S(1),children:(0,eN.jsx)(tS,{type:"icon-zoom-reset"})})}),(0,eN.jsx)(H,{orientation:"vertical"}),(0,eN.jsx)(es,{title:"切换左侧栏",children:(0,eN.jsx)("a",{className:`toolbar ${K?"active":""}`,onClick:()=>{J(e=>!e),setTimeout(()=>{var e,t;return null==(t=y.current)||null==(e=t.handleResize)?void 0:e.call(t)},0)},children:(0,eN.jsx)(tS,{type:"icon-sider-l"})})}),(0,eN.jsx)(es,{title:"切换右侧栏",children:(0,eN.jsx)("a",{className:`toolbar ${U?"active":""}`,onClick:()=>{q(e=>!e),setTimeout(()=>{var e,t;return null==(t=y.current)||null==(e=t.handleResize)?void 0:e.call(t)},0)},children:(0,eN.jsx)(tS,{type:"icon-sider-r"})})}),o]})]}),(0,eN.jsxs)(lo,{style:ed,children:[(0,eN.jsxs)("div",{className:"left",style:ec,children:[(0,eN.jsx)("div",{style:{padding:"22px 1px 22px 0",borderRight:"solid 1px #e8e8e8"},children:(0,eN.jsxs)(Z.Group,{value:$,onChange:e=>F(e.target.value),buttonStyle:"outline",style:{fontWeight:"normal",display:"inline-flex",flexDirection:"column",gap:14},className:"left-pane-tabs",children:[(0,eN.jsx)(Z.Button,{value:"component",children:(0,eN.jsx)(es,{title:"组件",placement:"right",children:(0,eN.jsx)(tS,{type:"icon-puzzle"})})}),(0,eN.jsx)(Z.Button,{value:"layer",children:(0,eN.jsx)(es,{title:"图层",placement:"right",children:(0,eN.jsx)(tS,{type:"icon-outline"})})}),!!p&&(0,eN.jsx)(Z.Button,{value:"dataset",children:(0,eN.jsx)(es,{title:"数据集",placement:"right",children:(0,eN.jsx)(tS,{type:"icon-dataset"})})}),d&&(0,eN.jsx)(Z.Button,{value:"datasource",title:"数据源",children:(0,eN.jsx)(es,{title:"数据源",placement:"right",children:(0,eN.jsx)(tS,{type:"icon-datasource"})})}),c&&(0,eN.jsx)(Z.Button,{value:"script",children:(0,eN.jsx)(es,{title:"脚本",placement:"right",children:(0,eN.jsx)(tS,{type:"icon-js"})})}),(0,eN.jsx)(Z.Button,{value:"env",children:(0,eN.jsx)(es,{title:"环境变量",placement:"right",children:(0,eN.jsx)(tS,{type:"icon-variable"})})}),(0,eN.jsx)(Z.Button,{value:"code",children:(0,eN.jsx)(es,{title:"源码",placement:"right",children:(0,eN.jsx)(tS,{type:"icon-json"})})})]})}),(0,eN.jsxs)("div",{style:{flex:"1 1 auto",display:"flex",flexDirection:"column",width:"calc(100% - 47px)"},children:["component"===$&&(0,eN.jsx)(t1,{}),"layer"===$&&(0,eN.jsx)(t9,{}),d&&"datasource"===$&&(0,eN.jsx)(t4,{}),c&&"script"===$&&(0,eN.jsx)(ll,{}),"env"===$&&(0,eN.jsx)(lr,{}),"code"===$&&(0,eN.jsx)(tQ,{}),!!p&&"dataset"===$&&(0,eN.jsx)(li,{ref:b,renderNode:p})]})]}),(0,eN.jsxs)("div",{className:"center",style:{flex:"1 1 auto"},children:[(0,eN.jsx)(tM,{title:"页面",extra:(0,eN.jsxs)(en,{children:[(0,eN.jsx)(_,{size:"small",type:et?"default":"primary",icon:et?(0,eN.jsx)(x,{}):(0,eN.jsx)(m,{}),onClick:()=>el(!et)}),(0,eN.jsxs)(Z.Group,{value:M,onChange:e=>P(e.target.value),size:"small",buttonStyle:"outline",children:[(0,eN.jsx)(Z.Button,{value:"desktop",title:"桌面",children:(0,eN.jsx)(u,{})}),(0,eN.jsx)(Z.Button,{value:"mobile",title:"移动设备",children:(0,eN.jsx)(w,{})}),(0,eN.jsx)(Z.Button,{value:"tablet",title:"平板设备",children:(0,eN.jsx)(T,{})})]})]})}),(0,eN.jsx)("div",{className:["body beautified_scrollbar",M].join(" "),children:(0,eN.jsx)("div",{style:{transform:`scale(${C})`,transformOrigin:"top center"},children:(0,eN.jsx)(tb,{ref:y,device:M,fetch:f})})})]}),(0,eN.jsxs)("div",{className:"right",style:eu,children:[(0,eN.jsxs)("div",{style:{flex:"1 1 auto",display:"flex",flexDirection:"column",width:"calc(100% - 47px)"},children:[(0,eN.jsx)(tY,{agentList:a,onEffect:ex,style:{display:"ai"===em&&(null==f?void 0:f.ai)?void 0:"none"}}),"props"===em&&(0,eN.jsx)(t7,{datasourceEnable:d}),"cascade"===em&&(null==X?void 0:X.cascadeIds)&&(0,eN.jsx)(tq,{})]}),(0,eN.jsx)("div",{style:{padding:"22px 0",borderLeft:"solid 1px #e8e8e8",display:"flex",flexDirection:"column",justifyContent:"space-between",alignItems:"center"},children:(0,eN.jsxs)(Z.Group,{value:em,onChange:e=>W(e.target.value),buttonStyle:"outline",style:{fontWeight:"normal",display:"inline-flex",flexDirection:"column",gap:14},className:"right-pane-tabs",children:[(null==f?void 0:f.ai)&&(0,eN.jsx)(Z.Button,{value:"ai",children:(0,eN.jsx)(es,{title:"智能助理",placement:"right",children:(0,eN.jsx)(tS,{type:"icon-assistant"})})}),(0,eN.jsx)(Z.Button,{value:"props",children:(0,eN.jsx)(es,{title:"属性",placement:"right",children:(0,eN.jsx)(tS,{type:"icon-info"})})}),(null==X?void 0:X.cascadeIds)&&(0,eN.jsx)(Z.Button,{value:"cascade",children:(0,eN.jsx)(es,{title:"联动",placement:"right",children:(0,eN.jsx)(tS,{type:"icon-cascade"})})})]})})]})]})]}),(0,eN.jsx)(ls,{open:er,onOk:e=>{ea(!1),ee(e)},onCancel:()=>ea(!1)}),(0,eN.jsx)(G,{open:ei,size:400,mask:!1,title:null,closable:!1,styles:{body:{padding:0}},onClose:()=>eo(!1),children:(0,eN.jsx)(tY,{agentList:a,headExtra:(0,eN.jsx)(_,{type:"link",icon:(0,eN.jsx)(s,{}),onClick:()=>eo(!1)}),onEffect:ex})})]})});var lc=((ez={}).STRING="STRING",ez.NUMBER="NUMBER",ez.BOOLEAN="BOOLEAN",ez.OBJECT="OBJECT",ez.ARRAY="ARRAY",ez);let lu=t(j)`
|
|
931
931
|
vertical-align: middle;
|
|
932
932
|
margin-left: 2px;
|
|
933
933
|
color: var(--ant-color-text-description);
|
|
@@ -1018,7 +1018,7 @@ import*as e from"react";import t,{css as l}from"styled-components";import{AlignC
|
|
|
1018
1018
|
margin-top: 16px;
|
|
1019
1019
|
text-align: right;
|
|
1020
1020
|
padding: ${e=>e.$bordered?"0 24px 24px":"0"};
|
|
1021
|
-
`;let lb=e=>{let{item:t,split:l,padding:n}=e;return(0,eN.jsx)(lh,{$split:l,$padding:n,children:(0,eN.jsxs)(lf,{children:[t.avatar&&(0,eN.jsx)(lg,{children:(0,eN.jsx)(L,{src:t.avatar})}),(0,eN.jsxs)(lv,{children:[t.title&&(0,eN.jsx)(lj,{children:t.href?(0,eN.jsx)("a",{href:t.href,children:t.title}):t.title}),t.description&&(0,eN.jsx)(ly,{children:t.description})]})]})})},lw=e=>{let{list:t=[],split:l,bordered:n,size:r,itemLayout:a,style:i,className:o}=e,s=(0,eO.useMemo)(()=>"small"===r?"8px 16px":n?"12px 24px":"12px 0",[r,n]);return(0,eN.jsx)(lm,{$bordered:n,$split:l,$size:r,style:i,$itemLayout:a,className:o,children:t.map((e,t)=>(0,eN.jsx)(lb,{item:e,split:l,padding:s},String(t)))})},lC=[{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,eO.useMemo)(()=>({...(null==n?void 0:n.style)||{},...a||{},...r||{}}),[n,a,r]);return(0,eN.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,eN.jsxs)(K,{layout:"vertical",children:[(0,eN.jsx)(K.Item,{label:"文本内容",children:(0,eN.jsx)(
|
|
1021
|
+
`;let lb=e=>{let{item:t,split:l,padding:n}=e;return(0,eN.jsx)(lh,{$split:l,$padding:n,children:(0,eN.jsxs)(lf,{children:[t.avatar&&(0,eN.jsx)(lg,{children:(0,eN.jsx)(L,{src:t.avatar})}),(0,eN.jsxs)(lv,{children:[t.title&&(0,eN.jsx)(lj,{children:t.href?(0,eN.jsx)("a",{href:t.href,children:t.title}):t.title}),t.description&&(0,eN.jsx)(ly,{children:t.description})]})]})})},lw=e=>{let{list:t=[],split:l,bordered:n,size:r,itemLayout:a,style:i,className:o}=e,s=(0,eO.useMemo)(()=>"small"===r?"8px 16px":n?"12px 24px":"12px 0",[r,n]);return(0,eN.jsx)(lm,{$bordered:n,$split:l,$size:r,style:i,$itemLayout:a,className:o,children:t.map((e,t)=>(0,eN.jsx)(lb,{item:e,split:l,padding:s},String(t)))})},lC=[{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,eO.useMemo)(()=>({...(null==n?void 0:n.style)||{},...a||{},...r||{}}),[n,a,r]);return(0,eN.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,eN.jsxs)(K,{layout:"vertical",children:[(0,eN.jsx)(K.Item,{label:"文本内容",children:(0,eN.jsx)(J.TextArea,{size:"small",value:o.text,onChange:e=>d("text",e.target.value)})}),(0,eN.jsx)(K.Item,{label:"类名",children:(0,eN.jsx)(et,{size:"small",value:o.classNames,mode:"tags",onChange:e=>d("classNames",e)})}),(0,eN.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,eN.jsxs)(en.Compact,{children:[(0,eN.jsxs)(et,{size:"small",value:null==(t=o.customStyle)?void 0:t.fontFamily,style:{width:90},onChange:e=>c("fontFamily",e),children:[(0,eN.jsx)(et.Option,{value:"'黑体', 'SimHei', sans-serif",children:"黑体"}),(0,eN.jsx)(et.Option,{value:"'宋体', 'SimSun', serif",children:"宋体"}),(0,eN.jsx)(et.Option,{value:"'仿宋', 'FangSong', serif",children:"仿宋"}),(0,eN.jsx)(et.Option,{value:"'楷体', 'KaiTi', serif",children:"楷体"}),(0,eN.jsx)(et.Option,{value:"Arial, sans-serif",children:"Arial"})]}),(0,eN.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,eN.jsx)(et.Option,{value:e,children:e},e))}),(0,eN.jsx)(F,{size:"small",value:null==(n=o.customStyle)?void 0:n.color,onChange:e=>c("color",e.toHexString()),allowClear:!0})]}),(0,eN.jsxs)(en.Compact,{children:[(0,eN.jsx)(_,{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,eN.jsx)(_,{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,eN.jsx)(_,{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,eN.jsx)("img",{id:t,src:l,alt:n,style:{width:r,height:a},className:o});return i&&i.length?(0,eN.jsx)("a",{href:i,target:"_blank",rel:"noreferrer",children:s}):(0,eN.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,eN.jsxs)(K,{labelCol:{span:24},wrapperCol:{span:24},children:[(0,eN.jsx)(K.Item,{label:(0,eN.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:["图片URL",(0,eN.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,eN.jsx)(_,{size:"small",type:"link",icon:(0,eN.jsx)(D,{})})})]}),children:(0,eN.jsx)(J,{size:"small",value:t.src,onChange:e=>n("src",e.target.value)})}),(0,eN.jsx)(K.Item,{label:"图片替代文本",children:(0,eN.jsx)(J,{size:"small",value:t.alt,onChange:e=>n("alt",e.target.value)})}),(0,eN.jsx)(K.Item,{label:"图片链接",children:(0,eN.jsx)(J,{size:"small",value:t.href,onChange:e=>n("href",e.target.value)})}),(0,eN.jsx)(K.Item,{label:"图片宽度",children:(0,eN.jsx)(J,{size:"small",value:t.width,onChange:e=>n("width",e.target.value)})}),(0,eN.jsx)(K.Item,{label:"图片高度",children:(0,eN.jsx)(J,{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,{env:p,callbacks:x}=(0,eO.useContext)(tv),m="danger"===n,h="string"==typeof r?r?(0,eN.jsx)(tS,{type:r}):void 0:r;return(0,eN.jsx)(_,{id:t,type:m?"default":n,icon:h,size:a,block:i,shape:["round","circle"].includes(o)?o:void 0,ghost:s,danger:m,onClick:()=>{p&&d&&x&&tI(p,d,x)},style:c,className:u,children:l})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n});return(0,eN.jsxs)(K,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,eN.jsx)(K.Item,{label:"文本",children:(0,eN.jsx)(J,{size:"small",value:t.text,onChange:e=>n("text",e.target.value),placeholder:"请输入按钮文本"})}),(0,eN.jsx)(K.Item,{label:"图标",children:(0,eN.jsx)(J,{size:"small",value:t.icon,onChange:e=>n("icon",e.target.value),placeholder:"请输入按钮图标(antdv 1.7.8)"})}),(0,eN.jsx)(K.Item,{label:"类型",children:(0,eN.jsxs)(Z.Group,{size:"small",value:t.type,onChange:e=>n("type",e.target.value),children:[(0,eN.jsx)(Z.Button,{value:"default",children:"默认"}),(0,eN.jsx)(Z.Button,{value:"primary",children:"主要"}),(0,eN.jsx)(Z.Button,{value:"link",children:"链接"}),(0,eN.jsx)(Z.Button,{value:"dashed",children:"虚线"}),(0,eN.jsx)(Z.Button,{value:"text",children:"文本"})]})}),(0,eN.jsx)(K.Item,{label:"大小",children:(0,eN.jsxs)(Z.Group,{size:"small",value:t.size,onChange:e=>n("size",e.target.value),children:[(0,eN.jsx)(Z.Button,{value:"small",children:"小"}),(0,eN.jsx)(Z.Button,{value:"middle",children:"中"}),(0,eN.jsx)(Z.Button,{value:"large",children:"大"})]})}),(0,eN.jsx)(K.Item,{label:"形状",children:(0,eN.jsxs)(Z.Group,{size:"small",value:t.shape,onChange:e=>n("shape",e.target.value),children:[(0,eN.jsx)(Z.Button,{value:"default",children:"默认"}),(0,eN.jsx)(Z.Button,{value:"round",children:"圆角"}),(0,eN.jsx)(Z.Button,{value:"circle",children:"圆形"})]})}),(0,eN.jsx)(K.Item,{label:"块级",children:(0,eN.jsx)(er,{size:"small",checked:!!t.block,onChange:e=>n("block",e)})}),(0,eN.jsx)(K.Item,{label:"幽灵",children:(0,eN.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,style:a={},className:i}=e,o=(0,eO.useMemo)(()=>!r.children||Array.isArray(r.children)||"object"!=typeof r.children?null:r.children.extra||[],[r]),[s,d]=(0,eO.useState)(o||[]);return(0,eN.jsxs)(lp,{id:t,style:{...a},className:i,children:[(0,eN.jsxs)("div",{className:"title",children:[(0,eN.jsx)("span",{className:"main",children:l}),n&&(0,eN.jsx)("span",{className:"sub",children:n})]}),(0,eN.jsx)("div",{children:(0,eN.jsx)(tf,{list:s,onListChange:e=>{let t=[...e];r.children.extra=t,d(t)}})})]})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n});return(0,eN.jsxs)(K,{layout:"vertical",children:[(0,eN.jsx)(K.Item,{label:"标题",children:(0,eN.jsx)(J,{size:"small",value:t.title,onChange:e=>n("title",e.target.value),placeholder:"请输入标题"})}),(0,eN.jsx)(K.Item,{label:"副标题",children:(0,eN.jsx)(J,{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,{env:u,initCallback:p}=(0,eO.useContext)(tv),x=!!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]} 条`},m=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",`
|
|
1022
1022
|
"use strict";
|
|
1023
1023
|
const window = undefined;
|
|
1024
1024
|
const document = undefined;
|
|
@@ -1028,7 +1028,7 @@ import*as e from"react";import t,{css as l}from"styled-components";import{AlignC
|
|
|
1028
1028
|
const module = undefined;
|
|
1029
1029
|
const exports = undefined;
|
|
1030
1030
|
${e.customRender}
|
|
1031
|
-
`)(console,Math,Date,Array,Object,String,Number,Boolean,t,l,n):e.render})),h=()=>{console.log("callback table",tz(u,l))};return(0,eO.useEffect)(()=>{p({id:l.id,callback:h})},[]),(0,eN.jsx)(ea,{id:t,dataSource:n,columns:m,pagination:x,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,eO.useState)(!1),[u,x]=(0,eO.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,eN.jsxs)(en,{children:[(0,eN.jsx)("a",{onClick:()=>{x(n),d(!0)},children:(0,eN.jsx)(p,{})}),(0,eN.jsx)("a",{onClick:()=>{let e;(e=[...t.columns||[]]).splice(n,1),i("columns",e)},children:(0,eN.jsx)(c,{})})]})}];return(0,eN.jsxs)("div",{children:[(0,eN.jsxs)(K,{labelCol:{span:12},wrapperCol:{span:12},children:[(0,eN.jsx)(K.Item,{label:"大小",children:(0,eN.jsxs)(Z.Group,{size:"small",value:t.size,onChange:e=>i("size",e.target.value),children:[(0,eN.jsx)(Z.Button,{value:"small",children:"小"}),(0,eN.jsx)(Z.Button,{value:"middle",children:"中"}),(0,eN.jsx)(Z.Button,{value:"large",children:"大"})]})}),(0,eN.jsx)(K.Item,{label:"边框",children:(0,eN.jsx)(er,{size:"small",checked:!!t.bordered,onChange:e=>i("bordered",e)})}),(0,eN.jsx)(K.Item,{label:"显示表头",children:(0,eN.jsx)(er,{size:"small",checked:!!t.showHeader,onChange:e=>i("showHeader",e)})}),(0,eN.jsx)(K.Item,{label:"分页大小",children:(0,eN.jsx)(
|
|
1031
|
+
`)(console,Math,Date,Array,Object,String,Number,Boolean,t,l,n):e.render})),h=()=>{console.log("callback table",tz(u,l))};return(0,eO.useEffect)(()=>{p({id:l.id,callback:h})},[]),(0,eN.jsx)(ea,{id:t,dataSource:n,columns:m,pagination:x,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,eO.useState)(!1),[u,x]=(0,eO.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,eN.jsxs)(en,{children:[(0,eN.jsx)("a",{onClick:()=>{x(n),d(!0)},children:(0,eN.jsx)(p,{})}),(0,eN.jsx)("a",{onClick:()=>{let e;(e=[...t.columns||[]]).splice(n,1),i("columns",e)},children:(0,eN.jsx)(c,{})})]})}];return(0,eN.jsxs)("div",{children:[(0,eN.jsxs)(K,{labelCol:{span:12},wrapperCol:{span:12},children:[(0,eN.jsx)(K.Item,{label:"大小",children:(0,eN.jsxs)(Z.Group,{size:"small",value:t.size,onChange:e=>i("size",e.target.value),children:[(0,eN.jsx)(Z.Button,{value:"small",children:"小"}),(0,eN.jsx)(Z.Button,{value:"middle",children:"中"}),(0,eN.jsx)(Z.Button,{value:"large",children:"大"})]})}),(0,eN.jsx)(K.Item,{label:"边框",children:(0,eN.jsx)(er,{size:"small",checked:!!t.bordered,onChange:e=>i("bordered",e)})}),(0,eN.jsx)(K.Item,{label:"显示表头",children:(0,eN.jsx)(er,{size:"small",checked:!!t.showHeader,onChange:e=>i("showHeader",e)})}),(0,eN.jsx)(K.Item,{label:"分页大小",children:(0,eN.jsx)(U,{size:"small",value:t.pageSize,onChange:e=>i("pageSize",e)})})]}),(0,eN.jsx)(H,{children:"表格列设置"}),(0,eN.jsx)(ea,{size:"small",dataSource:t.columns,rowKey:(e,t)=>String(t),columns:h,pagination:!1,bordered:!0}),(0,eN.jsx)(_,{size:"small",onClick:()=>{i("columns",[...t.columns||[],{title:"",dataIndex:"",width:"",align:"left",ellipsis:!1}])},block:!0,children:"添加列"}),(0,eN.jsx)(q,{title:"编辑列",open:s,footer:null,width:400,onCancel:()=>d(!1),children:(0,eN.jsx)(K,{layout:"vertical",children:(0,eN.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12},children:[(0,eN.jsx)(K.Item,{label:"列名",children:(0,eN.jsx)(J,{value:m.title,onChange:e=>o(u,{title:e.target.value})})}),(0,eN.jsx)(K.Item,{label:"数据索引",children:(0,eN.jsx)(J,{value:m.dataIndex,onChange:e=>o(u,{dataIndex:e.target.value})})}),(0,eN.jsx)(K.Item,{label:"宽度",children:(0,eN.jsx)(J,{value:m.width,onChange:e=>o(u,{width:e.target.value})})}),(0,eN.jsx)(K.Item,{label:"对齐",children:(0,eN.jsxs)(Z.Group,{value:m.align,onChange:e=>o(u,{align:e.target.value}),children:[(0,eN.jsx)(Z.Button,{value:"left",children:(0,eN.jsx)(r,{})}),(0,eN.jsx)(Z.Button,{value:"center",children:(0,eN.jsx)(n,{})}),(0,eN.jsx)(Z.Button,{value:"right",children:(0,eN.jsx)(a,{})})]})}),(0,eN.jsx)(K.Item,{label:"省略",children:(0,eN.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,{env:c,initCallback:u}=(0,eO.useContext)(tv),p=lx(t,i.datasource)||[],x=(0,eO.useMemo)(()=>!!l&&!(l<=p.length)&&{total:p.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,p.length,r]),m=["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],h=()=>{console.log("callback list",tz(c,i))};return(0,eO.useEffect)(()=>{u({id:i.id,callback:h})},[]),(0,eN.jsxs)("div",{id:t,style:{display:"flex",flexDirection:"column",...s},className:m.filter(Boolean).join(" "),children:[(0,eN.jsx)(lw,{list:p,split:o,bordered:n,size:r,itemLayout:a}),x&&(0,eN.jsx)(X,{...x})]})},formComponent:e=>{let{model:t,onChange:l}=e,[n]=K.useForm();return(0,eO.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,eN.jsxs)(K,{form:n,labelCol:{span:12},wrapperCol:{span:12},onValuesChange:e=>{null==l||l({...t,...e})},children:[(0,eN.jsx)(K.Item,{label:"大小",name:"size",children:(0,eN.jsxs)(Z.Group,{size:"small",buttonStyle:"solid",children:[(0,eN.jsx)(Z.Button,{value:"default",children:"默认"}),(0,eN.jsx)(Z.Button,{value:"small",children:"小"})]})}),(0,eN.jsx)(K.Item,{label:"布局",name:"itemLayout",children:(0,eN.jsxs)(Z.Group,{size:"small",buttonStyle:"solid",children:[(0,eN.jsx)(Z.Button,{value:"horizontal",children:"水平"}),(0,eN.jsx)(Z.Button,{value:"vertical",children:"垂直"})]})}),(0,eN.jsx)(K.Item,{label:"边框",name:"bordered",valuePropName:"checked",children:(0,eN.jsx)(er,{size:"small"})}),(0,eN.jsx)(K.Item,{label:"分割线",name:"split",valuePropName:"checked",children:(0,eN.jsx)(er,{size:"small"})}),(0,eN.jsx)(K.Item,{label:"分页大小",name:"pageSize",children:(0,eN.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,{env:o,initCallback:s}=(0,eO.useContext)(tv),d=lx(t,n.datasource),c=(0,eO.useMemo)(()=>Object.keys(d||{}),[d]),u=(0,eO.useMemo)(()=>c.map(e=>null==d?void 0:d[e]),[c,d]),p=(0,eO.useMemo)(()=>(l||"").replace(/{ *{\s*([^}]+)\s*} *}/g,(e,t)=>{try{return Function(...c,`
|
|
1032
1032
|
"use strict";
|
|
1033
1033
|
const window = undefined;
|
|
1034
1034
|
const document = undefined;
|
|
@@ -1048,10 +1048,10 @@ import*as e from"react";import t,{css as l}from"styled-components";import{AlignC
|
|
|
1048
1048
|
const module = undefined;
|
|
1049
1049
|
const exports = undefined;
|
|
1050
1050
|
${e}
|
|
1051
|
-
`)(eg,console,Math,Date,Array,Object,String,Number,Boolean,p)}catch(e){return console.error("ECharts 配置解析失败:",e),null}}})(l);c&&e&&(c.setOption(e),setTimeout(()=>c.resize(),50))},[c,l]),(0,eN.jsx)("div",{id:t,style:{width:"100%",height:r,...a},className:i,children:(0,eN.jsx)("div",{ref:d,style:{width:"100%",height:r,...a}})})},formComponent:e=>{let{model:t,onChange:l}=e,n=(0,eO.useRef)(null);return(0,eN.jsx)(K,{
|
|
1051
|
+
`)(eg,console,Math,Date,Array,Object,String,Number,Boolean,p)}catch(e){return console.error("ECharts 配置解析失败:",e),null}}})(l);c&&e&&(c.setOption(e),setTimeout(()=>c.resize(),50))},[c,l]),(0,eN.jsx)("div",{id:t,style:{width:"100%",height:r,...a},className:i,children:(0,eN.jsx)("div",{ref:d,style:{width:"100%",height:r,...a}})})},formComponent:e=>{let{model:t,onChange:l}=e,n=(0,eO.useRef)(null);return(0,eN.jsxs)(K,{children:[(0,eN.jsx)(K.Item,{name:"height",label:"高度",labelCol:{span:6},wrapperCol:{span:18},children:(0,eN.jsx)(U,{value:t.height,size:"small",min:10,max:1e3,suffix:"px",onChange:e=>l&&l({...t,height:e})})}),(0,eN.jsx)(K.Item,{layout:"vertical",label:(0,eN.jsxs)(eN.Fragment,{children:["Echarts 渲染脚本"," ",(0,eN.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,eN.jsx)(tS,{type:"icon-formate"})," 格式化"]})]}),className:"ant-form-item-label-space",children:(0,eN.jsxs)("div",{style:{border:"1px solid #d9d9d9",borderRadius:4,textAlign:"left"},children:[(0,eN.jsxs)("div",{style:{color:"#0000ff",fontSize:14,padding:"0 50px"},children:["function getOptions(data) ","{"," "]}),(0,eN.jsx)(em,{onMount:e=>{n.current={editor:e}},height:"400px",defaultLanguage:"javascript",value:t.script,onChange:e=>{let n;return n=e||"",l&&l({...t,script:n||""})},options:{minimap:{enabled:!1},scrollBeyondLastLine:!1,tabSize:2}}),(0,eN.jsx)("div",{style:{color:"#0000ff",fontSize:14,padding:"0 50px"},children:"}"})]})})]})},defaultOptions:{datasource:{source:"custom",datasourceId:null,scriptId:null,custom:'[{"name":"Mon","value":150},{"name":"Tue","value":230},{"name":"Wed","value":224},{"name":"Thu","value":218},{"name":"Fri","value":135},{"name":"Sat","value":147},{"name":"Sun","value":260}]'},props:{script:`
|
|
1052
1052
|
return {
|
|
1053
1053
|
xAxis: { type: 'category', data: data.map(i => i.name) },
|
|
1054
1054
|
yAxis: { type: 'value' },
|
|
1055
1055
|
series: [{ data: data.map(i => i.value), type: 'line' }]
|
|
1056
1056
|
}
|
|
1057
|
-
`}}},{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,{env:h,callbacks:f}=(0,eO.useContext)(tv),g=e=>{u&&u(e),h&&d&&l&&tk(h,d,l,e)};return s?(0,eN.jsx)(U.Search,{id:t,value:c,size:i,allowClear:o,placeholder:n,onChange:e=>g(e.target.value),onSearch:()=>{p&&p(c||""),h&&d&&f&&tI(h,d,f)},style:{...x},className:m}):(0,eN.jsx)(U,{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,eN.jsxs)(K,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,eN.jsx)(K.Item,{label:"搜索框",children:(0,eN.jsx)(er,{size:"small",checked:!!t.search,onChange:e=>n("search",e)})}),(0,eN.jsx)(K.Item,{label:"变量名",children:(0,eN.jsx)(U,{size:"small",value:t.var,onChange:e=>n("var",e.target.value),placeholder:"请输入变量名"})}),(0,eN.jsx)(K.Item,{label:"占位符",children:(0,eN.jsx)(U,{size:"small",value:t.placeholder,onChange:e=>n("placeholder",e.target.value),placeholder:"请输入占位符"})}),!t.search&&(0,eN.jsxs)(eN.Fragment,{children:[(0,eN.jsx)(K.Item,{label:"前缀",children:(0,eN.jsx)(U,{size:"small",value:t.prefix,onChange:e=>n("prefix",e.target.value),placeholder:"请输入前缀"})}),(0,eN.jsx)(K.Item,{label:"后缀",children:(0,eN.jsx)(U,{size:"small",value:t.suffix,onChange:e=>n("suffix",e.target.value),placeholder:"请输入后缀"})})]}),(0,eN.jsx)(K.Item,{label:"大小",children:(0,eN.jsxs)(Z.Group,{size:"small",value:t.size,onChange:e=>n("size",e.target.value),children:[(0,eN.jsx)(Z.Button,{value:"small",children:"小"}),(0,eN.jsx)(Z.Button,{value:"middle",children:"中"}),(0,eN.jsx)(Z.Button,{value:"large",children:"大"})]})}),(0,eN.jsx)(K.Item,{label:"清除图标",children:(0,eN.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,{env:m,callbacks:h}=(0,eO.useContext)(tv);return(0,eN.jsx)(J,{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),m&&c&&l&&tk(m,c,l,t),m&&c&&h&&tI(m,c,h))},style:{width:"100%",...p},className:x})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n});return(0,eN.jsxs)(K,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,eN.jsx)(K.Item,{label:"变量名",children:(0,eN.jsx)(U,{size:"small",value:t.var,onChange:e=>n("var",e.target.value)})}),(0,eN.jsx)(K.Item,{label:"最小值",children:(0,eN.jsx)(J,{size:"small",value:t.min,onChange:e=>n("min",e)})}),(0,eN.jsx)(K.Item,{label:"最大值",children:(0,eN.jsx)(J,{size:"small",value:t.max,onChange:e=>n("max",e)})}),(0,eN.jsx)(K.Item,{label:"步长",children:(0,eN.jsx)(J,{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,{env:x,callbacks:m}=(0,eO.useContext)(tv);return(0,eN.jsx)(et,{id:t,value:d,size:n,placeholder:r,allowClear:a,mode:i?"multiple":void 0,options:o,onChange:e=>{c&&c(e),x&&s&&l&&tk(x,s,l,e),x&&s&&m&&tI(x,s,m)},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,eN.jsx)(U,{size:"small",value:t.label,onChange:e=>r(l,"label",e.target.value)})},{title:"选项值",dataIndex:"value",render:(e,t,l)=>(0,eN.jsx)(U,{size:"small",value:t.value,onChange:e=>r(l,"value",e.target.value)})},{title:"操作",render:(e,l,r)=>(0,eN.jsx)(en,{children:(0,eN.jsx)(_,{danger:!0,size:"small",onClick:()=>{let e;(e=[...t.options||[]]).splice(r,1),n("options",e)},children:(0,eN.jsx)(c,{})})})}];return(0,eN.jsxs)(K,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,eN.jsx)(K.Item,{label:"变量名",children:(0,eN.jsx)(U,{size:"small",value:t.var,onChange:e=>n("var",e.target.value),placeholder:"请输入变量名"})}),(0,eN.jsx)(K.Item,{label:"占位符",children:(0,eN.jsx)(U,{size:"small",value:t.placeholder,onChange:e=>n("placeholder",e.target.value),placeholder:"请输入占位符"})}),(0,eN.jsx)(K.Item,{label:"大小",children:(0,eN.jsxs)(Z.Group,{size:"small",value:t.size,onChange:e=>n("size",e.target.value),children:[(0,eN.jsx)(Z.Button,{value:"small",children:"小"}),(0,eN.jsx)(Z.Button,{value:"middle",children:"中"}),(0,eN.jsx)(Z.Button,{value:"large",children:"大"})]})}),(0,eN.jsx)(K.Item,{label:"清除图标",children:(0,eN.jsx)(er,{size:"small",checked:!!t.allowClear,onChange:e=>n("allowClear",e)})}),(0,eN.jsx)(K.Item,{label:"多选",children:(0,eN.jsx)(er,{size:"small",checked:!!t.multiple,onChange:e=>n("multiple",e)})}),(0,eN.jsxs)(K.Item,{labelCol:{span:24},wrapperCol:{span:24},children:[(0,eN.jsx)(ea,{size:"small",dataSource:t.options,columns:a,pagination:!1,rowKey:(e,t)=>String(t),bordered:!0}),(0,eN.jsx)(_,{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,{env:d,callbacks:c}=(0,eO.useContext)(tv);return(0,eN.jsx)("span",{id:t,children:(0,eN.jsx)(Z.Group,{id:t,size:n,buttonStyle:"solid",onChange:e=>{var t;return t=e.target.value,void(i&&i(t),d&&a&&l&&tk(d,a,l,t),d&&a&&c&&tI(d,a,c))},style:o,className:s,children:r.map(e=>(0,eN.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,eN.jsx)(U,{size:"small",value:t.label,onChange:e=>r(l,"label",e.target.value)})},{title:"选项值",dataIndex:"value",render:(e,t,l)=>(0,eN.jsx)(U,{size:"small",value:t.value,onChange:e=>r(l,"value",e.target.value)})},{title:"操作",render:(e,l,r)=>(0,eN.jsx)(en,{children:(0,eN.jsx)(_,{danger:!0,size:"small",onClick:()=>{let e;(e=[...t.options||[]]).splice(r,1),n("options",e)},children:(0,eN.jsx)(c,{})})})}];return(0,eN.jsxs)(K,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,eN.jsx)(K.Item,{label:"变量名",children:(0,eN.jsx)(U,{size:"small",value:t.var,onChange:e=>n("var",e.target.value),placeholder:"请输入变量名"})}),(0,eN.jsx)(K.Item,{label:"大小",children:(0,eN.jsxs)(Z.Group,{size:"small",value:t.size,onChange:e=>n("size",e.target.value),children:[(0,eN.jsx)(Z.Button,{value:"small",children:"小"}),(0,eN.jsx)(Z.Button,{value:"middle",children:"中"}),(0,eN.jsx)(Z.Button,{value:"large",children:"大"})]})}),(0,eN.jsxs)(K.Item,{labelCol:{span:24},wrapperCol:{span:24},children:[(0,eN.jsx)(ea,{size:"small",dataSource:t.options,columns:a,pagination:!1,rowKey:(e,t)=>String(t),bordered:!0}),(0,eN.jsx)(_,{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,{env:c,callbacks:u}=(0,eO.useContext)(tv),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,eN.jsx)("span",{id:t,children:(0,eN.jsx)(P.Group,{onChange:e=>{o&&o(e),c&&i&&l&&tk(c,i,l,e),c&&i&&u&&tI(c,i,u)},style:p,className:d,children:a.map(e=>(0,eN.jsx)(P,{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,eN.jsx)(U,{size:"small",value:t.label,onChange:e=>r(l,"label",e.target.value)})},{title:"选项值",dataIndex:"value",render:(e,t,l)=>(0,eN.jsx)(U,{size:"small",value:t.value,onChange:e=>r(l,"value",e.target.value)})},{title:"操作",render:(e,l,r)=>(0,eN.jsx)(en,{children:(0,eN.jsx)(_,{danger:!0,size:"small",onClick:()=>{let e;(e=[...t.options||[]]).splice(r,1),n("options",e)},children:(0,eN.jsx)(c,{})})})}];return(0,eN.jsxs)(K,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,eN.jsx)(K.Item,{label:"变量名",children:(0,eN.jsx)(U,{size:"small",value:t.var,onChange:e=>n("var",e.target.value),placeholder:"请输入变量名"})}),(0,eN.jsx)(K.Item,{label:"布局",children:(0,eN.jsxs)(Z.Group,{size:"small",value:t.layout,onChange:e=>n("layout",e.target.value),children:[(0,eN.jsx)(Z.Button,{value:"horizontal",children:"水平"}),(0,eN.jsx)(Z.Button,{value:"vertical",children:"垂直"}),(0,eN.jsx)(Z.Button,{value:"grid",children:"网格"})]})}),"grid"===t.layout&&(0,eN.jsx)(K.Item,{label:"网格行数",children:(0,eN.jsx)(J,{size:"small",value:t.lineNumber,onChange:e=>n("lineNumber",e),min:1,max:10})}),(0,eN.jsxs)(K.Item,{labelCol:{span:24},wrapperCol:{span:24},children:[(0,eN.jsx)(ea,{size:"small",dataSource:t.options,columns:a,pagination:!1,rowKey:(e,t)=>String(t),bordered:!0}),(0,eN.jsx)(_,{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,{env:p,callbacks:x}=(0,eO.useContext)(tv),m=e=>{d&&d(e),p&&s&&l&&tk(p,s,l,e),p&&s&&x&&tI(p,s,x)};if("time"===a){let e="string"==typeof o&&o?ef(o,"HH:mm"):void 0;return(0,eN.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?ef(o,e):void 0;return(0,eN.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]?ef(o[0],e):void 0,a=Array.isArray(o)&&o[1]?ef(o[1],e):void 0;return(0,eN.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?ef(o,h):void 0;return(0,eN.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,eN.jsxs)(K,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,eN.jsx)(K.Item,{label:"变量名",children:(0,eN.jsx)(U,{size:"small",value:t.var,onChange:e=>n("var",e.target.value),placeholder:"请输入变量名"})}),(0,eN.jsx)(K.Item,{label:"类型",children:(0,eN.jsxs)(Z.Group,{size:"small",value:t.type,onChange:e=>n("type",e.target.value),children:[(0,eN.jsx)(Z.Button,{value:"date",children:"日期"}),(0,eN.jsx)(Z.Button,{value:"time",children:"时间"}),(0,eN.jsx)(Z.Button,{value:"month",children:"月份"}),(0,eN.jsx)(Z.Button,{value:"year",children:"年份"}),(0,eN.jsx)(Z.Button,{value:"range",children:"日期范围"})]})}),(0,eN.jsx)(K.Item,{label:"大小",children:(0,eN.jsxs)(Z.Group,{size:"small",value:t.size,onChange:e=>n("size",e.target.value),children:[(0,eN.jsx)(Z.Button,{value:"small",children:"小"}),(0,eN.jsx)(Z.Button,{value:"middle",children:"中"}),(0,eN.jsx)(Z.Button,{value:"large",children:"大"})]})}),(0,eN.jsx)(K.Item,{label:"清除图标",children:(0,eN.jsx)(er,{size:"small",checked:!!t.allowClear,onChange:e=>n("allowClear",e)})}),(0,eN.jsx)(K.Item,{label:"显示时间",children:(0,eN.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,{env:p,callbacks:x}=(0,eO.useContext)(tv);return(0,eN.jsx)("span",{children:(0,eN.jsx)(er,{id:t,checked:n,disabled:r,size:"small"===a?"small":void 0,checkedChildren:i,unCheckedChildren:o,onChange:e=>{d&&d(e),p&&s&&l&&tk(p,s,l,e),p&&s&&x&&tI(p,s,x)},style:c,className:u})})},formComponent:e=>{let{model:t,onChange:l}=e;return(0,eN.jsx)(K,{labelCol:{span:6},wrapperCol:{span:18},children:(0,eN.jsx)(K.Item,{label:"变量名",children:(0,eN.jsx)(U,{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,style:i={},className:o}=e,{designable:s}=(0,eO.useContext)(tu),[d,c]=(0,eO.useState)(a.children||[]),u=(0,eO.useMemo)(()=>({...i,...a.style||{},alignItems:l,flexDirection:r,gap:n}),[a,l,n,r]);return(0,eN.jsx)(tf,{rootComponent:en,rootData:{id:t,style:u,className:o},list:d,item:a,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,eN.jsxs)(K,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,eN.jsx)(K.Item,{label:"方向",children:(0,eN.jsxs)(Z.Group,{size:"small",value:t.direction,onChange:e=>n("direction",e.target.value),children:[(0,eN.jsx)(Z.Button,{value:"horizontal",children:"水平"}),(0,eN.jsx)(Z.Button,{value:"vertical",children:"垂直"})]})}),(0,eN.jsx)(K.Item,{label:"大小",children:(0,eN.jsxs)(Z.Group,{size:"small",value:t.size,onChange:e=>n("size",e.target.value),children:[(0,eN.jsx)(Z.Button,{value:"small",children:"小"}),(0,eN.jsx)(Z.Button,{value:"middle",children:"中"}),(0,eN.jsx)(Z.Button,{value:"large",children:"大"})]})}),(0,eN.jsx)(K.Item,{label:"对齐",children:(0,eN.jsxs)(Z.Group,{size:"small",value:t.align,onChange:e=>n("align",e.target.value),children:[(0,eN.jsx)(Z.Button,{value:"start",children:"开始"}),(0,eN.jsx)(Z.Button,{value:"end",children:"结束"}),(0,eN.jsx)(Z.Button,{value:"center",children:"居中"}),(0,eN.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,style:s,className:d}=e,c=(0,eO.useMemo)(()=>!o.children||Array.isArray(o.children)||"object"!=typeof o.children?null:o.children.title||[],[o]),[u,p]=(0,eO.useState)(c||[]),x=(0,eO.useMemo)(()=>!o.children||Array.isArray(o.children)||"object"!=typeof o.children?null:o.children.extra||[],[o]),[m,h]=(0,eO.useState)(x||[]),f=(0,eO.useMemo)(()=>o.children?Array.isArray(o.children)?o.children:"object"!=typeof o.children?null:o.children.body||[]:null,[o]),[g,v]=(0,eO.useState)(f||[]),j=(0,eO.useMemo)(()=>!o.children||Array.isArray(o.children)||"object"!=typeof o.children?null:o.children.actions||[],[o]),[y,b]=(0,eO.useState)(j||[]);return(0,eN.jsx)(M,{id:t,variant:l?"outlined":"borderless",size:n,hoverable:a,className:[i?"ant-card-shadow":void 0,d].filter(Boolean).join(" "),title:(null==r?void 0:r.length)&&!(null==c?void 0:c.length)?r:c?(0,eN.jsx)(tf,{list:u,onListChange:e=>{o.children.title=e,p(e)}}):r,extra:x&&(0,eN.jsx)(tf,{list:m,onListChange:e=>{o.children.extra=e,h(e)}}),actions:j&&[(0,eN.jsx)(tf,{list:y,onListChange:e=>{o.children.actions=e,b(e)}})],styles:{header:{borderBottom:"none"}},style:s,children:f&&(0,eN.jsx)(tf,{list:g,onListChange:e=>{Array.isArray(o.children)?o.children=e:o.children.body=e,v(e)}})})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n});return(0,eN.jsxs)(K,{labelCol:{span:12},wrapperCol:{span:12},children:[(0,eN.jsx)(K.Item,{label:"标题",children:(0,eN.jsx)(U,{size:"small",value:t.title,onChange:e=>n("title",e.target.value)})}),(0,eN.jsx)(K.Item,{label:"边框",children:(0,eN.jsx)(er,{size:"small",checked:!!t.bordered,onChange:e=>n("bordered",e)})}),(0,eN.jsx)(K.Item,{label:"悬停效果",children:(0,eN.jsx)(er,{size:"small",checked:!!t.hoverable,onChange:e=>n("hoverable",e)})}),(0,eN.jsx)(K.Item,{label:"阴影",children:(0,eN.jsx)(er,{size:"small",checked:!!t.shadow,onChange:e=>n("shadow",e)})}),(0,eN.jsx)(K.Item,{label:"大小",children:(0,eN.jsxs)(Z.Group,{size:"small",value:t.size,onChange:e=>n("size",e.target.value),children:[(0,eN.jsx)(Z.Button,{value:"default",children:"默认"}),(0,eN.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,style:r,className:a}=e,{designable:i}=(0,eO.useContext)(tu),[o,s]=(0,eO.useState)(n.children||[]);return(0,eN.jsx)(tf,{rootComponent:ee,rootData:{id:t,gutter:l,style:n.style||r,className:n.className||a},list:o,item:n,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,eN.jsxs)(K,{labelCol:{span:12},wrapperCol:{span:12},children:[(0,eN.jsx)(K.Item,{label:"列间距",children:(0,eN.jsx)(J,{size:"small",value:r[0],min:0,step:4,onChange:e=>n("gutter",[e||0,r[1]])})}),(0,eN.jsx)(K.Item,{label:"行间距",children:(0,eN.jsx)(J,{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,style:c={},className:u}=e,{designable:p}=(0,eO.useContext)(tu),{deviceWidth:x}=(0,eO.useContext)(tv),[m,h]=(0,eO.useState)(d.children||[]),f=(0,eO.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,eN.jsx)(tf,{rootComponent:$,rootData:{id:t||d.id,span:f,style:{...d.style||{},...c},className:u},list:m,item:d,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,eN.jsxs)(K,{labelCol:{span:12},wrapperCol:{span:12},children:[(0,eN.jsx)(K.Item,{label:"默认列数",children:(0,eN.jsx)(J,{size:"small",value:t.span,min:0,max:24,step:4,onChange:e=>n("span",e||0)})}),(0,eN.jsx)(K.Item,{label:(0,eN.jsxs)(eN.Fragment,{children:["xs"," ",(0,eN.jsx)(es,{title:"<576px 响应式栅格",children:(0,eN.jsx)(lu,{})})]}),children:(0,eN.jsx)(J,{size:"small",value:t.xs,min:0,max:24,step:4,onChange:e=>n("xs",e||0)})}),(0,eN.jsx)(K.Item,{label:(0,eN.jsxs)(eN.Fragment,{children:["sm"," ",(0,eN.jsx)(es,{title:"≥576px 响应式栅格",children:(0,eN.jsx)(lu,{})})]}),children:(0,eN.jsx)(J,{size:"small",value:t.sm,min:0,max:24,step:4,onChange:e=>n("sm",e||0)})}),(0,eN.jsx)(K.Item,{label:(0,eN.jsxs)(eN.Fragment,{children:["md"," ",(0,eN.jsx)(es,{title:"≥768px 响应式栅格",children:(0,eN.jsx)(lu,{})})]}),children:(0,eN.jsx)(J,{size:"small",value:t.md,min:0,max:24,step:4,onChange:e=>n("md",e||0)})}),(0,eN.jsx)(K.Item,{label:(0,eN.jsxs)(eN.Fragment,{children:["lg"," ",(0,eN.jsx)(es,{title:"≥992px 响应式栅格",children:(0,eN.jsx)(lu,{})})]}),children:(0,eN.jsx)(J,{size:"small",value:t.lg,min:0,max:24,step:4,onChange:e=>n("lg",e||0)})}),(0,eN.jsx)(K.Item,{label:(0,eN.jsxs)(eN.Fragment,{children:["xl"," ",(0,eN.jsx)(es,{title:"≥1200px 响应式栅格",children:(0,eN.jsx)(lu,{})})]}),children:(0,eN.jsx)(J,{size:"small",value:t.xl,min:0,max:24,step:4,onChange:e=>n("xl",e||0)})}),(0,eN.jsx)(K.Item,{label:(0,eN.jsxs)(eN.Fragment,{children:["xxl"," ",(0,eN.jsx)(es,{title:"≥1600px 响应式栅格",children:(0,eN.jsx)(lu,{})})]}),children:(0,eN.jsx)(J,{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 ew=eb.ru,eC=eb.R3,eS=eb.Ei,ez=eb.NQ,ek=eb.B7,eI=eb.Ts,eN=eb.V2,eO=eb.QE,eT=eb.NG,eE=eb.Wg,eD=eb.Nx;export{ew as DropContainer,eC as EnvContext,eS as PageCanvas,ez as PageContext,ek as PageDesigner,eI as PageProvider,eN as PageSchema,eO as PluginType,eT as PropEditorProps,eE as handleCallback,eD as plugins};
|
|
1057
|
+
`}}},{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,{env:h,callbacks:f}=(0,eO.useContext)(tv),g=e=>{u&&u(e),h&&d&&l&&tk(h,d,l,e)};return s?(0,eN.jsx)(J.Search,{id:t,value:c,size:i,allowClear:o,placeholder:n,onChange:e=>g(e.target.value),onSearch:()=>{p&&p(c||""),h&&d&&f&&tI(h,d,f)},style:{...x},className:m}):(0,eN.jsx)(J,{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,eN.jsxs)(K,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,eN.jsx)(K.Item,{label:"搜索框",children:(0,eN.jsx)(er,{size:"small",checked:!!t.search,onChange:e=>n("search",e)})}),(0,eN.jsx)(K.Item,{label:"变量名",children:(0,eN.jsx)(J,{size:"small",value:t.var,onChange:e=>n("var",e.target.value),placeholder:"请输入变量名"})}),(0,eN.jsx)(K.Item,{label:"占位符",children:(0,eN.jsx)(J,{size:"small",value:t.placeholder,onChange:e=>n("placeholder",e.target.value),placeholder:"请输入占位符"})}),!t.search&&(0,eN.jsxs)(eN.Fragment,{children:[(0,eN.jsx)(K.Item,{label:"前缀",children:(0,eN.jsx)(J,{size:"small",value:t.prefix,onChange:e=>n("prefix",e.target.value),placeholder:"请输入前缀"})}),(0,eN.jsx)(K.Item,{label:"后缀",children:(0,eN.jsx)(J,{size:"small",value:t.suffix,onChange:e=>n("suffix",e.target.value),placeholder:"请输入后缀"})})]}),(0,eN.jsx)(K.Item,{label:"大小",children:(0,eN.jsxs)(Z.Group,{size:"small",value:t.size,onChange:e=>n("size",e.target.value),children:[(0,eN.jsx)(Z.Button,{value:"small",children:"小"}),(0,eN.jsx)(Z.Button,{value:"middle",children:"中"}),(0,eN.jsx)(Z.Button,{value:"large",children:"大"})]})}),(0,eN.jsx)(K.Item,{label:"清除图标",children:(0,eN.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,{env:m,callbacks:h}=(0,eO.useContext)(tv);return(0,eN.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),m&&c&&l&&tk(m,c,l,t),m&&c&&h&&tI(m,c,h))},style:{width:"100%",...p},className:x})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n});return(0,eN.jsxs)(K,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,eN.jsx)(K.Item,{label:"变量名",children:(0,eN.jsx)(J,{size:"small",value:t.var,onChange:e=>n("var",e.target.value)})}),(0,eN.jsx)(K.Item,{label:"最小值",children:(0,eN.jsx)(U,{size:"small",value:t.min,onChange:e=>n("min",e)})}),(0,eN.jsx)(K.Item,{label:"最大值",children:(0,eN.jsx)(U,{size:"small",value:t.max,onChange:e=>n("max",e)})}),(0,eN.jsx)(K.Item,{label:"步长",children:(0,eN.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,{env:x,callbacks:m}=(0,eO.useContext)(tv);return(0,eN.jsx)(et,{id:t,value:d,size:n,placeholder:r,allowClear:a,mode:i?"multiple":void 0,options:o,onChange:e=>{c&&c(e),x&&s&&l&&tk(x,s,l,e),x&&s&&m&&tI(x,s,m)},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,eN.jsx)(J,{size:"small",value:t.label,onChange:e=>r(l,"label",e.target.value)})},{title:"选项值",dataIndex:"value",render:(e,t,l)=>(0,eN.jsx)(J,{size:"small",value:t.value,onChange:e=>r(l,"value",e.target.value)})},{title:"操作",render:(e,l,r)=>(0,eN.jsx)(en,{children:(0,eN.jsx)(_,{danger:!0,size:"small",onClick:()=>{let e;(e=[...t.options||[]]).splice(r,1),n("options",e)},children:(0,eN.jsx)(c,{})})})}];return(0,eN.jsxs)(K,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,eN.jsx)(K.Item,{label:"变量名",children:(0,eN.jsx)(J,{size:"small",value:t.var,onChange:e=>n("var",e.target.value),placeholder:"请输入变量名"})}),(0,eN.jsx)(K.Item,{label:"占位符",children:(0,eN.jsx)(J,{size:"small",value:t.placeholder,onChange:e=>n("placeholder",e.target.value),placeholder:"请输入占位符"})}),(0,eN.jsx)(K.Item,{label:"大小",children:(0,eN.jsxs)(Z.Group,{size:"small",value:t.size,onChange:e=>n("size",e.target.value),children:[(0,eN.jsx)(Z.Button,{value:"small",children:"小"}),(0,eN.jsx)(Z.Button,{value:"middle",children:"中"}),(0,eN.jsx)(Z.Button,{value:"large",children:"大"})]})}),(0,eN.jsx)(K.Item,{label:"清除图标",children:(0,eN.jsx)(er,{size:"small",checked:!!t.allowClear,onChange:e=>n("allowClear",e)})}),(0,eN.jsx)(K.Item,{label:"多选",children:(0,eN.jsx)(er,{size:"small",checked:!!t.multiple,onChange:e=>n("multiple",e)})}),(0,eN.jsxs)(K.Item,{labelCol:{span:24},wrapperCol:{span:24},children:[(0,eN.jsx)(ea,{size:"small",dataSource:t.options,columns:a,pagination:!1,rowKey:(e,t)=>String(t),bordered:!0}),(0,eN.jsx)(_,{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,{env:d,callbacks:c}=(0,eO.useContext)(tv);return(0,eN.jsx)("span",{id:t,children:(0,eN.jsx)(Z.Group,{id:t,size:n,buttonStyle:"solid",onChange:e=>{var t;return t=e.target.value,void(i&&i(t),d&&a&&l&&tk(d,a,l,t),d&&a&&c&&tI(d,a,c))},style:o,className:s,children:r.map(e=>(0,eN.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,eN.jsx)(J,{size:"small",value:t.label,onChange:e=>r(l,"label",e.target.value)})},{title:"选项值",dataIndex:"value",render:(e,t,l)=>(0,eN.jsx)(J,{size:"small",value:t.value,onChange:e=>r(l,"value",e.target.value)})},{title:"操作",render:(e,l,r)=>(0,eN.jsx)(en,{children:(0,eN.jsx)(_,{danger:!0,size:"small",onClick:()=>{let e;(e=[...t.options||[]]).splice(r,1),n("options",e)},children:(0,eN.jsx)(c,{})})})}];return(0,eN.jsxs)(K,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,eN.jsx)(K.Item,{label:"变量名",children:(0,eN.jsx)(J,{size:"small",value:t.var,onChange:e=>n("var",e.target.value),placeholder:"请输入变量名"})}),(0,eN.jsx)(K.Item,{label:"大小",children:(0,eN.jsxs)(Z.Group,{size:"small",value:t.size,onChange:e=>n("size",e.target.value),children:[(0,eN.jsx)(Z.Button,{value:"small",children:"小"}),(0,eN.jsx)(Z.Button,{value:"middle",children:"中"}),(0,eN.jsx)(Z.Button,{value:"large",children:"大"})]})}),(0,eN.jsxs)(K.Item,{labelCol:{span:24},wrapperCol:{span:24},children:[(0,eN.jsx)(ea,{size:"small",dataSource:t.options,columns:a,pagination:!1,rowKey:(e,t)=>String(t),bordered:!0}),(0,eN.jsx)(_,{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,{env:c,callbacks:u}=(0,eO.useContext)(tv),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,eN.jsx)("span",{id:t,children:(0,eN.jsx)(P.Group,{onChange:e=>{o&&o(e),c&&i&&l&&tk(c,i,l,e),c&&i&&u&&tI(c,i,u)},style:p,className:d,children:a.map(e=>(0,eN.jsx)(P,{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,eN.jsx)(J,{size:"small",value:t.label,onChange:e=>r(l,"label",e.target.value)})},{title:"选项值",dataIndex:"value",render:(e,t,l)=>(0,eN.jsx)(J,{size:"small",value:t.value,onChange:e=>r(l,"value",e.target.value)})},{title:"操作",render:(e,l,r)=>(0,eN.jsx)(en,{children:(0,eN.jsx)(_,{danger:!0,size:"small",onClick:()=>{let e;(e=[...t.options||[]]).splice(r,1),n("options",e)},children:(0,eN.jsx)(c,{})})})}];return(0,eN.jsxs)(K,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,eN.jsx)(K.Item,{label:"变量名",children:(0,eN.jsx)(J,{size:"small",value:t.var,onChange:e=>n("var",e.target.value),placeholder:"请输入变量名"})}),(0,eN.jsx)(K.Item,{label:"布局",children:(0,eN.jsxs)(Z.Group,{size:"small",value:t.layout,onChange:e=>n("layout",e.target.value),children:[(0,eN.jsx)(Z.Button,{value:"horizontal",children:"水平"}),(0,eN.jsx)(Z.Button,{value:"vertical",children:"垂直"}),(0,eN.jsx)(Z.Button,{value:"grid",children:"网格"})]})}),"grid"===t.layout&&(0,eN.jsx)(K.Item,{label:"网格行数",children:(0,eN.jsx)(U,{size:"small",value:t.lineNumber,onChange:e=>n("lineNumber",e),min:1,max:10})}),(0,eN.jsxs)(K.Item,{labelCol:{span:24},wrapperCol:{span:24},children:[(0,eN.jsx)(ea,{size:"small",dataSource:t.options,columns:a,pagination:!1,rowKey:(e,t)=>String(t),bordered:!0}),(0,eN.jsx)(_,{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,{env:p,callbacks:x}=(0,eO.useContext)(tv),m=e=>{d&&d(e),p&&s&&l&&tk(p,s,l,e),p&&s&&x&&tI(p,s,x)};if("time"===a){let e="string"==typeof o&&o?ef(o,"HH:mm"):void 0;return(0,eN.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?ef(o,e):void 0;return(0,eN.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]?ef(o[0],e):void 0,a=Array.isArray(o)&&o[1]?ef(o[1],e):void 0;return(0,eN.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?ef(o,h):void 0;return(0,eN.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,eN.jsxs)(K,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,eN.jsx)(K.Item,{label:"变量名",children:(0,eN.jsx)(J,{size:"small",value:t.var,onChange:e=>n("var",e.target.value),placeholder:"请输入变量名"})}),(0,eN.jsx)(K.Item,{label:"类型",children:(0,eN.jsxs)(Z.Group,{size:"small",value:t.type,onChange:e=>n("type",e.target.value),children:[(0,eN.jsx)(Z.Button,{value:"date",children:"日期"}),(0,eN.jsx)(Z.Button,{value:"time",children:"时间"}),(0,eN.jsx)(Z.Button,{value:"month",children:"月份"}),(0,eN.jsx)(Z.Button,{value:"year",children:"年份"}),(0,eN.jsx)(Z.Button,{value:"range",children:"日期范围"})]})}),(0,eN.jsx)(K.Item,{label:"大小",children:(0,eN.jsxs)(Z.Group,{size:"small",value:t.size,onChange:e=>n("size",e.target.value),children:[(0,eN.jsx)(Z.Button,{value:"small",children:"小"}),(0,eN.jsx)(Z.Button,{value:"middle",children:"中"}),(0,eN.jsx)(Z.Button,{value:"large",children:"大"})]})}),(0,eN.jsx)(K.Item,{label:"清除图标",children:(0,eN.jsx)(er,{size:"small",checked:!!t.allowClear,onChange:e=>n("allowClear",e)})}),(0,eN.jsx)(K.Item,{label:"显示时间",children:(0,eN.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,{env:p,callbacks:x}=(0,eO.useContext)(tv);return(0,eN.jsx)("span",{children:(0,eN.jsx)(er,{id:t,checked:n,disabled:r,size:"small"===a?"small":void 0,checkedChildren:i,unCheckedChildren:o,onChange:e=>{d&&d(e),p&&s&&l&&tk(p,s,l,e),p&&s&&x&&tI(p,s,x)},style:c,className:u})})},formComponent:e=>{let{model:t,onChange:l}=e;return(0,eN.jsx)(K,{labelCol:{span:6},wrapperCol:{span:18},children:(0,eN.jsx)(K.Item,{label:"变量名",children:(0,eN.jsx)(J,{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,style:i={},className:o}=e,{designable:s}=(0,eO.useContext)(tu),[d,c]=(0,eO.useState)(a.children||[]),u=(0,eO.useMemo)(()=>({...i,...a.style||{},alignItems:l,flexDirection:r,gap:n}),[a,l,n,r]);return(0,eN.jsx)(tf,{rootComponent:en,rootData:{id:t,style:u,className:o},list:d,item:a,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,eN.jsxs)(K,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,eN.jsx)(K.Item,{label:"方向",children:(0,eN.jsxs)(Z.Group,{size:"small",value:t.direction,onChange:e=>n("direction",e.target.value),children:[(0,eN.jsx)(Z.Button,{value:"horizontal",children:"水平"}),(0,eN.jsx)(Z.Button,{value:"vertical",children:"垂直"})]})}),(0,eN.jsx)(K.Item,{label:"大小",children:(0,eN.jsxs)(Z.Group,{size:"small",value:t.size,onChange:e=>n("size",e.target.value),children:[(0,eN.jsx)(Z.Button,{value:"small",children:"小"}),(0,eN.jsx)(Z.Button,{value:"middle",children:"中"}),(0,eN.jsx)(Z.Button,{value:"large",children:"大"})]})}),(0,eN.jsx)(K.Item,{label:"对齐",children:(0,eN.jsxs)(Z.Group,{size:"small",value:t.align,onChange:e=>n("align",e.target.value),children:[(0,eN.jsx)(Z.Button,{value:"start",children:"开始"}),(0,eN.jsx)(Z.Button,{value:"end",children:"结束"}),(0,eN.jsx)(Z.Button,{value:"center",children:"居中"}),(0,eN.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,style:s,className:d}=e,c=(0,eO.useMemo)(()=>!o.children||Array.isArray(o.children)||"object"!=typeof o.children?null:o.children.title||[],[o]),[u,p]=(0,eO.useState)(c||[]),x=(0,eO.useMemo)(()=>!o.children||Array.isArray(o.children)||"object"!=typeof o.children?null:o.children.extra||[],[o]),[m,h]=(0,eO.useState)(x||[]),f=(0,eO.useMemo)(()=>o.children?Array.isArray(o.children)?o.children:"object"!=typeof o.children?null:o.children.body||[]:null,[o]),[g,v]=(0,eO.useState)(f||[]),j=(0,eO.useMemo)(()=>!o.children||Array.isArray(o.children)||"object"!=typeof o.children?null:o.children.actions||[],[o]),[y,b]=(0,eO.useState)(j||[]);return(0,eN.jsx)(M,{id:t,variant:l?"outlined":"borderless",size:n,hoverable:a,className:[i?"ant-card-shadow":void 0,d].filter(Boolean).join(" "),title:(null==r?void 0:r.length)&&!(null==c?void 0:c.length)?r:c?(0,eN.jsx)(tf,{list:u,onListChange:e=>{o.children.title=e,p(e)}}):r,extra:x&&(0,eN.jsx)(tf,{list:m,onListChange:e=>{o.children.extra=e,h(e)}}),actions:j&&[(0,eN.jsx)(tf,{list:y,onListChange:e=>{o.children.actions=e,b(e)}})],styles:{header:{borderBottom:"none"}},style:s,children:f&&(0,eN.jsx)(tf,{list:g,onListChange:e=>{Array.isArray(o.children)?o.children=e:o.children.body=e,v(e)}})})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n});return(0,eN.jsxs)(K,{labelCol:{span:12},wrapperCol:{span:12},children:[(0,eN.jsx)(K.Item,{label:"标题",children:(0,eN.jsx)(J,{size:"small",value:t.title,onChange:e=>n("title",e.target.value)})}),(0,eN.jsx)(K.Item,{label:"边框",children:(0,eN.jsx)(er,{size:"small",checked:!!t.bordered,onChange:e=>n("bordered",e)})}),(0,eN.jsx)(K.Item,{label:"悬停效果",children:(0,eN.jsx)(er,{size:"small",checked:!!t.hoverable,onChange:e=>n("hoverable",e)})}),(0,eN.jsx)(K.Item,{label:"阴影",children:(0,eN.jsx)(er,{size:"small",checked:!!t.shadow,onChange:e=>n("shadow",e)})}),(0,eN.jsx)(K.Item,{label:"大小",children:(0,eN.jsxs)(Z.Group,{size:"small",value:t.size,onChange:e=>n("size",e.target.value),children:[(0,eN.jsx)(Z.Button,{value:"default",children:"默认"}),(0,eN.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,style:r,className:a}=e,{designable:i}=(0,eO.useContext)(tu),[o,s]=(0,eO.useState)(n.children||[]);return(0,eN.jsx)(tf,{rootComponent:ee,rootData:{id:t,gutter:l,style:n.style||r,className:n.className||a},list:o,item:n,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,eN.jsxs)(K,{labelCol:{span:12},wrapperCol:{span:12},children:[(0,eN.jsx)(K.Item,{label:"列间距",children:(0,eN.jsx)(U,{size:"small",value:r[0],min:0,step:4,onChange:e=>n("gutter",[e||0,r[1]])})}),(0,eN.jsx)(K.Item,{label:"行间距",children:(0,eN.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,style:c={},className:u}=e,{designable:p}=(0,eO.useContext)(tu),{deviceWidth:x}=(0,eO.useContext)(tv),[m,h]=(0,eO.useState)(d.children||[]),f=(0,eO.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,eN.jsx)(tf,{rootComponent:$,rootData:{id:t||d.id,span:f,style:{...d.style||{},...c},className:u},list:m,item:d,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,eN.jsxs)(K,{labelCol:{span:12},wrapperCol:{span:12},children:[(0,eN.jsx)(K.Item,{label:"默认列数",children:(0,eN.jsx)(U,{size:"small",value:t.span,min:0,max:24,step:4,onChange:e=>n("span",e||0)})}),(0,eN.jsx)(K.Item,{label:(0,eN.jsxs)(eN.Fragment,{children:["xs"," ",(0,eN.jsx)(es,{title:"<576px 响应式栅格",children:(0,eN.jsx)(lu,{})})]}),children:(0,eN.jsx)(U,{size:"small",value:t.xs,min:0,max:24,step:4,onChange:e=>n("xs",e||0)})}),(0,eN.jsx)(K.Item,{label:(0,eN.jsxs)(eN.Fragment,{children:["sm"," ",(0,eN.jsx)(es,{title:"≥576px 响应式栅格",children:(0,eN.jsx)(lu,{})})]}),children:(0,eN.jsx)(U,{size:"small",value:t.sm,min:0,max:24,step:4,onChange:e=>n("sm",e||0)})}),(0,eN.jsx)(K.Item,{label:(0,eN.jsxs)(eN.Fragment,{children:["md"," ",(0,eN.jsx)(es,{title:"≥768px 响应式栅格",children:(0,eN.jsx)(lu,{})})]}),children:(0,eN.jsx)(U,{size:"small",value:t.md,min:0,max:24,step:4,onChange:e=>n("md",e||0)})}),(0,eN.jsx)(K.Item,{label:(0,eN.jsxs)(eN.Fragment,{children:["lg"," ",(0,eN.jsx)(es,{title:"≥992px 响应式栅格",children:(0,eN.jsx)(lu,{})})]}),children:(0,eN.jsx)(U,{size:"small",value:t.lg,min:0,max:24,step:4,onChange:e=>n("lg",e||0)})}),(0,eN.jsx)(K.Item,{label:(0,eN.jsxs)(eN.Fragment,{children:["xl"," ",(0,eN.jsx)(es,{title:"≥1200px 响应式栅格",children:(0,eN.jsx)(lu,{})})]}),children:(0,eN.jsx)(U,{size:"small",value:t.xl,min:0,max:24,step:4,onChange:e=>n("xl",e||0)})}),(0,eN.jsx)(K.Item,{label:(0,eN.jsxs)(eN.Fragment,{children:["xxl"," ",(0,eN.jsx)(es,{title:"≥1600px 响应式栅格",children:(0,eN.jsx)(lu,{})})]}),children:(0,eN.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 ew=eb.ru,eC=eb.R3,eS=eb.Ei,ez=eb.NQ,ek=eb.B7,eI=eb.Ts,eN=eb.V2,eO=eb.QE,eT=eb.NG,eE=eb.Wg,eD=eb.Nx;export{ew as DropContainer,eC as EnvContext,eS as PageCanvas,ez as PageContext,ek as PageDesigner,eI as PageProvider,eN as PageSchema,eO as PluginType,eT as PropEditorProps,eE as handleCallback,eD as plugins};
|
|
@@ -927,7 +927,7 @@
|
|
|
927
927
|
background: transparent;
|
|
928
928
|
}
|
|
929
929
|
}
|
|
930
|
-
`,tc=e=>{let{open:t,onCancel:l,onOk:n}=e,[r,a]=(0,p.useState)(JSON.stringify({info:{},datasources:[],scripts:[],variables:[],items:[]}));return(0,d.jsx)(ey.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)(eX.Editor,{height:"100%",defaultLanguage:"json",value:r,options:{minimap:{enabled:!1}},onChange:e=>a(e||"")})})})},tu=m().forwardRef((e,t)=>{var l;let n,{pageId:r,agentList:a=[],plugins:i=[],headerExtra:o,datasourceEnable:s=!0,scriptEnable:c=!0,datasetPanel:u,datasetSelector:m,fetch:x,onSave:h,loading:f=!1}=e,g=(0,p.useRef)(null),v=(0,p.useRef)(null),[j,y]=(0,p.useState)(1),[b,w]=(0,p.useState)([]),[C,S]=(0,p.useState)([]),[I,z]=(0,p.useState)(!1),[k,O]=(0,p.useState)("desktop"),[N,T]=(0,p.useState)("component"),[R,F]=(0,p.useState)((null==x?void 0:x.ai)?"ai":"props"),[D,E]=(0,p.useState)(!0),[A,B]=(0,p.useState)(!0),[M,L]=(0,p.useState)(null),[P,$]=(0,p.useState)({info:{},datasources:[],scripts:[],variables:[],items:[]}),[Y,H]=(0,p.useState)(!0),[_,q]=(0,p.useState)(!1),[G,U]=(0,p.useState)(!1),K=(0,p.useMemo)(()=>{let e=D?"250px":"",t=A?"400px":"";return{gridTemplateColumns:`${e} 1fr ${t}`}},[D,A]),W=(0,p.useMemo)(()=>({display:D?"flex":"none"}),[D]),J=(0,p.useMemo)(()=>({display:A?"flex":"none"}),[A]);l=[P],(n=(0,p.useRef)()).current===JSON.stringify(l)&&n.current||(n.current=JSON.stringify(l),(()=>{I||(w(e=>e.length?[...e,JSON.parse(JSON.stringify(P))].slice(-50):[JSON.parse(JSON.stringify(P))]),S([]))})()),(0,p.useImperativeHandle)(t,()=>({handleOpen(e){z(!0),X(e.items),$(e),w([JSON.parse(JSON.stringify(e))]),S([]),setTimeout(()=>z(!1),0)}}));let X=(e,t)=>{e&&e.forEach(e=>{e.id||(e.id=t||Math.random().toString(36).slice(2,10)),Array.isArray(e.children)?X(e.children):"object"==typeof e.children&&e.children&&Object.keys(e.children).forEach(t=>{Array.isArray(e.children[t])&&X(e.children[t],Math.random().toString(36).slice(2,10))})})},V=e=>{var t,l,n;if((null==(t=e.datasets)?void 0:t.length)&&(null==v||null==(l=v.current)?void 0:l.reload)&&v.current.reload(),e.schema)$(e.schema);else if(null==(n=e.pageItems)?void 0:n.length){let t=new Map(e.pageItems.map(e=>[e.id,e])),l=JSON.parse(JSON.stringify(P)),n=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];e.forEach(e=>{t.has(e.id)&&(Object.keys(e).forEach(t=>{"id"!==t&&delete e[t]}),Object.assign(e,t.get(e.id))),Array.isArray(e.children)?n(e.children):"object"==typeof e.children&&e.children&&Object.keys(e.children).forEach(t=>{Array.isArray(e.children[t])&&n(e.children[t])})})};n(l.items),$(l)}},Q=(0,p.useMemo)(()=>"cascade"!==R||(null==M?void 0:M.cascadeIds)?R:"props",[M,R]);return(0,d.jsxs)(es,{pageId:r,designable:Y,plugins:i,schema:P,selectedItem:M,setSchema:$,setSelectedItem:L,datasetSelector:m,fetch:x,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)(ey.Space,{children:[(0,d.jsx)("span",{style:{fontSize:16,fontWeight:500},children:"创建数据报表"}),(0,d.jsx)(ey.Divider,{orientation:"vertical"}),(0,d.jsx)(ey.Tooltip,{title:"保存",children:(0,d.jsx)(ey.Button,{type:"link",className:"toolbar",onClick:()=>{null==h||h(P)},loading:f,children:(0,d.jsx)(ej.SaveOutlined,{})})}),(0,d.jsx)(ey.Divider,{orientation:"vertical"}),(0,d.jsx)(ey.Tooltip,{title:"撤销",children:(0,d.jsx)("a",{className:`toolbar ${b.length>1?"active":""}`,onClick:()=>{w(e=>{if(e.length<=1)return e;z(!0);let t=e[e.length-2];return S(e=>[...e,JSON.parse(JSON.stringify(P))]),$(t),L(null),setTimeout(()=>z(!1),0),e.slice(0,-1)})},children:(0,d.jsx)(ej.UndoOutlined,{})})}),(0,d.jsx)(ey.Tooltip,{title:"重做",children:(0,d.jsx)("a",{className:`toolbar ${C.length>0?"active":""}`,onClick:()=>{S(e=>e.length?(z(!0),w(e=>[...e,JSON.parse(JSON.stringify(P))]),$(e[e.length-1]),L(null),setTimeout(()=>z(!1),0),e.slice(0,-1)):e)},children:(0,d.jsx)(ej.RedoOutlined,{})})}),(0,d.jsx)(ey.Divider,{orientation:"vertical"}),(0,d.jsx)(ey.Tooltip,{title:"导入JSON",children:(0,d.jsx)("a",{className:`toolbar ${C.length>0?"active":""}`,onClick:()=>{q(!0)},children:(0,d.jsx)(ej.ImportOutlined,{})})})]}),(0,d.jsxs)(ey.Space,{children:[(0,d.jsx)(ey.Tooltip,{title:"缩小",children:(0,d.jsx)("a",{className:"toolbar",onClick:()=>y(parseFloat(Math.max(j-.1,.5).toFixed(1))),children:(0,d.jsx)(ej.ZoomOutOutlined,{})})}),(0,d.jsxs)("div",{style:{fontSize:12,color:"#999",userSelect:"none"},children:[(100*j).toFixed(0),"%"]}),(0,d.jsx)(ey.Tooltip,{title:"放大",children:(0,d.jsx)("a",{className:"toolbar",onClick:()=>y(parseFloat(Math.min(j+.1,2).toFixed(1))),children:(0,d.jsx)(ej.ZoomInOutlined,{})})}),(0,d.jsx)(ey.Tooltip,{title:"重置缩放",children:(0,d.jsx)("a",{className:"toolbar",onClick:()=>y(1),children:(0,d.jsx)(ew,{type:"icon-zoom-reset"})})}),(0,d.jsx)(ey.Divider,{orientation:"vertical"}),(0,d.jsx)(ey.Tooltip,{title:"切换左侧栏",children:(0,d.jsx)("a",{className:`toolbar ${D?"active":""}`,onClick:()=>{E(e=>!e),setTimeout(()=>{var e,t;return null==(t=g.current)||null==(e=t.handleResize)?void 0:e.call(t)},0)},children:(0,d.jsx)(ew,{type:"icon-sider-l"})})}),(0,d.jsx)(ey.Tooltip,{title:"切换右侧栏",children:(0,d.jsx)("a",{className:`toolbar ${A?"active":""}`,onClick:()=>{B(e=>!e),setTimeout(()=>{var e,t;return null==(t=g.current)||null==(e=t.handleResize)?void 0:e.call(t)},0)},children:(0,d.jsx)(ew,{type:"icon-sider-r"})})}),o]})]}),(0,d.jsxs)(td,{style:K,children:[(0,d.jsxs)("div",{className:"left",style:W,children:[(0,d.jsx)("div",{style:{padding:"22px 1px 22px 0",borderRight:"solid 1px #e8e8e8"},children:(0,d.jsxs)(ey.Radio.Group,{value:N,onChange:e=>T(e.target.value),buttonStyle:"outline",style:{fontWeight:"normal",display:"inline-flex",flexDirection:"column",gap:14},className:"left-pane-tabs",children:[(0,d.jsx)(ey.Radio.Button,{value:"component",children:(0,d.jsx)(ey.Tooltip,{title:"组件",placement:"right",children:(0,d.jsx)(ew,{type:"icon-puzzle"})})}),(0,d.jsx)(ey.Radio.Button,{value:"layer",children:(0,d.jsx)(ey.Tooltip,{title:"图层",placement:"right",children:(0,d.jsx)(ew,{type:"icon-outline"})})}),!!u&&(0,d.jsx)(ey.Radio.Button,{value:"dataset",children:(0,d.jsx)(ey.Tooltip,{title:"数据集",placement:"right",children:(0,d.jsx)(ew,{type:"icon-dataset"})})}),s&&(0,d.jsx)(ey.Radio.Button,{value:"datasource",title:"数据源",children:(0,d.jsx)(ey.Tooltip,{title:"数据源",placement:"right",children:(0,d.jsx)(ew,{type:"icon-datasource"})})}),c&&(0,d.jsx)(ey.Radio.Button,{value:"script",children:(0,d.jsx)(ey.Tooltip,{title:"脚本",placement:"right",children:(0,d.jsx)(ew,{type:"icon-js"})})}),(0,d.jsx)(ey.Radio.Button,{value:"env",children:(0,d.jsx)(ey.Tooltip,{title:"环境变量",placement:"right",children:(0,d.jsx)(ew,{type:"icon-variable"})})}),(0,d.jsx)(ey.Radio.Button,{value:"code",children:(0,d.jsx)(ey.Tooltip,{title:"源码",placement:"right",children:(0,d.jsx)(ew,{type:"icon-json"})})})]})}),(0,d.jsxs)("div",{style:{flex:"1 1 auto",display:"flex",flexDirection:"column",width:"calc(100% - 47px)"},children:["component"===N&&(0,d.jsx)(e4,{}),"layer"===N&&(0,d.jsx)(e3,{}),s&&"datasource"===N&&(0,d.jsx)(e5,{}),c&&"script"===N&&(0,d.jsx)(tr,{}),"env"===N&&(0,d.jsx)(ti,{}),"code"===N&&(0,d.jsx)(e0,{}),!!u&&"dataset"===N&&(0,d.jsx)(ts,{ref:v,renderNode:u})]})]}),(0,d.jsxs)("div",{className:"center",style:{flex:"1 1 auto"},children:[(0,d.jsx)(eL,{title:"页面",extra:(0,d.jsxs)(ey.Space,{children:[(0,d.jsx)(ey.Button,{size:"small",type:Y?"default":"primary",icon:Y?(0,d.jsx)(ej.EyeInvisibleOutlined,{}):(0,d.jsx)(ej.EyeOutlined,{}),onClick:()=>H(!Y)}),(0,d.jsxs)(ey.Radio.Group,{value:k,onChange:e=>O(e.target.value),size:"small",buttonStyle:"outline",children:[(0,d.jsx)(ey.Radio.Button,{value:"desktop",title:"桌面",children:(0,d.jsx)(ej.DesktopOutlined,{})}),(0,d.jsx)(ey.Radio.Button,{value:"mobile",title:"移动设备",children:(0,d.jsx)(ej.MobileOutlined,{})}),(0,d.jsx)(ey.Radio.Button,{value:"tablet",title:"平板设备",children:(0,d.jsx)(ej.TabletOutlined,{})})]})]})}),(0,d.jsx)("div",{className:["body beautified_scrollbar",k].join(" "),children:(0,d.jsx)("div",{style:{transform:`scale(${j})`,transformOrigin:"top center"},children:(0,d.jsx)(eg,{ref:g,device:k,fetch:x})})})]}),(0,d.jsxs)("div",{className:"right",style:J,children:[(0,d.jsxs)("div",{style:{flex:"1 1 auto",display:"flex",flexDirection:"column",width:"calc(100% - 47px)"},children:[(0,d.jsx)(eH,{agentList:a,onEffect:V,style:{display:"ai"===Q&&(null==x?void 0:x.ai)?void 0:"none"}}),"props"===Q&&(0,d.jsx)(tt,{datasourceEnable:s}),"cascade"===Q&&(null==M?void 0:M.cascadeIds)&&(0,d.jsx)(eJ,{})]}),(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)(ey.Radio.Group,{value:Q,onChange:e=>F(e.target.value),buttonStyle:"outline",style:{fontWeight:"normal",display:"inline-flex",flexDirection:"column",gap:14},className:"right-pane-tabs",children:[(null==x?void 0:x.ai)&&(0,d.jsx)(ey.Radio.Button,{value:"ai",children:(0,d.jsx)(ey.Tooltip,{title:"智能助理",placement:"right",children:(0,d.jsx)(ew,{type:"icon-assistant"})})}),(0,d.jsx)(ey.Radio.Button,{value:"props",children:(0,d.jsx)(ey.Tooltip,{title:"属性",placement:"right",children:(0,d.jsx)(ew,{type:"icon-info"})})}),(null==M?void 0:M.cascadeIds)&&(0,d.jsx)(ey.Radio.Button,{value:"cascade",children:(0,d.jsx)(ey.Tooltip,{title:"联动",placement:"right",children:(0,d.jsx)(ew,{type:"icon-cascade"})})})]})})]})]})]}),(0,d.jsx)(tc,{open:_,onOk:e=>{q(!1),$(e)},onCancel:()=>q(!1)}),(0,d.jsx)(ey.Drawer,{open:G,size:400,mask:!1,title:null,closable:!1,styles:{body:{padding:0}},onClose:()=>U(!1),children:(0,d.jsx)(eH,{agentList:a,headExtra:(0,d.jsx)(ey.Button,{type:"link",icon:(0,d.jsx)(ej.CloseOutlined,{}),onClick:()=>U(!1)}),onEffect:V})})]})});var tp=((i={}).STRING="STRING",i.NUMBER="NUMBER",i.BOOLEAN="BOOLEAN",i.OBJECT="OBJECT",i.ARRAY="ARRAY",i);let tm=h()(ej.InfoCircleOutlined)`
|
|
930
|
+
`,tc=e=>{let{open:t,onCancel:l,onOk:n}=e,[r,a]=(0,p.useState)(JSON.stringify({info:{},datasources:[],scripts:[],variables:[],items:[]}));return(0,d.jsx)(ey.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)(eX.Editor,{height:"100%",defaultLanguage:"json",value:r,options:{minimap:{enabled:!1}},onChange:e=>a(e||"")})})})},tu=m().forwardRef((e,t)=>{var l;let n,{pageId:r,agentList:a=[],plugins:i=[],headerExtra:o,datasourceEnable:s=!0,scriptEnable:c=!0,datasetPanel:u,datasetSelector:m,fetch:x,onSave:h,loading:f=!1}=e,g=(0,p.useRef)(null),v=(0,p.useRef)(null),[j,y]=(0,p.useState)(1),[b,w]=(0,p.useState)([]),[C,S]=(0,p.useState)([]),[I,z]=(0,p.useState)(!1),[k,O]=(0,p.useState)("desktop"),[N,T]=(0,p.useState)("component"),[R,F]=(0,p.useState)((null==x?void 0:x.ai)?"ai":"props"),[D,E]=(0,p.useState)(!0),[A,B]=(0,p.useState)(!0),[M,L]=(0,p.useState)(null),[P,$]=(0,p.useState)({info:{},datasources:[],scripts:[],variables:[],items:[]}),[Y,H]=(0,p.useState)(!0),[_,q]=(0,p.useState)(!1),[G,U]=(0,p.useState)(!1),K=(0,p.useMemo)(()=>{let e=D?"250px":"",t=A?"400px":"";return{gridTemplateColumns:`${e} 1fr ${t}`}},[D,A]),W=(0,p.useMemo)(()=>({display:D?"flex":"none"}),[D]),J=(0,p.useMemo)(()=>({display:A?"flex":"none"}),[A]);l=[P],(n=(0,p.useRef)()).current===JSON.stringify(l)&&n.current||(n.current=JSON.stringify(l),(()=>{I||(w(e=>e.length?[...e,JSON.parse(JSON.stringify(P))].slice(-50):[JSON.parse(JSON.stringify(P))]),S([]))})()),(0,p.useImperativeHandle)(t,()=>({handleOpen(e){z(!0),X(e.items),$(e),w([JSON.parse(JSON.stringify(e))]),S([]),setTimeout(()=>z(!1),0)}}));let X=(e,t)=>{e&&e.forEach(e=>{e.id||(e.id=t||Math.random().toString(36).slice(2,10)),Array.isArray(e.children)?X(e.children):"object"==typeof e.children&&e.children&&Object.keys(e.children).forEach(t=>{Array.isArray(e.children[t])&&X(e.children[t],Math.random().toString(36).slice(2,10))})})},V=e=>{var t,l,n;if((null==(t=e.datasets)?void 0:t.length)&&(null==v||null==(l=v.current)?void 0:l.reload)&&v.current.reload(),e.schema)$(JSON.parse(JSON.stringify(e.schema)));else if(null==(n=e.pageItems)?void 0:n.length){let t=new Map(e.pageItems.map(e=>[e.id,e])),l=JSON.parse(JSON.stringify(P)),n=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];e.forEach(e=>{t.has(e.id)&&(Object.keys(e).forEach(t=>{"id"!==t&&delete e[t]}),Object.assign(e,t.get(e.id))),Array.isArray(e.children)?n(e.children):"object"==typeof e.children&&e.children&&Object.keys(e.children).forEach(t=>{Array.isArray(e.children[t])&&n(e.children[t])})})};n(l.items),$(l)}},Q=(0,p.useMemo)(()=>"cascade"!==R||(null==M?void 0:M.cascadeIds)?R:"props",[M,R]);return(0,d.jsxs)(es,{pageId:r,designable:Y,plugins:i,schema:P,selectedItem:M,setSchema:$,setSelectedItem:L,datasetSelector:m,fetch:x,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)(ey.Space,{children:[(0,d.jsx)("span",{style:{fontSize:16,fontWeight:500},children:"创建数据报表"}),(0,d.jsx)(ey.Divider,{orientation:"vertical"}),(0,d.jsx)(ey.Tooltip,{title:"保存",children:(0,d.jsx)(ey.Button,{type:"link",className:"toolbar",onClick:()=>{null==h||h(P)},loading:f,children:(0,d.jsx)(ej.SaveOutlined,{})})}),(0,d.jsx)(ey.Divider,{orientation:"vertical"}),(0,d.jsx)(ey.Tooltip,{title:"撤销",children:(0,d.jsx)("a",{className:`toolbar ${b.length>1?"active":""}`,onClick:()=>{w(e=>{if(e.length<=1)return e;z(!0);let t=e[e.length-2];return S(e=>[...e,JSON.parse(JSON.stringify(P))]),$(t),L(null),setTimeout(()=>z(!1),0),e.slice(0,-1)})},children:(0,d.jsx)(ej.UndoOutlined,{})})}),(0,d.jsx)(ey.Tooltip,{title:"重做",children:(0,d.jsx)("a",{className:`toolbar ${C.length>0?"active":""}`,onClick:()=>{S(e=>e.length?(z(!0),w(e=>[...e,JSON.parse(JSON.stringify(P))]),$(e[e.length-1]),L(null),setTimeout(()=>z(!1),0),e.slice(0,-1)):e)},children:(0,d.jsx)(ej.RedoOutlined,{})})}),(0,d.jsx)(ey.Divider,{orientation:"vertical"}),(0,d.jsx)(ey.Tooltip,{title:"导入JSON",children:(0,d.jsx)("a",{className:`toolbar ${C.length>0?"active":""}`,onClick:()=>{q(!0)},children:(0,d.jsx)(ej.ImportOutlined,{})})})]}),(0,d.jsxs)(ey.Space,{children:[(0,d.jsx)(ey.Tooltip,{title:"缩小",children:(0,d.jsx)("a",{className:"toolbar",onClick:()=>y(parseFloat(Math.max(j-.1,.5).toFixed(1))),children:(0,d.jsx)(ej.ZoomOutOutlined,{})})}),(0,d.jsxs)("div",{style:{fontSize:12,color:"#999",userSelect:"none"},children:[(100*j).toFixed(0),"%"]}),(0,d.jsx)(ey.Tooltip,{title:"放大",children:(0,d.jsx)("a",{className:"toolbar",onClick:()=>y(parseFloat(Math.min(j+.1,2).toFixed(1))),children:(0,d.jsx)(ej.ZoomInOutlined,{})})}),(0,d.jsx)(ey.Tooltip,{title:"重置缩放",children:(0,d.jsx)("a",{className:"toolbar",onClick:()=>y(1),children:(0,d.jsx)(ew,{type:"icon-zoom-reset"})})}),(0,d.jsx)(ey.Divider,{orientation:"vertical"}),(0,d.jsx)(ey.Tooltip,{title:"切换左侧栏",children:(0,d.jsx)("a",{className:`toolbar ${D?"active":""}`,onClick:()=>{E(e=>!e),setTimeout(()=>{var e,t;return null==(t=g.current)||null==(e=t.handleResize)?void 0:e.call(t)},0)},children:(0,d.jsx)(ew,{type:"icon-sider-l"})})}),(0,d.jsx)(ey.Tooltip,{title:"切换右侧栏",children:(0,d.jsx)("a",{className:`toolbar ${A?"active":""}`,onClick:()=>{B(e=>!e),setTimeout(()=>{var e,t;return null==(t=g.current)||null==(e=t.handleResize)?void 0:e.call(t)},0)},children:(0,d.jsx)(ew,{type:"icon-sider-r"})})}),o]})]}),(0,d.jsxs)(td,{style:K,children:[(0,d.jsxs)("div",{className:"left",style:W,children:[(0,d.jsx)("div",{style:{padding:"22px 1px 22px 0",borderRight:"solid 1px #e8e8e8"},children:(0,d.jsxs)(ey.Radio.Group,{value:N,onChange:e=>T(e.target.value),buttonStyle:"outline",style:{fontWeight:"normal",display:"inline-flex",flexDirection:"column",gap:14},className:"left-pane-tabs",children:[(0,d.jsx)(ey.Radio.Button,{value:"component",children:(0,d.jsx)(ey.Tooltip,{title:"组件",placement:"right",children:(0,d.jsx)(ew,{type:"icon-puzzle"})})}),(0,d.jsx)(ey.Radio.Button,{value:"layer",children:(0,d.jsx)(ey.Tooltip,{title:"图层",placement:"right",children:(0,d.jsx)(ew,{type:"icon-outline"})})}),!!u&&(0,d.jsx)(ey.Radio.Button,{value:"dataset",children:(0,d.jsx)(ey.Tooltip,{title:"数据集",placement:"right",children:(0,d.jsx)(ew,{type:"icon-dataset"})})}),s&&(0,d.jsx)(ey.Radio.Button,{value:"datasource",title:"数据源",children:(0,d.jsx)(ey.Tooltip,{title:"数据源",placement:"right",children:(0,d.jsx)(ew,{type:"icon-datasource"})})}),c&&(0,d.jsx)(ey.Radio.Button,{value:"script",children:(0,d.jsx)(ey.Tooltip,{title:"脚本",placement:"right",children:(0,d.jsx)(ew,{type:"icon-js"})})}),(0,d.jsx)(ey.Radio.Button,{value:"env",children:(0,d.jsx)(ey.Tooltip,{title:"环境变量",placement:"right",children:(0,d.jsx)(ew,{type:"icon-variable"})})}),(0,d.jsx)(ey.Radio.Button,{value:"code",children:(0,d.jsx)(ey.Tooltip,{title:"源码",placement:"right",children:(0,d.jsx)(ew,{type:"icon-json"})})})]})}),(0,d.jsxs)("div",{style:{flex:"1 1 auto",display:"flex",flexDirection:"column",width:"calc(100% - 47px)"},children:["component"===N&&(0,d.jsx)(e4,{}),"layer"===N&&(0,d.jsx)(e3,{}),s&&"datasource"===N&&(0,d.jsx)(e5,{}),c&&"script"===N&&(0,d.jsx)(tr,{}),"env"===N&&(0,d.jsx)(ti,{}),"code"===N&&(0,d.jsx)(e0,{}),!!u&&"dataset"===N&&(0,d.jsx)(ts,{ref:v,renderNode:u})]})]}),(0,d.jsxs)("div",{className:"center",style:{flex:"1 1 auto"},children:[(0,d.jsx)(eL,{title:"页面",extra:(0,d.jsxs)(ey.Space,{children:[(0,d.jsx)(ey.Button,{size:"small",type:Y?"default":"primary",icon:Y?(0,d.jsx)(ej.EyeInvisibleOutlined,{}):(0,d.jsx)(ej.EyeOutlined,{}),onClick:()=>H(!Y)}),(0,d.jsxs)(ey.Radio.Group,{value:k,onChange:e=>O(e.target.value),size:"small",buttonStyle:"outline",children:[(0,d.jsx)(ey.Radio.Button,{value:"desktop",title:"桌面",children:(0,d.jsx)(ej.DesktopOutlined,{})}),(0,d.jsx)(ey.Radio.Button,{value:"mobile",title:"移动设备",children:(0,d.jsx)(ej.MobileOutlined,{})}),(0,d.jsx)(ey.Radio.Button,{value:"tablet",title:"平板设备",children:(0,d.jsx)(ej.TabletOutlined,{})})]})]})}),(0,d.jsx)("div",{className:["body beautified_scrollbar",k].join(" "),children:(0,d.jsx)("div",{style:{transform:`scale(${j})`,transformOrigin:"top center"},children:(0,d.jsx)(eg,{ref:g,device:k,fetch:x})})})]}),(0,d.jsxs)("div",{className:"right",style:J,children:[(0,d.jsxs)("div",{style:{flex:"1 1 auto",display:"flex",flexDirection:"column",width:"calc(100% - 47px)"},children:[(0,d.jsx)(eH,{agentList:a,onEffect:V,style:{display:"ai"===Q&&(null==x?void 0:x.ai)?void 0:"none"}}),"props"===Q&&(0,d.jsx)(tt,{datasourceEnable:s}),"cascade"===Q&&(null==M?void 0:M.cascadeIds)&&(0,d.jsx)(eJ,{})]}),(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)(ey.Radio.Group,{value:Q,onChange:e=>F(e.target.value),buttonStyle:"outline",style:{fontWeight:"normal",display:"inline-flex",flexDirection:"column",gap:14},className:"right-pane-tabs",children:[(null==x?void 0:x.ai)&&(0,d.jsx)(ey.Radio.Button,{value:"ai",children:(0,d.jsx)(ey.Tooltip,{title:"智能助理",placement:"right",children:(0,d.jsx)(ew,{type:"icon-assistant"})})}),(0,d.jsx)(ey.Radio.Button,{value:"props",children:(0,d.jsx)(ey.Tooltip,{title:"属性",placement:"right",children:(0,d.jsx)(ew,{type:"icon-info"})})}),(null==M?void 0:M.cascadeIds)&&(0,d.jsx)(ey.Radio.Button,{value:"cascade",children:(0,d.jsx)(ey.Tooltip,{title:"联动",placement:"right",children:(0,d.jsx)(ew,{type:"icon-cascade"})})})]})})]})]})]}),(0,d.jsx)(tc,{open:_,onOk:e=>{q(!1),$(e)},onCancel:()=>q(!1)}),(0,d.jsx)(ey.Drawer,{open:G,size:400,mask:!1,title:null,closable:!1,styles:{body:{padding:0}},onClose:()=>U(!1),children:(0,d.jsx)(eH,{agentList:a,headExtra:(0,d.jsx)(ey.Button,{type:"link",icon:(0,d.jsx)(ej.CloseOutlined,{}),onClick:()=>U(!1)}),onEffect:V})})]})});var tp=((i={}).STRING="STRING",i.NUMBER="NUMBER",i.BOOLEAN="BOOLEAN",i.OBJECT="OBJECT",i.ARRAY="ARRAY",i);let tm=h()(ej.InfoCircleOutlined)`
|
|
931
931
|
vertical-align: middle;
|
|
932
932
|
margin-left: 2px;
|
|
933
933
|
color: var(--ant-color-text-description);
|
|
@@ -1048,7 +1048,7 @@
|
|
|
1048
1048
|
const module = undefined;
|
|
1049
1049
|
const exports = undefined;
|
|
1050
1050
|
${e}
|
|
1051
|
-
`)(tI,console,Math,Date,Array,Object,String,Number,Boolean,x)}catch(e){return console.error("ECharts 配置解析失败:",e),null}}})(l);u&&e&&(u.setOption(e),setTimeout(()=>u.resize(),50))},[u,l]),(0,d.jsx)("div",{id:t,style:{width:"100%",height:r,...a},className:i,children:(0,d.jsx)("div",{ref:c,style:{width:"100%",height:r,...a}})})},formComponent:e=>{let{model:t,onChange:l}=e,n=(0,p.useRef)(null);return(0,d.jsx)(ey.Form,{
|
|
1051
|
+
`)(tI,console,Math,Date,Array,Object,String,Number,Boolean,x)}catch(e){return console.error("ECharts 配置解析失败:",e),null}}})(l);u&&e&&(u.setOption(e),setTimeout(()=>u.resize(),50))},[u,l]),(0,d.jsx)("div",{id:t,style:{width:"100%",height:r,...a},className:i,children:(0,d.jsx)("div",{ref:c,style:{width:"100%",height:r,...a}})})},formComponent:e=>{let{model:t,onChange:l}=e,n=(0,p.useRef)(null);return(0,d.jsxs)(ey.Form,{children:[(0,d.jsx)(ey.Form.Item,{name:"height",label:"高度",labelCol:{span:6},wrapperCol:{span:18},children:(0,d.jsx)(ey.InputNumber,{value:t.height,size:"small",min:10,max:1e3,suffix:"px",onChange:e=>l&&l({...t,height:e})})}),(0,d.jsx)(ey.Form.Item,{layout:"vertical",label:(0,d.jsxs)(d.Fragment,{children:["Echarts 渲染脚本"," ",(0,d.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,d.jsx)(ew,{type:"icon-formate"})," 格式化"]})]}),className:"ant-form-item-label-space",children:(0,d.jsxs)("div",{style:{border:"1px solid #d9d9d9",borderRadius:4,textAlign:"left"},children:[(0,d.jsxs)("div",{style:{color:"#0000ff",fontSize:14,padding:"0 50px"},children:["function getOptions(data) ","{"," "]}),(0,d.jsx)(eV(),{onMount:e=>{n.current={editor:e}},height:"400px",defaultLanguage:"javascript",value:t.script,onChange:e=>{let n;return n=e||"",l&&l({...t,script:n||""})},options:{minimap:{enabled:!1},scrollBeyondLastLine:!1,tabSize:2}}),(0,d.jsx)("div",{style:{color:"#0000ff",fontSize:14,padding:"0 50px"},children:"}"})]})})]})},defaultOptions:{datasource:{source:"custom",datasourceId:null,scriptId:null,custom:'[{"name":"Mon","value":150},{"name":"Tue","value":230},{"name":"Wed","value":224},{"name":"Thu","value":218},{"name":"Fri","value":135},{"name":"Sat","value":147},{"name":"Sun","value":260}]'},props:{script:`
|
|
1052
1052
|
return {
|
|
1053
1053
|
xAxis: { type: 'category', data: data.map(i => i.name) },
|
|
1054
1054
|
yAxis: { type: 'value' },
|
package/package.json
CHANGED
|
@@ -395,7 +395,7 @@ export const PageDesigner = React.forwardRef<any, PageDesignerProps>(
|
|
|
395
395
|
datasetPanelRef.current.reload();
|
|
396
396
|
}
|
|
397
397
|
if (effect.schema) {
|
|
398
|
-
setSchema(effect.schema);
|
|
398
|
+
setSchema(JSON.parse(JSON.stringify(effect.schema)));
|
|
399
399
|
} else if (effect.pageItems?.length) {
|
|
400
400
|
const effectItemMap = new Map(
|
|
401
401
|
effect.pageItems.map((item) => [item.id, item]),
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React, { useRef } from "react";
|
|
2
|
-
import { Form } from "antd";
|
|
2
|
+
import { Form, InputNumber } from "antd";
|
|
3
3
|
import Editor from "@monaco-editor/react";
|
|
4
4
|
import type { PropEditorProps } from "./types";
|
|
5
5
|
import { IconFont } from "../../../icon/IconFont";
|
|
6
6
|
|
|
7
|
-
export type EchartsModel = { script: string };
|
|
7
|
+
export type EchartsModel = { script: string; height?: number };
|
|
8
8
|
|
|
9
9
|
export const EchartsProps: React.FC<PropEditorProps<EchartsModel>> = ({
|
|
10
10
|
model,
|
|
@@ -13,14 +13,32 @@ export const EchartsProps: React.FC<PropEditorProps<EchartsModel>> = ({
|
|
|
13
13
|
const ref = useRef<any>(null);
|
|
14
14
|
const setScript = (v?: string) =>
|
|
15
15
|
onChange && onChange({ ...model, script: v || "" });
|
|
16
|
+
const triggerModel = (key: keyof EchartsModel, value: any) =>
|
|
17
|
+
onChange && onChange({ ...model, [key]: value });
|
|
16
18
|
const format = () => {
|
|
17
19
|
// Monaco-react does not expose format directly; relying on editor action
|
|
18
20
|
const editor = (ref.current as any)?.editor;
|
|
19
21
|
editor?.getAction("editor.action.formatDocument")?.run();
|
|
20
22
|
};
|
|
21
23
|
return (
|
|
22
|
-
<Form
|
|
24
|
+
<Form>
|
|
23
25
|
<Form.Item
|
|
26
|
+
name="height"
|
|
27
|
+
label="高度"
|
|
28
|
+
labelCol={{ span: 6 }}
|
|
29
|
+
wrapperCol={{ span: 18 }}
|
|
30
|
+
>
|
|
31
|
+
<InputNumber
|
|
32
|
+
value={model.height}
|
|
33
|
+
size="small"
|
|
34
|
+
min={10}
|
|
35
|
+
max={1000}
|
|
36
|
+
suffix="px"
|
|
37
|
+
onChange={(v) => triggerModel("height", v)}
|
|
38
|
+
/>
|
|
39
|
+
</Form.Item>
|
|
40
|
+
<Form.Item
|
|
41
|
+
layout="vertical"
|
|
24
42
|
label={
|
|
25
43
|
<>
|
|
26
44
|
Echarts 渲染脚本{" "}
|