diff --git a/client/packages/lowcoder/src/comps/comps/customComp/customComp.tsx b/client/packages/lowcoder/src/comps/comps/customComp/customComp.tsx index 4f31d0374..7e3d9c267 100644 --- a/client/packages/lowcoder/src/comps/comps/customComp/customComp.tsx +++ b/client/packages/lowcoder/src/comps/comps/customComp/customComp.tsx @@ -59,7 +59,12 @@ const defaultCode = ` root.render(); - `; + `; +// original source code of "iframe/_main_js/_runtime_js/_index from: https://custom-component.majiang.co/index.html" +const iframe_main_js = '\"use strict\";(self.webpackChunktaco_custom_component_runtime=self.webpackChunktaco_custom_component_runtime||[]).push([[179],{89:(e,t,n)=>{var r,a=n(294),l=n(935),o=n(745);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},i(e)}function u(){u=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=\"function\"==typeof Symbol?Symbol:{},a=r.iterator||\"@@iterator\",l=r.asyncIterator||\"@@asyncIterator\",o=r.toStringTag||\"@@toStringTag\";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},\"\")}catch(e){c=function(e,t,n){return e[t]=n}}function s(e,t,n,r){var a=t&&t.prototype instanceof p?t:p,l=Object.create(a.prototype),o=new _(r||[]);return l._invoke=function(e,t,n){var r=\"suspendedStart\";return function(a,l){if(\"executing\"===r)throw new Error(\"Generator is already running\");if(\"completed\"===r){if(\"throw\"===a)throw l;return{value:void 0,done:!0}}for(n.method=a,n.arg=l;;){var o=n.delegate;if(o){var i=S(o,n);if(i){if(i===d)continue;return i}}if(\"next\"===n.method)n.sent=n._sent=n.arg;else if(\"throw\"===n.method){if(\"suspendedStart\"===r)throw r=\"completed\",n.arg;n.dispatchException(n.arg)}else\"return\"===n.method&&n.abrupt(\"return\",n.arg);r=\"executing\";var u=f(e,t,n);if(\"normal\"===u.type){if(r=n.done?\"completed\":\"suspendedYield\",u.arg===d)continue;return{value:u.arg,done:n.done}}\"throw\"===u.type&&(r=\"completed\",n.method=\"throw\",n.arg=u.arg)}}}(e,n,o),l}function f(e,t,n){try{return{type:\"normal\",arg:e.call(t,n)}}catch(e){return{type:\"throw\",arg:e}}}e.wrap=s;var d={};function p(){}function h(){}function m(){}var v={};c(v,a,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(C([])));g&&g!==t&&n.call(g,a)&&(v=g);var b=m.prototype=p.prototype=Object.create(v);function w(e){[\"next\",\"throw\",\"return\"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function k(e,t){function r(a,l,o,u){var c=f(e[a],e,l);if(\"throw\"!==c.type){var s=c.arg,d=s.value;return d&&\"object\"==i(d)&&n.call(d,\"__await\")?t.resolve(d.__await).then((function(e){r(\"next\",e,o,u)}),(function(e){r(\"throw\",e,o,u)})):t.resolve(d).then((function(e){s.value=e,o(s)}),(function(e){return r(\"throw\",e,o,u)}))}u(c.arg)}var a;this._invoke=function(e,n){function l(){return new t((function(t,a){r(e,n,t,a)}))}return a=a?a.then(l,l):l()}}function S(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,\"throw\"===t.method){if(e.iterator.return&&(t.method=\"return\",t.arg=void 0,S(e,t),\"throw\"===t.method))return d;t.method=\"throw\",t.arg=new TypeError(\"The iterator does not provide a \'throw\' method\")}return d}var r=f(n,e.iterator,t.arg);if(\"throw\"===r.type)return t.method=\"throw\",t.arg=r.arg,t.delegate=null,d;var a=r.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,\"return\"!==t.method&&(t.method=\"next\",t.arg=void 0),t.delegate=null,d):a:(t.method=\"throw\",t.arg=new TypeError(\"iterator result is not an object\"),t.delegate=null,d)}function x(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function E(e){var t=e.completion||{};t.type=\"normal\",delete t.arg,e.completion=t}function _(e){this.tryEntries=[{tryLoc:\"root\"}],e.forEach(x,this),this.reset(!0)}function C(e){if(e){var t=e[a];if(t)return t.call(e);if(\"function\"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,l=function t(){for(;++r=0;--a){var l=this.tryEntries[a],o=l.completion;if(\"root\"===l.tryLoc)return r(\"end\");if(l.tryLoc<=this.prev){var i=n.call(l,\"catchLoc\"),u=n.call(l,\"finallyLoc\");if(i&&u){if(this.prev=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,\"finallyLoc\")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),E(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if(\"throw\"===r.type){var a=r.arg;E(n)}return a}}throw new Error(\"illegal catch attempt\")},delegateYield:function(e,t,n){return this.delegate={iterator:C(e),resultName:t,nextLoc:n},\"next\"===this.method&&(this.arg=void 0),d}},e}function c(e,t,n,r,a,l,o){try{var i=e[l](o),u=i.value}catch(e){return void n(e)}i.done?t(u):Promise.resolve(u).then(r,a)}function s(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var l=e.apply(t,n);function o(e){c(l,r,a,o,i,\"next\",e)}function i(e){c(l,r,a,o,i,\"throw\",e)}o(void 0)}))}}!function(e){e.Link=\"link\",e.Script=\"script\"}(r||(r={}));var f,d,p=[\"text/babel\",\"text/jsx\"],h=[],m=[];function v(e,t){Array.from(e.attributes).forEach((function(e){t.setAttribute(e.name,e.value)}))}function y(){return(y=s(u().mark((function e(t,n){return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.innerHTML=n,Object.values(r).forEach((function(e){t.querySelectorAll(e).forEach((function(t){var n=document.createElement(e);v(t,n),e===r.Script&&g(n,t),e===r.Link&&b(n,t)}))})),e.next=5,Promise.all(h);case 5:m.forEach((function(e){var t,n=e.prev,r=e.next;null===(t=n.parentNode)||void 0===t||t.replaceChild(r,n)}));case 6:case\"end\":return e.stop()}}),e)})))).apply(this,arguments)}function g(e,t){var n=e.getAttribute(\"type\");n||(n=\"text/javascript\");var r,a=e.getAttribute(\"src\");if(a)return w(e,a),void(null===(r=t.parentNode)||void 0===r||r.replaceChild(e,t));var l=p.includes(n),o=t.innerHTML;if(l)try{o=window.Babel.transform(o,{presets:[\"env\",\"react\"]}).code||\"\"}catch(e){console.error(e),o=\"document.write(\'unknownerror failed to load/strong>\')\"}e.setAttribute(\"type\",\"text/javascript\"),e.appendChild(document.createTextNode(o)),m.push({prev:t,next:e})}function b(e,t){var n,r=e.getAttribute(\"href\");return r&&(w(e,r),null===(n=t.parentNode)||void 0===n||n.replaceChild(e,t)),\"\"}function w(e,t){var n=new Promise((function(n,r){e.addEventListener(\"load\",(function(e){n(e.target)})),e.addEventListener(\"error\",(function(e){r(new Error(\"script \".concat(t,\" load err: \").concat(e.message)))}))}));h.push(n)}function k(e){return k=\"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},k(e)}function S(){S=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=\"function\"==typeof Symbol?Symbol:{},a=r.iterator||\"@@iterator\",l=r.asyncIterator||\"@@asyncIterator\",o=r.toStringTag||\"@@toStringTag\";function i(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{i({},\"\")}catch(e){i=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var a=t&&t.prototype instanceof f?t:f,l=Object.create(a.prototype),o=new _(r||[]);return l._invoke=function(e,t,n){var r=\"suspendedStart\";return function(a,l){if(\"executing\"===r)throw new Error(\"Generator is already running\");if(\"completed\"===r){if(\"throw\"===a)throw l;return{value:void 0,done:!0}}for(n.method=a,n.arg=l;;){var o=n.delegate;if(o){var i=w(o,n);if(i){if(i===s)continue;return i}}if(\"next\"===n.method)n.sent=n._sent=n.arg;else if(\"throw\"===n.method){if(\"suspendedStart\"===r)throw r=\"completed\",n.arg;n.dispatchException(n.arg)}else\"return\"===n.method&&n.abrupt(\"return\",n.arg);r=\"executing\";var u=c(e,t,n);if(\"normal\"===u.type){if(r=n.done?\"completed\":\"suspendedYield\",u.arg===s)continue;return{value:u.arg,done:n.done}}\"throw\"===u.type&&(r=\"completed\",n.method=\"throw\",n.arg=u.arg)}}}(e,n,o),l}function c(e,t,n){try{return{type:\"normal\",arg:e.call(t,n)}}catch(e){return{type:\"throw\",arg:e}}}e.wrap=u;var s={};function f(){}function d(){}function p(){}var h={};i(h,a,(function(){return this}));var m=Object.getPrototypeOf,v=m&&m(m(C([])));v&&v!==t&&n.call(v,a)&&(h=v);var y=p.prototype=f.prototype=Object.create(h);function g(e){[\"next\",\"throw\",\"return\"].forEach((function(t){i(e,t,(function(e){return this._invoke(t,e)}))}))}function b(e,t){function r(a,l,o,i){var u=c(e[a],e,l);if(\"throw\"!==u.type){var s=u.arg,f=s.value;return f&&\"object\"==k(f)&&n.call(f,\"__await\")?t.resolve(f.__await).then((function(e){r(\"next\",e,o,i)}),(function(e){r(\"throw\",e,o,i)})):t.resolve(f).then((function(e){s.value=e,o(s)}),(function(e){return r(\"throw\",e,o,i)}))}i(u.arg)}var a;this._invoke=function(e,n){function l(){return new t((function(t,a){r(e,n,t,a)}))}return a=a?a.then(l,l):l()}}function w(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,\"throw\"===t.method){if(e.iterator.return&&(t.method=\"return\",t.arg=void 0,w(e,t),\"throw\"===t.method))return s;t.method=\"throw\",t.arg=new TypeError(\"The iterator does not provide a \'throw\' method\")}return s}var r=c(n,e.iterator,t.arg);if(\"throw\"===r.type)return t.method=\"throw\",t.arg=r.arg,t.delegate=null,s;var a=r.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,\"return\"!==t.method&&(t.method=\"next\",t.arg=void 0),t.delegate=null,s):a:(t.method=\"throw\",t.arg=new TypeError(\"iterator result is not an object\"),t.delegate=null,s)}function x(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function E(e){var t=e.completion||{};t.type=\"normal\",delete t.arg,e.completion=t}function _(e){this.tryEntries=[{tryLoc:\"root\"}],e.forEach(x,this),this.reset(!0)}function C(e){if(e){var t=e[a];if(t)return t.call(e);if(\"function\"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,l=function t(){for(;++r=0;--a){var l=this.tryEntries[a],o=l.completion;if(\"root\"===l.tryLoc)return r(\"end\");if(l.tryLoc<=this.prev){var i=n.call(l,\"catchLoc\"),u=n.call(l,\"finallyLoc\");if(i&&u){if(this.prev=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,\"finallyLoc\")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),E(n),s}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if(\"throw\"===r.type){var a=r.arg;E(n)}return a}}throw new Error(\"illegal catch attempt\")},delegateYield:function(e,t,n){return this.delegate={iterator:C(e),resultName:t,nextLoc:n},\"next\"===this.method&&(this.arg=void 0),s}},e}function x(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n{var r=n(294),a=n(840);function l(e){for(var t=\"https://reactjs.org/docs/error-decoder.html?invariant=\"+e,n=1;n