bi-sdk-react 0.0.10 → 0.0.11

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.
@@ -1,5 +1,5 @@
1
1
  /*! For license information please see bi-sdk.umd.min.js.LICENSE.txt */
2
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@ant-design/icons"),require("echarts"),require("styled-components"),require("react"),require("antd"),require("uuid"),require("dayjs"),require("@monaco-editor/react")):"function"==typeof define&&define.amd?define(["@ant-design/icons","echarts","styled-components","react","antd","uuid","dayjs","@monaco-editor/react"],t):"object"==typeof exports?exports.BiSdk=t(require("@ant-design/icons"),require("echarts"),require("styled-components"),require("react"),require("antd"),require("uuid"),require("dayjs"),require("@monaco-editor/react")):e.BiSdk=t(e["@ant-design/icons"],e.echarts,e["styled-components"],e.react,e.antd,e.uuid,e.dayjs,e["@monaco-editor/react"])}(this,(e,t,l,n,r,a,i,o)=>(()=>{var s={290(e,t,l){"use strict";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){"use strict";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){"use strict";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){"use strict";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){"use strict";var n=l(155),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){"use strict";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()}}},375(t){"use strict";t.exports=e},247(e){"use strict";e.exports=o},59(e){"use strict";e.exports=r},185(e){"use strict";e.exports=i},190(e){"use strict";e.exports=t},155(e){"use strict";e.exports=n},694(e){"use strict";e.exports=l},315(e){"use strict";e.exports=a}},d={};function c(e){var t=d[e];if(void 0!==t)return t.exports;var l=d[e]={exports:{}};return s[e].call(l.exports,l,l.exports,c),l.exports}c.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return c.d(t,{a:t}),t},c.d=(e,t)=>{for(var l in t)c.o(t,l)&&!c.o(e,l)&&Object.defineProperty(e,l,{enumerable:!0,get:t[l]})},c.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),c.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var u={};return(()=>{"use strict";c.r(u),c.d(u,{EnvContext:()=>ex,PageCanvas:()=>ev,PageSchema:()=>o.PageSchema,PageContext:()=>eo,PageDesigner:()=>tu,PluginType:()=>o.PluginType,plugins:()=>tO,PropEditorProps:()=>s.PropEditorProps,PageProvider:()=>es,handleCallback:()=>ez,DropContainer:()=>em});var e,t,l,n,r,a,i,o={};c.r(o),c.d(o,{P:()=>tp});var s={};c.r(s);var d=c(848),p=c(155),m=c.n(p),x=c(694),h=c.n(x);function f(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 g(e,t){if(e){if("string"==typeof e)return f(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)?f(e,t):void 0}}function v(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)||g(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 j=c(951),y="data-pdnd-honey-pot";function b(e){return e instanceof Element&&e.hasAttribute(y)}function w(e){var t=v(document.elementsFromPoint(e.x,e.y),2),l=t[0],n=t[1];return l?b(l)?null!=n?n:null:l:null}function C(e){return(C="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 S(e,t,l){var n;return(n=function(e,t){if("object"!=C(e)||!e)return e;var l=e[Symbol.toPrimitive];if(void 0!==l){var n=l.call(e,t||"default");if("object"!=C(n))return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==C(n)?n:n+"")in e)?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}function I(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 z(e){for(var t=1;t<arguments.length;t++){var l=null!=arguments[t]?arguments[t]:{};t%2?I(Object(l),!0).forEach(function(t){S(e,t,l[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(l)):I(Object(l)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(l,t))})}return e}function k(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 O(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 N(e){return function(e){if(Array.isArray(e))return f(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||g(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 T(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 R=T(function(){return navigator.userAgent.includes("Firefox")}),F=T(function(){var e=navigator.userAgent;return e.includes("AppleWebKit")&&!e.includes("Chrome")}),D={isLeavingWindow:Symbol("leaving"),isEnteringWindow:Symbol("entering")};if("undefined"!=typeof window&&F()){var E=A();(0,j.bindAll)(window,[{type:"dragstart",listener:function(){E.enterCount=0,E.isOverWindow=!0}},{type:"drop",listener:B},{type:"dragend",listener:B},{type:"dragenter",listener:function(e){E.isOverWindow||0!==E.enterCount||(e[D.isEnteringWindow]=!0),E.isOverWindow=!0,E.enterCount++}},{type:"dragleave",listener:function(e){E.enterCount--,E.isOverWindow&&0===E.enterCount&&(e[D.isLeavingWindow]=!0,E.isOverWindow=!1)}}],{capture:!0})}function A(){return{enterCount:0,isOverWindow:!1}}function B(){E=A()}function M(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 L=(e=function(e){return e()},t=[],l=null,(n=function(){for(var n=arguments.length,r=Array(n),a=0;a<n;a++)r[a]=arguments[a];t=r,l||(l=requestAnimationFrame(function(){l=null,e.apply(void 0,t)}))}).cancel=function(){l&&(cancelAnimationFrame(l),l=null)},n),P=(r=null,{schedule:function(e){r={frameId:requestAnimationFrame(function(){r=null,e()}),fn:e}},flush:function(){r&&(cancelAnimationFrame(r.frameId),r.fn(),r=null)}}),$={isActive:!1};function Y(){return!$.isActive}function H(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 q=function(e){var t=e.event,l=e.dragType,n=e.getDropTargetsOver,r=e.dispatchEvent;if(Y()){var a,i,o=function(e){var t=e.event,l=e.dragType,n=e.getDropTargetsOver,r=M(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});$.isActive=!0;var s={current:o};H({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}}),P.schedule(function(){a({eventName:"onDragStart",payload:{source:t,location:i}})})},dragUpdate:function(e){var n=e.current;P.flush(),L.cancel(),a({eventName:"onDropTargetChange",payload:{source:t,location:{initial:l,previous:r,current:n}}})},drag:function(e){var n=e.current;L(function(){P.flush(),a({eventName:"onDrag",payload:{source:t,location:{initial:l,previous:r,current:n}}})})},drop:function(e){var n=e.current,i=e.updatedSourcePayload;P.flush(),L.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,j.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&&(F()?!!F()&&t.hasOwnProperty(D.isLeavingWindow):null==n||(R()?"nodeName"in n&&n.ownerDocument!==document:n instanceof HTMLIFrameElement))})({dragLeave:e})&&(u({input:s.current.input,dropTargets:[]}),"external"===l.startedFrom&&m())}},{type:"drop",listener:function(e){(s.current={dropTargets:s.current.dropTargets,input:M(e)},s.current.dropTargets.length)?(e.preventDefault(),H({event:e,current:s.current.dropTargets}),d.drop({current:s.current,updatedSourcePayload:"external"===l.type?l.getDropPayload(e):null}),x()):m()}},{type:"dragend",listener:function(e){s.current={dropTargets:s.current.dropTargets,input:M(e)},m()}}].concat(N([{type:"pointermove",listener:(i=0,function(){i<20?i++:a()})},{type:"pointerdown",listener:a=m}])),{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=M(e),r=n({target:b(e.target)?w({x:t.clientX,y:t.clientY}):e.target,input:t,source:l.payload,current:s.current.dropTargets});r.length&&(e.preventDefault(),H({event:e,current:r})),u({dropTargets:r,input:t})}function m(){s.current.dropTargets.length&&u({dropTargets:[],input:s.current.input}),d.drop({current:s.current,updatedSourcePayload:null}),x()}function x(){$.isActive=!1,c()}},G=new Map;function U(){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 _(e,t){var l=t.attribute,n=t.value;return e.setAttribute(l,n),function(){return e.removeAttribute(l)}}function K(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 W(e){for(var t=1;t<arguments.length;t++){var l=null!=arguments[t]?arguments[t]:{};t%2?K(Object(l),!0).forEach(function(t){S(e,t,l[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(l)):K(Object(l)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(l,t))})}return e}function J(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 X(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)?X(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 X(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 V(e){return e.slice(0).reverse()}function Q(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 Z(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 ee=T(function(){return navigator.userAgent.toLocaleLowerCase().includes("android")}),et="text/plain",el=new WeakMap,en=(a=null,{bindEvents:function(){return a=null,(0,j.bind)(window,{type:"pointermove",listener:function(e){a={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,i,o,s=n.location.initial.input,d=null!=a?a:{x:s.clientX,y:s.clientY};(r=document.createElement("div")).setAttribute(y,"true"),i=k({client:d}),Object.assign(r.style,z(z({backgroundColor:"transparent",position:"fixed",padding:0,margin:0,boxSizing:"border-box"},O({clientRect:i})),{},{pointerEvents:"auto",zIndex:0x7fffffff})),document.body.appendChild(r),o=(0,j.bind)(window,{type:"pointermove",listener:function(e){i=k({client:{x:e.clientX,y:e.clientY}}),Object.assign(r.style,O({clientRect:i}))},options:{capture:!0}}),e=function(e){var t,l,n,a=e.current;if(o(),l=(t={client:a,clientRect:i}).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,j.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 c,u=n.location.current.input;null==(c=e)||c({current:{x:u.clientX,y:u.clientY}}),e=null,a=null}}}}),er=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 Q(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)?Q(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?Z(Object(l),!0).forEach(function(t){S(e,t,l[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(l)):Z(Object(l)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(l,t))})}return e}({},n);return e.add(r),l(r),T(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=J(r.location.current.dropTargets);try{for(a.s();!(t=a.n()).done;){var i,o=t.value,s=n.get(o.element),d=W(W({},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=J(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=W(W({},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 m,x=J(l.location.current.dropTargets);try{for(x.s();!(m=x.n()).done;){var h,f,g=m.value;if(!a.has(g.element)){var v=W(W({},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){x.e(e)}finally{x.f()}}};return{dropTargetForConsumers:function(e){return T(U(_(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,m=void 0===p?[]:p;if(null==c)return m;if(!(c instanceof Element))return c instanceof Node?e({source:d,target:c.parentElement,input:u,result:m}):m;var x=c.closest(a);if(null==x)return m;var h=n.get(x);if(null==h)return m;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:m});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(N(m),[j])})}({source:t,target:r,input:i});if(s.length>=o.length)return s;for(var d=V(o),c=V(s),u=[],p=0;p<d.length;p++){var m,x=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(x.element);if(!v)break;var j={input:i,source:t,element:v.element};if(v.canDrop&&!v.canDrop(j)||!(null!=(m=v.getIsSticky)&&m.call(v,j)))break;u.push(W(W({},x),{},{isActiveDueToStickiness:!0}))}return V(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){q({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=G.get(t);if(n)return n.usageCount++,n;var r={typeKey:t,unmount:l(),usageCount:1};return G.set(t,r),r}(e={typeKey:t,mount:function(){return l({canStart:Y,start:d})}}),function(){n.usageCount--,n.usageCount>0||(n.unmount(),G.delete(e.typeKey))}},dropTarget:o.dropTargetForConsumers,monitor:i.monitorForConsumers}}({typeKey:"element",defaultDropEffect:"move",mount:function(e){return U(en.bindEvents(),(0,j.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=el.get(s);if(d){var c=M(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=w({x:c.clientX,y:c.clientY});if(!d.dragHandle.contains(p))return void t.preventDefault()}var m=null!=(n=null==(r=d.getInitialDataForExternal)?void 0:r.call(d,u))?n:null;if(m)for(var x=0,h=Object.entries(m);x<h.length;x++){var f=v(h[x],2),g=f[0],j=f[1];t.dataTransfer.setData(g,null!=j?j:"")}!ee()||t.dataTransfer.types.includes(et)||t.dataTransfer.types.includes("text/uri-list")||t.dataTransfer.setData(et,"pdnd:android-fallback"),t.dataTransfer.setData("application/vnd.pdnd","");var y={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:y,startedFrom:"internal"}})}}}}}))},dispatchEventToSource:function(e){var t,l,n=e.eventName,r=e.payload;null==(t=el.get(r.source.element))||null==(l=t[n])||l.call(t,r)},onPostDispatch:en.getOnPostDispatch()}),ea=er.dropTarget;function ei(e){return T(U(er.registerUsage(),(el.set(e.element,e),function(){el.delete(e.element)}),_(e.element,{attribute:"draggable",value:"true"})))}er.monitor;let eo=(0,p.createContext)({pageId:"",designable:!1,plugins:[],schema:{info:{},datasources:[],scripts:[],variables:[],items:[]},selectedItem:null,setSchema:()=>{},setSelectedItem:()=>{},updateSelectedItem:()=>{},forceUpdate:()=>{},datasetSelector:void 0,fetch:void 0}),es=e=>{let{pageId:t,designable:l,plugins:n,schema:r,selectedItem:a,setSchema:i,setSelectedItem:o,datasetSelector:s,fetch:c,children:u}=e;return(0,d.jsx)(eo.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:c,forceUpdate:()=>{null==i||i({...r})}},children:u})},ed=e=>{var t;let{item:l,onDelete:n,parentList:r,onListChange:a,index:i}=e,{designable:o,selectedItem:s,setSelectedItem:c,plugins:u}=(0,p.useContext)(eo),[m,x]=(0,p.useState)(!1),h=null==(t=u.find(e=>e.key===l.type))?void 0:t.component;return((0,p.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,p.useEffect)(()=>{let e=document.getElementById(`page-item-${l.id}`);if(!e||!o)return;let t=ei({element:e,getInitialData:()=>({id:l.id,index:i,list:r,onListChange:a,data:l}),canDrag:()=>!!o,onDragStart:()=>{x(!0)},onDrop:()=>{x(!1)}}),n=e=>{e.stopPropagation(),c&&c(l)};return o&&e.addEventListener("click",n),()=>{t(),o&&e.removeEventListener("click",n)}},[o,l,i,r]),h)?(0,d.jsx)(h,{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:m?.5:1}}):null},ec=h().div`
2
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@ant-design/icons"),require("echarts"),require("styled-components"),require("react"),require("antd"),require("uuid"),require("dayjs"),require("@monaco-editor/react")):"function"==typeof define&&define.amd?define(["@ant-design/icons","echarts","styled-components","react","antd","uuid","dayjs","@monaco-editor/react"],t):"object"==typeof exports?exports.BiSdk=t(require("@ant-design/icons"),require("echarts"),require("styled-components"),require("react"),require("antd"),require("uuid"),require("dayjs"),require("@monaco-editor/react")):e.BiSdk=t(e["@ant-design/icons"],e.echarts,e["styled-components"],e.react,e.antd,e.uuid,e.dayjs,e["@monaco-editor/react"])}(this,(e,t,l,n,r,a,i,o)=>(()=>{var s={290(e,t,l){"use strict";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){"use strict";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){"use strict";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){"use strict";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){"use strict";var n=l(155),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){"use strict";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()}}},375(t){"use strict";t.exports=e},247(e){"use strict";e.exports=o},59(e){"use strict";e.exports=r},185(e){"use strict";e.exports=i},190(e){"use strict";e.exports=t},155(e){"use strict";e.exports=n},694(e){"use strict";e.exports=l},315(e){"use strict";e.exports=a}},d={};function c(e){var t=d[e];if(void 0!==t)return t.exports;var l=d[e]={exports:{}};return s[e].call(l.exports,l,l.exports,c),l.exports}c.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return c.d(t,{a:t}),t},c.d=(e,t)=>{for(var l in t)c.o(t,l)&&!c.o(e,l)&&Object.defineProperty(e,l,{enumerable:!0,get:t[l]})},c.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),c.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var u={};return(()=>{"use strict";c.r(u),c.d(u,{EnvContext:()=>ex,PageCanvas:()=>ev,PageSchema:()=>o.PageSchema,PageContext:()=>eo,PageDesigner:()=>tu,PluginType:()=>o.PluginType,plugins:()=>tO,PropEditorProps:()=>s.PropEditorProps,PageProvider:()=>es,handleCallback:()=>ez,DropContainer:()=>em});var e,t,l,n,r,a,i,o={};c.r(o),c.d(o,{P:()=>tp});var s={};c.r(s);var d=c(848),p=c(155),m=c.n(p),x=c(694),h=c.n(x);function f(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 g(e,t){if(e){if("string"==typeof e)return f(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)?f(e,t):void 0}}function v(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)||g(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 j=c(951),y="data-pdnd-honey-pot";function b(e){return e instanceof Element&&e.hasAttribute(y)}function w(e){var t=v(document.elementsFromPoint(e.x,e.y),2),l=t[0],n=t[1];return l?b(l)?null!=n?n:null:l:null}function C(e){return(C="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 S(e,t,l){var n;return(n=function(e,t){if("object"!=C(e)||!e)return e;var l=e[Symbol.toPrimitive];if(void 0!==l){var n=l.call(e,t||"default");if("object"!=C(n))return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==C(n)?n:n+"")in e)?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}function I(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 z(e){for(var t=1;t<arguments.length;t++){var l=null!=arguments[t]?arguments[t]:{};t%2?I(Object(l),!0).forEach(function(t){S(e,t,l[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(l)):I(Object(l)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(l,t))})}return e}function k(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 O(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 N(e){return function(e){if(Array.isArray(e))return f(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||g(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 T(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 R=T(function(){return navigator.userAgent.includes("Firefox")}),F=T(function(){var e=navigator.userAgent;return e.includes("AppleWebKit")&&!e.includes("Chrome")}),D={isLeavingWindow:Symbol("leaving"),isEnteringWindow:Symbol("entering")};if("undefined"!=typeof window&&F()){var E=A();(0,j.bindAll)(window,[{type:"dragstart",listener:function(){E.enterCount=0,E.isOverWindow=!0}},{type:"drop",listener:B},{type:"dragend",listener:B},{type:"dragenter",listener:function(e){E.isOverWindow||0!==E.enterCount||(e[D.isEnteringWindow]=!0),E.isOverWindow=!0,E.enterCount++}},{type:"dragleave",listener:function(e){E.enterCount--,E.isOverWindow&&0===E.enterCount&&(e[D.isLeavingWindow]=!0,E.isOverWindow=!1)}}],{capture:!0})}function A(){return{enterCount:0,isOverWindow:!1}}function B(){E=A()}function M(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 L=(e=function(e){return e()},t=[],l=null,(n=function(){for(var n=arguments.length,r=Array(n),a=0;a<n;a++)r[a]=arguments[a];t=r,l||(l=requestAnimationFrame(function(){l=null,e.apply(void 0,t)}))}).cancel=function(){l&&(cancelAnimationFrame(l),l=null)},n),P=(r=null,{schedule:function(e){r={frameId:requestAnimationFrame(function(){r=null,e()}),fn:e}},flush:function(){r&&(cancelAnimationFrame(r.frameId),r.fn(),r=null)}}),$={isActive:!1};function Y(){return!$.isActive}function H(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 _=function(e){var t=e.event,l=e.dragType,n=e.getDropTargetsOver,r=e.dispatchEvent;if(Y()){var a,i,o=function(e){var t=e.event,l=e.dragType,n=e.getDropTargetsOver,r=M(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});$.isActive=!0;var s={current:o};H({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}}),P.schedule(function(){a({eventName:"onDragStart",payload:{source:t,location:i}})})},dragUpdate:function(e){var n=e.current;P.flush(),L.cancel(),a({eventName:"onDropTargetChange",payload:{source:t,location:{initial:l,previous:r,current:n}}})},drag:function(e){var n=e.current;L(function(){P.flush(),a({eventName:"onDrag",payload:{source:t,location:{initial:l,previous:r,current:n}}})})},drop:function(e){var n=e.current,i=e.updatedSourcePayload;P.flush(),L.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,j.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&&(F()?!!F()&&t.hasOwnProperty(D.isLeavingWindow):null==n||(R()?"nodeName"in n&&n.ownerDocument!==document:n instanceof HTMLIFrameElement))})({dragLeave:e})&&(u({input:s.current.input,dropTargets:[]}),"external"===l.startedFrom&&m())}},{type:"drop",listener:function(e){(s.current={dropTargets:s.current.dropTargets,input:M(e)},s.current.dropTargets.length)?(e.preventDefault(),H({event:e,current:s.current.dropTargets}),d.drop({current:s.current,updatedSourcePayload:"external"===l.type?l.getDropPayload(e):null}),x()):m()}},{type:"dragend",listener:function(e){s.current={dropTargets:s.current.dropTargets,input:M(e)},m()}}].concat(N([{type:"pointermove",listener:(i=0,function(){i<20?i++:a()})},{type:"pointerdown",listener:a=m}])),{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=M(e),r=n({target:b(e.target)?w({x:t.clientX,y:t.clientY}):e.target,input:t,source:l.payload,current:s.current.dropTargets});r.length&&(e.preventDefault(),H({event:e,current:r})),u({dropTargets:r,input:t})}function m(){s.current.dropTargets.length&&u({dropTargets:[],input:s.current.input}),d.drop({current:s.current,updatedSourcePayload:null}),x()}function x(){$.isActive=!1,c()}},q=new Map;function G(){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 U(e,t){var l=t.attribute,n=t.value;return e.setAttribute(l,n),function(){return e.removeAttribute(l)}}function K(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 W(e){for(var t=1;t<arguments.length;t++){var l=null!=arguments[t]?arguments[t]:{};t%2?K(Object(l),!0).forEach(function(t){S(e,t,l[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(l)):K(Object(l)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(l,t))})}return e}function J(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 X(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)?X(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 X(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 V(e){return e.slice(0).reverse()}function Q(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 Z(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 ee=T(function(){return navigator.userAgent.toLocaleLowerCase().includes("android")}),et="text/plain",el=new WeakMap,en=(a=null,{bindEvents:function(){return a=null,(0,j.bind)(window,{type:"pointermove",listener:function(e){a={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,i,o,s=n.location.initial.input,d=null!=a?a:{x:s.clientX,y:s.clientY};(r=document.createElement("div")).setAttribute(y,"true"),i=k({client:d}),Object.assign(r.style,z(z({backgroundColor:"transparent",position:"fixed",padding:0,margin:0,boxSizing:"border-box"},O({clientRect:i})),{},{pointerEvents:"auto",zIndex:0x7fffffff})),document.body.appendChild(r),o=(0,j.bind)(window,{type:"pointermove",listener:function(e){i=k({client:{x:e.clientX,y:e.clientY}}),Object.assign(r.style,O({clientRect:i}))},options:{capture:!0}}),e=function(e){var t,l,n,a=e.current;if(o(),l=(t={client:a,clientRect:i}).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,j.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 c,u=n.location.current.input;null==(c=e)||c({current:{x:u.clientX,y:u.clientY}}),e=null,a=null}}}}),er=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 Q(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)?Q(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?Z(Object(l),!0).forEach(function(t){S(e,t,l[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(l)):Z(Object(l)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(l,t))})}return e}({},n);return e.add(r),l(r),T(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=J(r.location.current.dropTargets);try{for(a.s();!(t=a.n()).done;){var i,o=t.value,s=n.get(o.element),d=W(W({},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=J(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=W(W({},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 m,x=J(l.location.current.dropTargets);try{for(x.s();!(m=x.n()).done;){var h,f,g=m.value;if(!a.has(g.element)){var v=W(W({},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){x.e(e)}finally{x.f()}}};return{dropTargetForConsumers:function(e){return T(G(U(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,m=void 0===p?[]:p;if(null==c)return m;if(!(c instanceof Element))return c instanceof Node?e({source:d,target:c.parentElement,input:u,result:m}):m;var x=c.closest(a);if(null==x)return m;var h=n.get(x);if(null==h)return m;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:m});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(N(m),[j])})}({source:t,target:r,input:i});if(s.length>=o.length)return s;for(var d=V(o),c=V(s),u=[],p=0;p<d.length;p++){var m,x=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(x.element);if(!v)break;var j={input:i,source:t,element:v.element};if(v.canDrop&&!v.canDrop(j)||!(null!=(m=v.getIsSticky)&&m.call(v,j)))break;u.push(W(W({},x),{},{isActiveDueToStickiness:!0}))}return V(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){_({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=q.get(t);if(n)return n.usageCount++,n;var r={typeKey:t,unmount:l(),usageCount:1};return q.set(t,r),r}(e={typeKey:t,mount:function(){return l({canStart:Y,start:d})}}),function(){n.usageCount--,n.usageCount>0||(n.unmount(),q.delete(e.typeKey))}},dropTarget:o.dropTargetForConsumers,monitor:i.monitorForConsumers}}({typeKey:"element",defaultDropEffect:"move",mount:function(e){return G(en.bindEvents(),(0,j.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=el.get(s);if(d){var c=M(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=w({x:c.clientX,y:c.clientY});if(!d.dragHandle.contains(p))return void t.preventDefault()}var m=null!=(n=null==(r=d.getInitialDataForExternal)?void 0:r.call(d,u))?n:null;if(m)for(var x=0,h=Object.entries(m);x<h.length;x++){var f=v(h[x],2),g=f[0],j=f[1];t.dataTransfer.setData(g,null!=j?j:"")}!ee()||t.dataTransfer.types.includes(et)||t.dataTransfer.types.includes("text/uri-list")||t.dataTransfer.setData(et,"pdnd:android-fallback"),t.dataTransfer.setData("application/vnd.pdnd","");var y={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:y,startedFrom:"internal"}})}}}}}))},dispatchEventToSource:function(e){var t,l,n=e.eventName,r=e.payload;null==(t=el.get(r.source.element))||null==(l=t[n])||l.call(t,r)},onPostDispatch:en.getOnPostDispatch()}),ea=er.dropTarget;function ei(e){return T(G(er.registerUsage(),(el.set(e.element,e),function(){el.delete(e.element)}),U(e.element,{attribute:"draggable",value:"true"})))}er.monitor;let eo=(0,p.createContext)({pageId:"",designable:!1,plugins:[],schema:{info:{},datasources:[],scripts:[],variables:[],items:[]},selectedItem:null,setSchema:()=>{},setSelectedItem:()=>{},updateSelectedItem:()=>{},forceUpdate:()=>{},datasetSelector:void 0,fetch:void 0}),es=e=>{let{pageId:t,designable:l,plugins:n,schema:r,selectedItem:a,setSchema:i,setSelectedItem:o,datasetSelector:s,fetch:c,children:u}=e;return(0,d.jsx)(eo.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:c,forceUpdate:()=>{null==i||i({...r})}},children:u})},ed=e=>{var t;let{item:l,onDelete:n,parentList:r,onListChange:a,index:i}=e,{designable:o,selectedItem:s,setSelectedItem:c,plugins:u}=(0,p.useContext)(eo),[m,x]=(0,p.useState)(!1),h=null==(t=u.find(e=>e.key===l.type))?void 0:t.component;return((0,p.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,p.useEffect)(()=>{let e=document.getElementById(`page-item-${l.id}`);if(!e||!o)return;let t=ei({element:e,getInitialData:()=>({id:l.id,index:i,list:r,onListChange:a,data:l}),canDrag:()=>!!o,onDragStart:()=>{x(!0)},onDrop:()=>{x(!1)}}),n=e=>{e.stopPropagation(),c&&c(l)};return o&&e.addEventListener("click",n),()=>{t(),o&&e.removeEventListener("click",n)}},[o,l,i,r]),h)?(0,d.jsx)(h,{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:m?.5:1}}):null},ec=h().div`
3
3
  position: absolute;
4
4
  background: #1890ff;
5
5
  pointer-events: none;
@@ -373,7 +373,7 @@
373
373
  .conversation-list li small {
374
374
  white-space: nowrap;
375
375
  }
376
- `,e$=[],eY="bi-design",eH=e=>{let t,l,n,r,a,i,o,{agentList:s=e$,headExtra:c,style:u={},onEffect:x}=e,{pageId:h,fetch:f}=(0,p.useContext)(eo);if(!f)return null;let[g,v]=(0,p.useState)(null),[j,y]=(0,p.useState)([]),[b,w]=(0,p.useState)([]),C=m().useRef(null),S=()=>{setTimeout(()=>{C.current&&C.current.scrollToBottom()},100)},I=()=>{v(null),w([])},z=async e=>{ey.Modal.confirm({title:"确认删除该对话吗?",okText:"确认",cancelText:"取消",onOk:async()=>{var t;await (null==(t=f.ai)?void 0:t.removeConversation(eY,h,e)),y(t=>t.filter(t=>t.id!==e)),w(t=>t.filter(t=>t.conversationId!==e)),g===e&&I()}})},k=async e=>{var t;v(e),y(t=>t.map(t=>({...t,isActived:t.id===e}))),w(await (null==(t=f.ai)?void 0:t.messageList(eY,h,e))||[])},O=async e=>{var t;let l={id:ek(),question:e.message,createdAt:new Date().toISOString(),files:e.files||[],agents:e.agents||[],sending:!0};w(e=>[...e,l]),S();let n=!g,{id:r,answer:a,createdAt:i,conversation:o}=await (null==(t=f.ai)?void 0:t.chat(eY,h,g,e));v((null==o?void 0:o.id)||""),y(e=>[n?o||{}:null,...e].filter(e=>null!==e)),Object.assign(l,{id:r,answer:a,createdAt:i,conversationId:(null==o?void 0:o.id)||"",sending:!1}),a.effect&&(null==x||x(a.effect)),w(e=>[...e]),S()},N=async e=>{var t;await (null==(t=f.ai)?void 0:t.removeMessage(eY,h,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=[],j.forEach(e=>{let s=new Date(e.createdAt);if(l(s,t))r.push(e);else if(l(s,n))a.push(e);else s.getFullYear()===t.getFullYear()&&s.getMonth()===t.getMonth()?i.push(e):o.push(e)}),[{title:"今天",items:r},{title:"昨天",items:a},{title:"本月内",items:i},{title:"很久以前",items:o}].filter(e=>e.items.length>0)),R=async()=>{try{var e,t;let l=await (null==(e=f.ai)?void 0:e.conversationList(eY,h));y(l||[]);let n=null==l?void 0:l.find(e=>e.isActived);if(n){v(n.id);let e=await (null==(t=f.ai)?void 0:t.messageList(eY,h,n.id));w(e||[])}}catch(e){console.error(e)}};return(0,p.useEffect)(()=>{R()},[f]),(0,p.useEffect)(()=>{S()},[]),(0,d.jsxs)(eP,{style:u,children:[(0,d.jsx)(eL,{title:"智能助理",extra:(0,d.jsxs)(ey.Space,{children:[(0,d.jsx)(ey.Tooltip,{title:"新对话",placement:"topRight",children:(0,d.jsx)("a",{onClick:I,children:(0,d.jsx)(ew,{type:"icon-chat-plus"})})}),(0,d.jsx)(ey.Dropdown,{trigger:["click"],styles:{root:{boxShadow:"var(--ant-box-shadow-drawer-up)",backgroundColor:"#ffffff",borderRadius:"var(--ant-border-radius)"}},popupRender:()=>(0,d.jsx)(eU,{children:T.map(e=>(0,d.jsxs)("div",{className:"group",children:[(0,d.jsx)("div",{className:"group-title",children:e.title}),(0,d.jsx)("ul",{className:"group-list",children:e.items.map(e=>(0,d.jsxs)("li",{className:e.isActived?"actived":"",children:[(0,d.jsx)("a",{onClick:()=>k(e.id),children:e.name}),(0,d.jsx)("small",{children:(0,d.jsx)("a",{onClick:()=>z(e.id),children:(0,d.jsx)(ej.DeleteOutlined,{})})})]},e.id))})]},e.title))}),placement:"topRight",children:(0,d.jsx)("a",{children:(0,d.jsx)(ej.HistoryOutlined,{})})}),c]}),style:{width:"initial"}}),(0,d.jsxs)("div",{className:"body",children:[(0,d.jsx)("div",{style:{flex:"1 1 auto",overflowY:"auto"},children:b.length?(0,d.jsx)(eK,{ref:C,list:b,onDeleteMessage:N}):(0,d.jsx)(eG,{})}),0===b.length&&j.length>0&&(0,d.jsx)(ey.Card,{title:"历史记录",size:"small",variant:"borderless",styles:{header:{padding:0,border:"none"},body:{padding:0}},style:{padding:"12px 12px 0 12px"},children:(0,d.jsx)("ul",{className:"conversation-list",children:j.slice(0,3).map(e=>(0,d.jsxs)("li",{children:[(0,d.jsxs)("a",{children:[(0,d.jsx)(ej.MessageOutlined,{}),e.name]}),(0,d.jsx)("small",{children:eO(e.createdAt)})]},e.id))})}),(0,d.jsx)(eB,{agentList:s,style:{padding:12},onUploading:null==f?void 0:f.upload,onSubmit:O})]})]})},eq=h().div`
376
+ `,e$=[],eY="bi-design",eH=e=>{let t,l,n,r,a,i,o,{agentList:s=e$,headExtra:c,style:u={},onEffect:x}=e,{pageId:h,fetch:f}=(0,p.useContext)(eo);if(!f)return null;let[g,v]=(0,p.useState)(null),[j,y]=(0,p.useState)([]),[b,w]=(0,p.useState)([]),C=m().useRef(null),S=()=>{setTimeout(()=>{C.current&&C.current.scrollToBottom()},100)},I=()=>{v(null),w([])},z=async e=>{ey.Modal.confirm({title:"确认删除该对话吗?",okText:"确认",cancelText:"取消",onOk:async()=>{var t;await (null==(t=f.ai)?void 0:t.removeConversation(eY,h,e)),y(t=>t.filter(t=>t.id!==e)),w(t=>t.filter(t=>t.conversationId!==e)),g===e&&I()}})},k=async e=>{var t;v(e),y(t=>t.map(t=>({...t,isActived:t.id===e}))),w(await (null==(t=f.ai)?void 0:t.messageList(eY,h,e))||[])},O=async e=>{var t;let l={id:ek(),question:e.message,createdAt:new Date().toISOString(),files:e.files||[],agents:e.agents||[],sending:!0};w(e=>[...e,l]),S();let n=!g,{id:r,answer:a,createdAt:i,conversation:o}=await (null==(t=f.ai)?void 0:t.chat(eY,h,g,e));v((null==o?void 0:o.id)||""),y(e=>[n?o||{}:null,...e].filter(e=>null!==e)),Object.assign(l,{id:r,answer:a,createdAt:i,conversationId:(null==o?void 0:o.id)||"",sending:!1}),a.effect&&(null==x||x(a.effect)),w(e=>[...e]),S()},N=async e=>{var t;await (null==(t=f.ai)?void 0:t.removeMessage(eY,h,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=[],j.forEach(e=>{let s=new Date(e.createdAt);if(l(s,t))r.push(e);else if(l(s,n))a.push(e);else s.getFullYear()===t.getFullYear()&&s.getMonth()===t.getMonth()?i.push(e):o.push(e)}),[{title:"今天",items:r},{title:"昨天",items:a},{title:"本月内",items:i},{title:"很久以前",items:o}].filter(e=>e.items.length>0)),R=async()=>{try{var e,t;let l=await (null==(e=f.ai)?void 0:e.conversationList(eY,h));y(l||[]);let n=null==l?void 0:l.find(e=>e.isActived);if(n){v(n.id);let e=await (null==(t=f.ai)?void 0:t.messageList(eY,h,n.id));w(e||[])}}catch(e){console.error(e)}};return(0,p.useEffect)(()=>{R()},[f]),(0,p.useEffect)(()=>{S()},[]),(0,d.jsxs)(eP,{style:u,children:[(0,d.jsx)(eL,{title:"智能助理",extra:(0,d.jsxs)(ey.Space,{children:[(0,d.jsx)(ey.Tooltip,{title:"新对话",placement:"topRight",children:(0,d.jsx)("a",{onClick:I,children:(0,d.jsx)(ew,{type:"icon-chat-plus"})})}),(0,d.jsx)(ey.Dropdown,{trigger:["click"],styles:{root:{boxShadow:"var(--ant-box-shadow-drawer-up)",backgroundColor:"#ffffff",borderRadius:"var(--ant-border-radius)"}},popupRender:()=>(0,d.jsx)(eG,{children:T.map(e=>(0,d.jsxs)("div",{className:"group",children:[(0,d.jsx)("div",{className:"group-title",children:e.title}),(0,d.jsx)("ul",{className:"group-list",children:e.items.map(e=>(0,d.jsxs)("li",{className:e.isActived?"actived":"",children:[(0,d.jsx)("a",{onClick:()=>k(e.id),children:e.name}),(0,d.jsx)("small",{children:(0,d.jsx)("a",{onClick:()=>z(e.id),children:(0,d.jsx)(ej.DeleteOutlined,{})})})]},e.id))})]},e.title))}),placement:"topRight",children:(0,d.jsx)("a",{children:(0,d.jsx)(ej.HistoryOutlined,{})})}),c]}),style:{width:"initial"}}),(0,d.jsxs)("div",{className:"body",children:[(0,d.jsx)("div",{style:{flex:"1 1 auto",overflowY:"auto"},children:b.length?(0,d.jsx)(eK,{ref:C,list:b,onDeleteMessage:N}):(0,d.jsx)(eq,{})}),0===b.length&&j.length>0&&(0,d.jsx)(ey.Card,{title:"历史记录",size:"small",variant:"borderless",styles:{header:{padding:0,border:"none"},body:{padding:0}},style:{padding:"12px 12px 0 12px"},children:(0,d.jsx)("ul",{className:"conversation-list",children:j.slice(0,3).map(e=>(0,d.jsxs)("li",{children:[(0,d.jsxs)("a",{children:[(0,d.jsx)(ej.MessageOutlined,{}),e.name]}),(0,d.jsx)("small",{children:eO(e.createdAt)})]},e.id))})}),(0,d.jsx)(eB,{agentList:s,style:{padding:12},onUploading:null==f?void 0:f.upload,onSubmit:O})]})]})},e_=h().div`
377
377
  flex: 1 1 auto;
378
378
  display: flex;
379
379
  align-items: center;
@@ -411,7 +411,7 @@
411
411
  font-size: 14px;
412
412
  color: var(--ant-color-text-secondary);
413
413
  }
414
- `,eG=()=>(0,d.jsx)(eq,{children:(0,d.jsxs)("div",{className:"content",children:[(0,d.jsx)("div",{className:"logo",children:(0,d.jsx)(ew,{type:"icon-ai-compute",style:{fontSize:60}})}),(0,d.jsx)("div",{className:"title",children:"与 智能助理 协作"}),(0,d.jsx)("div",{className:"desc",children:"自动化执行常规开发任务,端到端高效完成,提高交付效率"})]})}),eU=h().div`
414
+ `,eq=()=>(0,d.jsx)(e_,{children:(0,d.jsxs)("div",{className:"content",children:[(0,d.jsx)("div",{className:"logo",children:(0,d.jsx)(ew,{type:"icon-ai-compute",style:{fontSize:60}})}),(0,d.jsx)("div",{className:"title",children:"与 智能助理 协作"}),(0,d.jsx)("div",{className:"desc",children:"自动化执行常规开发任务,端到端高效完成,提高交付效率"})]})}),eG=h().div`
415
415
  width: 260px;
416
416
  padding: 8px;
417
417
  .group {
@@ -456,32 +456,13 @@
456
456
  .group-list li small a {
457
457
  color: var(--ant-color-error);
458
458
  }
459
- `,e_=h().div`
459
+ `,eU=h().div`
460
460
  height: 100%;
461
461
  display: flex;
462
462
  flex-direction: column;
463
463
  gap: 12px;
464
464
  padding-right: 8px;
465
- overflow: auto;
466
- scrollbar-width: none;
467
- &::-webkit-scrollbar {
468
- width: 0;
469
- height: 0;
470
- }
471
- &:hover {
472
- scrollbar-width: thin;
473
- }
474
- &:hover::-webkit-scrollbar {
475
- width: 8px;
476
- height: 8px;
477
- }
478
- &:hover::-webkit-scrollbar-thumb {
479
- background: var(--ant-color-border);
480
- border-radius: 4px;
481
- }
482
- &:hover::-webkit-scrollbar-track {
483
- background: transparent;
484
- }
465
+
485
466
  .msg {
486
467
  display: flex;
487
468
  flex-direction: column;
@@ -600,7 +581,7 @@
600
581
  }
601
582
  }
602
583
  }
603
- `,eK=(0,p.forwardRef)((e,t)=>{let{list:l,onDeleteMessage:n}=e,r=(0,p.useRef)(null),a=()=>{setTimeout(()=>{r.current&&(r.current.scrollTop=r.current.scrollHeight)},100)};return(0,p.useImperativeHandle)(t,()=>({scrollToBottom:a})),(0,d.jsx)(e_,{className:"message-list",ref:r,children:l.map(e=>{var t,l,r,a,i,o,s,c,u;return(0,d.jsxs)("div",{className:"msg",children:[(0,d.jsxs)("div",{className:"user-message",children:[(0,d.jsx)(ey.Space,{size:4,orientation:"vertical",className:"msg-tools",children:(0,d.jsx)(ey.Popconfirm,{title:"确认删除吗?",okText:"确认",cancelText:"取消",onConfirm:()=>n(e.id),children:(0,d.jsx)(ey.Tooltip,{title:"删除",children:(0,d.jsx)(ey.Button,{type:"link",size:"small",icon:(0,d.jsx)(ej.DeleteOutlined,{})})})})}),(0,d.jsx)("div",{className:"msg-header",children:(0,d.jsx)("span",{children:eO(e.createdAt)})}),(0,d.jsxs)("div",{className:"msg-section",children:[(0,d.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,d.jsxs)("div",{className:"msg-meta",children:[null==(r=e.files)?void 0:r.map(e=>(0,d.jsxs)(ey.Tag,{color:"processing",children:[(0,d.jsx)(ew,{type:"icon-paper-clip"})," ",e.name]},e.id)),null==(a=e.agents)?void 0:a.map(e=>(0,d.jsxs)(ey.Tag,{color:"blue",children:[(0,d.jsx)(ew,{type:"icon-at"})," ",e.name]},e.id))]}):null]})]}),(0,d.jsxs)("div",{className:"assistant-message",children:[(0,d.jsx)("div",{className:"msg-header",children:(0,d.jsxs)("span",{className:"msg-title",children:[(0,d.jsx)(ej.RobotOutlined,{})," 智能助理"]})}),(0,d.jsx)("div",{className:"msg-section",children:e.sending?(0,d.jsx)(ey.Skeleton,{active:!0}):(0,d.jsxs)(d.Fragment,{children:[(0,d.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,d.jsxs)("details",{className:"msg-ai-meta",open:!0,children:[(0,d.jsx)("summary",{className:"msg-ai-meta-title",children:"PLANS:"}),(0,d.jsx)("div",{className:"msg-ai-meta-list",children:e.answer.plans.map((e,t)=>(0,d.jsx)(ey.Tooltip,{title:e.description,children:(0,d.jsx)(ey.Tag,{color:"blue",children:e.name})},t))})]}),!!(null==(u=e.answer)||null==(c=u.extra)?void 0:c.length)&&(0,d.jsxs)("details",{className:"msg-ai-meta",open:!0,children:[(0,d.jsx)("summary",{className:"msg-ai-meta-title",children:"ACTIONS:"}),(0,d.jsx)("div",{className:"msg-ai-meta-list vertical",children:e.answer.extra.map((e,t)=>(0,d.jsxs)("div",{className:"msg-ai-meta-list-item",children:[(0,d.jsx)(ey.Tag,{color:"gold",children:e.element}),(0,d.jsx)("span",{children:e.action})]},t))})]})]})})]})]},e.id)})})}),eW=h().div`
584
+ `,eK=(0,p.forwardRef)((e,t)=>{let{list:l,onDeleteMessage:n}=e,r=(0,p.useRef)(null),a=()=>{setTimeout(()=>{r.current&&(r.current.scrollTop=r.current.scrollHeight)},100)};return(0,p.useImperativeHandle)(t,()=>({scrollToBottom:a})),(0,d.jsx)(eU,{className:"message-list beautified_scrollbar",ref:r,children:l.map(e=>{var t,l,r,a,i,o,s,c,u;return(0,d.jsxs)("div",{className:"msg",children:[(0,d.jsxs)("div",{className:"user-message",children:[(0,d.jsx)(ey.Space,{size:4,orientation:"vertical",className:"msg-tools",children:(0,d.jsx)(ey.Popconfirm,{title:"确认删除吗?",okText:"确认",cancelText:"取消",onConfirm:()=>n(e.id),children:(0,d.jsx)(ey.Tooltip,{title:"删除",children:(0,d.jsx)(ey.Button,{type:"link",size:"small",icon:(0,d.jsx)(ej.DeleteOutlined,{})})})})}),(0,d.jsx)("div",{className:"msg-header",children:(0,d.jsx)("span",{children:eO(e.createdAt)})}),(0,d.jsxs)("div",{className:"msg-section",children:[(0,d.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,d.jsxs)("div",{className:"msg-meta",children:[null==(r=e.files)?void 0:r.map(e=>(0,d.jsxs)(ey.Tag,{color:"processing",children:[(0,d.jsx)(ew,{type:"icon-paper-clip"})," ",e.name]},e.id)),null==(a=e.agents)?void 0:a.map(e=>(0,d.jsxs)(ey.Tag,{color:"blue",children:[(0,d.jsx)(ew,{type:"icon-at"})," ",e.name]},e.id))]}):null]})]}),(0,d.jsxs)("div",{className:"assistant-message",children:[(0,d.jsx)("div",{className:"msg-header",children:(0,d.jsxs)("span",{className:"msg-title",children:[(0,d.jsx)(ej.RobotOutlined,{})," 智能助理"]})}),(0,d.jsx)("div",{className:"msg-section",children:e.sending?(0,d.jsx)(ey.Skeleton,{active:!0}):(0,d.jsxs)(d.Fragment,{children:[(0,d.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,d.jsxs)("details",{className:"msg-ai-meta",open:!0,children:[(0,d.jsx)("summary",{className:"msg-ai-meta-title",children:"PLANS:"}),(0,d.jsx)("div",{className:"msg-ai-meta-list",children:e.answer.plans.map((e,t)=>(0,d.jsx)(ey.Tooltip,{title:e.description,children:(0,d.jsx)(ey.Tag,{color:"blue",children:e.name})},t))})]}),!!(null==(u=e.answer)||null==(c=u.extra)?void 0:c.length)&&(0,d.jsxs)("details",{className:"msg-ai-meta",open:!0,children:[(0,d.jsx)("summary",{className:"msg-ai-meta-title",children:"ACTIONS:"}),(0,d.jsx)("div",{className:"msg-ai-meta-list vertical",children:e.answer.extra.map((e,t)=>(0,d.jsxs)("div",{className:"msg-ai-meta-list-item",children:[(0,d.jsx)(ey.Tag,{color:"gold",children:e.element}),(0,d.jsx)("span",{children:e.action})]},t))})]})]})})]})]},e.id)})})}),eW=h().div`
604
585
  display: flex;
605
586
  flex-direction: column;
606
587
  height: 100%;
@@ -639,7 +620,7 @@
639
620
  font-size: 16px;
640
621
  color: var(--ant-color-text-secondary);
641
622
  }
642
- `,eJ=e=>{let{}=e,{schema:t,selectedItem:l,setSelectedItem:n,plugins:r,forceUpdate:a}=(0,p.useContext)(eo),i=(0,p.useMemo)(()=>(r||[]).reduce((e,t)=>(e[t.key]=t,e),{}),[r]),o=(0,p.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]),s=(0,p.useMemo)(()=>o.reduce((e,t)=>(t.id&&(e[t.id]=t),e),{}),[o]),c=e=>{l&&(n(Object.assign(l,{cascadeIds:e})),a())};return(0,d.jsxs)(eW,{className:"cascade-panel",children:[(0,d.jsx)(eL,{title:"联动",extra:(null==l?void 0:l.cascadeIds)?(0,d.jsx)(ey.Space,{children:(0,d.jsx)(ey.Dropdown,{menu:{onClick:e=>{let{key:t}=e,n=[...(null==l?void 0:l.cascadeIds)||[]];n.push(String(t)),c&&c(n)},items:o.map(e=>{var t,l;return{key:e.id,label:(0,d.jsxs)("a",{children:[(0,d.jsx)(ew,{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,d.jsxs)("a",{className:"toolbar",children:[(0,d.jsx)(ej.PlusOutlined,{}),(0,d.jsx)(ej.CaretDownOutlined,{style:{fontSize:8,verticalAlign:"sub"}})]})})}):null}),(0,d.jsx)("div",{className:"body",children:(null==l?void 0:l.cascadeIds)&&(0,d.jsx)("ul",{children:(l.cascadeIds||[]).map((e,t)=>{var n,r,a,o,u;return(0,d.jsxs)("li",{children:[(0,d.jsxs)("div",{children:[(0,d.jsx)(ew,{type:null==(n=i[null==(r=s[e])?void 0:r.type])?void 0:n.icon})," ",(null==(a=s[e])?void 0:a.name)||(null==(o=i[null==(u=s[e])?void 0:u.type])?void 0:o.label)," (",e,")"]}),(0,d.jsx)(ey.Popconfirm,{title:"确认删除吗?",okText:"确认",cancelText:"取消",onConfirm:()=>{let e=[...l.cascadeIds||[]];e.splice(t,1),c&&c(e)},children:(0,d.jsx)("a",{children:(0,d.jsx)(ej.DeleteOutlined,{})})})]},e)})})})]})};var eX=c(247),eV=c.n(eX),eQ=c(965),eZ=c.n(eQ);let e0=()=>{let{schema:e}=(0,p.useContext)(eo),t=(0,p.useMemo)(()=>JSON.stringify(e||{},null,2),[e]);return(0,d.jsxs)("div",{className:"code-panel",style:{display:"flex",flexDirection:"column",height:"100%"},children:[(0,d.jsx)(eL,{title:"代码",extra:(0,d.jsx)(ey.Space,{children:(0,d.jsx)(ey.Tooltip,{title:"复制到剪切板",children:(0,d.jsx)("a",{className:"toolbar",onClick:()=>{eZ()(t||"")&&ey.message.success("复制成功")},children:(0,d.jsx)(ej.CopyOutlined,{})})})})}),(0,d.jsx)("div",{className:"body",style:{flex:"1 1 auto",display:"flex"},children:(0,d.jsx)(eV(),{height:"100%",defaultLanguage:"json",value:t,options:{lineNumbers:"off",readOnly:!0,minimap:{enabled:!1}}})})]})},e1=h().div`
623
+ `,eJ=e=>{let{}=e,{schema:t,selectedItem:l,setSelectedItem:n,plugins:r,forceUpdate:a}=(0,p.useContext)(eo),i=(0,p.useMemo)(()=>(r||[]).reduce((e,t)=>(e[t.key]=t,e),{}),[r]),o=(0,p.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]),s=(0,p.useMemo)(()=>o.reduce((e,t)=>(t.id&&(e[t.id]=t),e),{}),[o]),c=e=>{l&&(n(Object.assign(l,{cascadeIds:e})),a())};return(0,d.jsxs)(eW,{className:"cascade-panel",children:[(0,d.jsx)(eL,{title:"联动",extra:(null==l?void 0:l.cascadeIds)?(0,d.jsx)(ey.Space,{children:(0,d.jsx)(ey.Dropdown,{menu:{onClick:e=>{let{key:t}=e,n=[...(null==l?void 0:l.cascadeIds)||[]];n.push(String(t)),c&&c(n)},items:o.map(e=>{var t,l;return{key:e.id,label:(0,d.jsxs)("a",{children:[(0,d.jsx)(ew,{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,d.jsxs)("a",{className:"toolbar",children:[(0,d.jsx)(ej.PlusOutlined,{}),(0,d.jsx)(ej.CaretDownOutlined,{style:{fontSize:8,verticalAlign:"sub"}})]})})}):null}),(0,d.jsx)("div",{className:"body beautified_scrollbar",children:(null==l?void 0:l.cascadeIds)&&(0,d.jsx)("ul",{children:(l.cascadeIds||[]).map((e,t)=>{var n,r,a,o,u;return(0,d.jsxs)("li",{children:[(0,d.jsxs)("div",{children:[(0,d.jsx)(ew,{type:null==(n=i[null==(r=s[e])?void 0:r.type])?void 0:n.icon})," ",(null==(a=s[e])?void 0:a.name)||(null==(o=i[null==(u=s[e])?void 0:u.type])?void 0:o.label)," (",e,")"]}),(0,d.jsx)(ey.Popconfirm,{title:"确认删除吗?",okText:"确认",cancelText:"取消",onConfirm:()=>{let e=[...l.cascadeIds||[]];e.splice(t,1),c&&c(e)},children:(0,d.jsx)("a",{children:(0,d.jsx)(ej.DeleteOutlined,{})})})]},e)})})})]})};var eX=c(247),eV=c.n(eX),eQ=c(965),eZ=c.n(eQ);let e0=()=>{let{schema:e}=(0,p.useContext)(eo),t=(0,p.useMemo)(()=>JSON.stringify(e||{},null,2),[e]);return(0,d.jsxs)("div",{className:"code-panel",style:{display:"flex",flexDirection:"column",height:"100%"},children:[(0,d.jsx)(eL,{title:"代码",extra:(0,d.jsx)(ey.Space,{children:(0,d.jsx)(ey.Tooltip,{title:"复制到剪切板",children:(0,d.jsx)("a",{className:"toolbar",onClick:()=>{eZ()(t||"")&&ey.message.success("复制成功")},children:(0,d.jsx)(ej.CopyOutlined,{})})})})}),(0,d.jsx)("div",{className:"body",style:{flex:"1 1 auto",display:"flex"},children:(0,d.jsx)(eV(),{height:"100%",defaultLanguage:"json",value:t,options:{lineNumbers:"off",readOnly:!0,minimap:{enabled:!1}}})})]})},e1=h().div`
643
624
  display: flex;
644
625
  flex-direction: column;
645
626
  height: 100%;
@@ -681,7 +662,7 @@
681
662
  overflow: hidden;
682
663
  font-size: 12px;
683
664
  }
684
- `,e2=e=>{let{plugin:t}=e,l=(0,p.useRef)(null);return(0,p.useEffect)(()=>{let e=l.current;if(!e)return;let n=ei({element:e,getInitialData:()=>{let e={id:ek(),type:t.key,name:t.label,...JSON.parse(JSON.stringify(t.defaultOptions||{}))};return{id:e.id,data:e}},canDrag:()=>!0,onDragStart:()=>{},onDrop:()=>{}});return()=>n()},[]),(0,d.jsxs)("div",{className:"plugin drag-move",ref:l,children:[(0,d.jsx)(ew,{className:"icon",type:t.icon}),(0,d.jsx)("div",{className:"label",children:t.label})]})},e4=()=>{let{plugins:e}=(0,p.useContext)(eo),t=(0,p.useMemo)(()=>{let t=[];return e.forEach(e=>{let l=t.find(t=>t.group===e.group);l?l.items.push(e):t.push({group:e.group,items:[e]})}),t},[e]);return(0,d.jsxs)(e1,{className:"component-panel",children:[(0,d.jsx)(eL,{title:"组件库"}),(0,d.jsx)("div",{className:"body",children:t.map(e=>(0,d.jsxs)("div",{className:"plugin-group",children:[(0,d.jsx)("div",{className:"group-title",children:e.group}),(0,d.jsx)("div",{className:"plugin-list",children:e.items.map(e=>(0,d.jsx)(e2,{plugin:e},e.key))})]},e.group))})]})},e8=h().div`
665
+ `,e2=e=>{let{plugin:t}=e,l=(0,p.useRef)(null);return(0,p.useEffect)(()=>{let e=l.current;if(!e)return;let n=ei({element:e,getInitialData:()=>{let e={id:ek(),type:t.key,name:t.label,...JSON.parse(JSON.stringify(t.defaultOptions||{}))};return{id:e.id,data:e}},canDrag:()=>!0,onDragStart:()=>{},onDrop:()=>{}});return()=>n()},[]),(0,d.jsxs)("div",{className:"plugin drag-move",ref:l,children:[(0,d.jsx)(ew,{className:"icon",type:t.icon}),(0,d.jsx)("div",{className:"label",children:t.label})]})},e4=()=>{let{plugins:e}=(0,p.useContext)(eo),t=(0,p.useMemo)(()=>{let t=[];return e.forEach(e=>{let l=t.find(t=>t.group===e.group);l?l.items.push(e):t.push({group:e.group,items:[e]})}),t},[e]);return(0,d.jsxs)(e1,{className:"component-panel",children:[(0,d.jsx)(eL,{title:"组件库"}),(0,d.jsx)("div",{className:"body beautified_scrollbar",children:t.map(e=>(0,d.jsxs)("div",{className:"plugin-group",children:[(0,d.jsx)("div",{className:"group-title",children:e.group}),(0,d.jsx)("div",{className:"plugin-list",children:e.items.map(e=>(0,d.jsx)(e2,{plugin:e},e.key))})]},e.group))})]})},e8=h().div`
685
666
  display: flex;
686
667
  flex-direction: column;
687
668
  height: 100%;
@@ -718,7 +699,7 @@
718
699
  .margin-bottom-0 {
719
700
  margin-bottom: 0;
720
701
  }
721
- `,e5=()=>{let{schema:e,setSchema:t}=(0,p.useContext)(eo),[l,n]=(0,p.useState)(!1),[r,a]=(0,p.useState)(!1),[i,o]=(0,p.useState)(-1),[s,c]=(0,p.useState)({id:ek(),type:"api",name:"",url:"",method:"GET",headers:[],formData:[],body:""}),[u,m]=(0,p.useState)({id:ek(),type:"sql",name:"",query:""}),x=(0,p.useMemo)(()=>e.datasources,[e.datasources]),h=l=>{t({...e,datasources:l})},f=[{title:"键",dataIndex:"name",render:(e,t,l)=>(0,d.jsx)(ey.Input,{size:"small",value:t.name,onChange:e=>{let t=[...s.headers];t[l]={...t[l],name:e.target.value},c({...s,headers:t})}})},{title:"值",dataIndex:"value",render:(e,t,l)=>(0,d.jsx)(ey.Input,{size:"small",value:t.value,onChange:e=>{let t=[...s.headers];t[l]={...t[l],value:e.target.value},c({...s,headers:t})}})},{title:"操作",width:50,align:"center",render:(e,t,l)=>(0,d.jsx)(ey.Space,{children:(0,d.jsx)("a",{onClick:()=>{let e=[...s.headers];e.splice(l,1),c({...s,headers:e})},children:(0,d.jsx)(ej.DeleteOutlined,{})})})}];return(0,d.jsxs)(e8,{className:"datasource-panel",children:[(0,d.jsx)(eL,{title:"数据源",extra:(0,d.jsx)(ey.Space,{children:(0,d.jsx)(ey.Dropdown,{menu:{onClick:e=>{let{key:t}=e;"api"===t?(o(-1),c({id:ek(),type:"api",name:"",url:"",method:"GET",headers:[],formData:[],body:""}),n(!0)):(o(-1),m({id:ek(),type:"sql",name:"",query:""}),a(!0))},items:[{key:"api",label:(0,d.jsx)("a",{children:"API接口"})},{key:"sql",label:(0,d.jsx)("a",{children:"SQL查询"})}]},placement:"bottom",children:(0,d.jsxs)("a",{className:"toolbar",children:[(0,d.jsx)(ej.PlusOutlined,{}),(0,d.jsx)(ej.CaretDownOutlined,{style:{fontSize:8,verticalAlign:"sub"}})]})})})}),(0,d.jsx)("div",{className:"body",children:(0,d.jsx)("ul",{children:x.map((e,t)=>(0,d.jsxs)("li",{children:[(0,d.jsxs)("div",{title:e.name,children:[(0,d.jsx)(ew,{type:"icon-drag"})," ",e.name]}),(0,d.jsxs)(ey.Space,{children:[(0,d.jsx)("a",{onClick:()=>{o(t),"api"===e.type?(c({...e}),n(!0)):(m({...e}),a(!0))},children:(0,d.jsx)(ej.EditOutlined,{})}),(0,d.jsx)(ey.Popconfirm,{title:"确认删除吗?",okText:"确认",cancelText:"取消",onConfirm:()=>{let e;(e=[...x]).splice(t,1),h&&h(e)},children:(0,d.jsx)("a",{children:(0,d.jsx)(ej.DeleteOutlined,{})})})]})]},e.id))})}),(0,d.jsx)(ey.Modal,{title:"添加API接口",open:l,width:600,styles:{body:{maxHeight:"calc(100vh - 250px)",overflow:"auto"}},onCancel:()=>n(!1),footer:(0,d.jsxs)(ey.Space,{children:[(0,d.jsx)(ey.Button,{type:"primary",onClick:()=>{if(!s.name||!s.url)return;let e=[...x];-1===i?e.push(s):e[i]=s,h&&h(e),n(!1)},children:"确定"}),(0,d.jsx)(ey.Button,{onClick:()=>n(!1),children:"取消"})]}),children:(0,d.jsxs)(ey.Form,{labelCol:{span:24},wrapperCol:{span:24},children:[(0,d.jsx)(ey.Form.Item,{label:"接口名称",required:!0,children:(0,d.jsx)(ey.Input,{value:s.name,onChange:e=>c({...s,name:e.target.value})})}),(0,d.jsx)(ey.Form.Item,{label:"接口URL",required:!0,children:(0,d.jsx)(ey.Input,{value:s.url,onChange:e=>c({...s,url:e.target.value})})}),(0,d.jsx)(ey.Form.Item,{label:"请求方法",children:(0,d.jsxs)(ey.Radio.Group,{value:s.method,onChange:e=>c({...s,method:e.target.value}),children:[(0,d.jsx)(ey.Radio.Button,{value:"GET",children:"GET"}),(0,d.jsx)(ey.Radio.Button,{value:"POST",children:"POST"}),(0,d.jsx)(ey.Radio.Button,{value:"PUT",children:"PUT"}),(0,d.jsx)(ey.Radio.Button,{value:"DELETE",children:"DELETE"})]})}),(0,d.jsx)("label",{style:{display:"block",color:"#000000d9",padding:"8px 0"},children:"请求头"}),(0,d.jsx)(ey.Table,{columns:f,dataSource:s.headers,pagination:!1,locale:{emptyText:"暂无数据"},size:"small",bordered:!0,rowKey:(e,t)=>String(t)}),(0,d.jsx)(ey.Button,{size:"small",block:!0,onClick:()=>c({...s,headers:[...s.headers,{name:"",value:""}]}),children:"添加"}),(0,d.jsx)("label",{style:{display:"block",color:"#000000d9",padding:"8px 0"},children:"表单数据"}),(0,d.jsx)(ey.Table,{columns:f,dataSource:s.formData,pagination:!1,locale:{emptyText:"暂无数据"},size:"small",bordered:!0,rowKey:(e,t)=>`f-${t}`}),(0,d.jsx)(ey.Button,{size:"small",block:!0,onClick:()=>c({...s,formData:[...s.formData,{name:"",value:""}]}),children:"添加"}),(0,d.jsx)(ey.Form.Item,{label:"请求体",children:(0,d.jsx)("div",{style:{border:"1px solid var(--ant-color-border)",borderRadius:"var(--ant-border-radius)",padding:1},children:(0,d.jsx)(eV(),{height:"300px",defaultLanguage:"json",value:s.body,onChange:e=>c({...s,body:e||""}),options:{minimap:{enabled:!1},scrollBeyondLastLine:!1,tabSize:2}})})})]})}),(0,d.jsx)(ey.Modal,{title:"添加SQL查询",open:r,width:600,styles:{body:{maxHeight:"calc(100vh - 250px)",overflow:"auto"}},onCancel:()=>a(!1),footer:(0,d.jsxs)(ey.Space,{children:[(0,d.jsx)(ey.Button,{type:"primary",onClick:()=>{if(!u.name||!u.query)return;let e=[...x];-1===i?e.push(u):e[i]=u,h&&h(e),a(!1)},children:"确定"}),(0,d.jsx)(ey.Button,{onClick:()=>a(!1),children:"取消"})]}),children:(0,d.jsxs)(ey.Form,{layout:"vertical",children:[(0,d.jsx)(ey.Form.Item,{label:"查询名称",required:!0,children:(0,d.jsx)(ey.Input,{value:u.name,onChange:e=>m({...u,name:e.target.value})})}),(0,d.jsx)(ey.Form.Item,{label:"查询语句",required:!0,children:(0,d.jsx)("div",{style:{border:"1px solid var(--ant-color-border)",borderRadius:"var(--ant-border-radius)",padding:1},children:(0,d.jsx)(eV(),{height:"300px",defaultLanguage:"sql",value:u.query,onChange:e=>m({...u,query:e||""}),options:{minimap:{enabled:!1},scrollBeyondLastLine:!1,tabSize:2}})})})]})})]})},e6=h().div`
702
+ `,e5=()=>{let{schema:e,setSchema:t}=(0,p.useContext)(eo),[l,n]=(0,p.useState)(!1),[r,a]=(0,p.useState)(!1),[i,o]=(0,p.useState)(-1),[s,c]=(0,p.useState)({id:ek(),type:"api",name:"",url:"",method:"GET",headers:[],formData:[],body:""}),[u,m]=(0,p.useState)({id:ek(),type:"sql",name:"",query:""}),x=(0,p.useMemo)(()=>e.datasources,[e.datasources]),h=l=>{t({...e,datasources:l})},f=[{title:"键",dataIndex:"name",render:(e,t,l)=>(0,d.jsx)(ey.Input,{size:"small",value:t.name,onChange:e=>{let t=[...s.headers];t[l]={...t[l],name:e.target.value},c({...s,headers:t})}})},{title:"值",dataIndex:"value",render:(e,t,l)=>(0,d.jsx)(ey.Input,{size:"small",value:t.value,onChange:e=>{let t=[...s.headers];t[l]={...t[l],value:e.target.value},c({...s,headers:t})}})},{title:"操作",width:50,align:"center",render:(e,t,l)=>(0,d.jsx)(ey.Space,{children:(0,d.jsx)("a",{onClick:()=>{let e=[...s.headers];e.splice(l,1),c({...s,headers:e})},children:(0,d.jsx)(ej.DeleteOutlined,{})})})}];return(0,d.jsxs)(e8,{className:"datasource-panel",children:[(0,d.jsx)(eL,{title:"数据源",extra:(0,d.jsx)(ey.Space,{children:(0,d.jsx)(ey.Dropdown,{menu:{onClick:e=>{let{key:t}=e;"api"===t?(o(-1),c({id:ek(),type:"api",name:"",url:"",method:"GET",headers:[],formData:[],body:""}),n(!0)):(o(-1),m({id:ek(),type:"sql",name:"",query:""}),a(!0))},items:[{key:"api",label:(0,d.jsx)("a",{children:"API接口"})},{key:"sql",label:(0,d.jsx)("a",{children:"SQL查询"})}]},placement:"bottom",children:(0,d.jsxs)("a",{className:"toolbar",children:[(0,d.jsx)(ej.PlusOutlined,{}),(0,d.jsx)(ej.CaretDownOutlined,{style:{fontSize:8,verticalAlign:"sub"}})]})})})}),(0,d.jsx)("div",{className:"body beautified_scrollbar",children:(0,d.jsx)("ul",{children:x.map((e,t)=>(0,d.jsxs)("li",{children:[(0,d.jsxs)("div",{title:e.name,children:[(0,d.jsx)(ew,{type:"icon-drag"})," ",e.name]}),(0,d.jsxs)(ey.Space,{children:[(0,d.jsx)("a",{onClick:()=>{o(t),"api"===e.type?(c({...e}),n(!0)):(m({...e}),a(!0))},children:(0,d.jsx)(ej.EditOutlined,{})}),(0,d.jsx)(ey.Popconfirm,{title:"确认删除吗?",okText:"确认",cancelText:"取消",onConfirm:()=>{let e;(e=[...x]).splice(t,1),h&&h(e)},children:(0,d.jsx)("a",{children:(0,d.jsx)(ej.DeleteOutlined,{})})})]})]},e.id))})}),(0,d.jsx)(ey.Modal,{title:"添加API接口",open:l,width:600,styles:{body:{maxHeight:"calc(100vh - 250px)",overflow:"auto"}},onCancel:()=>n(!1),footer:(0,d.jsxs)(ey.Space,{children:[(0,d.jsx)(ey.Button,{type:"primary",onClick:()=>{if(!s.name||!s.url)return;let e=[...x];-1===i?e.push(s):e[i]=s,h&&h(e),n(!1)},children:"确定"}),(0,d.jsx)(ey.Button,{onClick:()=>n(!1),children:"取消"})]}),children:(0,d.jsxs)(ey.Form,{labelCol:{span:24},wrapperCol:{span:24},children:[(0,d.jsx)(ey.Form.Item,{label:"接口名称",required:!0,children:(0,d.jsx)(ey.Input,{value:s.name,onChange:e=>c({...s,name:e.target.value})})}),(0,d.jsx)(ey.Form.Item,{label:"接口URL",required:!0,children:(0,d.jsx)(ey.Input,{value:s.url,onChange:e=>c({...s,url:e.target.value})})}),(0,d.jsx)(ey.Form.Item,{label:"请求方法",children:(0,d.jsxs)(ey.Radio.Group,{value:s.method,onChange:e=>c({...s,method:e.target.value}),children:[(0,d.jsx)(ey.Radio.Button,{value:"GET",children:"GET"}),(0,d.jsx)(ey.Radio.Button,{value:"POST",children:"POST"}),(0,d.jsx)(ey.Radio.Button,{value:"PUT",children:"PUT"}),(0,d.jsx)(ey.Radio.Button,{value:"DELETE",children:"DELETE"})]})}),(0,d.jsx)("label",{style:{display:"block",color:"#000000d9",padding:"8px 0"},children:"请求头"}),(0,d.jsx)(ey.Table,{columns:f,dataSource:s.headers,pagination:!1,locale:{emptyText:"暂无数据"},size:"small",bordered:!0,rowKey:(e,t)=>String(t)}),(0,d.jsx)(ey.Button,{size:"small",block:!0,onClick:()=>c({...s,headers:[...s.headers,{name:"",value:""}]}),children:"添加"}),(0,d.jsx)("label",{style:{display:"block",color:"#000000d9",padding:"8px 0"},children:"表单数据"}),(0,d.jsx)(ey.Table,{columns:f,dataSource:s.formData,pagination:!1,locale:{emptyText:"暂无数据"},size:"small",bordered:!0,rowKey:(e,t)=>`f-${t}`}),(0,d.jsx)(ey.Button,{size:"small",block:!0,onClick:()=>c({...s,formData:[...s.formData,{name:"",value:""}]}),children:"添加"}),(0,d.jsx)(ey.Form.Item,{label:"请求体",children:(0,d.jsx)("div",{style:{border:"1px solid var(--ant-color-border)",borderRadius:"var(--ant-border-radius)",padding:1},children:(0,d.jsx)(eV(),{height:"300px",defaultLanguage:"json",value:s.body,onChange:e=>c({...s,body:e||""}),options:{minimap:{enabled:!1},scrollBeyondLastLine:!1,tabSize:2}})})})]})}),(0,d.jsx)(ey.Modal,{title:"添加SQL查询",open:r,width:600,styles:{body:{maxHeight:"calc(100vh - 250px)",overflow:"auto"}},onCancel:()=>a(!1),footer:(0,d.jsxs)(ey.Space,{children:[(0,d.jsx)(ey.Button,{type:"primary",onClick:()=>{if(!u.name||!u.query)return;let e=[...x];-1===i?e.push(u):e[i]=u,h&&h(e),a(!1)},children:"确定"}),(0,d.jsx)(ey.Button,{onClick:()=>a(!1),children:"取消"})]}),children:(0,d.jsxs)(ey.Form,{layout:"vertical",children:[(0,d.jsx)(ey.Form.Item,{label:"查询名称",required:!0,children:(0,d.jsx)(ey.Input,{value:u.name,onChange:e=>m({...u,name:e.target.value})})}),(0,d.jsx)(ey.Form.Item,{label:"查询语句",required:!0,children:(0,d.jsx)("div",{style:{border:"1px solid var(--ant-color-border)",borderRadius:"var(--ant-border-radius)",padding:1},children:(0,d.jsx)(eV(),{height:"300px",defaultLanguage:"sql",value:u.query,onChange:e=>m({...u,query:e||""}),options:{minimap:{enabled:!1},scrollBeyondLastLine:!1,tabSize:2}})})})]})})]})},e6=h().div`
722
703
  display: flex;
723
704
  flex-direction: column;
724
705
  height: 100%;
@@ -740,7 +721,7 @@
740
721
  overflow: hidden;
741
722
  text-overflow: ellipsis;
742
723
  }
743
- `,e3=()=>{let{schema:e,setSchema:t,selectedItem:l,setSelectedItem:n,plugins:r}=(0,p.useContext)(eo),[a,i]=(0,p.useState)([]),o=(0,p.useMemo)(()=>l?[l.id]:[],[l]),s=(0,p.useMemo)(()=>{let t=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.map(e=>{let l,{id:n,type:r,children:a}=e;return Array.isArray(a)?l=t(a):"object"==typeof a&&a&&(l=[],Object.keys(a).forEach(e=>{Array.isArray(a[e])&&l.push({key:ek(),type:"slot",title:"插槽-"+e,slot:e,origin:a,children:t(a[e])})})),{key:n,title:e.name,item:e,type:r,children:l}})};return t(e.items)},[e]),c=(0,p.useMemo)(()=>{let e=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return console.log(t),t.map(t=>{var l,n,a;return{key:t.key,title:(0,d.jsx)(d.Fragment,{children:(null==t?void 0:t.title)||(l=t.type,n=t.slot,"slot"===l?"插槽-"+n:(null==(a=r.find(e=>e.key===l))?void 0:a.label)||l)}),children:t.children?e(t.children):void 0,dataRef:t}})};return e(s)},[s]);return(0,d.jsxs)(e6,{className:"layer-panel",children:[(0,d.jsx)(eL,{title:"图层",extra:(0,d.jsxs)(ey.Space,{children:[(0,d.jsx)(ey.Tooltip,{title:"全部展开",children:(0,d.jsx)("a",{className:"toolbar",onClick:()=>{let t=[],l=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];e.forEach(e=>{var n;t.push(e.id),(null==(n=e.children)?void 0:n.length)&&l(e.children)})};l(e.items),i(t)},children:(0,d.jsx)(ej.PlusSquareOutlined,{})})}),(0,d.jsx)(ey.Tooltip,{title:"全部收起",children:(0,d.jsx)("a",{className:"toolbar",onClick:()=>i([]),children:(0,d.jsx)(ej.MinusSquareOutlined,{})})})]})}),(0,d.jsx)("div",{className:"body",children:(0,d.jsx)(e9,{draggable:{icon:!1,nodeDraggable:e=>!1},showIcon:!1,showLine:{showLeafIcon:!1},treeData:c,selectedKeys:o,expandedKeys:a,onSelect:(e,t)=>{"slot"!==t.node.dataRef.type&&n&&n(t.node.dataRef.item)},onDrop:l=>{let n;if(!(e=>{let t=e.node,l=e.dragNode;if("slot"===l.dataRef.type||!e.dropToGap&&!["b-row","b-col","b-card","slot"].includes(t.dataRef.type))return!1;if("b-col"===l.dataRef.type)if(!e.dropToGap)return"b-row"===t.dataRef.type;else return"b-col"===t.dataRef.type;return("b-col"!==t.dataRef.type||!e.dropToGap)&&("b-row"!==t.dataRef.type||!!e.dropToGap)||"b-col"===l.dataRef.type})(l))return;let r=l.node.key,a=l.dragNode.key,i=l.node.pos.split("-"),o=l.dropPosition-Number(i[i.length-1]),s=(e,t,l)=>{e.forEach((e,n,r)=>{if(e.id===t)return(e.children=e.children||[],"slot"===e.type)?l(e,n,r,e.children[e.slot]):l(e,n,r,e.children);if(Array.isArray(e.children))return s(e.children,t,l);if("object"==typeof e.children)for(let n in e.children)Array.isArray(e.children[n])&&s(e.children[n],t,l)})},d=e.items;if(s(d,a,(e,t,l)=>{l.splice(t,1),n=e}),l.dropToGap)if((l.node.children||[]).length>0&&l.node.expanded&&1===o)s(d,r,(e,t,l)=>{e.children=e.children||[],e.children.unshift(n)});else{let e=[],t=0;s(d,r,(l,n,r)=>{e=r,t=n}),-1===o?e.splice(t,0,n):e.splice(t+1,0,n)}else{if("slot"===l.node.dataRef.type){let{slot:e,origin:t}=l.node.dataRef;console.log(e,JSON.stringify(t)),t[e]=t[e]||[],t[e].push(n)}s(d,r,e=>{e.children=e.children||[],e.children.push(n)})}t&&t({...e,items:d})},onExpand:e=>i(e)})})]})},e7=h().div`
724
+ `,e3=()=>{let{schema:e,setSchema:t,selectedItem:l,setSelectedItem:n,plugins:r}=(0,p.useContext)(eo),[a,i]=(0,p.useState)([]),o=(0,p.useMemo)(()=>l?[l.id]:[],[l]),s=(0,p.useMemo)(()=>{let t=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.map(e=>{let l,{id:n,type:r,children:a}=e;return Array.isArray(a)?l=t(a):"object"==typeof a&&a&&(l=[],Object.keys(a).forEach(e=>{Array.isArray(a[e])&&l.push({key:ek(),type:"slot",title:"插槽-"+e,slot:e,origin:a,children:t(a[e])})})),{key:n,title:e.name,item:e,type:r,children:l}})};return t(e.items)},[e]),c=(0,p.useMemo)(()=>{let e=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return console.log(t),t.map(t=>{var l,n,a;return{key:t.key,title:(0,d.jsx)(d.Fragment,{children:(null==t?void 0:t.title)||(l=t.type,n=t.slot,"slot"===l?"插槽-"+n:(null==(a=r.find(e=>e.key===l))?void 0:a.label)||l)}),children:t.children?e(t.children):void 0,dataRef:t}})};return e(s)},[s]);return(0,d.jsxs)(e6,{className:"layer-panel",children:[(0,d.jsx)(eL,{title:"图层",extra:(0,d.jsxs)(ey.Space,{children:[(0,d.jsx)(ey.Tooltip,{title:"全部展开",children:(0,d.jsx)("a",{className:"toolbar",onClick:()=>{let t=[],l=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];e.forEach(e=>{var n;t.push(e.id),(null==(n=e.children)?void 0:n.length)&&l(e.children)})};l(e.items),i(t)},children:(0,d.jsx)(ej.PlusSquareOutlined,{})})}),(0,d.jsx)(ey.Tooltip,{title:"全部收起",children:(0,d.jsx)("a",{className:"toolbar",onClick:()=>i([]),children:(0,d.jsx)(ej.MinusSquareOutlined,{})})})]})}),(0,d.jsx)("div",{className:"body beautified_scrollbar",children:(0,d.jsx)(e9,{draggable:{icon:!1,nodeDraggable:e=>!1},showIcon:!1,showLine:{showLeafIcon:!1},treeData:c,selectedKeys:o,expandedKeys:a,onSelect:(e,t)=>{"slot"!==t.node.dataRef.type&&n&&n(t.node.dataRef.item)},onDrop:l=>{let n;if(!(e=>{let t=e.node,l=e.dragNode;if("slot"===l.dataRef.type||!e.dropToGap&&!["b-row","b-col","b-card","slot"].includes(t.dataRef.type))return!1;if("b-col"===l.dataRef.type)if(!e.dropToGap)return"b-row"===t.dataRef.type;else return"b-col"===t.dataRef.type;return("b-col"!==t.dataRef.type||!e.dropToGap)&&("b-row"!==t.dataRef.type||!!e.dropToGap)||"b-col"===l.dataRef.type})(l))return;let r=l.node.key,a=l.dragNode.key,i=l.node.pos.split("-"),o=l.dropPosition-Number(i[i.length-1]),s=(e,t,l)=>{e.forEach((e,n,r)=>{if(e.id===t)return(e.children=e.children||[],"slot"===e.type)?l(e,n,r,e.children[e.slot]):l(e,n,r,e.children);if(Array.isArray(e.children))return s(e.children,t,l);if("object"==typeof e.children)for(let n in e.children)Array.isArray(e.children[n])&&s(e.children[n],t,l)})},d=e.items;if(s(d,a,(e,t,l)=>{l.splice(t,1),n=e}),l.dropToGap)if((l.node.children||[]).length>0&&l.node.expanded&&1===o)s(d,r,(e,t,l)=>{e.children=e.children||[],e.children.unshift(n)});else{let e=[],t=0;s(d,r,(l,n,r)=>{e=r,t=n}),-1===o?e.splice(t,0,n):e.splice(t+1,0,n)}else{if("slot"===l.node.dataRef.type){let{slot:e,origin:t}=l.node.dataRef;console.log(e,JSON.stringify(t)),t[e]=t[e]||[],t[e].push(n)}s(d,r,e=>{e.children=e.children||[],e.children.push(n)})}t&&t({...e,items:d})},onExpand:e=>i(e)})})]})},e7=h().div`
744
725
  display: flex;
745
726
  flex-direction: column;
746
727
  height: 100%;
@@ -770,7 +751,7 @@
770
751
  margin: 0;
771
752
  }
772
753
  }
773
- `,te=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},tt=e=>{var t,l,n,r,a,i,o;let{datasourceEnable:s=!0}=e,{plugins:c,selectedItem:u,updateSelectedItem:x,schema:h,setSchema:f,datasetSelector:g}=(0,p.useContext)(eo),v=(0,p.useRef)(null),[j,y]=(0,p.useState)("1"),b=(0,p.useMemo)(()=>te((null==h?void 0:h.items)||[]),[h]),w=(0,p.useMemo)(()=>u&&b.find(e=>e.id===u.id),[b,u]),C=w?j:"1",S=(0,p.useMemo)(()=>c.find(e=>e.key===(null==u?void 0:u.type)),[c,u]),I=null==S?void 0:S.formComponent,z=(null==u?void 0:u.props)||{},k=(null==u?void 0:u.style)||{},[O,N]=(0,p.useState)((null==h?void 0:h.info)||{}),[T,R]=(0,p.useState)((null==u?void 0:u.datasource)||{}),[F,D]=(0,p.useState)(!1),E=e=>{f({...h,info:e})},A={Authorization:`Bearer ${localStorage.getItem("ASKDATA_TOKEN")||""}`};return m().useEffect(()=>{y(u?"2":"1"),R((null==u?void 0:u.datasource)||{})},[u]),(0,d.jsxs)(e7,{className:"properties-panel",children:[(0,d.jsx)(eL,{title:"属性",extra:(0,d.jsxs)(ey.Radio.Group,{value:C,size:"small",buttonStyle:"outline",onChange:e=>y(e.target.value),children:[(0,d.jsx)(ey.Radio.Button,{value:"1",children:"页面"}),w&&(0,d.jsx)(ey.Radio.Button,{value:"2",children:"组件"})]})}),(0,d.jsxs)("div",{className:"body",children:["1"===C&&(0,d.jsxs)(ey.Form,{labelCol:{span:24},wrapperCol:{span:24},className:"ant-form-compact",children:[(0,d.jsx)(ey.Form.Item,{label:"页面名称",children:(0,d.jsx)(ey.Input,{size:"small",value:null==O?void 0:O.name,placeholder:"请输入页面名称",onChange:e=>{let t={...O,name:e.target.value};N(t),E&&E(t)}})}),(0,d.jsx)(ey.Form.Item,{label:"页面描述",children:(0,d.jsx)(ey.Input.TextArea,{size:"small",value:null==O?void 0:O.description,placeholder:"请输入页面描述",onChange:e=>{let t={...O,description:e.target.value};N(t),E&&E(t)}})}),(0,d.jsxs)(ey.Form.Item,{label:"封面",children:[(0,d.jsxs)(ey.Upload.Dragger,{name:"file",multiple:!1,accept:".png,.jpg,.jpeg",headers:A,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};N(n),E&&E(n)}},children:[(0,d.jsx)("p",{className:"ant-upload-drag-icon",children:(0,d.jsx)(ej.InboxOutlined,{})}),(0,d.jsx)("p",{className:"ant-upload-text",children:"点击或将文件拖拽到此区域进行上传"}),(0,d.jsx)("p",{className:"ant-upload-hint",children:"严禁上传公司数据或其他被禁止的文件。"})]}),(null==O||null==(t=O.cover)?void 0:t.url)&&(0,d.jsxs)("div",{style:{marginTop:10,textAlign:"left"},children:[(0,d.jsxs)("div",{style:{display:"flex",justifyContent:"space-between"},children:[(0,d.jsx)("label",{children:"封面预览"}),(0,d.jsx)("a",{onClick:()=>{let e={...O,cover:null};N(e),E&&E(e)},children:(0,d.jsx)(ej.DeleteOutlined,{})})]}),(0,d.jsx)("img",{src:O.cover.url,style:{width:"100%",maxHeight:200}})]})]})]}),"2"===C&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(ey.Divider,{children:"基础属性"}),(0,d.jsxs)(ey.Form,{labelCol:{span:24},wrapperCol:{span:24},className:"ant-form-compact",children:[(0,d.jsx)(ey.Form.Item,{label:"组件标识",labelCol:{span:5},wrapperCol:{span:19},children:(null==u?void 0:u.id)||""}),(0,d.jsx)(ey.Form.Item,{label:"组件名称",children:(0,d.jsx)(ey.Input,{size:"small",value:null==u?void 0:u.name,onChange:e=>x&&x({...u,name:e.target.value})})}),(0,d.jsx)(ey.Form.Item,{label:"组件描述",children:(0,d.jsx)(ey.Input.TextArea,{size:"small",value:null==u?void 0:u.description,onChange:e=>x&&x({...u,description:e.target.value})})})]}),(null==u?void 0:u.datasource)&&(0,d.jsx)(ey.Divider,{children:"数据源"}),(null==u?void 0:u.datasource)&&(0,d.jsxs)(ey.Form,{className:"ant-form-compact",children:[(0,d.jsx)(ey.Form.Item,{label:(0,d.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:"数据来源"}),labelCol:{span:5},wrapperCol:{span:19},colon:!1,children:(0,d.jsxs)(ey.Radio.Group,{size:"small",value:null==T?void 0:T.source,onChange:e=>{let t={...T||{},source:e.target.value};R(t),x&&x({...u,datasource:t})},children:[!!g&&(0,d.jsx)(ey.Radio.Button,{value:"dataset",children:"数据集"}),s&&(0,d.jsx)(ey.Radio.Button,{value:"define",children:"数据源"}),(0,d.jsx)(ey.Radio.Button,{value:"custom",children:"自定义"})]})}),(null==T?void 0:T.source)==="dataset"&&g&&(0,d.jsx)(d.Fragment,{children:(0,d.jsx)(ey.Form.Item,{label:"数据集",labelCol:{span:5},wrapperCol:{span:19},children:(0,d.jsxs)(ey.Space.Compact,{children:[(0,d.jsx)(ey.Input,{size:"small",readOnly:!0,value:(null==T||null==(l=T.dataset)?void 0:l.name)||"",style:{width:90}}),!!(null==T||null==(r=T.dataset)||null==(n=r.id)?void 0:n.length)&&(null==T||null==(a=T.dataset)?void 0:a.output)&&(0,d.jsx)(ey.Popover,{title:"输出类型",placement:"left",content:(0,d.jsx)("div",{style:{padding:"0 12px",maxWidth:500,maxHeight:500,overflow:"auto"},children:(0,d.jsx)(tl,{output:T.dataset.output})}),children:(0,d.jsx)(ey.Button,{size:"small",style:{color:"var(--ant-color-text-tertiary)"},title:"查看输出类型",children:(0,d.jsx)(ew,{type:"icon-json"})})}),!!(null==T||null==(o=T.dataset)||null==(i=o.id)?void 0:i.length)&&(0,d.jsx)(ey.Button,{size:"small",icon:(0,d.jsx)(ej.CloseOutlined,{}),onClick:()=>{let e={...T||{},dataset:{id:"",name:"",output:{fields:[]}}};R(e),x&&x({...u,datasource:e})},title:"删除数据集",style:{color:"var(--ant-color-text-tertiary)"}}),(0,d.jsx)(ey.Button,{size:"small",icon:(0,d.jsx)(ej.SelectOutlined,{}),title:"选择数据集",onClick:()=>D(!0)})]})})}),(null==T?void 0:T.source)==="define"&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(ey.Form.Item,{label:"数据源",layout:"vertical",children:(0,d.jsx)(ey.Select,{size:"small",value:null==T?void 0:T.datasourceId,onChange:e=>{let t={...T||{},datasourceId:e};R(t),x&&x({...u,datasource:t})},children:((null==h?void 0:h.datasources)||[]).map(e=>(0,d.jsx)(ey.Select.Option,{value:e.id,children:e.name},e.id))})}),(0,d.jsx)(ey.Form.Item,{label:"数据处理脚本",labelCol:{span:24},wrapperCol:{span:24},children:(0,d.jsx)(ey.Select,{size:"small",value:null==T?void 0:T.scriptId,onChange:e=>{let t={...T||{},scriptId:e};R(t),x&&x({...u,datasource:t})},children:((null==h?void 0:h.scripts)||[]).map(e=>(0,d.jsx)(ey.Select.Option,{value:e.id,children:e.name},e.id))})})]}),(null==T?void 0:T.source)==="custom"&&(0,d.jsx)(d.Fragment,{children:(0,d.jsx)(ey.Form.Item,{label:(0,d.jsxs)(d.Fragment,{children:["自定义",(0,d.jsxs)("a",{onClick:()=>{var e,t;let l=null==(e=v.current)?void 0:e.editor;null==l||null==(t=l.getAction("editor.action.formatDocument"))||t.run()},children:[(0,d.jsx)(ew,{type:"icon-formate"})," 格式化"]})]}),labelCol:{span:24},wrapperCol:{span:24},className:"ant-form-item-label-space",children:(0,d.jsx)("div",{style:{border:"1px solid var(--ant-color-border)",borderRadius:"var(--ant-border-radius)",padding:1},children:(0,d.jsx)(eV(),{height:"200px",onMount:e=>{v.current={editor:e}},defaultLanguage:"json",value:(null==T?void 0:T.custom)||"",onChange:e=>{let t={...T||{},custom:e||""};R(t),x&&x({...u,datasource:t})},options:{minimap:{enabled:!1},scrollBeyondLastLine:!1,tabSize:2}})})})})]}),I&&(0,d.jsx)(ey.Divider,{children:"特有属性"}),I&&(0,d.jsx)(I,{model:z,customStyle:k,onChange:e=>{u&&x&&x({...u,props:e})}})]})]}),!!g&&(0,d.jsx)(ey.Drawer,{title:"选择数据集",size:800,open:F,onClose:()=>{D(!1)},children:g(e=>{T.dataset=e,D(!1)})})]})},tl=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,d.jsxs)(d.Fragment,{children:["{",e.map((n,r)=>(0,d.jsxs)("div",{style:{paddingLeft:"1em"},children:[(0,d.jsx)("span",{style:{color:"var(--ant-color-primary)"},children:n.key}),":"," ","ARRAY"===n.type?(0,d.jsxs)(d.Fragment,{children:["Array","<",n.schema?l(n.schema.fields,t+1):(0,d.jsx)("span",{children:"any"}),">"]}):"OBJECT"===n.type?n.schema?l(n.schema.fields,t+1):(0,d.jsx)("span",{children:"{}"}):(0,d.jsx)("span",{style:{color:"var(--ant-color-success)"},children:(n.type||"string").toLowerCase()}),r<e.length-1?",":""]},n.key||r)),"}"]}):(0,d.jsx)("span",{children:"{}"})};return(0,d.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)})},tn=h().div`
754
+ `,te=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},tt=e=>{var t,l,n,r,a,i,o;let{datasourceEnable:s=!0}=e,{plugins:c,selectedItem:u,updateSelectedItem:x,schema:h,setSchema:f,datasetSelector:g}=(0,p.useContext)(eo),v=(0,p.useRef)(null),[j,y]=(0,p.useState)("1"),b=(0,p.useMemo)(()=>te((null==h?void 0:h.items)||[]),[h]),w=(0,p.useMemo)(()=>u&&b.find(e=>e.id===u.id),[b,u]),C=w?j:"1",S=(0,p.useMemo)(()=>c.find(e=>e.key===(null==u?void 0:u.type)),[c,u]),I=null==S?void 0:S.formComponent,z=(null==u?void 0:u.props)||{},k=(null==u?void 0:u.style)||{},[O,N]=(0,p.useState)((null==h?void 0:h.info)||{}),[T,R]=(0,p.useState)((null==u?void 0:u.datasource)||{}),[F,D]=(0,p.useState)(!1),E=e=>{f({...h,info:e})},A={Authorization:`Bearer ${localStorage.getItem("ASKDATA_TOKEN")||""}`};return m().useEffect(()=>{y(u?"2":"1"),R((null==u?void 0:u.datasource)||{})},[u]),(0,d.jsxs)(e7,{className:"properties-panel",children:[(0,d.jsx)(eL,{title:"属性",extra:(0,d.jsxs)(ey.Radio.Group,{value:C,size:"small",buttonStyle:"outline",onChange:e=>y(e.target.value),children:[(0,d.jsx)(ey.Radio.Button,{value:"1",children:"页面"}),w&&(0,d.jsx)(ey.Radio.Button,{value:"2",children:"组件"})]})}),(0,d.jsxs)("div",{className:"body beautified_scrollbar",children:["1"===C&&(0,d.jsxs)(ey.Form,{labelCol:{span:24},wrapperCol:{span:24},className:"ant-form-compact",children:[(0,d.jsx)(ey.Form.Item,{label:"页面名称",children:(0,d.jsx)(ey.Input,{size:"small",value:null==O?void 0:O.name,placeholder:"请输入页面名称",onChange:e=>{let t={...O,name:e.target.value};N(t),E&&E(t)}})}),(0,d.jsx)(ey.Form.Item,{label:"页面描述",children:(0,d.jsx)(ey.Input.TextArea,{size:"small",value:null==O?void 0:O.description,placeholder:"请输入页面描述",onChange:e=>{let t={...O,description:e.target.value};N(t),E&&E(t)}})}),(0,d.jsxs)(ey.Form.Item,{label:"封面",children:[(0,d.jsxs)(ey.Upload.Dragger,{name:"file",multiple:!1,accept:".png,.jpg,.jpeg",headers:A,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};N(n),E&&E(n)}},children:[(0,d.jsx)("p",{className:"ant-upload-drag-icon",children:(0,d.jsx)(ej.InboxOutlined,{})}),(0,d.jsx)("p",{className:"ant-upload-text",children:"点击或将文件拖拽到此区域进行上传"}),(0,d.jsx)("p",{className:"ant-upload-hint",children:"严禁上传公司数据或其他被禁止的文件。"})]}),(null==O||null==(t=O.cover)?void 0:t.url)&&(0,d.jsxs)("div",{style:{marginTop:10,textAlign:"left"},children:[(0,d.jsxs)("div",{style:{display:"flex",justifyContent:"space-between"},children:[(0,d.jsx)("label",{children:"封面预览"}),(0,d.jsx)("a",{onClick:()=>{let e={...O,cover:null};N(e),E&&E(e)},children:(0,d.jsx)(ej.DeleteOutlined,{})})]}),(0,d.jsx)("img",{src:O.cover.url,style:{width:"100%",maxHeight:200}})]})]})]}),"2"===C&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(ey.Divider,{children:"基础属性"}),(0,d.jsxs)(ey.Form,{labelCol:{span:24},wrapperCol:{span:24},className:"ant-form-compact",children:[(0,d.jsx)(ey.Form.Item,{label:"组件标识",labelCol:{span:5},wrapperCol:{span:19},children:(null==u?void 0:u.id)||""}),(0,d.jsx)(ey.Form.Item,{label:"组件名称",children:(0,d.jsx)(ey.Input,{size:"small",value:null==u?void 0:u.name,onChange:e=>x&&x({...u,name:e.target.value})})}),(0,d.jsx)(ey.Form.Item,{label:"组件描述",children:(0,d.jsx)(ey.Input.TextArea,{size:"small",value:null==u?void 0:u.description,onChange:e=>x&&x({...u,description:e.target.value})})})]}),(null==u?void 0:u.datasource)&&(0,d.jsx)(ey.Divider,{children:"数据源"}),(null==u?void 0:u.datasource)&&(0,d.jsxs)(ey.Form,{className:"ant-form-compact",children:[(0,d.jsx)(ey.Form.Item,{label:(0,d.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:"数据来源"}),labelCol:{span:5},wrapperCol:{span:19},colon:!1,children:(0,d.jsxs)(ey.Radio.Group,{size:"small",value:null==T?void 0:T.source,onChange:e=>{let t={...T||{},source:e.target.value};R(t),x&&x({...u,datasource:t})},children:[!!g&&(0,d.jsx)(ey.Radio.Button,{value:"dataset",children:"数据集"}),s&&(0,d.jsx)(ey.Radio.Button,{value:"define",children:"数据源"}),(0,d.jsx)(ey.Radio.Button,{value:"custom",children:"自定义"})]})}),(null==T?void 0:T.source)==="dataset"&&g&&(0,d.jsx)(d.Fragment,{children:(0,d.jsx)(ey.Form.Item,{label:"数据集",labelCol:{span:5},wrapperCol:{span:19},children:(0,d.jsxs)(ey.Space.Compact,{children:[(0,d.jsx)(ey.Input,{size:"small",readOnly:!0,value:(null==T||null==(l=T.dataset)?void 0:l.name)||"",style:{width:90}}),!!(null==T||null==(r=T.dataset)||null==(n=r.id)?void 0:n.length)&&(null==T||null==(a=T.dataset)?void 0:a.output)&&(0,d.jsx)(ey.Popover,{title:"输出类型",placement:"left",content:(0,d.jsx)("div",{style:{padding:"0 12px",maxWidth:500,maxHeight:500,overflow:"auto"},children:(0,d.jsx)(tl,{output:T.dataset.output})}),children:(0,d.jsx)(ey.Button,{size:"small",style:{color:"var(--ant-color-text-tertiary)"},title:"查看输出类型",children:(0,d.jsx)(ew,{type:"icon-json"})})}),!!(null==T||null==(o=T.dataset)||null==(i=o.id)?void 0:i.length)&&(0,d.jsx)(ey.Button,{size:"small",icon:(0,d.jsx)(ej.CloseOutlined,{}),onClick:()=>{let e={...T||{},dataset:{id:"",name:"",output:{fields:[]}}};R(e),x&&x({...u,datasource:e})},title:"删除数据集",style:{color:"var(--ant-color-text-tertiary)"}}),(0,d.jsx)(ey.Button,{size:"small",icon:(0,d.jsx)(ej.SelectOutlined,{}),title:"选择数据集",onClick:()=>D(!0)})]})})}),(null==T?void 0:T.source)==="define"&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(ey.Form.Item,{label:"数据源",layout:"vertical",children:(0,d.jsx)(ey.Select,{size:"small",value:null==T?void 0:T.datasourceId,onChange:e=>{let t={...T||{},datasourceId:e};R(t),x&&x({...u,datasource:t})},children:((null==h?void 0:h.datasources)||[]).map(e=>(0,d.jsx)(ey.Select.Option,{value:e.id,children:e.name},e.id))})}),(0,d.jsx)(ey.Form.Item,{label:"数据处理脚本",labelCol:{span:24},wrapperCol:{span:24},children:(0,d.jsx)(ey.Select,{size:"small",value:null==T?void 0:T.scriptId,onChange:e=>{let t={...T||{},scriptId:e};R(t),x&&x({...u,datasource:t})},children:((null==h?void 0:h.scripts)||[]).map(e=>(0,d.jsx)(ey.Select.Option,{value:e.id,children:e.name},e.id))})})]}),(null==T?void 0:T.source)==="custom"&&(0,d.jsx)(d.Fragment,{children:(0,d.jsx)(ey.Form.Item,{label:(0,d.jsxs)(d.Fragment,{children:["自定义",(0,d.jsxs)("a",{onClick:()=>{var e,t;let l=null==(e=v.current)?void 0:e.editor;null==l||null==(t=l.getAction("editor.action.formatDocument"))||t.run()},children:[(0,d.jsx)(ew,{type:"icon-formate"})," 格式化"]})]}),labelCol:{span:24},wrapperCol:{span:24},className:"ant-form-item-label-space",children:(0,d.jsx)("div",{style:{border:"1px solid var(--ant-color-border)",borderRadius:"var(--ant-border-radius)",padding:1},children:(0,d.jsx)(eV(),{height:"200px",onMount:e=>{v.current={editor:e}},defaultLanguage:"json",value:(null==T?void 0:T.custom)||"",onChange:e=>{let t={...T||{},custom:e||""};R(t),x&&x({...u,datasource:t})},options:{minimap:{enabled:!1},scrollBeyondLastLine:!1,tabSize:2}})})})})]}),I&&(0,d.jsx)(ey.Divider,{children:"特有属性"}),I&&(0,d.jsx)(I,{model:z,customStyle:k,onChange:e=>{u&&x&&x({...u,props:e})}})]})]}),!!g&&(0,d.jsx)(ey.Drawer,{title:"选择数据集",size:800,open:F,onClose:()=>{D(!1)},children:g(e=>{T.dataset=e,D(!1)})})]})},tl=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,d.jsxs)(d.Fragment,{children:["{",e.map((n,r)=>(0,d.jsxs)("div",{style:{paddingLeft:"1em"},children:[(0,d.jsx)("span",{style:{color:"var(--ant-color-primary)"},children:n.key}),":"," ","ARRAY"===n.type?(0,d.jsxs)(d.Fragment,{children:["Array","<",n.schema?l(n.schema.fields,t+1):(0,d.jsx)("span",{children:"any"}),">"]}):"OBJECT"===n.type?n.schema?l(n.schema.fields,t+1):(0,d.jsx)("span",{children:"{}"}):(0,d.jsx)("span",{style:{color:"var(--ant-color-success)"},children:(n.type||"string").toLowerCase()}),r<e.length-1?",":""]},n.key||r)),"}"]}):(0,d.jsx)("span",{children:"{}"})};return(0,d.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)})},tn=h().div`
774
755
  display: flex;
775
756
  flex-direction: column;
776
757
  height: 100%;
@@ -809,7 +790,7 @@
809
790
  font-size: 14px;
810
791
  padding: 0 50px;
811
792
  }
812
- `,tr=()=>{let{schema:e,setSchema:t}=(0,p.useContext)(eo),[l,n]=m().useState(!1),[r,a]=m().useState(-1),[i]=ey.Form.useForm(),o=(0,p.useMemo)(()=>e.scripts||[],[e]),s=l=>{t({...e,scripts:l})},c=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,d.jsxs)(tn,{className:"script-panel",children:[(0,d.jsx)(eL,{title:"脚本",extra:(0,d.jsx)(ey.Space,{children:(0,d.jsx)("a",{className:"toolbar",onClick:()=>{a(-1),i.setFieldsValue({name:"",script:"return {};"}),n(!0)},children:"+"})})}),(0,d.jsx)("div",{className:"body",children:(0,d.jsx)("ul",{children:o.map((e,t)=>(0,d.jsxs)("li",{children:[(0,d.jsxs)("div",{title:e.name,children:[(0,d.jsx)(ew,{type:"icon-drag"})," ",e.name]}),(0,d.jsxs)(ey.Space,{children:[(0,d.jsx)("a",{onClick:()=>{a(t),i.setFieldsValue({name:e.name,script:e.script}),n(!0)},children:(0,d.jsx)(ej.EditOutlined,{})}),(0,d.jsx)("a",{onClick:()=>{let e=[...o];e.splice(t,1),s&&s(e)},children:(0,d.jsx)(ej.DeleteOutlined,{})})]})]},e.id||t))})}),(0,d.jsx)(ey.Modal,{title:"添加脚本",open:l,width:600,styles:{body:{maxHeight:"calc(100vh - 250px)",overflow:"auto"}},onCancel:()=>n(!1),footer:(0,d.jsxs)(ey.Space,{children:[(0,d.jsx)(ey.Button,{type:"primary",onClick:c,children:"确定"}),(0,d.jsx)(ey.Button,{onClick:()=>n(!1),children:"取消"})]}),children:(0,d.jsxs)(ey.Form,{form:i,layout:"vertical",children:[(0,d.jsx)(ey.Form.Item,{label:"脚本名称",name:"name",rules:[{required:!0,message:"请输入脚本名称"}],children:(0,d.jsx)(ey.Input,{})}),(0,d.jsx)(ey.Form.Item,{label:"脚本语句",name:"script",rules:[{required:!0,message:"请输入脚本语句"}],children:(0,d.jsxs)("div",{style:{border:"1px solid #d9d9d9",padding:"0 10px"},children:[(0,d.jsxs)("div",{className:"function-wrapper",children:["function fixed(data) ","{"]}),(0,d.jsx)(eV(),{height:"200px",defaultLanguage:"javascript",value:i.getFieldValue("script"),onChange:e=>i.setFieldsValue({script:e||""}),options:{minimap:{enabled:!1},scrollBeyondLastLine:!1,tabSize:2}}),(0,d.jsx)("div",{className:"function-wrapper",children:"}"})]})})]})})]})},ta=h().div`
793
+ `,tr=()=>{let{schema:e,setSchema:t}=(0,p.useContext)(eo),[l,n]=m().useState(!1),[r,a]=m().useState(-1),[i]=ey.Form.useForm(),o=(0,p.useMemo)(()=>e.scripts||[],[e]),s=l=>{t({...e,scripts:l})},c=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,d.jsxs)(tn,{className:"script-panel",children:[(0,d.jsx)(eL,{title:"脚本",extra:(0,d.jsx)(ey.Space,{children:(0,d.jsx)("a",{className:"toolbar",onClick:()=>{a(-1),i.setFieldsValue({name:"",script:"return {};"}),n(!0)},children:"+"})})}),(0,d.jsx)("div",{className:"body beautified_scrollbar",children:(0,d.jsx)("ul",{children:o.map((e,t)=>(0,d.jsxs)("li",{children:[(0,d.jsxs)("div",{title:e.name,children:[(0,d.jsx)(ew,{type:"icon-drag"})," ",e.name]}),(0,d.jsxs)(ey.Space,{children:[(0,d.jsx)("a",{onClick:()=>{a(t),i.setFieldsValue({name:e.name,script:e.script}),n(!0)},children:(0,d.jsx)(ej.EditOutlined,{})}),(0,d.jsx)("a",{onClick:()=>{let e=[...o];e.splice(t,1),s&&s(e)},children:(0,d.jsx)(ej.DeleteOutlined,{})})]})]},e.id||t))})}),(0,d.jsx)(ey.Modal,{title:"添加脚本",open:l,width:600,styles:{body:{maxHeight:"calc(100vh - 250px)",overflow:"auto"}},onCancel:()=>n(!1),footer:(0,d.jsxs)(ey.Space,{children:[(0,d.jsx)(ey.Button,{type:"primary",onClick:c,children:"确定"}),(0,d.jsx)(ey.Button,{onClick:()=>n(!1),children:"取消"})]}),children:(0,d.jsxs)(ey.Form,{form:i,layout:"vertical",children:[(0,d.jsx)(ey.Form.Item,{label:"脚本名称",name:"name",rules:[{required:!0,message:"请输入脚本名称"}],children:(0,d.jsx)(ey.Input,{})}),(0,d.jsx)(ey.Form.Item,{label:"脚本语句",name:"script",rules:[{required:!0,message:"请输入脚本语句"}],children:(0,d.jsxs)("div",{style:{border:"1px solid #d9d9d9",padding:"0 10px"},children:[(0,d.jsxs)("div",{className:"function-wrapper",children:["function fixed(data) ","{"]}),(0,d.jsx)(eV(),{height:"200px",defaultLanguage:"javascript",value:i.getFieldValue("script"),onChange:e=>i.setFieldsValue({script:e||""}),options:{minimap:{enabled:!1},scrollBeyondLastLine:!1,tabSize:2}}),(0,d.jsx)("div",{className:"function-wrapper",children:"}"})]})})]})})]})},ta=h().div`
813
794
  display: flex;
814
795
  flex-direction: column;
815
796
  height: 100%;
@@ -820,7 +801,7 @@
820
801
  gap: 12px;
821
802
  padding: 12px;
822
803
  }
823
- `,ti=()=>{let{schema:e,setSchema:t}=(0,p.useContext)(eo),[l,n]=m().useState(!1),[r,a]=m().useState(-1),[i]=ey.Form.useForm(),o=(0,p.useMemo)(()=>e.variables||[],[e.variables]),s=l=>{t({...e,variables:l})},c=[{title:"名称",dataIndex:"name",render:(e,t)=>(0,d.jsxs)("div",{title:e,children:[(0,d.jsx)(ew,{type:"icon-drag"})," ",e]})},{title:"值",dataIndex:"value"},{title:"操作",width:60,align:"center",render:(e,t,l)=>(0,d.jsxs)(ey.Space,{children:[(0,d.jsx)("a",{onClick:()=>{a(l),i.setFieldsValue({name:t.name,value:t.value}),n(!0)},children:(0,d.jsx)(ej.EditOutlined,{})}),(0,d.jsx)(ey.Popconfirm,{title:"确认删除吗?",okText:"确认",cancelText:"取消",onConfirm:()=>{let e=[...o];e.splice(l,1),s&&s(e)},children:(0,d.jsx)("a",{children:(0,d.jsx)(ej.DeleteOutlined,{})})})]})}],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,d.jsxs)(ta,{children:[(0,d.jsx)(eL,{title:"环境变量",extra:(0,d.jsx)(ey.Space,{children:(0,d.jsx)("a",{className:"toolbar",onClick:()=>{a(-1),i.resetFields(),n(!0)},children:"+"})})}),(0,d.jsx)("div",{className:"body",children:(0,d.jsx)(ey.Table,{rowKey:e=>e.id||e.name,dataSource:o,columns:c,pagination:!1,size:"small",locale:{emptyText:"暂无环境变量"}})}),(0,d.jsx)(ey.Modal,{title:"添加环境变量",open:l,width:600,styles:{body:{maxHeight:"calc(100vh - 250px)",overflow:"auto"}},onCancel:()=>n(!1),footer:(0,d.jsxs)(ey.Space,{children:[(0,d.jsx)(ey.Button,{type:"primary",onClick:u,children:"确定"}),(0,d.jsx)(ey.Button,{onClick:()=>n(!1),children:"取消"})]}),children:(0,d.jsxs)(ey.Form,{form:i,layout:"vertical",children:[(0,d.jsx)(ey.Form.Item,{label:"环境变量名称",name:"name",rules:[{required:!0,message:"请输入环境变量名称"}],children:(0,d.jsx)(ey.Input,{})}),(0,d.jsx)(ey.Form.Item,{label:"环境变量值",name:"value",rules:[{required:!0,message:"请输入环境变量值"}],children:(0,d.jsx)(ey.Input,{})})]})})]})},to=h().div`
804
+ `,ti=()=>{let{schema:e,setSchema:t}=(0,p.useContext)(eo),[l,n]=m().useState(!1),[r,a]=m().useState(-1),[i]=ey.Form.useForm(),o=(0,p.useMemo)(()=>e.variables||[],[e.variables]),s=l=>{t({...e,variables:l})},c=[{title:"名称",dataIndex:"name",render:(e,t)=>(0,d.jsxs)("div",{title:e,children:[(0,d.jsx)(ew,{type:"icon-drag"})," ",e]})},{title:"值",dataIndex:"value"},{title:"操作",width:60,align:"center",render:(e,t,l)=>(0,d.jsxs)(ey.Space,{children:[(0,d.jsx)("a",{onClick:()=>{a(l),i.setFieldsValue({name:t.name,value:t.value}),n(!0)},children:(0,d.jsx)(ej.EditOutlined,{})}),(0,d.jsx)(ey.Popconfirm,{title:"确认删除吗?",okText:"确认",cancelText:"取消",onConfirm:()=>{let e=[...o];e.splice(l,1),s&&s(e)},children:(0,d.jsx)("a",{children:(0,d.jsx)(ej.DeleteOutlined,{})})})]})}],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,d.jsxs)(ta,{children:[(0,d.jsx)(eL,{title:"环境变量",extra:(0,d.jsx)(ey.Space,{children:(0,d.jsx)("a",{className:"toolbar",onClick:()=>{a(-1),i.resetFields(),n(!0)},children:"+"})})}),(0,d.jsx)("div",{className:"body beautified_scrollbar",children:(0,d.jsx)(ey.Table,{rowKey:e=>e.id||e.name,dataSource:o,columns:c,pagination:!1,size:"small",locale:{emptyText:"暂无环境变量"}})}),(0,d.jsx)(ey.Modal,{title:"添加环境变量",open:l,width:600,styles:{body:{maxHeight:"calc(100vh - 250px)",overflow:"auto"}},onCancel:()=>n(!1),footer:(0,d.jsxs)(ey.Space,{children:[(0,d.jsx)(ey.Button,{type:"primary",onClick:u,children:"确定"}),(0,d.jsx)(ey.Button,{onClick:()=>n(!1),children:"取消"})]}),children:(0,d.jsxs)(ey.Form,{form:i,layout:"vertical",children:[(0,d.jsx)(ey.Form.Item,{label:"环境变量名称",name:"name",rules:[{required:!0,message:"请输入环境变量名称"}],children:(0,d.jsx)(ey.Input,{})}),(0,d.jsx)(ey.Form.Item,{label:"环境变量值",name:"value",rules:[{required:!0,message:"请输入环境变量值"}],children:(0,d.jsx)(ey.Input,{})})]})})]})},to=h().div`
824
805
  display: flex;
825
806
  flex-direction: column;
826
807
  height: 100%;
@@ -832,7 +813,7 @@
832
813
  padding: 12px;
833
814
  overflow: auto;
834
815
  }
835
- `,ts=m().forwardRef((e,t)=>{let{renderNode:l}=e,n=(0,p.useRef)(null);(0,p.useImperativeHandle)(t,()=>({reload:r}));let r=()=>{var e;null==(e=n.current)||e.reload()};return(0,d.jsxs)(to,{className:"dataset-panel",children:[(0,d.jsx)(eL,{title:"数据集",extra:(0,d.jsx)(ey.Space,{children:(0,d.jsx)("a",{className:"toolbar",onClick:()=>{var e;null==(e=n.current)||e.handleAdd()},children:"+"})})}),(0,d.jsx)("div",{className:"body",children:(0,d.jsx)(l,{ref:n})})]})}),td=h().div`
816
+ `,ts=m().forwardRef((e,t)=>{let{renderNode:l}=e,n=(0,p.useRef)(null);(0,p.useImperativeHandle)(t,()=>({reload:r}));let r=()=>{var e;null==(e=n.current)||e.reload()};return(0,d.jsxs)(to,{className:"dataset-panel",children:[(0,d.jsx)(eL,{title:"数据集",extra:(0,d.jsx)(ey.Space,{children:(0,d.jsx)("a",{className:"toolbar",onClick:()=>{var e;null==(e=n.current)||e.handleAdd()},children:"+"})})}),(0,d.jsx)("div",{className:"body beautified_scrollbar",children:(0,d.jsx)(l,{ref:n})})]})}),td=h().div`
836
817
  height: 100%;
837
818
  display: grid;
838
819
  background: #ffffff;
@@ -840,7 +821,7 @@
840
821
  box-sizing: border-box;
841
822
  }
842
823
  & > div {
843
- height: calc(100vh - 40px);
824
+ height: calc(100vh - 49px);
844
825
  display: flex;
845
826
  flex-direction: column;
846
827
  }
@@ -923,7 +904,30 @@
923
904
  border-right: solid 2px #1890ff;
924
905
  background: linear-gradient(to left, #1890ff1a, #ffffff);
925
906
  }
926
- `,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,G]=(0,p.useState)(!1),[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:()=>{G(!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",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:["ai"===Q&&(null==x?void 0:x.ai)&&(0,d.jsx)(eH,{agentList:a,onEffect:V}),"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:q,onOk:e=>{G(!1),$(e)},onCancel:()=>G(!1)}),(0,d.jsx)(ey.Drawer,{open:U,size:400,mask:!1,title:null,closable:!1,styles:{body:{padding:0}},onClose:()=>_(!1),children:(0,d.jsx)(eH,{agentList:a,headExtra:(0,d.jsx)(ey.Button,{type:"link",icon:(0,d.jsx)(ej.CloseOutlined,{}),onClick:()=>_(!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)`
907
+
908
+ .beautified_scrollbar {
909
+ overflow: auto;
910
+ scrollbar-width: none;
911
+ &::-webkit-scrollbar {
912
+ width: 0;
913
+ height: 0;
914
+ }
915
+ &:hover {
916
+ scrollbar-width: thin;
917
+ }
918
+ &:hover::-webkit-scrollbar {
919
+ width: 8px;
920
+ height: 8px;
921
+ }
922
+ &:hover::-webkit-scrollbar-thumb {
923
+ background: var(--ant-color-border);
924
+ border-radius: 4px;
925
+ }
926
+ &:hover::-webkit-scrollbar-track {
927
+ background: transparent;
928
+ }
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)`
927
931
  vertical-align: middle;
928
932
  margin-left: 2px;
929
933
  color: var(--ant-color-text-description);
@@ -1024,7 +1028,7 @@
1024
1028
  const module = undefined;
1025
1029
  const exports = undefined;
1026
1030
  ${e.customRender}
1027
- `)(console,Math,Date,Array,Object,String,Number,Boolean,t,l,n):e.render})),g=()=>{console.log("callback table",eS(m,l))};return(0,p.useEffect)(()=>{x({id:l.id,callback:g})},[]),(0,d.jsx)(ey.Table,{id:t,dataSource:n,columns:f,pagination:h,bordered:i,size:o,showHeader:"boolean"!=typeof s||s,rowKey:(e,t)=>String(t),style:{padding:1,...c},className:u})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n}),r=(e,l)=>{let r=[...t.columns||[]];r[e]={...r[e],...l},n("columns",r)},[a,i]=(0,p.useState)(!1),[o,s]=(0,p.useState)(null),c=null!=o&&t.columns[o]?t.columns[o]:{title:"",dataIndex:"",width:"",align:"left",ellipsis:!1},u=[{title:"列名",dataIndex:"title"},{title:"数据索引",dataIndex:"dataIndex"},{title:"操作",width:80,align:"center",render:(e,l,r)=>(0,d.jsxs)(ey.Space,{children:[(0,d.jsx)("a",{onClick:()=>{s(r),i(!0)},children:(0,d.jsx)(ej.EditOutlined,{})}),(0,d.jsx)("a",{onClick:()=>{let e;(e=[...t.columns||[]]).splice(r,1),n("columns",e)},children:(0,d.jsx)(ej.DeleteOutlined,{})})]})}];return(0,d.jsxs)("div",{children:[(0,d.jsxs)(ey.Form,{labelCol:{span:12},wrapperCol:{span:12},children:[(0,d.jsx)(ey.Form.Item,{label:"大小",children:(0,d.jsxs)(ey.Radio.Group,{size:"small",value:t.size,onChange:e=>n("size",e.target.value),children:[(0,d.jsx)(ey.Radio.Button,{value:"small",children:"小"}),(0,d.jsx)(ey.Radio.Button,{value:"middle",children:"中"}),(0,d.jsx)(ey.Radio.Button,{value:"large",children:"大"})]})}),(0,d.jsx)(ey.Form.Item,{label:"边框",children:(0,d.jsx)(ey.Switch,{size:"small",checked:!!t.bordered,onChange:e=>n("bordered",e)})}),(0,d.jsx)(ey.Form.Item,{label:"显示表头",children:(0,d.jsx)(ey.Switch,{size:"small",checked:!!t.showHeader,onChange:e=>n("showHeader",e)})}),(0,d.jsx)(ey.Form.Item,{label:"分页大小",children:(0,d.jsx)(ey.InputNumber,{size:"small",value:t.pageSize,onChange:e=>n("pageSize",e)})})]}),(0,d.jsx)(ey.Divider,{children:"表格列设置"}),(0,d.jsx)(ey.Table,{size:"small",dataSource:t.columns,rowKey:(e,t)=>String(t),columns:u,pagination:!1,bordered:!0}),(0,d.jsx)(ey.Button,{size:"small",onClick:()=>{n("columns",[...t.columns||[],{title:"",dataIndex:"",width:"",align:"left",ellipsis:!1}])},block:!0,children:"添加列"}),(0,d.jsx)(ey.Modal,{title:"编辑列",open:a,footer:null,width:400,onCancel:()=>i(!1),children:(0,d.jsx)(ey.Form,{layout:"vertical",children:(0,d.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12},children:[(0,d.jsx)(ey.Form.Item,{label:"列名",children:(0,d.jsx)(ey.Input,{value:c.title,onChange:e=>r(o,{title:e.target.value})})}),(0,d.jsx)(ey.Form.Item,{label:"数据索引",children:(0,d.jsx)(ey.Input,{value:c.dataIndex,onChange:e=>r(o,{dataIndex:e.target.value})})}),(0,d.jsx)(ey.Form.Item,{label:"宽度",children:(0,d.jsx)(ey.Input,{value:c.width,onChange:e=>r(o,{width:e.target.value})})}),(0,d.jsx)(ey.Form.Item,{label:"对齐",children:(0,d.jsxs)(ey.Radio.Group,{value:c.align,onChange:e=>r(o,{align:e.target.value}),children:[(0,d.jsx)(ey.Radio.Button,{value:"left",children:(0,d.jsx)(ej.AlignLeftOutlined,{})}),(0,d.jsx)(ey.Radio.Button,{value:"center",children:(0,d.jsx)(ej.AlignCenterOutlined,{})}),(0,d.jsx)(ey.Radio.Button,{value:"right",children:(0,d.jsx)(ej.AlignRightOutlined,{})})]})}),(0,d.jsx)(ey.Form.Item,{label:"省略",children:(0,d.jsx)(ey.Switch,{checked:!!c.ellipsis,onChange:e=>r(o,{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:c}=e,{env:u,initCallback:m}=(0,p.useContext)(ex),x=th(t,i.datasource)||[],h=(0,p.useMemo)(()=>!!l&&!(l<=x.length)&&{total:x.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,x.length,r]),f=["p-list",a?`p-list--${a}`:void 0,r?`p-list--${r}`:void 0,o?"p-list--split":void 0,n?"p-list--bordered":void 0,c],g=()=>{console.log("callback list",eS(u,i))};return(0,p.useEffect)(()=>{m({id:i.id,callback:g})},[]),(0,d.jsxs)("div",{id:t,style:{display:"flex",flexDirection:"column",...s},className:f.filter(Boolean).join(" "),children:[(0,d.jsx)(tS,{list:x,split:o,bordered:n,size:r,itemLayout:a}),h&&(0,d.jsx)(ey.Pagination,{...h})]})},formComponent:e=>{let{model:t,onChange:l}=e,[n]=ey.Form.useForm();return(0,p.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,d.jsxs)(ey.Form,{form:n,labelCol:{span:12},wrapperCol:{span:12},onValuesChange:e=>{null==l||l({...t,...e})},children:[(0,d.jsx)(ey.Form.Item,{label:"大小",name:"size",children:(0,d.jsxs)(ey.Radio.Group,{size:"small",buttonStyle:"solid",children:[(0,d.jsx)(ey.Radio.Button,{value:"default",children:"默认"}),(0,d.jsx)(ey.Radio.Button,{value:"small",children:"小"})]})}),(0,d.jsx)(ey.Form.Item,{label:"布局",name:"itemLayout",children:(0,d.jsxs)(ey.Radio.Group,{size:"small",buttonStyle:"solid",children:[(0,d.jsx)(ey.Radio.Button,{value:"horizontal",children:"水平"}),(0,d.jsx)(ey.Radio.Button,{value:"vertical",children:"垂直"})]})}),(0,d.jsx)(ey.Form.Item,{label:"边框",name:"bordered",valuePropName:"checked",children:(0,d.jsx)(ey.Switch,{size:"small"})}),(0,d.jsx)(ey.Form.Item,{label:"分割线",name:"split",valuePropName:"checked",children:(0,d.jsx)(ey.Switch,{size:"small"})}),(0,d.jsx)(ey.Form.Item,{label:"分页大小",name:"pageSize",children:(0,d.jsx)(ey.InputNumber,{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,p.useContext)(ex),c=th(t,n.datasource),u=(0,p.useMemo)(()=>Object.keys(c||{}),[c]),m=(0,p.useMemo)(()=>u.map(e=>null==c?void 0:c[e]),[u,c]),x=(0,p.useMemo)(()=>(l||"").replace(/{{\s*([^}]+)\s*}}/g,(e,t)=>{try{return Function(...u,`
1031
+ `)(console,Math,Date,Array,Object,String,Number,Boolean,t,l,n):e.render})),g=()=>{console.log("callback table",eS(m,l))};return(0,p.useEffect)(()=>{x({id:l.id,callback:g})},[]),(0,d.jsx)(ey.Table,{id:t,dataSource:n,columns:f,pagination:h,bordered:i,size:o,showHeader:"boolean"!=typeof s||s,rowKey:(e,t)=>String(t),style:{padding:1,...c},className:u})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n}),r=(e,l)=>{let r=[...t.columns||[]];r[e]={...r[e],...l},n("columns",r)},[a,i]=(0,p.useState)(!1),[o,s]=(0,p.useState)(null),c=null!=o&&t.columns[o]?t.columns[o]:{title:"",dataIndex:"",width:"",align:"left",ellipsis:!1},u=[{title:"列名",dataIndex:"title"},{title:"数据索引",dataIndex:"dataIndex"},{title:"操作",width:80,align:"center",render:(e,l,r)=>(0,d.jsxs)(ey.Space,{children:[(0,d.jsx)("a",{onClick:()=>{s(r),i(!0)},children:(0,d.jsx)(ej.EditOutlined,{})}),(0,d.jsx)("a",{onClick:()=>{let e;(e=[...t.columns||[]]).splice(r,1),n("columns",e)},children:(0,d.jsx)(ej.DeleteOutlined,{})})]})}];return(0,d.jsxs)("div",{children:[(0,d.jsxs)(ey.Form,{labelCol:{span:12},wrapperCol:{span:12},children:[(0,d.jsx)(ey.Form.Item,{label:"大小",children:(0,d.jsxs)(ey.Radio.Group,{size:"small",value:t.size,onChange:e=>n("size",e.target.value),children:[(0,d.jsx)(ey.Radio.Button,{value:"small",children:"小"}),(0,d.jsx)(ey.Radio.Button,{value:"middle",children:"中"}),(0,d.jsx)(ey.Radio.Button,{value:"large",children:"大"})]})}),(0,d.jsx)(ey.Form.Item,{label:"边框",children:(0,d.jsx)(ey.Switch,{size:"small",checked:!!t.bordered,onChange:e=>n("bordered",e)})}),(0,d.jsx)(ey.Form.Item,{label:"显示表头",children:(0,d.jsx)(ey.Switch,{size:"small",checked:!!t.showHeader,onChange:e=>n("showHeader",e)})}),(0,d.jsx)(ey.Form.Item,{label:"分页大小",children:(0,d.jsx)(ey.InputNumber,{size:"small",value:t.pageSize,onChange:e=>n("pageSize",e)})})]}),(0,d.jsx)(ey.Divider,{children:"表格列设置"}),(0,d.jsx)(ey.Table,{size:"small",dataSource:t.columns,rowKey:(e,t)=>String(t),columns:u,pagination:!1,bordered:!0}),(0,d.jsx)(ey.Button,{size:"small",onClick:()=>{n("columns",[...t.columns||[],{title:"",dataIndex:"",width:"",align:"left",ellipsis:!1}])},block:!0,children:"添加列"}),(0,d.jsx)(ey.Modal,{title:"编辑列",open:a,footer:null,width:400,onCancel:()=>i(!1),children:(0,d.jsx)(ey.Form,{layout:"vertical",children:(0,d.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12},children:[(0,d.jsx)(ey.Form.Item,{label:"列名",children:(0,d.jsx)(ey.Input,{value:c.title,onChange:e=>r(o,{title:e.target.value})})}),(0,d.jsx)(ey.Form.Item,{label:"数据索引",children:(0,d.jsx)(ey.Input,{value:c.dataIndex,onChange:e=>r(o,{dataIndex:e.target.value})})}),(0,d.jsx)(ey.Form.Item,{label:"宽度",children:(0,d.jsx)(ey.Input,{value:c.width,onChange:e=>r(o,{width:e.target.value})})}),(0,d.jsx)(ey.Form.Item,{label:"对齐",children:(0,d.jsxs)(ey.Radio.Group,{value:c.align,onChange:e=>r(o,{align:e.target.value}),children:[(0,d.jsx)(ey.Radio.Button,{value:"left",children:(0,d.jsx)(ej.AlignLeftOutlined,{})}),(0,d.jsx)(ey.Radio.Button,{value:"center",children:(0,d.jsx)(ej.AlignCenterOutlined,{})}),(0,d.jsx)(ey.Radio.Button,{value:"right",children:(0,d.jsx)(ej.AlignRightOutlined,{})})]})}),(0,d.jsx)(ey.Form.Item,{label:"省略",children:(0,d.jsx)(ey.Switch,{checked:!!c.ellipsis,onChange:e=>r(o,{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:c}=e,{env:u,initCallback:m}=(0,p.useContext)(ex),x=th(t,i.datasource)||[],h=(0,p.useMemo)(()=>!!l&&!(l<=x.length)&&{total:x.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,x.length,r]),f=["p-list",a?`p-list--${a}`:void 0,r?`p-list--${r}`:void 0,o?"p-list--split":void 0,n?"p-list--bordered":void 0,c],g=()=>{console.log("callback list",eS(u,i))};return(0,p.useEffect)(()=>{m({id:i.id,callback:g})},[]),(0,d.jsxs)("div",{id:t,style:{display:"flex",flexDirection:"column",...s},className:f.filter(Boolean).join(" "),children:[(0,d.jsx)(tS,{list:x,split:o,bordered:n,size:r,itemLayout:a}),h&&(0,d.jsx)(ey.Pagination,{...h})]})},formComponent:e=>{let{model:t,onChange:l}=e,[n]=ey.Form.useForm();return(0,p.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,d.jsxs)(ey.Form,{form:n,labelCol:{span:12},wrapperCol:{span:12},onValuesChange:e=>{null==l||l({...t,...e})},children:[(0,d.jsx)(ey.Form.Item,{label:"大小",name:"size",children:(0,d.jsxs)(ey.Radio.Group,{size:"small",buttonStyle:"solid",children:[(0,d.jsx)(ey.Radio.Button,{value:"default",children:"默认"}),(0,d.jsx)(ey.Radio.Button,{value:"small",children:"小"})]})}),(0,d.jsx)(ey.Form.Item,{label:"布局",name:"itemLayout",children:(0,d.jsxs)(ey.Radio.Group,{size:"small",buttonStyle:"solid",children:[(0,d.jsx)(ey.Radio.Button,{value:"horizontal",children:"水平"}),(0,d.jsx)(ey.Radio.Button,{value:"vertical",children:"垂直"})]})}),(0,d.jsx)(ey.Form.Item,{label:"边框",name:"bordered",valuePropName:"checked",children:(0,d.jsx)(ey.Switch,{size:"small"})}),(0,d.jsx)(ey.Form.Item,{label:"分割线",name:"split",valuePropName:"checked",children:(0,d.jsx)(ey.Switch,{size:"small"})}),(0,d.jsx)(ey.Form.Item,{label:"分页大小",name:"pageSize",children:(0,d.jsx)(ey.InputNumber,{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,p.useContext)(ex),c=th(t,n.datasource),u=(0,p.useMemo)(()=>Object.keys(c||{}),[c]),m=(0,p.useMemo)(()=>u.map(e=>null==c?void 0:c[e]),[u,c]),x=(0,p.useMemo)(()=>(l||"").replace(/{ *{\s*([^}]+)\s*} *}/g,(e,t)=>{try{return Function(...u,`
1028
1032
  "use strict";
1029
1033
  const window = undefined;
1030
1034
  const document = undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bi-sdk-react",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/umd/js/bi-sdk.umd.min.js",