bi-sdk-react 0.0.25 → 0.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/js/bi-sdk.es.js +90 -38
- package/dist/types/components/PageDesigner.d.ts +2 -1
- package/dist/types/components/context/PageContext.d.ts +14 -3
- package/dist/types/components/dnd/DropContainer.d.ts +1 -0
- package/dist/types/components/hooks/datasource.d.ts +3 -1
- package/dist/types/components/index.d.ts +1 -3
- package/dist/types/components/layout/PageCanvas.d.ts +0 -2
- package/dist/types/components/layout/PageItem.d.ts +1 -0
- package/dist/types/components/plugins/@antd/items/ButtonRender.d.ts +1 -1
- package/dist/types/components/plugins/@antd/items/CapsuleRender.d.ts +1 -1
- package/dist/types/components/plugins/@antd/items/CardRender.d.ts +2 -1
- package/dist/types/components/plugins/@antd/items/CheckboxRender.d.ts +1 -1
- package/dist/types/components/plugins/@antd/items/ColRender.d.ts +2 -1
- package/dist/types/components/plugins/@antd/items/DatePickerRender.d.ts +3 -3
- package/dist/types/components/plugins/@antd/items/InputNumberRender.d.ts +1 -1
- package/dist/types/components/plugins/@antd/items/InputRender.d.ts +2 -2
- package/dist/types/components/plugins/@antd/items/PageHeaderRender.d.ts +2 -1
- package/dist/types/components/plugins/@antd/items/RowRender.d.ts +2 -1
- package/dist/types/components/plugins/@antd/items/SelectRender.d.ts +2 -2
- package/dist/types/components/plugins/@antd/items/SpaceRender.d.ts +2 -1
- package/dist/types/components/plugins/@antd/items/SwitchRender.d.ts +1 -1
- package/dist/types/components/plugins/@antd/items/TableRender.d.ts +1 -1
- package/dist/types/components/typing.d.ts +6 -1
- package/dist/types/components/utils.d.ts +0 -8
- package/dist/umd/js/bi-sdk.umd.min.js +88 -36
- package/package.json +1 -1
- package/src/components/PageDesigner.tsx +16 -9
- package/src/components/context/PageContext.tsx +112 -5
- package/src/components/dnd/DropContainer.tsx +7 -4
- package/src/components/hooks/datasource.ts +30 -10
- package/src/components/index.ts +4 -10
- package/src/components/layout/PageCanvas.tsx +15 -47
- package/src/components/layout/PageItem.tsx +256 -67
- package/src/components/panel/AiPanel.tsx +10 -2
- package/src/components/panel/LayerPanel.tsx +0 -2
- package/src/components/panel/PropertiesPanel.tsx +65 -32
- package/src/components/plugins/@antd/item-props/EchartsProps.tsx +0 -1
- package/src/components/plugins/@antd/items/ButtonRender.tsx +7 -6
- package/src/components/plugins/@antd/items/CapsuleRender.tsx +6 -6
- package/src/components/plugins/@antd/items/CardRender.tsx +33 -6
- package/src/components/plugins/@antd/items/CheckboxRender.tsx +6 -6
- package/src/components/plugins/@antd/items/ColRender.tsx +13 -8
- package/src/components/plugins/@antd/items/DatePickerRender.tsx +8 -8
- package/src/components/plugins/@antd/items/EchartsRender.tsx +32 -17
- package/src/components/plugins/@antd/items/HtmlRender.tsx +22 -13
- package/src/components/plugins/@antd/items/InputNumberRender.tsx +5 -6
- package/src/components/plugins/@antd/items/InputRender.tsx +6 -7
- package/src/components/plugins/@antd/items/ListRender.tsx +19 -15
- package/src/components/plugins/@antd/items/PageHeaderRender.tsx +9 -2
- package/src/components/plugins/@antd/items/RowRender.tsx +10 -5
- package/src/components/plugins/@antd/items/SelectRender.tsx +6 -7
- package/src/components/plugins/@antd/items/SpaceRender.tsx +11 -4
- package/src/components/plugins/@antd/items/SwitchRender.tsx +5 -6
- package/src/components/plugins/@antd/items/TableRender.tsx +4 -6
- package/src/components/typing.ts +12 -1
- package/src/components/utils.ts +0 -34
- package/src/example.tsx +147 -64
- package/src/components/context/EnvContext.tsx +0 -45
|
@@ -1,5 +1,46 @@
|
|
|
1
1
|
/*! For license information please see bi-sdk.umd.min.js.LICENSE.txt */
|
|
2
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@ant-design/icons"),require("echarts"),require("styled-components"),require("react"),require("antd"),require("uuid"),require("dayjs"),require("@monaco-editor/react")):"function"==typeof define&&define.amd?define(["@ant-design/icons","echarts","styled-components","react","antd","uuid","dayjs","@monaco-editor/react"],t):"object"==typeof exports?exports.BiSdk=t(require("@ant-design/icons"),require("echarts"),require("styled-components"),require("react"),require("antd"),require("uuid"),require("dayjs"),require("@monaco-editor/react")):e.BiSdk=t(e["@ant-design/icons"],e.echarts,e["styled-components"],e.react,e.antd,e.uuid,e.dayjs,e["@monaco-editor/react"])}(this,(e,t,l,n,r,a,i,o)=>(()=>{var s={290(e,t,l){"use strict";var n=this&&this.__assign||function(){return(n=Object.assign||function(e){for(var t,l=1,n=arguments.length;l<n;l++)for(var r in t=arguments[l])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.bindAll=void 0;var r=l(352);function a(e){if(void 0!==e)return"boolean"==typeof e?{capture:e}:e}t.bindAll=function(e,t,l){var i=t.map(function(t){var i=null==l?t:n(n({},t),{options:n(n({},a(l)),a(t.options))});return(0,r.bind)(e,i)});return function(){i.forEach(function(e){return e()})}}},352(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.bind=void 0,t.bind=function(e,t){var l=t.type,n=t.listener,r=t.options;return e.addEventListener(l,n,r),function(){e.removeEventListener(l,n,r)}}},951(e,t,l){"use strict";t.bindAll=t.bind=void 0;var n=l(352);Object.defineProperty(t,"bind",{enumerable:!0,get:function(){return n.bind}});var r=l(290);Object.defineProperty(t,"bindAll",{enumerable:!0,get:function(){return r.bindAll}})},965(e,t,l){"use strict";var n=l(426),r={"text/plain":"Text","text/html":"Url",default:"Text"};e.exports=function(e,t){var l,a,i,o,s,d,c,u,p=!1;t||(t={}),i=t.debug||!1;try{if(s=n(),d=document.createRange(),c=document.getSelection(),(u=document.createElement("span")).textContent=e,u.ariaHidden="true",u.style.all="unset",u.style.position="fixed",u.style.top=0,u.style.clip="rect(0, 0, 0, 0)",u.style.whiteSpace="pre",u.style.webkitUserSelect="text",u.style.MozUserSelect="text",u.style.msUserSelect="text",u.style.userSelect="text",u.addEventListener("copy",function(l){if(l.stopPropagation(),t.format)if(l.preventDefault(),void 0===l.clipboardData){i&&console.warn("unable to use e.clipboardData"),i&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var n=r[t.format]||r.default;window.clipboardData.setData(n,e)}else l.clipboardData.clearData(),l.clipboardData.setData(t.format,e);t.onCopy&&(l.preventDefault(),t.onCopy(l.clipboardData))}),document.body.appendChild(u),d.selectNodeContents(u),c.addRange(d),!document.execCommand("copy"))throw Error("copy command was unsuccessful");p=!0}catch(n){i&&console.error("unable to copy using execCommand: ",n),i&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),p=!0}catch(n){i&&console.error("unable to copy using clipboardData: ",n),i&&console.error("falling back to prompt"),l="message"in t?t.message:"Copy to clipboard: #{key}, Enter",a=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C",o=l.replace(/#{\s*key\s*}/g,a),window.prompt(o,e)}}finally{c&&("function"==typeof c.removeRange?c.removeRange(d):c.removeAllRanges()),u&&document.body.removeChild(u),s()}return p}},20(e,t,l){"use strict";var n=l(155),r=Symbol.for("react.element"),a=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,o=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function d(e,t,l){var n,a={},d=null,c=null;for(n in void 0!==l&&(d=""+l),void 0!==t.key&&(d=""+t.key),void 0!==t.ref&&(c=t.ref),t)i.call(t,n)&&!s.hasOwnProperty(n)&&(a[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps)void 0===a[n]&&(a[n]=t[n]);return{$$typeof:r,type:e,key:d,ref:c,props:a,_owner:o.current}}t.Fragment=a,t.jsx=d,t.jsxs=d},848(e,t,l){"use strict";e.exports=l(20)},426(e){e.exports=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,l=[],n=0;n<e.rangeCount;n++)l.push(e.getRangeAt(n));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null}return e.removeAllRanges(),function(){"Caret"===e.type&&e.removeAllRanges(),e.rangeCount||l.forEach(function(t){e.addRange(t)}),t&&t.focus()}}},375(t){"use strict";t.exports=e},247(e){"use strict";e.exports=o},59(e){"use strict";e.exports=r},185(e){"use strict";e.exports=i},190(e){"use strict";e.exports=t},155(e){"use strict";e.exports=n},694(e){"use strict";e.exports=l},315(e){"use strict";e.exports=a}},d={};function c(e){var t=d[e];if(void 0!==t)return t.exports;var l=d[e]={exports:{}};return s[e].call(l.exports,l,l.exports,c),l.exports}c.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return c.d(t,{a:t}),t},c.d=(e,t)=>{for(var l in t)c.o(t,l)&&!c.o(e,l)&&Object.defineProperty(e,l,{enumerable:!0,get:t[l]})},c.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),c.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var u={};return(()=>{"use strict";c.r(u),c.d(u,{EnvContext:()=>ex,PageCanvas:()=>ev,PageSchema:()=>o.PageSchema,PageContext:()=>eo,PageDesigner:()=>tu,PluginType:()=>o.PluginType,plugins:()=>tO,PropEditorProps:()=>s.PropEditorProps,PageProvider:()=>es,handleCallback:()=>ez,DropContainer:()=>em});var e,t,l,n,r,a,i,o={};c.r(o),c.d(o,{P:()=>tp});var s={};c.r(s);var d=c(848),p=c(155),m=c.n(p),x=c(694),h=c.n(x);function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var l=0,n=Array(t);l<t;l++)n[l]=e[l];return n}function g(e,t){if(e){if("string"==typeof e)return f(e,t);var l=({}).toString.call(e).slice(8,-1);return"Object"===l&&e.constructor&&(l=e.constructor.name),"Map"===l||"Set"===l?Array.from(e):"Arguments"===l||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(l)?f(e,t):void 0}}function v(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var l=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=l){var n,r,a,i,o=[],s=!0,d=!1;try{if(a=(l=l.call(e)).next,0===t){if(Object(l)!==l)return;s=!1}else for(;!(s=(n=a.call(l)).done)&&(o.push(n.value),o.length!==t);s=!0);}catch(e){d=!0,r=e}finally{try{if(!s&&null!=l.return&&(i=l.return(),Object(i)!==i))return}finally{if(d)throw r}}return o}}(e,t)||g(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var y=c(951),j="data-pdnd-honey-pot";function b(e){return e instanceof Element&&e.hasAttribute(j)}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 A=E();(0,y.bindAll)(window,[{type:"dragstart",listener:function(){A.enterCount=0,A.isOverWindow=!0}},{type:"drop",listener:B},{type:"dragend",listener:B},{type:"dragenter",listener:function(e){A.isOverWindow||0!==A.enterCount||(e[D.isEnteringWindow]=!0),A.isOverWindow=!0,A.enterCount++}},{type:"dragleave",listener:function(e){A.enterCount--,A.isOverWindow&&0===A.enterCount&&(e[D.isLeavingWindow]=!0,A.isOverWindow=!1)}}],{capture:!0})}function E(){return{enterCount:0,isOverWindow:!1}}function B(){A=E()}function L(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 M=(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 _(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(Y()){var a,i,o=function(e){var t=e.event,l=e.dragType,n=e.getDropTargetsOver,r=L(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};_({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(),M.cancel(),a({eventName:"onDropTargetChange",payload:{source:t,location:{initial:l,previous:r,current:n}}})},drag:function(e){var n=e.current;M(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(),M.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,y.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:L(e)},s.current.dropTargets.length)?(e.preventDefault(),_({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:L(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=L(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(),_({event:e,current:r})),u({dropTargets:r,input:t})}function m(){s.current.dropTargets.length&&u({dropTargets:[],input:s.current.input}),d.drop({current:s.current,updatedSourcePayload:null}),x()}function x(){$.isActive=!1,c()}},q=new Map;function G(){for(var e=arguments.length,t=Array(e),l=0;l<e;l++)t[l]=arguments[l];return function(){t.forEach(function(e){return e()})}}function U(e,t){var l=t.attribute,n=t.value;return e.setAttribute(l,n),function(){return e.removeAttribute(l)}}function J(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?J(Object(l),!0).forEach(function(t){S(e,t,l[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(l)):J(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 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,y.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(j,"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,y.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,y.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=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(G(U(e.element,{attribute:r,value:"true"}),(n.set(e.element,e),function(){return n.delete(e.element)})))},getIsOver:function(e){var t=e.source,r=e.target,i=e.input,o=e.current,s=function e(t){var r,i,o,s,d=t.source,c=t.target,u=t.input,p=t.result,m=void 0===p?[]:p;if(null==c)return m;if(!(c instanceof Element))return c instanceof Node?e({source:d,target:c.parentElement,input:u,result:m}):m;var x=c.closest(a);if(null==x)return m;var h=n.get(x);if(null==h)return m;var f={input:u,source:d,element:h.element};if(h.canDrop&&!h.canDrop(f))return e({source:d,target:h.element.parentElement,input:u,result:m});var g=null!=(r=null==(i=h.getData)?void 0:i.call(h,f))?r:{},v=null!=(o=null==(s=h.getDropEffect)?void 0:s.call(h,f))?o:l,y={data:g,element:h.element,dropEffect:v,isActiveDueToStickiness:!1};return e({source:d,target:h.element.parentElement,input:u,result:[].concat(N(m),[y])})}({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 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 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){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=q.get(t);if(n)return n.usageCount++,n;var r={typeKey:t,unmount:l(),usageCount:1};return q.set(t,r),r}(e={typeKey:t,mount:function(){return l({canStart:Y,start:d})}}),function(){n.usageCount--,n.usageCount>0||(n.unmount(),q.delete(e.typeKey))}},dropTarget:o.dropTargetForConsumers,monitor:i.monitorForConsumers}}({typeKey:"element",defaultDropEffect:"move",mount:function(e){return G(en.bindEvents(),(0,y.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=L(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],y=f[1];t.dataTransfer.setData(g,null!=y?y:"")}!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 j={element:d.element,dragHandle:null!=(a=d.dragHandle)?a:null,data:null!=(i=null==(o=d.getInitialData)?void 0:o.call(d,u))?i:{}};e.start({event:t,dragType:{type:"element",payload:j,startedFrom:"internal"}})}}}}}))},dispatchEventToSource:function(e){var t,l,n=e.eventName,r=e.payload;null==(t=el.get(r.source.element))||null==(l=t[n])||l.call(t,r)},onPostDispatch:en.getOnPostDispatch()}),ea=er.dropTarget;function ei(e){return T(G(er.registerUsage(),(el.set(e.element,e),function(){el.delete(e.element)}),U(e.element,{attribute:"draggable",value:"true"})))}er.monitor;let eo=(0,p.createContext)({pageId:"",designable:!1,plugins:[],schema:{info:{},datasources:[],scripts:[],variables:[],items:[]},selectedItem:null,atItems:null,setSchema:()=>{},setSelectedItem:()=>{},updateSelectedItem:()=>{},forceUpdate:()=>{},onAddAtItem:()=>{},onRemoveAtItem:()=>{},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,[m,x]=(0,p.useState)([]);return(0,d.jsx)(eo.Provider,{value:{pageId:t,designable:!!l,plugins:n||[],schema:r,selectedItem:a,atItems:m,setSchema:i||(()=>{}),setSelectedItem:o||(()=>{}),updateSelectedItem:e=>{null==o||o(Object.assign(a,e||{})),null==i||i({...r})},datasetSelector:s,fetch:c,forceUpdate:()=>{null==i||i({...r})},onAddAtItem:e=>{null!=m&&m.includes(e)||x([...m,e])},onRemoveAtItem:(e,t)=>{x(m.filter(t=>t!==e))}},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,onAddAtItem:m}=(0,p.useContext)(eo),[x,h]=(0,p.useState)(!1),f=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");o.innerText="#",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",o.setAttribute("title","添加到对话"),n.appendChild(o),o.addEventListener("click",e=>{e.stopPropagation(),m&&m(l)});let s=document.createElement("a");return s.innerText="X",s.style.background="#1890ff",s.style.color="#fff",s.style.fontSize="12px",s.style.borderTopLeftRadius="4px",s.style.borderTopRightRadius="4px",s.style.padding="2px 8px",s.style.cursor="pointer",s.style.userSelect="none",s.setAttribute("title","删除"),n.appendChild(s),s.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:()=>{h(!0)},onDrop:()=>{h(!1)}}),n=e=>{e.stopPropagation(),c&&c(l)};return o&&e.addEventListener("click",n),()=>{t(),o&&e.removeEventListener("click",n)}},[o,l,i,r]),f)?(0,d.jsx)(f,{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:x?.5:1}}):null},ec=h().div`
|
|
2
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@ant-design/icons"),require("echarts"),require("styled-components"),require("react"),require("antd"),require("react-dom"),require("uuid"),require("dayjs"),require("@monaco-editor/react")):"function"==typeof define&&define.amd?define(["@ant-design/icons","echarts","styled-components","react","antd","react-dom","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("react-dom"),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["react-dom"],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},514(e){"use strict";e.exports=a},694(e){"use strict";e.exports=l},315(e){"use strict";e.exports=i}},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,{PluginType:()=>o.PluginType,PageCanvas:()=>ek,PageContext:()=>f,PageDesigner:()=>tc,PageSchema:()=>o.PageSchema,plugins:()=>tz,PropEditorProps:()=>s.PropEditorProps,PageProvider:()=>g,DropContainer:()=>eC});var e,t,l,n,r,a,i,o={};u.r(o),u.d(o,{P:()=>tu});var s={};u.r(s);var d=u(848),c=u(155),m=u.n(c),x=u(694),h=u.n(x);let f=(0,c.createContext)({pageId:"",designable:!1,plugins:[],schema:{info:{},datasources:[],scripts:[],variables:[],items:[]},selectedItem:null,atItems:null,setSchema:()=>{},setSelectedItem:()=>{},updateSelectedItem:()=>{},forceUpdate:()=>{},onAddAtItem:()=>{},onRemoveAtItem:()=>{},datasetSelector:void 0,datasetAdd:void 0,fetch:void 0,deviceWidth:0,setDeviceWidth:()=>{},initCallback:()=>{},handleCallback:()=>{},getVars:()=>({}),setVar:()=>{}}),g=e=>{let{pageId:t,designable:l,plugins:n,schema:r,selectedItem:a,setSchema:i,setSelectedItem:o,datasetSelector:s,datasetAdd:u,fetch:p,children:m}=e,[x,h]=(0,c.useState)(0),[g,v]=(0,c.useState)([]),[j,b]=(0,c.useState)({global:{},local:{}}),[y,w]=(0,c.useState)({}),C=e=>({...j.global,...j.local[e||""]||{}});return(0,c.useEffect)(()=>{let e={};(r.variables||[]).forEach(t=>{e[t.name]=t.value}),b(t=>({...t,global:e}))},[r.variables]),(0,d.jsx)(f.Provider,{value:{pageId:t,designable:!!l,plugins:n||[],schema:r,selectedItem:a,atItems:g,setSchema:i||(()=>{}),setSelectedItem:o||(()=>{}),updateSelectedItem:e=>{null==o||o(Object.assign(a,e||{})),null==i||i({...r})},datasetSelector:s,datasetAdd:u,fetch:p,forceUpdate:()=>{null==i||i({...r})},onAddAtItem:e=>{null!=g&&g.includes(e)||v([...g,e])},onRemoveAtItem:e=>{v(g.filter(t=>t!==e))},deviceWidth:x,setDeviceWidth:h||(()=>{}),initCallback:e=>{let{id:t,callback:l}=e;w(e=>({...e,[t]:l}))},handleCallback:(e,t,l)=>{(e.cascadeIds||[]).forEach(e=>{let n=y[e];if("function"==typeof n){let r=n(t,C(e));if(r){let{target:e,data:t}=r;null==l||l(e,t)}}})},getVars:C,setVar:(e,t,l)=>{let n={...j};(e.cascadeIds||[]).forEach(e=>{n.local[e]=n.local[e]||{},n.local[e][t]=l})}},children:m})};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 j(e,t){if(e){if("string"==typeof e)return v(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)?v(e,t):void 0}}function b(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)||j(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 y=u(951),w="data-pdnd-honey-pot";function C(e){return e instanceof Element&&e.hasAttribute(w)}function S(e){var t=b(document.elementsFromPoint(e.x,e.y),2),l=t[0],n=t[1];return l?C(l)?null!=n?n:null:l:null}function I(e){return(I="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 k(e,t,l){var n;return(n=function(e,t){if("object"!=I(e)||!e)return e;var l=e[Symbol.toPrimitive];if(void 0!==l){var n=l.call(e,t||"default");if("object"!=I(n))return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==I(n)?n:n+"")in e)?Object.defineProperty(e,t,{value:l,enumerable:!0,configurable:!0,writable:!0}):e[t]=l,e}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}function O(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){k(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}function N(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 T(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 R(e){return function(e){if(Array.isArray(e))return v(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||j(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 F(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 D=F(function(){return navigator.userAgent.includes("Firefox")}),E=F(function(){var e=navigator.userAgent;return e.includes("AppleWebKit")&&!e.includes("Chrome")}),A={isLeavingWindow:Symbol("leaving"),isEnteringWindow:Symbol("entering")};if("undefined"!=typeof window&&E()){var B=M();(0,y.bindAll)(window,[{type:"dragstart",listener:function(){B.enterCount=0,B.isOverWindow=!0}},{type:"drop",listener:P},{type:"dragend",listener:P},{type:"dragenter",listener:function(e){B.isOverWindow||0!==B.enterCount||(e[A.isEnteringWindow]=!0),B.isOverWindow=!0,B.enterCount++}},{type:"dragleave",listener:function(e){B.enterCount--,B.isOverWindow&&0===B.enterCount&&(e[A.isLeavingWindow]=!0,B.isOverWindow=!1)}}],{capture:!0})}function M(){return{enterCount:0,isOverWindow:!1}}function P(){B=M()}function L(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 $=(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),Y=(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 q(){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 G=function(e){var t=e.event,l=e.dragType,n=e.getDropTargetsOver,r=e.dispatchEvent;if(q()){var a,i,o=function(e){var t=e.event,l=e.dragType,n=e.getDropTargetsOver,r=L(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}}),Y.schedule(function(){a({eventName:"onDragStart",payload:{source:t,location:i}})})},dragUpdate:function(e){var n=e.current;Y.flush(),$.cancel(),a({eventName:"onDropTargetChange",payload:{source:t,location:{initial:l,previous:r,current:n}}})},drag:function(e){var n=e.current;$(function(){Y.flush(),a({eventName:"onDrag",payload:{source:t,location:{initial:l,previous:r,current:n}}})})},drop:function(e){var n=e.current,i=e.updatedSourcePayload;Y.flush(),$.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,y.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&&(E()?!!E()&&t.hasOwnProperty(A.isLeavingWindow):null==n||(D()?"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:L(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:L(e)},m()}}].concat(R([{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=L(e),r=n({target:C(e.target)?S({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()}},U=new Map;function J(){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 K(e,t){var l=t.attribute,n=t.value;return e.setAttribute(l,n),function(){return e.removeAttribute(l)}}function W(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 X(e){for(var t=1;t<arguments.length;t++){var l=null!=arguments[t]?arguments[t]:{};t%2?W(Object(l),!0).forEach(function(t){k(e,t,l[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(l)):W(Object(l)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(l,t))})}return e}function V(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))||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 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){return e.slice(0).reverse()}function ee(e,t){(null==t||t>e.length)&&(t=e.length);for(var l=0,n=Array(t);l<t;l++)n[l]=e[l];return n}function et(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 el=F(function(){return navigator.userAgent.toLocaleLowerCase().includes("android")}),en="text/plain",er=new WeakMap,ea=(a=null,{bindEvents:function(){return a=null,(0,y.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(w,"true"),i=N({client:d}),Object.assign(r.style,O(O({backgroundColor:"transparent",position:"fixed",padding:0,margin:0,boxSizing:"border-box"},T({clientRect:i})),{},{pointerEvents:"auto",zIndex:0x7fffffff})),document.body.appendChild(r),o=(0,y.bind)(window,{type:"pointermove",listener:function(e){i=N({client:{x:e.clientX,y:e.clientY}}),Object.assign(r.style,T({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,y.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}}}}),ei=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 ee(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)?ee(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?et(Object(l),!0).forEach(function(t){k(e,t,l[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(l)):et(Object(l)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(l,t))})}return e}({},n);return e.add(r),l(r),F(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=V(r.location.current.dropTargets);try{for(a.s();!(t=a.n()).done;){var i,o=t.value,s=n.get(o.element),d=X(X({},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=V(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=X(X({},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=V(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=X(X({},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 F(J(K(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(R(m),[j])})}({source:t,target:r,input:i});if(s.length>=o.length)return s;for(var d=Z(o),c=Z(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(X(X({},x),{},{isActiveDueToStickiness:!0}))}return Z(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){G({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=U.get(t);if(n)return n.usageCount++,n;var r={typeKey:t,unmount:l(),usageCount:1};return U.set(t,r),r}(e={typeKey:t,mount:function(){return l({canStart:q,start:d})}}),function(){n.usageCount--,n.usageCount>0||(n.unmount(),U.delete(e.typeKey))}},dropTarget:o.dropTargetForConsumers,monitor:i.monitorForConsumers}}({typeKey:"element",defaultDropEffect:"move",mount:function(e){return J(ea.bindEvents(),(0,y.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=er.get(s);if(d){var c=L(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=S({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=b(h[x],2),g=f[0],v=f[1];t.dataTransfer.setData(g,null!=v?v:"")}!el()||t.dataTransfer.types.includes(en)||t.dataTransfer.types.includes("text/uri-list")||t.dataTransfer.setData(en,"pdnd:android-fallback"),t.dataTransfer.setData("application/vnd.pdnd","");var j={element:d.element,dragHandle:null!=(a=d.dragHandle)?a:null,data:null!=(i=null==(o=d.getInitialData)?void 0:o.call(d,u))?i:{}};e.start({event:t,dragType:{type:"element",payload:j,startedFrom:"internal"}})}}}}}))},dispatchEventToSource:function(e){var t,l,n=e.eventName,r=e.payload;null==(t=er.get(r.source.element))||null==(l=t[n])||l.call(t,r)},onPostDispatch:ea.getOnPostDispatch()}),eo=ei.dropTarget;function es(e){return F(J(ei.registerUsage(),(er.set(e.element,e),function(){er.delete(e.element)}),K(e.element,{attribute:"draggable",value:"true"})))}ei.monitor;var ed=u(375);let ec=(0,ed.createFromIconfontCN)({scriptUrl:"https://at.alicdn.com/t/c/font_5072483_ufbwxczz8z.js"}),eu=e=>{let{type:t,className:l="",style:n={}}=e;return(0,d.jsx)(ec,{type:t,className:l,style:n})};var ep=u(59),em=u(514),ex=u.n(em),eh=u(247),ef=u.n(eh);let eg=h().div`
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: row;
|
|
5
|
+
align-items: flex-end;
|
|
6
|
+
|
|
7
|
+
> * {
|
|
8
|
+
background-color: rgb(24, 144, 255);
|
|
9
|
+
color: #fff;
|
|
10
|
+
font-size: 12px;
|
|
11
|
+
border-bottom-left-radius: 0;
|
|
12
|
+
border-bottom-right-radius: 0;
|
|
13
|
+
padding: 2px 8px;
|
|
14
|
+
cursor: pointer;
|
|
15
|
+
user-select: none;
|
|
16
|
+
height: 22px;
|
|
17
|
+
box-sizing: border-box;
|
|
18
|
+
|
|
19
|
+
&:first-child {
|
|
20
|
+
border-top-left-radius: 4px;
|
|
21
|
+
border-top-right-radius: 2px;
|
|
22
|
+
margin-right: 1px;
|
|
23
|
+
|
|
24
|
+
& + a {
|
|
25
|
+
border-top-left-radius: 1px;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&:last-child {
|
|
30
|
+
border-top-right-radius: 4px;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
> a {
|
|
35
|
+
background-color: rgb(24, 144, 255, 0.6);
|
|
36
|
+
font-size: 10px;
|
|
37
|
+
height: 20px;
|
|
38
|
+
|
|
39
|
+
&:hover {
|
|
40
|
+
background-color: rgb(24, 144, 255, 1);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
`,ev=e=>{let{item:t,ancestors:l,onAddAt:n,onDelete:r,onUpdate:a,onSelect:i}=e,[o,s]=(0,c.useState)(JSON.stringify(t||{},null,2)),[u,p]=(0,c.useState)(!1),m=(0,c.useRef)(null),x=(0,d.jsx)(ep.Typography.Text,{children:t.name||t.type+`(${t.id})`});return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(ep.Modal,{title:`源码编辑(${t.name||t.type+`(${t.id})`})`,open:u,width:700,onCancel:()=>{p(!1),m.current=null},styles:{body:{margin:"0 -24px"}},footer:(0,d.jsxs)(ep.Space,{children:[(0,d.jsx)(ep.Button,{onClick:()=>{p(!1),m.current=null},children:"取消"}),(0,d.jsx)(ep.Button,{onClick:()=>{s(JSON.stringify(t||{},null,2))},children:"重置"}),(0,d.jsx)(ep.Button,{onClick:()=>{var e,t;let l=null==(e=m.current)?void 0:e.editor;null==l||null==(t=l.getAction("editor.action.formatDocument"))||t.run()},children:"格式化"}),(0,d.jsx)(ep.Button,{type:"primary",onClick:()=>{p(!1),Object.assign(t,JSON.parse(o)),a&&a()},children:"保存"})]}),children:(0,d.jsx)(eh.Editor,{height:"400px",defaultLanguage:"json",value:o,onChange:e=>s(e||""),options:{minimap:{enabled:!1}},onMount:e=>{m.current={editor:e}}})}),(0,d.jsxs)(eg,{children:[(null==l?void 0:l.length)?(0,d.jsx)(ep.Dropdown,{placement:"topLeft",menu:{style:{borderRadius:0,padding:0,background:"none",boxShadow:"none"},items:l.map(e=>({label:(null==e?void 0:e.name)||(null==e?void 0:e.type)+`(${null==e?void 0:e.id})`,key:null==e?void 0:e.id,onClick:()=>{null==i||i(e)}}))},styles:{item:{borderRadius:2,background:"rgba(24, 144, 255, 0.8)",padding:"2px 8px",color:"#fff",fontSize:12,marginTop:2}},children:x}):x,n&&(0,d.jsx)(ep.Tooltip,{title:"添加到对话",children:(0,d.jsx)("a",{onClick:n,children:(0,d.jsx)(eu,{type:"icon-number"})})}),(0,d.jsx)(ep.Tooltip,{title:"源码编辑",children:(0,d.jsx)("a",{onClick:()=>p(!0),children:(0,d.jsx)(eu,{type:"icon-json"})})}),(0,d.jsx)(ep.Tooltip,{title:"删除",children:(0,d.jsx)("a",{onClick:r,children:(0,d.jsx)(ed.DeleteOutlined,{})})})]})]})},ej=e=>{var t,l;let{item:n,onDelete:r,ancestors:a,parentList:i,onListChange:o,index:s}=e,{designable:u,selectedItem:p,setSelectedItem:m,plugins:x,onAddAtItem:h,onRemoveAtItem:g,forceUpdate:v,fetch:j}=(0,c.useContext)(f),[b,y]=(0,c.useState)(!1),[w,C]=(0,c.useState)(null),S=null==(t=x.find(e=>e.key===n.type))?void 0:t.component;return((0,c.useEffect)(()=>{let e=()=>{if(!t.current)return;let e=document.getElementById(`page-item-${n.id}`);if(!e)return void l();let r=e.getBoundingClientRect();if(0===r.width&&0===r.height){t.current.style.display="none";return}t.current.style.display="flex";let a=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0,i=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;t.current.style.top=`${r.top+a-22}px`,t.current.style.left=`${r.left+i-1}px`},t={current:null},l=()=>{t.current&&(document.body.contains(t.current)&&document.body.removeChild(t.current),t.current=null,C(null),window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e))};if(p&&p===n&&u){let n=document.createElement("div");return n.style.position="absolute",n.style.zIndex="1000",n.style.display="flex",n.style.gap="4px",document.body.appendChild(n),t.current=n,C(n),e(),window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),()=>l()}},[p,u,n]),(0,c.useEffect)(()=>{let e=document.getElementById(`page-item-${n.id}`);if(!e||!u)return;let t=es({element:e,getInitialData:()=>({id:n.id,index:s,list:i,onListChange:o,data:n}),canDrag:()=>!!u,onDragStart:()=>{y(!0)},onDrop:()=>{y(!1)}}),l=e=>{e.stopPropagation(),m&&m(n)};return u&&e.addEventListener("click",l),()=>{t(),u&&e.removeEventListener("click",l)}},[u,n,s,i]),S)?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(S,{id:`page-item-${n.id}`,"data-item-id":n.id,...n.props||{},item:n,className:`page-item-component ${u?"designable":""} ${p===n?"selected":""}`,ancestors:a,style:{...n.style||{},opacity:b?.5:1}}),w&&ex().createPortal((0,d.jsx)(ev,{item:n,ancestors:a,onAddAt:(null==j||null==(l=j.ai)?void 0:l.chat)?e=>{e.stopPropagation(),h&&h(n)}:void 0,onDelete:e=>{e.stopPropagation(),ep.Modal.confirm({title:"确认删除吗?",okText:"确认",cancelText:"取消",okType:"danger",onOk:()=>{r&&r(),g&&g(n)}})},onUpdate:v,onSelect:m}),w)]}):null},eb=h().div`
|
|
3
44
|
position: absolute;
|
|
4
45
|
background: #1890ff;
|
|
5
46
|
pointer-events: none;
|
|
@@ -41,7 +82,7 @@
|
|
|
41
82
|
&::before { left: -3px; top: -4px; }
|
|
42
83
|
&::after { left: -3px; bottom: -4px; }
|
|
43
84
|
`}
|
|
44
|
-
`,
|
|
85
|
+
`,ey=(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}},ew=e=>{let{rootComponent:t="div",rootData:l={},list:n=[],ancestors:r=[],item:a,onListChange:i,className:o}=e,{designable:s,selectedItem:u,setSelectedItem:p,forceUpdate:m}=(0,c.useContext)(f),x=(0,c.useRef)(null),[h,g]=(0,c.useState)(!1),[v,j]=(0,c.useState)(0),[b,y]=(0,c.useState)(!1),[w,C]=(0,c.useState)(!1),S=(0,c.useRef)(n),I=(0,c.useRef)(i);(0,c.useEffect)(()=>{S.current=n,I.current=i},[n,i]);let k=(0,c.useMemo)(()=>n||[],[n]);(0,c.useEffect)(()=>{let e=x.current;if(!e)return;let t=eo({element:e,canDrop:e=>{let{source:t,element:l}=e;if(!s)return!1;let{data:n}=t.data||{};return(!l.classList.contains("ant-row")||(null==n?void 0:n.type)==="b-col")&&(!!l.classList.contains("ant-row")||(null==n?void 0:n.type)!=="b-col")},getData:()=>({localList:S.current}),onDragEnter:t=>{if(!s)return!1;let[l]=t.location.current.dropTargets;if((null==l?void 0:l.element)!==e)return;g(!0),C(!0);let n=t.location.current.input.clientY,{indicatorOffset:r,isHorizontal:a}=ey(e,t.location.current.input.clientX,n,S.current||[]);j(r),y(a)},onDrag:t=>{if(!s)return!1;let[l]=t.location.current.dropTargets;if((null==l?void 0:l.element)!==e){g(!1),C(!1);return}g(!0),C(!0);let n=t.location.current.input.clientY,{indicatorOffset:r,isHorizontal:a}=ey(e,t.location.current.input.clientX,n,S.current||[]);j(r),y(a)},onDragLeave:()=>{if(!s)return!1;g(!1),C(!1)},onDrop(t){if(!s)return!1;let[l]=t.location.current.dropTargets;if((null==l?void 0:l.element)!==e)return;g(!1),C(!1);let{data:n,list:r,onListChange:a,index:i}=t.source.data;null==p||p(n);let o=S.current||[],d=I.current,c=r===o||o.some(e=>e.id===n.id),u=t.location.current.input.clientY,{index:m}=ey(e,t.location.current.input.clientX,u,o);if(r)if(c){let e=[...o],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=[...o];e.some(e=>e.id===n.id)||(e.splice(m,0,n),null==d||d(e))}else{let e=[...o];e.splice(m,0,n),null==d||d(e)}}});return()=>t()},[]);let z=[o,"drag-container","page-item-component",!n.length?"empty-container":"",u===a?"selected":"",s?"designable":""].filter(Boolean).join(" ");return(0,d.jsxs)(t,{...l||{},ref:x,className:z,style:{...null==l?void 0:l.style,position:"relative",minHeight:s?24:void 0,outline:h?"1px dashed #1890ff":void 0},children:[s&&(0,d.jsx)(eb,{className:"drop-indicator",$offset:v,$vertical:b,$visible:w}),(Array.isArray(k)?k:[]).filter(Boolean).map((e,t)=>(0,d.jsx)(ej,{item:e,ancestors:r,parentList:k,onListChange:i,index:t,onDelete:()=>null==i?void 0:i(k.filter(t=>t.id!==e.id))},e.id||t))]})},eC=ew,eS=h().div`
|
|
45
86
|
.empty-container.designable {
|
|
46
87
|
min-width: 10px;
|
|
47
88
|
min-height: 30px;
|
|
@@ -66,16 +107,15 @@
|
|
|
66
107
|
.page-item-component.designable:hover {
|
|
67
108
|
outline: 1px dashed #1890ff;
|
|
68
109
|
cursor: move;
|
|
69
|
-
|
|
70
|
-
.page-item-component.designable.ant-row {
|
|
71
|
-
padding: 6px;
|
|
110
|
+
z-index: 2;
|
|
72
111
|
}
|
|
73
112
|
.page-item-component.designable.selected {
|
|
74
113
|
position: relative;
|
|
75
114
|
outline: 1px solid #1890ff;
|
|
115
|
+
z-index: 2;
|
|
76
116
|
}
|
|
77
117
|
}
|
|
78
|
-
`,
|
|
118
|
+
`,eI=m().forwardRef((e,t)=>{let{device:l="desktop"}=e,{schema:n,forceUpdate:r,setDeviceWidth:a}=(0,c.useContext)(f),i=(0,c.useRef)(null),o=(0,c.useMemo)(()=>n.items||[],[n.items]),[s,u]=(0,c.useState)(o);(0,c.useEffect)(()=>{u(n.items||[])},[n.items]);let p=()=>{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(p,10):a(n?n-36:0)};return(0,c.useEffect)(()=>{p()},[l]),(0,c.useEffect)(()=>{let e=()=>p();return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),(0,c.useImperativeHandle)(t,()=>({handleResize(){p()},get dom(){return i.current}})),(0,d.jsx)(eS,{ref:i,children:(0,d.jsx)(ew,{ancestors:[],list:s,onListChange:e=>{let t=[...e];n.items=t,u(t),null==r||r()},className:"page-canvas"})})}),ek=eI;var ez=u(315);let eO=()=>(0,ez.v4)(),eN=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}`},eT=h().div`
|
|
79
119
|
max-height: 400px;
|
|
80
120
|
overflow: auto;
|
|
81
121
|
background: #fff;
|
|
@@ -104,7 +144,7 @@
|
|
|
104
144
|
text-overflow: ellipsis;
|
|
105
145
|
white-space: nowrap;
|
|
106
146
|
}
|
|
107
|
-
`,
|
|
147
|
+
`,eR=h().div`
|
|
108
148
|
.chat-input {
|
|
109
149
|
display: flex;
|
|
110
150
|
flex-direction: column;
|
|
@@ -320,7 +360,7 @@
|
|
|
320
360
|
.send-btn.send-btn-active {
|
|
321
361
|
background-color: var(--ant-color-primary);
|
|
322
362
|
}
|
|
323
|
-
`,
|
|
363
|
+
`,eF=[],eD=[],eE=["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","audio/wav"],eA=[".xlsx",".wav"],eB=e=>{let{open:t,onCancel:l,onOk:n,allowedExtensions:r,allowedMimeTypes:a}=e,[i,o]=(0,c.useState)([]);(0,c.useEffect)(()=>{t&&o([])},[t]);let s=[...eA,...eE].join(",");return(0,d.jsxs)(ep.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)(ep.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)(ep.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):(ep.message.error(`不支持的文件类型: ${e.name}`),ep.Upload.LIST_IGNORE)}},children:[(0,d.jsx)("p",{className:"ant-upload-drag-icon",children:(0,d.jsx)(ed.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)(ep.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)(ed.FileExcelOutlined,{style:{color:"#52c41a"}}):(0,d.jsx)(ed.AudioOutlined,{style:{color:"#1890ff"}}),(0,d.jsx)(ep.Typography.Text,{ellipsis:!0,style:{maxWidth:300},children:e.name}),(0,d.jsxs)(ep.Typography.Text,{type:"secondary",style:{fontSize:12},children:["(",(e.size/1024).toFixed(1)," KB)"]})]}),(0,d.jsx)(ep.Button,{type:"text",size:"small",icon:(0,d.jsx)(ed.DeleteOutlined,{}),onClick:()=>{o(e=>e.filter((e,l)=>l!==t))},danger:!0})]},`${e.name}-${t}`))})]})]})},eM=m().forwardRef((e,t)=>{let{value:l="",placeholder:n="请输入需求,例如:分析 2025 年人口结构并生成可视化报告",disabled:r=!1,sending:a=!1,rows:i=6,agentList:o=eF,agentId:s=null,attachments:u=eD,atItems:p=null,onInput:m,onSubmit:x,onUpdateAgentId:h,onUpdateAttachments:f,onUploading:g,onRemoveAtItem:v,style:j={}}=e,b=(0,c.useRef)(null),[y,w]=(0,c.useState)([]),[C,S]=(0,c.useState)(l||""),[I,k]=(0,c.useState)(0),[z,O]=(0,c.useState)(Array.isArray(u)?u:[]),[N,T]=(0,c.useState)(!1),R=(0,c.useMemo)(()=>!1,[]);(0,c.useImperativeHandle)(t,()=>({focus(){var e;null==(e=b.current)||e.focus()}})),(0,c.useEffect)(()=>S(l||""),[l]),(0,c.useEffect)(()=>{m&&m(C)},[C]),(0,c.useEffect)(()=>O(Array.isArray(u)?u:[]),[u]);let F=!!(C&&C.trim()),D=async e=>{if(T(!1),!g||!e.length)return;let t=[];for(let l of e)try{let e=await g(l);e&&t.push({id:e.id,name:l.name,size:l.size})}catch(e){console.error(e)}O([...z,...t]),f&&f([...z,...t])},E=()=>{if(!F||a)return;let e=Date.now();if(e-I<400)return;k(e);let t=(C||"").trim();if(!t)return;let l={message:t,agents:y.map(e=>({id:e.id,name:e.name})),files:z.map(e=>({id:e.id,name:e.name,extension:e.name.substring(e.name.lastIndexOf("."))}))};x&&x(l),S(""),O([])},A=(0,d.jsx)(eT,{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(h&&h(t),w(t=>[...t,e]))},children:e.name})},String(e.id)))})});return(0,d.jsx)(eR,{style:j,children:(0,d.jsxs)("div",{className:"chat-input",children:[(0,d.jsxs)("div",{className:"input-stack",children:[z.length>0&&(0,d.jsx)("div",{className:"attachment-bar beautified_scrollbar",children:z.map(e=>(0,d.jsxs)("div",{className:"attachment-card",children:[e.name.endsWith(".xlsx")?(0,d.jsx)(eu,{type:"icon-excel"}):(0,d.jsx)(eu,{type:"icon-audio"}),(0,d.jsx)(ep.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(O(l=z.filter(e=>e.id!==t)),f&&f(l))},children:(0,d.jsx)(ed.DeleteOutlined,{})})]},e.id))}),y.length>0&&(0,d.jsx)("div",{className:"agent-info",children:y.map((e,t)=>(0,d.jsxs)("div",{children:[(0,d.jsxs)("span",{className:"name",children:[(0,d.jsx)(eu,{type:"icon-at"}),e.name]}),(0,d.jsx)("a",{className:"remove",onClick:()=>{h&&h(null),w(e=>e.filter((e,l)=>l!==t))},children:"\xd7"})]},String(e.id)))}),!!(null==p?void 0:p.length)&&(0,d.jsx)("div",{className:"agent-info",children:p.map((e,t)=>(0,d.jsxs)("div",{children:[(0,d.jsxs)("span",{className:"name",children:[(0,d.jsx)(eu,{type:"icon-number"}),e.name||e.id]}),(0,d.jsx)("a",{className:"remove",onClick:()=>null==v?void 0:v(e,t),children:"\xd7"})]},String(e.id)))}),(0,d.jsx)(ep.Input.TextArea,{ref:b,className:"input textarea-stacked",placeholder:n,disabled:r||a,autoSize:{minRows:i,maxRows:i},value:C,onPressEnter:e=>{"Enter"===e.key&&(e.shiftKey||(e.preventDefault(),E()))},onChange:e=>S(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)(ep.Dropdown,{trigger:["click"],popupRender:()=>A,placement:"topLeft",styles:{root:{boxShadow:"var(--ant-box-shadow-card)"}},children:(0,d.jsx)(ep.Tooltip,{title:"选择助理",children:(0,d.jsx)(ep.Button,{className:"agent-trigger",onClick:e=>e.preventDefault(),children:(0,d.jsx)(eu,{type:"icon-at"})})})}),g&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(ep.Tooltip,{title:"上传文件",children:(0,d.jsx)(ep.Button,{className:"attach-upload",onClick:()=>T(!0),disabled:r||a,children:(0,d.jsx)(eu,{type:"icon-paper-clip"})})}),(0,d.jsx)(eB,{open:N,onCancel:()=>T(!1),onOk:D,allowedExtensions:eA,allowedMimeTypes:eE})]})]}),(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6},children:[!R&&(0,d.jsx)("div",{className:"tips",children:"按 Enter 发送,Shift+Enter 换行"}),(0,d.jsx)("a",{className:`send-btn ${!a&&(null==C?void 0:C.length)>0?"send-btn-active":""}`,onClick:E,children:(0,d.jsx)(ed.SendOutlined,{})})]})]})]})})}),eP=h().div`
|
|
324
364
|
width: 100%;
|
|
325
365
|
padding: 0 12px;
|
|
326
366
|
border-bottom: solid 1px #e8e8e8;
|
|
@@ -336,7 +376,7 @@
|
|
|
336
376
|
.extra {
|
|
337
377
|
line-height: 32px;
|
|
338
378
|
}
|
|
339
|
-
`,
|
|
379
|
+
`,eL=e=>{let{title:t="",extra:l,style:n={}}=e;return(0,d.jsxs)(eP,{className:"pane-header",style:n,children:[(0,d.jsx)("span",{className:"title",children:t}),(0,d.jsx)("div",{className:"extra",children:l})]})},e$=h().div`
|
|
340
380
|
display: flex;
|
|
341
381
|
flex-direction: column;
|
|
342
382
|
height: 100%;
|
|
@@ -377,7 +417,7 @@
|
|
|
377
417
|
.conversation-list li small {
|
|
378
418
|
white-space: nowrap;
|
|
379
419
|
}
|
|
380
|
-
`,
|
|
420
|
+
`,eY=[],e_="bi-design",eq=e=>{let t,l,n,r,a,i,o,{agentList:s=eY,headExtra:u,style:p={},onEffect:x}=e,{pageId:h,schema:g,fetch:v,atItems:j,onRemoveAtItem:b}=(0,c.useContext)(f);if(!v)return null;let[y,w]=(0,c.useState)(null),[C,S]=(0,c.useState)([]),[I,k]=(0,c.useState)([]),z=m().useRef(null),O=()=>{setTimeout(()=>{z.current&&z.current.scrollToBottom()},100)},N=()=>{w(null),k([])},T=async e=>{ep.Modal.confirm({title:"确认删除该对话吗?",okText:"确认",cancelText:"取消",onOk:async()=>{var t;await (null==(t=v.ai)?void 0:t.removeConversation(e_,h,e)),S(t=>t.filter(t=>t.id!==e)),k(t=>t.filter(t=>t.conversationId!==e)),y===e&&N()}})},R=async e=>{var t;w(e),S(t=>t.map(t=>({...t,isActived:t.id===e}))),k(await (null==(t=v.ai)?void 0:t.messageList(e_,h,e))||[]),O()},F=async e=>{var t;let l={id:eO(),question:e.message,createdAt:new Date().toISOString(),files:e.files||[],agents:e.agents||[],atItems:j,sending:!0};k(e=>[...e,l]),O();let n=!y,{id:r,answer:a,createdAt:i,conversation:o}=await (null==(t=v.ai)?void 0:t.chat(e_,h,y,{...e,page:JSON.stringify(g),pageItems:JSON.stringify(j||[])}));w((null==o?void 0:o.id)||""),S(e=>[n?o||{}:null,...e].filter(e=>null!==e)),Object.assign(l,{id:r,answer:a,createdAt:i,conversationId:(null==o?void 0:o.id)||"",sending:!1}),a.effect&&(null==x||x(a.effect)),k(e=>[...e]),O()},D=async e=>{var t;await (null==(t=v.ai)?void 0:t.removeMessage(e_,h,e)),k(t=>t.filter(t=>t.id!==e))},E=(t=new Date,l=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),(n=new Date(t)).setDate(t.getDate()-1),r=[],a=[],i=[],o=[],C.forEach(e=>{let s=new Date(e.createdAt);if(l(s,t))r.push(e);else if(l(s,n))a.push(e);else s.getFullYear()===t.getFullYear()&&s.getMonth()===t.getMonth()?i.push(e):o.push(e)}),[{title:"今天",items:r},{title:"昨天",items:a},{title:"本月内",items:i},{title:"很久以前",items:o}].filter(e=>e.items.length>0)),A=async()=>{try{var e,t;let l=await (null==(e=v.ai)?void 0:e.conversationList(e_,h));S(l||[]);let n=null==l?void 0:l.find(e=>e.isActived);if(n){w(n.id);let e=await (null==(t=v.ai)?void 0:t.messageList(e_,h,n.id));k(e||[]),O()}}catch(e){console.error(e)}};return(0,c.useEffect)(()=>{A()},[v]),(0,c.useEffect)(()=>{O()},[]),(0,d.jsxs)(e$,{style:p,children:[(0,d.jsx)(eL,{title:"智能助理",extra:(0,d.jsxs)(ep.Space,{children:[(0,d.jsx)(ep.Tooltip,{title:"新对话",placement:"topRight",children:(0,d.jsx)("a",{onClick:N,children:(0,d.jsx)(eu,{type:"icon-chat-plus"})})}),(0,d.jsx)(ep.Dropdown,{trigger:["click"],styles:{root:{boxShadow:"var(--ant-box-shadow-drawer-up)",backgroundColor:"#ffffff",borderRadius:"var(--ant-border-radius)"}},popupRender:()=>(0,d.jsx)(eU,{children:E.map(e=>(0,d.jsxs)("div",{className:"group",children:[(0,d.jsx)("div",{className:"group-title",children:e.title}),(0,d.jsx)("ul",{className:"group-list",children:e.items.map(e=>(0,d.jsxs)("li",{className:e.isActived?"actived":"",children:[(0,d.jsx)("a",{onClick:()=>R(e.id),children:e.name}),(0,d.jsx)("small",{children:(0,d.jsx)("a",{onClick:()=>T(e.id),children:(0,d.jsx)(ed.DeleteOutlined,{})})})]},e.id))})]},e.title))}),placement:"topRight",children:(0,d.jsx)("a",{children:(0,d.jsx)(ed.HistoryOutlined,{})})}),u]}),style:{width:"initial"}}),(0,d.jsxs)("div",{className:"body",children:[(0,d.jsx)("div",{style:{flex:"1 1 auto",overflowY:"auto"},children:I.length?(0,d.jsx)(eK,{ref:z,list:I,onDeleteMessage:D}):(0,d.jsx)(eG,{})}),0===I.length&&C.length>0&&(0,d.jsx)(ep.Card,{title:"历史记录",size:"small",variant:"borderless",styles:{header:{padding:0,border:"none"},body:{padding:0}},style:{padding:"12px 12px 0 12px"},children:(0,d.jsx)("ul",{className:"conversation-list",children:C.slice(0,3).map(e=>(0,d.jsxs)("li",{children:[(0,d.jsxs)("a",{children:[(0,d.jsx)(ed.MessageOutlined,{}),e.name]}),(0,d.jsx)("small",{children:eN(e.createdAt)})]},e.id))})}),(0,d.jsx)(eM,{agentList:s,style:{padding:12},atItems:j,onUploading:null==v?void 0:v.upload,onSubmit:F,onRemoveAtItem:b})]})]})},eH=h().div`
|
|
381
421
|
flex: 1 1 auto;
|
|
382
422
|
display: flex;
|
|
383
423
|
align-items: center;
|
|
@@ -415,7 +455,7 @@
|
|
|
415
455
|
font-size: 14px;
|
|
416
456
|
color: var(--ant-color-text-secondary);
|
|
417
457
|
}
|
|
418
|
-
`,
|
|
458
|
+
`,eG=()=>(0,d.jsx)(eH,{children:(0,d.jsxs)("div",{className:"content",children:[(0,d.jsx)("div",{className:"logo",children:(0,d.jsx)(eu,{type:"icon-ai-compute",style:{fontSize:60}})}),(0,d.jsx)("div",{className:"title",children:"与 智能助理 协作"}),(0,d.jsx)("div",{className:"desc",children:"自动化执行常规开发任务,端到端高效完成,提高交付效率"})]})}),eU=h().div`
|
|
419
459
|
width: 260px;
|
|
420
460
|
padding: 8px;
|
|
421
461
|
.group {
|
|
@@ -460,7 +500,7 @@
|
|
|
460
500
|
.group-list li small a {
|
|
461
501
|
color: var(--ant-color-error);
|
|
462
502
|
}
|
|
463
|
-
`,
|
|
503
|
+
`,eJ=h().div`
|
|
464
504
|
height: 100%;
|
|
465
505
|
display: flex;
|
|
466
506
|
flex-direction: column;
|
|
@@ -483,13 +523,19 @@
|
|
|
483
523
|
|
|
484
524
|
.msg-tools {
|
|
485
525
|
position: absolute;
|
|
486
|
-
|
|
487
|
-
|
|
526
|
+
right: 0;
|
|
527
|
+
bottom: -20px;
|
|
488
528
|
display: none;
|
|
489
529
|
}
|
|
490
530
|
|
|
491
531
|
&:hover .msg-tools {
|
|
492
532
|
display: flex;
|
|
533
|
+
flex-direction: row;
|
|
534
|
+
align-items: center;
|
|
535
|
+
|
|
536
|
+
.anticon {
|
|
537
|
+
color: var(--ant-color-text-tertiary);
|
|
538
|
+
}
|
|
493
539
|
}
|
|
494
540
|
|
|
495
541
|
.msg-header {
|
|
@@ -586,7 +632,7 @@
|
|
|
586
632
|
}
|
|
587
633
|
}
|
|
588
634
|
}
|
|
589
|
-
`,
|
|
635
|
+
`,eK=(0,c.forwardRef)((e,t)=>{let{list:l,onDeleteMessage:n}=e,r=(0,c.useRef)(null),a=()=>{setTimeout(()=>{r.current&&(r.current.scrollTop=r.current.scrollHeight)},100)};return(0,c.useImperativeHandle)(t,()=>({scrollToBottom:a})),(0,d.jsx)(eJ,{className:"message-list beautified_scrollbar",ref:r,children:l.map(e=>{var t,l,r,a,i,o,s,c,u,p;return(0,d.jsxs)("div",{className:"msg",children:[(0,d.jsxs)("div",{className:"user-message",children:[(0,d.jsx)("div",{className:"msg-header",children:(0,d.jsx)("span",{children:eN(e.createdAt)})}),(0,d.jsxs)("div",{className:"msg-section",children:[(0,d.jsxs)(ep.Space,{size:4,orientation:"vertical",className:"msg-tools",children:[(0,d.jsx)(ep.Typography.Text,{copyable:{text:e.question,tooltips:"复制"}}),(0,d.jsx)(ep.Popconfirm,{title:"确认删除吗?",okText:"确认",cancelText:"取消",onConfirm:()=>n(e.id),children:(0,d.jsx)(ep.Tooltip,{title:"删除",children:(0,d.jsx)(ep.Button,{type:"link",size:"small",icon:(0,d.jsx)(ed.DeleteOutlined,{})})})})]}),(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)||(null==(r=e.atItems)?void 0:r.length)?(0,d.jsxs)("div",{className:"msg-meta",children:[null==(a=e.files)?void 0:a.map(e=>(0,d.jsxs)(ep.Tag,{color:"processing",children:[(0,d.jsx)(eu,{type:"icon-paper-clip"})," ",e.name]},e.id)),null==(i=e.agents)?void 0:i.map(e=>(0,d.jsxs)(ep.Tag,{color:"blue",children:[(0,d.jsx)(eu,{type:"icon-at"})," ",e.name]},e.id)),JSON.parse(e.atItems||"[]").map(e=>(0,d.jsxs)(ep.Tag,{color:"blue",children:[(0,d.jsx)(eu,{type:"icon-number"})," ",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)(ed.RobotOutlined,{})," 智能助理"]})}),(0,d.jsx)("div",{className:"msg-section",children:e.sending?(0,d.jsx)(ep.Skeleton,{active:!0}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"msg-content",children:(null==(o=e.answer)?void 0:o.answer)||""}),!!(null==(c=e.answer)||null==(s=c.plans)?void 0:s.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)(ep.Tooltip,{title:e.description,children:(0,d.jsx)(ep.Tag,{color:"blue",children:e.name})},t))})]}),!!(null==(p=e.answer)||null==(u=p.extra)?void 0:u.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)(ep.Tag,{color:"gold",children:e.element}),(0,d.jsx)("span",{children:e.action})]},t))})]})]})})]})]},e.id)})})}),eW=h().div`
|
|
590
636
|
display: flex;
|
|
591
637
|
flex-direction: column;
|
|
592
638
|
height: 100%;
|
|
@@ -625,7 +671,7 @@
|
|
|
625
671
|
font-size: 16px;
|
|
626
672
|
color: var(--ant-color-text-secondary);
|
|
627
673
|
}
|
|
628
|
-
`,
|
|
674
|
+
`,eX=e=>{let{}=e,{schema:t,selectedItem:l,setSelectedItem:n,plugins:r,forceUpdate:a}=(0,c.useContext)(f),i=(0,c.useMemo)(()=>(r||[]).reduce((e,t)=>(e[t.key]=t,e),{}),[r]),o=(0,c.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,c.useMemo)(()=>o.reduce((e,t)=>(t.id&&(e[t.id]=t),e),{}),[o]),u=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)(ep.Space,{children:(0,d.jsx)(ep.Dropdown,{menu:{onClick:e=>{let{key:t}=e,n=[...(null==l?void 0:l.cascadeIds)||[]];n.push(String(t)),u&&u(n)},items:o.map(e=>{var t,l;return{key:e.id,label:(0,d.jsxs)("a",{children:[(0,d.jsx)(eu,{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)(ed.PlusOutlined,{}),(0,d.jsx)(ed.CaretDownOutlined,{style:{fontSize:8,verticalAlign:"sub"}})]})})}):null}),(0,d.jsx)("div",{className:"body beautified_scrollbar",children:(null==l?void 0:l.cascadeIds)&&(0,d.jsx)("ul",{children:(l.cascadeIds||[]).map((e,t)=>{var n,r,a,o,c;return(0,d.jsxs)("li",{children:[(0,d.jsxs)("div",{children:[(0,d.jsx)(eu,{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==(c=s[e])?void 0:c.type])?void 0:o.label)," (",e,")"]}),(0,d.jsx)(ep.Popconfirm,{title:"确认删除吗?",okText:"确认",cancelText:"取消",onConfirm:()=>{let e=[...l.cascadeIds||[]];e.splice(t,1),u&&u(e)},children:(0,d.jsx)("a",{children:(0,d.jsx)(ed.DeleteOutlined,{})})})]},e)})})})]})};var eV=u(965),eQ=u.n(eV);let eZ=()=>{let{schema:e}=(0,c.useContext)(f),t=(0,c.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)(ep.Space,{children:(0,d.jsx)(ep.Tooltip,{title:"复制到剪切板",children:(0,d.jsx)("a",{className:"toolbar",onClick:()=>{eQ()(t||"")&&ep.message.success("复制成功")},children:(0,d.jsx)(ed.CopyOutlined,{})})})})}),(0,d.jsx)("div",{className:"body",style:{flex:"1 1 auto",display:"flex"},children:(0,d.jsx)(ef(),{height:"100%",defaultLanguage:"json",value:t,options:{lineNumbers:"off",readOnly:!0,minimap:{enabled:!1}}})})]})},e0=h().div`
|
|
629
675
|
display: flex;
|
|
630
676
|
flex-direction: column;
|
|
631
677
|
height: 100%;
|
|
@@ -667,7 +713,7 @@
|
|
|
667
713
|
overflow: hidden;
|
|
668
714
|
font-size: 12px;
|
|
669
715
|
}
|
|
670
|
-
`,
|
|
716
|
+
`,e1=e=>{let{plugin:t}=e,l=(0,c.useRef)(null);return(0,c.useEffect)(()=>{let e=l.current;if(!e)return;let n=es({element:e,getInitialData:()=>{let e={id:eO(),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)(eu,{className:"icon",type:t.icon}),(0,d.jsx)("div",{className:"label",children:t.label})]})},e2=()=>{let{plugins:e}=(0,c.useContext)(f),t=(0,c.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)(e0,{className:"component-panel",children:[(0,d.jsx)(eL,{title:"组件库"}),(0,d.jsx)("div",{className:"body beautified_scrollbar",children:t.map(e=>(0,d.jsxs)("div",{className:"plugin-group",children:[(0,d.jsx)("div",{className:"group-title",children:e.group}),(0,d.jsx)("div",{className:"plugin-list",children:e.items.map(e=>(0,d.jsx)(e1,{plugin:e},e.key))})]},e.group))})]})},e4=h().div`
|
|
671
717
|
display: flex;
|
|
672
718
|
flex-direction: column;
|
|
673
719
|
height: 100%;
|
|
@@ -704,7 +750,7 @@
|
|
|
704
750
|
.margin-bottom-0 {
|
|
705
751
|
margin-bottom: 0;
|
|
706
752
|
}
|
|
707
|
-
`,
|
|
753
|
+
`,e8=()=>{let{schema:e,setSchema:t}=(0,c.useContext)(f),[l,n]=(0,c.useState)(!1),[r,a]=(0,c.useState)(!1),[i,o]=(0,c.useState)(-1),[s,u]=(0,c.useState)({id:eO(),type:"api",name:"",url:"",method:"GET",headers:[],formData:[],body:""}),[p,m]=(0,c.useState)({id:eO(),type:"sql",name:"",query:""}),x=(0,c.useMemo)(()=>e.datasources,[e.datasources]),h=l=>{t({...e,datasources:l})},g=[{title:"键",dataIndex:"name",render:(e,t,l)=>(0,d.jsx)(ep.Input,{size:"small",value:t.name,onChange:e=>{let t=[...s.headers];t[l]={...t[l],name:e.target.value},u({...s,headers:t})}})},{title:"值",dataIndex:"value",render:(e,t,l)=>(0,d.jsx)(ep.Input,{size:"small",value:t.value,onChange:e=>{let t=[...s.headers];t[l]={...t[l],value:e.target.value},u({...s,headers:t})}})},{title:"操作",width:50,align:"center",render:(e,t,l)=>(0,d.jsx)(ep.Space,{children:(0,d.jsx)("a",{onClick:()=>{let e=[...s.headers];e.splice(l,1),u({...s,headers:e})},children:(0,d.jsx)(ed.DeleteOutlined,{})})})}];return(0,d.jsxs)(e4,{className:"datasource-panel",children:[(0,d.jsx)(eL,{title:"数据源",extra:(0,d.jsx)(ep.Space,{children:(0,d.jsx)(ep.Dropdown,{menu:{onClick:e=>{let{key:t}=e;"api"===t?(o(-1),u({id:eO(),type:"api",name:"",url:"",method:"GET",headers:[],formData:[],body:""}),n(!0)):(o(-1),m({id:eO(),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)(ed.PlusOutlined,{}),(0,d.jsx)(ed.CaretDownOutlined,{style:{fontSize:8,verticalAlign:"sub"}})]})})})}),(0,d.jsx)("div",{className:"body beautified_scrollbar",children:(0,d.jsx)("ul",{children:x.map((e,t)=>(0,d.jsxs)("li",{children:[(0,d.jsxs)("div",{title:e.name,children:[(0,d.jsx)(eu,{type:"icon-drag"})," ",e.name]}),(0,d.jsxs)(ep.Space,{children:[(0,d.jsx)("a",{onClick:()=>{o(t),"api"===e.type?(u({...e}),n(!0)):(m({...e}),a(!0))},children:(0,d.jsx)(ed.EditOutlined,{})}),(0,d.jsx)(ep.Popconfirm,{title:"确认删除吗?",okText:"确认",cancelText:"取消",onConfirm:()=>{let e;(e=[...x]).splice(t,1),h&&h(e)},children:(0,d.jsx)("a",{children:(0,d.jsx)(ed.DeleteOutlined,{})})})]})]},e.id))})}),(0,d.jsx)(ep.Modal,{title:"添加API接口",open:l,width:600,styles:{body:{maxHeight:"calc(100vh - 250px)",overflow:"auto"}},onCancel:()=>n(!1),footer:(0,d.jsxs)(ep.Space,{children:[(0,d.jsx)(ep.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)(ep.Button,{onClick:()=>n(!1),children:"取消"})]}),children:(0,d.jsxs)(ep.Form,{labelCol:{span:24},wrapperCol:{span:24},children:[(0,d.jsx)(ep.Form.Item,{label:"接口名称",required:!0,children:(0,d.jsx)(ep.Input,{value:s.name,onChange:e=>u({...s,name:e.target.value})})}),(0,d.jsx)(ep.Form.Item,{label:"接口URL",required:!0,children:(0,d.jsx)(ep.Input,{value:s.url,onChange:e=>u({...s,url:e.target.value})})}),(0,d.jsx)(ep.Form.Item,{label:"请求方法",children:(0,d.jsxs)(ep.Radio.Group,{value:s.method,onChange:e=>u({...s,method:e.target.value}),children:[(0,d.jsx)(ep.Radio.Button,{value:"GET",children:"GET"}),(0,d.jsx)(ep.Radio.Button,{value:"POST",children:"POST"}),(0,d.jsx)(ep.Radio.Button,{value:"PUT",children:"PUT"}),(0,d.jsx)(ep.Radio.Button,{value:"DELETE",children:"DELETE"})]})}),(0,d.jsx)("label",{style:{display:"block",color:"#000000d9",padding:"8px 0"},children:"请求头"}),(0,d.jsx)(ep.Table,{columns:g,dataSource:s.headers,pagination:!1,locale:{emptyText:"暂无数据"},size:"small",bordered:!0,rowKey:(e,t)=>String(t)}),(0,d.jsx)(ep.Button,{size:"small",block:!0,onClick:()=>u({...s,headers:[...s.headers,{name:"",value:""}]}),children:"添加"}),(0,d.jsx)("label",{style:{display:"block",color:"#000000d9",padding:"8px 0"},children:"表单数据"}),(0,d.jsx)(ep.Table,{columns:g,dataSource:s.formData,pagination:!1,locale:{emptyText:"暂无数据"},size:"small",bordered:!0,rowKey:(e,t)=>`f-${t}`}),(0,d.jsx)(ep.Button,{size:"small",block:!0,onClick:()=>u({...s,formData:[...s.formData,{name:"",value:""}]}),children:"添加"}),(0,d.jsx)(ep.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)(ef(),{height:"300px",defaultLanguage:"json",value:s.body,onChange:e=>u({...s,body:e||""}),options:{minimap:{enabled:!1},scrollBeyondLastLine:!1,tabSize:2}})})})]})}),(0,d.jsx)(ep.Modal,{title:"添加SQL查询",open:r,width:600,styles:{body:{maxHeight:"calc(100vh - 250px)",overflow:"auto"}},onCancel:()=>a(!1),footer:(0,d.jsxs)(ep.Space,{children:[(0,d.jsx)(ep.Button,{type:"primary",onClick:()=>{if(!p.name||!p.query)return;let e=[...x];-1===i?e.push(p):e[i]=p,h&&h(e),a(!1)},children:"确定"}),(0,d.jsx)(ep.Button,{onClick:()=>a(!1),children:"取消"})]}),children:(0,d.jsxs)(ep.Form,{layout:"vertical",children:[(0,d.jsx)(ep.Form.Item,{label:"查询名称",required:!0,children:(0,d.jsx)(ep.Input,{value:p.name,onChange:e=>m({...p,name:e.target.value})})}),(0,d.jsx)(ep.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)(ef(),{height:"300px",defaultLanguage:"sql",value:p.query,onChange:e=>m({...p,query:e||""}),options:{minimap:{enabled:!1},scrollBeyondLastLine:!1,tabSize:2}})})})]})})]})},e5=h().div`
|
|
708
754
|
display: flex;
|
|
709
755
|
flex-direction: column;
|
|
710
756
|
height: 100%;
|
|
@@ -716,7 +762,7 @@
|
|
|
716
762
|
padding: 12px;
|
|
717
763
|
overflow: auto;
|
|
718
764
|
}
|
|
719
|
-
`,
|
|
765
|
+
`,e6=h()(ep.Tree)`
|
|
720
766
|
.ant-tree-draggable-icon {
|
|
721
767
|
display: none;
|
|
722
768
|
}
|
|
@@ -726,7 +772,7 @@
|
|
|
726
772
|
overflow: hidden;
|
|
727
773
|
text-overflow: ellipsis;
|
|
728
774
|
}
|
|
729
|
-
`,
|
|
775
|
+
`,e9=()=>{let{schema:e,setSchema:t,selectedItem:l,setSelectedItem:n,plugins:r}=(0,c.useContext)(f),[a,i]=(0,c.useState)([]),o=(0,c.useMemo)(()=>l?[l.id]:[],[l]),s=(0,c.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:eO(),type:"slot",title:"插槽-"+e,slot:e,origin:a,children:t(a[e])})})),{key:n,title:e.name,item:e,type:r,children:l}})};return t(e.items)},[e]),u=(0,c.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)(d.Fragment,{children:(null==t?void 0:t.title)||(l=t.type,n=t.slot,"slot"===l?"插槽-"+n:(null==(a=r.find(e=>e.key===l))?void 0:a.label)||l)}),children:t.children?e(t.children):void 0,dataRef:t}})};return e(s)},[s]);return(0,d.jsxs)(e5,{className:"layer-panel",children:[(0,d.jsx)(eL,{title:"图层",extra:(0,d.jsxs)(ep.Space,{children:[(0,d.jsx)(ep.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)(ed.PlusSquareOutlined,{})})}),(0,d.jsx)(ep.Tooltip,{title:"全部收起",children:(0,d.jsx)("a",{className:"toolbar",onClick:()=>i([]),children:(0,d.jsx)(ed.MinusSquareOutlined,{})})})]})}),(0,d.jsx)("div",{className:"body beautified_scrollbar",children:(0,d.jsx)(e6,{draggable:{icon:!1,nodeDraggable:e=>!1},showIcon:!1,showLine:{showLeafIcon:!1},treeData:u,selectedKeys:o,expandedKeys:a,onSelect:(e,t)=>{"slot"!==t.node.dataRef.type&&n&&n(t.node.dataRef.item)},onDrop:l=>{let n;if(!(e=>{let t=e.node,l=e.dragNode;if("slot"===l.dataRef.type||!e.dropToGap&&!["b-row","b-col","b-card","slot"].includes(t.dataRef.type))return!1;if("b-col"===l.dataRef.type)if(!e.dropToGap)return"b-row"===t.dataRef.type;else return"b-col"===t.dataRef.type;return("b-col"!==t.dataRef.type||!e.dropToGap)&&("b-row"!==t.dataRef.type||!!e.dropToGap)||"b-col"===l.dataRef.type})(l))return;let r=l.node.key,a=l.dragNode.key,i=l.node.pos.split("-"),o=l.dropPosition-Number(i[i.length-1]),s=(e,t,l)=>{e.forEach((e,n,r)=>{if(e.id===t)return(e.children=e.children||[],"slot"===e.type)?l(e,n,r,e.children[e.slot]):l(e,n,r,e.children);if(Array.isArray(e.children))return s(e.children,t,l);if("object"==typeof e.children)for(let n in e.children)Array.isArray(e.children[n])&&s(e.children[n],t,l)})},d=e.items;if(s(d,a,(e,t,l)=>{l.splice(t,1),n=e}),l.dropToGap)if((l.node.children||[]).length>0&&l.node.expanded&&1===o)s(d,r,(e,t,l)=>{e.children=e.children||[],e.children.unshift(n)});else{let e=[],t=0;s(d,r,(l,n,r)=>{e=r,t=n}),-1===o?e.splice(t,0,n):e.splice(t+1,0,n)}else{if("slot"===l.node.dataRef.type){let{slot:e,origin:t}=l.node.dataRef;t[e]=t[e]||[],t[e].push(n)}s(d,r,e=>{e.children=e.children||[],e.children.push(n)})}t&&t({...e,items:d})},onExpand:e=>i(e)})})]})},e3=h().div`
|
|
730
776
|
display: flex;
|
|
731
777
|
flex-direction: column;
|
|
732
778
|
height: 100%;
|
|
@@ -756,7 +802,7 @@
|
|
|
756
802
|
margin: 0;
|
|
757
803
|
}
|
|
758
804
|
}
|
|
759
|
-
`,
|
|
805
|
+
`,e7=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},te=e=>{var t,l,n,r,a,i,o;let{datasourceEnable:s=!0}=e,{plugins:u,selectedItem:p,updateSelectedItem:x,schema:h,setSchema:g,datasetSelector:v,datasetAdd:j}=(0,c.useContext)(f),b=(0,c.useRef)(null),[y,w]=(0,c.useState)("1"),C=(0,c.useMemo)(()=>e7((null==h?void 0:h.items)||[]),[h]),S=(0,c.useMemo)(()=>p&&C.find(e=>e.id===p.id),[C,p]),I=S?y:"1",k=(0,c.useMemo)(()=>u.find(e=>e.key===(null==p?void 0:p.type)),[u,p]),z=null==k?void 0:k.formComponent,O=(null==p?void 0:p.props)||{},N=(null==p?void 0:p.style)||{},[T,R]=(0,c.useState)((null==h?void 0:h.info)||{}),[F,D]=(0,c.useState)((null==p?void 0:p.datasource)||{}),[E,A]=(0,c.useState)(!1),[B,M]=(0,c.useState)(!1),P=e=>{g({...h,info:e})},L={Authorization:`Bearer ${localStorage.getItem("ASKDATA_TOKEN")||""}`};return m().useEffect(()=>{w(p?"2":"1"),D((null==p?void 0:p.datasource)||{})},[p]),(0,d.jsxs)(e3,{className:"properties-panel",children:[(0,d.jsx)(eL,{title:"属性",extra:(0,d.jsxs)(ep.Radio.Group,{value:I,size:"small",buttonStyle:"outline",onChange:e=>w(e.target.value),children:[(0,d.jsx)(ep.Radio.Button,{value:"1",children:"页面"}),S&&(0,d.jsx)(ep.Radio.Button,{value:"2",children:"组件"})]})}),(0,d.jsxs)("div",{className:"body beautified_scrollbar always",children:["1"===I&&(0,d.jsxs)(ep.Form,{labelCol:{span:24},wrapperCol:{span:24},className:"ant-form-compact",children:[(0,d.jsx)(ep.Form.Item,{label:"页面名称",children:(0,d.jsx)(ep.Input,{size:"small",value:null==T?void 0:T.name,placeholder:"请输入页面名称",onChange:e=>{let t={...T,name:e.target.value};R(t),P&&P(t)}})}),(0,d.jsx)(ep.Form.Item,{label:"页面描述",children:(0,d.jsx)(ep.Input.TextArea,{size:"small",value:null==T?void 0:T.description,placeholder:"请输入页面描述",onChange:e=>{let t={...T,description:e.target.value};R(t),P&&P(t)}})}),(0,d.jsxs)(ep.Form.Item,{label:"封面",children:[(0,d.jsxs)(ep.Upload.Dragger,{name:"file",multiple:!1,accept:".png,.jpg,.jpeg",headers:L,action:"/api/datareport/upload",showUploadList:!1,beforeUpload:e=>e.type.startsWith("image/"),onChange:e=>{if("done"===e.file.status){var t;let l={url:null==(t=e.file.response)?void 0:t.data,name:e.file.name},n={...T,cover:l};R(n),P&&P(n)}},children:[(0,d.jsx)("p",{className:"ant-upload-drag-icon",children:(0,d.jsx)(ed.InboxOutlined,{})}),(0,d.jsx)("p",{className:"ant-upload-text",children:"点击或将文件拖拽到此区域进行上传"}),(0,d.jsx)("p",{className:"ant-upload-hint",children:"严禁上传公司数据或其他被禁止的文件。"})]}),(null==T||null==(t=T.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={...T,cover:null};R(e),P&&P(e)},children:(0,d.jsx)(ed.DeleteOutlined,{})})]}),(0,d.jsx)("img",{src:T.cover.url,style:{width:"100%",maxHeight:200}})]})]})]}),"2"===I&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(ep.Divider,{children:"基础属性"}),(0,d.jsxs)(ep.Form,{labelCol:{span:24},wrapperCol:{span:24},className:"ant-form-compact",children:[(0,d.jsx)(ep.Form.Item,{label:"组件标识",labelCol:{span:5},wrapperCol:{span:19},children:(null==p?void 0:p.id)||""}),(0,d.jsx)(ep.Form.Item,{label:"组件名称",children:(0,d.jsx)(ep.Input,{size:"small",value:null==p?void 0:p.name,onChange:e=>x&&x({...p,name:e.target.value})})}),(0,d.jsx)(ep.Form.Item,{label:"组件描述",children:(0,d.jsx)(ep.Input.TextArea,{size:"small",value:null==p?void 0:p.description,onChange:e=>x&&x({...p,description:e.target.value})})})]}),(null==p?void 0:p.datasource)&&(0,d.jsx)(ep.Divider,{children:"数据源"}),(null==p?void 0:p.datasource)&&(0,d.jsxs)(ep.Form,{className:"ant-form-compact",children:[(0,d.jsx)(ep.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)(ep.Radio.Group,{size:"small",value:null==F?void 0:F.source,onChange:e=>{let t={...F||{},source:e.target.value};D(t),x&&x({...p,datasource:t})},children:[!!v&&(0,d.jsx)(ep.Radio.Button,{value:"dataset",children:"数据集"}),s&&(0,d.jsx)(ep.Radio.Button,{value:"define",children:"数据源"}),(0,d.jsx)(ep.Radio.Button,{value:"custom",children:"自定义"})]})}),(null==F?void 0:F.source)==="dataset"&&v&&(0,d.jsx)(d.Fragment,{children:(0,d.jsx)(ep.Form.Item,{label:"数据集",labelCol:{span:5},wrapperCol:{span:19},children:(0,d.jsxs)(ep.Space.Compact,{children:[(0,d.jsx)(ep.Input,{size:"small",readOnly:!0,value:(null==F||null==(l=F.dataset)?void 0:l.name)||"",style:{width:90}}),!!(null==F||null==(r=F.dataset)||null==(n=r.id)?void 0:n.length)&&(null==F||null==(a=F.dataset)?void 0:a.output)&&(0,d.jsx)(ep.Popover,{title:"输出类型",placement:"left",content:(0,d.jsx)("div",{style:{padding:"0 12px",maxWidth:500,maxHeight:500,overflow:"auto"},children:(0,d.jsx)(tt,{output:F.dataset.output})}),children:(0,d.jsx)(ep.Button,{size:"small",style:{color:"var(--ant-color-text-tertiary)"},title:"查看输出类型",children:(0,d.jsx)(eu,{type:"icon-json"})})}),!!(null==F||null==(o=F.dataset)||null==(i=o.id)?void 0:i.length)&&(0,d.jsx)(ep.Button,{size:"small",icon:(0,d.jsx)(ed.CloseOutlined,{}),onClick:()=>{let e={...F||{},dataset:{id:"",name:"",output:{fields:[]}}};D(e),x&&x({...p,datasource:e})},title:"删除数据集",style:{color:"var(--ant-color-text-tertiary)"}}),j&&(0,d.jsx)(ep.Button,{size:"small",icon:(0,d.jsx)(ed.PlusOutlined,{}),title:"新建数据集",onClick:()=>M(!0)}),(0,d.jsx)(ep.Button,{size:"small",icon:(0,d.jsx)(ed.SelectOutlined,{}),title:"选择数据集",onClick:()=>A(!0)})]})})}),(null==F?void 0:F.source)==="define"&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(ep.Form.Item,{label:"数据源",layout:"vertical",children:(0,d.jsx)(ep.Select,{size:"small",value:null==F?void 0:F.datasourceId,onChange:e=>{let t={...F||{},datasourceId:e};D(t),x&&x({...p,datasource:t})},children:((null==h?void 0:h.datasources)||[]).map(e=>(0,d.jsx)(ep.Select.Option,{value:e.id,children:e.name},e.id))})}),(0,d.jsx)(ep.Form.Item,{label:"数据处理脚本",labelCol:{span:24},wrapperCol:{span:24},children:(0,d.jsx)(ep.Select,{size:"small",value:null==F?void 0:F.scriptId,onChange:e=>{let t={...F||{},scriptId:e};D(t),x&&x({...p,datasource:t})},children:((null==h?void 0:h.scripts)||[]).map(e=>(0,d.jsx)(ep.Select.Option,{value:e.id,children:e.name},e.id))})})]}),(null==F?void 0:F.source)==="custom"&&(0,d.jsx)(d.Fragment,{children:(0,d.jsx)(ep.Form.Item,{label:(0,d.jsxs)(d.Fragment,{children:["自定义",(0,d.jsxs)("a",{onClick:()=>{var e,t;let l=null==(e=b.current)?void 0:e.editor;null==l||null==(t=l.getAction("editor.action.formatDocument"))||t.run()},children:[(0,d.jsx)(eu,{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)(ef(),{height:"200px",onMount:e=>{b.current={editor:e}},defaultLanguage:"json",value:(null==F?void 0:F.custom)||"",onChange:e=>{let t={...F||{},custom:e||""};D(t),x&&x({...p,datasource:t})},options:{minimap:{enabled:!1},scrollBeyondLastLine:!1,tabSize:2}})})})})]}),z&&(0,d.jsx)(ep.Divider,{children:"特有属性"}),z&&(0,d.jsx)(z,{model:O,customStyle:N,onChange:e=>{p&&x&&x({...p,props:e})}})]})]}),!!v&&p&&(0,d.jsx)(ep.Drawer,{title:"选择数据集",size:800,open:E,onClose:()=>{A(!1)},children:v(e=>{F.dataset=e,x({...p,datasource:{...p.datasource,dataset:e}}),A(!1)})}),!!j&&p&&B&&j(p,e=>{F.dataset=e,x({...p,datasource:{...p.datasource,dataset:e}}),M(!1)},()=>{M(!1)})]})},tt=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)})},tl=h().div`
|
|
760
806
|
display: flex;
|
|
761
807
|
flex-direction: column;
|
|
762
808
|
height: 100%;
|
|
@@ -795,7 +841,7 @@
|
|
|
795
841
|
font-size: 14px;
|
|
796
842
|
padding: 0 50px;
|
|
797
843
|
}
|
|
798
|
-
`,
|
|
844
|
+
`,tn=()=>{let{schema:e,setSchema:t}=(0,c.useContext)(f),[l,n]=m().useState(!1),[r,a]=m().useState(-1),[i]=ep.Form.useForm(),o=(0,c.useMemo)(()=>e.scripts||[],[e]),s=l=>{t({...e,scripts:l})},u=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)(tl,{className:"script-panel",children:[(0,d.jsx)(eL,{title:"脚本",extra:(0,d.jsx)(ep.Space,{children:(0,d.jsx)("a",{className:"toolbar",onClick:()=>{a(-1),i.setFieldsValue({name:"",script:"return {};"}),n(!0)},children:"+"})})}),(0,d.jsx)("div",{className:"body beautified_scrollbar",children:(0,d.jsx)("ul",{children:o.map((e,t)=>(0,d.jsxs)("li",{children:[(0,d.jsxs)("div",{title:e.name,children:[(0,d.jsx)(eu,{type:"icon-drag"})," ",e.name]}),(0,d.jsxs)(ep.Space,{children:[(0,d.jsx)("a",{onClick:()=>{a(t),i.setFieldsValue({name:e.name,script:e.script}),n(!0)},children:(0,d.jsx)(ed.EditOutlined,{})}),(0,d.jsx)("a",{onClick:()=>{let e=[...o];e.splice(t,1),s&&s(e)},children:(0,d.jsx)(ed.DeleteOutlined,{})})]})]},e.id||t))})}),(0,d.jsx)(ep.Modal,{title:"添加脚本",open:l,width:600,styles:{body:{maxHeight:"calc(100vh - 250px)",overflow:"auto"}},onCancel:()=>n(!1),footer:(0,d.jsxs)(ep.Space,{children:[(0,d.jsx)(ep.Button,{type:"primary",onClick:u,children:"确定"}),(0,d.jsx)(ep.Button,{onClick:()=>n(!1),children:"取消"})]}),children:(0,d.jsxs)(ep.Form,{form:i,layout:"vertical",children:[(0,d.jsx)(ep.Form.Item,{label:"脚本名称",name:"name",rules:[{required:!0,message:"请输入脚本名称"}],children:(0,d.jsx)(ep.Input,{})}),(0,d.jsx)(ep.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)(ef(),{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:"}"})]})})]})})]})},tr=h().div`
|
|
799
845
|
display: flex;
|
|
800
846
|
flex-direction: column;
|
|
801
847
|
height: 100%;
|
|
@@ -806,7 +852,7 @@
|
|
|
806
852
|
gap: 12px;
|
|
807
853
|
padding: 12px;
|
|
808
854
|
}
|
|
809
|
-
`,
|
|
855
|
+
`,ta=()=>{let{schema:e,setSchema:t}=(0,c.useContext)(f),[l,n]=m().useState(!1),[r,a]=m().useState(-1),[i]=ep.Form.useForm(),o=(0,c.useMemo)(()=>e.variables||[],[e.variables]),s=l=>{t({...e,variables:l})},u=[{title:"名称",dataIndex:"name",render:(e,t)=>(0,d.jsxs)("div",{title:e,children:[(0,d.jsx)(eu,{type:"icon-drag"})," ",e]})},{title:"值",dataIndex:"value"},{title:"操作",width:60,align:"center",render:(e,t,l)=>(0,d.jsxs)(ep.Space,{children:[(0,d.jsx)("a",{onClick:()=>{a(l),i.setFieldsValue({name:t.name,value:t.value}),n(!0)},children:(0,d.jsx)(ed.EditOutlined,{})}),(0,d.jsx)(ep.Popconfirm,{title:"确认删除吗?",okText:"确认",cancelText:"取消",onConfirm:()=>{let e=[...o];e.splice(l,1),s&&s(e)},children:(0,d.jsx)("a",{children:(0,d.jsx)(ed.DeleteOutlined,{})})})]})}],p=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)(tr,{children:[(0,d.jsx)(eL,{title:"环境变量",extra:(0,d.jsx)(ep.Space,{children:(0,d.jsx)("a",{className:"toolbar",onClick:()=>{a(-1),i.resetFields(),n(!0)},children:"+"})})}),(0,d.jsx)("div",{className:"body beautified_scrollbar",children:(0,d.jsx)(ep.Table,{rowKey:e=>e.id||e.name,dataSource:o,columns:u,pagination:!1,size:"small",locale:{emptyText:"暂无环境变量"}})}),(0,d.jsx)(ep.Modal,{title:"添加环境变量",open:l,width:600,styles:{body:{maxHeight:"calc(100vh - 250px)",overflow:"auto"}},onCancel:()=>n(!1),footer:(0,d.jsxs)(ep.Space,{children:[(0,d.jsx)(ep.Button,{type:"primary",onClick:p,children:"确定"}),(0,d.jsx)(ep.Button,{onClick:()=>n(!1),children:"取消"})]}),children:(0,d.jsxs)(ep.Form,{form:i,layout:"vertical",children:[(0,d.jsx)(ep.Form.Item,{label:"环境变量名称",name:"name",rules:[{required:!0,message:"请输入环境变量名称"}],children:(0,d.jsx)(ep.Input,{})}),(0,d.jsx)(ep.Form.Item,{label:"环境变量值",name:"value",rules:[{required:!0,message:"请输入环境变量值"}],children:(0,d.jsx)(ep.Input,{})})]})})]})},ti=h().div`
|
|
810
856
|
display: flex;
|
|
811
857
|
flex-direction: column;
|
|
812
858
|
height: 100%;
|
|
@@ -818,7 +864,7 @@
|
|
|
818
864
|
padding: 12px;
|
|
819
865
|
overflow: auto;
|
|
820
866
|
}
|
|
821
|
-
`,
|
|
867
|
+
`,to=m().forwardRef((e,t)=>{let{renderNode:l}=e,n=(0,c.useRef)(null);(0,c.useImperativeHandle)(t,()=>({reload:r}));let r=()=>{var e;null==(e=n.current)||e.reload()};return(0,d.jsxs)(ti,{className:"dataset-panel",children:[(0,d.jsx)(eL,{title:"数据集",extra:(0,d.jsx)(ep.Space,{children:(0,d.jsx)("a",{className:"toolbar",onClick:()=>{var e;null==(e=n.current)||e.handleAdd()},children:"+"})})}),(0,d.jsx)("div",{className:"body beautified_scrollbar",children:(0,d.jsx)(l,{ref:n})})]})}),ts=h().div`
|
|
822
868
|
height: 100%;
|
|
823
869
|
display: grid;
|
|
824
870
|
background: #ffffff;
|
|
@@ -913,9 +959,15 @@
|
|
|
913
959
|
.beautified_scrollbar {
|
|
914
960
|
overflow: auto;
|
|
915
961
|
scrollbar-width: none;
|
|
962
|
+
|
|
963
|
+
&.always {
|
|
964
|
+
overflow-y: scroll;
|
|
965
|
+
scrollbar-width: thin;
|
|
966
|
+
}
|
|
916
967
|
&::-webkit-scrollbar {
|
|
917
968
|
width: 0;
|
|
918
969
|
height: 0;
|
|
970
|
+
position: absolute;
|
|
919
971
|
}
|
|
920
972
|
&:hover {
|
|
921
973
|
scrollbar-width: thin;
|
|
@@ -932,11 +984,11 @@
|
|
|
932
984
|
background: transparent;
|
|
933
985
|
}
|
|
934
986
|
}
|
|
935
|
-
`,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)(ej.Modal,{title:"导入页面",open:t,width:800,onCancel:l,onOk:()=>null==n?void 0:n(JSON.parse(r)),okText:"导入",cancelText:"取消",styles:{body:{height:"calc(100vh - 250px)",overflow:"auto"}},children:(0,d.jsx)("div",{className:"body",style:{flex:"1 1 auto",display:"flex",height:"100%"},children:(0,d.jsx)(eX.Editor,{height:"100%",defaultLanguage:"json",value:r,options:{minimap:{enabled:!1}},onChange:e=>a(e||"")})})})},tu=m().forwardRef((e,t)=>{var l;let n,{pageId:r,agentList:a=[],plugins:i=[],headerExtra:o,datasourceEnable:s=!0,scriptEnable:c=!0,datasetPanel:u,datasetSelector:m,fetch:x,onSave:h,loading:f=!1}=e,g=(0,p.useRef)(null),v=(0,p.useRef)(null),[y,j]=(0,p.useState)(1),[b,w]=(0,p.useState)([]),[C,S]=(0,p.useState)([]),[I,z]=(0,p.useState)(!1),[k,O]=(0,p.useState)("desktop"),[N,T]=(0,p.useState)("component"),[R,F]=(0,p.useState)((null==x?void 0:x.ai)?"ai":"props"),[D,A]=(0,p.useState)(!0),[E,B]=(0,p.useState)(!0),[L,M]=(0,p.useState)(null),[P,$]=(0,p.useState)({info:{},datasources:[],scripts:[],variables:[],items:[]}),[Y,_]=(0,p.useState)(!0),[H,q]=(0,p.useState)(!1),[G,U]=(0,p.useState)(!1),J=(0,p.useMemo)(()=>{let e=D?"250px":"",t=E?"400px":"";return{gridTemplateColumns:`${e} 1fr ${t}`}},[D,E]),K=(0,p.useMemo)(()=>({display:D?"flex":"none"}),[D]),W=(0,p.useMemo)(()=>({display:E?"flex":"none"}),[E]);l=[P],(n=(0,p.useRef)()).current===JSON.stringify(l)&&n.current||(n.current=JSON.stringify(l),(()=>{I||(w(e=>e.length?[...e,JSON.parse(JSON.stringify(P))].slice(-50):[JSON.parse(JSON.stringify(P))]),S([]))})()),(0,p.useImperativeHandle)(t,()=>({handleOpen(e){z(!0),X(e.items),$(e),w([JSON.parse(JSON.stringify(e))]),S([]),setTimeout(()=>z(!1),0)}}));let X=(e,t)=>{e&&e.forEach(e=>{e.id||(e.id=t||ek()),Array.isArray(e.children)?X(e.children):"object"==typeof e.children&&e.children&&Object.keys(e.children).forEach(t=>{Array.isArray(e.children[t])&&X(e.children[t],ek())})})},V=e=>{var t,l,n;if((null==(t=e.datasets)?void 0:t.length)&&(null==v||null==(l=v.current)?void 0:l.reload)&&v.current.reload(),e.schema){let t=JSON.parse(JSON.stringify(e.schema));X(t.items),$(t)}else if(null==(n=e.pageItems)?void 0:n.length){let t=new Map(e.pageItems.map(e=>[e.targetId,e])),l=JSON.parse(JSON.stringify(P)),n=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];e.forEach((l,r)=>{if(t.has(l.id)){let{position:n,insertSlot:d,pageItem:c}=t.get(l.id);switch(n){case"before":e.splice(r-1,0,c);break;case"after":e.splice(r+1,0,c);break;case"replace":Object.keys(l).forEach(e=>{"id"!==e&&delete l[e]}),Object.assign(l,t.get(l.id));break;case"insert":var a,o,s;let u=i.find(e=>e.key===l.type);Array.isArray(null==u||null==(a=u.defaultOptions)?void 0:a.children)?l.children=[...l.children||[],c]:"object"==typeof(null==u||null==(o=u.defaultOptions)?void 0:o.children)&&d&&(l.children={...l.children||{},[d]:[...(null==(s=l.children)?void 0:s[d])||[],c]})}}Array.isArray(l.children)?n(l.children):"object"==typeof l.children&&l.children&&Object.keys(l.children).forEach(e=>{Array.isArray(l.children[e])&&n(l.children[e])})})};n(l.items),$(l)}},Q=(0,p.useMemo)(()=>"cascade"!==R||(null==L?void 0:L.cascadeIds)?R:"props",[L,R]);return(0,d.jsxs)(es,{pageId:r,designable:Y,plugins:i,schema:P,selectedItem:L,setSchema:$,setSelectedItem:M,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)(ej.Space,{children:[(0,d.jsx)("span",{style:{fontSize:16,fontWeight:500},children:"创建数据报表"}),(0,d.jsx)(ej.Divider,{orientation:"vertical"}),(0,d.jsx)(ej.Tooltip,{title:"保存",children:(0,d.jsx)(ej.Button,{type:"link",className:"toolbar",onClick:()=>{null==h||h(P)},loading:f,children:(0,d.jsx)(ey.SaveOutlined,{})})}),(0,d.jsx)(ej.Divider,{orientation:"vertical"}),(0,d.jsx)(ej.Tooltip,{title:"撤销",children:(0,d.jsx)("a",{className:`toolbar ${b.length>1?"active":""}`,onClick:()=>{w(e=>{if(e.length<=1)return e;z(!0);let t=e[e.length-2];return S(e=>[...e,JSON.parse(JSON.stringify(P))]),$(t),M(null),setTimeout(()=>z(!1),0),e.slice(0,-1)})},children:(0,d.jsx)(ey.UndoOutlined,{})})}),(0,d.jsx)(ej.Tooltip,{title:"重做",children:(0,d.jsx)("a",{className:`toolbar ${C.length>0?"active":""}`,onClick:()=>{S(e=>e.length?(z(!0),w(e=>[...e,JSON.parse(JSON.stringify(P))]),$(e[e.length-1]),M(null),setTimeout(()=>z(!1),0),e.slice(0,-1)):e)},children:(0,d.jsx)(ey.RedoOutlined,{})})}),(0,d.jsx)(ej.Divider,{orientation:"vertical"}),(0,d.jsx)(ej.Tooltip,{title:"导入JSON",children:(0,d.jsx)("a",{className:`toolbar ${C.length>0?"active":""}`,onClick:()=>{q(!0)},children:(0,d.jsx)(ey.ImportOutlined,{})})})]}),(0,d.jsxs)(ej.Space,{children:[(0,d.jsx)(ej.Tooltip,{title:"缩小",children:(0,d.jsx)("a",{className:"toolbar",onClick:()=>j(parseFloat(Math.max(y-.1,.5).toFixed(1))),children:(0,d.jsx)(ey.ZoomOutOutlined,{})})}),(0,d.jsxs)("div",{style:{fontSize:12,color:"#999",userSelect:"none"},children:[(100*y).toFixed(0),"%"]}),(0,d.jsx)(ej.Tooltip,{title:"放大",children:(0,d.jsx)("a",{className:"toolbar",onClick:()=>j(parseFloat(Math.min(y+.1,2).toFixed(1))),children:(0,d.jsx)(ey.ZoomInOutlined,{})})}),(0,d.jsx)(ej.Tooltip,{title:"重置缩放",children:(0,d.jsx)("a",{className:"toolbar",onClick:()=>j(1),children:(0,d.jsx)(ew,{type:"icon-zoom-reset"})})}),(0,d.jsx)(ej.Divider,{orientation:"vertical"}),(0,d.jsx)(ej.Tooltip,{title:"切换左侧栏",children:(0,d.jsx)("a",{className:`toolbar ${D?"active":""}`,onClick:()=>{A(e=>!e),setTimeout(()=>{var e,t;return null==(t=g.current)||null==(e=t.handleResize)?void 0:e.call(t)},0)},children:(0,d.jsx)(ew,{type:"icon-sider-l"})})}),(0,d.jsx)(ej.Tooltip,{title:"切换右侧栏",children:(0,d.jsx)("a",{className:`toolbar ${E?"active":""}`,onClick:()=>{B(e=>!e),setTimeout(()=>{var e,t;return null==(t=g.current)||null==(e=t.handleResize)?void 0:e.call(t)},0)},children:(0,d.jsx)(ew,{type:"icon-sider-r"})})}),o]})]}),(0,d.jsxs)(td,{style:J,children:[(0,d.jsxs)("div",{className:"left",style:K,children:[(0,d.jsx)("div",{style:{padding:"22px 1px 22px 0",borderRight:"solid 1px #e8e8e8"},children:(0,d.jsxs)(ej.Radio.Group,{value:N,onChange:e=>T(e.target.value),buttonStyle:"outline",style:{fontWeight:"normal",display:"inline-flex",flexDirection:"column",gap:14},className:"left-pane-tabs",children:[(0,d.jsx)(ej.Radio.Button,{value:"component",children:(0,d.jsx)(ej.Tooltip,{title:"组件",placement:"right",children:(0,d.jsx)(ew,{type:"icon-puzzle"})})}),(0,d.jsx)(ej.Radio.Button,{value:"layer",children:(0,d.jsx)(ej.Tooltip,{title:"图层",placement:"right",children:(0,d.jsx)(ew,{type:"icon-outline"})})}),!!u&&(0,d.jsx)(ej.Radio.Button,{value:"dataset",children:(0,d.jsx)(ej.Tooltip,{title:"数据集",placement:"right",children:(0,d.jsx)(ew,{type:"icon-dataset"})})}),s&&(0,d.jsx)(ej.Radio.Button,{value:"datasource",title:"数据源",children:(0,d.jsx)(ej.Tooltip,{title:"数据源",placement:"right",children:(0,d.jsx)(ew,{type:"icon-datasource"})})}),c&&(0,d.jsx)(ej.Radio.Button,{value:"script",children:(0,d.jsx)(ej.Tooltip,{title:"脚本",placement:"right",children:(0,d.jsx)(ew,{type:"icon-js"})})}),(0,d.jsx)(ej.Radio.Button,{value:"env",children:(0,d.jsx)(ej.Tooltip,{title:"环境变量",placement:"right",children:(0,d.jsx)(ew,{type:"icon-variable"})})}),(0,d.jsx)(ej.Radio.Button,{value:"code",children:(0,d.jsx)(ej.Tooltip,{title:"源码",placement:"right",children:(0,d.jsx)(ew,{type:"icon-json"})})})]})}),(0,d.jsxs)("div",{style:{flex:"1 1 auto",display:"flex",flexDirection:"column",width:"calc(100% - 47px)"},children:["component"===N&&(0,d.jsx)(e4,{}),"layer"===N&&(0,d.jsx)(e3,{}),s&&"datasource"===N&&(0,d.jsx)(e5,{}),c&&"script"===N&&(0,d.jsx)(tr,{}),"env"===N&&(0,d.jsx)(ti,{}),"code"===N&&(0,d.jsx)(e0,{}),!!u&&"dataset"===N&&(0,d.jsx)(ts,{ref:v,renderNode:u})]})]}),(0,d.jsxs)("div",{className:"center",style:{flex:"1 1 auto"},children:[(0,d.jsx)(eM,{title:"页面",extra:(0,d.jsxs)(ej.Space,{children:[(0,d.jsx)(ej.Button,{size:"small",type:Y?"default":"primary",icon:Y?(0,d.jsx)(ey.EyeInvisibleOutlined,{}):(0,d.jsx)(ey.EyeOutlined,{}),onClick:()=>_(!Y)}),(0,d.jsxs)(ej.Radio.Group,{value:k,onChange:e=>O(e.target.value),size:"small",buttonStyle:"outline",children:[(0,d.jsx)(ej.Radio.Button,{value:"desktop",title:"桌面",children:(0,d.jsx)(ey.DesktopOutlined,{})}),(0,d.jsx)(ej.Radio.Button,{value:"mobile",title:"移动设备",children:(0,d.jsx)(ey.MobileOutlined,{})}),(0,d.jsx)(ej.Radio.Button,{value:"tablet",title:"平板设备",children:(0,d.jsx)(ey.TabletOutlined,{})})]})]})}),(0,d.jsx)("div",{className:["body beautified_scrollbar",k].join(" "),children:(0,d.jsx)("div",{style:{transform:`scale(${y})`,transformOrigin:"top center"},children:(0,d.jsx)(eg,{ref:g,device:k,fetch:x})})})]}),(0,d.jsxs)("div",{className:"right",style:W,children:[(0,d.jsxs)("div",{style:{flex:"1 1 auto",display:"flex",flexDirection:"column",width:"calc(100% - 47px)"},children:[(0,d.jsx)(e_,{agentList:a,onEffect:V,style:{display:"ai"===Q&&(null==x?void 0:x.ai)?void 0:"none"}}),"props"===Q&&(0,d.jsx)(tt,{datasourceEnable:s}),"cascade"===Q&&(null==L?void 0:L.cascadeIds)&&(0,d.jsx)(eW,{})]}),(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)(ej.Radio.Group,{value:Q,onChange:e=>F(e.target.value),buttonStyle:"outline",style:{fontWeight:"normal",display:"inline-flex",flexDirection:"column",gap:14},className:"right-pane-tabs",children:[(null==x?void 0:x.ai)&&(0,d.jsx)(ej.Radio.Button,{value:"ai",children:(0,d.jsx)(ej.Tooltip,{title:"智能助理",placement:"right",children:(0,d.jsx)(ew,{type:"icon-assistant"})})}),(0,d.jsx)(ej.Radio.Button,{value:"props",children:(0,d.jsx)(ej.Tooltip,{title:"属性",placement:"right",children:(0,d.jsx)(ew,{type:"icon-info"})})}),(null==L?void 0:L.cascadeIds)&&(0,d.jsx)(ej.Radio.Button,{value:"cascade",children:(0,d.jsx)(ej.Tooltip,{title:"联动",placement:"right",children:(0,d.jsx)(ew,{type:"icon-cascade"})})})]})})]})]})]}),(0,d.jsx)(tc,{open:H,onOk:e=>{q(!1),$(e)},onCancel:()=>q(!1)}),(0,d.jsx)(ej.Drawer,{open:G,size:400,mask:!1,title:null,closable:!1,styles:{body:{padding:0}},onClose:()=>U(!1),children:(0,d.jsx)(e_,{agentList:a,headExtra:(0,d.jsx)(ej.Button,{type:"link",icon:(0,d.jsx)(ey.CloseOutlined,{}),onClick:()=>U(!1)}),onEffect:V})})]})});var tp=((i={}).STRING="STRING",i.NUMBER="NUMBER",i.BOOLEAN="BOOLEAN",i.OBJECT="OBJECT",i.ARRAY="ARRAY",i);let tm=h()(ey.InfoCircleOutlined)`
|
|
987
|
+
`,td=e=>{let{open:t,onCancel:l,onOk:n}=e,[r,a]=(0,c.useState)(JSON.stringify({info:{},datasources:[],scripts:[],variables:[],items:[]}));return(0,d.jsx)(ep.Modal,{title:"导入页面",open:t,width:800,onCancel:l,onOk:()=>null==n?void 0:n(JSON.parse(r)),okText:"导入",cancelText:"取消",styles:{body:{height:"calc(100vh - 250px)",overflow:"auto"}},children:(0,d.jsx)("div",{className:"body",style:{flex:"1 1 auto",display:"flex",height:"100%"},children:(0,d.jsx)(eh.Editor,{height:"100%",defaultLanguage:"json",value:r,options:{minimap:{enabled:!1}},onChange:e=>a(e||"")})})})},tc=m().forwardRef((e,t)=>{var l;let n,{pageId:r,agentList:a=[],plugins:i=[],headerExtra:o,datasourceEnable:s=!0,scriptEnable:u=!0,datasetPanel:p,datasetSelector:m,datasetAdd:x,fetch:h,onSave:f,loading:v=!1}=e,j=(0,c.useRef)(null),b=(0,c.useRef)(null),[y,w]=(0,c.useState)(1),[C,S]=(0,c.useState)([]),[I,k]=(0,c.useState)([]),[z,O]=(0,c.useState)(!1),[N,T]=(0,c.useState)("desktop"),[R,F]=(0,c.useState)("component"),[D,E]=(0,c.useState)((null==h?void 0:h.ai)?"ai":"props"),[A,B]=(0,c.useState)(!0),[M,P]=(0,c.useState)(!0),[L,$]=(0,c.useState)(null),[Y,_]=(0,c.useState)({info:{},datasources:[],scripts:[],variables:[],items:[]}),[q,H]=(0,c.useState)(!0),[G,U]=(0,c.useState)(!1),[J,K]=(0,c.useState)(!1),W=(0,c.useMemo)(()=>{let e=A?"250px":"",t=M?"400px":"";return{gridTemplateColumns:`${e} 1fr ${t}`}},[A,M]),X=(0,c.useMemo)(()=>({display:A?"flex":"none"}),[A]),V=(0,c.useMemo)(()=>({display:M?"flex":"none"}),[M]);l=[Y],(n=(0,c.useRef)()).current===JSON.stringify(l)&&n.current||(n.current=JSON.stringify(l),(()=>{z||(S(e=>e.length?[...e,JSON.parse(JSON.stringify(Y))].slice(-50):[JSON.parse(JSON.stringify(Y))]),k([]))})()),(0,c.useImperativeHandle)(t,()=>({handleOpen(e){O(!0),Q(e.items),_(e),S([JSON.parse(JSON.stringify(e))]),k([]),setTimeout(()=>O(!1),0)}}));let Q=(e,t)=>{e&&e.forEach(e=>{e.id||(e.id=t||eO()),Array.isArray(e.children)?Q(e.children):"object"==typeof e.children&&e.children&&Object.keys(e.children).forEach(t=>{Array.isArray(e.children[t])&&Q(e.children[t],eO())})})},Z=e=>{var t,l,n;if((null==(t=e.datasets)?void 0:t.length)&&(null==b||null==(l=b.current)?void 0:l.reload)&&b.current.reload(),e.schema){let t=JSON.parse(JSON.stringify(e.schema));Q(t.items),_(t)}else if(null==(n=e.pageItems)?void 0:n.length){let t=new Map(e.pageItems.map(e=>[e.targetId,e])),l=JSON.parse(JSON.stringify(Y)),n=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];e.forEach((l,r)=>{if(t.has(l.id)){let{position:n,insertSlot:d,pageItem:c}=t.get(l.id);switch(n){case"before":e.splice(r,0,c);break;case"after":e.splice(r+1,0,c);break;case"replace":Object.keys(l).forEach(e=>{"id"!==e&&delete l[e]}),Object.assign(l,c);break;case"insert":var a,o,s;let u=i.find(e=>e.key===l.type);Array.isArray(null==u||null==(a=u.defaultOptions)?void 0:a.children)?l.children=[...l.children||[],c]:"object"==typeof(null==u||null==(o=u.defaultOptions)?void 0:o.children)&&d&&(l.children={...l.children||{},[d]:[...(null==(s=l.children)?void 0:s[d])||[],c]})}}Array.isArray(l.children)?n(l.children):"object"==typeof l.children&&l.children&&Object.keys(l.children).forEach(e=>{Array.isArray(l.children[e])&&n(l.children[e])})})};n(l.items),_(l)}},ee=(0,c.useMemo)(()=>"cascade"!==D||(null==L?void 0:L.cascadeIds)?D:"props",[L,D]);return(0,d.jsxs)(g,{pageId:r,designable:q,plugins:i,schema:Y,selectedItem:L,setSchema:_,setSelectedItem:$,datasetSelector:m,datasetAdd:x,fetch:h,children:[(0,d.jsxs)("div",{style:{display:"flex",flexDirection:"column",height:"100%"},children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 24px",borderBottom:"solid 1px #e8e8e8"},children:[(0,d.jsxs)(ep.Space,{children:[(0,d.jsx)("span",{style:{fontSize:16,fontWeight:500},children:"创建数据报表"}),(0,d.jsx)(ep.Divider,{orientation:"vertical"}),(0,d.jsx)(ep.Tooltip,{title:"保存",children:(0,d.jsx)(ep.Button,{type:"link",className:"toolbar",onClick:()=>{null==f||f(Y)},loading:v,children:(0,d.jsx)(ed.SaveOutlined,{})})}),(0,d.jsx)(ep.Divider,{orientation:"vertical"}),(0,d.jsx)(ep.Tooltip,{title:"撤销",children:(0,d.jsx)("a",{className:`toolbar ${C.length>1?"active":""}`,onClick:()=>{S(e=>{if(e.length<=1)return e;O(!0);let t=e[e.length-2];return k(e=>[...e,JSON.parse(JSON.stringify(Y))]),_(t),$(null),setTimeout(()=>O(!1),0),e.slice(0,-1)})},children:(0,d.jsx)(ed.UndoOutlined,{})})}),(0,d.jsx)(ep.Tooltip,{title:"重做",children:(0,d.jsx)("a",{className:`toolbar ${I.length>0?"active":""}`,onClick:()=>{k(e=>e.length?(O(!0),S(e=>[...e,JSON.parse(JSON.stringify(Y))]),_(e[e.length-1]),$(null),setTimeout(()=>O(!1),0),e.slice(0,-1)):e)},children:(0,d.jsx)(ed.RedoOutlined,{})})}),(0,d.jsx)(ep.Divider,{orientation:"vertical"}),(0,d.jsx)(ep.Tooltip,{title:"导入JSON",children:(0,d.jsx)("a",{className:`toolbar ${I.length>0?"active":""}`,onClick:()=>{U(!0)},children:(0,d.jsx)(ed.ImportOutlined,{})})})]}),(0,d.jsxs)(ep.Space,{children:[(0,d.jsx)(ep.Tooltip,{title:"缩小",children:(0,d.jsx)("a",{className:"toolbar",onClick:()=>w(parseFloat(Math.max(y-.1,.5).toFixed(1))),children:(0,d.jsx)(ed.ZoomOutOutlined,{})})}),(0,d.jsxs)("div",{style:{fontSize:12,color:"#999",userSelect:"none"},children:[(100*y).toFixed(0),"%"]}),(0,d.jsx)(ep.Tooltip,{title:"放大",children:(0,d.jsx)("a",{className:"toolbar",onClick:()=>w(parseFloat(Math.min(y+.1,2).toFixed(1))),children:(0,d.jsx)(ed.ZoomInOutlined,{})})}),(0,d.jsx)(ep.Tooltip,{title:"重置缩放",children:(0,d.jsx)("a",{className:"toolbar",onClick:()=>w(1),children:(0,d.jsx)(eu,{type:"icon-zoom-reset"})})}),(0,d.jsx)(ep.Divider,{orientation:"vertical"}),(0,d.jsx)(ep.Tooltip,{title:"切换左侧栏",children:(0,d.jsx)("a",{className:`toolbar ${A?"active":""}`,onClick:()=>{B(e=>!e),setTimeout(()=>{var e,t;return null==(t=j.current)||null==(e=t.handleResize)?void 0:e.call(t)},0)},children:(0,d.jsx)(eu,{type:"icon-sider-l"})})}),(0,d.jsx)(ep.Tooltip,{title:"切换右侧栏",children:(0,d.jsx)("a",{className:`toolbar ${M?"active":""}`,onClick:()=>{P(e=>!e),setTimeout(()=>{var e,t;return null==(t=j.current)||null==(e=t.handleResize)?void 0:e.call(t)},0)},children:(0,d.jsx)(eu,{type:"icon-sider-r"})})}),o]})]}),(0,d.jsxs)(ts,{style:W,children:[(0,d.jsxs)("div",{className:"left",style:X,children:[(0,d.jsx)("div",{style:{padding:"22px 1px 22px 0",borderRight:"solid 1px #e8e8e8"},children:(0,d.jsxs)(ep.Radio.Group,{value:R,onChange:e=>F(e.target.value),buttonStyle:"outline",style:{fontWeight:"normal",display:"inline-flex",flexDirection:"column",gap:14},className:"left-pane-tabs",children:[(0,d.jsx)(ep.Radio.Button,{value:"component",children:(0,d.jsx)(ep.Tooltip,{title:"组件",placement:"right",children:(0,d.jsx)(eu,{type:"icon-puzzle"})})}),(0,d.jsx)(ep.Radio.Button,{value:"layer",children:(0,d.jsx)(ep.Tooltip,{title:"图层",placement:"right",children:(0,d.jsx)(eu,{type:"icon-outline"})})}),!!p&&(0,d.jsx)(ep.Radio.Button,{value:"dataset",children:(0,d.jsx)(ep.Tooltip,{title:"数据集",placement:"right",children:(0,d.jsx)(eu,{type:"icon-dataset"})})}),s&&(0,d.jsx)(ep.Radio.Button,{value:"datasource",title:"数据源",children:(0,d.jsx)(ep.Tooltip,{title:"数据源",placement:"right",children:(0,d.jsx)(eu,{type:"icon-datasource"})})}),u&&(0,d.jsx)(ep.Radio.Button,{value:"script",children:(0,d.jsx)(ep.Tooltip,{title:"脚本",placement:"right",children:(0,d.jsx)(eu,{type:"icon-js"})})}),(0,d.jsx)(ep.Radio.Button,{value:"env",children:(0,d.jsx)(ep.Tooltip,{title:"环境变量",placement:"right",children:(0,d.jsx)(eu,{type:"icon-variable"})})}),(0,d.jsx)(ep.Radio.Button,{value:"code",children:(0,d.jsx)(ep.Tooltip,{title:"源码",placement:"right",children:(0,d.jsx)(eu,{type:"icon-json"})})})]})}),(0,d.jsxs)("div",{style:{flex:"1 1 auto",display:"flex",flexDirection:"column",width:"calc(100% - 47px)"},children:["component"===R&&(0,d.jsx)(e2,{}),"layer"===R&&(0,d.jsx)(e9,{}),s&&"datasource"===R&&(0,d.jsx)(e8,{}),u&&"script"===R&&(0,d.jsx)(tn,{}),"env"===R&&(0,d.jsx)(ta,{}),"code"===R&&(0,d.jsx)(eZ,{}),!!p&&"dataset"===R&&(0,d.jsx)(to,{ref:b,renderNode:p})]})]}),(0,d.jsxs)("div",{className:"center",style:{flex:"1 1 auto"},children:[(0,d.jsx)(eL,{title:"页面",extra:(0,d.jsxs)(ep.Space,{children:[(0,d.jsx)(ep.Button,{size:"small",type:q?"default":"primary",icon:q?(0,d.jsx)(ed.EyeInvisibleOutlined,{}):(0,d.jsx)(ed.EyeOutlined,{}),onClick:()=>H(!q)}),(0,d.jsxs)(ep.Radio.Group,{value:N,onChange:e=>T(e.target.value),size:"small",buttonStyle:"outline",children:[(0,d.jsx)(ep.Radio.Button,{value:"desktop",title:"桌面",children:(0,d.jsx)(ed.DesktopOutlined,{})}),(0,d.jsx)(ep.Radio.Button,{value:"mobile",title:"移动设备",children:(0,d.jsx)(ed.MobileOutlined,{})}),(0,d.jsx)(ep.Radio.Button,{value:"tablet",title:"平板设备",children:(0,d.jsx)(ed.TabletOutlined,{})})]})]})}),(0,d.jsx)("div",{className:["body beautified_scrollbar always",N].join(" "),children:(0,d.jsx)("div",{style:{transform:`scale(${y})`,transformOrigin:"top center"},children:(0,d.jsx)(eI,{ref:j,device:N})})})]}),(0,d.jsxs)("div",{className:"right",style:V,children:[(0,d.jsxs)("div",{style:{flex:"1 1 auto",display:"flex",flexDirection:"column",width:"calc(100% - 47px)"},children:[(0,d.jsx)(eq,{agentList:a,onEffect:Z,style:{display:"ai"===ee&&(null==h?void 0:h.ai)?void 0:"none"}}),"props"===ee&&(0,d.jsx)(te,{datasourceEnable:s}),"cascade"===ee&&(null==L?void 0:L.cascadeIds)&&(0,d.jsx)(eX,{})]}),(0,d.jsx)("div",{style:{padding:"22px 0",borderLeft:"solid 1px #e8e8e8",display:"flex",flexDirection:"column",justifyContent:"space-between",alignItems:"center"},children:(0,d.jsxs)(ep.Radio.Group,{value:ee,onChange:e=>E(e.target.value),buttonStyle:"outline",style:{fontWeight:"normal",display:"inline-flex",flexDirection:"column",gap:14},className:"right-pane-tabs",children:[(null==h?void 0:h.ai)&&(0,d.jsx)(ep.Radio.Button,{value:"ai",children:(0,d.jsx)(ep.Tooltip,{title:"智能助理",placement:"right",children:(0,d.jsx)(eu,{type:"icon-assistant"})})}),(0,d.jsx)(ep.Radio.Button,{value:"props",children:(0,d.jsx)(ep.Tooltip,{title:"属性",placement:"right",children:(0,d.jsx)(eu,{type:"icon-info"})})}),(null==L?void 0:L.cascadeIds)&&(0,d.jsx)(ep.Radio.Button,{value:"cascade",children:(0,d.jsx)(ep.Tooltip,{title:"联动",placement:"right",children:(0,d.jsx)(eu,{type:"icon-cascade"})})})]})})]})]})]}),(0,d.jsx)(td,{open:G,onOk:e=>{U(!1),_(e)},onCancel:()=>U(!1)}),(0,d.jsx)(ep.Drawer,{open:J,size:400,mask:!1,title:null,closable:!1,styles:{body:{padding:0}},onClose:()=>K(!1),children:(0,d.jsx)(eq,{agentList:a,headExtra:(0,d.jsx)(ep.Button,{type:"link",icon:(0,d.jsx)(ed.CloseOutlined,{}),onClick:()=>K(!1)}),onEffect:Z})})]})});var tu=((i={}).STRING="STRING",i.NUMBER="NUMBER",i.BOOLEAN="BOOLEAN",i.OBJECT="OBJECT",i.ARRAY="ARRAY",i);let tp=h()(ed.InfoCircleOutlined)`
|
|
936
988
|
vertical-align: middle;
|
|
937
989
|
margin-left: 2px;
|
|
938
990
|
color: var(--ant-color-text-description);
|
|
939
|
-
`,
|
|
991
|
+
`,tm=h().div`
|
|
940
992
|
width: 100%;
|
|
941
993
|
padding: 0 12px;
|
|
942
994
|
border-bottom: solid 1px #e8e8e8;
|
|
@@ -956,7 +1008,7 @@
|
|
|
956
1008
|
color: #999;
|
|
957
1009
|
font-size: 12px;
|
|
958
1010
|
}
|
|
959
|
-
`,
|
|
1011
|
+
`,tx=(e,t)=>{let[l,n]=(0,c.useState)(null),{fetch:r,getVars:a}=(0,c.useContext)(f);return(0,c.useEffect)(()=>{if(!(null==e?void 0:e.datasource))return n(null);switch((null==e?void 0:e.datasource.source)||"custom"){case"custom":try{return n(JSON.parse((null==e?void 0:e.datasource.custom)||"[]"))}catch(e){break}case"dataset":if(!(null==e?void 0:e.datasource.dataset)||!(null==r?void 0:r.dataset))break;let t=a(e.id||"");r.dataset(null==e?void 0:e.datasource.dataset.id,t).then(e=>n((null==e?void 0:e.data)||null)).catch(e=>{console.error(e),n(null)})}return n(null)},[null==e?void 0:e.datasource,t]),l},th=h().div`
|
|
960
1012
|
box-sizing: border-box;
|
|
961
1013
|
margin: 0;
|
|
962
1014
|
padding: 0;
|
|
@@ -975,7 +1027,7 @@
|
|
|
975
1027
|
${e=>"vertical"===e.$itemLayout&&(0,x.css)`
|
|
976
1028
|
flex-direction: column;
|
|
977
1029
|
`}
|
|
978
|
-
`,
|
|
1030
|
+
`,tf=h().div`
|
|
979
1031
|
display: flex;
|
|
980
1032
|
align-items: center;
|
|
981
1033
|
justify-content: space-between;
|
|
@@ -988,12 +1040,12 @@
|
|
|
988
1040
|
border-bottom: none;
|
|
989
1041
|
}
|
|
990
1042
|
`}
|
|
991
|
-
`,
|
|
1043
|
+
`,tg=h().div`
|
|
992
1044
|
display: flex;
|
|
993
1045
|
flex: 1;
|
|
994
1046
|
align-items: flex-start;
|
|
995
1047
|
max-width: 100%;
|
|
996
|
-
`,
|
|
1048
|
+
`,tv=h().div`
|
|
997
1049
|
margin-right: 16px;
|
|
998
1050
|
`,tj=h().div`
|
|
999
1051
|
flex: 1 0;
|
|
@@ -1015,7 +1067,7 @@
|
|
|
1015
1067
|
color: #1890ff;
|
|
1016
1068
|
}
|
|
1017
1069
|
}
|
|
1018
|
-
`,
|
|
1070
|
+
`,ty=h().div`
|
|
1019
1071
|
color: rgba(0, 0, 0, 0.45);
|
|
1020
1072
|
font-size: 14px;
|
|
1021
1073
|
line-height: 1.5715;
|
|
@@ -1023,7 +1075,7 @@
|
|
|
1023
1075
|
margin-top: 16px;
|
|
1024
1076
|
text-align: right;
|
|
1025
1077
|
padding: ${e=>e.$bordered?"0 24px 24px":"0"};
|
|
1026
|
-
`;let
|
|
1078
|
+
`;let tw=e=>{let{item:t,split:l,padding:n}=e;return(0,d.jsx)(tf,{$split:l,$padding:n,children:(0,d.jsxs)(tg,{children:[t.avatar&&(0,d.jsx)(tv,{children:(0,d.jsx)(ep.Avatar,{src:t.avatar})}),(0,d.jsxs)(tj,{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)(ty,{children:t.description})]})]})})},tC=e=>{let{list:t=[],split:l,bordered:n,size:r,itemLayout:a,style:i,className:o}=e,s=(0,c.useMemo)(()=>"small"===r?"8px 16px":n?"12px 24px":"12px 0",[r,n]);return(0,d.jsx)(th,{$bordered:n,$split:l,$size:r,style:i,$itemLayout:a,className:o,children:t.map((e,t)=>(0,d.jsx)(tw,{item:e,split:l,padding:s},String(t)))})};var tS=u(190),tI=u(185),tk=u.n(tI);let tz=[{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,c.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)(ep.Form,{layout:"vertical",children:[(0,d.jsx)(ep.Form.Item,{label:"文本内容",children:(0,d.jsx)(ep.Input.TextArea,{size:"small",value:o.text,onChange:e=>c("text",e.target.value)})}),(0,d.jsx)(ep.Form.Item,{label:"类名",children:(0,d.jsx)(ep.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)(ep.Space.Compact,{children:[(0,d.jsxs)(ep.Select,{size:"small",value:null==(t=o.customStyle)?void 0:t.fontFamily,style:{width:90},onChange:e=>u("fontFamily",e),children:[(0,d.jsx)(ep.Select.Option,{value:"'黑体', 'SimHei', sans-serif",children:"黑体"}),(0,d.jsx)(ep.Select.Option,{value:"'宋体', 'SimSun', serif",children:"宋体"}),(0,d.jsx)(ep.Select.Option,{value:"'仿宋', 'FangSong', serif",children:"仿宋"}),(0,d.jsx)(ep.Select.Option,{value:"'楷体', 'KaiTi', serif",children:"楷体"}),(0,d.jsx)(ep.Select.Option,{value:"Arial, sans-serif",children:"Arial"})]}),(0,d.jsx)(ep.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)(ep.Select.Option,{value:e,children:e},e))}),(0,d.jsx)(ep.ColorPicker,{size:"small",value:null==(n=o.customStyle)?void 0:n.color,onChange:e=>u("color",e.toHexString()),allowClear:!0})]}),(0,d.jsxs)(ep.Space.Compact,{children:[(0,d.jsx)(ep.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)(ep.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)(ep.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)(ep.Form,{labelCol:{span:24},wrapperCol:{span:24},children:[(0,d.jsx)(ep.Form.Item,{label:(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:["图片URL",(0,d.jsx)(ep.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||ep.message.error("上传封面只能是图片文件"),t},onChange:e=>{if("done"===e.file.status){var t;n("src",null==(t=e.file.response)?void 0:t.data),ep.message.success("上传成功")}else"error"===e.file.status&&ep.message.error("上传失败")},children:(0,d.jsx)(ep.Button,{size:"small",type:"link",icon:(0,d.jsx)(ed.UploadOutlined,{})})})]}),children:(0,d.jsx)(ep.Input,{size:"small",value:t.src,onChange:e=>n("src",e.target.value)})}),(0,d.jsx)(ep.Form.Item,{label:"图片替代文本",children:(0,d.jsx)(ep.Input,{size:"small",value:t.alt,onChange:e=>n("alt",e.target.value)})}),(0,d.jsx)(ep.Form.Item,{label:"图片链接",children:(0,d.jsx)(ep.Input,{size:"small",value:t.href,onChange:e=>n("href",e.target.value)})}),(0,d.jsx)(ep.Form.Item,{label:"图片宽度",children:(0,d.jsx)(ep.Input,{size:"small",value:t.width,onChange:e=>n("width",e.target.value)})}),(0,d.jsx)(ep.Form.Item,{label:"图片高度",children:(0,d.jsx)(ep.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:u,style:p,className:m}=e,{handleCallback:x}=(0,c.useContext)(f),h="danger"===n,g="string"==typeof r?r?(0,d.jsx)(eu,{type:r}):void 0:r;return(0,d.jsx)(ep.Button,{id:t,type:h?"default":n,icon:g,size:a,block:i,shape:["round","circle"].includes(o)?o:void 0,ghost:s,danger:h,onClick:()=>{x(u,!1,(e,t)=>{console.log("点击回调:",{target:e,data:t})})},style:p,className:m,children:l})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n});return(0,d.jsxs)(ep.Form,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,d.jsx)(ep.Form.Item,{label:"文本",children:(0,d.jsx)(ep.Input,{size:"small",value:t.text,onChange:e=>n("text",e.target.value),placeholder:"请输入按钮文本"})}),(0,d.jsx)(ep.Form.Item,{label:"图标",children:(0,d.jsx)(ep.Input,{size:"small",value:t.icon,onChange:e=>n("icon",e.target.value),placeholder:"请输入按钮图标(antdv 1.7.8)"})}),(0,d.jsx)(ep.Form.Item,{label:"类型",children:(0,d.jsxs)(ep.Radio.Group,{size:"small",value:t.type,onChange:e=>n("type",e.target.value),children:[(0,d.jsx)(ep.Radio.Button,{value:"default",children:"默认"}),(0,d.jsx)(ep.Radio.Button,{value:"primary",children:"主要"}),(0,d.jsx)(ep.Radio.Button,{value:"link",children:"链接"}),(0,d.jsx)(ep.Radio.Button,{value:"dashed",children:"虚线"}),(0,d.jsx)(ep.Radio.Button,{value:"text",children:"文本"})]})}),(0,d.jsx)(ep.Form.Item,{label:"大小",children:(0,d.jsxs)(ep.Radio.Group,{size:"small",value:t.size,onChange:e=>n("size",e.target.value),children:[(0,d.jsx)(ep.Radio.Button,{value:"small",children:"小"}),(0,d.jsx)(ep.Radio.Button,{value:"middle",children:"中"}),(0,d.jsx)(ep.Radio.Button,{value:"large",children:"大"})]})}),(0,d.jsx)(ep.Form.Item,{label:"形状",children:(0,d.jsxs)(ep.Radio.Group,{size:"small",value:t.shape,onChange:e=>n("shape",e.target.value),children:[(0,d.jsx)(ep.Radio.Button,{value:"default",children:"默认"}),(0,d.jsx)(ep.Radio.Button,{value:"round",children:"圆角"}),(0,d.jsx)(ep.Radio.Button,{value:"circle",children:"圆形"})]})}),(0,d.jsx)(ep.Form.Item,{label:"块级",children:(0,d.jsx)(ep.Switch,{size:"small",checked:!!t.block,onChange:e=>n("block",e)})}),(0,d.jsx)(ep.Form.Item,{label:"幽灵",children:(0,d.jsx)(ep.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,ancestors:a,style:i={},className:o}=e,s=(0,c.useMemo)(()=>!r.children||Array.isArray(r.children)||"object"!=typeof r.children?null:r.children.extra||[],[r]),[u,p]=(0,c.useState)(s||[]);return(0,c.useEffect)(()=>{p(s||[])},[s]),(0,d.jsxs)(tm,{id:t,style:{...i},className:o,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)(ew,{list:u,ancestors:[...a,r],onListChange:e=>{let t=[...e];r.children.extra=t,p(t)}})})]})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n});return(0,d.jsxs)(ep.Form,{layout:"vertical",children:[(0,d.jsx)(ep.Form.Item,{label:"标题",children:(0,d.jsx)(ep.Input,{size:"small",value:t.title,onChange:e=>n("title",e.target.value),placeholder:"请输入标题"})}),(0,d.jsx)(ep.Form.Item,{label:"副标题",children:(0,d.jsx)(ep.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:u={},className:p}=e,{initCallback:m}=(0,c.useContext)(f),x=!!a&&!(a<=n.length)&&{total:n.length,pageSize:a,size:o,showSizeChanger:!0,showQuickJumper:!0,hideOnSinglePage:!0,pageSizeOptions:["10","20","30","40"],showTotal:(e,t)=>`共 ${e} 条记录,显示第 ${t[0]}-${t[1]} 条`},h=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",`
|
|
1027
1079
|
"use strict";
|
|
1028
1080
|
const window = undefined;
|
|
1029
1081
|
const document = undefined;
|
|
@@ -1033,7 +1085,7 @@
|
|
|
1033
1085
|
const module = undefined;
|
|
1034
1086
|
const exports = undefined;
|
|
1035
1087
|
${e.customRender}
|
|
1036
|
-
`)(console,Math,Date,Array,Object,String,Number,Boolean,t,l,n):e.render})),g=()=>{console.log("callback table"
|
|
1088
|
+
`)(console,Math,Date,Array,Object,String,Number,Boolean,t,l,n):e.render})),g=()=>{console.log("callback table")};return(0,c.useEffect)(()=>{m({id:l.id,callback:g})},[]),(0,d.jsx)(ep.Table,{id:t,dataSource:n,columns:h,pagination:x,bordered:i,size:o,showHeader:"boolean"!=typeof s||s,rowKey:(e,t)=>String(t),style:{padding:1,...u},className:p})},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,c.useState)(!1),[o,s]=(0,c.useState)(null),u=null!=o&&t.columns[o]?t.columns[o]:{title:"",dataIndex:"",width:"",align:"left",ellipsis:!1},p=[{title:"列名",dataIndex:"title"},{title:"数据索引",dataIndex:"dataIndex"},{title:"操作",width:80,align:"center",render:(e,l,r)=>(0,d.jsxs)(ep.Space,{children:[(0,d.jsx)("a",{onClick:()=>{s(r),i(!0)},children:(0,d.jsx)(ed.EditOutlined,{})}),(0,d.jsx)("a",{onClick:()=>{let e;(e=[...t.columns||[]]).splice(r,1),n("columns",e)},children:(0,d.jsx)(ed.DeleteOutlined,{})})]})}];return(0,d.jsxs)("div",{children:[(0,d.jsxs)(ep.Form,{labelCol:{span:12},wrapperCol:{span:12},children:[(0,d.jsx)(ep.Form.Item,{label:"大小",children:(0,d.jsxs)(ep.Radio.Group,{size:"small",value:t.size,onChange:e=>n("size",e.target.value),children:[(0,d.jsx)(ep.Radio.Button,{value:"small",children:"小"}),(0,d.jsx)(ep.Radio.Button,{value:"middle",children:"中"}),(0,d.jsx)(ep.Radio.Button,{value:"large",children:"大"})]})}),(0,d.jsx)(ep.Form.Item,{label:"边框",children:(0,d.jsx)(ep.Switch,{size:"small",checked:!!t.bordered,onChange:e=>n("bordered",e)})}),(0,d.jsx)(ep.Form.Item,{label:"显示表头",children:(0,d.jsx)(ep.Switch,{size:"small",checked:!!t.showHeader,onChange:e=>n("showHeader",e)})}),(0,d.jsx)(ep.Form.Item,{label:"分页大小",children:(0,d.jsx)(ep.InputNumber,{size:"small",value:t.pageSize,onChange:e=>n("pageSize",e)})})]}),(0,d.jsx)(ep.Divider,{children:"表格列设置"}),(0,d.jsx)(ep.Table,{size:"small",dataSource:t.columns,rowKey:(e,t)=>String(t),columns:p,pagination:!1,bordered:!0}),(0,d.jsx)(ep.Button,{size:"small",onClick:()=>{n("columns",[...t.columns||[],{title:"",dataIndex:"",width:"",align:"left",ellipsis:!1}])},block:!0,children:"添加列"}),(0,d.jsx)(ep.Modal,{title:"编辑列",open:a,footer:null,width:400,onCancel:()=>i(!1),children:(0,d.jsx)(ep.Form,{layout:"vertical",children:(0,d.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12},children:[(0,d.jsx)(ep.Form.Item,{label:"列名",children:(0,d.jsx)(ep.Input,{value:u.title,onChange:e=>r(o,{title:e.target.value})})}),(0,d.jsx)(ep.Form.Item,{label:"数据索引",children:(0,d.jsx)(ep.Input,{value:u.dataIndex,onChange:e=>r(o,{dataIndex:e.target.value})})}),(0,d.jsx)(ep.Form.Item,{label:"宽度",children:(0,d.jsx)(ep.Input,{value:u.width,onChange:e=>r(o,{width:e.target.value})})}),(0,d.jsx)(ep.Form.Item,{label:"对齐",children:(0,d.jsxs)(ep.Radio.Group,{value:u.align,onChange:e=>r(o,{align:e.target.value}),children:[(0,d.jsx)(ep.Radio.Button,{value:"left",children:(0,d.jsx)(ed.AlignLeftOutlined,{})}),(0,d.jsx)(ep.Radio.Button,{value:"center",children:(0,d.jsx)(ed.AlignCenterOutlined,{})}),(0,d.jsx)(ep.Radio.Button,{value:"right",children:(0,d.jsx)(ed.AlignRightOutlined,{})})]})}),(0,d.jsx)(ep.Form.Item,{label:"省略",children:(0,d.jsx)(ep.Switch,{checked:!!u.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:u}=e,{initCallback:p}=(0,c.useContext)(f),[m,x]=(0,c.useState)(0),h=tx(i,m),g=(0,c.useRef)(h);(0,c.useEffect)(()=>{g.current=h},[h]);let v=g.current||[],j=(0,c.useMemo)(()=>!!l&&!(l<=v.length)&&{total:v.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,v.length,r]),b=["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,u],y=function(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];return e&&x(e=>e+1),{target:i,data:g.current}};return(0,c.useEffect)(()=>{p({id:i.id,callback:y})},[]),(0,d.jsxs)("div",{id:t,style:{display:"flex",flexDirection:"column",...s},className:b.filter(Boolean).join(" "),children:[(0,d.jsx)(tC,{list:v,split:o,bordered:n,size:r,itemLayout:a}),j&&(0,d.jsx)(ep.Pagination,{...j})]})},formComponent:e=>{let{model:t,onChange:l}=e,[n]=ep.Form.useForm();return(0,c.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)(ep.Form,{form:n,labelCol:{span:12},wrapperCol:{span:12},onValuesChange:e=>{null==l||l({...t,...e})},children:[(0,d.jsx)(ep.Form.Item,{label:"大小",name:"size",children:(0,d.jsxs)(ep.Radio.Group,{size:"small",buttonStyle:"solid",children:[(0,d.jsx)(ep.Radio.Button,{value:"default",children:"默认"}),(0,d.jsx)(ep.Radio.Button,{value:"small",children:"小"})]})}),(0,d.jsx)(ep.Form.Item,{label:"布局",name:"itemLayout",children:(0,d.jsxs)(ep.Radio.Group,{size:"small",buttonStyle:"solid",children:[(0,d.jsx)(ep.Radio.Button,{value:"horizontal",children:"水平"}),(0,d.jsx)(ep.Radio.Button,{value:"vertical",children:"垂直"})]})}),(0,d.jsx)(ep.Form.Item,{label:"边框",name:"bordered",valuePropName:"checked",children:(0,d.jsx)(ep.Switch,{size:"small"})}),(0,d.jsx)(ep.Form.Item,{label:"分割线",name:"split",valuePropName:"checked",children:(0,d.jsx)(ep.Switch,{size:"small"})}),(0,d.jsx)(ep.Form.Item,{label:"分页大小",name:"pageSize",children:(0,d.jsx)(ep.InputNumber,{size:"small"})})]})},defaultOptions:{datasource:{source:"custom",custom:"[]"},props:{size:"default",itemLayout:"horizontal",bordered:!0,split:!0,pageSize:10}}},{group:"基础组件",key:"b-html",label:"HTML",icon:"icon-html",component:e=>{let{id:t,template:l="",item:n,style:r,className:a,classNames:i=[]}=e,{initCallback:o}=(0,c.useContext)(f),[s,u]=(0,c.useState)(0),p=tx(n,s),m=(0,c.useRef)(p);(0,c.useEffect)(()=>{m.current=p},[p]);let x=(0,c.useMemo)(()=>Object.keys(p||{}),[p]),h=(0,c.useMemo)(()=>x.map(e=>null==p?void 0:p[e]),[x,p]),g=(0,c.useMemo)(()=>(l||"").replace(/##\s*([^#]+)\s*##/g,(e,t)=>{try{return Function(...x,`
|
|
1037
1089
|
"use strict";
|
|
1038
1090
|
const window = undefined;
|
|
1039
1091
|
const document = undefined;
|
|
@@ -1043,7 +1095,7 @@
|
|
|
1043
1095
|
const module = undefined;
|
|
1044
1096
|
const exports = undefined;
|
|
1045
1097
|
return ${t};
|
|
1046
|
-
`)(...
|
|
1098
|
+
`)(...h)}catch{return""}}),[l,h]),v=function(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];return e&&u(e=>e+1),{target:n,data:m.current}};return(0,c.useEffect)(()=>{o({id:n.id,callback:v})},[]),(0,d.jsx)("div",{id:t,style:r,className:(i||[]).join(" ")+" "+a,dangerouslySetInnerHTML:{__html:g}})},formComponent:e=>{let{model:t,onChange:l}=e,n=(0,c.useRef)(null),r=(e,n)=>l&&l({...t,[e]:n});return(0,d.jsx)("div",{children:(0,d.jsxs)(ep.Form,{layout:"vertical",children:[(0,d.jsx)(ep.Form.Item,{label:"类名",children:(0,d.jsx)(ep.Select,{size:"small",value:t.classNames,mode:"tags",onChange:e=>r("classNames",e)})}),(0,d.jsx)(ep.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)(eu,{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)(ef(),{onMount:e=>{n.current={editor:e}},height:"300px",defaultLanguage:"html",value:t.template,onChange:e=>r("template",e||""),options:{minimap:{enabled:!1},scrollBeyondLastLine:!1,tabSize:2}})})})]})})},defaultOptions:{datasource:{source:"custom",datasourceId:null,scriptId:null,custom:'{"name": "Confucius"}'},props:{template:"<div>{{name}}, welcome to the world of programming.</div>"}}},{group:"基础组件",key:"b-echarts",label:"图表",icon:"icon-echarts",component:e=>{let{id:t,script:l="",item:n,height:r=400,style:a,className:i}=e,{initCallback:o}=(0,c.useContext)(f),s=(0,c.useRef)(null),[u,p]=(0,c.useState)(null),[m,x]=(0,c.useState)(0),h=tx(n,m),g=(0,c.useRef)(h);(0,c.useEffect)(()=>{g.current=h},[h]);let v=function(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];return arguments.length>1&&arguments[1],e&&x(e=>e+1),{target:n,data:g.current}};return(0,c.useEffect)(()=>{if(!s.current)return;let e=tS.init(s.current);p(e);let t=()=>e.resize();return window.addEventListener("resize",t),o({id:n.id,callback:v}),()=>{window.removeEventListener("resize",t),e.dispose()}},[]),(0,c.useEffect)(()=>{let e;e=(e=>{try{return JSON.parse(e)}catch(t){try{return Function("echarts","console","Math","Date","Array","Object","String","Number","Boolean","data",`
|
|
1047
1099
|
"use strict";
|
|
1048
1100
|
const window = undefined;
|
|
1049
1101
|
const document = undefined;
|
|
@@ -1053,10 +1105,10 @@
|
|
|
1053
1105
|
const module = undefined;
|
|
1054
1106
|
const exports = undefined;
|
|
1055
1107
|
${e}
|
|
1056
|
-
`)(
|
|
1108
|
+
`)(tS,console,Math,Date,Array,Object,String,Number,Boolean,h)}catch(e){return console.error("ECharts 配置解析失败:",e),null}}})(l),u&&e&&(u.setOption(e),setTimeout(()=>u.resize(),50))},[u,l,h]),(0,d.jsx)("div",{id:t,style:{width:"100%",height:r,...a},className:i,children:(0,d.jsx)("div",{ref:s,style:{width:"100%",height:r,...a}})})},formComponent:e=>{let{model:t,onChange:l}=e,n=(0,c.useRef)(null);return(0,d.jsxs)(ep.Form,{children:[(0,d.jsx)(ep.Form.Item,{label:"高度",labelCol:{span:6},wrapperCol:{span:18},children:(0,d.jsx)(ep.InputNumber,{value:t.height,size:"small",min:10,max:1e3,suffix:"px",onChange:e=>l&&l({...t,height:e})})}),(0,d.jsx)(ep.Form.Item,{layout:"vertical",label:(0,d.jsxs)(d.Fragment,{children:["Echarts 渲染脚本"," ",(0,d.jsxs)("a",{onClick:()=>{var e,t;let l=null==(e=n.current)?void 0:e.editor;null==l||null==(t=l.getAction("editor.action.formatDocument"))||t.run()},children:[(0,d.jsx)(eu,{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)(ef(),{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:`
|
|
1057
1109
|
return {
|
|
1058
1110
|
xAxis: { type: 'category', data: data.map(i => i.name) },
|
|
1059
1111
|
yAxis: { type: 'value' },
|
|
1060
1112
|
series: [{ data: data.map(i => i.value), type: 'line' }]
|
|
1061
1113
|
}
|
|
1062
|
-
`}}},{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),y=e=>{m&&m(e),g&&c&&l&&eI(g,c,l,e)};return s?(0,d.jsx)(ej.Input.Search,{id:t,value:u,size:i,allowClear:o,placeholder:n,onChange:e=>y(e.target.value),onSearch:()=>{x&&x(u||""),g&&c&&v&&ez(g,c,v)},style:{...h},className:f}):(0,d.jsx)(ej.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=>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,d.jsxs)(ej.Form,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,d.jsx)(ej.Form.Item,{label:"搜索框",children:(0,d.jsx)(ej.Switch,{size:"small",checked:!!t.search,onChange:e=>n("search",e)})}),(0,d.jsx)(ej.Form.Item,{label:"变量名",children:(0,d.jsx)(ej.Input,{size:"small",value:t.var,onChange:e=>n("var",e.target.value),placeholder:"请输入变量名"})}),(0,d.jsx)(ej.Form.Item,{label:"占位符",children:(0,d.jsx)(ej.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)(ej.Form.Item,{label:"前缀",children:(0,d.jsx)(ej.Input,{size:"small",value:t.prefix,onChange:e=>n("prefix",e.target.value),placeholder:"请输入前缀"})}),(0,d.jsx)(ej.Form.Item,{label:"后缀",children:(0,d.jsx)(ej.Input,{size:"small",value:t.suffix,onChange:e=>n("suffix",e.target.value),placeholder:"请输入后缀"})})]}),(0,d.jsx)(ej.Form.Item,{label:"大小",children:(0,d.jsxs)(ej.Radio.Group,{size:"small",value:t.size,onChange:e=>n("size",e.target.value),children:[(0,d.jsx)(ej.Radio.Button,{value:"small",children:"小"}),(0,d.jsx)(ej.Radio.Button,{value:"middle",children:"中"}),(0,d.jsx)(ej.Radio.Button,{value:"large",children:"大"})]})}),(0,d.jsx)(ej.Form.Item,{label:"清除图标",children:(0,d.jsx)(ej.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)(ej.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)(ej.Form,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,d.jsx)(ej.Form.Item,{label:"变量名",children:(0,d.jsx)(ej.Input,{size:"small",value:t.var,onChange:e=>n("var",e.target.value)})}),(0,d.jsx)(ej.Form.Item,{label:"最小值",children:(0,d.jsx)(ej.InputNumber,{size:"small",value:t.min,onChange:e=>n("min",e)})}),(0,d.jsx)(ej.Form.Item,{label:"最大值",children:(0,d.jsx)(ej.InputNumber,{size:"small",value:t.max,onChange:e=>n("max",e)})}),(0,d.jsx)(ej.Form.Item,{label:"步长",children:(0,d.jsx)(ej.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)(ej.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)(ej.Input,{size:"small",value:t.label,onChange:e=>r(l,"label",e.target.value)})},{title:"选项值",dataIndex:"value",render:(e,t,l)=>(0,d.jsx)(ej.Input,{size:"small",value:t.value,onChange:e=>r(l,"value",e.target.value)})},{title:"操作",render:(e,l,r)=>(0,d.jsx)(ej.Space,{children:(0,d.jsx)(ej.Button,{danger:!0,size:"small",onClick:()=>{let e;(e=[...t.options||[]]).splice(r,1),n("options",e)},children:(0,d.jsx)(ey.DeleteOutlined,{})})})}];return(0,d.jsxs)(ej.Form,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,d.jsx)(ej.Form.Item,{label:"变量名",children:(0,d.jsx)(ej.Input,{size:"small",value:t.var,onChange:e=>n("var",e.target.value),placeholder:"请输入变量名"})}),(0,d.jsx)(ej.Form.Item,{label:"占位符",children:(0,d.jsx)(ej.Input,{size:"small",value:t.placeholder,onChange:e=>n("placeholder",e.target.value),placeholder:"请输入占位符"})}),(0,d.jsx)(ej.Form.Item,{label:"大小",children:(0,d.jsxs)(ej.Radio.Group,{size:"small",value:t.size,onChange:e=>n("size",e.target.value),children:[(0,d.jsx)(ej.Radio.Button,{value:"small",children:"小"}),(0,d.jsx)(ej.Radio.Button,{value:"middle",children:"中"}),(0,d.jsx)(ej.Radio.Button,{value:"large",children:"大"})]})}),(0,d.jsx)(ej.Form.Item,{label:"清除图标",children:(0,d.jsx)(ej.Switch,{size:"small",checked:!!t.allowClear,onChange:e=>n("allowClear",e)})}),(0,d.jsx)(ej.Form.Item,{label:"多选",children:(0,d.jsx)(ej.Switch,{size:"small",checked:!!t.multiple,onChange:e=>n("multiple",e)})}),(0,d.jsxs)(ej.Form.Item,{labelCol:{span:24},wrapperCol:{span:24},children:[(0,d.jsx)(ej.Table,{size:"small",dataSource:t.options,columns:a,pagination:!1,rowKey:(e,t)=>String(t),bordered:!0}),(0,d.jsx)(ej.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)(ej.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)(ej.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)(ej.Input,{size:"small",value:t.label,onChange:e=>r(l,"label",e.target.value)})},{title:"选项值",dataIndex:"value",render:(e,t,l)=>(0,d.jsx)(ej.Input,{size:"small",value:t.value,onChange:e=>r(l,"value",e.target.value)})},{title:"操作",render:(e,l,r)=>(0,d.jsx)(ej.Space,{children:(0,d.jsx)(ej.Button,{danger:!0,size:"small",onClick:()=>{let e;(e=[...t.options||[]]).splice(r,1),n("options",e)},children:(0,d.jsx)(ey.DeleteOutlined,{})})})}];return(0,d.jsxs)(ej.Form,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,d.jsx)(ej.Form.Item,{label:"变量名",children:(0,d.jsx)(ej.Input,{size:"small",value:t.var,onChange:e=>n("var",e.target.value),placeholder:"请输入变量名"})}),(0,d.jsx)(ej.Form.Item,{label:"大小",children:(0,d.jsxs)(ej.Radio.Group,{size:"small",value:t.size,onChange:e=>n("size",e.target.value),children:[(0,d.jsx)(ej.Radio.Button,{value:"small",children:"小"}),(0,d.jsx)(ej.Radio.Button,{value:"middle",children:"中"}),(0,d.jsx)(ej.Radio.Button,{value:"large",children:"大"})]})}),(0,d.jsxs)(ej.Form.Item,{labelCol:{span:24},wrapperCol:{span:24},children:[(0,d.jsx)(ej.Table,{size:"small",dataSource:t.options,columns:a,pagination:!1,rowKey:(e,t)=>String(t),bordered:!0}),(0,d.jsx)(ej.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)(ej.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)(ej.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)(ej.Input,{size:"small",value:t.label,onChange:e=>r(l,"label",e.target.value)})},{title:"选项值",dataIndex:"value",render:(e,t,l)=>(0,d.jsx)(ej.Input,{size:"small",value:t.value,onChange:e=>r(l,"value",e.target.value)})},{title:"操作",render:(e,l,r)=>(0,d.jsx)(ej.Space,{children:(0,d.jsx)(ej.Button,{danger:!0,size:"small",onClick:()=>{let e;(e=[...t.options||[]]).splice(r,1),n("options",e)},children:(0,d.jsx)(ey.DeleteOutlined,{})})})}];return(0,d.jsxs)(ej.Form,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,d.jsx)(ej.Form.Item,{label:"变量名",children:(0,d.jsx)(ej.Input,{size:"small",value:t.var,onChange:e=>n("var",e.target.value),placeholder:"请输入变量名"})}),(0,d.jsx)(ej.Form.Item,{label:"布局",children:(0,d.jsxs)(ej.Radio.Group,{size:"small",value:t.layout,onChange:e=>n("layout",e.target.value),children:[(0,d.jsx)(ej.Radio.Button,{value:"horizontal",children:"水平"}),(0,d.jsx)(ej.Radio.Button,{value:"vertical",children:"垂直"}),(0,d.jsx)(ej.Radio.Button,{value:"grid",children:"网格"})]})}),"grid"===t.layout&&(0,d.jsx)(ej.Form.Item,{label:"网格行数",children:(0,d.jsx)(ej.InputNumber,{size:"small",value:t.lineNumber,onChange:e=>n("lineNumber",e),min:1,max:10})}),(0,d.jsxs)(ej.Form.Item,{labelCol:{span:24},wrapperCol:{span:24},children:[(0,d.jsx)(ej.Table,{size:"small",dataSource:t.options,columns:a,pagination:!1,rowKey:(e,t)=>String(t),bordered:!0}),(0,d.jsx)(ej.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)(ej.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)(ej.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)(ej.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)(ej.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)(ej.Form,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,d.jsx)(ej.Form.Item,{label:"变量名",children:(0,d.jsx)(ej.Input,{size:"small",value:t.var,onChange:e=>n("var",e.target.value),placeholder:"请输入变量名"})}),(0,d.jsx)(ej.Form.Item,{label:"类型",children:(0,d.jsxs)(ej.Radio.Group,{size:"small",value:t.type,onChange:e=>n("type",e.target.value),children:[(0,d.jsx)(ej.Radio.Button,{value:"date",children:"日期"}),(0,d.jsx)(ej.Radio.Button,{value:"time",children:"时间"}),(0,d.jsx)(ej.Radio.Button,{value:"month",children:"月份"}),(0,d.jsx)(ej.Radio.Button,{value:"year",children:"年份"}),(0,d.jsx)(ej.Radio.Button,{value:"range",children:"日期范围"})]})}),(0,d.jsx)(ej.Form.Item,{label:"大小",children:(0,d.jsxs)(ej.Radio.Group,{size:"small",value:t.size,onChange:e=>n("size",e.target.value),children:[(0,d.jsx)(ej.Radio.Button,{value:"small",children:"小"}),(0,d.jsx)(ej.Radio.Button,{value:"middle",children:"中"}),(0,d.jsx)(ej.Radio.Button,{value:"large",children:"大"})]})}),(0,d.jsx)(ej.Form.Item,{label:"清除图标",children:(0,d.jsx)(ej.Switch,{size:"small",checked:!!t.allowClear,onChange:e=>n("allowClear",e)})}),(0,d.jsx)(ej.Form.Item,{label:"显示时间",children:(0,d.jsx)(ej.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)(ej.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)(ej.Form,{labelCol:{span:6},wrapperCol:{span:18},children:(0,d.jsx)(ej.Form.Item,{label:"变量名",children:(0,d.jsx)(ej.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:ej.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)(ej.Form,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,d.jsx)(ej.Form.Item,{label:"方向",children:(0,d.jsxs)(ej.Radio.Group,{size:"small",value:t.direction,onChange:e=>n("direction",e.target.value),children:[(0,d.jsx)(ej.Radio.Button,{value:"horizontal",children:"水平"}),(0,d.jsx)(ej.Radio.Button,{value:"vertical",children:"垂直"})]})}),(0,d.jsx)(ej.Form.Item,{label:"大小",children:(0,d.jsxs)(ej.Radio.Group,{size:"small",value:t.size,onChange:e=>n("size",e.target.value),children:[(0,d.jsx)(ej.Radio.Button,{value:"small",children:"小"}),(0,d.jsx)(ej.Radio.Button,{value:"middle",children:"中"}),(0,d.jsx)(ej.Radio.Button,{value:"large",children:"大"})]})}),(0,d.jsx)(ej.Form.Item,{label:"对齐",children:(0,d.jsxs)(ej.Radio.Group,{size:"small",value:t.align,onChange:e=>n("align",e.target.value),children:[(0,d.jsx)(ej.Radio.Button,{value:"start",children:"开始"}),(0,d.jsx)(ej.Radio.Button,{value:"end",children:"结束"}),(0,d.jsx)(ej.Radio.Button,{value:"center",children:"居中"}),(0,d.jsx)(ej.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]),[y,j]=(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)(ej.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:y,onListChange:e=>{Array.isArray(o.children)?o.children=e:o.children.body=e,j(e)}})})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n});return(0,d.jsxs)(ej.Form,{labelCol:{span:12},wrapperCol:{span:12},children:[(0,d.jsx)(ej.Form.Item,{label:"标题",children:(0,d.jsx)(ej.Input,{size:"small",value:t.title,onChange:e=>n("title",e.target.value)})}),(0,d.jsx)(ej.Form.Item,{label:"边框",children:(0,d.jsx)(ej.Switch,{size:"small",checked:!!t.bordered,onChange:e=>n("bordered",e)})}),(0,d.jsx)(ej.Form.Item,{label:"悬停效果",children:(0,d.jsx)(ej.Switch,{size:"small",checked:!!t.hoverable,onChange:e=>n("hoverable",e)})}),(0,d.jsx)(ej.Form.Item,{label:"阴影",children:(0,d.jsx)(ej.Switch,{size:"small",checked:!!t.shadow,onChange:e=>n("shadow",e)})}),(0,d.jsx)(ej.Form.Item,{label:"大小",children:(0,d.jsxs)(ej.Radio.Group,{size:"small",value:t.size,onChange:e=>n("size",e.target.value),children:[(0,d.jsx)(ej.Radio.Button,{value:"default",children:"默认"}),(0,d.jsx)(ej.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:ej.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)(ej.Form,{labelCol:{span:12},wrapperCol:{span:12},children:[(0,d.jsx)(ej.Form.Item,{label:"列间距",children:(0,d.jsx)(ej.InputNumber,{size:"small",value:r[0],min:0,step:4,onChange:e=>n("gutter",[e||0,r[1]])})}),(0,d.jsx)(ej.Form.Item,{label:"行间距",children:(0,d.jsx)(ej.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:ej.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)(ej.Form,{labelCol:{span:12},wrapperCol:{span:12},children:[(0,d.jsx)(ej.Form.Item,{label:"默认列数",children:(0,d.jsx)(ej.InputNumber,{size:"small",value:t.span,min:0,max:24,step:4,onChange:e=>n("span",e||0)})}),(0,d.jsx)(ej.Form.Item,{label:(0,d.jsxs)(d.Fragment,{children:["xs"," ",(0,d.jsx)(ej.Tooltip,{title:"<576px 响应式栅格",children:(0,d.jsx)(tm,{})})]}),children:(0,d.jsx)(ej.InputNumber,{size:"small",value:t.xs,min:0,max:24,step:4,onChange:e=>n("xs",e||0)})}),(0,d.jsx)(ej.Form.Item,{label:(0,d.jsxs)(d.Fragment,{children:["sm"," ",(0,d.jsx)(ej.Tooltip,{title:"≥576px 响应式栅格",children:(0,d.jsx)(tm,{})})]}),children:(0,d.jsx)(ej.InputNumber,{size:"small",value:t.sm,min:0,max:24,step:4,onChange:e=>n("sm",e||0)})}),(0,d.jsx)(ej.Form.Item,{label:(0,d.jsxs)(d.Fragment,{children:["md"," ",(0,d.jsx)(ej.Tooltip,{title:"≥768px 响应式栅格",children:(0,d.jsx)(tm,{})})]}),children:(0,d.jsx)(ej.InputNumber,{size:"small",value:t.md,min:0,max:24,step:4,onChange:e=>n("md",e||0)})}),(0,d.jsx)(ej.Form.Item,{label:(0,d.jsxs)(d.Fragment,{children:["lg"," ",(0,d.jsx)(ej.Tooltip,{title:"≥992px 响应式栅格",children:(0,d.jsx)(tm,{})})]}),children:(0,d.jsx)(ej.InputNumber,{size:"small",value:t.lg,min:0,max:24,step:4,onChange:e=>n("lg",e||0)})}),(0,d.jsx)(ej.Form.Item,{label:(0,d.jsxs)(d.Fragment,{children:["xl"," ",(0,d.jsx)(ej.Tooltip,{title:"≥1200px 响应式栅格",children:(0,d.jsx)(tm,{})})]}),children:(0,d.jsx)(ej.InputNumber,{size:"small",value:t.xl,min:0,max:24,step:4,onChange:e=>n("xl",e||0)})}),(0,d.jsx)(ej.Form.Item,{label:(0,d.jsxs)(d.Fragment,{children:["xxl"," ",(0,d.jsx)(ej.Tooltip,{title:"≥1600px 响应式栅格",children:(0,d.jsx)(tm,{})})]}),children:(0,d.jsx)(ej.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})());
|
|
1114
|
+
`}}},{group:"表单组件",key:"b-input",label:"输入框",icon:"icon-form-input",component:e=>{let{id:t,var:l="",placeholder:n="",prefix:r,suffix:a,size:i,allowClear:o=!1,search:s=!1,item:u,value:p,onChange:m,onSearch:x,style:h={},className:g}=e,{handleCallback:v,setVar:j}=(0,c.useContext)(f),b=e=>{m&&m(e),u&&l&&j(u,l,e)};return s?(0,d.jsx)(ep.Input.Search,{id:t,value:p,size:i,allowClear:o,placeholder:n,onChange:e=>b(e.target.value),onSearch:()=>{x&&x(p||""),v(u)},style:{...h},className:g}):(0,d.jsx)(ep.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=>b(e.target.value),style:{...h},className:g})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n});return(0,d.jsxs)(ep.Form,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,d.jsx)(ep.Form.Item,{label:"搜索框",children:(0,d.jsx)(ep.Switch,{size:"small",checked:!!t.search,onChange:e=>n("search",e)})}),(0,d.jsx)(ep.Form.Item,{label:"变量名",children:(0,d.jsx)(ep.Input,{size:"small",value:t.var,onChange:e=>n("var",e.target.value),placeholder:"请输入变量名"})}),(0,d.jsx)(ep.Form.Item,{label:"占位符",children:(0,d.jsx)(ep.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)(ep.Form.Item,{label:"前缀",children:(0,d.jsx)(ep.Input,{size:"small",value:t.prefix,onChange:e=>n("prefix",e.target.value),placeholder:"请输入前缀"})}),(0,d.jsx)(ep.Form.Item,{label:"后缀",children:(0,d.jsx)(ep.Input,{size:"small",value:t.suffix,onChange:e=>n("suffix",e.target.value),placeholder:"请输入后缀"})})]}),(0,d.jsx)(ep.Form.Item,{label:"大小",children:(0,d.jsxs)(ep.Radio.Group,{size:"small",value:t.size,onChange:e=>n("size",e.target.value),children:[(0,d.jsx)(ep.Radio.Button,{value:"small",children:"小"}),(0,d.jsx)(ep.Radio.Button,{value:"middle",children:"中"}),(0,d.jsx)(ep.Radio.Button,{value:"large",children:"大"})]})}),(0,d.jsx)(ep.Form.Item,{label:"清除图标",children:(0,d.jsx)(ep.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:u=0,item:p,onChange:m,style:x={},className:h}=e,{handleCallback:g,setVar:v}=(0,c.useContext)(f);return(0,d.jsx)(ep.InputNumber,{id:t,value:n,placeholder:a,size:r,min:i,max:o,step:s,precision:u,onChange:e=>{var t;return t=e??void 0,void(m&&m(t),p&&l&&v(p,l,t),g(p))},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)(ep.Form,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,d.jsx)(ep.Form.Item,{label:"变量名",children:(0,d.jsx)(ep.Input,{size:"small",value:t.var,onChange:e=>n("var",e.target.value)})}),(0,d.jsx)(ep.Form.Item,{label:"最小值",children:(0,d.jsx)(ep.InputNumber,{size:"small",value:t.min,onChange:e=>n("min",e)})}),(0,d.jsx)(ep.Form.Item,{label:"最大值",children:(0,d.jsx)(ep.InputNumber,{size:"small",value:t.max,onChange:e=>n("max",e)})}),(0,d.jsx)(ep.Form.Item,{label:"步长",children:(0,d.jsx)(ep.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:u,onChange:p,style:m={},className:x}=e,{handleCallback:h,setVar:g}=(0,c.useContext)(f);return(0,d.jsx)(ep.Select,{id:t,value:u,size:n,placeholder:r,allowClear:a,mode:i?"multiple":void 0,options:o,onChange:e=>{p&&p(e),s&&l&&g(s,l,e),h(s)},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)(ep.Input,{size:"small",value:t.label,onChange:e=>r(l,"label",e.target.value)})},{title:"选项值",dataIndex:"value",render:(e,t,l)=>(0,d.jsx)(ep.Input,{size:"small",value:t.value,onChange:e=>r(l,"value",e.target.value)})},{title:"操作",render:(e,l,r)=>(0,d.jsx)(ep.Space,{children:(0,d.jsx)(ep.Button,{danger:!0,size:"small",onClick:()=>{let e;(e=[...t.options||[]]).splice(r,1),n("options",e)},children:(0,d.jsx)(ed.DeleteOutlined,{})})})}];return(0,d.jsxs)(ep.Form,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,d.jsx)(ep.Form.Item,{label:"变量名",children:(0,d.jsx)(ep.Input,{size:"small",value:t.var,onChange:e=>n("var",e.target.value),placeholder:"请输入变量名"})}),(0,d.jsx)(ep.Form.Item,{label:"占位符",children:(0,d.jsx)(ep.Input,{size:"small",value:t.placeholder,onChange:e=>n("placeholder",e.target.value),placeholder:"请输入占位符"})}),(0,d.jsx)(ep.Form.Item,{label:"大小",children:(0,d.jsxs)(ep.Radio.Group,{size:"small",value:t.size,onChange:e=>n("size",e.target.value),children:[(0,d.jsx)(ep.Radio.Button,{value:"small",children:"小"}),(0,d.jsx)(ep.Radio.Button,{value:"middle",children:"中"}),(0,d.jsx)(ep.Radio.Button,{value:"large",children:"大"})]})}),(0,d.jsx)(ep.Form.Item,{label:"清除图标",children:(0,d.jsx)(ep.Switch,{size:"small",checked:!!t.allowClear,onChange:e=>n("allowClear",e)})}),(0,d.jsx)(ep.Form.Item,{label:"多选",children:(0,d.jsx)(ep.Switch,{size:"small",checked:!!t.multiple,onChange:e=>n("multiple",e)})}),(0,d.jsxs)(ep.Form.Item,{labelCol:{span:24},wrapperCol:{span:24},children:[(0,d.jsx)(ep.Table,{size:"small",dataSource:t.options,columns:a,pagination:!1,rowKey:(e,t)=>String(t),bordered:!0}),(0,d.jsx)(ep.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,{handleCallback:u,setVar:p}=(0,c.useContext)(f);return(0,d.jsx)("span",{id:t,children:(0,d.jsx)(ep.Radio.Group,{id:t,size:n,buttonStyle:"solid",onChange:e=>{var t;return t=e.target.value,void(i&&i(t),a&&l&&p(a,l,t),u(a))},style:o,className:s,children:r.map(e=>(0,d.jsx)(ep.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)(ep.Input,{size:"small",value:t.label,onChange:e=>r(l,"label",e.target.value)})},{title:"选项值",dataIndex:"value",render:(e,t,l)=>(0,d.jsx)(ep.Input,{size:"small",value:t.value,onChange:e=>r(l,"value",e.target.value)})},{title:"操作",render:(e,l,r)=>(0,d.jsx)(ep.Space,{children:(0,d.jsx)(ep.Button,{danger:!0,size:"small",onClick:()=>{let e;(e=[...t.options||[]]).splice(r,1),n("options",e)},children:(0,d.jsx)(ed.DeleteOutlined,{})})})}];return(0,d.jsxs)(ep.Form,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,d.jsx)(ep.Form.Item,{label:"变量名",children:(0,d.jsx)(ep.Input,{size:"small",value:t.var,onChange:e=>n("var",e.target.value),placeholder:"请输入变量名"})}),(0,d.jsx)(ep.Form.Item,{label:"大小",children:(0,d.jsxs)(ep.Radio.Group,{size:"small",value:t.size,onChange:e=>n("size",e.target.value),children:[(0,d.jsx)(ep.Radio.Button,{value:"small",children:"小"}),(0,d.jsx)(ep.Radio.Button,{value:"middle",children:"中"}),(0,d.jsx)(ep.Radio.Button,{value:"large",children:"大"})]})}),(0,d.jsxs)(ep.Form.Item,{labelCol:{span:24},wrapperCol:{span:24},children:[(0,d.jsx)(ep.Table,{size:"small",dataSource:t.options,columns:a,pagination:!1,rowKey:(e,t)=>String(t),bordered:!0}),(0,d.jsx)(ep.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:u}=e,{handleCallback:p,setVar:m}=(0,c.useContext)(f),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)(ep.Checkbox.Group,{onChange:e=>{o&&o(e),i&&l&&m(i,l,e),p(i)},style:x,className:u,children:a.map(e=>(0,d.jsx)(ep.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)(ep.Input,{size:"small",value:t.label,onChange:e=>r(l,"label",e.target.value)})},{title:"选项值",dataIndex:"value",render:(e,t,l)=>(0,d.jsx)(ep.Input,{size:"small",value:t.value,onChange:e=>r(l,"value",e.target.value)})},{title:"操作",render:(e,l,r)=>(0,d.jsx)(ep.Space,{children:(0,d.jsx)(ep.Button,{danger:!0,size:"small",onClick:()=>{let e;(e=[...t.options||[]]).splice(r,1),n("options",e)},children:(0,d.jsx)(ed.DeleteOutlined,{})})})}];return(0,d.jsxs)(ep.Form,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,d.jsx)(ep.Form.Item,{label:"变量名",children:(0,d.jsx)(ep.Input,{size:"small",value:t.var,onChange:e=>n("var",e.target.value),placeholder:"请输入变量名"})}),(0,d.jsx)(ep.Form.Item,{label:"布局",children:(0,d.jsxs)(ep.Radio.Group,{size:"small",value:t.layout,onChange:e=>n("layout",e.target.value),children:[(0,d.jsx)(ep.Radio.Button,{value:"horizontal",children:"水平"}),(0,d.jsx)(ep.Radio.Button,{value:"vertical",children:"垂直"}),(0,d.jsx)(ep.Radio.Button,{value:"grid",children:"网格"})]})}),"grid"===t.layout&&(0,d.jsx)(ep.Form.Item,{label:"网格行数",children:(0,d.jsx)(ep.InputNumber,{size:"small",value:t.lineNumber,onChange:e=>n("lineNumber",e),min:1,max:10})}),(0,d.jsxs)(ep.Form.Item,{labelCol:{span:24},wrapperCol:{span:24},children:[(0,d.jsx)(ep.Table,{size:"small",dataSource:t.options,columns:a,pagination:!1,rowKey:(e,t)=>String(t),bordered:!0}),(0,d.jsx)(ep.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:u,style:p={},className:m}=e,{handleCallback:x,setVar:h}=(0,c.useContext)(f),g=e=>{u&&u(e),s&&l&&h(s,l,e),x(s)};if("time"===a){let e="string"==typeof o&&o?tk()(o,"HH:mm"):void 0;return(0,d.jsx)(ep.TimePicker,{id:t,value:e,format:"HH:mm",placeholder:"请选择时间",size:n,allowClear:r,onChange:e=>g(e?e.format("HH:mm"):void 0),style:{...(null==s?void 0:s.style)||{},...p},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)(ep.DatePicker,{id:t,picker:a,value:l,format:e,placeholder:"month"===a?"请选择月份":"请选择年份",size:n,allowClear:r,onChange:t=>g(t?t.format(e):void 0),onPanelChange:t=>g(t?t.format(e):void 0),style:{...(null==s?void 0:s.style)||{},...p},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)(ep.DatePicker.RangePicker,{id:t,value:[l,a],format:e,placeholder:["开始日期","结束日期"],size:n,allowClear:r,showTime:i,onChange:t=>g(t&&t[0]&&t[1]?[t[0].format(e),t[1].format(e)]:void 0),style:{...(null==s?void 0:s.style)||{},...p},className:m})}let v=i?"YYYY-MM-DD HH:mm":"YYYY-MM-DD",j="string"==typeof o&&o?tk()(o,v):void 0;return(0,d.jsx)(ep.DatePicker,{id:t,value:j,format:v,placeholder:"请选择日期",size:n,allowClear:r,showTime:i,style:{...(null==s?void 0:s.style)||{},...p},className:m,onChange:e=>g(e?e.format(v):void 0)})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n});return(0,d.jsxs)(ep.Form,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,d.jsx)(ep.Form.Item,{label:"变量名",children:(0,d.jsx)(ep.Input,{size:"small",value:t.var,onChange:e=>n("var",e.target.value),placeholder:"请输入变量名"})}),(0,d.jsx)(ep.Form.Item,{label:"类型",children:(0,d.jsxs)(ep.Radio.Group,{size:"small",value:t.type,onChange:e=>n("type",e.target.value),children:[(0,d.jsx)(ep.Radio.Button,{value:"date",children:"日期"}),(0,d.jsx)(ep.Radio.Button,{value:"time",children:"时间"}),(0,d.jsx)(ep.Radio.Button,{value:"month",children:"月份"}),(0,d.jsx)(ep.Radio.Button,{value:"year",children:"年份"}),(0,d.jsx)(ep.Radio.Button,{value:"range",children:"日期范围"})]})}),(0,d.jsx)(ep.Form.Item,{label:"大小",children:(0,d.jsxs)(ep.Radio.Group,{size:"small",value:t.size,onChange:e=>n("size",e.target.value),children:[(0,d.jsx)(ep.Radio.Button,{value:"small",children:"小"}),(0,d.jsx)(ep.Radio.Button,{value:"middle",children:"中"}),(0,d.jsx)(ep.Radio.Button,{value:"large",children:"大"})]})}),(0,d.jsx)(ep.Form.Item,{label:"清除图标",children:(0,d.jsx)(ep.Switch,{size:"small",checked:!!t.allowClear,onChange:e=>n("allowClear",e)})}),(0,d.jsx)(ep.Form.Item,{label:"显示时间",children:(0,d.jsx)(ep.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:u,style:p={},className:m}=e,{handleCallback:x,setVar:h}=(0,c.useContext)(f);return(0,d.jsx)("span",{children:(0,d.jsx)(ep.Switch,{id:t,checked:n,disabled:r,size:"small"===a?"small":void 0,checkedChildren:i,unCheckedChildren:o,onChange:e=>{u&&u(e),s&&l&&h(s,l,e),x(s)},style:p,className:m})})},formComponent:e=>{let{model:t,onChange:l}=e;return(0,d.jsx)(ep.Form,{labelCol:{span:6},wrapperCol:{span:18},children:(0,d.jsx)(ep.Form.Item,{label:"变量名",children:(0,d.jsx)(ep.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,ancestors:i,style:o={},className:s}=e,[u,p]=(0,c.useState)(a.children||[]),m=(0,c.useMemo)(()=>({...o,...a.style||{},alignItems:l,flexDirection:r,gap:n}),[a,l,n,r]);return(0,c.useEffect)(()=>{p(a.children||[])},[a.children]),(0,d.jsx)(ew,{rootComponent:ep.Space,rootData:{id:t,style:m,className:s},item:a,ancestors:[...i,a],list:u,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,d.jsxs)(ep.Form,{labelCol:{span:6},wrapperCol:{span:18},children:[(0,d.jsx)(ep.Form.Item,{label:"方向",children:(0,d.jsxs)(ep.Radio.Group,{size:"small",value:t.direction,onChange:e=>n("direction",e.target.value),children:[(0,d.jsx)(ep.Radio.Button,{value:"horizontal",children:"水平"}),(0,d.jsx)(ep.Radio.Button,{value:"vertical",children:"垂直"})]})}),(0,d.jsx)(ep.Form.Item,{label:"大小",children:(0,d.jsxs)(ep.Radio.Group,{size:"small",value:t.size,onChange:e=>n("size",e.target.value),children:[(0,d.jsx)(ep.Radio.Button,{value:"small",children:"小"}),(0,d.jsx)(ep.Radio.Button,{value:"middle",children:"中"}),(0,d.jsx)(ep.Radio.Button,{value:"large",children:"大"})]})}),(0,d.jsx)(ep.Form.Item,{label:"对齐",children:(0,d.jsxs)(ep.Radio.Group,{size:"small",value:t.align,onChange:e=>n("align",e.target.value),children:[(0,d.jsx)(ep.Radio.Button,{value:"start",children:"开始"}),(0,d.jsx)(ep.Radio.Button,{value:"end",children:"结束"}),(0,d.jsx)(ep.Radio.Button,{value:"center",children:"居中"}),(0,d.jsx)(ep.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,ancestors:s,style:u,className:p}=e,m=(0,c.useMemo)(()=>!o.children||Array.isArray(o.children)||"object"!=typeof o.children?null:o.children.title||[],[o]),[x,h]=(0,c.useState)(m||[]),f=(0,c.useMemo)(()=>!o.children||Array.isArray(o.children)||"object"!=typeof o.children?null:o.children.extra||[],[o]),[g,v]=(0,c.useState)(f||[]),j=(0,c.useMemo)(()=>o.children?Array.isArray(o.children)?o.children:"object"!=typeof o.children?null:o.children.body||[]:null,[o]),[b,y]=(0,c.useState)(j||[]),w=(0,c.useMemo)(()=>!o.children||Array.isArray(o.children)||"object"!=typeof o.children?null:o.children.actions||[],[o]),[C,S]=(0,c.useState)(w||[]);return(0,c.useEffect)(()=>{h(m||[])},[m]),(0,c.useEffect)(()=>{v(f||[])},[f]),(0,c.useEffect)(()=>{y(j||[])},[j]),(0,c.useEffect)(()=>{S(w||[])},[w]),(0,d.jsx)(ep.Card,{id:t,variant:l?"outlined":"borderless",size:n,hoverable:a,className:[i?"ant-card-shadow":void 0,p].filter(Boolean).join(" "),title:(null==r?void 0:r.length)&&!(null==m?void 0:m.length)?r:m?(0,d.jsx)(ew,{ancestors:[...s,o],list:x,onListChange:e=>{o.children.title=e,h(e)}}):r,extra:f&&(0,d.jsx)(ew,{ancestors:[...s,o],list:g,onListChange:e=>{o.children.extra=e,v(e)}}),actions:w&&[(0,d.jsx)(ew,{ancestors:[...s,o],list:C,onListChange:e=>{o.children.actions=e,S(e)}})],styles:{header:{borderBottom:"none"}},style:u,children:j&&(0,d.jsx)(ew,{ancestors:[...s,o],list:b,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)(ep.Form,{labelCol:{span:12},wrapperCol:{span:12},children:[(0,d.jsx)(ep.Form.Item,{label:"标题",children:(0,d.jsx)(ep.Input,{size:"small",value:t.title,onChange:e=>n("title",e.target.value)})}),(0,d.jsx)(ep.Form.Item,{label:"边框",children:(0,d.jsx)(ep.Switch,{size:"small",checked:!!t.bordered,onChange:e=>n("bordered",e)})}),(0,d.jsx)(ep.Form.Item,{label:"悬停效果",children:(0,d.jsx)(ep.Switch,{size:"small",checked:!!t.hoverable,onChange:e=>n("hoverable",e)})}),(0,d.jsx)(ep.Form.Item,{label:"阴影",children:(0,d.jsx)(ep.Switch,{size:"small",checked:!!t.shadow,onChange:e=>n("shadow",e)})}),(0,d.jsx)(ep.Form.Item,{label:"大小",children:(0,d.jsxs)(ep.Radio.Group,{size:"small",value:t.size,onChange:e=>n("size",e.target.value),children:[(0,d.jsx)(ep.Radio.Button,{value:"default",children:"默认"}),(0,d.jsx)(ep.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,ancestors:r,style:a,className:i}=e,[o,s]=(0,c.useState)(n.children||[]);return(0,c.useEffect)(()=>{s(n.children||[])},[n.children]),(0,d.jsx)(ew,{rootComponent:ep.Row,rootData:{id:t,gutter:l,style:n.style||a,className:n.className||i},item:n,ancestors:[...r,n],list:o,onListChange:e=>{n.children=e,s(e)}})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n}),r=t.gutter||[0,0];return(0,d.jsxs)(ep.Form,{labelCol:{span:12},wrapperCol:{span:12},children:[(0,d.jsx)(ep.Form.Item,{label:"列间距",children:(0,d.jsx)(ep.InputNumber,{size:"small",value:r[0],min:0,step:4,onChange:e=>n("gutter",[e||0,r[1]])})}),(0,d.jsx)(ep.Form.Item,{label:"行间距",children:(0,d.jsx)(ep.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:u,ancestors:p,style:m={},className:x}=e,{deviceWidth:h}=(0,c.useContext)(f),[g,v]=(0,c.useState)(u.children||[]),j=(0,c.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,c.useEffect)(()=>{v(u.children||[])},[u.children]),(0,d.jsx)(ew,{rootComponent:ep.Col,rootData:{id:t||u.id,span:j,style:{...u.style||{},...m},className:x},item:u,ancestors:[...p,u],list:g,onListChange:e=>{u.children=e,v(e)}})},formComponent:e=>{let{model:t,onChange:l}=e,n=(e,n)=>l&&l({...t,[e]:n});return(0,d.jsxs)(ep.Form,{labelCol:{span:12},wrapperCol:{span:12},children:[(0,d.jsx)(ep.Form.Item,{label:"默认列数",children:(0,d.jsx)(ep.InputNumber,{size:"small",value:t.span,min:0,max:24,step:4,onChange:e=>n("span",e||0)})}),(0,d.jsx)(ep.Form.Item,{label:(0,d.jsxs)(d.Fragment,{children:["xs"," ",(0,d.jsx)(ep.Tooltip,{title:"<576px 响应式栅格",children:(0,d.jsx)(tp,{})})]}),children:(0,d.jsx)(ep.InputNumber,{size:"small",value:t.xs,min:0,max:24,step:4,onChange:e=>n("xs",e||0)})}),(0,d.jsx)(ep.Form.Item,{label:(0,d.jsxs)(d.Fragment,{children:["sm"," ",(0,d.jsx)(ep.Tooltip,{title:"≥576px 响应式栅格",children:(0,d.jsx)(tp,{})})]}),children:(0,d.jsx)(ep.InputNumber,{size:"small",value:t.sm,min:0,max:24,step:4,onChange:e=>n("sm",e||0)})}),(0,d.jsx)(ep.Form.Item,{label:(0,d.jsxs)(d.Fragment,{children:["md"," ",(0,d.jsx)(ep.Tooltip,{title:"≥768px 响应式栅格",children:(0,d.jsx)(tp,{})})]}),children:(0,d.jsx)(ep.InputNumber,{size:"small",value:t.md,min:0,max:24,step:4,onChange:e=>n("md",e||0)})}),(0,d.jsx)(ep.Form.Item,{label:(0,d.jsxs)(d.Fragment,{children:["lg"," ",(0,d.jsx)(ep.Tooltip,{title:"≥992px 响应式栅格",children:(0,d.jsx)(tp,{})})]}),children:(0,d.jsx)(ep.InputNumber,{size:"small",value:t.lg,min:0,max:24,step:4,onChange:e=>n("lg",e||0)})}),(0,d.jsx)(ep.Form.Item,{label:(0,d.jsxs)(d.Fragment,{children:["xl"," ",(0,d.jsx)(ep.Tooltip,{title:"≥1200px 响应式栅格",children:(0,d.jsx)(tp,{})})]}),children:(0,d.jsx)(ep.InputNumber,{size:"small",value:t.xl,min:0,max:24,step:4,onChange:e=>n("xl",e||0)})}),(0,d.jsx)(ep.Form.Item,{label:(0,d.jsxs)(d.Fragment,{children:["xxl"," ",(0,d.jsx)(ep.Tooltip,{title:"≥1600px 响应式栅格",children:(0,d.jsx)(tp,{})})]}),children:(0,d.jsx)(ep.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})());
|