@nocobase/plugin-block-iframe 1.4.0-beta.8 → 1.4.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.
@@ -11,4 +11,4 @@
11
11
  object-assign
12
12
  (c) Sindre Sorhus
13
13
  @license MIT
14
- */var G=Object.getOwnPropertySymbols,Z=Object.prototype.hasOwnProperty,ee=Object.prototype.propertyIsEnumerable;function te(o){if(o==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(o)}function re(){try{if(!Object.assign)return!1;var o=new String("abc");if(o[5]="de",Object.getOwnPropertyNames(o)[0]==="5")return!1;for(var a={},t=0;t<10;t++)a["_"+String.fromCharCode(t)]=t;var i=Object.getOwnPropertyNames(a).map(function(f){return a[f]});if(i.join("")!=="0123456789")return!1;var s={};return"abcdefghijklmnopqrst".split("").forEach(function(f){s[f]=f}),Object.keys(Object.assign({},s)).join("")==="abcdefghijklmnopqrst"}catch(f){return!1}}var ne=re()?Object.assign:function(o,a){for(var t,i=te(o),s,f=1;f<arguments.length;f++){t=Object(arguments[f]);for(var k in t)Z.call(t,k)&&(i[k]=t[k]);if(G){s=G(t);for(var g=0;g<s.length;g++)ee.call(t,s[g])&&(i[s[g]]=t[s[g]])}}return i};const oe=Y(ne),ae=({url:o,allowFullScreen:a,position:t,display:i,height:s,width:f,overflow:k,styles:g,onLoad:T,onMouseOver:B,onMouseOut:M,scrolling:y,id:F,frameBorder:C,ariaHidden:P,sandbox:x,allow:b,className:l,title:d,ariaLabel:u,ariaLabelledby:I,name:c,target:m,loading:A,importance:p,referrerpolicy:E,allowpaymentrequest:ue,src:pe,key:fe})=>{const D=oe({src:pe||o,target:m||null,style:{position:t||null,display:i||"initial",overflow:k||null},scrolling:y||null,allowpaymentrequest:ue||null,importance:p||null,sandbox:x&&[...x].join(" ")||null,loading:A||null,styles:g||null,name:c||null,className:l||null,allowFullScreen:"allowFullScreen",referrerpolicy:E||null,title:d||null,allow:b||null,id:F||null,"aria-labelledby":I||null,"aria-hidden":P||null,"aria-label":u||null,width:f||null,height:s||null,onLoad:T||null,onMouseOver:B||null,onMouseOut:M||null,key:fe||"iframe"});let h=Object.create(null);for(let v of Object.keys(D))D[v]!=null&&(h[v]=D[v]);for(let v of Object.keys(h.style))h.style[v]==null&&delete h.style[v];if(h.styles)for(let v of Object.keys(h.styles))h.styles.hasOwnProperty(v)&&(h.style[v]=h.styles[v]),Object.keys(h.styles).pop()==v&&delete h.styles;if(a)if("allow"in h){const v=h.allow.replace("fullscreen","");h.allow=`fullscreen ${v.trim()}`.trim()}else h.allow="fullscreen";return C>=0&&(h.style.hasOwnProperty("border")||(h.style.border=C)),z.createElement("iframe",Object.assign({},h))},se=()=>{const o=O.useField(),a=O.useFieldSchema(),{t}=q.useTranslation(),{dn:i}=e.useDesignable(),s=e.useAPIClient(),{mode:f,url:k,htmlId:g,height:T="60vh",engine:B}=a["x-component-props"]||{},M=x=>H(this,null,function*(){var l,d,u,I,c;const b={values:{html:x}};if(g){const{data:m}=yield(d=(l=s.resource("iframeHtml")).update)==null?void 0:d.call(l,N(w({},b),{filterByTk:g}));return((u=m==null?void 0:m.data)==null?void 0:u[0])||{id:g}}else{const{data:m}=yield(c=(I=s.resource("iframeHtml")).create)==null?void 0:c.call(I,b);return m==null?void 0:m.data}}),y=I=>H(this,[I],function*({mode:x,url:b,html:l,height:d,engine:u}){const c=a["x-component-props"]||{};if(c.mode=x,c.height=d,c.url=b,c.engine=u||"string",x==="html"){const m=yield M(l);c.htmlId=m.id}a["x-component-props"]=c,o.componentProps=w({},c),o.data={v:j.uid()},i.emit("patch",{schema:{"x-uid":a["x-uid"],"x-component-props":c}})}),{form:F}=e.useFormBlockContext(),C=e.useRecord(),P=e.useVariableOptions({collectionField:{uiSchema:a},form:F,record:C,uiSchema:a,noDisabled:!0});return n.jsxs(e.GeneralSchemaDesigner,{children:[n.jsx(e.SchemaSettingsModalItem,{title:t("Edit iframe"),asyncGetInitialValues:()=>H(this,null,function*(){var b,l,d;const x={mode:f,url:k,height:T};if(g){const{data:u}=yield(l=(b=s.resource("iframeHtml")).get)==null?void 0:l.call(b,{filterByTk:g});x.html=((d=u==null?void 0:u.data)==null?void 0:d.html)||""}return x}),schema:{type:"object",title:t("Edit iframe"),properties:{mode:{title:'{{t("Mode")}}',"x-component":"Radio.Group","x-decorator":"FormItem",required:!0,default:"url",enum:[{value:"url",label:t("URL")},{value:"html",label:t("HTML")}]},url:{title:t("URL"),type:"string","x-decorator":"FormItem","x-component":"Variable.TextArea","x-component-props":{scope:P},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:t("String template")},{value:"handlebars",label:t("Handlebars")}],"x-reactions":{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "url"}}'}}}},html:{title:t("html"),type:"string","x-decorator":"FormItem","x-component":"Variable.RawTextArea","x-component-props":{scope:P,style:{minHeight:"200px"}},required:!0,"x-reactions":{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "url"}}'}}}},height:{title:t("Height"),type:"string","x-decorator":"FormItem","x-component":"Input",required:!0}}},onSubmit:y}),n.jsx(e.SchemaSettingsDivider,{}),n.jsx(e.SchemaSettingsRemove,{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}})]})};function V(o){return typeof o!="string"?!1:!isNaN(o)&&!isNaN(parseFloat(o))}const R=O.observer(o=>{const I=o,{url:a,htmlId:t,mode:i="url",height:s,html:f,params:k,engine:g}=I,T=X(I,["url","htmlId","mode","height","html","params","engine"]),B=O.useField(),{t:M}=q.useTranslation(),y=e.useBlockHeight()||s,F=e.useVariables(),C=e.useLocalVariables(),P=e.useCompile(),{loading:x,data:b}=e.useRequest({url:`iframeHtml:getHtml/${t}`},{refreshDeps:[t,B.data],ready:i==="html"&&!!t}),{parseURLAndParams:l}=e.useParseURLAndParams(),[d,u]=z.useState(null);return z.useEffect(()=>{H(this,null,function*(){if(i==="html"){const m=yield e.getRenderContent(g,b,P(F),P(C),E=>E);if(m===void 0)return;const p="data:text/html;charset=utf-8,"+encodeURIComponent(m);u(p)}else try{const m=yield l(a,k||[]);u(m)}catch(m){console.error("Error fetching target URL:",m),u("fallback-url")}})},[b,i,a,F,C,k]),i==="url"&&!a||i==="html"&&!t?n.jsx($.Card,{style:{marginBottom:24,height:V(y)?`${y}px`:y},children:M("Please fill in the iframe URL")}):x&&!d?n.jsx("div",{style:{height:V(y)?`${y}px`:y||"60vh",marginBottom:"24px",border:0},children:n.jsx($.Spin,{})}):n.jsx(ae,w({url:d,width:"100%",display:"block",position:"relative",styles:{height:V(y)?`${y}px`:y||"60vh",marginBottom:"24px",border:0}},T))},{displayName:"Iframe"});R.Designer=se;const ie=()=>{const{insert:o}=e.useSchemaInitializer(),a=e.useSchemaInitializerItem();return n.jsx(e.SchemaInitializerItem,N(w({},a),{icon:n.jsx(L.FormOutlined,{}),onClick:()=>{o({type:"void","x-settings":"blockSettings:iframe","x-decorator":"BlockItem","x-decorator-props":{name:"iframe"},"x-component":"Iframe","x-component-props":{}})}}))},le=o=>n.jsx(e.SchemaComponentOptions,{components:{Iframe:R,IframeBlockInitializer:ie,ArrayItems:S.ArrayItems},children:o.children}),ce=o=>a=>{const t=O.useFieldSchema(),{form:i}=e.useFormBlockContext(),s=e.useRecord(),f=e.useVariableOptions({collectionField:{uiSchema:t},form:i,record:s,uiSchema:t,noDisabled:!0});return n.jsx(o,N(w({},a),{scope:f}))},_={items:[{name:"EditIframe",type:"modal",useComponentProps(){const o=O.useField(),a=O.useFieldSchema(),{t,i18n:i}=q.useTranslation(),{dn:s}=e.useDesignable(),f=e.useAPIClient(),{mode:k,url:g,params:T,htmlId:B,height:M="60vh",engine:y}=a["x-component-props"]||{},F=l=>H(this,null,function*(){var u,I,c,m,A;const d={values:{html:l}};if(B){const{data:p}=yield(I=(u=f.resource("iframeHtml")).update)==null?void 0:I.call(u,N(w({},d),{filterByTk:B}));return((c=p==null?void 0:p.data)==null?void 0:c[0])||{id:B}}else{const{data:p}=yield(A=(m=f.resource("iframeHtml")).create)==null?void 0:A.call(m,d);return p==null?void 0:p.data}}),{urlSchema:C,paramsSchema:P}=e.useURLAndHTMLSchema(),x=A=>H(this,[A],function*({mode:l,url:d,html:u,height:I,params:c,engine:m}){const p=a["x-component-props"]||{};if(p.mode=l,p.height=I,p.engine=m||"string",p.params=c,p.url=d,l==="html"){const E=yield F(u);p.htmlId=E.id}a["x-component-props"]=p,o.componentProps=w({},p),o.data={v:j.uid()},s.emit("patch",{schema:{"x-uid":a["x-uid"],"x-component-props":p}})}),b=n.jsxs(n.Fragment,{children:[n.jsxs("span",{style:{marginLeft:".25em"},className:"ant-formily-item-extra",children:[t("Syntax references"),":"]})," ",n.jsx("a",{href:`https://${i.language==="zh-CN"?"docs-cn":"docs"}.nocobase.com/handbook/template-handlebars`,target:"_blank",rel:"noreferrer",children:"Handlebars.js"})]});return{title:t("Edit iframe"),asyncGetInitialValues:()=>H(this,null,function*(){var d,u,I;const l={mode:k,url:g,height:M,engine:y,params:T};if(B){const{data:c}=yield(u=(d=f.resource("iframeHtml")).get)==null?void 0:u.call(d,{filterByTk:B});l.html=((I=c==null?void 0:c.data)==null?void 0:I.html)||""}return l}),schema:{type:"object",title:t("Edit iframe"),properties:{mode:{title:'{{t("Mode")}}',"x-component":"Radio.Group","x-decorator":"FormItem",required:!0,default:"url",enum:[{value:"url",label:t("URL")},{value:"html",label:t("HTML")}]},url:N(w({},C),{required:!0}),params:P,engine:{title:'{{t("Template engine")}}',"x-component":"Radio.Group","x-decorator":"FormItem",default:"string",enum:[{value:"string",label:t("String template")},{value:"handlebars",label:t("Handlebars")}],"x-reactions":{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "url"}}'}}}},html:{title:t("html"),type:"string","x-decorator":"FormItem","x-component":ce(e.Variable.RawTextArea),"x-component-props":{rows:10},required:!0,description:b,"x-reactions":[{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "url"}}'}}},l=>{const{engine:d}=l.form.values;d==="handlebars"?l.description=b:l.description=null}]}}},onSubmit:x,noRecord:!0}}},{name:"setTheBlockHeight",Component:e.SchemaSettingsBlockHeightItem},{name:"divider",type:"divider"},{name:"delete",type:"remove",useComponentProps(){return{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}}}]},me=new e.SchemaSettings(w({name:"iframeBlockSchemaSettings"},_)),de=new e.SchemaSettings(w({name:"blockSettings:iframe"},_));class W extends e.Plugin{load(){return H(this,null,function*(){this.app.schemaSettingsManager.add(me),this.app.schemaSettingsManager.add(de),this.app.use(le);const a=this.app.schemaInitializerManager.get("page:addBlock");a==null||a.add("otherBlocks.iframe",{title:'{{t("Iframe")}}',Component:"IframeBlockInitializer"});const t=this.app.schemaInitializerManager.get("popup:addNew:addBlock");t==null||t.add("otherBlocks.iframe",{title:'{{t("Iframe")}}',Component:"IframeBlockInitializer"});const i=this.app.schemaInitializerManager.get("popup:common:addBlock");i==null||i.add("otherBlocks.iframe",{title:'{{t("Iframe")}}',Component:"IframeBlockInitializer"});const s=this.app.schemaInitializerManager.get("RecordFormBlockInitializers");s==null||s.add("otherBlocks.iframe",{title:'{{t("Iframe")}}',Component:"IframeBlockInitializer"}),this.app.schemaInitializerManager.addItem("mobilePage:addBlock","otherBlocks.iframe",{title:'{{t("Iframe")}}',Component:"IframeBlockInitializer"}),this.app.schemaInitializerManager.addItem("mobile:addBlock","otherBlocks.iframe",{title:'{{t("Iframe")}}',Component:"IframeBlockInitializer"})})}}r.PluginBlockIframeClient=W,r.default=W,Object.defineProperties(r,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
14
+ */var G=Object.getOwnPropertySymbols,Z=Object.prototype.hasOwnProperty,ee=Object.prototype.propertyIsEnumerable;function te(o){if(o==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(o)}function re(){try{if(!Object.assign)return!1;var o=new String("abc");if(o[5]="de",Object.getOwnPropertyNames(o)[0]==="5")return!1;for(var a={},t=0;t<10;t++)a["_"+String.fromCharCode(t)]=t;var i=Object.getOwnPropertyNames(a).map(function(f){return a[f]});if(i.join("")!=="0123456789")return!1;var s={};return"abcdefghijklmnopqrst".split("").forEach(function(f){s[f]=f}),Object.keys(Object.assign({},s)).join("")==="abcdefghijklmnopqrst"}catch(f){return!1}}var ne=re()?Object.assign:function(o,a){for(var t,i=te(o),s,f=1;f<arguments.length;f++){t=Object(arguments[f]);for(var k in t)Z.call(t,k)&&(i[k]=t[k]);if(G){s=G(t);for(var g=0;g<s.length;g++)ee.call(t,s[g])&&(i[s[g]]=t[s[g]])}}return i};const oe=Y(ne),ae=({url:o,allowFullScreen:a,position:t,display:i,height:s,width:f,overflow:k,styles:g,onLoad:T,onMouseOver:B,onMouseOut:M,scrolling:y,id:F,frameBorder:C,ariaHidden:P,sandbox:x,allow:b,className:l,title:d,ariaLabel:u,ariaLabelledby:I,name:c,target:m,loading:A,importance:p,referrerpolicy:E,allowpaymentrequest:ue,src:pe,key:fe})=>{const D=oe({src:pe||o,target:m||null,style:{position:t||null,display:i||"initial",overflow:k||null},scrolling:y||null,allowpaymentrequest:ue||null,importance:p||null,sandbox:x&&[...x].join(" ")||null,loading:A||null,styles:g||null,name:c||null,className:l||null,allowFullScreen:"allowFullScreen",referrerpolicy:E||null,title:d||null,allow:b||null,id:F||null,"aria-labelledby":I||null,"aria-hidden":P||null,"aria-label":u||null,width:f||null,height:s||null,onLoad:T||null,onMouseOver:B||null,onMouseOut:M||null,key:fe||"iframe"});let h=Object.create(null);for(let v of Object.keys(D))D[v]!=null&&(h[v]=D[v]);for(let v of Object.keys(h.style))h.style[v]==null&&delete h.style[v];if(h.styles)for(let v of Object.keys(h.styles))h.styles.hasOwnProperty(v)&&(h.style[v]=h.styles[v]),Object.keys(h.styles).pop()==v&&delete h.styles;if(a)if("allow"in h){const v=h.allow.replace("fullscreen","");h.allow=`fullscreen ${v.trim()}`.trim()}else h.allow="fullscreen";return C>=0&&(h.style.hasOwnProperty("border")||(h.style.border=C)),z.createElement("iframe",Object.assign({},h))},se=()=>{const o=O.useField(),a=O.useFieldSchema(),{t}=q.useTranslation(),{dn:i}=e.useDesignable(),s=e.useAPIClient(),{mode:f,url:k,htmlId:g,height:T="60vh",engine:B}=a["x-component-props"]||{},M=x=>H(this,null,function*(){var l,d,u,I,c;const b={values:{html:x}};if(g){const{data:m}=yield(d=(l=s.resource("iframeHtml")).update)==null?void 0:d.call(l,N(w({},b),{filterByTk:g}));return((u=m==null?void 0:m.data)==null?void 0:u[0])||{id:g}}else{const{data:m}=yield(c=(I=s.resource("iframeHtml")).create)==null?void 0:c.call(I,b);return m==null?void 0:m.data}}),y=I=>H(this,[I],function*({mode:x,url:b,html:l,height:d,engine:u}){const c=a["x-component-props"]||{};if(c.mode=x,c.height=d,c.url=b,c.engine=u||"string",x==="html"){const m=yield M(l);c.htmlId=m.id}a["x-component-props"]=c,o.componentProps=w({},c),o.data={v:j.uid()},i.emit("patch",{schema:{"x-uid":a["x-uid"],"x-component-props":c}})}),{form:F}=e.useFormBlockContext(),C=e.useRecord(),P=e.useVariableOptions({collectionField:{uiSchema:a},form:F,record:C,uiSchema:a,noDisabled:!0});return n.jsxs(e.GeneralSchemaDesigner,{children:[n.jsx(e.SchemaSettingsModalItem,{title:t("Edit iframe"),asyncGetInitialValues:()=>H(this,null,function*(){var b,l,d;const x={mode:f,url:k,height:T};if(g){const{data:u}=yield(l=(b=s.resource("iframeHtml")).get)==null?void 0:l.call(b,{filterByTk:g});x.html=((d=u==null?void 0:u.data)==null?void 0:d.html)||""}return x}),schema:{type:"object",title:t("Edit iframe"),properties:{mode:{title:'{{t("Mode")}}',"x-component":"Radio.Group","x-decorator":"FormItem",required:!0,default:"url",enum:[{value:"url",label:t("URL")},{value:"html",label:t("HTML")}]},url:{title:t("URL"),type:"string","x-decorator":"FormItem","x-component":"Variable.TextArea","x-component-props":{scope:P},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:t("String template")},{value:"handlebars",label:t("Handlebars")}],"x-reactions":{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "url"}}'}}}},html:{title:t("html"),type:"string","x-decorator":"FormItem","x-component":"Variable.RawTextArea","x-component-props":{scope:P,style:{minHeight:"200px"}},required:!0,"x-reactions":{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "url"}}'}}}},height:{title:t("Height"),type:"string","x-decorator":"FormItem","x-component":"Input",required:!0}}},onSubmit:y}),n.jsx(e.SchemaSettingsDivider,{}),n.jsx(e.SchemaSettingsRemove,{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}})]})};function V(o){return typeof o!="string"?!1:!isNaN(o)&&!isNaN(parseFloat(o))}const R=O.observer(o=>{const I=o,{url:a,htmlId:t,mode:i="url",height:s,html:f,params:k,engine:g}=I,T=X(I,["url","htmlId","mode","height","html","params","engine"]),B=O.useField(),{t:M}=q.useTranslation(),y=e.useBlockHeight()||s,F=e.useVariables(),C=e.useLocalVariables(),P=e.useCompile(),{loading:x,data:b}=e.useRequest({url:`iframeHtml:getHtml/${t}`},{refreshDeps:[t,B.data],ready:i==="html"&&!!t}),{parseURLAndParams:l}=e.useParseURLAndParams(),[d,u]=z.useState(null);return z.useEffect(()=>{H(this,null,function*(){if(i==="html"){const m=yield e.getRenderContent(g,b,P(F),P(C),E=>E);if(m===void 0)return;const p="data:text/html;charset=utf-8,"+encodeURIComponent(m);u(p)}else try{const m=yield l(a,k||[]);u(m)}catch(m){console.error("Error fetching target URL:",m),u("fallback-url")}})},[b,i,a,F,C,k]),i==="url"&&!a||i==="html"&&!t?n.jsx($.Card,{style:{marginBottom:24,height:V(y)?`${y}px`:y},children:M("Please fill in the iframe URL")}):x&&!d?n.jsx("div",{style:{height:V(y)?`${y}px`:y||"60vh",marginBottom:"24px",border:0},children:n.jsx($.Spin,{})}):n.jsx(ae,w({url:d,width:"100%",display:"block",position:"relative",styles:{height:V(y)?`${y}px`:y||"60vh",marginBottom:"24px",border:0}},T))},{displayName:"Iframe"});R.Designer=se;const ie=()=>{const{insert:o}=e.useSchemaInitializer(),a=e.useSchemaInitializerItem();return n.jsx(e.SchemaInitializerItem,N(w({},a),{icon:n.jsx(L.PicRightOutlined,{}),onClick:()=>{o({type:"void","x-settings":"blockSettings:iframe","x-decorator":"BlockItem","x-decorator-props":{name:"iframe"},"x-component":"Iframe","x-component-props":{}})}}))},le=o=>n.jsx(e.SchemaComponentOptions,{components:{Iframe:R,IframeBlockInitializer:ie,ArrayItems:S.ArrayItems},children:o.children}),ce=o=>a=>{const t=O.useFieldSchema(),{form:i}=e.useFormBlockContext(),s=e.useRecord(),f=e.useVariableOptions({collectionField:{uiSchema:t},form:i,record:s,uiSchema:t,noDisabled:!0});return n.jsx(o,N(w({},a),{scope:f}))},_={items:[{name:"EditIframe",type:"modal",useComponentProps(){const o=O.useField(),a=O.useFieldSchema(),{t,i18n:i}=q.useTranslation(),{dn:s}=e.useDesignable(),f=e.useAPIClient(),{mode:k,url:g,params:T,htmlId:B,height:M="60vh",engine:y}=a["x-component-props"]||{},F=l=>H(this,null,function*(){var u,I,c,m,A;const d={values:{html:l}};if(B){const{data:p}=yield(I=(u=f.resource("iframeHtml")).update)==null?void 0:I.call(u,N(w({},d),{filterByTk:B}));return((c=p==null?void 0:p.data)==null?void 0:c[0])||{id:B}}else{const{data:p}=yield(A=(m=f.resource("iframeHtml")).create)==null?void 0:A.call(m,d);return p==null?void 0:p.data}}),{urlSchema:C,paramsSchema:P}=e.useURLAndHTMLSchema(),x=A=>H(this,[A],function*({mode:l,url:d,html:u,height:I,params:c,engine:m}){const p=a["x-component-props"]||{};if(p.mode=l,p.height=I,p.engine=m||"string",p.params=c,p.url=d,l==="html"){const E=yield F(u);p.htmlId=E.id}a["x-component-props"]=p,o.componentProps=w({},p),o.data={v:j.uid()},s.emit("patch",{schema:{"x-uid":a["x-uid"],"x-component-props":p}})}),b=n.jsxs(n.Fragment,{children:[n.jsxs("span",{style:{marginLeft:".25em"},className:"ant-formily-item-extra",children:[t("Syntax references"),":"]})," ",n.jsx("a",{href:`https://${i.language==="zh-CN"?"docs-cn":"docs"}.nocobase.com/handbook/template-handlebars`,target:"_blank",rel:"noreferrer",children:"Handlebars.js"})]});return{title:t("Edit iframe"),asyncGetInitialValues:()=>H(this,null,function*(){var d,u,I;const l={mode:k,url:g,height:M,engine:y,params:T};if(B){const{data:c}=yield(u=(d=f.resource("iframeHtml")).get)==null?void 0:u.call(d,{filterByTk:B});l.html=((I=c==null?void 0:c.data)==null?void 0:I.html)||""}return l}),schema:{type:"object",title:t("Edit iframe"),properties:{mode:{title:'{{t("Mode")}}',"x-component":"Radio.Group","x-decorator":"FormItem",required:!0,default:"url",enum:[{value:"url",label:t("URL")},{value:"html",label:t("HTML")}]},url:N(w({},C),{required:!0}),params:P,engine:{title:'{{t("Template engine")}}',"x-component":"Radio.Group","x-decorator":"FormItem",default:"string",enum:[{value:"string",label:t("String template")},{value:"handlebars",label:t("Handlebars")}],"x-reactions":{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "url"}}'}}}},html:{title:t("html"),type:"string","x-decorator":"FormItem","x-component":ce(e.Variable.RawTextArea),"x-component-props":{rows:10},required:!0,description:b,"x-reactions":[{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "url"}}'}}},l=>{const{engine:d}=l.form.values;d==="handlebars"?l.description=b:l.description=null}]}}},onSubmit:x,noRecord:!0}}},{name:"setTheBlockHeight",Component:e.SchemaSettingsBlockHeightItem},{name:"divider",type:"divider"},{name:"delete",type:"remove",useComponentProps(){return{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}}}]},me=new e.SchemaSettings(w({name:"iframeBlockSchemaSettings"},_)),de=new e.SchemaSettings(w({name:"blockSettings:iframe"},_));class W extends e.Plugin{load(){return H(this,null,function*(){this.app.schemaSettingsManager.add(me),this.app.schemaSettingsManager.add(de),this.app.use(le);const a=this.app.schemaInitializerManager.get("page:addBlock");a==null||a.add("otherBlocks.iframe",{title:'{{t("Iframe")}}',Component:"IframeBlockInitializer"});const t=this.app.schemaInitializerManager.get("popup:addNew:addBlock");t==null||t.add("otherBlocks.iframe",{title:'{{t("Iframe")}}',Component:"IframeBlockInitializer"});const i=this.app.schemaInitializerManager.get("popup:common:addBlock");i==null||i.add("otherBlocks.iframe",{title:'{{t("Iframe")}}',Component:"IframeBlockInitializer"});const s=this.app.schemaInitializerManager.get("RecordFormBlockInitializers");s==null||s.add("otherBlocks.iframe",{title:'{{t("Iframe")}}',Component:"IframeBlockInitializer"}),this.app.schemaInitializerManager.addItem("mobilePage:addBlock","otherBlocks.iframe",{title:'{{t("Iframe")}}',Component:"IframeBlockInitializer"}),this.app.schemaInitializerManager.addItem("mobile:addBlock","otherBlocks.iframe",{title:'{{t("Iframe")}}',Component:"IframeBlockInitializer"})})}}r.PluginBlockIframeClient=W,r.default=W,Object.defineProperties(r,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -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.4.0-beta.8",
13
+ "@nocobase/client": "1.4.0",
14
14
  "react": "18.2.0",
15
15
  "react-i18next": "11.18.6",
16
16
  "antd": "5.12.8",
17
17
  "@ant-design/icons": "5.2.6",
18
18
  "@formily/antd-v5": "1.1.9",
19
- "@nocobase/server": "1.4.0-beta.8",
20
- "@nocobase/test": "1.4.0-beta.8",
21
- "@nocobase/actions": "1.4.0-beta.8",
22
- "@nocobase/database": "1.4.0-beta.8"
19
+ "@nocobase/server": "1.4.0",
20
+ "@nocobase/test": "1.4.0",
21
+ "@nocobase/actions": "1.4.0",
22
+ "@nocobase/database": "1.4.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.4.0-beta.8",
7
+ "version": "1.4.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": "d6ca78c29506d611937583d79fab5dffbd17a6fc",
28
+ "gitHead": "e37782acdee701524dc0bb385c160f1fdf5c4b43",
29
29
  "keywords": [
30
30
  "Blocks"
31
31
  ]