@nocobase/plugin-block-iframe 1.7.0-beta.8 → 1.7.0

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.
@@ -7,4 +7,4 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
 
10
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react-i18next"),require("@formily/shared"),require("@nocobase/client"),require("antd"),require("@ant-design/icons"),require("@formily/react"),require("@formily/antd-v5"),require("react")):"function"==typeof define&&define.amd?define("@nocobase/plugin-block-iframe",["react-i18next","@formily/shared","@nocobase/client","antd","@ant-design/icons","@formily/react","@formily/antd-v5","react"],t):"object"==typeof exports?exports["@nocobase/plugin-block-iframe"]=t(require("react-i18next"),require("@formily/shared"),require("@nocobase/client"),require("antd"),require("@ant-design/icons"),require("@formily/react"),require("@formily/antd-v5"),require("react")):e["@nocobase/plugin-block-iframe"]=t(e["react-i18next"],e["@formily/shared"],e["@nocobase/client"],e.antd,e["@ant-design/icons"],e["@formily/react"],e["@formily/antd-v5"],e.react)}(self,function(e,t,r,n,o,a,i,l){return function(){"use strict";var c={753:function(e){var t=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;e.exports=!function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;var n=Object.getOwnPropertyNames(t).map(function(e){return t[e]});if("0123456789"!==n.join(""))return!1;var o={};if("abcdefghijklmnopqrst".split("").forEach(function(e){o[e]=e}),"abcdefghijklmnopqrst"!==Object.keys(Object.assign({},o)).join(""))return!1;return!0}catch(e){return!1}}()?function(e,o){for(var a,i,l=function(e){if(null==e)throw TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),c=1;c<arguments.length;c++){for(var u in a=Object(arguments[c]),a)r.call(a,u)&&(l[u]=a[u]);if(t){i=t(a);for(var s=0;s<i.length;s++)n.call(a,i[s])&&(l[i[s]]=a[i[s]])}}return l}:Object.assign},482:function(e){e.exports=o},632:function(e){e.exports=i},505:function(e){e.exports=a},875:function(e){e.exports=t},772:function(e){e.exports=r},721:function(e){e.exports=n},156:function(e){e.exports=l},238:function(t){t.exports=e}},u={};function s(e){var t=u[e];if(void 0!==t)return t.exports;var r=u[e]={exports:{}};return c[e](r,r.exports,s),r.exports}s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,{a:t}),t},s.d=function(e,t){for(var r in t)s.o(t,r)&&!s.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var f={};s.r(f),s.d(f,{default:function(){return W},PluginBlockIframeClient:function(){return Q}});var p=s("772"),m=s("156"),d=s.n(m),b=s("632"),h=s("505"),y=s("721"),v=s("238"),g=s("753"),O=s.n(g),w=({url:e,allowFullScreen:t,position:r,display:n,height:o,width:a,overflow:i,styles:l,onLoad:c,onMouseOver:u,onMouseOut:s,scrolling:f,id:p,frameBorder:m,ariaHidden:b,sandbox:h,allow:y,className:v,title:g,ariaLabel:w,ariaLabelledby:x,name:j,target:S,loading:P,importance:k,referrerpolicy:I,allowpaymentrequest:E,src:B,key:R})=>{let q=O()({src:B||e,target:S||null,style:{position:r||null,display:n||"initial",overflow:i||null},scrolling:f||null,allowpaymentrequest:E||null,importance:k||null,sandbox:h&&[...h].join(" ")||null,loading:P||null,styles:l||null,name:j||null,className:v||null,allowFullScreen:"allowFullScreen",referrerpolicy:I||null,title:g||null,allow:y||null,id:p||null,"aria-labelledby":x||null,"aria-hidden":b||null,"aria-label":w||null,width:a||null,height:o||null,onLoad:c||null,onMouseOver:u||null,onMouseOut:s||null,key:R||"iframe"}),C=Object.create(null);for(let e of Object.keys(q))null!=q[e]&&(C[e]=q[e]);for(let e of Object.keys(C.style))null==C.style[e]&&delete C.style[e];if(C.styles)for(let e of Object.keys(C.styles))C.styles.hasOwnProperty(e)&&(C.style[e]=C.styles[e]),Object.keys(C.styles).pop()==e&&delete C.styles;if(t){if("allow"in C){let e=C.allow.replace("fullscreen","");C.allow=`fullscreen ${e.trim()}`.trim()}else C.allow="fullscreen"}return m>=0&&!C.style.hasOwnProperty("border")&&(C.style.border=m),d().createElement("iframe",Object.assign({},C))},x=s("875");function j(e,t,r,n,o,a,i){try{var l=e[a](i),c=l.value}catch(e){r(e);return}l.done?t(c):Promise.resolve(c).then(n,o)}function S(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var a=e.apply(t,r);function i(e){j(a,n,o,i,l,"next",e)}function l(e){j(a,n,o,i,l,"throw",e)}i(void 0)})}}function P(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(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n,o,a;n=e,o=t,a=r[t],o in n?Object.defineProperty(n,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[o]=a})}return e}function k(e,t){var r,n,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(r)throw TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}function I(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function E(e,t,r,n,o,a,i){try{var l=e[a](i),c=l.value}catch(e){r(e);return}l.done?t(c):Promise.resolve(c).then(n,o)}function B(e){return"string"==typeof e&&!isNaN(e)&&!isNaN(parseFloat(e))}var R=(0,h.observer)(function(e){var t,r,n=e.url,o=e.htmlId,a=e.mode,i=void 0===a?"url":a,l=e.height,c=(e.html,e.params),u=e.engine,s=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],!(t.indexOf(r)>=0)&&(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++){if(r=a[n],!(t.indexOf(r)>=0))Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}}return o}(e,["url","htmlId","mode","height","html","params","engine"]),f=(0,h.useField)(),b=(0,v.useTranslation)().t,g=(0,p.useBlockHeight)()||l,O=(0,p.useVariables)(),x=(0,p.useLocalVariables)(),j=(0,p.useCompile)(),S=(0,p.useRequest)({url:"iframeHtml:getHtml/".concat(o)},{refreshDeps:[o,f.data],ready:"html"===i&&!!o}),P=S.loading,k=S.data,R=(0,p.useParseURLAndParams)().parseURLAndParams;var q=(t=(0,m.useState)(null),r=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var r,n,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],i=!0,l=!1;try{for(o=o.call(e);!(i=(r=o.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,n=e}finally{try{!i&&null!=o.return&&o.return()}finally{if(l)throw n}}return a}}(t,2)||function(e,t){if(e){if("string"==typeof e)return I(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return I(e,t)}}(t,r)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),C=q[0],T=q[1];return((0,m.useEffect)(function(){var e,t;(t=(e=function(){var e;return function(e,t){var r,n,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(r)throw TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,function(t){switch(t.label){case 0:if("html"!==i)return[3,2];return[4,(0,p.getRenderContent)(u,k,j(O),j(x),function(e){return e})];case 1:if(void 0===(e=t.sent()))return[2];return T("data:text/html;charset=utf-8,"+encodeURIComponent(e)),[3,5];case 2:return t.trys.push([2,4,,5]),[4,R(n,c||[])];case 3:return T(t.sent()),[3,5];case 4:return console.error("Error fetching target URL:",t.sent()),T("fallback-url"),[3,5];case 5:return[2]}})},function(){var t=this,r=arguments;return new Promise(function(n,o){var a=e.apply(t,r);function i(e){E(a,n,o,i,l,"next",e)}function l(e){E(a,n,o,i,l,"throw",e)}i(void 0)})}),function(){return t.apply(this,arguments)})()},[k,i,n,O,x,c]),("url"!==i||n)&&("html"!==i||o))?P&&!C?d().createElement("div",{style:{height:B(g)?"".concat(g,"px"):g||"60vh",marginBottom:"24px",border:0}},d().createElement(y.Spin,null)):d().createElement(w,function(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(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n,o,a;n=e,o=t,a=r[t],o in n?Object.defineProperty(n,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[o]=a})}return e}({url:C,width:"100%",display:"block",position:"relative",styles:{height:B(g)?"".concat(g,"px"):g||"60vh",marginBottom:"24px",border:0}},s)):d().createElement(y.Card,{style:{marginBottom:24,height:B(g)?"".concat(g,"px"):g}},b("Please fill in the iframe URL"))},{displayName:"Iframe"});R.Designer=function(){var e,t,r=(0,h.useField)(),n=(0,h.useFieldSchema)(),o=(0,v.useTranslation)().t,a=(0,p.useDesignable)().dn,i=(0,p.useAPIClient)(),l=n["x-component-props"]||{},c=l.mode,u=l.url,s=l.htmlId,f=l.height,m=void 0===f?"60vh":f;l.engine;var b=(e=S(function(e){var t,r,n,o,a,l,c,u;return k(this,function(f){switch(f.label){case 0:var p,m;if(t={values:{html:e}},!s)return[3,2];return[4,null===(r=(n=i.resource("iframeHtml")).update)||void 0===r?void 0:r.call(n,(p=P({},t),m=(m={filterByTk:s},m),Object.getOwnPropertyDescriptors?Object.defineProperties(p,Object.getOwnPropertyDescriptors(m)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(m)).forEach(function(e){Object.defineProperty(p,e,Object.getOwnPropertyDescriptor(m,e))}),p))];case 1:return[2,(null==(a=f.sent().data)?void 0:null===(o=a.data)||void 0===o?void 0:o[0])||{id:s}];case 2:return[4,null===(l=(c=i.resource("iframeHtml")).create)||void 0===l?void 0:l.call(c,t)];case 3:return[2,null==(u=f.sent().data)?void 0:u.data];case 4:return[2]}})}),function(t){return e.apply(this,arguments)});var y=(t=S(function(e){var t,o,i,l,c,u,s;return k(this,function(f){switch(f.label){case 0:if(t=e.mode,o=e.url,i=e.html,l=e.height,c=e.engine,(u=n["x-component-props"]||{}).mode=t,u.height=l,u.url=o,u.engine=c||"string","html"!==t)return[3,2];return[4,b(i)];case 1:s=f.sent(),u.htmlId=s.id,f.label=2;case 2:return n["x-component-props"]=u,r.componentProps=P({},u),r.data={v:(0,x.uid)()},a.emit("patch",{schema:{"x-uid":n["x-uid"],"x-component-props":u}}),[2]}})}),function(e){return t.apply(this,arguments)}),g=(0,p.useFormBlockContext)().form,O=(0,p.useRecord)(),w=(0,p.useVariableOptions)({collectionField:{uiSchema:n},form:g,record:O,uiSchema:n,noDisabled:!0});return d().createElement(p.GeneralSchemaDesigner,null,d().createElement(p.SchemaSettingsModalItem,{title:o("Edit iframe"),asyncGetInitialValues:S(function(){var e,t,r,n,o;return k(this,function(a){switch(a.label){case 0:if(e={mode:c,url:u,height:m},!s)return[3,2];return[4,null===(t=(r=i.resource("iframeHtml")).get)||void 0===t?void 0:t.call(r,{filterByTk:s})];case 1:o=a.sent().data,e.html=(null==o?void 0:null===(n=o.data)||void 0===n?void 0:n.html)||"",a.label=2;case 2:return[2,e]}})}),schema:{type:"object",title:o("Edit iframe"),properties:{mode:{title:'{{t("Mode")}}',"x-component":"Radio.Group","x-decorator":"FormItem",required:!0,default:"url",enum:[{value:"url",label:o("URL")},{value:"html",label:o("HTML")}]},url:{title:o("URL"),type:"string","x-decorator":"FormItem","x-component":"Variable.TextArea","x-component-props":{scope:w},required:!0,"x-reactions":{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "html"}}'}}}},engine:{title:'{{t("Template engine")}}',"x-component":"Radio.Group","x-decorator":"FormItem",enum:[{value:"string",label:o("String template")},{value:"handlebars",label:o("Handlebars")}],"x-reactions":{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "url"}}'}}}},html:{title:o("html"),type:"string","x-decorator":"FormItem","x-component":"Variable.RawTextArea","x-component-props":{scope:w,style:{minHeight:"200px"}},required:!0,"x-reactions":{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "url"}}'}}}},height:{title:o("Height"),type:"string","x-decorator":"FormItem","x-component":"Input",required:!0}}},onSubmit:y}),d().createElement(p.SchemaSettingsDivider,null),d().createElement(p.SchemaSettingsRemove,{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}))};var q=s("482"),C=function(){var e,t,r=(0,p.useSchemaInitializer)().insert,n=(0,p.useSchemaInitializerItem)();return d().createElement(p.SchemaInitializerItem,(e=function(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(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n,o,a;n=e,o=t,a=r[t],o in n?Object.defineProperty(n,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[o]=a})}return e}({},n),t=(t={icon:d().createElement(q.PicRightOutlined,null),onClick:function(){r({type:"void","x-settings":"blockSettings:iframe","x-decorator":"BlockItem","x-decorator-props":{name:"iframe"},"x-component":"Iframe","x-component-props":{}})}},t),Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e))},T=function(e){return d().createElement(p.SchemaComponentOptions,{components:{Iframe:R,IframeBlockInitializer:C,ArrayItems:b.ArrayItems}},e.children)};function F(e,t,r,n,o,a,i){try{var l=e[a](i),c=l.value}catch(e){r(e);return}l.done?t(c):Promise.resolve(c).then(n,o)}function M(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var a=e.apply(t,r);function i(e){F(a,n,o,i,l,"next",e)}function l(e){F(a,n,o,i,l,"throw",e)}i(void 0)})}}function D(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(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n,o,a;n=e,o=t,a=r[t],o in n?Object.defineProperty(n,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[o]=a})}return e}function H(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function z(e,t){var r,n,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(r)throw TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}var A={items:[{name:"EditIframe",type:"modal",useComponentProps:function(){var e,t,r,n=(0,h.useField)(),o=(0,h.useFieldSchema)(),a=(0,v.useTranslation)(),i=a.t,l=a.i18n,c=(0,p.useDesignable)().dn,u=(0,p.useAPIClient)(),s=o["x-component-props"]||{},f=s.mode,m=s.url,b=s.params,y=s.htmlId,g=s.height,O=void 0===g?"60vh":g,w=s.engine;var j=(e=M(function(e){var t,r,n,o,a,i,l,c;return z(this,function(s){switch(s.label){case 0:if(t={values:{html:e}},!y)return[3,2];return[4,null===(r=(n=u.resource("iframeHtml")).update)||void 0===r?void 0:r.call(n,H(D({},t),{filterByTk:y}))];case 1:return[2,(null==(a=s.sent().data)?void 0:null===(o=a.data)||void 0===o?void 0:o[0])||{id:y}];case 2:return[4,null===(i=(l=u.resource("iframeHtml")).create)||void 0===i?void 0:i.call(l,t)];case 3:return[2,null==(c=s.sent().data)?void 0:c.data];case 4:return[2]}})}),function(t){return e.apply(this,arguments)}),S=(0,p.useURLAndHTMLSchema)(),P=S.urlSchema,k=S.paramsSchema;var I=(t=M(function(e){var t,r,a,i,l,u,s,f;return z(this,function(p){switch(p.label){case 0:if(t=e.mode,r=e.url,a=e.html,i=e.height,l=e.params,u=e.engine,(s=o["x-component-props"]||{}).mode=t,s.height=i,s.engine=u||"string",s.params=l,s.url=r,"html"!==t)return[3,2];return[4,j(a)];case 1:f=p.sent(),s.htmlId=f.id,p.label=2;case 2:return o["x-component-props"]=s,n.componentProps=D({},s),n.data={v:(0,x.uid)()},c.emit("patch",{schema:{"x-uid":o["x-uid"],"x-component-props":s}}),[2]}})}),function(e){return t.apply(this,arguments)}),E=d().createElement(d().Fragment,null,d().createElement("span",{style:{marginLeft:".25em"},className:"ant-formily-item-extra"},i("Syntax references"),":")," ",d().createElement("a",{href:"https://".concat("zh-CN"===l.language?"docs-cn":"docs",".nocobase.com/handbook/template-handlebars"),target:"_blank",rel:"noreferrer"},"Handlebars.js"));return{title:i("Edit iframe"),asyncGetInitialValues:M(function(){var e,t,r,n,o;return z(this,function(a){switch(a.label){case 0:if(e={mode:f,url:m,height:O,engine:w,params:b},!y)return[3,2];return[4,null===(t=(r=u.resource("iframeHtml")).get)||void 0===t?void 0:t.call(r,{filterByTk:y})];case 1:o=a.sent().data,e.html=(null==o?void 0:null===(n=o.data)||void 0===n?void 0:n.html)||"",a.label=2;case 2:return[2,e]}})}),schema:{type:"object",title:i("Edit iframe"),properties:{mode:{title:'{{t("Mode")}}',"x-component":"Radio.Group","x-decorator":"FormItem",required:!0,default:"url",enum:[{value:"url",label:i("URL")},{value:"html",label:i("HTML")}]},url:H(D({},P),{required:!0}),params:k,engine:{title:'{{t("Template engine")}}',"x-component":"Radio.Group","x-decorator":"FormItem",default:"string",enum:[{value:"string",label:i("String template")},{value:"handlebars",label:i("Handlebars")}],"x-reactions":{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "url"}}'}}}},html:{title:i("html"),type:"string","x-decorator":"FormItem","x-component":(r=p.Variable.RawTextArea,function(e){var t=(0,h.useFieldSchema)(),n=(0,p.useFormBlockContext)().form,o=(0,p.useRecord)(),a=(0,p.useVariableOptions)({collectionField:{uiSchema:t},form:n,record:o,uiSchema:t,noDisabled:!0});return d().createElement(r,H(D({},e),{scope:a}))}),"x-component-props":{rows:10},required:!0,description:E,"x-reactions":[{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "url"}}'}}},function(e){"handlebars"===e.form.values.engine?e.description=E:e.description=null}]}}},onSubmit:I,noRecord:!0}}},{name:"setTheBlockHeight",Component:p.SchemaSettingsBlockHeightItem},{name:"divider",type:"divider"},{name:"delete",type:"remove",useComponentProps:function(){return{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}}}]},L=new p.SchemaSettings(D({name:"iframeBlockSchemaSettings"},A)),_=new p.SchemaSettings(D({name:"blockSettings:iframe"},A));function G(e,t,r,n,o,a,i){try{var l=e[a](i),c=l.value}catch(e){r(e);return}l.done?t(c):Promise.resolve(c).then(n,o)}function N(e,t,r){return(N=K()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&$(o,r.prototype),o}).apply(null,arguments)}function U(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function V(e){return(V=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function $(e,t){return($=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function J(e){var t="function"==typeof Map?new Map:void 0;return(J=function(e){var r;if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return N(e,arguments,V(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),$(n,e)})(e)}function K(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(K=function(){return!!e})()}var Q=function(e){var t,r,n;function o(){var e,t,r;return!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,o),e=this,t=o,r=arguments,t=V(t),function(e,t){return t&&("object"===function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t)||"function"==typeof t)?t:function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,K()?Reflect.construct(t,r||[],V(e).constructor):t.apply(e,r))}return!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&$(e,t)}(o,e),t=o,r=[{key:"load",value:function(){var e,t=this;return(e=function(){var e,r,n,o;return function(e,t){var r,n,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(r)throw TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,function(a){return t.app.schemaSettingsManager.add(L),t.app.schemaSettingsManager.add(_),t.app.use(T),null==(e=t.app.schemaInitializerManager.get("page:addBlock"))||e.add("otherBlocks.iframe",{title:'{{t("Iframe")}}',Component:"IframeBlockInitializer"}),null==(r=t.app.schemaInitializerManager.get("popup:addNew:addBlock"))||r.add("otherBlocks.iframe",{title:'{{t("Iframe")}}',Component:"IframeBlockInitializer"}),null==(n=t.app.schemaInitializerManager.get("popup:common:addBlock"))||n.add("otherBlocks.iframe",{title:'{{t("Iframe")}}',Component:"IframeBlockInitializer"}),null==(o=t.app.schemaInitializerManager.get("RecordFormBlockInitializers"))||o.add("otherBlocks.iframe",{title:'{{t("Iframe")}}',Component:"IframeBlockInitializer"}),t.app.schemaInitializerManager.addItem("mobilePage:addBlock","otherBlocks.iframe",{title:'{{t("Iframe")}}',Component:"IframeBlockInitializer"}),t.app.schemaInitializerManager.addItem("mobile:addBlock","otherBlocks.iframe",{title:'{{t("Iframe")}}',Component:"IframeBlockInitializer"}),[2]})},function(){var t=this,r=arguments;return new Promise(function(n,o){var a=e.apply(t,r);function i(e){G(a,n,o,i,l,"next",e)}function l(e){G(a,n,o,i,l,"throw",e)}i(void 0)})})()}}],U(t.prototype,r),o}(J(p.Plugin)),W=Q;return f}()});
10
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@formily/shared"),require("@nocobase/client"),require("@formily/antd-v5"),require("react"),require("@formily/react"),require("@ant-design/icons"),require("antd"),require("react-i18next")):"function"==typeof define&&define.amd?define("@nocobase/plugin-block-iframe",["@formily/shared","@nocobase/client","@formily/antd-v5","react","@formily/react","@ant-design/icons","antd","react-i18next"],t):"object"==typeof exports?exports["@nocobase/plugin-block-iframe"]=t(require("@formily/shared"),require("@nocobase/client"),require("@formily/antd-v5"),require("react"),require("@formily/react"),require("@ant-design/icons"),require("antd"),require("react-i18next")):e["@nocobase/plugin-block-iframe"]=t(e["@formily/shared"],e["@nocobase/client"],e["@formily/antd-v5"],e.react,e["@formily/react"],e["@ant-design/icons"],e.antd,e["react-i18next"])}(self,function(e,t,r,n,o,l,a,i){return function(){"use strict";var c={753:function(e){var t=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;e.exports=!function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;var n=Object.getOwnPropertyNames(t).map(function(e){return t[e]});if("0123456789"!==n.join(""))return!1;var o={};if("abcdefghijklmnopqrst".split("").forEach(function(e){o[e]=e}),"abcdefghijklmnopqrst"!==Object.keys(Object.assign({},o)).join(""))return!1;return!0}catch(e){return!1}}()?function(e,o){for(var l,a,i=function(e){if(null==e)throw TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),c=1;c<arguments.length;c++){for(var u in l=Object(arguments[c]))r.call(l,u)&&(i[u]=l[u]);if(t){a=t(l);for(var s=0;s<a.length;s++)n.call(l,a[s])&&(i[a[s]]=l[a[s]])}}return i}:Object.assign},482:function(e){e.exports=l},632:function(e){e.exports=r},505:function(e){e.exports=o},875:function(t){t.exports=e},772:function(e){e.exports=t},721:function(e){e.exports=a},156:function(e){e.exports=n},238:function(e){e.exports=i}},u={};function s(e){var t=u[e];if(void 0!==t)return t.exports;var r=u[e]={exports:{}};return c[e](r,r.exports,s),r.exports}s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,{a:t}),t},s.d=function(e,t){for(var r in t)s.o(t,r)&&!s.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var p={};return!function(){s.r(p),s.d(p,{PluginBlockIframeClient:function(){return N},default:function(){return _}});var e=s(772),t=s(156),r=s.n(t),n=s(632),o=s(505),l=s(721),a=s(238),i=s(753),c=s.n(i),u=({url:e,allowFullScreen:t,position:n,display:o,height:l,width:a,overflow:i,styles:u,onLoad:s,onMouseOver:p,onMouseOut:f,scrolling:m,id:d,frameBorder:h,ariaHidden:b,sandbox:y,allow:g,className:v,title:w,ariaLabel:O,ariaLabelledby:x,name:j,target:P,loading:S,importance:k,referrerpolicy:E,allowpaymentrequest:I,src:C,key:M})=>{let T=c()({src:C||e,target:P||null,style:{position:n||null,display:o||"initial",overflow:i||null},scrolling:m||null,allowpaymentrequest:I||null,importance:k||null,sandbox:y&&[...y].join(" ")||null,loading:S||null,styles:u||null,name:j||null,className:v||null,allowFullScreen:"allowFullScreen",referrerpolicy:E||null,title:w||null,allow:g||null,id:d||null,"aria-labelledby":x||null,"aria-hidden":b||null,"aria-label":O||null,width:a||null,height:l||null,onLoad:s||null,onMouseOver:p||null,onMouseOut:f||null,key:M||"iframe"}),R=Object.create(null);for(let e of Object.keys(T))null!=T[e]&&(R[e]=T[e]);for(let e of Object.keys(R.style))null==R.style[e]&&delete R.style[e];if(R.styles)for(let e of Object.keys(R.styles))R.styles.hasOwnProperty(e)&&(R.style[e]=R.styles[e]),Object.keys(R.styles).pop()==e&&delete R.styles;if(t)if("allow"in R){let e=R.allow.replace("fullscreen","");R.allow=`fullscreen ${e.trim()}`.trim()}else R.allow="fullscreen";return h>=0&&!R.style.hasOwnProperty("border")&&(R.style.border=h),r().createElement("iframe",Object.assign({},R))},f=s(875);function m(e,t,r,n,o,l,a){try{var i=e[l](a),c=i.value}catch(e){r(e);return}i.done?t(c):Promise.resolve(c).then(n,o)}function d(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var l=e.apply(t,r);function a(e){m(l,n,o,a,i,"next",e)}function i(e){m(l,n,o,a,i,"throw",e)}a(void 0)})}}function h(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(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}function b(e,t){var r,n,o,l,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return l={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(l[Symbol.iterator]=function(){return this}),l;function i(l){return function(i){var c=[l,i];if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function g(e,t,r,n,o,l,a){try{var i=e[l](a),c=i.value}catch(e){r(e);return}i.done?t(c):Promise.resolve(c).then(n,o)}function v(e){return"string"==typeof e&&!isNaN(e)&&!isNaN(parseFloat(e))}var w=(0,o.observer)(function(n){var i,c=n.url,s=n.htmlId,p=n.mode,f=void 0===p?"url":p,m=n.height,d=(n.html,n.params),h=n.engine,b=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},l=Object.keys(e);for(n=0;n<l.length;n++)r=l[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n<l.length;n++)r=l[n],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(n,["url","htmlId","mode","height","html","params","engine"]),w=(0,o.useField)(),O=(0,a.useTranslation)().t,x=l.theme.useToken().token,j=(0,e.useBlockHeight)()||m,P=(0,e.useVariables)(),S=(0,e.useLocalVariables)(),k=(0,e.useCompile)(),E=(0,e.useRequest)({url:"iframeHtml:getHtml/".concat(s)},{refreshDeps:[s,w.data],ready:"html"===f&&!!s}),I=E.loading,C=E.data,M=(0,e.useParseURLAndParams)().parseURLAndParams,T=(i=(0,t.useState)(null),function(e){if(Array.isArray(e))return e}(i)||function(e,t){var r,n,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var l=[],a=!0,i=!1;try{for(o=o.call(e);!(a=(r=o.next()).done)&&(l.push(r.value),l.length!==t);a=!0);}catch(e){i=!0,n=e}finally{try{a||null==o.return||o.return()}finally{if(i)throw n}}return l}}(i,2)||function(e,t){if(e){if("string"==typeof e)return y(e,2);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return y(e,t)}}(i,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),R=T[0],B=T[1];return((0,t.useEffect)(function(){var t,r;(t=function(){var t;return function(e,t){var r,n,o,l,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return l={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(l[Symbol.iterator]=function(){return this}),l;function i(l){return function(i){var c=[l,i];if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(r){switch(r.label){case 0:if("html"!==f)return[3,2];return[4,(0,e.getRenderContent)(h,C,k(P),k(S),function(e){return e})];case 1:if(void 0===(t=r.sent()))return[2];return B("data:text/html;charset=utf-8,"+encodeURIComponent(t)),[3,5];case 2:return r.trys.push([2,4,,5]),[4,M(c,d||[])];case 3:return B(r.sent()),[3,5];case 4:return console.error("Error fetching target URL:",r.sent()),B("fallback-url"),[3,5];case 5:return[2]}})},r=function(){var e=this,r=arguments;return new Promise(function(n,o){var l=t.apply(e,r);function a(e){g(l,n,o,a,i,"next",e)}function i(e){g(l,n,o,a,i,"throw",e)}a(void 0)})},function(){return r.apply(this,arguments)})()},[C,f,c,P,S,d]),("url"!==f||c)&&("html"!==f||s))?I&&!R?r().createElement("div",{style:{height:v(j)?"".concat(j,"px"):j||"60vh",marginBottom:x.padding,border:0}},r().createElement(l.Spin,null)):r().createElement(u,function(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(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}({url:R,width:"100%",display:"block",position:"relative",styles:{height:v(j)?"".concat(j,"px"):j||"60vh",marginBottom:"24px",border:0}},b)):r().createElement(l.Card,{style:{marginBottom:x.padding,height:v(j)?"".concat(j,"px"):j}},O("Please fill in the iframe URL"))},{displayName:"Iframe"});w.Designer=function(){var t,n,l=(0,o.useField)(),i=(0,o.useFieldSchema)(),c=(0,a.useTranslation)().t,u=(0,e.useDesignable)().dn,s=(0,e.useAPIClient)(),p=i["x-component-props"]||{},m=p.mode,y=p.url,g=p.htmlId,v=p.height,w=void 0===v?"60vh":v;p.engine;var O=(t=d(function(e){var t,r,n,o,l,a,i,c;return b(this,function(u){switch(u.label){case 0:var p,f;if(t={values:{html:e}},!g)return[3,2];return[4,null==(r=(n=s.resource("iframeHtml")).update)?void 0:r.call(n,(p=h({},t),f=f={filterByTk:g},Object.getOwnPropertyDescriptors?Object.defineProperties(p,Object.getOwnPropertyDescriptors(f)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(f)).forEach(function(e){Object.defineProperty(p,e,Object.getOwnPropertyDescriptor(f,e))}),p))];case 1:return[2,(null==(l=u.sent().data)||null==(o=l.data)?void 0:o[0])||{id:g}];case 2:return[4,null==(a=(i=s.resource("iframeHtml")).create)?void 0:a.call(i,t)];case 3:return[2,null==(c=u.sent().data)?void 0:c.data];case 4:return[2]}})}),function(e){return t.apply(this,arguments)}),x=(n=d(function(e){var t,r,n,o,a,c,s;return b(this,function(p){switch(p.label){case 0:if(t=e.mode,r=e.url,n=e.html,o=e.height,a=e.engine,(c=i["x-component-props"]||{}).mode=t,c.height=o,c.url=r,c.engine=a||"string","html"!==t)return[3,2];return[4,O(n)];case 1:s=p.sent(),c.htmlId=s.id,p.label=2;case 2:return i["x-component-props"]=c,l.componentProps=h({},c),l.data={v:(0,f.uid)()},u.emit("patch",{schema:{"x-uid":i["x-uid"],"x-component-props":c}}),[2]}})}),function(e){return n.apply(this,arguments)}),j=(0,e.useFormBlockContext)().form,P=(0,e.useRecord)(),S=(0,e.useVariableOptions)({collectionField:{uiSchema:i},form:j,record:P,uiSchema:i,noDisabled:!0});return r().createElement(e.GeneralSchemaDesigner,null,r().createElement(e.SchemaSettingsModalItem,{title:c("Edit iframe"),asyncGetInitialValues:d(function(){var e,t,r,n,o;return b(this,function(l){switch(l.label){case 0:if(e={mode:m,url:y,height:w},!g)return[3,2];return[4,null==(t=(r=s.resource("iframeHtml")).get)?void 0:t.call(r,{filterByTk:g})];case 1:o=l.sent().data,e.html=(null==o||null==(n=o.data)?void 0:n.html)||"",l.label=2;case 2:return[2,e]}})}),schema:{type:"object",title:c("Edit iframe"),properties:{mode:{title:'{{t("Mode")}}',"x-component":"Radio.Group","x-decorator":"FormItem",required:!0,default:"url",enum:[{value:"url",label:c("URL")},{value:"html",label:c("HTML")}]},url:{title:c("URL"),type:"string","x-decorator":"FormItem","x-component":"Variable.TextArea","x-component-props":{scope:S},required:!0,"x-reactions":{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "html"}}'}}}},engine:{title:'{{t("Template engine")}}',"x-component":"Radio.Group","x-decorator":"FormItem",enum:[{value:"string",label:c("String template")},{value:"handlebars",label:c("Handlebars")}],"x-reactions":{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "url"}}'}}}},html:{title:c("html"),type:"string","x-decorator":"FormItem","x-component":"Variable.RawTextArea","x-component-props":{scope:S,style:{minHeight:"200px"}},required:!0,"x-reactions":{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "url"}}'}}}},height:{title:c("Height"),type:"string","x-decorator":"FormItem","x-component":"Input",required:!0}}},onSubmit:x}),r().createElement(e.SchemaSettingsDivider,null),r().createElement(e.SchemaSettingsRemove,{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}))};var O=s(482),x=function(){var t,n,o=(0,e.useSchemaInitializer)().insert,l=(0,e.useSchemaInitializerItem)();return r().createElement(e.SchemaInitializerItem,(t=function(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(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}({},l),n=n={icon:r().createElement(O.PicRightOutlined,null),onClick:function(){o({type:"void","x-settings":"blockSettings:iframe","x-decorator":"BlockItem","x-decorator-props":{name:"iframe"},"x-component":"Iframe","x-component-props":{}})}},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t))},j=function(t){return r().createElement(e.SchemaComponentOptions,{components:{Iframe:w,IframeBlockInitializer:x,ArrayItems:n.ArrayItems}},t.children)};function P(e,t,r,n,o,l,a){try{var i=e[l](a),c=i.value}catch(e){r(e);return}i.done?t(c):Promise.resolve(c).then(n,o)}function S(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var l=e.apply(t,r);function a(e){P(l,n,o,a,i,"next",e)}function i(e){P(l,n,o,a,i,"throw",e)}a(void 0)})}}function k(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(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}function E(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function I(e,t){var r,n,o,l,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return l={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(l[Symbol.iterator]=function(){return this}),l;function i(l){return function(i){var c=[l,i];if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}var C=function(t){return r().createElement(e.FlagProvider,{collectionField:!0},t.children)},M=function(e){var t=e.type,n=(0,a.useTranslation)(),o=n.t,i=n.i18n,c={autoplay:o("Controls whether the current document is allowed to autoplay media requested through the HTMLMediaElement interface. When this policy is disabled and there were no user gestures, the Promise returned by HTMLMediaElement.play() will reject with a NotAllowedError DOMException. The autoplay attribute on <audio> and <video> elements will be ignored."),camera:o("Controls whether the current document is allowed to use video input devices. When this policy is disabled, the Promise returned by getUserMedia() will reject with a NotAllowedError DOMException."),"document-domain":o("Controls whether the current document is allowed to set document.domain. When this policy is disabled, attempting to set document.domain will fail and cause a SecurityError DOMException to be thrown."),"encrypted-media":o("Controls whether the current document is allowed to use the Encrypted Media Extensions API (EME). When this policy is disabled, the Promise returned by Navigator.requestMediaKeySystemAccess() will reject with a SecurityError DOMException."),fullscreen:o("Controls whether the current document is allowed to use Element.requestFullscreen(). When this policy is disabled, the returned Promise rejects with a TypeError."),geolocation:o("Controls whether the current document is allowed to use the Geolocation Interface. When this policy is disabled, calls to getCurrentPosition() and watchPosition() will cause those functions callbacks to be invoked with a GeolocationPositionError code of PERMISSION_DENIED."),microphone:o("Controls whether the current document is allowed to use audio input devices. When this policy is disabled, the Promise returned by MediaDevices.getUserMedia() will reject with a NotAllowedError DOMException."),midi:o("Controls whether the current document is allowed to use the Web MIDI API. When this policy is disabled, the Promise returned by Navigator.requestMIDIAccess() will reject with a SecurityError DOMException."),payment:o("Controls whether the current document is allowed to use the Payment Request API. When this policy is enabled, the PaymentRequest() constructor will throw a SecurityError DOMException.")}[t];return r().createElement("span",null,t," ",r().createElement(l.Tooltip,{zIndex:9999,title:r().createElement("span",null,c," ",r().createElement("a",{href:"https://developer.mozilla.org/".concat("zh-CN"===i.language?"zh-CN":"en-US","/docs/Web/HTTP/Reference/Headers/Permissions-Policy/").concat(t),target:"_blank",rel:"noreferrer"},r().createElement(O.LinkOutlined,null)))},r().createElement(O.QuestionCircleOutlined,null)))},T=function(){var e=(0,a.useTranslation)(),t=e.t,n="zh-CN"===e.i18n.language?"https://developer.mozilla.org/zh-CN/docs/Web/HTML/Reference/Elements/iframe#allow":"https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/iframe#allow";return r().createElement("span",null,t("Specifies a Permissions Policy for the <iframe>. The policy defines what features are available to the <iframe> (for example, access to the microphone, camera, battery, web-share, etc.) based on the origin of the request.")," ",r().createElement("a",{href:n,target:"_blank",rel:"noreferrer"},r().createElement(O.LinkOutlined,null)))},R={items:[{name:"EditIframe",type:"modal",useComponentProps:function(){var t,n,i,c=(0,o.useField)(),u=(0,o.useFieldSchema)(),s=(0,a.useTranslation)(),p=s.t,m=s.i18n,d=(0,e.useDesignable)().dn,h=(0,e.useAPIClient)(),b=u["x-component-props"]||{},y=b.mode,g=b.url,v=b.params,w=b.htmlId,O=b.height,x=void 0===O?"60vh":O,j=b.engine,P=b.allow,R=(t=S(function(e){var t,r,n,o,l,a,i,c;return I(this,function(u){switch(u.label){case 0:if(t={values:{html:e}},!w)return[3,2];return[4,null==(r=(n=h.resource("iframeHtml")).update)?void 0:r.call(n,E(k({},t),{filterByTk:w}))];case 1:return[2,(null==(l=u.sent().data)||null==(o=l.data)?void 0:o[0])||{id:w}];case 2:return[4,null==(a=(i=h.resource("iframeHtml")).create)?void 0:a.call(i,t)];case 3:return[2,null==(c=u.sent().data)?void 0:c.data];case 4:return[2]}})}),function(e){return t.apply(this,arguments)}),B=(0,e.useURLAndHTMLSchema)(),q=B.urlSchema,D=B.paramsSchema,F=(n=S(function(e){var t,r,n,o,l,a,i,s,p;return I(this,function(m){switch(m.label){case 0:if(t=e.mode,r=e.url,n=e.html,o=e.height,l=e.params,a=e.engine,i=e.allow,(s=u["x-component-props"]||{}).mode=t,s.height=o,s.engine=a||"string",s.params=l,s.url=r,s.allow=i,"html"!==t)return[3,2];return[4,R(n)];case 1:p=m.sent(),s.htmlId=p.id,m.label=2;case 2:return u["x-component-props"]=s,c.componentProps=k({},s),c.data={v:(0,f.uid)()},d.emit("patch",{schema:{"x-uid":u["x-uid"],"x-component-props":s}}),[2]}})}),function(e){return n.apply(this,arguments)}),z=r().createElement(r().Fragment,null,r().createElement("span",{style:{marginLeft:".25em"},className:"ant-formily-item-extra"},p("Syntax references"),":")," ",r().createElement("a",{href:"https://".concat("zh-CN"===m.language?"docs-cn":"docs",".nocobase.com/handbook/template-handlebars"),target:"_blank",rel:"noreferrer"},"Handlebars.js"));return{title:p("Edit iframe"),asyncGetInitialValues:S(function(){var e,t,r,n,o;return I(this,function(l){switch(l.label){case 0:if(e={mode:y,url:g,height:x,engine:j,params:v,allow:P},!w)return[3,2];return[4,null==(t=(r=h.resource("iframeHtml")).get)?void 0:t.call(r,{filterByTk:w})];case 1:o=l.sent().data,e.html=(null==o||null==(n=o.data)?void 0:n.html)||"",l.label=2;case 2:return[2,e]}})}),schema:{type:"object",title:p("Edit iframe"),properties:{container:{type:"void","x-component":C,properties:{mode:{title:'{{t("Mode")}}',"x-component":"Radio.Group","x-decorator":"FormItem",required:!0,default:"url",enum:[{value:"url",label:p("URL")},{value:"html",label:p("HTML")}]},url:E(k({},q),{required:!0}),allow:{title:"Allow",type:"string","x-decorator":"FormItem","x-component":function(e){return r().createElement(l.Select,E(k({},e),{allowClear:!0,options:[{value:"autoplay",label:r().createElement(M,{type:"autoplay"})},{value:"camera",label:r().createElement(M,{type:"camera"})},{value:"document-domain",label:r().createElement(M,{type:"document-domain"})},{value:"encrypted-media",label:r().createElement(M,{type:"encrypted-media"})},{value:"fullscreen",label:r().createElement(M,{type:"fullscreen"})},{value:"geolocation",label:r().createElement(M,{type:"geolocation"})},{value:"microphone",label:r().createElement(M,{type:"microphone"})},{value:"midi",label:r().createElement(M,{type:"midi"})},{value:"payment",label:r().createElement(M,{type:"payment"})}]}))},description:r().createElement(T,null)},params:D,engine:{title:'{{t("Template engine")}}',"x-component":"Radio.Group","x-decorator":"FormItem",default:"string",enum:[{value:"string",label:p("String template")},{value:"handlebars",label:p("Handlebars")}],"x-reactions":{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "url"}}'}}}},html:{title:p("html"),type:"string","x-decorator":"FormItem","x-component":(i=e.Variable.RawTextArea,function(t){var n=(0,o.useFieldSchema)(),l=(0,e.useFormBlockContext)().form,a=(0,e.useRecord)(),c=(0,e.useVariableOptions)({collectionField:{uiSchema:n},form:l,record:a,uiSchema:n,noDisabled:!0});return r().createElement(i,E(k({},t),{scope:c}))}),"x-component-props":{rows:10},required:!0,description:z,"x-reactions":[{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "url"}}'}}},function(e){"handlebars"===e.form.values.engine?e.description=z:e.description=null}]}}}}},onSubmit:F,noRecord:!0,width:600}}},{name:"setTheBlockHeight",Component:e.SchemaSettingsBlockHeightItem},{name:"blockLinkageRules",Component:e.SchemaSettingsLinkageRules,useComponentProps:function(){return{title:(0,(0,a.useTranslation)().t)("Block Linkage rules"),category:e.LinkageRuleCategory.block}}},{name:"divider",type:"divider"},{name:"delete",type:"remove",useComponentProps:function(){return{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}}}]},B=new e.SchemaSettings(k({name:"iframeBlockSchemaSettings"},R)),q=new e.SchemaSettings(k({name:"blockSettings:iframe"},R));function D(e,t,r,n,o,l,a){try{var i=e[l](a),c=i.value}catch(e){r(e);return}i.done?t(c):Promise.resolve(c).then(n,o)}function F(e,t,r){return(F=L()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&A(o,r.prototype),o}).apply(null,arguments)}function z(e){return(z=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function A(e,t){return(A=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function H(e){var t="function"==typeof Map?new Map:void 0;return(H=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return F(e,arguments,z(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),A(r,e)})(e)}function L(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(L=function(){return!!e})()}var N=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return e=r,t=arguments,e=z(e),function(e,t){var r;if(t&&("object"==((r=t)&&"undefined"!=typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,L()?Reflect.construct(e,t||[],z(this).constructor):e.apply(this,t))}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&A(r,e),t=[{key:"load",value:function(){var e,t=this;return(e=function(){var e,r,n,o;return function(e,t){var r,n,o,l,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return l={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(l[Symbol.iterator]=function(){return this}),l;function i(l){return function(i){var c=[l,i];if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(l){return t.app.schemaSettingsManager.add(B),t.app.schemaSettingsManager.add(q),t.app.use(j),null==(e=t.app.schemaInitializerManager.get("page:addBlock"))||e.add("otherBlocks.iframe",{title:'{{t("Iframe")}}',Component:"IframeBlockInitializer"}),null==(r=t.app.schemaInitializerManager.get("popup:addNew:addBlock"))||r.add("otherBlocks.iframe",{title:'{{t("Iframe")}}',Component:"IframeBlockInitializer"}),null==(n=t.app.schemaInitializerManager.get("popup:common:addBlock"))||n.add("otherBlocks.iframe",{title:'{{t("Iframe")}}',Component:"IframeBlockInitializer"}),null==(o=t.app.schemaInitializerManager.get("RecordFormBlockInitializers"))||o.add("otherBlocks.iframe",{title:'{{t("Iframe")}}',Component:"IframeBlockInitializer"}),t.app.schemaInitializerManager.addItem("mobilePage:addBlock","otherBlocks.iframe",{title:'{{t("Iframe")}}',Component:"IframeBlockInitializer"}),t.app.schemaInitializerManager.addItem("mobile:addBlock","otherBlocks.iframe",{title:'{{t("Iframe")}}',Component:"IframeBlockInitializer"}),[2]})},function(){var t=this,r=arguments;return new Promise(function(n,o){var l=e.apply(t,r);function a(e){D(l,n,o,a,i,"next",e)}function i(e){D(l,n,o,a,i,"throw",e)}a(void 0)})})()}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(r.prototype,t),r}(H(e.Plugin)),_=N}(),p}()});
@@ -10,14 +10,14 @@
10
10
  module.exports = {
11
11
  "@formily/react": "2.3.0",
12
12
  "@formily/shared": "2.3.2",
13
- "@nocobase/client": "1.7.0-beta.8",
13
+ "@nocobase/client": "1.7.0",
14
14
  "react": "18.2.0",
15
15
  "react-i18next": "11.18.6",
16
- "antd": "5.12.8",
16
+ "antd": "5.24.2",
17
17
  "@ant-design/icons": "5.6.1",
18
- "@formily/antd-v5": "1.1.9",
19
- "@nocobase/server": "1.7.0-beta.8",
20
- "@nocobase/test": "1.7.0-beta.8",
21
- "@nocobase/actions": "1.7.0-beta.8",
22
- "@nocobase/database": "1.7.0-beta.8"
18
+ "@formily/antd-v5": "1.2.3",
19
+ "@nocobase/server": "1.7.0",
20
+ "@nocobase/test": "1.7.0",
21
+ "@nocobase/actions": "1.7.0",
22
+ "@nocobase/database": "1.7.0"
23
23
  };
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "displayName.zh-CN": "区块:iframe",
5
5
  "description": "Create an iframe block on the page to embed and display external web pages or content.",
6
6
  "description.zh-CN": "在页面上创建和管理iframe,用于嵌入和展示外部网页或内容。",
7
- "version": "1.7.0-beta.8",
7
+ "version": "1.7.0",
8
8
  "license": "AGPL-3.0",
9
9
  "main": "./dist/server/index.js",
10
10
  "homepage": "https://docs.nocobase.com/handbook/block-iframe",
@@ -25,7 +25,7 @@
25
25
  "@nocobase/server": "1.x",
26
26
  "@nocobase/test": "1.x"
27
27
  },
28
- "gitHead": "9ad35ee90db98d95dfa660645d155f4f4e81b47c",
28
+ "gitHead": "767ae089e404a104d718962272289c0bec01803a",
29
29
  "keywords": [
30
30
  "Blocks"
31
31
  ]