@alifd/adaptor-render
Advanced tools
Comparing version 0.5.2 to 0.5.3
@@ -13,3 +13,4 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray"; | ||
onError = _ref.onError, | ||
onLoad = _ref.onLoad; | ||
onLoad = _ref.onLoad, | ||
onDragStart = _ref.onDragStart; | ||
var index = 0; | ||
@@ -49,3 +50,4 @@ var count = demos.length; | ||
height: height, | ||
node: node | ||
node: node, | ||
onDragStart: onDragStart | ||
}); | ||
@@ -67,3 +69,3 @@ }))); | ||
export default (function (name, themeId) { | ||
export default (function (name, themeId, onDragStart) { | ||
var demos = getSnapshotDemos(name); | ||
@@ -77,2 +79,3 @@ var mountNode = createMountedNode(); | ||
onError: reject, | ||
onDragStart: onDragStart, | ||
onLoad: function onLoad() { | ||
@@ -79,0 +82,0 @@ return resolve({ |
{ | ||
"name": "@alifd/adaptor-render", | ||
"version": "0.5.2", | ||
"version": "0.5.3", | ||
"main": "umd/react/adaptor-render.development.js", | ||
@@ -5,0 +5,0 @@ "unpkg": "umd/react/adaptor-render.production.min.js", |
@@ -8,3 +8,3 @@ import React, { useState } from 'react'; | ||
const Demos = ({ demos = [], themeId, onError, onLoad }) => { | ||
const Demos = ({ demos = [], themeId, onError, onLoad, onDragStart }) => { | ||
let index = 0; | ||
@@ -30,5 +30,13 @@ let count = demos.length; | ||
demos.map(({ node, background, height }, index) => { | ||
return ( | ||
<Demo id={index} key={index} onLoad={handleLoad} themeId={themeId} background={background} height={height} node={node} /> | ||
<Demo | ||
id={index} | ||
key={index} | ||
onLoad={handleLoad} | ||
themeId={themeId} | ||
background={background} | ||
height={height} | ||
node={node} | ||
onDragStart={onDragStart} | ||
/> | ||
); | ||
@@ -54,3 +62,3 @@ }) | ||
export default (name, themeId) => { | ||
export default (name, themeId, onDragStart) => { | ||
const demos = getSnapshotDemos(name); | ||
@@ -62,4 +70,4 @@ const mountNode = createMountedNode(); | ||
return new Promise((resolve, reject) => { | ||
ReactDOM.render(<Demos demos={demos} themeId={themeId} onError={reject} onLoad={() => resolve({ height: mountNode.offsetHeight })} />, mountNode) | ||
ReactDOM.render(<Demos demos={demos} themeId={themeId} onError={reject} onDragStart={onDragStart} onLoad={() => resolve({ height: mountNode.offsetHeight })} />, mountNode) | ||
}); | ||
}; |
@@ -1665,3 +1665,4 @@ (function (global, factory) { | ||
onError = _ref.onError, | ||
onLoad = _ref.onLoad; | ||
onLoad = _ref.onLoad, | ||
onDragStart = _ref.onDragStart; | ||
var index = 0; | ||
@@ -1701,3 +1702,4 @@ var count = demos.length; | ||
height: height, | ||
node: node | ||
node: node, | ||
onDragStart: onDragStart | ||
}); | ||
@@ -1719,3 +1721,3 @@ }))); | ||
var snapshot = (function (name, themeId) { | ||
var snapshot = (function (name, themeId, onDragStart) { | ||
var demos = getSnapshotDemos(name); | ||
@@ -1729,2 +1731,3 @@ var mountNode = createMountedNode$1(); | ||
onError: reject, | ||
onDragStart: onDragStart, | ||
onLoad: function onLoad() { | ||
@@ -1731,0 +1734,0 @@ return resolve({ |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],e):(t=t||self).AdaptorRender=e(t.React,t.ReactDOM)}(this,function(p,c){"use strict";var d="default"in p?p.default:p;c=c&&c.hasOwnProperty("default")?c.default:c;var t,r=(function(t){var e=function(a){var u,t=Object.prototype,l=t.hasOwnProperty,e="function"==typeof Symbol?Symbol:{},o=e.iterator||"@@iterator",r=e.asyncIterator||"@@asyncIterator",n=e.toStringTag||"@@toStringTag";function i(t,e,r,n){var o=e&&e.prototype instanceof c?e:c,a=Object.create(o.prototype),i=new k(n||[]);return a._invoke=function(a,i,c){var u=f;return function(t,e){if(u===d)throw new Error("Generator is already running");if(u===h){if("throw"===t)throw e;return L()}for(c.method=t,c.arg=e;;){var r=c.delegate;if(r){var n=O(r,c);if(n){if(n===m)continue;return n}}if("next"===c.method)c.sent=c._sent=c.arg;else if("throw"===c.method){if(u===f)throw u=h,c.arg;c.dispatchException(c.arg)}else"return"===c.method&&c.abrupt("return",c.arg);u=d;var o=s(a,i,c);if("normal"===o.type){if(u=c.done?h:p,o.arg===m)continue;return{value:o.arg,done:c.done}}"throw"===o.type&&(u=h,c.method="throw",c.arg=o.arg)}}}(t,r,i),a}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}a.wrap=i;var f="suspendedStart",p="suspendedYield",d="executing",h="completed",m={};function c(){}function v(){}function y(){}var g={};g[o]=function(){return this};var C=Object.getPrototypeOf,b=C&&C(C(j([])));b&&b!==t&&l.call(b,o)&&(g=b);var w=y.prototype=c.prototype=Object.create(g);function E(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function x(u){var e;this._invoke=function(r,n){function t(){return new Promise(function(t,e){!function e(t,r,n,o){var a=s(u[t],u,r);if("throw"!==a.type){var i=a.arg,c=i.value;return c&&"object"==typeof c&&l.call(c,"__await")?Promise.resolve(c.__await).then(function(t){e("next",t,n,o)},function(t){e("throw",t,n,o)}):Promise.resolve(c).then(function(t){i.value=t,n(i)},function(t){return e("throw",t,n,o)})}o(a.arg)}(r,n,t,e)})}return e=e?e.then(t,t):t()}}function O(t,e){var r=t.iterator[e.method];if(r===u){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=u,O(t,e),"throw"===e.method))return m;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return m}var n=s(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,m;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=u),e.delegate=null,m):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,m)}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function k(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function j(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,n=function t(){for(;++r<e.length;)if(l.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=u,t.done=!0,t};return n.next=n}}return{next:L}}function L(){return{value:u,done:!0}}return v.prototype=w.constructor=y,y.constructor=v,y[n]=v.displayName="GeneratorFunction",a.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,n in t||(t[n]="GeneratorFunction")),t.prototype=Object.create(w),t},a.awrap=function(t){return{__await:t}},E(x.prototype),x.prototype[r]=function(){return this},a.AsyncIterator=x,a.async=function(t,e,r,n){var o=new x(i(t,e,r,n));return a.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},E(w),w[n]="Generator",w[o]=function(){return this},w.toString=function(){return"[object Generator]"},a.keys=function(r){var n=[];for(var t in r)n.push(t);return n.reverse(),function t(){for(;n.length;){var e=n.pop();if(e in r)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=j,k.prototype={constructor:k,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=u,this.done=!1,this.delegate=null,this.method="next",this.arg=u,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&l.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=u)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var n=this;function t(t,e){return a.type="throw",a.arg=r,n.next=t,e&&(n.method="next",n.arg=u),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var o=this.tryEntries[e],a=o.completion;if("root"===o.tryLoc)return t("end");if(o.tryLoc<=this.prev){var i=l.call(o,"catchLoc"),c=l.call(o,"finallyLoc");if(i&&c){if(this.prev<o.catchLoc)return t(o.catchLoc,!0);if(this.prev<o.finallyLoc)return t(o.finallyLoc)}else if(i){if(this.prev<o.catchLoc)return t(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return t(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;0<=r;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&l.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),_(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;_(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:j(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=u),m}},a}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}}(t={exports:{}},t.exports),t.exports);function y(o){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{},e=Object.keys(a);"function"==typeof Object.getOwnPropertySymbols&&(e=e.concat(Object.getOwnPropertySymbols(a).filter(function(t){return Object.getOwnPropertyDescriptor(a,t).enumerable}))),e.forEach(function(t){var e,r,n;e=o,n=a[r=t],r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n})}return o}function u(t,e,r,n,o,a,i){try{var c=t[a](i),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}var e,n,o,a,i,l;Object.keys({"-":"disabled","*":"active","~":"hover","":"normal"}).forEach(function(t){}),(n=e||(e={})).divider="divider",n.node="node",n.comment="comment",(a=o||(o={})).text="text",a.icon="icon",(l=i||(i={})).enum="enum",l.string="string",l.number="number",l.bool="bool",l.node="node",l.nodeList="node-list";function s(t){return t.replace(/\B([A-Z])/g,"-$1").split(/[-|_]/).map(function(t){return function(t){return t?[t.substring(0,1).toUpperCase(),t.substring(1)].join(""):""}(t)}).join(" ")}var g=i;function f(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),n.forEach(function(t){h(e,t,r[t])})}return e}function h(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}for(var m=function(){return(0<arguments.length&&void 0!==arguments[0]?arguments[0]:[]).filter(function(t){return!!t}).map(function(t){return f({},t,{label:t.label||s(t.name),options:function(){return(0<arguments.length&&void 0!==arguments[0]?arguments[0]:[]).filter(function(t){return!!t}).map(function(t){var e=t.value||t;return{value:e,label:t.label||s(e)}})}(t.options)})})},v=function(r){if(!r.name)return console.error("[error] muse be have name:"),r;var t;t=!r.shape||!Array.isArray(r.shape)||r.shape.length<1?[{label:r.name,value:"normal"}]:r.shape.filter(function(t){return!!t}).map(function(t){var e=t.value||t;return{value:e,label:t.label||"".concat(s(e)," ").concat("normal"===e?"":r.name)}});return f({},r,{shape:t,editor:function(t){var e=r.editor?r.editor(t):{};return e.props||(e.props=[]),e.nodes||(e.nodes=[]),f({},e,{props:m(e.props),nodes:m(e.nodes)})},content:function(t){var e=r.content?r.content(t):{};return f({},e,{options:m(e.options)})}})},C=function(t,e){var r=t.editor(e),n={shape:e,data:r.data&&r.data.default||""};return r.props.forEach(function(t){var e=t.default;if(null==e)switch(t.type){case g.string:e="";break;case g.number:e=0;break;case g.bool:e=!1;break;case g.enum:e=t.options?t.options[0].value:""}n[t.name]=e}),r.nodes.forEach(function(t){var e=t.name,r=t.default;n[e]=r}),n},b=function(e){return(1<arguments.length&&void 0!==arguments[1]?arguments[1]:[]).find(function(t){return t.name===e})},w=((new Date).getTime(),[]),E=[],x=0;x<256;x+=1)E[x]=(x<16?"0":"")+x.toString(16);function O(){return function(){var t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,r=4294967295*Math.random()|0,n=4294967295*Math.random()|0;return"".concat(E[255&t]+E[t>>8&255]+E[t>>16&255]+E[t>>24&255],"-").concat(E[255&e]).concat(E[e>>8&255],"-").concat(E[e>>16&15|64]).concat(E[e>>24&255],"-").concat(E[63&r|128]).concat(E[r>>8&255],"-").concat(E[r>>16&255]).concat(E[r>>24&255]).concat(E[255&n]).concat(E[n>>8&255]).concat(E[n>>16&255]).concat(E[n>>24&255])}()}function S(e){return w.find(function(t){return t.name===e})}function _(t){var l=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},s=2<arguments.length?arguments[2]:void 0,f=3<arguments.length?arguments[3]:void 0,p=4<arguments.length&&void 0!==arguments[4]?arguments[4]:"",e=5<arguments.length?arguments[5]:void 0,d=6<arguments.length&&void 0!==arguments[6]?arguments[6]:{},r=S(t);if(!r)return null;var n=l.shape,o=void 0===n?"normal":n,h=r.editor(o),a=C(r,o);l=y({},a,l);var m={},v={};return Object.keys(l).forEach(function(a){var t=l[a],e=(b(a,h.props)||{}).type;switch(void 0===e?"any":e){case g.node:if(!t||!t.adaptor)return;var r=t.id||O(),n=[p,a].filter(function(t){return!!t}).join("-"),o={};v[a]=_(t.adaptor,t.props,s,r,n,a,o),m[a]=y({adaptor:t.adaptor,label:t.label,propName:a,id:r,path:n},f?{}:{props:o}),d[a]={adaptor:t.adaptor,label:t.label,propName:a,id:r,path:n,props:o};break;case g.nodeList:if(!t||!Array.isArray(t)||0===t.length||0===t.filter(function(t){return t&&t.adaptor}).length)return;var i=[],c=[],u=[];t.filter(function(t){return t&&t.adaptor}).forEach(function(t,e){var r=t.id||O(),n="".concat(p||"").concat(p?"-":"").concat(a,"_").concat(e),o={};i.push(_(t.adaptor,t.props,s,r,n,a,o)),c.push(y({adaptor:t.adaptor,label:t.label,propName:a,id:r,path:n,index:e.toString()},f?{}:{props:o})),u.push({adaptor:t.adaptor,label:t.label,propName:a,id:r,path:n,index:e.toString(),props:o})}),v[a]=i,m[a]=c,d[a]=u;break;default:v[a]=t,m[a]=t,d[a]=t}}),r.adaptor(y({},v,{"data-fusioncool":JSON.stringify(y({name:t,props:m,type:"adaptor-component",root:!p,themeId:String(s)},e?{propName:e}:{},p?{path:p}:{}))},f?{"data-id":f}:{}))}var k=function(){var e=function(c){return function(){var t=this,i=arguments;return new Promise(function(e,r){var n=c.apply(t,i);function o(t){u(n,e,r,o,a,"next",t)}function a(t){u(n,e,r,o,a,"throw",t)}o(void 0)})}}(r.mark(function t(e){return r.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(window.Adaptors&&Object.keys(window.Adaptors).forEach(function(t){w.push(y({},v(window.Adaptors[t]),{type:"basic"}))}),e)return t.next=4,Promise.all(e.map(function(t){var e=t.name,r=t.script,n=t.stylesheet;if(r){var o,a,i=[];return i.push((o=r,new Promise(function(t,e){var r=document.createElement("script");r.type="text/javascript",r.setAttribute("crossorigin",!0),r.onload=t,r.onerror=e,r.src=o,document.body.appendChild(r)})).then(function(){window.Adaptor&&(w.push(y({},v(window.Adaptor),{type:"expanded"})),window.Adaptor=null)}).catch(function(){console.error("[".concat(e,"] script (").concat(r,") load error ! please contact the developer"))})),n&&i.push((a=n,new Promise(function(t,e){var r=document.createElement("link");r.rel="stylesheet",r.type="text/css",r.onload=t,r.onerror=e,r.href=a,document.head.appendChild(r)})).catch(function(){console.error("[".concat(e,"] stylesheet (").concat(n,") load error ! please contact the developer"))})),Promise.all(i)}}));t.next=4;break;case 4:case"end":return t.stop()}},t)}));return function(t){return e.apply(this,arguments)}}();function j(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function L(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function P(t,e,r){return e&&L(t.prototype,e),r&&L(t,r),t}function A(t){return(A="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function M(t){return(M="function"==typeof Symbol&&"symbol"===A(Symbol.iterator)?function(t){return A(t)}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":A(t)})(t)}function N(t,e){return!e||"object"!==M(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function D(t){return(D=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function I(t,e){return(I=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function T(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&I(t,e)}var F=function(t){function r(t){var e;return j(this,r),(e=N(this,D(r).call(this,t))).state={hasError:!1},e}return T(r,p.Component),P(r,[{key:"componentDidCatch",value:function(t,e){this.props.onError(t,e)}},{key:"render",value:function(){return this.state.hasError?d.createElement("div",{className:"__error__"}," This demo is running incorrectly, please contact the developer. "):this.props.children}}],[{key:"getDerivedStateFromError",value:function(){return{hasError:!0}}}]),r}();F.defaultProps={onError:function(){}};function G(n){function r(t){var e=t.onError,r=_(n,o,a);return d.createElement(F,{onError:e},r)}var o=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},a=2<arguments.length?arguments[2]:void 0,i=function(){var t=document.getElementById("mount-node");return t||((t=document.createElement("div")).setAttribute("id","mount-node"),"undefined"!=typeof window&&"watch"!==window.__ENV__&&(t.style.position="fixed",t.style.left="-1000px",t.style.top="-1000px"),document.body.appendChild(t)),t}();return new Promise(function(t,e){c.render(d.createElement(r,{onError:e}),i,function(){i.querySelector(".__error__")||setTimeout(function(){t(i.firstElementChild)},50)})})}function R(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=[],n=!0,o=!1,a=void 0;try{for(var i,c=t[Symbol.iterator]();!(n=(i=c.next()).done)&&(r.push(i.value),!e||r.length!==e);n=!0);}catch(t){o=!0,a=t}finally{try{n||null==c.return||c.return()}finally{if(o)throw a}}return r}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var B=function(t){function e(t){var o;return j(this,e),(o=N(this,D(e).call(this,t))).saveRef=function(t){o.demo=t},o.handleDragStart=function(){var t=o.props,e=t.onDragStart,r=t.node,n=t.themeId;return G(r.adaptor,r.props,n).then(e)},o.state={scale:1,height:t.height||"auto",loaded:!1,error:!1},o}return T(e,p.Component),P(e,[{key:"componentDidCatch",value:function(t,e){this.props.onError(t,e)}},{key:"componentDidMount",value:function(){var t=this;setTimeout(function(){t.computeScale()},50)}},{key:"computeScale",value:function(){var t=this.props.onLoad,e=1,r=this.state.height;if(this.demo){var n=c.findDOMNode(this.demo),o=n.firstElementChild;1<(e=(n.offsetWidth-20)/o.offsetWidth)&&(e=1),r=this.props.height?this.props.height*e:o.offsetHeight*e+20}this.setState({loaded:!0,scale:e,height:r},function(){t()})}},{key:"render",value:function(){var t=this.props,e=t.background,r=t.node,n=t.themeId,o=this.state,a=o.scale,i=o.height,c=o.loaded,u=o.error,l=_(r.adaptor,r.props||{},n);if(!l)return null;if(u)return d.createElement("div",null," This demo is running incorrectly, please contact the developer ");return d.createElement("div",{ref:this.saveRef,style:{background:e,height:i||"auto",padding:10,overflow:"hidden",position:"relative",display:"flex",flexDirection:"row",alignItems:"flex-start",justifyContent:"flex-start",visibility:c?"":"hidden"}},d.cloneElement(l,{style:y({transform:"scale(".concat(a,")"),transformOrigin:"top left",flexShrink:0,flexGrow:0,position:"relative"},l.props.style||{})}),d.createElement("img",{onDragStart:this.handleDragStart,draggable:!0,alt:"drag layer",src:function(t,e,r,n){var o=!(4<arguments.length&&void 0!==arguments[4])||arguments[4];return'data:image/svg+xml;charset=UTF-8,<svg width="'.concat(t,'px" height="').concat(e,'px" viewBox="0 0 ').concat(t," ").concat(e,'" version="1.1" xmlns="http://www.w3.org/2000/svg"><rect stroke="none" fill="none" id=\'__magic:FC_').concat(r,",").concat(n,'\' x="0" y="0" width="').concat(t,'" height="').concat(e,'" />\n ').concat(o?'<g id="loading" transform="translate('.concat(t/2-27,", ").concat(e/2-25,')" fill="#5A5A5A" opacity="0.5">\n <text id="text" font-family="PingFangSC-Regular, PingFang SC" font-size="16" font-weight="normal">\n <tspan x="0" y="45">Loading</tspan>\n </text>\n <g id="icon" transform="translate(18.000000, 0.000000)" fill-rule="nonzero">\n <path d="M14.3390969,12.0749978 C14.3390969,12.1289011 14.3881236,12.1779078 14.441947,12.1779078 C14.4957704,12.1779078 14.5447771,12.1289011 14.5447771,12.0749978 C14.5447771,12.0211744 14.4958303,11.9720678 14.441947,11.9720678 C14.3881636,11.9720478 14.3390969,12.0211544 14.3390969,12.0749978 M12.0693204,14.4193036 C12.0693204,14.4730071 12.0913854,14.5262309 12.1292396,14.5641052 C12.1670739,14.6019994 12.2202777,14.6240644 12.2737813,14.6240644 C12.3274249,14.6240644 12.3805887,14.6019994 12.418403,14.5641052 C12.4562173,14.526211 12.4783223,14.4729671 12.4783223,14.4193036 C12.4783223,14.3657201 12.4562373,14.3124763 12.418403,14.274662 C12.3805687,14.2367678 12.3273649,14.2146828 12.2737813,14.2146828 C12.2202178,14.2146828 12.1670539,14.2367478 12.1292396,14.274662 C12.0913654,14.3124763 12.0693204,14.3657201 12.0693204,14.4193036 M9.00980084,15.626023 C9.00980084,15.7065283 9.04285836,15.7866138 9.09977965,15.8435551 C9.15666098,15.9005164 9.23664658,15.9336538 9.31709187,15.9336538 C9.39745723,15.9336538 9.47744283,15.9005164 9.53436412,15.8435551 C9.59128541,15.7866138 9.62438291,15.7065683 9.62438291,15.626023 C9.62438291,15.5455578 9.59128541,15.4654922 9.53436412,15.4085309 C9.47744283,15.3515497 9.39745723,15.3184122 9.31709187,15.3184122 C9.23664658,15.3184122 9.15666098,15.3515497 9.09977965,15.4085309 C9.04285836,15.4654922 9.00980084,15.5455378 9.00980084,15.626023 M5.71628043,15.464353 C5.71628043,15.5714801 5.76041043,15.6779677 5.83607896,15.7537962 C5.91174752,15.8295447 6.01819512,15.8736347 6.12530229,15.8736347 C6.23234949,15.8736347 6.33881709,15.8295447 6.41448564,15.7537962 C6.49025412,15.6779677 6.53430416,15.5714802 6.53430416,15.464353 C6.53430416,15.3570859 6.49025412,15.2506383 6.41448564,15.1747699 C6.33881709,15.0990414 6.23236949,15.0549514 6.12530229,15.0549514 C6.0182151,15.0549514 5.9117475,15.0990414 5.83607896,15.1747699 C5.76041043,15.2506383 5.71628043,15.3570859 5.71628043,15.464353 M2.79454721,13.9635735 C2.79454721,14.0977623 2.84970969,14.2310516 2.94444527,14.3258871 C3.03918086,14.4206827 3.17237029,14.4759251 3.30641914,14.4759251 C3.44032809,14.4759251 3.57351752,14.4206827 3.66825309,14.3258871 C3.76298867,14.2310516 3.81815115,14.0977623 3.81815115,13.9635735 C3.81815115,13.8294847 3.76298867,13.6961754 3.66825309,13.6013798 C3.5735175,13.5065643 3.44032807,13.4513218 3.30641914,13.4513218 C3.17237029,13.4513218 3.03918086,13.5065643 2.94444527,13.6013798 C2.84968971,13.6961754 2.79454721,13.8294847 2.79454721,13.9635735 M0.771023203,11.4122684 C0.771023203,11.5733788 0.837238184,11.73339 0.95100082,11.8473126 C1.06480344,11.9611951 1.22479465,12.02757 1.38562527,12.02757 C1.54657582,12.02757 1.70646711,11.9612151 1.82024973,11.8473126 C1.93401236,11.73343 2.00030729,11.5733788 2.00030729,11.4122684 C2.00030729,11.2512779 1.93403234,11.0912267 1.82024973,10.9773242 C1.70646709,10.8634416 1.54657582,10.7970667 1.38562527,10.7970667 C1.22479463,10.7970667 1.06480344,10.8634016 0.95100082,10.9773242 C0.837218184,11.0912267 0.771023203,11.2512779 0.771023203,11.4122684 M0.0117595117,8.27969855 C0.0117595117,8.46747088 0.0890069922,8.65400402 0.221576836,8.78677375 C0.35414668,8.91944354 0.540519961,8.99667102 0.728092402,8.99667102 C0.915664844,8.99667102 1.10201813,8.91944354 1.23460797,8.78677375 C1.36717781,8.65396406 1.44442529,8.4674309 1.44442529,8.27969855 C1.44442529,8.09200619 1.36717781,7.90547303 1.23460797,7.77270332 C1.10201813,7.63999355 0.915664844,7.56276607 0.728092402,7.56276607 C0.540519961,7.56276607 0.35414668,7.63999355 0.221576836,7.77270332 C0.0890269531,7.90549301 0.0117595117,8.09202617 0.0117595117,8.27969855 M0.636554648,5.16747486 C0.636554648,5.38212891 0.724814629,5.59552379 0.876551445,5.74728059 C1.02816834,5.89905738 1.24124346,5.9873973 1.45571762,5.9873973 C1.67019178,5.9873973 1.88328688,5.89905738 2.03490377,5.74728059 C2.18662061,5.59552379 2.27488059,5.38212889 2.27488059,5.16747486 C2.27488059,4.95290078 2.18662061,4.73952586 2.03490377,4.58776906 C1.88328687,4.43597229 1.67019178,4.34763236 1.45571762,4.34763236 C1.24124346,4.34763236 1.02816836,4.43597229 0.876551445,4.58776906 C0.724814629,4.73950588 0.636554648,4.95290078 0.636554648,5.16747486 M2.51094006,2.65808125 C2.51094006,2.89963699 2.61035246,3.13969375 2.78101641,3.31053758 C2.95170033,3.48136143 3.19159721,3.58083377 3.43293311,3.58083377 C3.67428898,3.58083377 3.91408592,3.48132145 4.08474986,3.31053758 C4.25545379,3.13969375 4.35482621,2.89963699 4.35482621,2.65808125 C4.35482621,2.41646555 4.25545379,2.17634883 4.08474986,2.00554498 C3.91408592,1.83470115 3.67428898,1.73524879 3.43293311,1.73524879 C3.19159721,1.73524879 2.95170035,1.83472115 2.78101641,2.00554498 C2.61035246,2.17636883 2.51094006,2.41646555 2.51094006,2.65808125 M5.2632285,1.22063871 C5.2632285,1.48887631 5.37355348,1.755515 5.56300465,1.94512605 C5.75253576,2.13485703 6.01883469,2.24522199 6.28683244,2.24522199 C6.5548302,2.24522199 6.8211491,2.13487703 7.01064025,1.94512605 C7.20019137,1.75551498 7.31053633,1.48887631 7.31053633,1.22063871 C7.31053633,0.952381133 7.20019137,0.685882344 7.01064025,0.496131367 C6.8211691,0.306520293 6.5548302,0.19605541 6.28683244,0.19605541 C6.01883469,0.19605541 5.75255574,0.306500313 5.56300465,0.496131367 C5.37355348,0.685902344 5.2632285,0.952401113 5.2632285,1.22063871 M8.35448645,1.13137941 C8.35448645,1.42653871 8.47582395,1.71987924 8.68438211,1.9285973 C8.89288033,2.13731537 9.18596104,2.2588927 9.48084053,2.2588927 C9.77583992,2.2588927 10.0689206,2.13731537 10.2773989,1.9285973 C10.4858971,1.71989922 10.6072945,1.42653871 10.6072945,1.13137941 C10.6072945,0.836200137 10.4859371,0.542859609 10.2773989,0.334061582 C10.0688607,0.125343516 9.77581994,0.00386611328 9.48084053,0.00386611328 C9.18596105,0.00386611328 8.89288033,0.125343516 8.68438211,0.334061582 C8.47582395,0.542819629 8.35448645,0.836200137 8.35448645,1.13137941 M11.184642,2.40591273 C11.184642,2.72773389 11.3170519,3.04755643 11.5443573,3.27506172 C11.7717427,3.50270691 12.0912854,3.63513687 12.4128268,3.63513687 C12.7343282,3.63513687 13.0538709,3.50270693 13.2811763,3.27506172 C13.5085617,3.04755643 13.6408917,2.72771391 13.6408917,2.40591273 C13.6408917,2.08407158 13.5085617,1.76424906 13.2811763,1.53662385 C13.0538709,1.30909857 12.7343282,1.17656869 12.4128268,1.17656869 C12.0912854,1.17656869 11.7717427,1.30909857 11.5443573,1.53662385 C11.3170519,1.76424906 11.184642,2.08407158 11.184642,2.40591273 M13.1957344,4.79996477 C13.1957344,5.1487276 13.3391968,5.49531193 13.5855493,5.74200418 C13.8319817,5.9885965 14.1782663,6.13215887 14.5267093,6.13215887 C14.8751524,6.13215887 15.2214769,5.9885765 15.4678294,5.74200418 C15.7141819,5.49531193 15.8576043,5.14872762 15.8576043,4.79996477 C15.8576043,4.45116195 15.7141819,4.10455764 15.4678294,3.85796533 C15.2214769,3.61129307 14.8751524,3.46773068 14.5267093,3.46773068 C14.1782663,3.46773068 13.8319818,3.61131305 13.5855493,3.85796533 C13.3391969,4.10455766 13.1957344,4.45118195 13.1957344,4.79996477 M13.9957104,7.90093611 C13.9957104,8.27658068 14.1501854,8.65000674 14.4156648,8.91566609 C14.6811043,9.18134543 15.0540907,9.33604023 15.4295154,9.33604023 C15.8048002,9.33604023 16.1778665,9.18134543 16.4432861,8.91566609 C16.7087256,8.65002674 16.8632405,8.27658066 16.8632405,7.90093611 C16.8632405,7.52517164 16.7087456,7.15176555 16.4432861,6.88610619 C16.1778865,6.62044684 15.8048202,6.46585197 15.4295154,6.46585197 C15.0541107,6.46585197 14.6811243,6.62044686 14.4156648,6.88610619 C14.1501654,7.15174557 13.9957104,7.52515164 13.9957104,7.90093611" id="Shape"></path>\n </g>\n </g>'):"","\n </svg>")}(0,0,r.adaptor,"group"),style:{opacity:0,position:"absolute",top:"10px",left:"10px",width:"100%",height:"calc(100% - 20px)",cursor:"pointer",zIndex:1e7}}))}}],[{key:"getDerivedStateFromError",value:function(){return{error:!0}}}]),e}();B.defaultProps={background:"transparent",node:{adaptor:"__test__",props:{}},onLoad:function(){},onError:function(){},onDragStart:function(){}};function q(t){function a(){++c===u&&(f(!0),o())}var e=t.demos,r=void 0===e?[]:e,i=t.themeId,n=t.onError,o=t.onLoad,c=0,u=r.length,l=R(p.useState(!1),2),s=l[0],f=l[1];return d.createElement(F,{onError:n},d.createElement("div",{style:{opacity:s?1:0}},r.map(function(t,e){var r=t.node,n=t.background,o=t.height;return d.createElement(B,{id:e,key:e,onLoad:a,themeId:i,background:n,height:o,node:r})})))}return{init:function(t){return k(t)},findEditor:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"normal",r=S(t);if(r)return r.editor(e)},findShapes:function(t){var e=S(t);return e?e.shape:[]},render:G,snapshot:function(t,r){var n=function(i){var c=S(i);return c?c.demos&&0<c.demos.length?c.demos.map(function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{node:{props:{}}};return y({},t,{node:y({},t.node||{},{props:y({},C(c,t.node.props.shape||"normal"),t.node.props||{})})})}):c.shape.map(function(t){var e=t.value,r=C(c,e),n=c.editor(e).props,o=b("level",n);o&&o.options&&o.options.find(function(t){return"primary"===t.value})&&(r.level="primary");var a={node:{adaptor:i,props:r}};return c.demoOptions?c.demoOptions(a):a}):[]}(t),o=function(){var t=document.getElementById("mount-snapshot-node");return t||((t=document.createElement("div")).setAttribute("id","mount-snapshot-node"),document.body.appendChild(t)),t}();return c.unmountComponentAtNode(o),new Promise(function(t,e){c.render(d.createElement(q,{demos:n,themeId:r,onError:e,onLoad:function(){return t({height:o.offsetHeight})}}),o)})}}}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],e):(t=t||self).AdaptorRender=e(t.React,t.ReactDOM)}(this,function(d,c){"use strict";var h="default"in d?d.default:d;c=c&&c.hasOwnProperty("default")?c.default:c;var t,r=(function(t){var e=function(a){var u,t=Object.prototype,l=t.hasOwnProperty,e="function"==typeof Symbol?Symbol:{},o=e.iterator||"@@iterator",r=e.asyncIterator||"@@asyncIterator",n=e.toStringTag||"@@toStringTag";function i(t,e,r,n){var o=e&&e.prototype instanceof c?e:c,a=Object.create(o.prototype),i=new k(n||[]);return a._invoke=function(a,i,c){var u=f;return function(t,e){if(u===d)throw new Error("Generator is already running");if(u===h){if("throw"===t)throw e;return L()}for(c.method=t,c.arg=e;;){var r=c.delegate;if(r){var n=O(r,c);if(n){if(n===m)continue;return n}}if("next"===c.method)c.sent=c._sent=c.arg;else if("throw"===c.method){if(u===f)throw u=h,c.arg;c.dispatchException(c.arg)}else"return"===c.method&&c.abrupt("return",c.arg);u=d;var o=s(a,i,c);if("normal"===o.type){if(u=c.done?h:p,o.arg===m)continue;return{value:o.arg,done:c.done}}"throw"===o.type&&(u=h,c.method="throw",c.arg=o.arg)}}}(t,r,i),a}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}a.wrap=i;var f="suspendedStart",p="suspendedYield",d="executing",h="completed",m={};function c(){}function v(){}function y(){}var g={};g[o]=function(){return this};var C=Object.getPrototypeOf,b=C&&C(C(j([])));b&&b!==t&&l.call(b,o)&&(g=b);var w=y.prototype=c.prototype=Object.create(g);function E(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function x(u){var e;this._invoke=function(r,n){function t(){return new Promise(function(t,e){!function e(t,r,n,o){var a=s(u[t],u,r);if("throw"!==a.type){var i=a.arg,c=i.value;return c&&"object"==typeof c&&l.call(c,"__await")?Promise.resolve(c.__await).then(function(t){e("next",t,n,o)},function(t){e("throw",t,n,o)}):Promise.resolve(c).then(function(t){i.value=t,n(i)},function(t){return e("throw",t,n,o)})}o(a.arg)}(r,n,t,e)})}return e=e?e.then(t,t):t()}}function O(t,e){var r=t.iterator[e.method];if(r===u){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=u,O(t,e),"throw"===e.method))return m;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return m}var n=s(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,m;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=u),e.delegate=null,m):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,m)}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function k(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function j(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,n=function t(){for(;++r<e.length;)if(l.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=u,t.done=!0,t};return n.next=n}}return{next:L}}function L(){return{value:u,done:!0}}return v.prototype=w.constructor=y,y.constructor=v,y[n]=v.displayName="GeneratorFunction",a.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,n in t||(t[n]="GeneratorFunction")),t.prototype=Object.create(w),t},a.awrap=function(t){return{__await:t}},E(x.prototype),x.prototype[r]=function(){return this},a.AsyncIterator=x,a.async=function(t,e,r,n){var o=new x(i(t,e,r,n));return a.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},E(w),w[n]="Generator",w[o]=function(){return this},w.toString=function(){return"[object Generator]"},a.keys=function(r){var n=[];for(var t in r)n.push(t);return n.reverse(),function t(){for(;n.length;){var e=n.pop();if(e in r)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=j,k.prototype={constructor:k,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=u,this.done=!1,this.delegate=null,this.method="next",this.arg=u,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&l.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=u)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var n=this;function t(t,e){return a.type="throw",a.arg=r,n.next=t,e&&(n.method="next",n.arg=u),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var o=this.tryEntries[e],a=o.completion;if("root"===o.tryLoc)return t("end");if(o.tryLoc<=this.prev){var i=l.call(o,"catchLoc"),c=l.call(o,"finallyLoc");if(i&&c){if(this.prev<o.catchLoc)return t(o.catchLoc,!0);if(this.prev<o.finallyLoc)return t(o.finallyLoc)}else if(i){if(this.prev<o.catchLoc)return t(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return t(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;0<=r;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&l.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),_(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;_(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:j(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=u),m}},a}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}}(t={exports:{}},t.exports),t.exports);function y(o){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{},e=Object.keys(a);"function"==typeof Object.getOwnPropertySymbols&&(e=e.concat(Object.getOwnPropertySymbols(a).filter(function(t){return Object.getOwnPropertyDescriptor(a,t).enumerable}))),e.forEach(function(t){var e,r,n;e=o,n=a[r=t],r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n})}return o}function u(t,e,r,n,o,a,i){try{var c=t[a](i),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}var e,n,o,a,i,l;Object.keys({"-":"disabled","*":"active","~":"hover","":"normal"}).forEach(function(t){}),(n=e||(e={})).divider="divider",n.node="node",n.comment="comment",(a=o||(o={})).text="text",a.icon="icon",(l=i||(i={})).enum="enum",l.string="string",l.number="number",l.bool="bool",l.node="node",l.nodeList="node-list";function s(t){return t.replace(/\B([A-Z])/g,"-$1").split(/[-|_]/).map(function(t){return function(t){return t?[t.substring(0,1).toUpperCase(),t.substring(1)].join(""):""}(t)}).join(" ")}var g=i;function f(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),n.forEach(function(t){p(e,t,r[t])})}return e}function p(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}for(var m=function(){return(0<arguments.length&&void 0!==arguments[0]?arguments[0]:[]).filter(function(t){return!!t}).map(function(t){return f({},t,{label:t.label||s(t.name),options:function(){return(0<arguments.length&&void 0!==arguments[0]?arguments[0]:[]).filter(function(t){return!!t}).map(function(t){var e=t.value||t;return{value:e,label:t.label||s(e)}})}(t.options)})})},v=function(r){if(!r.name)return console.error("[error] muse be have name:"),r;var t;t=!r.shape||!Array.isArray(r.shape)||r.shape.length<1?[{label:r.name,value:"normal"}]:r.shape.filter(function(t){return!!t}).map(function(t){var e=t.value||t;return{value:e,label:t.label||"".concat(s(e)," ").concat("normal"===e?"":r.name)}});return f({},r,{shape:t,editor:function(t){var e=r.editor?r.editor(t):{};return e.props||(e.props=[]),e.nodes||(e.nodes=[]),f({},e,{props:m(e.props),nodes:m(e.nodes)})},content:function(t){var e=r.content?r.content(t):{};return f({},e,{options:m(e.options)})}})},C=function(t,e){var r=t.editor(e),n={shape:e,data:r.data&&r.data.default||""};return r.props.forEach(function(t){var e=t.default;if(null==e)switch(t.type){case g.string:e="";break;case g.number:e=0;break;case g.bool:e=!1;break;case g.enum:e=t.options?t.options[0].value:""}n[t.name]=e}),r.nodes.forEach(function(t){var e=t.name,r=t.default;n[e]=r}),n},b=function(e){return(1<arguments.length&&void 0!==arguments[1]?arguments[1]:[]).find(function(t){return t.name===e})},w=((new Date).getTime(),[]),E=[],x=0;x<256;x+=1)E[x]=(x<16?"0":"")+x.toString(16);function O(){return function(){var t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,r=4294967295*Math.random()|0,n=4294967295*Math.random()|0;return"".concat(E[255&t]+E[t>>8&255]+E[t>>16&255]+E[t>>24&255],"-").concat(E[255&e]).concat(E[e>>8&255],"-").concat(E[e>>16&15|64]).concat(E[e>>24&255],"-").concat(E[63&r|128]).concat(E[r>>8&255],"-").concat(E[r>>16&255]).concat(E[r>>24&255]).concat(E[255&n]).concat(E[n>>8&255]).concat(E[n>>16&255]).concat(E[n>>24&255])}()}function S(e){return w.find(function(t){return t.name===e})}function _(t){var l=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},s=2<arguments.length?arguments[2]:void 0,f=3<arguments.length?arguments[3]:void 0,p=4<arguments.length&&void 0!==arguments[4]?arguments[4]:"",e=5<arguments.length?arguments[5]:void 0,d=6<arguments.length&&void 0!==arguments[6]?arguments[6]:{},r=S(t);if(!r)return null;var n=l.shape,o=void 0===n?"normal":n,h=r.editor(o),a=C(r,o);l=y({},a,l);var m={},v={};return Object.keys(l).forEach(function(a){var t=l[a],e=(b(a,h.props)||{}).type;switch(void 0===e?"any":e){case g.node:if(!t||!t.adaptor)return;var r=t.id||O(),n=[p,a].filter(function(t){return!!t}).join("-"),o={};v[a]=_(t.adaptor,t.props,s,r,n,a,o),m[a]=y({adaptor:t.adaptor,label:t.label,propName:a,id:r,path:n},f?{}:{props:o}),d[a]={adaptor:t.adaptor,label:t.label,propName:a,id:r,path:n,props:o};break;case g.nodeList:if(!t||!Array.isArray(t)||0===t.length||0===t.filter(function(t){return t&&t.adaptor}).length)return;var i=[],c=[],u=[];t.filter(function(t){return t&&t.adaptor}).forEach(function(t,e){var r=t.id||O(),n="".concat(p||"").concat(p?"-":"").concat(a,"_").concat(e),o={};i.push(_(t.adaptor,t.props,s,r,n,a,o)),c.push(y({adaptor:t.adaptor,label:t.label,propName:a,id:r,path:n,index:e.toString()},f?{}:{props:o})),u.push({adaptor:t.adaptor,label:t.label,propName:a,id:r,path:n,index:e.toString(),props:o})}),v[a]=i,m[a]=c,d[a]=u;break;default:v[a]=t,m[a]=t,d[a]=t}}),r.adaptor(y({},v,{"data-fusioncool":JSON.stringify(y({name:t,props:m,type:"adaptor-component",root:!p,themeId:String(s)},e?{propName:e}:{},p?{path:p}:{}))},f?{"data-id":f}:{}))}var k=function(){var e=function(c){return function(){var t=this,i=arguments;return new Promise(function(e,r){var n=c.apply(t,i);function o(t){u(n,e,r,o,a,"next",t)}function a(t){u(n,e,r,o,a,"throw",t)}o(void 0)})}}(r.mark(function t(e){return r.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(window.Adaptors&&Object.keys(window.Adaptors).forEach(function(t){w.push(y({},v(window.Adaptors[t]),{type:"basic"}))}),e)return t.next=4,Promise.all(e.map(function(t){var e=t.name,r=t.script,n=t.stylesheet;if(r){var o,a,i=[];return i.push((o=r,new Promise(function(t,e){var r=document.createElement("script");r.type="text/javascript",r.setAttribute("crossorigin",!0),r.onload=t,r.onerror=e,r.src=o,document.body.appendChild(r)})).then(function(){window.Adaptor&&(w.push(y({},v(window.Adaptor),{type:"expanded"})),window.Adaptor=null)}).catch(function(){console.error("[".concat(e,"] script (").concat(r,") load error ! please contact the developer"))})),n&&i.push((a=n,new Promise(function(t,e){var r=document.createElement("link");r.rel="stylesheet",r.type="text/css",r.onload=t,r.onerror=e,r.href=a,document.head.appendChild(r)})).catch(function(){console.error("[".concat(e,"] stylesheet (").concat(n,") load error ! please contact the developer"))})),Promise.all(i)}}));t.next=4;break;case 4:case"end":return t.stop()}},t)}));return function(t){return e.apply(this,arguments)}}();function j(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function L(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function P(t,e,r){return e&&L(t.prototype,e),r&&L(t,r),t}function A(t){return(A="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function M(t){return(M="function"==typeof Symbol&&"symbol"===A(Symbol.iterator)?function(t){return A(t)}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":A(t)})(t)}function D(t,e){return!e||"object"!==M(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function N(t){return(N=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function I(t,e){return(I=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function T(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&I(t,e)}var F=function(t){function r(t){var e;return j(this,r),(e=D(this,N(r).call(this,t))).state={hasError:!1},e}return T(r,d.Component),P(r,[{key:"componentDidCatch",value:function(t,e){this.props.onError(t,e)}},{key:"render",value:function(){return this.state.hasError?h.createElement("div",{className:"__error__"}," This demo is running incorrectly, please contact the developer. "):this.props.children}}],[{key:"getDerivedStateFromError",value:function(){return{hasError:!0}}}]),r}();F.defaultProps={onError:function(){}};function G(n){function r(t){var e=t.onError,r=_(n,o,a);return h.createElement(F,{onError:e},r)}var o=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},a=2<arguments.length?arguments[2]:void 0,i=function(){var t=document.getElementById("mount-node");return t||((t=document.createElement("div")).setAttribute("id","mount-node"),"undefined"!=typeof window&&"watch"!==window.__ENV__&&(t.style.position="fixed",t.style.left="-1000px",t.style.top="-1000px"),document.body.appendChild(t)),t}();return new Promise(function(t,e){c.render(h.createElement(r,{onError:e}),i,function(){i.querySelector(".__error__")||setTimeout(function(){t(i.firstElementChild)},50)})})}function R(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=[],n=!0,o=!1,a=void 0;try{for(var i,c=t[Symbol.iterator]();!(n=(i=c.next()).done)&&(r.push(i.value),!e||r.length!==e);n=!0);}catch(t){o=!0,a=t}finally{try{n||null==c.return||c.return()}finally{if(o)throw a}}return r}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var B=function(t){function e(t){var o;return j(this,e),(o=D(this,N(e).call(this,t))).saveRef=function(t){o.demo=t},o.handleDragStart=function(){var t=o.props,e=t.onDragStart,r=t.node,n=t.themeId;return G(r.adaptor,r.props,n).then(e)},o.state={scale:1,height:t.height||"auto",loaded:!1,error:!1},o}return T(e,d.Component),P(e,[{key:"componentDidCatch",value:function(t,e){this.props.onError(t,e)}},{key:"componentDidMount",value:function(){var t=this;setTimeout(function(){t.computeScale()},50)}},{key:"computeScale",value:function(){var t=this.props.onLoad,e=1,r=this.state.height;if(this.demo){var n=c.findDOMNode(this.demo),o=n.firstElementChild;1<(e=(n.offsetWidth-20)/o.offsetWidth)&&(e=1),r=this.props.height?this.props.height*e:o.offsetHeight*e+20}this.setState({loaded:!0,scale:e,height:r},function(){t()})}},{key:"render",value:function(){var t=this.props,e=t.background,r=t.node,n=t.themeId,o=this.state,a=o.scale,i=o.height,c=o.loaded,u=o.error,l=_(r.adaptor,r.props||{},n);if(!l)return null;if(u)return h.createElement("div",null," This demo is running incorrectly, please contact the developer ");return h.createElement("div",{ref:this.saveRef,style:{background:e,height:i||"auto",padding:10,overflow:"hidden",position:"relative",display:"flex",flexDirection:"row",alignItems:"flex-start",justifyContent:"flex-start",visibility:c?"":"hidden"}},h.cloneElement(l,{style:y({transform:"scale(".concat(a,")"),transformOrigin:"top left",flexShrink:0,flexGrow:0,position:"relative"},l.props.style||{})}),h.createElement("img",{onDragStart:this.handleDragStart,draggable:!0,alt:"drag layer",src:function(t,e,r,n){var o=!(4<arguments.length&&void 0!==arguments[4])||arguments[4];return'data:image/svg+xml;charset=UTF-8,<svg width="'.concat(t,'px" height="').concat(e,'px" viewBox="0 0 ').concat(t," ").concat(e,'" version="1.1" xmlns="http://www.w3.org/2000/svg"><rect stroke="none" fill="none" id=\'__magic:FC_').concat(r,",").concat(n,'\' x="0" y="0" width="').concat(t,'" height="').concat(e,'" />\n ').concat(o?'<g id="loading" transform="translate('.concat(t/2-27,", ").concat(e/2-25,')" fill="#5A5A5A" opacity="0.5">\n <text id="text" font-family="PingFangSC-Regular, PingFang SC" font-size="16" font-weight="normal">\n <tspan x="0" y="45">Loading</tspan>\n </text>\n <g id="icon" transform="translate(18.000000, 0.000000)" fill-rule="nonzero">\n <path d="M14.3390969,12.0749978 C14.3390969,12.1289011 14.3881236,12.1779078 14.441947,12.1779078 C14.4957704,12.1779078 14.5447771,12.1289011 14.5447771,12.0749978 C14.5447771,12.0211744 14.4958303,11.9720678 14.441947,11.9720678 C14.3881636,11.9720478 14.3390969,12.0211544 14.3390969,12.0749978 M12.0693204,14.4193036 C12.0693204,14.4730071 12.0913854,14.5262309 12.1292396,14.5641052 C12.1670739,14.6019994 12.2202777,14.6240644 12.2737813,14.6240644 C12.3274249,14.6240644 12.3805887,14.6019994 12.418403,14.5641052 C12.4562173,14.526211 12.4783223,14.4729671 12.4783223,14.4193036 C12.4783223,14.3657201 12.4562373,14.3124763 12.418403,14.274662 C12.3805687,14.2367678 12.3273649,14.2146828 12.2737813,14.2146828 C12.2202178,14.2146828 12.1670539,14.2367478 12.1292396,14.274662 C12.0913654,14.3124763 12.0693204,14.3657201 12.0693204,14.4193036 M9.00980084,15.626023 C9.00980084,15.7065283 9.04285836,15.7866138 9.09977965,15.8435551 C9.15666098,15.9005164 9.23664658,15.9336538 9.31709187,15.9336538 C9.39745723,15.9336538 9.47744283,15.9005164 9.53436412,15.8435551 C9.59128541,15.7866138 9.62438291,15.7065683 9.62438291,15.626023 C9.62438291,15.5455578 9.59128541,15.4654922 9.53436412,15.4085309 C9.47744283,15.3515497 9.39745723,15.3184122 9.31709187,15.3184122 C9.23664658,15.3184122 9.15666098,15.3515497 9.09977965,15.4085309 C9.04285836,15.4654922 9.00980084,15.5455378 9.00980084,15.626023 M5.71628043,15.464353 C5.71628043,15.5714801 5.76041043,15.6779677 5.83607896,15.7537962 C5.91174752,15.8295447 6.01819512,15.8736347 6.12530229,15.8736347 C6.23234949,15.8736347 6.33881709,15.8295447 6.41448564,15.7537962 C6.49025412,15.6779677 6.53430416,15.5714802 6.53430416,15.464353 C6.53430416,15.3570859 6.49025412,15.2506383 6.41448564,15.1747699 C6.33881709,15.0990414 6.23236949,15.0549514 6.12530229,15.0549514 C6.0182151,15.0549514 5.9117475,15.0990414 5.83607896,15.1747699 C5.76041043,15.2506383 5.71628043,15.3570859 5.71628043,15.464353 M2.79454721,13.9635735 C2.79454721,14.0977623 2.84970969,14.2310516 2.94444527,14.3258871 C3.03918086,14.4206827 3.17237029,14.4759251 3.30641914,14.4759251 C3.44032809,14.4759251 3.57351752,14.4206827 3.66825309,14.3258871 C3.76298867,14.2310516 3.81815115,14.0977623 3.81815115,13.9635735 C3.81815115,13.8294847 3.76298867,13.6961754 3.66825309,13.6013798 C3.5735175,13.5065643 3.44032807,13.4513218 3.30641914,13.4513218 C3.17237029,13.4513218 3.03918086,13.5065643 2.94444527,13.6013798 C2.84968971,13.6961754 2.79454721,13.8294847 2.79454721,13.9635735 M0.771023203,11.4122684 C0.771023203,11.5733788 0.837238184,11.73339 0.95100082,11.8473126 C1.06480344,11.9611951 1.22479465,12.02757 1.38562527,12.02757 C1.54657582,12.02757 1.70646711,11.9612151 1.82024973,11.8473126 C1.93401236,11.73343 2.00030729,11.5733788 2.00030729,11.4122684 C2.00030729,11.2512779 1.93403234,11.0912267 1.82024973,10.9773242 C1.70646709,10.8634416 1.54657582,10.7970667 1.38562527,10.7970667 C1.22479463,10.7970667 1.06480344,10.8634016 0.95100082,10.9773242 C0.837218184,11.0912267 0.771023203,11.2512779 0.771023203,11.4122684 M0.0117595117,8.27969855 C0.0117595117,8.46747088 0.0890069922,8.65400402 0.221576836,8.78677375 C0.35414668,8.91944354 0.540519961,8.99667102 0.728092402,8.99667102 C0.915664844,8.99667102 1.10201813,8.91944354 1.23460797,8.78677375 C1.36717781,8.65396406 1.44442529,8.4674309 1.44442529,8.27969855 C1.44442529,8.09200619 1.36717781,7.90547303 1.23460797,7.77270332 C1.10201813,7.63999355 0.915664844,7.56276607 0.728092402,7.56276607 C0.540519961,7.56276607 0.35414668,7.63999355 0.221576836,7.77270332 C0.0890269531,7.90549301 0.0117595117,8.09202617 0.0117595117,8.27969855 M0.636554648,5.16747486 C0.636554648,5.38212891 0.724814629,5.59552379 0.876551445,5.74728059 C1.02816834,5.89905738 1.24124346,5.9873973 1.45571762,5.9873973 C1.67019178,5.9873973 1.88328688,5.89905738 2.03490377,5.74728059 C2.18662061,5.59552379 2.27488059,5.38212889 2.27488059,5.16747486 C2.27488059,4.95290078 2.18662061,4.73952586 2.03490377,4.58776906 C1.88328687,4.43597229 1.67019178,4.34763236 1.45571762,4.34763236 C1.24124346,4.34763236 1.02816836,4.43597229 0.876551445,4.58776906 C0.724814629,4.73950588 0.636554648,4.95290078 0.636554648,5.16747486 M2.51094006,2.65808125 C2.51094006,2.89963699 2.61035246,3.13969375 2.78101641,3.31053758 C2.95170033,3.48136143 3.19159721,3.58083377 3.43293311,3.58083377 C3.67428898,3.58083377 3.91408592,3.48132145 4.08474986,3.31053758 C4.25545379,3.13969375 4.35482621,2.89963699 4.35482621,2.65808125 C4.35482621,2.41646555 4.25545379,2.17634883 4.08474986,2.00554498 C3.91408592,1.83470115 3.67428898,1.73524879 3.43293311,1.73524879 C3.19159721,1.73524879 2.95170035,1.83472115 2.78101641,2.00554498 C2.61035246,2.17636883 2.51094006,2.41646555 2.51094006,2.65808125 M5.2632285,1.22063871 C5.2632285,1.48887631 5.37355348,1.755515 5.56300465,1.94512605 C5.75253576,2.13485703 6.01883469,2.24522199 6.28683244,2.24522199 C6.5548302,2.24522199 6.8211491,2.13487703 7.01064025,1.94512605 C7.20019137,1.75551498 7.31053633,1.48887631 7.31053633,1.22063871 C7.31053633,0.952381133 7.20019137,0.685882344 7.01064025,0.496131367 C6.8211691,0.306520293 6.5548302,0.19605541 6.28683244,0.19605541 C6.01883469,0.19605541 5.75255574,0.306500313 5.56300465,0.496131367 C5.37355348,0.685902344 5.2632285,0.952401113 5.2632285,1.22063871 M8.35448645,1.13137941 C8.35448645,1.42653871 8.47582395,1.71987924 8.68438211,1.9285973 C8.89288033,2.13731537 9.18596104,2.2588927 9.48084053,2.2588927 C9.77583992,2.2588927 10.0689206,2.13731537 10.2773989,1.9285973 C10.4858971,1.71989922 10.6072945,1.42653871 10.6072945,1.13137941 C10.6072945,0.836200137 10.4859371,0.542859609 10.2773989,0.334061582 C10.0688607,0.125343516 9.77581994,0.00386611328 9.48084053,0.00386611328 C9.18596105,0.00386611328 8.89288033,0.125343516 8.68438211,0.334061582 C8.47582395,0.542819629 8.35448645,0.836200137 8.35448645,1.13137941 M11.184642,2.40591273 C11.184642,2.72773389 11.3170519,3.04755643 11.5443573,3.27506172 C11.7717427,3.50270691 12.0912854,3.63513687 12.4128268,3.63513687 C12.7343282,3.63513687 13.0538709,3.50270693 13.2811763,3.27506172 C13.5085617,3.04755643 13.6408917,2.72771391 13.6408917,2.40591273 C13.6408917,2.08407158 13.5085617,1.76424906 13.2811763,1.53662385 C13.0538709,1.30909857 12.7343282,1.17656869 12.4128268,1.17656869 C12.0912854,1.17656869 11.7717427,1.30909857 11.5443573,1.53662385 C11.3170519,1.76424906 11.184642,2.08407158 11.184642,2.40591273 M13.1957344,4.79996477 C13.1957344,5.1487276 13.3391968,5.49531193 13.5855493,5.74200418 C13.8319817,5.9885965 14.1782663,6.13215887 14.5267093,6.13215887 C14.8751524,6.13215887 15.2214769,5.9885765 15.4678294,5.74200418 C15.7141819,5.49531193 15.8576043,5.14872762 15.8576043,4.79996477 C15.8576043,4.45116195 15.7141819,4.10455764 15.4678294,3.85796533 C15.2214769,3.61129307 14.8751524,3.46773068 14.5267093,3.46773068 C14.1782663,3.46773068 13.8319818,3.61131305 13.5855493,3.85796533 C13.3391969,4.10455766 13.1957344,4.45118195 13.1957344,4.79996477 M13.9957104,7.90093611 C13.9957104,8.27658068 14.1501854,8.65000674 14.4156648,8.91566609 C14.6811043,9.18134543 15.0540907,9.33604023 15.4295154,9.33604023 C15.8048002,9.33604023 16.1778665,9.18134543 16.4432861,8.91566609 C16.7087256,8.65002674 16.8632405,8.27658066 16.8632405,7.90093611 C16.8632405,7.52517164 16.7087456,7.15176555 16.4432861,6.88610619 C16.1778865,6.62044684 15.8048202,6.46585197 15.4295154,6.46585197 C15.0541107,6.46585197 14.6811243,6.62044686 14.4156648,6.88610619 C14.1501654,7.15174557 13.9957104,7.52515164 13.9957104,7.90093611" id="Shape"></path>\n </g>\n </g>'):"","\n </svg>")}(0,0,r.adaptor,"group"),style:{opacity:0,position:"absolute",top:"10px",left:"10px",width:"100%",height:"calc(100% - 20px)",cursor:"pointer",zIndex:1e7}}))}}],[{key:"getDerivedStateFromError",value:function(){return{error:!0}}}]),e}();B.defaultProps={background:"transparent",node:{adaptor:"__test__",props:{}},onLoad:function(){},onError:function(){},onDragStart:function(){}};function q(t){function a(){++u===l&&(p(!0),o())}var e=t.demos,r=void 0===e?[]:e,i=t.themeId,n=t.onError,o=t.onLoad,c=t.onDragStart,u=0,l=r.length,s=R(d.useState(!1),2),f=s[0],p=s[1];return h.createElement(F,{onError:n},h.createElement("div",{style:{opacity:f?1:0}},r.map(function(t,e){var r=t.node,n=t.background,o=t.height;return h.createElement(B,{id:e,key:e,onLoad:a,themeId:i,background:n,height:o,node:r,onDragStart:c})})))}return{init:function(t){return k(t)},findEditor:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"normal",r=S(t);if(r)return r.editor(e)},findShapes:function(t){var e=S(t);return e?e.shape:[]},render:G,snapshot:function(t,r,n){var o=function(i){var c=S(i);return c?c.demos&&0<c.demos.length?c.demos.map(function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{node:{props:{}}};return y({},t,{node:y({},t.node||{},{props:y({},C(c,t.node.props.shape||"normal"),t.node.props||{})})})}):c.shape.map(function(t){var e=t.value,r=C(c,e),n=c.editor(e).props,o=b("level",n);o&&o.options&&o.options.find(function(t){return"primary"===t.value})&&(r.level="primary");var a={node:{adaptor:i,props:r}};return c.demoOptions?c.demoOptions(a):a}):[]}(t),a=function(){var t=document.getElementById("mount-snapshot-node");return t||((t=document.createElement("div")).setAttribute("id","mount-snapshot-node"),document.body.appendChild(t)),t}();return c.unmountComponentAtNode(a),new Promise(function(t,e){c.render(h.createElement(q,{demos:o,themeId:r,onError:e,onDragStart:n,onLoad:function(){return t({height:a.offsetHeight})}}),a)})}}}); |
322211
8521