bi-sdk-react 0.0.4 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/css/bi-sdk.css +1 -1
- package/dist/es/js/bi-sdk.es.js +296 -63
- package/dist/types/components/PageDesigner.d.ts +9 -1
- package/dist/types/components/context/DesignerContext.d.ts +5 -2
- package/dist/types/components/context/EnvContext.d.ts +2 -1
- package/dist/types/components/icon/IconFont.d.ts +2 -1
- package/dist/types/components/layout/PageCanvas.d.ts +2 -0
- package/dist/types/components/panel/AiPanel.d.ts +4 -0
- package/dist/types/components/panel/ChatInput.d.ts +13 -6
- package/dist/types/components/panel/DatasetPanel.d.ts +11 -0
- package/dist/types/components/panel/PaneHeader.d.ts +1 -0
- package/dist/types/components/panel/PropertiesPanel.d.ts +3 -1
- package/dist/types/components/plugins/@antd/item-props/EchartsProps.d.ts +2 -2
- package/dist/types/components/plugins/@antd/item-props/TextProps.d.ts +1 -0
- package/dist/types/components/plugins/@antd/items/TableRender.d.ts +1 -0
- package/dist/types/components/plugins/@antd/items/TextRender.d.ts +1 -0
- package/dist/types/components/typing.d.ts +102 -2
- package/dist/types/components/utils.d.ts +1 -0
- package/dist/umd/css/bi-sdk.css +1 -1
- package/dist/umd/js/bi-sdk.umd.min.js +300 -67
- package/package.json +3 -2
- package/src/components/PageDesigner.tsx +231 -37
- package/src/components/context/DesignerContext.tsx +15 -3
- package/src/components/context/EnvContext.tsx +4 -1
- package/src/components/icon/IconFont.tsx +15 -11
- package/src/components/layout/PageCanvas.tsx +4 -2
- package/src/components/layout/PageItem.tsx +1 -1
- package/src/components/panel/AiPanel.tsx +656 -43
- package/src/components/panel/ChatInput.tsx +259 -147
- package/src/components/panel/DatasetPanel.tsx +65 -0
- package/src/components/panel/PaneHeader.tsx +3 -2
- package/src/components/panel/PropertiesPanel.tsx +332 -125
- package/src/components/plugins/@antd/index.ts +12 -8
- package/src/components/plugins/@antd/item-props/EchartsProps.tsx +52 -22
- package/src/components/plugins/@antd/item-props/HtmlProps.tsx +8 -9
- package/src/components/plugins/@antd/item-props/TextProps.tsx +13 -1
- package/src/components/plugins/@antd/items/EchartsRender.tsx +9 -1
- package/src/components/plugins/@antd/items/HtmlRender.tsx +13 -1
- package/src/components/plugins/@antd/items/ListRender.tsx +18 -1
- package/src/components/plugins/@antd/items/TableRender.tsx +16 -1
- package/src/components/plugins/@antd/items/TextRender.tsx +3 -1
- package/src/components/styles.css +20 -0
- package/src/components/typing.ts +117 -2
- package/src/components/utils.ts +40 -0
- package/src/example.tsx +344 -13
|
@@ -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("xlsx"),require("uuid"),require("dayjs"),require("@monaco-editor/react")):"function"==typeof define&&define.amd?define(["@ant-design/icons","echarts","styled-components","react","antd","xlsx","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("xlsx"),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.xlsx,e.uuid,e.dayjs,e["@monaco-editor/react"])}(this,(e,t,l,n,r,a,i,o,s)=>(()=>{var d={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=s},59(e){"use strict";e.exports=r},185(e){"use strict";e.exports=o},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=i},347(e){"use strict";e.exports=a}},c={};function u(e){var t=c[e];if(void 0!==t)return t.exports;var l=c[e]={exports:{}};return d[e].call(l.exports,l,l.exports,u),l.exports}u.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return u.d(t,{a:t}),t},u.d=(e,t)=>{for(var l in t)u.o(t,l)&&!u.o(e,l)&&Object.defineProperty(e,l,{enumerable:!0,get:t[l]})},u.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),u.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var p={};return(()=>{"use strict";u.r(p),u.d(p,{EnvContext:()=>em,DesignerContext:()=>ei,PageCanvas:()=>eg,PageSchema:()=>i.PageSchema,PageDesigner:()=>e9,PluginType:()=>i.PluginType,plugins:()=>tp,PropEditorProps:()=>o.PropEditorProps,handleCallback:()=>eq,DropContainer:()=>ep});var e,t,l,n,r,a,i={};u.r(i);var o={};u.r(o);var s=u(848),d=u(155),c=u.n(d),m=u(694),x=u.n(m);function h(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 f(e,t){if(e){if("string"==typeof e)return h(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)?h(e,t):void 0}}function g(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)||f(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 v=u(951),y="data-pdnd-honey-pot";function b(e){return e instanceof Element&&e.hasAttribute(y)}function j(e){var t=g(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 w(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 S(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 I(e){for(var t=1;t<arguments.length;t++){var l=null!=arguments[t]?arguments[t]:{};t%2?S(Object(l),!0).forEach(function(t){w(e,t,l[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(l)):S(Object(l)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(l,t))})}return e}function z(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 k(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 O(e){return function(e){if(Array.isArray(e))return h(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||f(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 N=E();(0,v.bindAll)(window,[{type:"dragstart",listener:function(){N.enterCount=0,N.isOverWindow=!0}},{type:"drop",listener:A},{type:"dragend",listener:A},{type:"dragenter",listener:function(e){N.isOverWindow||0!==N.enterCount||(e[D.isEnteringWindow]=!0),N.isOverWindow=!0,N.enterCount++}},{type:"dragleave",listener:function(e){N.enterCount--,N.isOverWindow&&0===N.enterCount&&(e[D.isLeavingWindow]=!0,N.isOverWindow=!1)}}],{capture:!0})}function E(){return{enterCount:0,isOverWindow:!1}}function A(){N=E()}function B(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)}}),M={isActive:!1};function $(){return!M.isActive}function q(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 H=function(e){var t=e.event,l=e.dragType,n=e.getDropTargetsOver,r=e.dispatchEvent;if($()){var a,i,o=function(e){var t=e.event,l=e.dragType,n=e.getDropTargetsOver,r=B(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});M.isActive=!0;var s={current:o};q({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,v.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:B(e)},s.current.dropTargets.length)?(e.preventDefault(),q({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:B(e)},m()}}].concat(O([{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=B(e),r=n({target:b(e.target)?j({x:t.clientX,y:t.clientY}):e.target,input:t,source:l.payload,current:s.current.dropTargets});r.length&&(e.preventDefault(),q({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(){M.isActive=!1,c()}},G=new Map;function Y(){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 U(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 K(e){for(var t=1;t<arguments.length;t++){var l=null!=arguments[t]?arguments[t]:{};t%2?U(Object(l),!0).forEach(function(t){w(e,t,l[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(l)):U(Object(l)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(l,t))})}return e}function W(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 J(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)?J(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 J(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 X(e){return e.slice(0).reverse()}function V(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 Q(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 Z=T(function(){return navigator.userAgent.toLocaleLowerCase().includes("android")}),ee="text/plain",et=new WeakMap,el=(a=null,{bindEvents:function(){return a=null,(0,v.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=z({client:d}),Object.assign(r.style,I(I({backgroundColor:"transparent",position:"fixed",padding:0,margin:0,boxSizing:"border-box"},k({clientRect:i})),{},{pointerEvents:"auto",zIndex:0x7fffffff})),document.body.appendChild(r),o=(0,v.bind)(window,{type:"pointermove",listener:function(e){i=z({client:{x:e.clientX,y:e.clientY}}),Object.assign(r.style,k({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,v.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}}}}),en=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 V(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)?V(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?Q(Object(l),!0).forEach(function(t){w(e,t,l[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(l)):Q(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=W(r.location.current.dropTargets);try{for(a.s();!(t=a.n()).done;){var i,o=t.value,s=n.get(o.element),d=K(K({},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=W(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=K(K({},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=W(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=K(K({},l),{},{self:g}),y=n.get(g.element);null==y||null==(h=y.onDropTargetChange)||h.call(y,v),null==y||null==(f=y.onDragEnter)||f.call(y,v)}}}catch(e){x.e(e)}finally{x.f()}}};return{dropTargetForConsumers:function(e){return T(Y(_(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,y={data:g,element:h.element,dropEffect:v,isActiveDueToStickiness:!1};return e({source:d,target:h.element.parentElement,input:u,result:[].concat(O(m),[y])})}({source:t,target:r,input:i});if(s.length>=o.length)return s;for(var d=X(o),c=X(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 y={input:i,source:t,element:v.element};if(v.canDrop&&!v.canDrop(y)||!(null!=(m=v.getIsSticky)&&m.call(v,y)))break;u.push(K(K({},x),{},{isActiveDueToStickiness:!0}))}return X(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){H({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:$,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 Y(el.bindEvents(),(0,v.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=et.get(s);if(d){var c=B(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=j({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=g(h[x],2),v=f[0],y=f[1];t.dataTransfer.setData(v,null!=y?y:"")}!Z()||t.dataTransfer.types.includes(ee)||t.dataTransfer.types.includes("text/uri-list")||t.dataTransfer.setData(ee,"pdnd:android-fallback"),t.dataTransfer.setData("application/vnd.pdnd","");var b={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:b,startedFrom:"internal"}})}}}}}))},dispatchEventToSource:function(e){var t,l,n=e.eventName,r=e.payload;null==(t=et.get(r.source.element))||null==(l=t[n])||l.call(t,r)},onPostDispatch:el.getOnPostDispatch()}),er=en.dropTarget;function ea(e){return T(Y(en.registerUsage(),(et.set(e.element,e),function(){et.delete(e.element)}),_(e.element,{attribute:"draggable",value:"true"})))}en.monitor;let ei=(0,d.createContext)({designable:!1,plugins:[],schema:{info:{},datasources:[],scripts:[],variables:[],items:[]},selectedItem:null,setSchema:()=>{},setSelectedItem:()=>{},updateSelectedItem:()=>{},forceUpdate:()=>{}}),eo=e=>{let{designable:t,plugins:l,schema:n,selectedItem:r,setSchema:a,setSelectedItem:i,children:o}=e;return(0,s.jsx)(ei.Provider,{value:{designable:!!t,plugins:l||[],schema:n,selectedItem:r,setSchema:a||(()=>{}),setSelectedItem:i||(()=>{}),updateSelectedItem:e=>{null==i||i(Object.assign(r,e||{})),null==a||a({...n})},forceUpdate:()=>{null==a||a({...n})}},children:o})},es=e=>{var t;let{item:l,onDelete:n,parentList:r,onListChange:a,index:i}=e,{designable:o,selectedItem:c,setSelectedItem:u,plugins:p}=(0,d.useContext)(ei),[m,x]=(0,d.useState)(!1),h=null==(t=p.find(e=>e.key===l.type))?void 0:t.component;return((0,d.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(c&&c===l&&o){let n=document.createElement("div");n.style.position="absolute",n.style.zIndex="9999",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()}},[c,o,l,n]),(0,d.useEffect)(()=>{let e=document.getElementById(`page-item-${l.id}`);if(!e||!o)return;let t=ea({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(),u&&u(l)};return o&&e.addEventListener("click",n),()=>{t(),o&&e.removeEventListener("click",n)}},[o,l,i,r]),h)?(0,s.jsx)(h,{id:`page-item-${l.id}`,"data-item-id":l.id,...l.props||{},item:l,className:`page-item-component ${o?"designable":""} ${c===l?"selected":""}`,style:{...l.style||{},opacity:m?.5:1}}):null},ed=x().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,DesignerContext:()=>eo,PageCanvas:()=>ev,PageSchema:()=>o.PageSchema,PageDesigner:()=>tu,PluginType:()=>o.PluginType,plugins:()=>tO,PropEditorProps:()=>s.PropEditorProps,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`
|
|
3
3
|
position: absolute;
|
|
4
4
|
background: #1890ff;
|
|
5
5
|
pointer-events: none;
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
&::before { left: -3px; top: -4px; }
|
|
42
42
|
&::after { left: -3px; bottom: -4px; }
|
|
43
43
|
`}
|
|
44
|
-
`,
|
|
44
|
+
`,eu=(e,t,l,n)=>{let r=e.getBoundingClientRect(),a=Array.from(e.children).filter(e=>!e.classList.contains("drop-indicator")&&e.getBoundingClientRect().width>0),i=(e=>{let t=Array.from(e.children).filter(e=>!e.classList.contains("drop-indicator")&&e.getBoundingClientRect().width>0);if(0===t.length){let t=window.getComputedStyle(e),{display:l,flexDirection:n}=t;return"flex"===l||"inline-flex"===l?!n.includes("column"):"grid"===l&&!t.gridAutoFlow.includes("column")}if(1===t.length){let l=window.getComputedStyle(t[0]),n=window.getComputedStyle(e);return"flex"===n.display||"inline-flex"===n.display?!n.flexDirection.includes("column"):!!["inline","inline-block","inline-flex"].includes(l.display)||"none"!==l.float}let l=0,n=0,r=t.map(e=>{let t=e.getBoundingClientRect(),r=t.left+t.width/2,a=t.top+t.height/2;return l+=r,n+=a,{cx:r,cy:a}}),a=l/t.length,i=n/t.length,o=0,s=0;return r.forEach(e=>{o+=(e.cx-a)**2,s+=(e.cy-i)**2}),o>=s})(e),o=e.scrollLeft,s=e.scrollTop;if(0===a.length)return{index:0,indicatorOffset:15,isHorizontal:i};let d=(e,t)=>i?(t?e.left:e.right)-r.left+o+(t?-4:4):(t?e.top:e.bottom)-r.top+s+(t?-4:4),c=e=>{let t=e.getAttribute("data-item-id");if(t){let e=n.findIndex(e=>e.id===t);if(-1!==e)return e}return a.indexOf(e)};for(let e=0;e<a.length;e++){let n=a[e].getBoundingClientRect();if(t>=n.left-5&&t<=n.right+5&&l>=n.top-5&&l<=n.bottom+5){let r=i?t<n.left+n.width/2:l<n.top+n.height/2,o=c(a[e]);return{index:r?o:o+1,indicatorOffset:d(n,r),isHorizontal:i}}}let u=1/0,p=!1,m=null,x=null;for(let e=0;e<a.length;e++){let n=a[e].getBoundingClientRect(),r=n.left+n.width/2,o=n.top+n.height/2,s=(t-r)**2+(l-o)**2;s<u&&(u=s,m=n,x=a[e],p=i?t<r:l<o)}if(x&&m){let e=c(x);return{index:p?e:e+1,indicatorOffset:d(m,p),isHorizontal:i}}let h=a[a.length-1].getBoundingClientRect();return{index:n.length,indicatorOffset:d(h,!1),isHorizontal:i}},ep=e=>{let{rootComponent:t="div",rootData:l={},list:n=[],item:r,onListChange:a,className:i}=e,{designable:o,selectedItem:s,setSelectedItem:c,forceUpdate:u}=(0,p.useContext)(eo),m=(0,p.useRef)(null),[x,h]=(0,p.useState)(!1),[f,g]=(0,p.useState)(0),[v,j]=(0,p.useState)(!1),[y,b]=(0,p.useState)(!1),w=(0,p.useRef)(n),C=(0,p.useRef)(a);(0,p.useEffect)(()=>{w.current=n,C.current=a},[n,a]);let S=(0,p.useMemo)(()=>n||[],[n]);(0,p.useEffect)(()=>{let e=m.current;if(!e)return;let t=ea({element:e,canDrop:e=>{let{source:t,element:l}=e;if(!o)return!1;let{data:n}=t.data||{};return(!l.classList.contains("ant-row")||(null==n?void 0:n.type)==="b-col")&&(!!l.classList.contains("ant-row")||(null==n?void 0:n.type)!=="b-col")},getData:()=>({localList:w.current}),onDragEnter:t=>{if(!o)return!1;let[l]=t.location.current.dropTargets;if((null==l?void 0:l.element)!==e)return;h(!0),b(!0);let n=t.location.current.input.clientY,{indicatorOffset:r,isHorizontal:a}=eu(e,t.location.current.input.clientX,n,w.current||[]);g(r),j(a)},onDrag:t=>{if(!o)return!1;let[l]=t.location.current.dropTargets;if((null==l?void 0:l.element)!==e){h(!1),b(!1);return}h(!0),b(!0);let n=t.location.current.input.clientY,{indicatorOffset:r,isHorizontal:a}=eu(e,t.location.current.input.clientX,n,w.current||[]);g(r),j(a)},onDragLeave:()=>{if(!o)return!1;h(!1),b(!1)},onDrop(t){if(!o)return!1;let[l]=t.location.current.dropTargets;if((null==l?void 0:l.element)!==e)return;h(!1),b(!1);let{data:n,list:r,onListChange:a,index:i}=t.source.data;null==c||c(n);let s=w.current||[],d=C.current,u=r===s||s.some(e=>e.id===n.id),p=t.location.current.input.clientY,{index:m}=eu(e,t.location.current.input.clientX,p,s);if(r)if(u){let e=[...s],t=e.findIndex(e=>e.id===n.id);if(-1!==t){let[l]=e.splice(t,1);e.splice(m>t?m-1:m,0,l),null==d||d(e)}else e.splice(m,0,n),null==d||d(e)}else{a&&r&&a(r.filter(e=>e.id!==n.id));let e=[...s];e.some(e=>e.id===n.id)||(e.splice(m,0,n),null==d||d(e))}else{let e=[...s];e.splice(m,0,n),null==d||d(e)}}});return()=>t()},[]);let I=[i,"drag-container","page-item-component",!n.length?"empty-container":"",s===r?"selected":"",o?"designable":""].filter(Boolean).join(" ");return(0,d.jsxs)(t,{...l||{},ref:m,className:I,style:{...null==l?void 0:l.style,position:"relative",minHeight:o?24:void 0,outline:x?"1px dashed #1890ff":void 0},children:[(0,d.jsx)(ec,{className:"drop-indicator",$offset:f,$vertical:v,$visible:y}),(Array.isArray(S)?S:[]).filter(Boolean).map((e,t)=>(0,d.jsx)(ed,{item:e,parentList:S,onListChange:a,index:t,onDelete:()=>null==a?void 0:a(S.filter(t=>t.id!==e.id))},e.id||t))]})},em=ep,ex=(0,p.createContext)({deviceWidth:0,env:{global:{},local:{}},callbacks:{},initCallback:e=>{let{id:t,callback:l}=e}}),eh=e=>{let{deviceWidth:t,env:l,fetch:n,callbacks:r,initCallback:a,children:i}=e;return(0,d.jsx)(ex.Provider,{value:{deviceWidth:t,env:l,fetch:n,callbacks:r,initCallback:a},children:i})},ef=h().div`
|
|
45
45
|
.empty-container.designable {
|
|
46
46
|
min-width: 10px;
|
|
47
47
|
min-height: 30px;
|
|
@@ -75,23 +75,11 @@
|
|
|
75
75
|
outline: 1px solid #1890ff;
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
`,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
height: 40px;
|
|
84
|
-
display: flex;
|
|
85
|
-
align-items: center;
|
|
86
|
-
justify-content: space-between;
|
|
87
|
-
.title {
|
|
88
|
-
font-size: 14px;
|
|
89
|
-
line-height: 40px;
|
|
90
|
-
}
|
|
91
|
-
.extra {
|
|
92
|
-
line-height: 32px;
|
|
93
|
-
}
|
|
94
|
-
`,ew=e=>{let{title:t="",extra:l}=e;return(0,s.jsxs)(eC,{className:"pane-header",children:[(0,s.jsx)("span",{className:"title",children:t}),(0,s.jsx)("div",{className:"extra",children:l})]})};var eS=u(347);let eI=x().div`
|
|
78
|
+
`,eg=m().forwardRef((e,t)=>{let{device:l="desktop",fetch:n}=e,{schema:r,forceUpdate:a}=(0,p.useContext)(eo),i=(0,p.useRef)(null),[o,s]=(0,p.useState)(0),[c,u]=(0,p.useState)({}),[m,x]=(0,p.useState)({global:{},local:{}}),h=(0,p.useMemo)(()=>r.items||[],[r.items]),[f,g]=(0,p.useState)(h);(0,p.useEffect)(()=>{g(r.items||[])},[r.items]),(0,p.useEffect)(()=>{let e={};(r.variables||[]).forEach(t=>{e[t.name]=t.value}),x(t=>({...t,global:e}))},[r.variables]);let v=()=>{var e;let t=null==(e=i.current)?void 0:e.parentElement,l=null==t?void 0:t.getBoundingClientRect(),n=(null==l?void 0:l.width)||0;n<=100?setTimeout(v,10):s(n?n-36:0)};return(0,p.useEffect)(()=>{v()},[l]),(0,p.useEffect)(()=>{let e=()=>v();return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),(0,p.useImperativeHandle)(t,()=>({handleResize(){v()},get dom(){return i.current}})),(0,d.jsx)(eh,{deviceWidth:o,env:m,callbacks:c,initCallback:e=>{let{id:t,callback:l}=e;u(e=>({...e,[t]:l}))},fetch:n,children:(0,d.jsx)(ef,{ref:i,children:(0,d.jsx)(ep,{list:f,onListChange:e=>{let t=[...e];r.items=t,g(t),null==a||a()},className:"page-canvas"})})})}),ev=eg;var ej=c(375),ey=c(59);let eb=(0,ej.createFromIconfontCN)({scriptUrl:"https://at.alicdn.com/t/c/font_5072483_zvtcct793i.js"}),ew=e=>{let{type:t,className:l="",style:n={}}=e;return(0,d.jsx)(eb,{type:t,className:l,style:n})};var eC=c(315);let eS=(e,t)=>({...e.global,...e.local[t.id||""]||{}}),eI=(e,t,l,n)=>{(t.cascadeIds||[]).forEach(t=>{e.local[t]=e.local[t]||{},e.local[t][l]=n})},ez=(e,t,l)=>{let n=eS(e,t);(t.cascadeIds||[]).forEach(e=>{let t=l[e];"function"==typeof t&&t(n)})},ek=()=>(0,eC.v4)(),eO=e=>{if(!e)return"";let t=new Date(e),l=new Date,n=l.getTime()-t.getTime();if(n<6e4)return"刚刚";if(n<36e5)return`${Math.floor(n/6e4)}分钟前`;let r=e=>e.toString().padStart(2,"0"),a=r(t.getHours()),i=r(t.getMinutes());if(t.getDate()===l.getDate()&&t.getMonth()===l.getMonth()&&t.getFullYear()===l.getFullYear())return`${a}:${i}`;let o=r(t.getMonth()+1),s=r(t.getDate());if(t.getFullYear()===l.getFullYear())return`${o}-${s} ${a}:${i}`;let d=t.getFullYear();return`${d}-${o}-${s} ${a}:${i}`},eN=h().div`
|
|
79
|
+
max-height: 400px;
|
|
80
|
+
overflow: auto;
|
|
81
|
+
background: #fff;
|
|
82
|
+
|
|
95
83
|
ul.agent-list {
|
|
96
84
|
margin: 0;
|
|
97
85
|
padding: 0;
|
|
@@ -116,6 +104,7 @@
|
|
|
116
104
|
text-overflow: ellipsis;
|
|
117
105
|
white-space: nowrap;
|
|
118
106
|
}
|
|
107
|
+
`,eT=h().div`
|
|
119
108
|
.chat-input {
|
|
120
109
|
display: flex;
|
|
121
110
|
flex-direction: column;
|
|
@@ -287,21 +276,6 @@
|
|
|
287
276
|
.agent-trigger:hover {
|
|
288
277
|
background-color: #f7f7f7;
|
|
289
278
|
}
|
|
290
|
-
.title-toggle {
|
|
291
|
-
display: none;
|
|
292
|
-
align-items: center;
|
|
293
|
-
gap: 6px;
|
|
294
|
-
background-color: #ffffff;
|
|
295
|
-
border: solid 1px #dcdcdc;
|
|
296
|
-
border-radius: 5px;
|
|
297
|
-
padding: 0 4px;
|
|
298
|
-
height: 26px;
|
|
299
|
-
}
|
|
300
|
-
.title-toggle .label {
|
|
301
|
-
color: #666;
|
|
302
|
-
font-size: 12px;
|
|
303
|
-
user-select: none;
|
|
304
|
-
}
|
|
305
279
|
.attach-upload {
|
|
306
280
|
display: inline-flex;
|
|
307
281
|
align-items: center;
|
|
@@ -315,6 +289,9 @@
|
|
|
315
289
|
font-size: 12px;
|
|
316
290
|
cursor: pointer;
|
|
317
291
|
}
|
|
292
|
+
.ant-btn .anticon {
|
|
293
|
+
color: var(--ant-color-text-label);
|
|
294
|
+
}
|
|
318
295
|
.tips {
|
|
319
296
|
color: #999;
|
|
320
297
|
font-size: 12px;
|
|
@@ -339,7 +316,23 @@
|
|
|
339
316
|
.send-btn.send-btn-active {
|
|
340
317
|
background-color: var(--ant-color-primary);
|
|
341
318
|
}
|
|
342
|
-
`,
|
|
319
|
+
`,eR=[],eF=[],eD=["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","audio/wav"],eE=[".xlsx",".wav"],eA=e=>{let{open:t,onCancel:l,onOk:n,allowedExtensions:r,allowedMimeTypes:a}=e,[i,o]=(0,p.useState)([]);(0,p.useEffect)(()=>{t&&o([])},[t]);let s=[...eE,...eD].join(",");return(0,d.jsxs)(ey.Modal,{title:"上传文件",open:t,okText:"上传",cancelText:"取消",onOk:()=>{n(i),l()},onCancel:l,width:600,children:[(0,d.jsx)("div",{style:{marginBottom:16},children:(0,d.jsxs)(ey.Typography.Text,{type:"secondary",children:["支持的文件类型:",r.join(", "),(0,d.jsx)("br",{}),"单次支持上传多个文件,请确保文件内容合规。",(0,d.jsx)("br",{}),"Excel 暂不支持加密文件。",(0,d.jsx)("br",{}),"不支持 xls 电子表格,请自行转换为 xlsx 格式。",(0,d.jsx)("br",{}),"Excel 仅支持第一行为表头、第二行开始为数据,不支持合并单元格。"]})}),(0,d.jsxs)(ey.Upload.Dragger,{...{name:"file",multiple:!0,accept:s,fileList:[],beforeUpload:e=>{let t=a.includes(e.type)||!e.type,l=(e.name||"").substring(e.name.lastIndexOf(".")).toLowerCase(),n=r.includes(l);return t||n?(o(t=>[...t,e]),!1):(ey.message.error(`不支持的文件类型: ${e.name}`),ey.Upload.LIST_IGNORE)}},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:"支持上传Excel表格数据或音频文件进行分析"})]}),i.length>0&&(0,d.jsxs)("div",{style:{marginTop:16},children:[(0,d.jsxs)(ey.Typography.Title,{level:5,style:{fontSize:14,marginBottom:8},children:["已选文件 (",i.length,")"]}),(0,d.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:8,maxHeight:200,overflowY:"auto"},children:i.map((e,t)=>(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",background:"#f5f5f5",borderRadius:4},children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,overflow:"hidden"},children:[e.name.endsWith(".xlsx")?(0,d.jsx)(ej.FileExcelOutlined,{style:{color:"#52c41a"}}):(0,d.jsx)(ej.AudioOutlined,{style:{color:"#1890ff"}}),(0,d.jsx)(ey.Typography.Text,{ellipsis:!0,style:{maxWidth:300},children:e.name}),(0,d.jsxs)(ey.Typography.Text,{type:"secondary",style:{fontSize:12},children:["(",(e.size/1024).toFixed(1)," KB)"]})]}),(0,d.jsx)(ey.Button,{type:"text",size:"small",icon:(0,d.jsx)(ej.DeleteOutlined,{}),onClick:()=>{o(e=>e.filter((e,l)=>l!==t))},danger:!0})]},`${e.name}-${t}`))})]})]})},eB=m().forwardRef((e,t)=>{let{value:l="",placeholder:n="请输入需求,例如:分析 2025 年人口结构并生成可视化报告",disabled:r=!1,sending:a=!1,rows:i=6,agentList:o=eR,agentId:s=null,attachments:c=eF,onInput:u,onSubmit:m,onUpdateAgentId:x,onUpdateAttachments:h,onUploading:f,style:g={}}=e,v=(0,p.useRef)(null),[j,y]=(0,p.useState)([]),[b,w]=(0,p.useState)(l||""),[C,S]=(0,p.useState)(0),[I,z]=(0,p.useState)(Array.isArray(c)?c:[]),[k,O]=(0,p.useState)(!1),N=(0,p.useMemo)(()=>!1,[]);(0,p.useImperativeHandle)(t,()=>({focus(){var e;null==(e=v.current)||e.focus()}})),(0,p.useEffect)(()=>w(l||""),[l]),(0,p.useEffect)(()=>{u&&u(b)},[b]),(0,p.useEffect)(()=>z(Array.isArray(c)?c:[]),[c]);let T=!!(b&&b.trim()),R=async e=>{if(O(!1),!f||!e.length)return;let t=[];for(let l of e)try{let e=await f(l);e&&t.push({id:e.id,name:l.name,size:l.size})}catch(e){console.error(e)}z([...I,...t]),h&&h([...I,...t])},F=()=>{if(!T||a)return;let e=Date.now();if(e-C<400)return;S(e);let t=(b||"").trim();if(!t)return;let l={message:t,agents:j.map(e=>({id:e.id,name:e.name})),files:I.map(e=>({id:e.id,name:e.name,extension:e.name.substring(e.name.lastIndexOf("."))}))};m&&m(l),w("")},D=(0,d.jsx)(eN,{children:(0,d.jsx)("ul",{className:"agent-list",children:o.map(e=>(0,d.jsx)("li",{children:(0,d.jsx)("a",{onClick:()=>{let t;return t=e.id||null,void(x&&x(t),y(t=>[...t,e]))},children:e.name})},String(e.id)))})});return(0,d.jsx)(eT,{style:g,children:(0,d.jsxs)("div",{className:"chat-input",children:[(0,d.jsxs)("div",{className:"input-stack",children:[I.length>0&&(0,d.jsx)("div",{className:"attachment-bar",children:I.map(e=>(0,d.jsxs)("div",{className:"attachment-card",children:[e.name.endsWith(".xlsx")?(0,d.jsx)(ew,{type:"icon-excel"}):(0,d.jsx)(ew,{type:"icon-audio"}),(0,d.jsx)(ey.Typography.Text,{className:"name",ellipsis:{tooltip:e.name},children:e.name}),(0,d.jsx)("a",{className:"remove",onClick:()=>{var t;let l;return t=e.id,void(z(l=I.filter(e=>e.id!==t)),h&&h(l))},children:(0,d.jsx)(ej.DeleteOutlined,{})})]},e.id))}),j.length>0&&(0,d.jsx)("div",{className:"agent-info",children:j.map((e,t)=>(0,d.jsxs)("div",{children:[(0,d.jsxs)("span",{className:"name",children:["@ ",e.name]}),(0,d.jsx)("a",{className:"remove",onClick:()=>{x&&x(null),y(e=>e.filter((e,l)=>l!==t))},children:"\xd7"})]},String(e.id)))}),(0,d.jsx)(ey.Input.TextArea,{ref:v,className:"input textarea-stacked",placeholder:n,disabled:r||a,autoSize:{minRows:i,maxRows:i},value:b,onPressEnter:e=>{"Enter"===e.key&&(e.shiftKey||(e.preventDefault(),F()))},onChange:e=>w(e.target.value)})]}),(0,d.jsxs)("div",{className:"footer",children:[(0,d.jsxs)("div",{className:"left",children:[!!(null==o?void 0:o.length)&&(0,d.jsx)(ey.Dropdown,{trigger:["click"],popupRender:()=>D,placement:"topLeft",styles:{root:{boxShadow:"var(--ant-box-shadow-card)"}},children:(0,d.jsx)(ey.Tooltip,{title:"选择助理",children:(0,d.jsx)(ey.Button,{className:"agent-trigger",onClick:e=>e.preventDefault(),children:(0,d.jsx)(ew,{type:"icon-at"})})})}),f&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(ey.Tooltip,{title:"上传文件",children:(0,d.jsx)(ey.Button,{className:"attach-upload",onClick:()=>O(!0),disabled:r||a,children:(0,d.jsx)(ew,{type:"icon-paper-clip"})})}),(0,d.jsx)(eA,{open:k,onCancel:()=>O(!1),onOk:R,allowedExtensions:eE,allowedMimeTypes:eD})]})]}),(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6},children:[!N&&(0,d.jsx)("div",{className:"tips",children:"按 Enter 发送,Shift+Enter 换行"}),(0,d.jsx)("a",{className:`send-btn ${!a&&(null==b?void 0:b.length)>0?"send-btn-active":""}`,onClick:F,children:(0,d.jsx)(ej.SendOutlined,{})})]})]})]})})}),eM=h().div`
|
|
320
|
+
width: 100%;
|
|
321
|
+
padding: 0 12px;
|
|
322
|
+
border-bottom: solid 1px #e8e8e8;
|
|
323
|
+
background: #ffffff;
|
|
324
|
+
height: 40px;
|
|
325
|
+
display: flex;
|
|
326
|
+
align-items: center;
|
|
327
|
+
justify-content: space-between;
|
|
328
|
+
.title {
|
|
329
|
+
font-size: 14px;
|
|
330
|
+
line-height: 40px;
|
|
331
|
+
}
|
|
332
|
+
.extra {
|
|
333
|
+
line-height: 32px;
|
|
334
|
+
}
|
|
335
|
+
`,eL=e=>{let{title:t="",extra:l,style:n={}}=e;return(0,d.jsxs)(eM,{className:"pane-header",style:n,children:[(0,d.jsx)("span",{className:"title",children:t}),(0,d.jsx)("div",{className:"extra",children:l})]})},eP=h().div`
|
|
343
336
|
display: flex;
|
|
344
337
|
flex-direction: column;
|
|
345
338
|
height: 100%;
|
|
@@ -348,7 +341,7 @@
|
|
|
348
341
|
display: flex;
|
|
349
342
|
flex-direction: column;
|
|
350
343
|
gap: 12px;
|
|
351
|
-
padding:
|
|
344
|
+
padding: 0 !important;
|
|
352
345
|
}
|
|
353
346
|
.conversation-list {
|
|
354
347
|
margin: 0;
|
|
@@ -380,7 +373,230 @@
|
|
|
380
373
|
.conversation-list li small {
|
|
381
374
|
white-space: nowrap;
|
|
382
375
|
}
|
|
383
|
-
`,
|
|
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{id:n,answer:r,createdAt:a,conversation:i}=await (null==(t=f.ai)?void 0:t.chat(eY,h,g,e));v((null==i?void 0:i.id)||""),y(e=>[...e,i||{}]),Object.assign(l,{id:n,answer:r,createdAt:a,conversationId:(null==i?void 0:i.id)||"",sending:!1}),r.effect&&(null==x||x(r.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`
|
|
377
|
+
flex: 1 1 auto;
|
|
378
|
+
display: flex;
|
|
379
|
+
align-items: center;
|
|
380
|
+
justify-content: center;
|
|
381
|
+
height: 100%;
|
|
382
|
+
padding: 12px;
|
|
383
|
+
|
|
384
|
+
.content {
|
|
385
|
+
display: flex;
|
|
386
|
+
flex-direction: column;
|
|
387
|
+
align-items: center;
|
|
388
|
+
gap: 12px;
|
|
389
|
+
text-align: center;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
.logo {
|
|
393
|
+
width: 64px;
|
|
394
|
+
height: 64px;
|
|
395
|
+
border-radius: 8px;
|
|
396
|
+
display: flex;
|
|
397
|
+
align-items: center;
|
|
398
|
+
justify-content: center;
|
|
399
|
+
// background: var(--link-bg-color);
|
|
400
|
+
// border: 1px solid var(--ant-color-border);
|
|
401
|
+
color: var(--ant-color-info-text-active);
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
.title {
|
|
405
|
+
font-size: 18px;
|
|
406
|
+
font-weight: 600;
|
|
407
|
+
color: var(--ant-color-text);
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
.desc {
|
|
411
|
+
font-size: 14px;
|
|
412
|
+
color: var(--ant-color-text-secondary);
|
|
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`
|
|
415
|
+
width: 260px;
|
|
416
|
+
padding: 8px;
|
|
417
|
+
.group {
|
|
418
|
+
display: flex;
|
|
419
|
+
flex-direction: column;
|
|
420
|
+
gap: 6px;
|
|
421
|
+
margin-bottom: 6px;
|
|
422
|
+
}
|
|
423
|
+
.group-title {
|
|
424
|
+
color: var(--ant-color-text-secondary);
|
|
425
|
+
font-size: 12px;
|
|
426
|
+
}
|
|
427
|
+
.group-list {
|
|
428
|
+
margin: 0;
|
|
429
|
+
padding: 0;
|
|
430
|
+
list-style: none;
|
|
431
|
+
display: flex;
|
|
432
|
+
flex-direction: column;
|
|
433
|
+
gap: 6px;
|
|
434
|
+
}
|
|
435
|
+
.group-list li {
|
|
436
|
+
display: flex;
|
|
437
|
+
align-items: center;
|
|
438
|
+
justify-content: space-between;
|
|
439
|
+
gap: 6px;
|
|
440
|
+
padding: 6px 8px;
|
|
441
|
+
border-radius: 6px;
|
|
442
|
+
background: var(--link-bg-color);
|
|
443
|
+
cursor: pointer;
|
|
444
|
+
font-size: 13px;
|
|
445
|
+
}
|
|
446
|
+
.group-list li.actived {
|
|
447
|
+
background: var(--ant-color-primary-bg);
|
|
448
|
+
}
|
|
449
|
+
.group-list li a {
|
|
450
|
+
color: var(--ant-color-text);
|
|
451
|
+
flex: auto;
|
|
452
|
+
overflow: hidden;
|
|
453
|
+
text-overflow: ellipsis;
|
|
454
|
+
white-space: nowrap;
|
|
455
|
+
}
|
|
456
|
+
.group-list li small a {
|
|
457
|
+
color: var(--ant-color-error);
|
|
458
|
+
}
|
|
459
|
+
`,e_=h().div`
|
|
460
|
+
height: 100%;
|
|
461
|
+
display: flex;
|
|
462
|
+
flex-direction: column;
|
|
463
|
+
gap: 12px;
|
|
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
|
+
}
|
|
485
|
+
.msg {
|
|
486
|
+
display: flex;
|
|
487
|
+
flex-direction: column;
|
|
488
|
+
gap: 8px;
|
|
489
|
+
border-radius: var(--ant-border-radius);
|
|
490
|
+
// border: 1px solid var(--ant-color-border);
|
|
491
|
+
padding: 8px 10px;
|
|
492
|
+
background: var(--ant-color-bg-container);
|
|
493
|
+
|
|
494
|
+
.user-message {
|
|
495
|
+
background: var(--ant-color-primary-bg);
|
|
496
|
+
padding: 8px 10px;
|
|
497
|
+
max-width: 90%;
|
|
498
|
+
margin: 10px 0 10px auto;
|
|
499
|
+
position: relative;
|
|
500
|
+
|
|
501
|
+
.msg-tools {
|
|
502
|
+
position: absolute;
|
|
503
|
+
top: 0;
|
|
504
|
+
left: -25px;
|
|
505
|
+
display: none;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
&:hover .msg-tools {
|
|
509
|
+
display: flex;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
.msg-header {
|
|
513
|
+
justify-content: flex-end;
|
|
514
|
+
color: var(--ant-color-text-tertiary);
|
|
515
|
+
padding: 4px 0 8px 0;
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
.assistant-message {
|
|
519
|
+
.msg-header .msg-title {
|
|
520
|
+
color: var(--ant-color-primary);
|
|
521
|
+
padding: 8px 0;
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
.msg-header {
|
|
526
|
+
display: flex;
|
|
527
|
+
align-items: center;
|
|
528
|
+
justify-content: space-between;
|
|
529
|
+
color: var(--ant-color-text-secondary);
|
|
530
|
+
font-size: 12px;
|
|
531
|
+
}
|
|
532
|
+
.msg-title {
|
|
533
|
+
font-weight: 600;
|
|
534
|
+
color: var(--ant-color-text);
|
|
535
|
+
}
|
|
536
|
+
.msg-content {
|
|
537
|
+
color: var(--ant-color-text);
|
|
538
|
+
font-size: 13px;
|
|
539
|
+
line-height: 1.6;
|
|
540
|
+
white-space: pre-wrap;
|
|
541
|
+
}
|
|
542
|
+
.msg-meta {
|
|
543
|
+
display: flex;
|
|
544
|
+
align-items: center;
|
|
545
|
+
gap: 0 8px;
|
|
546
|
+
flex-wrap: wrap;
|
|
547
|
+
|
|
548
|
+
.ant-tag {
|
|
549
|
+
padding-inline: 0;
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
.msg-section {
|
|
553
|
+
display: flex;
|
|
554
|
+
flex-direction: column;
|
|
555
|
+
gap: 6px;
|
|
556
|
+
}
|
|
557
|
+
.msg-ai-meta {
|
|
558
|
+
&-title {
|
|
559
|
+
padding: 8px 4px;
|
|
560
|
+
font-size: 12px;
|
|
561
|
+
color: var(--ant-color-text-tertiary);
|
|
562
|
+
}
|
|
563
|
+
&-list {
|
|
564
|
+
max-height: 200px;
|
|
565
|
+
overflow: auto;
|
|
566
|
+
display: flex;
|
|
567
|
+
flex-wrap: wrap;
|
|
568
|
+
flex-direction: row;
|
|
569
|
+
gap: 4px;
|
|
570
|
+
|
|
571
|
+
.ant-tag {
|
|
572
|
+
max-width: 155px;
|
|
573
|
+
overflow: hidden;
|
|
574
|
+
text-overflow: ellipsis;
|
|
575
|
+
white-space: nowrap;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
&.vertical {
|
|
579
|
+
flex-direction: column;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
&-item {
|
|
583
|
+
font-size: 12px;
|
|
584
|
+
color: var(--ant-color-text-label);
|
|
585
|
+
margin-bottom: 4px;
|
|
586
|
+
|
|
587
|
+
&:last-child {
|
|
588
|
+
margin-bottom: 0;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
.ant-tag {
|
|
592
|
+
display: inline;
|
|
593
|
+
max-width: unset;
|
|
594
|
+
margin-right: 6px;
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
`,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.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`
|
|
384
600
|
display: flex;
|
|
385
601
|
flex-direction: column;
|
|
386
602
|
height: 100%;
|
|
@@ -419,7 +635,7 @@
|
|
|
419
635
|
font-size: 16px;
|
|
420
636
|
color: var(--ant-color-text-secondary);
|
|
421
637
|
}
|
|
422
|
-
`,
|
|
638
|
+
`,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`
|
|
423
639
|
display: flex;
|
|
424
640
|
flex-direction: column;
|
|
425
641
|
height: 100%;
|
|
@@ -461,7 +677,7 @@
|
|
|
461
677
|
overflow: hidden;
|
|
462
678
|
font-size: 12px;
|
|
463
679
|
}
|
|
464
|
-
`,
|
|
680
|
+
`,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`
|
|
465
681
|
display: flex;
|
|
466
682
|
flex-direction: column;
|
|
467
683
|
height: 100%;
|
|
@@ -498,7 +714,7 @@
|
|
|
498
714
|
.margin-bottom-0 {
|
|
499
715
|
margin-bottom: 0;
|
|
500
716
|
}
|
|
501
|
-
`,
|
|
717
|
+
`,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`
|
|
502
718
|
display: flex;
|
|
503
719
|
flex-direction: column;
|
|
504
720
|
height: 100%;
|
|
@@ -510,7 +726,7 @@
|
|
|
510
726
|
padding: 12px;
|
|
511
727
|
overflow: auto;
|
|
512
728
|
}
|
|
513
|
-
`,
|
|
729
|
+
`,e9=h()(ey.Tree)`
|
|
514
730
|
.ant-tree-draggable-icon {
|
|
515
731
|
display: none;
|
|
516
732
|
}
|
|
@@ -520,7 +736,7 @@
|
|
|
520
736
|
overflow: hidden;
|
|
521
737
|
text-overflow: ellipsis;
|
|
522
738
|
}
|
|
523
|
-
`,
|
|
739
|
+
`,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",slot:e,origin:a,children:t(a[e])})})),{key:n,title:r,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 t.map(t=>{var l,n,a;return{key:t.key,title:(0,d.jsx)("span",{children:(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`
|
|
524
740
|
display: flex;
|
|
525
741
|
flex-direction: column;
|
|
526
742
|
height: 100%;
|
|
@@ -532,12 +748,12 @@
|
|
|
532
748
|
padding: 12px;
|
|
533
749
|
overflow: auto;
|
|
534
750
|
|
|
751
|
+
.ant-form-item {
|
|
752
|
+
margin-bottom: 8px;
|
|
753
|
+
}
|
|
754
|
+
|
|
535
755
|
.ant-form-item-label {
|
|
536
756
|
text-align: left;
|
|
537
|
-
|
|
538
|
-
label {
|
|
539
|
-
display: inline;
|
|
540
|
-
}
|
|
541
757
|
}
|
|
542
758
|
|
|
543
759
|
.ant-form-item-control-input,
|
|
@@ -545,8 +761,12 @@
|
|
|
545
761
|
text-align: end;
|
|
546
762
|
justify-content: flex-end;
|
|
547
763
|
}
|
|
764
|
+
|
|
765
|
+
.ant-divider {
|
|
766
|
+
margin: 0;
|
|
767
|
+
}
|
|
548
768
|
}
|
|
549
|
-
`,
|
|
769
|
+
`,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`
|
|
550
770
|
display: flex;
|
|
551
771
|
flex-direction: column;
|
|
552
772
|
height: 100%;
|
|
@@ -585,7 +805,7 @@
|
|
|
585
805
|
font-size: 14px;
|
|
586
806
|
padding: 0 50px;
|
|
587
807
|
}
|
|
588
|
-
`,
|
|
808
|
+
`,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`
|
|
589
809
|
display: flex;
|
|
590
810
|
flex-direction: column;
|
|
591
811
|
height: 100%;
|
|
@@ -596,7 +816,19 @@
|
|
|
596
816
|
gap: 12px;
|
|
597
817
|
padding: 12px;
|
|
598
818
|
}
|
|
599
|
-
`,
|
|
819
|
+
`,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`
|
|
820
|
+
display: flex;
|
|
821
|
+
flex-direction: column;
|
|
822
|
+
height: 100%;
|
|
823
|
+
.body {
|
|
824
|
+
flex: 1 1 auto;
|
|
825
|
+
display: flex;
|
|
826
|
+
flex-direction: column;
|
|
827
|
+
gap: 12px;
|
|
828
|
+
padding: 12px;
|
|
829
|
+
overflow: auto;
|
|
830
|
+
}
|
|
831
|
+
`,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`
|
|
600
832
|
height: 100%;
|
|
601
833
|
display: grid;
|
|
602
834
|
background: #ffffff;
|
|
@@ -664,6 +896,7 @@
|
|
|
664
896
|
flex-direction: column;
|
|
665
897
|
gap: 12px;
|
|
666
898
|
padding: 12px;
|
|
899
|
+
height: calc(100% - 40px);
|
|
667
900
|
}
|
|
668
901
|
.left-pane-tabs > label,
|
|
669
902
|
.right-pane-tabs > label {
|
|
@@ -686,11 +919,11 @@
|
|
|
686
919
|
border-right: solid 2px #1890ff;
|
|
687
920
|
background: linear-gradient(to left, #1890ff1a, #ffffff);
|
|
688
921
|
}
|
|
689
|
-
`,e5=e=>{let{open:t,onCancel:l,onOk:n}=e,[r,a]=(0,d.useState)(JSON.stringify({info:{},datasources:[],scripts:[],variables:[],items:[]}));return(0,s.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,s.jsx)("div",{className:"body",style:{flex:"1 1 auto",display:"flex",height:"100%"},children:(0,s.jsx)(eE.Editor,{height:"100%",defaultLanguage:"json",value:r,options:{minimap:{enabled:!1}},onChange:e=>a(e||"")})})})},e9=c().forwardRef((e,t)=>{var l;let n,{agentList:r=[],plugins:a=[],headerExtra:i}=e,o=(0,d.useRef)(null),[c,u]=(0,d.useState)(1),[p,m]=(0,d.useState)([]),[x,h]=(0,d.useState)([]),[f,g]=(0,d.useState)(!1),[v,y]=(0,d.useState)("desktop"),[b,j]=(0,d.useState)("component"),[C,w]=(0,d.useState)("ai"),[S,I]=(0,d.useState)(!0),[z,k]=(0,d.useState)(!0),[O,T]=(0,d.useState)(null),[R,F]=(0,d.useState)({info:{},datasources:[],scripts:[],variables:[],items:[]}),[D,N]=(0,d.useState)(!0),[E,A]=(0,d.useState)(!1),B=(0,d.useMemo)(()=>{let e=S?"250px":"",t=z?"400px":"";return{gridTemplateColumns:`${e} 1fr ${t}`}},[S,z]),L=(0,d.useMemo)(()=>({display:S?"flex":"none"}),[S]),P=(0,d.useMemo)(()=>({display:z?"flex":"none"}),[z]);l=[R],(n=(0,d.useRef)()).current===JSON.stringify(l)&&n.current||(n.current=JSON.stringify(l),(()=>{f||(m(e=>e.length?[...e,JSON.parse(JSON.stringify(R))].slice(-50):[JSON.parse(JSON.stringify(R))]),h([]))})()),(0,d.useImperativeHandle)(t,()=>({handleOpen(e){g(!0),M(e.items),F(e),m([JSON.parse(JSON.stringify(e))]),h([]),setTimeout(()=>g(!1),0)}}));let M=(e,t)=>{e&&e.forEach(e=>{e.id||(e.id=t||Math.random().toString(36).slice(2,10)),Array.isArray(e.children)?M(e.children):"object"==typeof e.children&&e.children&&Object.keys(e.children).forEach(t=>{Array.isArray(e.children[t])&&M(e.children[t],Math.random().toString(36).slice(2,10))})})};return(0,s.jsxs)(eo,{designable:D,plugins:a,schema:R,selectedItem:O,setSchema:F,setSelectedItem:T,children:[(0,s.jsxs)("div",{style:{display:"flex",flexDirection:"column",height:"100%"},children:[(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 24px",borderBottom:"solid 1px #e8e8e8"},children:[(0,s.jsxs)(ey.Space,{children:[(0,s.jsx)("span",{style:{fontSize:16,fontWeight:500},children:"创建数据报表"}),(0,s.jsx)(ey.Divider,{orientation:"vertical"}),(0,s.jsx)(ey.Tooltip,{title:"保存",children:(0,s.jsx)("a",{className:"toolbar",children:(0,s.jsx)(ev.SaveOutlined,{})})}),(0,s.jsx)(ey.Divider,{orientation:"vertical"}),(0,s.jsx)(ey.Tooltip,{title:"撤销",children:(0,s.jsx)("a",{className:`toolbar ${p.length>1?"active":""}`,onClick:()=>{m(e=>{if(e.length<=1)return e;g(!0);let t=e[e.length-2];return h(e=>[...e,JSON.parse(JSON.stringify(R))]),F(t),T(null),setTimeout(()=>g(!1),0),e.slice(0,-1)})},children:(0,s.jsx)(ev.UndoOutlined,{})})}),(0,s.jsx)(ey.Tooltip,{title:"重做",children:(0,s.jsx)("a",{className:`toolbar ${x.length>0?"active":""}`,onClick:()=>{h(e=>e.length?(g(!0),m(e=>[...e,JSON.parse(JSON.stringify(R))]),F(e[e.length-1]),T(null),setTimeout(()=>g(!1),0),e.slice(0,-1)):e)},children:(0,s.jsx)(ev.RedoOutlined,{})})}),(0,s.jsx)(ey.Divider,{orientation:"vertical"}),(0,s.jsx)(ey.Tooltip,{title:"导入JSON",children:(0,s.jsx)("a",{className:`toolbar ${x.length>0?"active":""}`,onClick:()=>{A(!0)},children:(0,s.jsx)(ev.ImportOutlined,{})})})]}),(0,s.jsxs)(ey.Space,{children:[(0,s.jsx)(ey.Tooltip,{title:"缩小",children:(0,s.jsx)("a",{className:"toolbar",onClick:()=>u(parseFloat(Math.max(c-.1,.5).toFixed(1))),children:(0,s.jsx)(ev.ZoomOutOutlined,{})})}),(0,s.jsxs)("div",{style:{fontSize:12,color:"#999",userSelect:"none"},children:[(100*c).toFixed(0),"%"]}),(0,s.jsx)(ey.Tooltip,{title:"放大",children:(0,s.jsx)("a",{className:"toolbar",onClick:()=>u(parseFloat(Math.min(c+.1,2).toFixed(1))),children:(0,s.jsx)(ev.ZoomInOutlined,{})})}),(0,s.jsx)(ey.Tooltip,{title:"重置缩放",children:(0,s.jsx)("a",{className:"toolbar",onClick:()=>u(1),children:(0,s.jsx)(ej,{type:"icon-zoom-reset"})})}),(0,s.jsx)(ey.Divider,{orientation:"vertical"}),(0,s.jsx)(ey.Tooltip,{title:"切换左侧栏",children:(0,s.jsx)("a",{className:`toolbar ${S?"active":""}`,onClick:()=>{I(e=>!e),setTimeout(()=>{var e,t;return null==(t=o.current)||null==(e=t.handleResize)?void 0:e.call(t)},0)},children:(0,s.jsx)(ej,{type:"icon-sider-l"})})}),(0,s.jsx)(ey.Tooltip,{title:"切换右侧栏",children:(0,s.jsx)("a",{className:`toolbar ${z?"active":""}`,onClick:()=>{k(e=>!e),setTimeout(()=>{var e,t;return null==(t=o.current)||null==(e=t.handleResize)?void 0:e.call(t)},0)},children:(0,s.jsx)(ej,{type:"icon-sider-r"})})}),i]})]}),(0,s.jsxs)(e8,{style:B,children:[(0,s.jsxs)("div",{className:"left",style:L,children:[(0,s.jsx)("div",{style:{padding:"22px 1px 22px 0",borderRight:"solid 1px #e8e8e8"},children:(0,s.jsxs)(ey.Radio.Group,{value:b,onChange:e=>j(e.target.value),buttonStyle:"outline",style:{fontWeight:"normal",display:"inline-flex",flexDirection:"column",gap:14},className:"left-pane-tabs",children:[(0,s.jsx)(ey.Radio.Button,{value:"component",children:(0,s.jsx)(ey.Tooltip,{title:"组件",placement:"right",children:(0,s.jsx)(ej,{type:"icon-puzzle"})})}),(0,s.jsx)(ey.Radio.Button,{value:"layer",children:(0,s.jsx)(ey.Tooltip,{title:"图层",placement:"right",children:(0,s.jsx)(ej,{type:"icon-outline"})})}),(0,s.jsx)(ey.Radio.Button,{value:"datasource",children:(0,s.jsx)(ey.Tooltip,{title:"数据集",placement:"right",children:(0,s.jsx)(ej,{type:"icon-datasource"})})}),(0,s.jsx)(ey.Radio.Button,{value:"script",children:(0,s.jsx)(ey.Tooltip,{title:"脚本",placement:"right",children:(0,s.jsx)(ej,{type:"icon-js"})})}),(0,s.jsx)(ey.Radio.Button,{value:"env",children:(0,s.jsx)(ey.Tooltip,{title:"环境变量",placement:"right",children:(0,s.jsx)(ej,{type:"icon-variable"})})}),(0,s.jsx)(ey.Radio.Button,{value:"code",children:(0,s.jsx)(ey.Tooltip,{title:"源码",placement:"right",children:(0,s.jsx)(ej,{type:"icon-json"})})})]})}),(0,s.jsxs)("div",{style:{flex:"1 1 auto",display:"flex",flexDirection:"column",width:"calc(100% - 47px)"},children:["component"===b&&(0,s.jsx)(e_,{}),"layer"===b&&(0,s.jsx)(eX,{}),"datasource"===b&&(0,s.jsx)(eK,{}),"script"===b&&(0,s.jsx)(e1,{}),"env"===b&&(0,s.jsx)(e4,{}),"code"===b&&(0,s.jsx)(eP,{})]})]}),(0,s.jsxs)("div",{className:"center",style:{flex:"1 1 auto"},children:[(0,s.jsx)(ew,{title:"页面",extra:(0,s.jsxs)(ey.Space,{children:[(0,s.jsx)(ey.Button,{size:"small",type:D?"default":"primary",icon:D?(0,s.jsx)(ev.EyeInvisibleOutlined,{}):(0,s.jsx)(ev.EyeOutlined,{}),onClick:()=>N(!D)}),(0,s.jsxs)(ey.Radio.Group,{value:v,onChange:e=>y(e.target.value),size:"small",buttonStyle:"outline",children:[(0,s.jsx)(ey.Radio.Button,{value:"desktop",title:"桌面",children:(0,s.jsx)(ev.DesktopOutlined,{})}),(0,s.jsx)(ey.Radio.Button,{value:"mobile",title:"移动设备",children:(0,s.jsx)(ev.MobileOutlined,{})}),(0,s.jsx)(ey.Radio.Button,{value:"tablet",title:"平板设备",children:(0,s.jsx)(ev.TabletOutlined,{})})]})]})}),(0,s.jsx)("div",{className:["body",v].join(" "),children:(0,s.jsx)("div",{style:{transform:`scale(${c})`,transformOrigin:"top center"},children:(0,s.jsx)(ef,{ref:o,device:v})})})]}),(0,s.jsxs)("div",{className:"right",style:P,children:[(0,s.jsxs)("div",{style:{flex:"1 1 auto",display:"flex",flexDirection:"column",width:"calc(100% - 47px)"},children:["ai"===C&&(0,s.jsx)(eF,{agentList:r}),"props"===C&&(0,s.jsx)(eZ,{}),"cascade"===C&&(0,s.jsx)(eN,{})]}),(0,s.jsx)("div",{style:{padding:"22px 0",borderLeft:"solid 1px #e8e8e8"},children:(0,s.jsxs)(ey.Radio.Group,{value:C,onChange:e=>w(e.target.value),buttonStyle:"outline",style:{fontWeight:"normal",display:"inline-flex",flexDirection:"column",gap:14},className:"right-pane-tabs",children:[(0,s.jsx)(ey.Radio.Button,{value:"ai",children:(0,s.jsx)(ey.Tooltip,{title:"智能体",placement:"right",children:(0,s.jsx)(ej,{type:"icon-assistant"})})}),(0,s.jsx)(ey.Radio.Button,{value:"props",children:(0,s.jsx)(ey.Tooltip,{title:"属性",placement:"right",children:(0,s.jsx)(ej,{type:"icon-info"})})}),(0,s.jsx)(ey.Radio.Button,{value:"cascade",children:(0,s.jsx)(ey.Tooltip,{title:"联动",placement:"right",children:(0,s.jsx)(ej,{type:"icon-cascade"})})})]})})]})]})]}),(0,s.jsx)(e5,{open:E,onOk:e=>{A(!1),F(e)},onCancel:()=>A(!1)})]})}),e6=x()(ev.InfoCircleOutlined)`
|
|
922
|
+
`,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}=e,h=(0,p.useRef)(null),f=(0,p.useRef)(null),[g,v]=(0,p.useState)(1),[j,y]=(0,p.useState)([]),[b,w]=(0,p.useState)([]),[C,S]=(0,p.useState)(!1),[I,z]=(0,p.useState)("desktop"),[k,O]=(0,p.useState)("component"),[N,T]=(0,p.useState)((null==x?void 0:x.ai)?"ai":"props"),[R,F]=(0,p.useState)(!0),[D,E]=(0,p.useState)(!0),[A,B]=(0,p.useState)(null),[M,L]=(0,p.useState)({info:{},datasources:[],scripts:[],variables:[],items:[]}),[P,$]=(0,p.useState)(!0),[Y,H]=(0,p.useState)(!1),[q,G]=(0,p.useState)(!1),U=(0,p.useMemo)(()=>{let e=R?"250px":"",t=D?"400px":"";return{gridTemplateColumns:`${e} 1fr ${t}`}},[R,D]),_=(0,p.useMemo)(()=>({display:R?"flex":"none"}),[R]),K=(0,p.useMemo)(()=>({display:D?"flex":"none"}),[D]);l=[M],(n=(0,p.useRef)()).current===JSON.stringify(l)&&n.current||(n.current=JSON.stringify(l),(()=>{C||(y(e=>e.length?[...e,JSON.parse(JSON.stringify(M))].slice(-50):[JSON.parse(JSON.stringify(M))]),w([]))})()),(0,p.useImperativeHandle)(t,()=>({handleOpen(e){S(!0),W(e.items),L(e),y([JSON.parse(JSON.stringify(e))]),w([]),setTimeout(()=>S(!1),0)}}));let W=(e,t)=>{e&&e.forEach(e=>{e.id||(e.id=t||Math.random().toString(36).slice(2,10)),Array.isArray(e.children)?W(e.children):"object"==typeof e.children&&e.children&&Object.keys(e.children).forEach(t=>{Array.isArray(e.children[t])&&W(e.children[t],Math.random().toString(36).slice(2,10))})})},J=e=>{var t,l,n;if((null==(t=e.datasets)?void 0:t.length)&&(null==f||null==(l=f.current)?void 0:l.reload)&&f.current.reload(),e.schema)L(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(M)),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(l)}},X=(0,p.useMemo)(()=>"cascade"!==N||(null==A?void 0:A.cascadeIds)?N:"props",[A,N]);return(0,d.jsxs)(es,{pageId:r,designable:P,plugins:i,schema:M,selectedItem:A,setSchema:L,setSelectedItem:B,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)("a",{className:"toolbar",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 ${j.length>1?"active":""}`,onClick:()=>{y(e=>{if(e.length<=1)return e;S(!0);let t=e[e.length-2];return w(e=>[...e,JSON.parse(JSON.stringify(M))]),L(t),B(null),setTimeout(()=>S(!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 ${b.length>0?"active":""}`,onClick:()=>{w(e=>e.length?(S(!0),y(e=>[...e,JSON.parse(JSON.stringify(M))]),L(e[e.length-1]),B(null),setTimeout(()=>S(!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 ${b.length>0?"active":""}`,onClick:()=>{H(!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:()=>v(parseFloat(Math.max(g-.1,.5).toFixed(1))),children:(0,d.jsx)(ej.ZoomOutOutlined,{})})}),(0,d.jsxs)("div",{style:{fontSize:12,color:"#999",userSelect:"none"},children:[(100*g).toFixed(0),"%"]}),(0,d.jsx)(ey.Tooltip,{title:"放大",children:(0,d.jsx)("a",{className:"toolbar",onClick:()=>v(parseFloat(Math.min(g+.1,2).toFixed(1))),children:(0,d.jsx)(ej.ZoomInOutlined,{})})}),(0,d.jsx)(ey.Tooltip,{title:"重置缩放",children:(0,d.jsx)("a",{className:"toolbar",onClick:()=>v(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 ${R?"active":""}`,onClick:()=>{F(e=>!e),setTimeout(()=>{var e,t;return null==(t=h.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 ${D?"active":""}`,onClick:()=>{E(e=>!e),setTimeout(()=>{var e,t;return null==(t=h.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:U,children:[(0,d.jsxs)("div",{className:"left",style:_,children:[(0,d.jsx)("div",{style:{padding:"22px 1px 22px 0",borderRight:"solid 1px #e8e8e8"},children:(0,d.jsxs)(ey.Radio.Group,{value:k,onChange:e=>O(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"===k&&(0,d.jsx)(e4,{}),"layer"===k&&(0,d.jsx)(e3,{}),s&&"datasource"===k&&(0,d.jsx)(e5,{}),c&&"script"===k&&(0,d.jsx)(tr,{}),"env"===k&&(0,d.jsx)(ti,{}),"code"===k&&(0,d.jsx)(e0,{}),!!u&&"dataset"===k&&(0,d.jsx)(ts,{ref:f,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:P?"default":"primary",icon:P?(0,d.jsx)(ej.EyeInvisibleOutlined,{}):(0,d.jsx)(ej.EyeOutlined,{}),onClick:()=>$(!P)}),(0,d.jsxs)(ey.Radio.Group,{value:I,onChange:e=>z(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",I].join(" "),children:(0,d.jsx)("div",{style:{transform:`scale(${g})`,transformOrigin:"top center"},children:(0,d.jsx)(eg,{ref:h,device:I,fetch:x})})})]}),(0,d.jsxs)("div",{className:"right",style:K,children:[(0,d.jsxs)("div",{style:{flex:"1 1 auto",display:"flex",flexDirection:"column",width:"calc(100% - 47px)"},children:["ai"===X&&(null==x?void 0:x.ai)&&(0,d.jsx)(eH,{agentList:a,onEffect:J}),"props"===X&&(0,d.jsx)(tt,{datasourceEnable:s}),"cascade"===X&&(null==A?void 0:A.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:X,onChange:e=>T(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==A?void 0:A.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:Y,onOk:e=>{H(!1),L(e)},onCancel:()=>H(!1)}),(0,d.jsx)(ey.Drawer,{open:q,size:400,mask:!1,title:null,closable:!1,styles:{body:{padding:0}},onClose:()=>G(!1),children:(0,d.jsx)(eH,{agentList:a,headExtra:(0,d.jsx)(ey.Button,{type:"link",icon:(0,d.jsx)(ej.CloseOutlined,{}),onClick:()=>G(!1)}),onEffect:J})})]})});var tp=((i={}).STRING="STRING",i.NUMBER="NUMBER",i.BOOLEAN="BOOLEAN",i.OBJECT="OBJECT",i.ARRAY="ARRAY",i);let tm=h()(ej.InfoCircleOutlined)`
|
|
690
923
|
vertical-align: middle;
|
|
691
924
|
margin-left: 2px;
|
|
692
925
|
color: var(--ant-color-text-description);
|
|
693
|
-
`,
|
|
926
|
+
`,tx=h().div`
|
|
694
927
|
width: 100%;
|
|
695
928
|
padding: 0 12px;
|
|
696
929
|
border-bottom: solid 1px #e8e8e8;
|
|
@@ -710,7 +943,7 @@
|
|
|
710
943
|
color: #999;
|
|
711
944
|
font-size: 12px;
|
|
712
945
|
}
|
|
713
|
-
`,
|
|
946
|
+
`,th=(e,t)=>(0,p.useMemo)(()=>{if(!t)return null;if("custom"===(t.source||"custom"))try{return JSON.parse(t.custom||"[]")}catch(e){}return null},[e,t]),tf=h().div`
|
|
714
947
|
box-sizing: border-box;
|
|
715
948
|
margin: 0;
|
|
716
949
|
padding: 0;
|
|
@@ -721,39 +954,39 @@
|
|
|
721
954
|
display: flex;
|
|
722
955
|
flex-direction: column;
|
|
723
956
|
|
|
724
|
-
${e=>e.$bordered&&(0,
|
|
957
|
+
${e=>e.$bordered&&(0,x.css)`
|
|
725
958
|
border: 1px solid #d9d9d9;
|
|
726
959
|
border-radius: 2px;
|
|
727
960
|
`}
|
|
728
961
|
|
|
729
|
-
${e=>"vertical"===e.$itemLayout&&(0,
|
|
962
|
+
${e=>"vertical"===e.$itemLayout&&(0,x.css)`
|
|
730
963
|
flex-direction: column;
|
|
731
964
|
`}
|
|
732
|
-
`,
|
|
965
|
+
`,tg=h().div`
|
|
733
966
|
display: flex;
|
|
734
967
|
align-items: center;
|
|
735
968
|
justify-content: space-between;
|
|
736
969
|
padding: ${e=>e.$padding||"12px 0"};
|
|
737
970
|
color: rgba(0, 0, 0, 0.85);
|
|
738
971
|
|
|
739
|
-
${e=>e.$split&&(0,
|
|
972
|
+
${e=>e.$split&&(0,x.css)`
|
|
740
973
|
border-bottom: 1px solid #f0f0f0;
|
|
741
974
|
&:last-child {
|
|
742
975
|
border-bottom: none;
|
|
743
976
|
}
|
|
744
977
|
`}
|
|
745
|
-
`,
|
|
978
|
+
`,tv=h().div`
|
|
746
979
|
display: flex;
|
|
747
980
|
flex: 1;
|
|
748
981
|
align-items: flex-start;
|
|
749
982
|
max-width: 100%;
|
|
750
|
-
`,
|
|
983
|
+
`,tj=h().div`
|
|
751
984
|
margin-right: 16px;
|
|
752
|
-
`,
|
|
985
|
+
`,ty=h().div`
|
|
753
986
|
flex: 1 0;
|
|
754
987
|
width: 0;
|
|
755
988
|
color: rgba(0, 0, 0, 0.85);
|
|
756
|
-
`,
|
|
989
|
+
`,tb=h().h4`
|
|
757
990
|
margin-bottom: 4px;
|
|
758
991
|
color: rgba(0, 0, 0, 0.85);
|
|
759
992
|
font-size: 14px;
|
|
@@ -769,15 +1002,15 @@
|
|
|
769
1002
|
color: #1890ff;
|
|
770
1003
|
}
|
|
771
1004
|
}
|
|
772
|
-
`,
|
|
1005
|
+
`,tw=h().div`
|
|
773
1006
|
color: rgba(0, 0, 0, 0.45);
|
|
774
1007
|
font-size: 14px;
|
|
775
1008
|
line-height: 1.5715;
|
|
776
|
-
`;
|
|
1009
|
+
`;h().div`
|
|
777
1010
|
margin-top: 16px;
|
|
778
1011
|
text-align: right;
|
|
779
1012
|
padding: ${e=>e.$bordered?"0 24px 24px":"0"};
|
|
780
|
-
`;let
|
|
1013
|
+
`;let tC=e=>{let{item:t,split:l,padding:n}=e;return(0,d.jsx)(tg,{$split:l,$padding:n,children:(0,d.jsxs)(tv,{children:[t.avatar&&(0,d.jsx)(tj,{children:(0,d.jsx)(ey.Avatar,{src:t.avatar})}),(0,d.jsxs)(ty,{children:[t.title&&(0,d.jsx)(tb,{children:t.href?(0,d.jsx)("a",{href:t.href,children:t.title}):t.title}),t.description&&(0,d.jsx)(tw,{children:t.description})]})]})})},tS=e=>{let{list:t=[],split:l,bordered:n,size:r,itemLayout:a,style:i,className:o}=e,s=(0,p.useMemo)(()=>"small"===r?"8px 16px":n?"12px 24px":"12px 0",[r,n]);return(0,d.jsx)(tf,{$bordered:n,$split:l,$size:r,style:i,$itemLayout:a,className:o,children:t.map((e,t)=>(0,d.jsx)(tC,{item:e,split:l,padding:s},String(t)))})};var tI=c(190),tz=c(185),tk=c.n(tz);let tO=[{group:"基础组件",key:"b-text",label:"文本",icon:"icon-text",component:e=>{let{id:t,text:l,item:n,style:r={},customStyle:a={},className:i,classNames:o=[]}=e,s=(0,p.useMemo)(()=>({...(null==n?void 0:n.style)||{},...a||{},...r||{}}),[n,a,r]);return(0,d.jsx)("span",{id:t,style:s,className:(o||[]).join(" ")+" "+i,children:l})},formComponent:e=>{var t,l,n,r,a,i;let{model:o,onChange:s}=e,c=(e,t)=>s&&s({...o,[e]:t}),u=(e,t)=>{let l={...o.customStyle||{},[e]:t};s&&s({...o,customStyle:l})};return(0,d.jsxs)(ey.Form,{layout:"vertical",children:[(0,d.jsx)(ey.Form.Item,{label:"文本内容",children:(0,d.jsx)(ey.Input.TextArea,{size:"small",value:o.text,onChange:e=>c("text",e.target.value)})}),(0,d.jsx)(ey.Form.Item,{label:"类名",children:(0,d.jsx)(ey.Select,{size:"small",value:o.classNames,mode:"tags",onChange:e=>c("classNames",e)})}),(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,d.jsxs)(ey.Space.Compact,{children:[(0,d.jsxs)(ey.Select,{size:"small",value:null==(t=o.customStyle)?void 0:t.fontFamily,style:{width:90},onChange:e=>u("fontFamily",e),children:[(0,d.jsx)(ey.Select.Option,{value:"'黑体', 'SimHei', sans-serif",children:"黑体"}),(0,d.jsx)(ey.Select.Option,{value:"'宋体', 'SimSun', serif",children:"宋体"}),(0,d.jsx)(ey.Select.Option,{value:"'仿宋', 'FangSong', serif",children:"仿宋"}),(0,d.jsx)(ey.Select.Option,{value:"'楷体', 'KaiTi', serif",children:"楷体"}),(0,d.jsx)(ey.Select.Option,{value:"Arial, sans-serif",children:"Arial"})]}),(0,d.jsx)(ey.Select,{size:"small",value:null==(l=o.customStyle)?void 0:l.fontSize,style:{width:90},onChange:e=>u("fontSize",e),children:["12px","14px","16px","20px","22px","24px","32px","48px"].map(e=>(0,d.jsx)(ey.Select.Option,{value:e,children:e},e))}),(0,d.jsx)(ey.ColorPicker,{size:"small",value:null==(n=o.customStyle)?void 0:n.color,onChange:e=>u("color",e.toHexString()),allowClear:!0})]}),(0,d.jsxs)(ey.Space.Compact,{children:[(0,d.jsx)(ey.Button,{type:(null==(r=o.customStyle)?void 0:r.fontWeight)==="bold"?"primary":void 0,size:"small",onClick:()=>{var e;return u("fontWeight",(null==(e=o.customStyle)?void 0:e.fontWeight)==="bold"?"normal":"bold")},children:"B"}),(0,d.jsx)(ey.Button,{type:(null==(a=o.customStyle)?void 0:a.fontStyle)==="italic"?"primary":void 0,size:"small",onClick:()=>{var e;return u("fontStyle",(null==(e=o.customStyle)?void 0:e.fontStyle)==="italic"?"normal":"italic")},children:"I"}),(0,d.jsx)(ey.Button,{type:(null==(i=o.customStyle)?void 0:i.textDecoration)==="underline"?"primary":void 0,size:"small",onClick:()=>{var e;return u("textDecoration",(null==(e=o.customStyle)?void 0:e.textDecoration)==="underline"?"none":"underline")},children:"U"})]})]})]})},defaultOptions:{style:{},props:{text:"文本内容",classNames:[],customStyle:{fontSize:14,color:"#444444",fontFamily:"'宋体', 'SimSun', serif",fontWeight:"normal",fontStyle:"normal",textDecoration:"none"}}}},{group:"基础组件",key:"b-image",label:"图片",icon:"icon-image",component:e=>{let{id:t,src:l,alt:n,width:r,height:a,href:i,className:o}=e,s=(0,d.jsx)("img",{id:t,src:l,alt:n,style:{width:r,height:a},className:o});return i&&i.length?(0,d.jsx)("a",{href:i,target:"_blank",rel:"noreferrer",children:s}):(0,d.jsx)("div",{children:s})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n}),r={Authorization:`Bearer ${localStorage.getItem("ASKDATA_TOKEN")||""}`};return(0,d.jsxs)(ey.Form,{labelCol:{span:24},wrapperCol:{span:24},children:[(0,d.jsx)(ey.Form.Item,{label:(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:["图片URL",(0,d.jsx)(ey.Upload,{name:"file",multiple:!1,accept:".png,.jpg,.jpeg",headers:r,action:"/api/datareport/upload",showUploadList:!1,beforeUpload:e=>{let t=e.type.startsWith("image/");return t||ey.message.error("上传封面只能是图片文件"),t},onChange:e=>{if("done"===e.file.status){var t;n("src",null==(t=e.file.response)?void 0:t.data),ey.message.success("上传成功")}else"error"===e.file.status&&ey.message.error("上传失败")},children:(0,d.jsx)(ey.Button,{size:"small",type:"link",icon:(0,d.jsx)(ej.UploadOutlined,{})})})]}),children:(0,d.jsx)(ey.Input,{size:"small",value:t.src,onChange:e=>n("src",e.target.value)})}),(0,d.jsx)(ey.Form.Item,{label:"图片替代文本",children:(0,d.jsx)(ey.Input,{size:"small",value:t.alt,onChange:e=>n("alt",e.target.value)})}),(0,d.jsx)(ey.Form.Item,{label:"图片链接",children:(0,d.jsx)(ey.Input,{size:"small",value:t.href,onChange:e=>n("href",e.target.value)})}),(0,d.jsx)(ey.Form.Item,{label:"图片宽度",children:(0,d.jsx)(ey.Input,{size:"small",value:t.width,onChange:e=>n("width",e.target.value)})}),(0,d.jsx)(ey.Form.Item,{label:"图片高度",children:(0,d.jsx)(ey.Input,{size:"small",value:t.height,onChange:e=>n("height",e.target.value)})})]})},defaultOptions:{props:{src:"https://gw.alipayobjects.com/zos/rmsportal/JiqGstEfoWAOHiTxclqi.png",alt:"",href:"",width:"100%",height:"auto"}}},{group:"基础组件",key:"b-button",label:"按钮",icon:"icon-button",component:e=>{let{id:t,text:l="按钮",type:n="middle",icon:r,size:a,block:i=!1,shape:o="default",ghost:s=!1,item:c,style:u,className:m}=e,{env:x,callbacks:h}=(0,p.useContext)(ex),f="danger"===n,g="string"==typeof r?r?(0,d.jsx)(ew,{type:r}):void 0:r;return(0,d.jsx)(ey.Button,{id:t,type:f?"default":n,icon:g,size:a,block:i,shape:["round","circle"].includes(o)?o:void 0,ghost:s,danger:f,onClick:()=>{x&&c&&h&&ez(x,c,h)},style:u,className:m,children:l})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n});return(0,d.jsxs)(ey.Form,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,d.jsx)(ey.Form.Item,{label:"文本",children:(0,d.jsx)(ey.Input,{size:"small",value:t.text,onChange:e=>n("text",e.target.value),placeholder:"请输入按钮文本"})}),(0,d.jsx)(ey.Form.Item,{label:"图标",children:(0,d.jsx)(ey.Input,{size:"small",value:t.icon,onChange:e=>n("icon",e.target.value),placeholder:"请输入按钮图标(antdv 1.7.8)"})}),(0,d.jsx)(ey.Form.Item,{label:"类型",children:(0,d.jsxs)(ey.Radio.Group,{size:"small",value:t.type,onChange:e=>n("type",e.target.value),children:[(0,d.jsx)(ey.Radio.Button,{value:"default",children:"默认"}),(0,d.jsx)(ey.Radio.Button,{value:"primary",children:"主要"}),(0,d.jsx)(ey.Radio.Button,{value:"link",children:"链接"}),(0,d.jsx)(ey.Radio.Button,{value:"dashed",children:"虚线"}),(0,d.jsx)(ey.Radio.Button,{value:"text",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.jsxs)(ey.Radio.Group,{size:"small",value:t.shape,onChange:e=>n("shape",e.target.value),children:[(0,d.jsx)(ey.Radio.Button,{value:"default",children:"默认"}),(0,d.jsx)(ey.Radio.Button,{value:"round",children:"圆角"}),(0,d.jsx)(ey.Radio.Button,{value:"circle",children:"圆形"})]})}),(0,d.jsx)(ey.Form.Item,{label:"块级",children:(0,d.jsx)(ey.Switch,{size:"small",checked:!!t.block,onChange:e=>n("block",e)})}),(0,d.jsx)(ey.Form.Item,{label:"幽灵",children:(0,d.jsx)(ey.Switch,{size:"small",checked:!!t.ghost,onChange:e=>n("ghost",e)})})]})},defaultOptions:{props:{type:"primary",size:"default",shape:"default",block:!1,ghost:!1,text:"按钮文本",icon:""},cascadeIds:[]}},{group:"基础组件",key:"b-page-header",label:"页面标题",icon:"icon-page-header",component:e=>{let{id:t,title:l,subTitle:n,item:r,style:a={},className:i}=e,o=(0,p.useMemo)(()=>!r.children||Array.isArray(r.children)||"object"!=typeof r.children?null:r.children.extra||[],[r]),[s,c]=(0,p.useState)(o||[]);return(0,d.jsxs)(tx,{id:t,style:{...a},className:i,children:[(0,d.jsxs)("div",{className:"title",children:[(0,d.jsx)("span",{className:"main",children:l}),n&&(0,d.jsx)("span",{className:"sub",children:n})]}),(0,d.jsx)("div",{children:(0,d.jsx)(ep,{list:s,onListChange:e=>{let t=[...e];r.children.extra=t,c(t)}})})]})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n});return(0,d.jsxs)(ey.Form,{layout:"vertical",children:[(0,d.jsx)(ey.Form.Item,{label:"标题",children:(0,d.jsx)(ey.Input,{size:"small",value:t.title,onChange:e=>n("title",e.target.value),placeholder:"请输入标题"})}),(0,d.jsx)(ey.Form.Item,{label:"副标题",children:(0,d.jsx)(ey.Input,{size:"small",value:t.subTitle,onChange:e=>n("subTitle",e.target.value),placeholder:"请输入副标题"})})]})},defaultOptions:{props:{title:"标题",subTitle:"副标题"},children:{extra:[]}}},{group:"基础组件",key:"b-table",label:"数据表格",icon:"icon-table",component:e=>{let{id:t,item:l,dataSource:n=[],columns:r=[],pageSize:a=10,bordered:i=!0,size:o,showHeader:s=!0,style:c={},className:u}=e,{env:m,initCallback:x}=(0,p.useContext)(ex),h=!!a&&!(a<=n.length)&&{total:n.length,pageSize:a,size:o,showSizeChanger:!0,showQuickJumper:!0,hideOnSinglePage:!0,pageSizeOptions:["10","20","30","40"],showTotal:(e,t)=>`共 ${e} 条记录,显示第 ${t[0]}-${t[1]} 条`},f=r.map(e=>({...e,render:e.customRender&&("string"!=typeof e.customRender||""!==e.customRender.trim())?(t,l,n)=>Function("console","Math","Date","Array","Object","String","Number","Boolean","text","record","index",`
|
|
781
1014
|
"use strict";
|
|
782
1015
|
const window = undefined;
|
|
783
1016
|
const document = undefined;
|
|
@@ -787,7 +1020,7 @@
|
|
|
787
1020
|
const module = undefined;
|
|
788
1021
|
const exports = undefined;
|
|
789
1022
|
${e.customRender}
|
|
790
|
-
`)(console,Math,Date,Array,Object,String,Number,Boolean,t,l,n):e.render}));return(0,
|
|
1023
|
+
`)(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}=e,{env:i,initCallback:o}=(0,p.useContext)(ex),s=th(t,n.datasource),c=(0,p.useMemo)(()=>Object.keys(s||{}),[s]),u=(0,p.useMemo)(()=>c.map(e=>null==s?void 0:s[e]),[c,s]),m=(0,p.useMemo)(()=>(l||"").replace(/{{\s*([^}]+)\s*}}/g,(e,t)=>{try{return Function(...c,`
|
|
791
1024
|
"use strict";
|
|
792
1025
|
const window = undefined;
|
|
793
1026
|
const document = undefined;
|
|
@@ -797,7 +1030,7 @@
|
|
|
797
1030
|
const module = undefined;
|
|
798
1031
|
const exports = undefined;
|
|
799
1032
|
return ${t};
|
|
800
|
-
`)(...
|
|
1033
|
+
`)(...u)}catch{return""}}),[l,u]),x=()=>{console.log("callback html",eS(i,n))};return(0,p.useEffect)(()=>{o({id:n.id,callback:x})},[]),(0,d.jsx)("div",{id:t,style:r,className:a,dangerouslySetInnerHTML:{__html:m}})},formComponent:e=>{let{model:t,onChange:l}=e,n=(0,p.useRef)(null);return(0,d.jsx)("div",{children:(0,d.jsx)(ey.Form,{layout:"vertical",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=n.current)?void 0:e.editor;null==l||null==(t=l.getAction("editor.action.formatDocument"))||t.run()},children:[(0,d.jsx)(ew,{type:"icon-formate"})," 格式化"]})]}),className:"ant-form-item-label-space",children:(0,d.jsx)("div",{style:{border:"1px solid #d9d9d9",borderRadius:4,textAlign:"left"},children:(0,d.jsx)(eV(),{onMount:e=>{n.current={editor:e}},height:"300px",defaultLanguage:"html",value:t.template,onChange:e=>{let n;return n=e||"",l&&l({...t,template:n||""})},options:{minimap:{enabled:!1},scrollBeyondLastLine:!1,tabSize:2}})})})})})},defaultOptions:{datasource:{source:"custom",datasourceId:null,scriptId:null,custom:'{"name": "Confucius"}'},props:{template:"<div>{{name}}, welcome to the world of programming.</div>"}}},{group:"基础组件",key:"b-echarts",label:"图表",icon:"icon-echarts",component:e=>{let{id:t,script:l="",item:n,height:r=400,style:a,className:i}=e,{initCallback:o,env:s}=(0,p.useContext)(ex),c=(0,p.useRef)(null),[u,m]=(0,p.useState)(null),x=th(t,n.datasource),h=()=>{console.log("callback echarts",eS(s,n))};return(0,p.useEffect)(()=>{if(!c.current)return;let e=tI.init(c.current);m(e);let t=()=>e.resize();return window.addEventListener("resize",t),o({id:n.id,callback:h}),()=>{window.removeEventListener("resize",t),e.dispose()}},[]),(0,p.useEffect)(()=>{let e=(e=>{try{return JSON.parse(e)}catch(t){try{return Function("echarts","console","Math","Date","Array","Object","String","Number","Boolean","data",`
|
|
801
1034
|
"use strict";
|
|
802
1035
|
const window = undefined;
|
|
803
1036
|
const document = undefined;
|
|
@@ -807,10 +1040,10 @@
|
|
|
807
1040
|
const module = undefined;
|
|
808
1041
|
const exports = undefined;
|
|
809
1042
|
${e}
|
|
810
|
-
`)(
|
|
1043
|
+
`)(tI,console,Math,Date,Array,Object,String,Number,Boolean,x)}catch(e){return console.error("ECharts 配置解析失败:",e),null}}})(l);u&&e&&(u.setOption(e),setTimeout(()=>u.resize(),50))},[u,l]),(0,d.jsx)("div",{id:t,style:{width:"100%",height:r,...a},className:i,children:(0,d.jsx)("div",{ref:c,style:{width:"100%",height:r,...a}})})},formComponent:e=>{let{model:t,onChange:l}=e,n=(0,p.useRef)(null);return(0,d.jsx)(ey.Form,{layout:"vertical",children:(0,d.jsx)(ey.Form.Item,{label:(0,d.jsxs)(d.Fragment,{children:["Echarts 渲染脚本"," ",(0,d.jsxs)("a",{onClick:()=>{var e,t;let l=null==(e=n.current)?void 0:e.editor;null==l||null==(t=l.getAction("editor.action.formatDocument"))||t.run()},children:[(0,d.jsx)(ew,{type:"icon-formate"})," 格式化"]})]}),className:"ant-form-item-label-space",children:(0,d.jsxs)("div",{style:{border:"1px solid #d9d9d9",borderRadius:4,textAlign:"left"},children:[(0,d.jsxs)("div",{style:{color:"#0000ff",fontSize:14,padding:"0 50px"},children:["function getOptions(data) ","{"," "]}),(0,d.jsx)(eV(),{onMount:e=>{n.current={editor:e}},height:"400px",defaultLanguage:"javascript",value:t.script,onChange:e=>{let n;return n=e||"",l&&l({...t,script:n||""})},options:{minimap:{enabled:!1},scrollBeyondLastLine:!1,tabSize:2}}),(0,d.jsx)("div",{style:{color:"#0000ff",fontSize:14,padding:"0 50px"},children:"}"})]})})})},defaultOptions:{datasource:{source:"custom",datasourceId:null,scriptId:null,custom:'[{"name":"Mon","value":150},{"name":"Tue","value":230},{"name":"Wed","value":224},{"name":"Thu","value":218},{"name":"Fri","value":135},{"name":"Sat","value":147},{"name":"Sun","value":260}]'},props:{script:`
|
|
811
1044
|
return {
|
|
812
1045
|
xAxis: { type: 'category', data: data.map(i => i.name) },
|
|
813
1046
|
yAxis: { type: 'value' },
|
|
814
1047
|
series: [{ data: data.map(i => i.value), type: 'line' }]
|
|
815
1048
|
}
|
|
816
|
-
`}}},{group:"表单组件",key:"b-input",label:"输入框",icon:"icon-form-input",component:e=>{let{id:t,var:l="",placeholder:n="",prefix:r,suffix:a,size:i,allowClear:o=!1,search:c=!1,item:u,value:p,onChange:m,onSearch:x,style:h={},className:f}=e,{env:g,callbacks:v}=(0,d.useContext)(em),y=e=>{m&&m(e),g&&u&&l&&e$(g,u,l,e)};return c?(0,s.jsx)(ey.Input.Search,{id:t,value:p,size:i,allowClear:o,placeholder:n,onChange:e=>y(e.target.value),onSearch:()=>{x&&x(p||""),g&&u&&v&&eq(g,u,v)},style:{...h},className:f}):(0,s.jsx)(ey.Input,{id:t,value:p,size:i,allowClear:o,placeholder:n,prefix:"string"==typeof r?void 0:r,suffix:"string"==typeof a?void 0:a,onChange:e=>y(e.target.value),style:{...h},className:f})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n});return(0,s.jsxs)(ey.Form,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,s.jsx)(ey.Form.Item,{label:"搜索框",children:(0,s.jsx)(ey.Switch,{size:"small",checked:!!t.search,onChange:e=>n("search",e)})}),(0,s.jsx)(ey.Form.Item,{label:"变量名",children:(0,s.jsx)(ey.Input,{size:"small",value:t.var,onChange:e=>n("var",e.target.value),placeholder:"请输入变量名"})}),(0,s.jsx)(ey.Form.Item,{label:"占位符",children:(0,s.jsx)(ey.Input,{size:"small",value:t.placeholder,onChange:e=>n("placeholder",e.target.value),placeholder:"请输入占位符"})}),!t.search&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(ey.Form.Item,{label:"前缀",children:(0,s.jsx)(ey.Input,{size:"small",value:t.prefix,onChange:e=>n("prefix",e.target.value),placeholder:"请输入前缀"})}),(0,s.jsx)(ey.Form.Item,{label:"后缀",children:(0,s.jsx)(ey.Input,{size:"small",value:t.suffix,onChange:e=>n("suffix",e.target.value),placeholder:"请输入后缀"})})]}),(0,s.jsx)(ey.Form.Item,{label:"大小",children:(0,s.jsxs)(ey.Radio.Group,{size:"small",value:t.size,onChange:e=>n("size",e.target.value),children:[(0,s.jsx)(ey.Radio.Button,{value:"small",children:"小"}),(0,s.jsx)(ey.Radio.Button,{value:"middle",children:"中"}),(0,s.jsx)(ey.Radio.Button,{value:"large",children:"大"})]})}),(0,s.jsx)(ey.Form.Item,{label:"清除图标",children:(0,s.jsx)(ey.Switch,{size:"small",checked:!!t.allowClear,onChange:e=>n("allowClear",e)})})]})},defaultOptions:{props:{var:"",size:"default",allowClear:!0,search:!1,prefix:"",suffix:"",placeholder:"请输入"},cascadeIds:[]}},{group:"表单组件",key:"b-input-number",label:"数字输入框",icon:"icon-form-input-number",component:e=>{let{id:t,var:l="",value:n,size:r,placeholder:a="请输入",min:i=0,max:o=Number.MAX_SAFE_INTEGER,step:c=1,precision:u=0,item:p,onChange:m,style:x={},className:h}=e,{env:f,callbacks:g}=(0,d.useContext)(em);return(0,s.jsx)(ey.InputNumber,{id:t,value:n,placeholder:a,size:r,min:i,max:o,step:c,precision:u,onChange:e=>{var t;return t=e??void 0,void(m&&m(t),f&&p&&l&&e$(f,p,l,t),f&&p&&g&&eq(f,p,g))},style:{width:"100%",...x},className:h})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n});return(0,s.jsxs)(ey.Form,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,s.jsx)(ey.Form.Item,{label:"变量名",children:(0,s.jsx)(ey.Input,{size:"small",value:t.var,onChange:e=>n("var",e.target.value)})}),(0,s.jsx)(ey.Form.Item,{label:"最小值",children:(0,s.jsx)(ey.InputNumber,{size:"small",value:t.min,onChange:e=>n("min",e)})}),(0,s.jsx)(ey.Form.Item,{label:"最大值",children:(0,s.jsx)(ey.InputNumber,{size:"small",value:t.max,onChange:e=>n("max",e)})}),(0,s.jsx)(ey.Form.Item,{label:"步长",children:(0,s.jsx)(ey.InputNumber,{size:"small",value:t.step,onChange:e=>n("step",e)})})]})},defaultOptions:{props:{var:"",size:"default",allowClear:!0,prefix:"",suffix:"",placeholder:"请输入",step:1,min:0,max:100,precision:0},cascadeIds:[]}},{group:"表单组件",key:"b-select",label:"选择框",icon:"icon-form-select",component:e=>{let{id:t,var:l="",size:n,placeholder:r="请选择",allowClear:a=!1,multiple:i=!1,options:o=[],item:c,value:u,onChange:p,style:m={},className:x}=e,{env:h,callbacks:f}=(0,d.useContext)(em);return(0,s.jsx)(ey.Select,{id:t,value:u,size:n,placeholder:r,allowClear:a,mode:i?"multiple":void 0,options:o,onChange:e=>{p&&p(e),h&&c&&l&&e$(h,c,l,e),h&&c&&f&&eq(h,c,f)},style:{width:"100%",...m},className:x})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n}),r=(e,l,r)=>{let a=[...t.options||[]];a[e]={...a[e],[l]:r},n("options",a)},a=[{title:"选项标签",dataIndex:"label",render:(e,t,l)=>(0,s.jsx)(ey.Input,{size:"small",value:t.label,onChange:e=>r(l,"label",e.target.value)})},{title:"选项值",dataIndex:"value",render:(e,t,l)=>(0,s.jsx)(ey.Input,{size:"small",value:t.value,onChange:e=>r(l,"value",e.target.value)})},{title:"操作",render:(e,l,r)=>(0,s.jsx)(ey.Space,{children:(0,s.jsx)(ey.Button,{danger:!0,size:"small",onClick:()=>{let e;(e=[...t.options||[]]).splice(r,1),n("options",e)},children:(0,s.jsx)(ev.DeleteOutlined,{})})})}];return(0,s.jsxs)(ey.Form,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,s.jsx)(ey.Form.Item,{label:"变量名",children:(0,s.jsx)(ey.Input,{size:"small",value:t.var,onChange:e=>n("var",e.target.value),placeholder:"请输入变量名"})}),(0,s.jsx)(ey.Form.Item,{label:"占位符",children:(0,s.jsx)(ey.Input,{size:"small",value:t.placeholder,onChange:e=>n("placeholder",e.target.value),placeholder:"请输入占位符"})}),(0,s.jsx)(ey.Form.Item,{label:"大小",children:(0,s.jsxs)(ey.Radio.Group,{size:"small",value:t.size,onChange:e=>n("size",e.target.value),children:[(0,s.jsx)(ey.Radio.Button,{value:"small",children:"小"}),(0,s.jsx)(ey.Radio.Button,{value:"middle",children:"中"}),(0,s.jsx)(ey.Radio.Button,{value:"large",children:"大"})]})}),(0,s.jsx)(ey.Form.Item,{label:"清除图标",children:(0,s.jsx)(ey.Switch,{size:"small",checked:!!t.allowClear,onChange:e=>n("allowClear",e)})}),(0,s.jsx)(ey.Form.Item,{label:"多选",children:(0,s.jsx)(ey.Switch,{size:"small",checked:!!t.multiple,onChange:e=>n("multiple",e)})}),(0,s.jsxs)(ey.Form.Item,{labelCol:{span:24},wrapperCol:{span:24},children:[(0,s.jsx)(ey.Table,{size:"small",dataSource:t.options,columns:a,pagination:!1,rowKey:(e,t)=>String(t),bordered:!0}),(0,s.jsx)(ey.Button,{size:"small",block:!0,onClick:()=>{n("options",[...t.options||[],{label:"",value:""}])},children:"添加选项"})]})]})},defaultOptions:{props:{var:"",size:"default",allowClear:!0,multiple:!1,options:[{label:"选项1",value:"1"},{label:"选项2",value:"2"}]},cascadeIds:[]}},{group:"表单组件",key:"b-capsule",label:"胶囊选择框",icon:"icon-form-capsule",component:e=>{let{id:t,var:l="",size:n="middle",options:r=[],item:a,onChange:i,style:o,className:c}=e,{env:u,callbacks:p}=(0,d.useContext)(em);return(0,s.jsx)("span",{id:t,children:(0,s.jsx)(ey.Radio.Group,{id:t,size:n,buttonStyle:"solid",onChange:e=>{var t;return t=e.target.value,void(i&&i(t),u&&a&&l&&e$(u,a,l,t),u&&a&&p&&eq(u,a,p))},style:o,className:c,children:r.map(e=>(0,s.jsx)(ey.Radio.Button,{value:e.value,children:e.label},e.value))})})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n}),r=(e,l,r)=>{let a=[...t.options||[]];a[e]={...a[e],[l]:r},n("options",a)},a=[{title:"选项标签",dataIndex:"label",render:(e,t,l)=>(0,s.jsx)(ey.Input,{size:"small",value:t.label,onChange:e=>r(l,"label",e.target.value)})},{title:"选项值",dataIndex:"value",render:(e,t,l)=>(0,s.jsx)(ey.Input,{size:"small",value:t.value,onChange:e=>r(l,"value",e.target.value)})},{title:"操作",render:(e,l,r)=>(0,s.jsx)(ey.Space,{children:(0,s.jsx)(ey.Button,{danger:!0,size:"small",onClick:()=>{let e;(e=[...t.options||[]]).splice(r,1),n("options",e)},children:(0,s.jsx)(ev.DeleteOutlined,{})})})}];return(0,s.jsxs)(ey.Form,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,s.jsx)(ey.Form.Item,{label:"变量名",children:(0,s.jsx)(ey.Input,{size:"small",value:t.var,onChange:e=>n("var",e.target.value),placeholder:"请输入变量名"})}),(0,s.jsx)(ey.Form.Item,{label:"大小",children:(0,s.jsxs)(ey.Radio.Group,{size:"small",value:t.size,onChange:e=>n("size",e.target.value),children:[(0,s.jsx)(ey.Radio.Button,{value:"small",children:"小"}),(0,s.jsx)(ey.Radio.Button,{value:"middle",children:"中"}),(0,s.jsx)(ey.Radio.Button,{value:"large",children:"大"})]})}),(0,s.jsxs)(ey.Form.Item,{labelCol:{span:24},wrapperCol:{span:24},children:[(0,s.jsx)(ey.Table,{size:"small",dataSource:t.options,columns:a,pagination:!1,rowKey:(e,t)=>String(t),bordered:!0}),(0,s.jsx)(ey.Button,{size:"small",block:!0,onClick:()=>{n("options",[...t.options||[],{label:"",value:""}])},children:"添加选项"})]})]})},defaultOptions:{props:{var:"",size:"default",allowClear:!0,multiple:!1,options:[{label:"选项1",value:"1"},{label:"选项2",value:"2"}]},cascadeIds:[]}},{group:"表单组件",key:"b-checkbox",label:"复选框",icon:"icon-form-checkbox",component:e=>{let{id:t,var:l="",layout:n="horizontal",lineNumber:r=3,options:a=[],item:i,onChange:o,style:c,className:u}=e,{env:p,callbacks:m}=(0,d.useContext)(em),x={...c,display:"grid"===n?"grid":"flex",gap:"grid"===n?void 0:"8px",flexDirection:"vertical"===n?"column":"row",gridTemplateColumns:"grid"===n?`repeat(${r}, 1fr)`:void 0};return(0,s.jsx)("span",{id:t,children:(0,s.jsx)(ey.Checkbox.Group,{onChange:e=>{o&&o(e),p&&i&&l&&e$(p,i,l,e),p&&i&&m&&eq(p,i,m)},style:x,className:u,children:a.map(e=>(0,s.jsx)(ey.Checkbox,{value:e.value,children:e.label},e.value))})})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n}),r=(e,l,r)=>{let a=[...t.options||[]];a[e]={...a[e],[l]:r},n("options",a)},a=[{title:"选项标签",dataIndex:"label",render:(e,t,l)=>(0,s.jsx)(ey.Input,{size:"small",value:t.label,onChange:e=>r(l,"label",e.target.value)})},{title:"选项值",dataIndex:"value",render:(e,t,l)=>(0,s.jsx)(ey.Input,{size:"small",value:t.value,onChange:e=>r(l,"value",e.target.value)})},{title:"操作",render:(e,l,r)=>(0,s.jsx)(ey.Space,{children:(0,s.jsx)(ey.Button,{danger:!0,size:"small",onClick:()=>{let e;(e=[...t.options||[]]).splice(r,1),n("options",e)},children:(0,s.jsx)(ev.DeleteOutlined,{})})})}];return(0,s.jsxs)(ey.Form,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,s.jsx)(ey.Form.Item,{label:"变量名",children:(0,s.jsx)(ey.Input,{size:"small",value:t.var,onChange:e=>n("var",e.target.value),placeholder:"请输入变量名"})}),(0,s.jsx)(ey.Form.Item,{label:"布局",children:(0,s.jsxs)(ey.Radio.Group,{size:"small",value:t.layout,onChange:e=>n("layout",e.target.value),children:[(0,s.jsx)(ey.Radio.Button,{value:"horizontal",children:"水平"}),(0,s.jsx)(ey.Radio.Button,{value:"vertical",children:"垂直"}),(0,s.jsx)(ey.Radio.Button,{value:"grid",children:"网格"})]})}),"grid"===t.layout&&(0,s.jsx)(ey.Form.Item,{label:"网格行数",children:(0,s.jsx)(ey.InputNumber,{size:"small",value:t.lineNumber,onChange:e=>n("lineNumber",e),min:1,max:10})}),(0,s.jsxs)(ey.Form.Item,{labelCol:{span:24},wrapperCol:{span:24},children:[(0,s.jsx)(ey.Table,{size:"small",dataSource:t.options,columns:a,pagination:!1,rowKey:(e,t)=>String(t),bordered:!0}),(0,s.jsx)(ey.Button,{size:"small",block:!0,onClick:()=>{n("options",[...t.options||[],{label:"",value:""}])},children:"添加选项"})]})]})},defaultOptions:{props:{var:"",layout:"horizontal",lineNumber:3,options:[{label:"选项1",value:"1"},{label:"选项2",value:"2"}]},cascadeIds:[]}},{group:"表单组件",key:"b-date-picker",label:"日期选择器",icon:"icon-form-date-picker",component:e=>{let{id:t,var:l="",size:n,allowClear:r=!1,type:a="date",showTime:i=!1,value:o,item:c,onChange:u,style:p={},className:m}=e,{env:x,callbacks:h}=(0,d.useContext)(em),f=e=>{u&&u(e),x&&c&&l&&e$(x,c,l,e),x&&c&&h&&eq(x,c,h)};if("time"===a){let e="string"==typeof o&&o?tu()(o,"HH:mm"):void 0;return(0,s.jsx)(ey.TimePicker,{id:t,value:e,format:"HH:mm",placeholder:"请选择时间",size:n,allowClear:r,onChange:e=>f(e?e.format("HH:mm"):void 0),style:{...(null==c?void 0:c.style)||{},...p},className:m})}if("month"===a||"year"===a){let e="month"===a?"YYYY-MM":"YYYY",l="string"==typeof o&&o?tu()(o,e):void 0;return(0,s.jsx)(ey.DatePicker,{id:t,picker:a,value:l,format:e,placeholder:"month"===a?"请选择月份":"请选择年份",size:n,allowClear:r,onChange:t=>f(t?t.format(e):void 0),onPanelChange:t=>f(t?t.format(e):void 0),style:{...(null==c?void 0:c.style)||{},...p},className:m})}if("range"===a){let e=i?"YYYY-MM-DD HH:mm":"YYYY-MM-DD",l=Array.isArray(o)&&o[0]?tu()(o[0],e):void 0,a=Array.isArray(o)&&o[1]?tu()(o[1],e):void 0;return(0,s.jsx)(ey.DatePicker.RangePicker,{id:t,value:[l,a],format:e,placeholder:["开始日期","结束日期"],size:n,allowClear:r,showTime:i,onChange:t=>f(t&&t[0]&&t[1]?[t[0].format(e),t[1].format(e)]:void 0),style:{...(null==c?void 0:c.style)||{},...p},className:m})}let g=i?"YYYY-MM-DD HH:mm":"YYYY-MM-DD",v="string"==typeof o&&o?tu()(o,g):void 0;return(0,s.jsx)(ey.DatePicker,{id:t,value:v,format:g,placeholder:"请选择日期",size:n,allowClear:r,showTime:i,style:{...(null==c?void 0:c.style)||{},...p},className:m,onChange:e=>f(e?e.format(g):void 0)})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n});return(0,s.jsxs)(ey.Form,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,s.jsx)(ey.Form.Item,{label:"变量名",children:(0,s.jsx)(ey.Input,{size:"small",value:t.var,onChange:e=>n("var",e.target.value),placeholder:"请输入变量名"})}),(0,s.jsx)(ey.Form.Item,{label:"类型",children:(0,s.jsxs)(ey.Radio.Group,{size:"small",value:t.type,onChange:e=>n("type",e.target.value),children:[(0,s.jsx)(ey.Radio.Button,{value:"date",children:"日期"}),(0,s.jsx)(ey.Radio.Button,{value:"time",children:"时间"}),(0,s.jsx)(ey.Radio.Button,{value:"month",children:"月份"}),(0,s.jsx)(ey.Radio.Button,{value:"year",children:"年份"}),(0,s.jsx)(ey.Radio.Button,{value:"range",children:"日期范围"})]})}),(0,s.jsx)(ey.Form.Item,{label:"大小",children:(0,s.jsxs)(ey.Radio.Group,{size:"small",value:t.size,onChange:e=>n("size",e.target.value),children:[(0,s.jsx)(ey.Radio.Button,{value:"small",children:"小"}),(0,s.jsx)(ey.Radio.Button,{value:"middle",children:"中"}),(0,s.jsx)(ey.Radio.Button,{value:"large",children:"大"})]})}),(0,s.jsx)(ey.Form.Item,{label:"清除图标",children:(0,s.jsx)(ey.Switch,{size:"small",checked:!!t.allowClear,onChange:e=>n("allowClear",e)})}),(0,s.jsx)(ey.Form.Item,{label:"显示时间",children:(0,s.jsx)(ey.Switch,{size:"small",checked:!!t.showTime,onChange:e=>n("showTime",e)})})]})},defaultOptions:{props:{var:"",size:"default",allowClear:!0,showTime:!1,type:"date"},cascadeIds:[]}},{group:"表单组件",key:"b-switch",label:"开关",icon:"icon-form-switch",component:e=>{let{id:t,var:l="",checked:n,disabled:r,size:a="default",checkedChildren:i,unCheckedChildren:o,item:c,onChange:u,style:p={},className:m}=e,{env:x,callbacks:h}=(0,d.useContext)(em);return(0,s.jsx)("span",{children:(0,s.jsx)(ey.Switch,{id:t,checked:n,disabled:r,size:"small"===a?"small":void 0,checkedChildren:i,unCheckedChildren:o,onChange:e=>{u&&u(e),x&&c&&l&&e$(x,c,l,e),x&&c&&h&&eq(x,c,h)},style:p,className:m})})},formComponent:e=>{let{model:t,onChange:l}=e;return(0,s.jsx)(ey.Form,{labelCol:{span:6},wrapperCol:{span:18},children:(0,s.jsx)(ey.Form.Item,{label:"变量名",children:(0,s.jsx)(ey.Input,{size:"small",value:t.var,onChange:e=>{let n;return n=e.target.value,l&&l({...t,var:n})},placeholder:"请输入变量名"})})})},defaultOptions:{props:{var:"",size:"default",checkedChildren:"开",unCheckedChildren:"关"},cascadeIds:[]}},{group:"容器组件",key:"b-space",label:"容器",icon:"icon-space",component:e=>{let{id:t,align:l="start",size:n="small",direction:r="horizontal",item:a,style:i={},className:o}=e,{designable:c}=(0,d.useContext)(ei),[u,p]=(0,d.useState)(a.children||[]),m=(0,d.useMemo)(()=>({...i,...a.style||{},alignItems:l,flexDirection:r,gap:n}),[a,l,n,r]);return(0,s.jsx)(eu,{rootComponent:ey.Space,rootData:{id:t,style:m,className:o},list:u,item:a,onListChange:e=>{a.children=e,p(e)}})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n});return(0,s.jsxs)(ey.Form,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,s.jsx)(ey.Form.Item,{label:"方向",children:(0,s.jsxs)(ey.Radio.Group,{size:"small",value:t.direction,onChange:e=>n("direction",e.target.value),children:[(0,s.jsx)(ey.Radio.Button,{value:"horizontal",children:"水平"}),(0,s.jsx)(ey.Radio.Button,{value:"vertical",children:"垂直"})]})}),(0,s.jsx)(ey.Form.Item,{label:"大小",children:(0,s.jsxs)(ey.Radio.Group,{size:"small",value:t.size,onChange:e=>n("size",e.target.value),children:[(0,s.jsx)(ey.Radio.Button,{value:"small",children:"小"}),(0,s.jsx)(ey.Radio.Button,{value:"middle",children:"中"}),(0,s.jsx)(ey.Radio.Button,{value:"large",children:"大"})]})}),(0,s.jsx)(ey.Form.Item,{label:"对齐",children:(0,s.jsxs)(ey.Radio.Group,{size:"small",value:t.align,onChange:e=>n("align",e.target.value),children:[(0,s.jsx)(ey.Radio.Button,{value:"start",children:"开始"}),(0,s.jsx)(ey.Radio.Button,{value:"end",children:"结束"}),(0,s.jsx)(ey.Radio.Button,{value:"center",children:"居中"}),(0,s.jsx)(ey.Radio.Button,{value:"baseline",children:"基线"})]})})]})},defaultOptions:{props:{align:"flex-start",direction:"row",size:"8px"},children:[]}},{group:"容器组件",key:"b-card",label:"卡片",icon:"icon-card",component:e=>{let{id:t,bordered:l=!1,size:n="default",title:r,hoverable:a=!1,shadow:i=!0,item:o,style:c,className:u}=e,p=(0,d.useMemo)(()=>!o.children||Array.isArray(o.children)||"object"!=typeof o.children?null:o.children.title||[],[o]),[m,x]=(0,d.useState)(p||[]),h=(0,d.useMemo)(()=>!o.children||Array.isArray(o.children)||"object"!=typeof o.children?null:o.children.extra||[],[o]),[f,g]=(0,d.useState)(h||[]),v=(0,d.useMemo)(()=>o.children?Array.isArray(o.children)?o.children:"object"!=typeof o.children?null:o.children.body||[]:null,[o]),[y,b]=(0,d.useState)(v||[]),j=(0,d.useMemo)(()=>!o.children||Array.isArray(o.children)||"object"!=typeof o.children?null:o.children.actions||[],[o]),[C,w]=(0,d.useState)(j||[]);return(0,s.jsx)(ey.Card,{id:t,variant:l?"outlined":"borderless",size:n,hoverable:a,className:[i?"ant-card-shadow":void 0,u].filter(Boolean).join(" "),title:(null==r?void 0:r.length)&&!(null==p?void 0:p.length)?r:p?(0,s.jsx)(eu,{list:m,onListChange:e=>{o.children.title=e,x(e)}}):r,extra:h&&(0,s.jsx)(eu,{list:f,onListChange:e=>{o.children.extra=e,g(e)}}),actions:j&&[(0,s.jsx)(eu,{list:C,onListChange:e=>{o.children.actions=e,w(e)}})],styles:{header:{borderBottom:"none"}},style:c,children:v&&(0,s.jsx)(eu,{list:y,onListChange:e=>{Array.isArray(o.children)?o.children=e:o.children.body=e,b(e)}})})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n});return(0,s.jsxs)(ey.Form,{labelCol:{span:12},wrapperCol:{span:12},children:[(0,s.jsx)(ey.Form.Item,{label:"标题",children:(0,s.jsx)(ey.Input,{size:"small",value:t.title,onChange:e=>n("title",e.target.value)})}),(0,s.jsx)(ey.Form.Item,{label:"边框",children:(0,s.jsx)(ey.Switch,{size:"small",checked:!!t.bordered,onChange:e=>n("bordered",e)})}),(0,s.jsx)(ey.Form.Item,{label:"悬停效果",children:(0,s.jsx)(ey.Switch,{size:"small",checked:!!t.hoverable,onChange:e=>n("hoverable",e)})}),(0,s.jsx)(ey.Form.Item,{label:"阴影",children:(0,s.jsx)(ey.Switch,{size:"small",checked:!!t.shadow,onChange:e=>n("shadow",e)})}),(0,s.jsx)(ey.Form.Item,{label:"大小",children:(0,s.jsxs)(ey.Radio.Group,{size:"small",value:t.size,onChange:e=>n("size",e.target.value),children:[(0,s.jsx)(ey.Radio.Button,{value:"default",children:"默认"}),(0,s.jsx)(ey.Radio.Button,{value:"small",children:"小"})]})})]})},defaultOptions:{props:{title:"标题",bordered:!0,hoverable:!0,shadow:!0,size:"default"},children:{title:[],extra:[],body:[],actions:[]}}},{group:"容器组件",key:"b-row",label:"栅格行",icon:"icon-grid-row",component:e=>{let{id:t,gutter:l,item:n,style:r,className:a}=e,{designable:i}=(0,d.useContext)(ei),[o,c]=(0,d.useState)(n.children||[]);return(0,s.jsx)(eu,{rootComponent:ey.Row,rootData:{id:t,gutter:l,style:n.style||r,className:n.className||a},list:o,item:n,onListChange:e=>{n.children=e,c(e)}})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n}),r=t.gutter||[0,0];return(0,s.jsxs)(ey.Form,{labelCol:{span:12},wrapperCol:{span:12},children:[(0,s.jsx)(ey.Form.Item,{label:"列间距",children:(0,s.jsx)(ey.InputNumber,{size:"small",value:r[0],min:0,step:4,onChange:e=>n("gutter",[e||0,r[1]])})}),(0,s.jsx)(ey.Form.Item,{label:"行间距",children:(0,s.jsx)(ey.InputNumber,{size:"small",value:r[1],min:0,step:4,onChange:e=>n("gutter",[r[0],e||0])})})]})},defaultOptions:{props:{gutter:[12,12]},children:[]}},{group:"容器组件",key:"b-col",label:"栅格列",icon:"icon-grid-columns",component:e=>{let{id:t,span:l=24,xs:n,sm:r,md:a,lg:i,xl:o,xxl:c,item:u,style:p={},className:m}=e,{designable:x}=(0,d.useContext)(ei),{deviceWidth:h}=(0,d.useContext)(em),[f,g]=(0,d.useState)(u.children||[]),v=(0,d.useMemo)(()=>{let e=h||1600,t=null;return e<576&&n&&(t=n),e>=576&&r&&(t=r),e>=768&&a&&(t=a),e>=992&&i&&(t=i),e>=1200&&o&&(t=o),e>=1600&&c&&(t=c),t||l},[n,r,a,i,o,c,l,h]);return(0,s.jsx)(eu,{rootComponent:ey.Col,rootData:{id:t||u.id,span:v,style:{...u.style||{},...p},className:m},list:f,item:u,onListChange:e=>{u.children=e,g(e)}})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n});return(0,s.jsxs)(ey.Form,{labelCol:{span:12},wrapperCol:{span:12},children:[(0,s.jsx)(ey.Form.Item,{label:"默认列数",children:(0,s.jsx)(ey.InputNumber,{size:"small",value:t.span,min:0,max:24,step:4,onChange:e=>n("span",e||0)})}),(0,s.jsx)(ey.Form.Item,{label:(0,s.jsxs)(s.Fragment,{children:["xs"," ",(0,s.jsx)(ey.Tooltip,{title:"<576px 响应式栅格",children:(0,s.jsx)(e6,{})})]}),children:(0,s.jsx)(ey.InputNumber,{size:"small",value:t.xs,min:0,max:24,step:4,onChange:e=>n("xs",e||0)})}),(0,s.jsx)(ey.Form.Item,{label:(0,s.jsxs)(s.Fragment,{children:["sm"," ",(0,s.jsx)(ey.Tooltip,{title:"≥576px 响应式栅格",children:(0,s.jsx)(e6,{})})]}),children:(0,s.jsx)(ey.InputNumber,{size:"small",value:t.sm,min:0,max:24,step:4,onChange:e=>n("sm",e||0)})}),(0,s.jsx)(ey.Form.Item,{label:(0,s.jsxs)(s.Fragment,{children:["md"," ",(0,s.jsx)(ey.Tooltip,{title:"≥768px 响应式栅格",children:(0,s.jsx)(e6,{})})]}),children:(0,s.jsx)(ey.InputNumber,{size:"small",value:t.md,min:0,max:24,step:4,onChange:e=>n("md",e||0)})}),(0,s.jsx)(ey.Form.Item,{label:(0,s.jsxs)(s.Fragment,{children:["lg"," ",(0,s.jsx)(ey.Tooltip,{title:"≥992px 响应式栅格",children:(0,s.jsx)(e6,{})})]}),children:(0,s.jsx)(ey.InputNumber,{size:"small",value:t.lg,min:0,max:24,step:4,onChange:e=>n("lg",e||0)})}),(0,s.jsx)(ey.Form.Item,{label:(0,s.jsxs)(s.Fragment,{children:["xl"," ",(0,s.jsx)(ey.Tooltip,{title:"≥1200px 响应式栅格",children:(0,s.jsx)(e6,{})})]}),children:(0,s.jsx)(ey.InputNumber,{size:"small",value:t.xl,min:0,max:24,step:4,onChange:e=>n("xl",e||0)})}),(0,s.jsx)(ey.Form.Item,{label:(0,s.jsxs)(s.Fragment,{children:["xxl"," ",(0,s.jsx)(ey.Tooltip,{title:"≥1600px 响应式栅格",children:(0,s.jsx)(e6,{})})]}),children:(0,s.jsx)(ey.InputNumber,{size:"small",value:t.xxl,min:0,max:24,step:4,onChange:e=>n("xxl",e||0)})})]})},defaultOptions:{props:{xs:24,sm:12,md:12,lg:6,xl:6,xxl:6,span:8},children:[]}}]})(),p})());
|
|
1049
|
+
`}}},{group:"表单组件",key:"b-input",label:"输入框",icon:"icon-form-input",component:e=>{let{id:t,var:l="",placeholder:n="",prefix:r,suffix:a,size:i,allowClear:o=!1,search:s=!1,item:c,value:u,onChange:m,onSearch:x,style:h={},className:f}=e,{env:g,callbacks:v}=(0,p.useContext)(ex),j=e=>{m&&m(e),g&&c&&l&&eI(g,c,l,e)};return s?(0,d.jsx)(ey.Input.Search,{id:t,value:u,size:i,allowClear:o,placeholder:n,onChange:e=>j(e.target.value),onSearch:()=>{x&&x(u||""),g&&c&&v&&ez(g,c,v)},style:{...h},className:f}):(0,d.jsx)(ey.Input,{id:t,value:u,size:i,allowClear:o,placeholder:n,prefix:"string"==typeof r?void 0:r,suffix:"string"==typeof a?void 0:a,onChange:e=>j(e.target.value),style:{...h},className:f})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n});return(0,d.jsxs)(ey.Form,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,d.jsx)(ey.Form.Item,{label:"搜索框",children:(0,d.jsx)(ey.Switch,{size:"small",checked:!!t.search,onChange:e=>n("search",e)})}),(0,d.jsx)(ey.Form.Item,{label:"变量名",children:(0,d.jsx)(ey.Input,{size:"small",value:t.var,onChange:e=>n("var",e.target.value),placeholder:"请输入变量名"})}),(0,d.jsx)(ey.Form.Item,{label:"占位符",children:(0,d.jsx)(ey.Input,{size:"small",value:t.placeholder,onChange:e=>n("placeholder",e.target.value),placeholder:"请输入占位符"})}),!t.search&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(ey.Form.Item,{label:"前缀",children:(0,d.jsx)(ey.Input,{size:"small",value:t.prefix,onChange:e=>n("prefix",e.target.value),placeholder:"请输入前缀"})}),(0,d.jsx)(ey.Form.Item,{label:"后缀",children:(0,d.jsx)(ey.Input,{size:"small",value:t.suffix,onChange:e=>n("suffix",e.target.value),placeholder:"请输入后缀"})})]}),(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.allowClear,onChange:e=>n("allowClear",e)})})]})},defaultOptions:{props:{var:"",size:"default",allowClear:!0,search:!1,prefix:"",suffix:"",placeholder:"请输入"},cascadeIds:[]}},{group:"表单组件",key:"b-input-number",label:"数字输入框",icon:"icon-form-input-number",component:e=>{let{id:t,var:l="",value:n,size:r,placeholder:a="请输入",min:i=0,max:o=Number.MAX_SAFE_INTEGER,step:s=1,precision:c=0,item:u,onChange:m,style:x={},className:h}=e,{env:f,callbacks:g}=(0,p.useContext)(ex);return(0,d.jsx)(ey.InputNumber,{id:t,value:n,placeholder:a,size:r,min:i,max:o,step:s,precision:c,onChange:e=>{var t;return t=e??void 0,void(m&&m(t),f&&u&&l&&eI(f,u,l,t),f&&u&&g&&ez(f,u,g))},style:{width:"100%",...x},className:h})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n});return(0,d.jsxs)(ey.Form,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,d.jsx)(ey.Form.Item,{label:"变量名",children:(0,d.jsx)(ey.Input,{size:"small",value:t.var,onChange:e=>n("var",e.target.value)})}),(0,d.jsx)(ey.Form.Item,{label:"最小值",children:(0,d.jsx)(ey.InputNumber,{size:"small",value:t.min,onChange:e=>n("min",e)})}),(0,d.jsx)(ey.Form.Item,{label:"最大值",children:(0,d.jsx)(ey.InputNumber,{size:"small",value:t.max,onChange:e=>n("max",e)})}),(0,d.jsx)(ey.Form.Item,{label:"步长",children:(0,d.jsx)(ey.InputNumber,{size:"small",value:t.step,onChange:e=>n("step",e)})})]})},defaultOptions:{props:{var:"",size:"default",allowClear:!0,prefix:"",suffix:"",placeholder:"请输入",step:1,min:0,max:100,precision:0},cascadeIds:[]}},{group:"表单组件",key:"b-select",label:"选择框",icon:"icon-form-select",component:e=>{let{id:t,var:l="",size:n,placeholder:r="请选择",allowClear:a=!1,multiple:i=!1,options:o=[],item:s,value:c,onChange:u,style:m={},className:x}=e,{env:h,callbacks:f}=(0,p.useContext)(ex);return(0,d.jsx)(ey.Select,{id:t,value:c,size:n,placeholder:r,allowClear:a,mode:i?"multiple":void 0,options:o,onChange:e=>{u&&u(e),h&&s&&l&&eI(h,s,l,e),h&&s&&f&&ez(h,s,f)},style:{width:"100%",...m},className:x})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n}),r=(e,l,r)=>{let a=[...t.options||[]];a[e]={...a[e],[l]:r},n("options",a)},a=[{title:"选项标签",dataIndex:"label",render:(e,t,l)=>(0,d.jsx)(ey.Input,{size:"small",value:t.label,onChange:e=>r(l,"label",e.target.value)})},{title:"选项值",dataIndex:"value",render:(e,t,l)=>(0,d.jsx)(ey.Input,{size:"small",value:t.value,onChange:e=>r(l,"value",e.target.value)})},{title:"操作",render:(e,l,r)=>(0,d.jsx)(ey.Space,{children:(0,d.jsx)(ey.Button,{danger:!0,size:"small",onClick:()=>{let e;(e=[...t.options||[]]).splice(r,1),n("options",e)},children:(0,d.jsx)(ej.DeleteOutlined,{})})})}];return(0,d.jsxs)(ey.Form,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,d.jsx)(ey.Form.Item,{label:"变量名",children:(0,d.jsx)(ey.Input,{size:"small",value:t.var,onChange:e=>n("var",e.target.value),placeholder:"请输入变量名"})}),(0,d.jsx)(ey.Form.Item,{label:"占位符",children:(0,d.jsx)(ey.Input,{size:"small",value:t.placeholder,onChange:e=>n("placeholder",e.target.value),placeholder:"请输入占位符"})}),(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.allowClear,onChange:e=>n("allowClear",e)})}),(0,d.jsx)(ey.Form.Item,{label:"多选",children:(0,d.jsx)(ey.Switch,{size:"small",checked:!!t.multiple,onChange:e=>n("multiple",e)})}),(0,d.jsxs)(ey.Form.Item,{labelCol:{span:24},wrapperCol:{span:24},children:[(0,d.jsx)(ey.Table,{size:"small",dataSource:t.options,columns:a,pagination:!1,rowKey:(e,t)=>String(t),bordered:!0}),(0,d.jsx)(ey.Button,{size:"small",block:!0,onClick:()=>{n("options",[...t.options||[],{label:"",value:""}])},children:"添加选项"})]})]})},defaultOptions:{props:{var:"",size:"default",allowClear:!0,multiple:!1,options:[{label:"选项1",value:"1"},{label:"选项2",value:"2"}]},cascadeIds:[]}},{group:"表单组件",key:"b-capsule",label:"胶囊选择框",icon:"icon-form-capsule",component:e=>{let{id:t,var:l="",size:n="middle",options:r=[],item:a,onChange:i,style:o,className:s}=e,{env:c,callbacks:u}=(0,p.useContext)(ex);return(0,d.jsx)("span",{id:t,children:(0,d.jsx)(ey.Radio.Group,{id:t,size:n,buttonStyle:"solid",onChange:e=>{var t;return t=e.target.value,void(i&&i(t),c&&a&&l&&eI(c,a,l,t),c&&a&&u&&ez(c,a,u))},style:o,className:s,children:r.map(e=>(0,d.jsx)(ey.Radio.Button,{value:e.value,children:e.label},e.value))})})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n}),r=(e,l,r)=>{let a=[...t.options||[]];a[e]={...a[e],[l]:r},n("options",a)},a=[{title:"选项标签",dataIndex:"label",render:(e,t,l)=>(0,d.jsx)(ey.Input,{size:"small",value:t.label,onChange:e=>r(l,"label",e.target.value)})},{title:"选项值",dataIndex:"value",render:(e,t,l)=>(0,d.jsx)(ey.Input,{size:"small",value:t.value,onChange:e=>r(l,"value",e.target.value)})},{title:"操作",render:(e,l,r)=>(0,d.jsx)(ey.Space,{children:(0,d.jsx)(ey.Button,{danger:!0,size:"small",onClick:()=>{let e;(e=[...t.options||[]]).splice(r,1),n("options",e)},children:(0,d.jsx)(ej.DeleteOutlined,{})})})}];return(0,d.jsxs)(ey.Form,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,d.jsx)(ey.Form.Item,{label:"变量名",children:(0,d.jsx)(ey.Input,{size:"small",value:t.var,onChange:e=>n("var",e.target.value),placeholder:"请输入变量名"})}),(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.jsxs)(ey.Form.Item,{labelCol:{span:24},wrapperCol:{span:24},children:[(0,d.jsx)(ey.Table,{size:"small",dataSource:t.options,columns:a,pagination:!1,rowKey:(e,t)=>String(t),bordered:!0}),(0,d.jsx)(ey.Button,{size:"small",block:!0,onClick:()=>{n("options",[...t.options||[],{label:"",value:""}])},children:"添加选项"})]})]})},defaultOptions:{props:{var:"",size:"default",allowClear:!0,multiple:!1,options:[{label:"选项1",value:"1"},{label:"选项2",value:"2"}]},cascadeIds:[]}},{group:"表单组件",key:"b-checkbox",label:"复选框",icon:"icon-form-checkbox",component:e=>{let{id:t,var:l="",layout:n="horizontal",lineNumber:r=3,options:a=[],item:i,onChange:o,style:s,className:c}=e,{env:u,callbacks:m}=(0,p.useContext)(ex),x={...s,display:"grid"===n?"grid":"flex",gap:"grid"===n?void 0:"8px",flexDirection:"vertical"===n?"column":"row",gridTemplateColumns:"grid"===n?`repeat(${r}, 1fr)`:void 0};return(0,d.jsx)("span",{id:t,children:(0,d.jsx)(ey.Checkbox.Group,{onChange:e=>{o&&o(e),u&&i&&l&&eI(u,i,l,e),u&&i&&m&&ez(u,i,m)},style:x,className:c,children:a.map(e=>(0,d.jsx)(ey.Checkbox,{value:e.value,children:e.label},e.value))})})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n}),r=(e,l,r)=>{let a=[...t.options||[]];a[e]={...a[e],[l]:r},n("options",a)},a=[{title:"选项标签",dataIndex:"label",render:(e,t,l)=>(0,d.jsx)(ey.Input,{size:"small",value:t.label,onChange:e=>r(l,"label",e.target.value)})},{title:"选项值",dataIndex:"value",render:(e,t,l)=>(0,d.jsx)(ey.Input,{size:"small",value:t.value,onChange:e=>r(l,"value",e.target.value)})},{title:"操作",render:(e,l,r)=>(0,d.jsx)(ey.Space,{children:(0,d.jsx)(ey.Button,{danger:!0,size:"small",onClick:()=>{let e;(e=[...t.options||[]]).splice(r,1),n("options",e)},children:(0,d.jsx)(ej.DeleteOutlined,{})})})}];return(0,d.jsxs)(ey.Form,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,d.jsx)(ey.Form.Item,{label:"变量名",children:(0,d.jsx)(ey.Input,{size:"small",value:t.var,onChange:e=>n("var",e.target.value),placeholder:"请输入变量名"})}),(0,d.jsx)(ey.Form.Item,{label:"布局",children:(0,d.jsxs)(ey.Radio.Group,{size:"small",value:t.layout,onChange:e=>n("layout",e.target.value),children:[(0,d.jsx)(ey.Radio.Button,{value:"horizontal",children:"水平"}),(0,d.jsx)(ey.Radio.Button,{value:"vertical",children:"垂直"}),(0,d.jsx)(ey.Radio.Button,{value:"grid",children:"网格"})]})}),"grid"===t.layout&&(0,d.jsx)(ey.Form.Item,{label:"网格行数",children:(0,d.jsx)(ey.InputNumber,{size:"small",value:t.lineNumber,onChange:e=>n("lineNumber",e),min:1,max:10})}),(0,d.jsxs)(ey.Form.Item,{labelCol:{span:24},wrapperCol:{span:24},children:[(0,d.jsx)(ey.Table,{size:"small",dataSource:t.options,columns:a,pagination:!1,rowKey:(e,t)=>String(t),bordered:!0}),(0,d.jsx)(ey.Button,{size:"small",block:!0,onClick:()=>{n("options",[...t.options||[],{label:"",value:""}])},children:"添加选项"})]})]})},defaultOptions:{props:{var:"",layout:"horizontal",lineNumber:3,options:[{label:"选项1",value:"1"},{label:"选项2",value:"2"}]},cascadeIds:[]}},{group:"表单组件",key:"b-date-picker",label:"日期选择器",icon:"icon-form-date-picker",component:e=>{let{id:t,var:l="",size:n,allowClear:r=!1,type:a="date",showTime:i=!1,value:o,item:s,onChange:c,style:u={},className:m}=e,{env:x,callbacks:h}=(0,p.useContext)(ex),f=e=>{c&&c(e),x&&s&&l&&eI(x,s,l,e),x&&s&&h&&ez(x,s,h)};if("time"===a){let e="string"==typeof o&&o?tk()(o,"HH:mm"):void 0;return(0,d.jsx)(ey.TimePicker,{id:t,value:e,format:"HH:mm",placeholder:"请选择时间",size:n,allowClear:r,onChange:e=>f(e?e.format("HH:mm"):void 0),style:{...(null==s?void 0:s.style)||{},...u},className:m})}if("month"===a||"year"===a){let e="month"===a?"YYYY-MM":"YYYY",l="string"==typeof o&&o?tk()(o,e):void 0;return(0,d.jsx)(ey.DatePicker,{id:t,picker:a,value:l,format:e,placeholder:"month"===a?"请选择月份":"请选择年份",size:n,allowClear:r,onChange:t=>f(t?t.format(e):void 0),onPanelChange:t=>f(t?t.format(e):void 0),style:{...(null==s?void 0:s.style)||{},...u},className:m})}if("range"===a){let e=i?"YYYY-MM-DD HH:mm":"YYYY-MM-DD",l=Array.isArray(o)&&o[0]?tk()(o[0],e):void 0,a=Array.isArray(o)&&o[1]?tk()(o[1],e):void 0;return(0,d.jsx)(ey.DatePicker.RangePicker,{id:t,value:[l,a],format:e,placeholder:["开始日期","结束日期"],size:n,allowClear:r,showTime:i,onChange:t=>f(t&&t[0]&&t[1]?[t[0].format(e),t[1].format(e)]:void 0),style:{...(null==s?void 0:s.style)||{},...u},className:m})}let g=i?"YYYY-MM-DD HH:mm":"YYYY-MM-DD",v="string"==typeof o&&o?tk()(o,g):void 0;return(0,d.jsx)(ey.DatePicker,{id:t,value:v,format:g,placeholder:"请选择日期",size:n,allowClear:r,showTime:i,style:{...(null==s?void 0:s.style)||{},...u},className:m,onChange:e=>f(e?e.format(g):void 0)})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n});return(0,d.jsxs)(ey.Form,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,d.jsx)(ey.Form.Item,{label:"变量名",children:(0,d.jsx)(ey.Input,{size:"small",value:t.var,onChange:e=>n("var",e.target.value),placeholder:"请输入变量名"})}),(0,d.jsx)(ey.Form.Item,{label:"类型",children:(0,d.jsxs)(ey.Radio.Group,{size:"small",value:t.type,onChange:e=>n("type",e.target.value),children:[(0,d.jsx)(ey.Radio.Button,{value:"date",children:"日期"}),(0,d.jsx)(ey.Radio.Button,{value:"time",children:"时间"}),(0,d.jsx)(ey.Radio.Button,{value:"month",children:"月份"}),(0,d.jsx)(ey.Radio.Button,{value:"year",children:"年份"}),(0,d.jsx)(ey.Radio.Button,{value:"range",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.allowClear,onChange:e=>n("allowClear",e)})}),(0,d.jsx)(ey.Form.Item,{label:"显示时间",children:(0,d.jsx)(ey.Switch,{size:"small",checked:!!t.showTime,onChange:e=>n("showTime",e)})})]})},defaultOptions:{props:{var:"",size:"default",allowClear:!0,showTime:!1,type:"date"},cascadeIds:[]}},{group:"表单组件",key:"b-switch",label:"开关",icon:"icon-form-switch",component:e=>{let{id:t,var:l="",checked:n,disabled:r,size:a="default",checkedChildren:i,unCheckedChildren:o,item:s,onChange:c,style:u={},className:m}=e,{env:x,callbacks:h}=(0,p.useContext)(ex);return(0,d.jsx)("span",{children:(0,d.jsx)(ey.Switch,{id:t,checked:n,disabled:r,size:"small"===a?"small":void 0,checkedChildren:i,unCheckedChildren:o,onChange:e=>{c&&c(e),x&&s&&l&&eI(x,s,l,e),x&&s&&h&&ez(x,s,h)},style:u,className:m})})},formComponent:e=>{let{model:t,onChange:l}=e;return(0,d.jsx)(ey.Form,{labelCol:{span:6},wrapperCol:{span:18},children:(0,d.jsx)(ey.Form.Item,{label:"变量名",children:(0,d.jsx)(ey.Input,{size:"small",value:t.var,onChange:e=>{let n;return n=e.target.value,l&&l({...t,var:n})},placeholder:"请输入变量名"})})})},defaultOptions:{props:{var:"",size:"default",checkedChildren:"开",unCheckedChildren:"关"},cascadeIds:[]}},{group:"容器组件",key:"b-space",label:"容器",icon:"icon-space",component:e=>{let{id:t,align:l="start",size:n="small",direction:r="horizontal",item:a,style:i={},className:o}=e,{designable:s}=(0,p.useContext)(eo),[c,u]=(0,p.useState)(a.children||[]),m=(0,p.useMemo)(()=>({...i,...a.style||{},alignItems:l,flexDirection:r,gap:n}),[a,l,n,r]);return(0,d.jsx)(ep,{rootComponent:ey.Space,rootData:{id:t,style:m,className:o},list:c,item:a,onListChange:e=>{a.children=e,u(e)}})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n});return(0,d.jsxs)(ey.Form,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,d.jsx)(ey.Form.Item,{label:"方向",children:(0,d.jsxs)(ey.Radio.Group,{size:"small",value:t.direction,onChange:e=>n("direction",e.target.value),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:"大小",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.jsxs)(ey.Radio.Group,{size:"small",value:t.align,onChange:e=>n("align",e.target.value),children:[(0,d.jsx)(ey.Radio.Button,{value:"start",children:"开始"}),(0,d.jsx)(ey.Radio.Button,{value:"end",children:"结束"}),(0,d.jsx)(ey.Radio.Button,{value:"center",children:"居中"}),(0,d.jsx)(ey.Radio.Button,{value:"baseline",children:"基线"})]})})]})},defaultOptions:{props:{align:"flex-start",direction:"row",size:"8px"},children:[]}},{group:"容器组件",key:"b-card",label:"卡片",icon:"icon-card",component:e=>{let{id:t,bordered:l=!1,size:n="default",title:r,hoverable:a=!1,shadow:i=!0,item:o,style:s,className:c}=e,u=(0,p.useMemo)(()=>!o.children||Array.isArray(o.children)||"object"!=typeof o.children?null:o.children.title||[],[o]),[m,x]=(0,p.useState)(u||[]),h=(0,p.useMemo)(()=>!o.children||Array.isArray(o.children)||"object"!=typeof o.children?null:o.children.extra||[],[o]),[f,g]=(0,p.useState)(h||[]),v=(0,p.useMemo)(()=>o.children?Array.isArray(o.children)?o.children:"object"!=typeof o.children?null:o.children.body||[]:null,[o]),[j,y]=(0,p.useState)(v||[]),b=(0,p.useMemo)(()=>!o.children||Array.isArray(o.children)||"object"!=typeof o.children?null:o.children.actions||[],[o]),[w,C]=(0,p.useState)(b||[]);return(0,d.jsx)(ey.Card,{id:t,variant:l?"outlined":"borderless",size:n,hoverable:a,className:[i?"ant-card-shadow":void 0,c].filter(Boolean).join(" "),title:(null==r?void 0:r.length)&&!(null==u?void 0:u.length)?r:u?(0,d.jsx)(ep,{list:m,onListChange:e=>{o.children.title=e,x(e)}}):r,extra:h&&(0,d.jsx)(ep,{list:f,onListChange:e=>{o.children.extra=e,g(e)}}),actions:b&&[(0,d.jsx)(ep,{list:w,onListChange:e=>{o.children.actions=e,C(e)}})],styles:{header:{borderBottom:"none"}},style:s,children:v&&(0,d.jsx)(ep,{list:j,onListChange:e=>{Array.isArray(o.children)?o.children=e:o.children.body=e,y(e)}})})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n});return(0,d.jsxs)(ey.Form,{labelCol:{span:12},wrapperCol:{span:12},children:[(0,d.jsx)(ey.Form.Item,{label:"标题",children:(0,d.jsx)(ey.Input,{size:"small",value:t.title,onChange:e=>n("title",e.target.value)})}),(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.hoverable,onChange:e=>n("hoverable",e)})}),(0,d.jsx)(ey.Form.Item,{label:"阴影",children:(0,d.jsx)(ey.Switch,{size:"small",checked:!!t.shadow,onChange:e=>n("shadow",e)})}),(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:"default",children:"默认"}),(0,d.jsx)(ey.Radio.Button,{value:"small",children:"小"})]})})]})},defaultOptions:{props:{title:"标题",bordered:!0,hoverable:!0,shadow:!0,size:"default"},children:{title:[],extra:[],body:[],actions:[]}}},{group:"容器组件",key:"b-row",label:"栅格行",icon:"icon-grid-row",component:e=>{let{id:t,gutter:l,item:n,style:r,className:a}=e,{designable:i}=(0,p.useContext)(eo),[o,s]=(0,p.useState)(n.children||[]);return(0,d.jsx)(ep,{rootComponent:ey.Row,rootData:{id:t,gutter:l,style:n.style||r,className:n.className||a},list:o,item:n,onListChange:e=>{n.children=e,s(e)}})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n}),r=t.gutter||[0,0];return(0,d.jsxs)(ey.Form,{labelCol:{span:12},wrapperCol:{span:12},children:[(0,d.jsx)(ey.Form.Item,{label:"列间距",children:(0,d.jsx)(ey.InputNumber,{size:"small",value:r[0],min:0,step:4,onChange:e=>n("gutter",[e||0,r[1]])})}),(0,d.jsx)(ey.Form.Item,{label:"行间距",children:(0,d.jsx)(ey.InputNumber,{size:"small",value:r[1],min:0,step:4,onChange:e=>n("gutter",[r[0],e||0])})})]})},defaultOptions:{props:{gutter:[12,12]},children:[]}},{group:"容器组件",key:"b-col",label:"栅格列",icon:"icon-grid-columns",component:e=>{let{id:t,span:l=24,xs:n,sm:r,md:a,lg:i,xl:o,xxl:s,item:c,style:u={},className:m}=e,{designable:x}=(0,p.useContext)(eo),{deviceWidth:h}=(0,p.useContext)(ex),[f,g]=(0,p.useState)(c.children||[]),v=(0,p.useMemo)(()=>{let e=h||1600,t=null;return e<576&&n&&(t=n),e>=576&&r&&(t=r),e>=768&&a&&(t=a),e>=992&&i&&(t=i),e>=1200&&o&&(t=o),e>=1600&&s&&(t=s),t||l},[n,r,a,i,o,s,l,h]);return(0,d.jsx)(ep,{rootComponent:ey.Col,rootData:{id:t||c.id,span:v,style:{...c.style||{},...u},className:m},list:f,item:c,onListChange:e=>{c.children=e,g(e)}})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n});return(0,d.jsxs)(ey.Form,{labelCol:{span:12},wrapperCol:{span:12},children:[(0,d.jsx)(ey.Form.Item,{label:"默认列数",children:(0,d.jsx)(ey.InputNumber,{size:"small",value:t.span,min:0,max:24,step:4,onChange:e=>n("span",e||0)})}),(0,d.jsx)(ey.Form.Item,{label:(0,d.jsxs)(d.Fragment,{children:["xs"," ",(0,d.jsx)(ey.Tooltip,{title:"<576px 响应式栅格",children:(0,d.jsx)(tm,{})})]}),children:(0,d.jsx)(ey.InputNumber,{size:"small",value:t.xs,min:0,max:24,step:4,onChange:e=>n("xs",e||0)})}),(0,d.jsx)(ey.Form.Item,{label:(0,d.jsxs)(d.Fragment,{children:["sm"," ",(0,d.jsx)(ey.Tooltip,{title:"≥576px 响应式栅格",children:(0,d.jsx)(tm,{})})]}),children:(0,d.jsx)(ey.InputNumber,{size:"small",value:t.sm,min:0,max:24,step:4,onChange:e=>n("sm",e||0)})}),(0,d.jsx)(ey.Form.Item,{label:(0,d.jsxs)(d.Fragment,{children:["md"," ",(0,d.jsx)(ey.Tooltip,{title:"≥768px 响应式栅格",children:(0,d.jsx)(tm,{})})]}),children:(0,d.jsx)(ey.InputNumber,{size:"small",value:t.md,min:0,max:24,step:4,onChange:e=>n("md",e||0)})}),(0,d.jsx)(ey.Form.Item,{label:(0,d.jsxs)(d.Fragment,{children:["lg"," ",(0,d.jsx)(ey.Tooltip,{title:"≥992px 响应式栅格",children:(0,d.jsx)(tm,{})})]}),children:(0,d.jsx)(ey.InputNumber,{size:"small",value:t.lg,min:0,max:24,step:4,onChange:e=>n("lg",e||0)})}),(0,d.jsx)(ey.Form.Item,{label:(0,d.jsxs)(d.Fragment,{children:["xl"," ",(0,d.jsx)(ey.Tooltip,{title:"≥1200px 响应式栅格",children:(0,d.jsx)(tm,{})})]}),children:(0,d.jsx)(ey.InputNumber,{size:"small",value:t.xl,min:0,max:24,step:4,onChange:e=>n("xl",e||0)})}),(0,d.jsx)(ey.Form.Item,{label:(0,d.jsxs)(d.Fragment,{children:["xxl"," ",(0,d.jsx)(ey.Tooltip,{title:"≥1600px 响应式栅格",children:(0,d.jsx)(tm,{})})]}),children:(0,d.jsx)(ey.InputNumber,{size:"small",value:t.xxl,min:0,max:24,step:4,onChange:e=>n("xxl",e||0)})})]})},defaultOptions:{props:{xs:24,sm:12,md:12,lg:6,xl:6,xxl:6,span:8},children:[]}}]})(),u})());
|