@nocobase/plugin-block-iframe 1.6.24 → 1.6.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/index.js +1 -1
- package/dist/externalVersion.js +5 -5
- package/package.json +2 -2
package/dist/client/index.js
CHANGED
|
@@ -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("@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,a,l,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 a,l,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 a=Object(arguments[c]))r.call(a,u)&&(i[u]=a[u]);if(t){l=t(a);for(var s=0;s<l.length;s++)n.call(a,l[s])&&(i[l[s]]=a[l[s]])}}return i}:Object.assign},482:function(e){e.exports=a},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=l},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 f={};return!function(){s.r(f),s.d(f,{PluginBlockIframeClient:function(){return z},default:function(){return A}});var e=s(772),t=s(156),r=s.n(t),n=s(632),o=s(505),a=s(721),l=s(238),i=s(753),c=s.n(i),u=({url:e,allowFullScreen:t,position:n,display:o,height:a,width:l,overflow:i,styles:u,onLoad:s,onMouseOver:f,onMouseOut:p,scrolling:m,id:d,frameBorder:b,ariaHidden:h,sandbox:y,allow:g,className:v,title:O,ariaLabel:w,ariaLabelledby:x,name:j,target:S,loading:k,importance:P,referrerpolicy:I,allowpaymentrequest:E,src:B,key:R})=>{let T=c()({src:B||e,target:S||null,style:{position:n||null,display:o||"initial",overflow:i||null},scrolling:m||null,allowpaymentrequest:E||null,importance:P||null,sandbox:y&&[...y].join(" ")||null,loading:k||null,styles:u||null,name:j||null,className:v||null,allowFullScreen:"allowFullScreen",referrerpolicy:I||null,title:O||null,allow:g||null,id:d||null,"aria-labelledby":x||null,"aria-hidden":h||null,"aria-label":w||null,width:l||null,height:a||null,onLoad:s||null,onMouseOver:f||null,onMouseOut:p||null,key:R||"iframe"}),q=Object.create(null);for(let e of Object.keys(T))null!=T[e]&&(q[e]=T[e]);for(let e of Object.keys(q.style))null==q.style[e]&&delete q.style[e];if(q.styles)for(let e of Object.keys(q.styles))q.styles.hasOwnProperty(e)&&(q.style[e]=q.styles[e]),Object.keys(q.styles).pop()==e&&delete q.styles;if(t)if("allow"in q){let e=q.allow.replace("fullscreen","");q.allow=`fullscreen ${e.trim()}`.trim()}else q.allow="fullscreen";return b>=0&&!q.style.hasOwnProperty("border")&&(q.style.border=b),r().createElement("iframe",Object.assign({},q))},p=s(875);function m(e,t,r,n,o,a,l){try{var i=e[a](l),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 a=e.apply(t,r);function l(e){m(a,n,o,l,i,"next",e)}function i(e){m(a,n,o,l,i,"throw",e)}l(void 0)})}}function b(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 h(e,t){var r,n,o,a,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(a){return function(i){var c=[a,i];if(r)throw TypeError("Generator is already executing.");for(;l;)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 l.label++,{value:c[1],done:!1};case 5:l.label++,n=c[1],c=[0];continue;case 7:c=l.ops.pop(),l.trys.pop();continue;default:if(!(o=(o=l.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){l=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){l.label=c[1];break}if(6===c[0]&&l.label<o[1]){l.label=o[1],o=c;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(c);break}o[2]&&l.ops.pop(),l.trys.pop();continue}c=t.call(e,l)}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,a,l){try{var i=e[a](l),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 O=(0,o.observer)(function(n){var i,c=n.url,s=n.htmlId,f=n.mode,p=void 0===f?"url":f,m=n.height,d=(n.html,n.params),b=n.engine,h=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++)r=a[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"]),O=(0,o.useField)(),w=(0,l.useTranslation)().t,x=a.theme.useToken().token,j=(0,e.useBlockHeight)()||m,S=(0,e.useVariables)(),k=(0,e.useLocalVariables)(),P=(0,e.useCompile)(),I=(0,e.useRequest)({url:"iframeHtml:getHtml/".concat(s)},{refreshDeps:[s,O.data],ready:"html"===p&&!!s}),E=I.loading,B=I.data,R=(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 a=[],l=!0,i=!1;try{for(o=o.call(e);!(l=(r=o.next()).done)&&(a.push(r.value),a.length!==t);l=!0);}catch(e){i=!0,n=e}finally{try{l||null==o.return||o.return()}finally{if(i)throw n}}return a}}(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.")}()),q=T[0],C=T[1];return((0,t.useEffect)(function(){var t,r;(t=function(){var t;return function(e,t){var r,n,o,a,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(a){return function(i){var c=[a,i];if(r)throw TypeError("Generator is already executing.");for(;l;)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 l.label++,{value:c[1],done:!1};case 5:l.label++,n=c[1],c=[0];continue;case 7:c=l.ops.pop(),l.trys.pop();continue;default:if(!(o=(o=l.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){l=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){l.label=c[1];break}if(6===c[0]&&l.label<o[1]){l.label=o[1],o=c;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(c);break}o[2]&&l.ops.pop(),l.trys.pop();continue}c=t.call(e,l)}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"!==p)return[3,2];return[4,(0,e.getRenderContent)(b,B,P(S),P(k),function(e){return e})];case 1:if(void 0===(t=r.sent()))return[2];return C("data:text/html;charset=utf-8,"+encodeURIComponent(t)),[3,5];case 2:return r.trys.push([2,4,,5]),[4,R(c,d||[])];case 3:return C(r.sent()),[3,5];case 4:return console.error("Error fetching target URL:",r.sent()),C("fallback-url"),[3,5];case 5:return[2]}})},r=function(){var e=this,r=arguments;return new Promise(function(n,o){var a=t.apply(e,r);function l(e){g(a,n,o,l,i,"next",e)}function i(e){g(a,n,o,l,i,"throw",e)}l(void 0)})},function(){return r.apply(this,arguments)})()},[B,p,c,S,k,d]),("url"!==p||c)&&("html"!==p||s))?E&&!q?r().createElement("div",{style:{height:v(j)?"".concat(j,"px"):j||"60vh",marginBottom:x.padding,border:0}},r().createElement(a.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:q,width:"100%",display:"block",position:"relative",styles:{height:v(j)?"".concat(j,"px"):j||"60vh",marginBottom:"24px",border:0}},h)):r().createElement(a.Card,{style:{marginBottom:x.padding,height:v(j)?"".concat(j,"px"):j}},w("Please fill in the iframe URL"))},{displayName:"Iframe"});O.Designer=function(){var t,n,a=(0,o.useField)(),i=(0,o.useFieldSchema)(),c=(0,l.useTranslation)().t,u=(0,e.useDesignable)().dn,s=(0,e.useAPIClient)(),f=i["x-component-props"]||{},m=f.mode,y=f.url,g=f.htmlId,v=f.height,O=void 0===v?"60vh":v;f.engine;var w=(t=d(function(e){var t,r,n,o,a,l,i,c;return h(this,function(u){switch(u.label){case 0:var f,p;if(t={values:{html:e}},!g)return[3,2];return[4,null==(r=(n=s.resource("iframeHtml")).update)?void 0:r.call(n,(f=b({},t),p=p={filterByTk:g},Object.getOwnPropertyDescriptors?Object.defineProperties(f,Object.getOwnPropertyDescriptors(p)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(p)).forEach(function(e){Object.defineProperty(f,e,Object.getOwnPropertyDescriptor(p,e))}),f))];case 1:return[2,(null==(a=u.sent().data)||null==(o=a.data)?void 0:o[0])||{id:g}];case 2:return[4,null==(l=(i=s.resource("iframeHtml")).create)?void 0:l.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,l,c,s;return h(this,function(f){switch(f.label){case 0:if(t=e.mode,r=e.url,n=e.html,o=e.height,l=e.engine,(c=i["x-component-props"]||{}).mode=t,c.height=o,c.url=r,c.engine=l||"string","html"!==t)return[3,2];return[4,w(n)];case 1:s=f.sent(),c.htmlId=s.id,f.label=2;case 2:return i["x-component-props"]=c,a.componentProps=b({},c),a.data={v:(0,p.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,S=(0,e.useRecord)(),k=(0,e.useVariableOptions)({collectionField:{uiSchema:i},form:j,record:S,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 h(this,function(a){switch(a.label){case 0:if(e={mode:m,url:y,height:O},!g)return[3,2];return[4,null==(t=(r=s.resource("iframeHtml")).get)?void 0:t.call(r,{filterByTk:g})];case 1:o=a.sent().data,e.html=(null==o||null==(n=o.data)?void 0:n.html)||"",a.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:k},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:k,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 w=s(482),x=function(){var t,n,o=(0,e.useSchemaInitializer)().insert,a=(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}({},a),n=n={icon:r().createElement(w.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:O,IframeBlockInitializer:x,ArrayItems:n.ArrayItems}},t.children)};function S(e,t,r,n,o,a,l){try{var i=e[a](l),c=i.value}catch(e){r(e);return}i.done?t(c):Promise.resolve(c).then(n,o)}function k(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var a=e.apply(t,r);function l(e){S(a,n,o,l,i,"next",e)}function i(e){S(a,n,o,l,i,"throw",e)}l(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;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}function I(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 E(e,t){var r,n,o,a,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(a){return function(i){var c=[a,i];if(r)throw TypeError("Generator is already executing.");for(;l;)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 l.label++,{value:c[1],done:!1};case 5:l.label++,n=c[1],c=[0];continue;case 7:c=l.ops.pop(),l.trys.pop();continue;default:if(!(o=(o=l.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){l=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){l.label=c[1];break}if(6===c[0]&&l.label<o[1]){l.label=o[1],o=c;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(c);break}o[2]&&l.ops.pop(),l.trys.pop();continue}c=t.call(e,l)}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 B={items:[{name:"EditIframe",type:"modal",useComponentProps:function(){var t,n,a,i=(0,o.useField)(),c=(0,o.useFieldSchema)(),u=(0,l.useTranslation)(),s=u.t,f=u.i18n,m=(0,e.useDesignable)().dn,d=(0,e.useAPIClient)(),b=c["x-component-props"]||{},h=b.mode,y=b.url,g=b.params,v=b.htmlId,O=b.height,w=void 0===O?"60vh":O,x=b.engine,j=(t=k(function(e){var t,r,n,o,a,l,i,c;return E(this,function(u){switch(u.label){case 0:if(t={values:{html:e}},!v)return[3,2];return[4,null==(r=(n=d.resource("iframeHtml")).update)?void 0:r.call(n,I(P({},t),{filterByTk:v}))];case 1:return[2,(null==(a=u.sent().data)||null==(o=a.data)?void 0:o[0])||{id:v}];case 2:return[4,null==(l=(i=d.resource("iframeHtml")).create)?void 0:l.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)}),S=(0,e.useURLAndHTMLSchema)(),B=S.urlSchema,R=S.paramsSchema,T=(n=k(function(e){var t,r,n,o,a,l,u,s;return E(this,function(f){switch(f.label){case 0:if(t=e.mode,r=e.url,n=e.html,o=e.height,a=e.params,l=e.engine,(u=c["x-component-props"]||{}).mode=t,u.height=o,u.engine=l||"string",u.params=a,u.url=r,"html"!==t)return[3,2];return[4,j(n)];case 1:s=f.sent(),u.htmlId=s.id,f.label=2;case 2:return c["x-component-props"]=u,i.componentProps=P({},u),i.data={v:(0,p.uid)()},m.emit("patch",{schema:{"x-uid":c["x-uid"],"x-component-props":u}}),[2]}})}),function(e){return n.apply(this,arguments)}),q=r().createElement(r().Fragment,null,r().createElement("span",{style:{marginLeft:".25em"},className:"ant-formily-item-extra"},s("Syntax references"),":")," ",r().createElement("a",{href:"https://".concat("zh-CN"===f.language?"docs-cn":"docs",".nocobase.com/handbook/template-handlebars"),target:"_blank",rel:"noreferrer"},"Handlebars.js"));return{title:s("Edit iframe"),asyncGetInitialValues:k(function(){var e,t,r,n,o;return E(this,function(a){switch(a.label){case 0:if(e={mode:h,url:y,height:w,engine:x,params:g},!v)return[3,2];return[4,null==(t=(r=d.resource("iframeHtml")).get)?void 0:t.call(r,{filterByTk:v})];case 1:o=a.sent().data,e.html=(null==o||null==(n=o.data)?void 0:n.html)||"",a.label=2;case 2:return[2,e]}})}),schema:{type:"object",title:s("Edit iframe"),properties:{mode:{title:'{{t("Mode")}}',"x-component":"Radio.Group","x-decorator":"FormItem",required:!0,default:"url",enum:[{value:"url",label:s("URL")},{value:"html",label:s("HTML")}]},url:I(P({},B),{required:!0}),params:R,engine:{title:'{{t("Template engine")}}',"x-component":"Radio.Group","x-decorator":"FormItem",default:"string",enum:[{value:"string",label:s("String template")},{value:"handlebars",label:s("Handlebars")}],"x-reactions":{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "url"}}'}}}},html:{title:s("html"),type:"string","x-decorator":"FormItem","x-component":(a=e.Variable.RawTextArea,function(t){var n=(0,o.useFieldSchema)(),l=(0,e.useFormBlockContext)().form,i=(0,e.useRecord)(),c=(0,e.useVariableOptions)({collectionField:{uiSchema:n},form:l,record:i,uiSchema:n,noDisabled:!0});return r().createElement(a,I(P({},t),{scope:c}))}),"x-component-props":{rows:10},required:!0,description:q,"x-reactions":[{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "url"}}'}}},function(e){"handlebars"===e.form.values.engine?e.description=q:e.description=null}]}}},onSubmit:T,noRecord:!0}}},{name:"setTheBlockHeight",Component:e.SchemaSettingsBlockHeightItem},{name:"divider",type:"divider"},{name:"delete",type:"remove",useComponentProps:function(){return{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}}}]},R=new e.SchemaSettings(P({name:"iframeBlockSchemaSettings"},B)),T=new e.SchemaSettings(P({name:"blockSettings:iframe"},B));function q(e,t,r,n,o,a,l){try{var i=e[a](l),c=i.value}catch(e){r(e);return}i.done?t(c):Promise.resolve(c).then(n,o)}function C(e,t,r){return(C=H()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&M(o,r.prototype),o}).apply(null,arguments)}function F(e){return(F=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function M(e,t){return(M=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function D(e){var t="function"==typeof Map?new Map:void 0;return(D=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 C(e,arguments,F(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),M(r,e)})(e)}function H(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(H=function(){return!!e})()}var z=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=F(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,H()?Reflect.construct(e,t||[],F(this).constructor):e.apply(this,t))}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&M(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,a,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(a){return function(i){var c=[a,i];if(r)throw TypeError("Generator is already executing.");for(;l;)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 l.label++,{value:c[1],done:!1};case 5:l.label++,n=c[1],c=[0];continue;case 7:c=l.ops.pop(),l.trys.pop();continue;default:if(!(o=(o=l.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){l=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){l.label=c[1];break}if(6===c[0]&&l.label<o[1]){l.label=o[1],o=c;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(c);break}o[2]&&l.ops.pop(),l.trys.pop();continue}c=t.call(e,l)}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(a){return t.app.schemaSettingsManager.add(R),t.app.schemaSettingsManager.add(T),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 a=e.apply(t,r);function l(e){q(a,n,o,l,i,"next",e)}function i(e){q(a,n,o,l,i,"throw",e)}l(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}(D(e.Plugin)),A=z}(),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 L}});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:E,referrerpolicy:k,allowpaymentrequest:I,src:M,key:C})=>{let T=c()({src:M||e,target:P||null,style:{position:n||null,display:o||"initial",overflow:i||null},scrolling:m||null,allowpaymentrequest:I||null,importance:E||null,sandbox:y&&[...y].join(" ")||null,loading:S||null,styles:u||null,name:j||null,className:v||null,allowFullScreen:"allowFullScreen",referrerpolicy:k||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:C||"iframe"}),B=Object.create(null);for(let e of Object.keys(T))null!=T[e]&&(B[e]=T[e]);for(let e of Object.keys(B.style))null==B.style[e]&&delete B.style[e];if(B.styles)for(let e of Object.keys(B.styles))B.styles.hasOwnProperty(e)&&(B.style[e]=B.styles[e]),Object.keys(B.styles).pop()==e&&delete B.styles;if(t)if("allow"in B){let e=B.allow.replace("fullscreen","");B.allow=`fullscreen ${e.trim()}`.trim()}else B.allow="fullscreen";return h>=0&&!B.style.hasOwnProperty("border")&&(B.style.border=h),r().createElement("iframe",Object.assign({},B))},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)(),E=(0,e.useCompile)(),k=(0,e.useRequest)({url:"iframeHtml:getHtml/".concat(s)},{refreshDeps:[s,w.data],ready:"html"===f&&!!s}),I=k.loading,M=k.data,C=(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.")}()),B=T[0],R=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,M,E(P),E(S),function(e){return e})];case 1:if(void 0===(t=r.sent()))return[2];return R("data:text/html;charset=utf-8,"+encodeURIComponent(t)),[3,5];case 2:return r.trys.push([2,4,,5]),[4,C(c,d||[])];case 3:return R(r.sent()),[3,5];case 4:return console.error("Error fetching target URL:",r.sent()),R("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)})()},[M,f,c,P,S,d]),("url"!==f||c)&&("html"!==f||s))?I&&!B?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:B,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 E(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 k(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 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)))},C=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)))},T={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,T=(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,k(E({},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)(),R=B.urlSchema,q=B.paramsSchema,D=(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,T(n)];case 1:p=m.sent(),s.htmlId=p.id,m.label=2;case 2:return u["x-component-props"]=s,c.componentProps=E({},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)}),F=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:{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:k(E({},R),{required:!0}),allow:{title:"Allow",type:"string","x-decorator":"FormItem","x-component":function(e){return r().createElement(l.Select,k(E({},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(C,null)},params:q,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,k(E({},t),{scope:c}))}),"x-component-props":{rows:10},required:!0,description:F,"x-reactions":[{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "url"}}'}}},function(e){"handlebars"===e.form.values.engine?e.description=F:e.description=null}]}}},onSubmit:D,noRecord:!0,width:600}}},{name:"setTheBlockHeight",Component:e.SchemaSettingsBlockHeightItem},{name:"divider",type:"divider"},{name:"delete",type:"remove",useComponentProps:function(){return{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}}}]},B=new e.SchemaSettings(E({name:"iframeBlockSchemaSettings"},T)),R=new e.SchemaSettings(E({name:"blockSettings:iframe"},T));function q(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,t,r){return(D=H()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&z(o,r.prototype),o}).apply(null,arguments)}function F(e){return(F=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function z(e,t){return(z=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function A(e){var t="function"==typeof Map?new Map:void 0;return(A=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 D(e,arguments,F(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),z(r,e)})(e)}function H(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(H=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=F(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,H()?Reflect.construct(e,t||[],F(this).constructor):e.apply(this,t))}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&z(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(R),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){q(l,n,o,a,i,"next",e)}function i(e){q(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}(A(e.Plugin)),L=N}(),p}()});
|
package/dist/externalVersion.js
CHANGED
|
@@ -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.6.
|
|
13
|
+
"@nocobase/client": "1.6.26",
|
|
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.6.1",
|
|
18
18
|
"@formily/antd-v5": "1.1.9",
|
|
19
|
-
"@nocobase/server": "1.6.
|
|
20
|
-
"@nocobase/test": "1.6.
|
|
21
|
-
"@nocobase/actions": "1.6.
|
|
22
|
-
"@nocobase/database": "1.6.
|
|
19
|
+
"@nocobase/server": "1.6.26",
|
|
20
|
+
"@nocobase/test": "1.6.26",
|
|
21
|
+
"@nocobase/actions": "1.6.26",
|
|
22
|
+
"@nocobase/database": "1.6.26"
|
|
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.6.
|
|
7
|
+
"version": "1.6.26",
|
|
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": "
|
|
28
|
+
"gitHead": "dc7085b4f453983c6398a5b33011a8fb6dfc59ae",
|
|
29
29
|
"keywords": [
|
|
30
30
|
"Blocks"
|
|
31
31
|
]
|