@nocobase/plugin-block-iframe 1.2.12-alpha → 1.2.14-alpha
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 +2 -7
- package/dist/externalVersion.js +4 -5
- package/package.json +2 -2
package/dist/client/index.js
CHANGED
|
@@ -7,13 +7,8 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
(function(r,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("@nocobase/client"),require("react/jsx-runtime"),require("@formily/antd-v5"),require("@formily/react"),require("antd"),require("react"),require("react-i18next"),require("@formily/shared"),require("@ant-design/icons")
|
|
10
|
+
(function(r,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("@nocobase/client"),require("react/jsx-runtime"),require("@formily/antd-v5"),require("@formily/react"),require("antd"),require("react"),require("react-i18next"),require("@formily/shared"),require("@ant-design/icons")):typeof define=="function"&&define.amd?define(["exports","@nocobase/client","react/jsx-runtime","@formily/antd-v5","@formily/react","antd","react","react-i18next","@formily/shared","@ant-design/icons"],e):(r=typeof globalThis!="undefined"?globalThis:r||self,e(r["@nocobase/plugin-block-iframe"]={},r["@nocobase/client"],r.jsxRuntime,r["@formily/antd-v5"],r["@formily/react"],r.antd,r.react,r["react-i18next"],r["@formily/shared"],r["@ant-design/icons"]))})(this,function(r,e,n,S,O,E,T,q,j,A){"use strict";var he=Object.defineProperty,ge=Object.defineProperties;var ye=Object.getOwnPropertyDescriptors;var N=Object.getOwnPropertySymbols;var _=Object.prototype.hasOwnProperty,W=Object.prototype.propertyIsEnumerable;var G=(r,e,n)=>e in r?he(r,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[e]=n,w=(r,e)=>{for(var n in e||(e={}))_.call(e,n)&&G(r,n,e[n]);if(N)for(var n of N(e))W.call(e,n)&&G(r,n,e[n]);return r},M=(r,e)=>ge(r,ye(e));var J=(r,e)=>{var n={};for(var S in r)_.call(r,S)&&e.indexOf(S)<0&&(n[S]=r[S]);if(r!=null&&N)for(var S of N(r))e.indexOf(S)<0&&W.call(r,S)&&(n[S]=r[S]);return n};var P=(r,e,n)=>new Promise((S,O)=>{var E=j=>{try{q(n.next(j))}catch(A){O(A)}},T=j=>{try{q(n.throw(j))}catch(A){O(A)}},q=j=>j.done?S(j.value):Promise.resolve(j.value).then(E,T);q((n=n.apply(r,e)).next())});function K(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}/*
|
|
11
11
|
object-assign
|
|
12
12
|
(c) Sindre Sorhus
|
|
13
13
|
@license MIT
|
|
14
|
-
*/var z=Object.getOwnPropertySymbols,
|
|
15
|
-
& > .ant-space-item:first-child,
|
|
16
|
-
& > .ant-space-item:last-child {
|
|
17
|
-
flex-shrink: 0;
|
|
18
|
-
}
|
|
19
|
-
`},properties:{name:{type:"string","x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:'{{t("Name")}}'}},value:{type:"string","x-decorator":"FormItem","x-component":U(e.Variable.TextArea),"x-component-props":{placeholder:'{{t("Value")}}',useTypedConstant:!0,changeOnSelect:!0}},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},"x-reactions":{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "html"}}'}}},properties:{add:{type:"void",title:'{{t("Add parameter")}}',"x-component":"ArrayItems.Addition"}}},html:{title:t("html"),type:"string","x-decorator":"FormItem","x-component":U(e.Variable.RawTextArea),"x-component-props":{rows:10},required:!0,"x-reactions":{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "url"}}'}}}}}},onSubmit:g,noRecord:!0}}},{name:"setTheBlockHeight",Component:e.SchemaSettingsBlockHeightItem},{name:"divider",type:"divider"},{name:"delete",type:"remove",useComponentProps(){return{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}}}]},ie=new e.SchemaSettings(B({name:"iframeBlockSchemaSettings"},L)),le=new e.SchemaSettings(B({name:"blockSettings:iframe"},L));class R extends e.Plugin{load(){return P(this,null,function*(){this.app.schemaSettingsManager.add(ie),this.app.schemaSettingsManager.add(le),this.app.use(se);const n=this.app.schemaInitializerManager.get("page:addBlock");n==null||n.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 l=this.app.schemaInitializerManager.get("popup:common:addBlock");l==null||l.add("otherBlocks.iframe",{title:'{{t("Iframe")}}',Component:"IframeBlockInitializer"});const i=this.app.schemaInitializerManager.get("RecordFormBlockInitializers");i==null||i.add("otherBlocks.iframe",{title:'{{t("Iframe")}}',Component:"IframeBlockInitializer"}),this.app.schemaInitializerManager.addItem("mobilePage:addBlock","otherBlocks.iframe",{title:'{{t("Iframe")}}',Component:"IframeBlockInitializer"})})}}r.PluginBlockIframeClient=R,r.default=R,Object.defineProperties(r,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
14
|
+
*/var z=Object.getOwnPropertySymbols,Q=Object.prototype.hasOwnProperty,X=Object.prototype.propertyIsEnumerable;function Y(o){if(o==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(o)}function Z(){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 l=Object.getOwnPropertyNames(a).map(function(h){return a[h]});if(l.join("")!=="0123456789")return!1;var s={};return"abcdefghijklmnopqrst".split("").forEach(function(h){s[h]=h}),Object.keys(Object.assign({},s)).join("")==="abcdefghijklmnopqrst"}catch(h){return!1}}var ee=Z()?Object.assign:function(o,a){for(var t,l=Y(o),s,h=1;h<arguments.length;h++){t=Object(arguments[h]);for(var v in t)Q.call(t,v)&&(l[v]=t[v]);if(z){s=z(t);for(var y=0;y<s.length;y++)X.call(t,s[y])&&(l[s[y]]=t[s[y]])}}return l};const te=K(ee),re=({url:o,allowFullScreen:a,position:t,display:l,height:s,width:h,overflow:v,styles:y,onLoad:k,onMouseOver:F,onMouseOut:I,scrolling:C,id:H,frameBorder:B,ariaHidden:m,sandbox:u,allow:d,className:c,title:p,ariaLabel:b,ariaLabelledby:i,name:f,target:L,loading:ce,importance:me,referrerpolicy:ue,allowpaymentrequest:de,src:pe,key:fe})=>{const U=te({src:pe||o,target:L||null,style:{position:t||null,display:l||"initial",overflow:v||null},scrolling:C||null,allowpaymentrequest:de||null,importance:me||null,sandbox:u&&[...u].join(" ")||null,loading:ce||null,styles:y||null,name:f||null,className:c||null,allowFullScreen:"allowFullScreen",referrerpolicy:ue||null,title:p||null,allow:d||null,id:H||null,"aria-labelledby":i||null,"aria-hidden":m||null,"aria-label":b||null,width:h||null,height:s||null,onLoad:k||null,onMouseOver:F||null,onMouseOut:I||null,key:fe||"iframe"});let g=Object.create(null);for(let x of Object.keys(U))U[x]!=null&&(g[x]=U[x]);for(let x of Object.keys(g.style))g.style[x]==null&&delete g.style[x];if(g.styles)for(let x of Object.keys(g.styles))g.styles.hasOwnProperty(x)&&(g.style[x]=g.styles[x]),Object.keys(g.styles).pop()==x&&delete g.styles;if(a)if("allow"in g){const x=g.allow.replace("fullscreen","");g.allow=`fullscreen ${x.trim()}`.trim()}else g.allow="fullscreen";return B>=0&&(g.style.hasOwnProperty("border")||(g.style.border=B)),T.createElement("iframe",Object.assign({},g))},oe=()=>{const o=O.useField(),a=O.useFieldSchema(),{t}=q.useTranslation(),{dn:l}=e.useDesignable(),s=e.useAPIClient(),{mode:h,url:v,htmlId:y,height:k="60vh"}=a["x-component-props"]||{},F=m=>P(this,null,function*(){var d,c,p,b,i;const u={values:{html:m}};if(y){const{data:f}=yield(c=(d=s.resource("iframeHtml")).update)==null?void 0:c.call(d,M(w({},u),{filterByTk:y}));return((p=f==null?void 0:f.data)==null?void 0:p[0])||{id:y}}else{const{data:f}=yield(i=(b=s.resource("iframeHtml")).create)==null?void 0:i.call(b,u);return f==null?void 0:f.data}}),I=p=>P(this,[p],function*({mode:m,url:u,html:d,height:c}){const b=a["x-component-props"]||{};if(b.mode=m,b.height=c,b.url=u,m==="html"){const i=yield F(d);b.htmlId=i.id}a["x-component-props"]=b,o.componentProps=w({},b),o.data={v:j.uid()},l.emit("patch",{schema:{"x-uid":a["x-uid"],"x-component-props":b}})}),{form:C}=e.useFormBlockContext(),H=e.useRecord(),B=e.useVariableOptions({collectionField:{uiSchema:a},form:C,record:H,uiSchema:a,noDisabled:!0});return n.jsxs(e.GeneralSchemaDesigner,{children:[n.jsx(e.SchemaSettingsModalItem,{title:t("Edit iframe"),asyncGetInitialValues:()=>P(this,null,function*(){var u,d,c;const m={mode:h,url:v,height:k};if(y){const{data:p}=yield(d=(u=s.resource("iframeHtml")).get)==null?void 0:d.call(u,{filterByTk:y});m.html=((c=p==null?void 0:p.data)==null?void 0:c.html)||""}return m}),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:B},required:!0,"x-reactions":{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "html"}}'}}}},html:{title:t("html"),type:"string","x-decorator":"FormItem","x-component":"Variable.RawTextArea","x-component-props":{scope:B,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:I}),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 D=O.observer(o=>{const p=o,{url:a,htmlId:t,mode:l="url",height:s,html:h,params:v}=p,y=J(p,["url","htmlId","mode","height","html","params"]),k=O.useField(),{t:F}=q.useTranslation(),I=e.useBlockHeight()||s,C=e.useVariables(),H=e.useLocalVariables(),{loading:B,data:m}=e.useRequest({url:`iframeHtml:getHtml/${t}`},{refreshDeps:[t,k.data],ready:l==="html"&&!!t}),{parseURLAndParams:u}=e.useParseURLAndParams(),[d,c]=T.useState(null);return T.useEffect(()=>{P(this,null,function*(){if(l==="html"){const i=yield e.replaceVariableValue(m,C,H),L="data:text/html;charset=utf-8,"+encodeURIComponent(i);c(L)}else try{const i=u(a,v||[]);c(i)}catch(i){console.error("Error fetching target URL:",i),c("fallback-url")}})},[m,l,a,C,H,v]),l==="url"&&!a||l==="html"&&!t?n.jsx(E.Card,{style:{marginBottom:24,height:V(I)?`${I}px`:I},children:F("Please fill in the iframe URL")}):B&&!d?n.jsx("div",{style:{height:V(I)?`${I}px`:I||"60vh",marginBottom:"24px",border:0},children:n.jsx(E.Spin,{})}):n.jsx(re,w({url:d,width:"100%",display:"block",position:"relative",styles:{height:V(I)?`${I}px`:I||"60vh",marginBottom:"24px",border:0}},y))},{displayName:"Iframe"});D.Designer=oe;const ne=()=>{const{insert:o}=e.useSchemaInitializer(),a=e.useSchemaInitializerItem();return n.jsx(e.SchemaInitializerItem,M(w({},a),{icon:n.jsx(A.FormOutlined,{}),onClick:()=>{o({type:"void","x-settings":"blockSettings:iframe","x-decorator":"BlockItem","x-decorator-props":{name:"iframe"},"x-component":"Iframe","x-component-props":{}})}}))},ae=o=>n.jsx(e.SchemaComponentOptions,{components:{Iframe:D,IframeBlockInitializer:ne,ArrayItems:S.ArrayItems},children:o.children}),se=o=>a=>{const t=O.useFieldSchema(),{form:l}=e.useFormBlockContext(),s=e.useRecord(),h=e.useVariableOptions({collectionField:{uiSchema:t},form:l,record:s,uiSchema:t,noDisabled:!0});return n.jsx(o,M(w({},a),{scope:h}))},$={items:[{name:"EditIframe",type:"modal",useComponentProps(){const o=O.useField(),a=O.useFieldSchema(),{t}=q.useTranslation(),{dn:l}=e.useDesignable(),s=e.useAPIClient(),{mode:h,url:v,params:y,htmlId:k,height:F="60vh"}=a["x-component-props"]||{},I=m=>P(this,null,function*(){var d,c,p,b,i;const u={values:{html:m}};if(k){const{data:f}=yield(c=(d=s.resource("iframeHtml")).update)==null?void 0:c.call(d,M(w({},u),{filterByTk:k}));return((p=f==null?void 0:f.data)==null?void 0:p[0])||{id:k}}else{const{data:f}=yield(i=(b=s.resource("iframeHtml")).create)==null?void 0:i.call(b,u);return f==null?void 0:f.data}}),{urlSchema:C,paramsSchema:H}=e.useURLAndParamsSchema(),B=b=>P(this,[b],function*({mode:m,url:u,html:d,height:c,params:p}){const i=a["x-component-props"]||{};if(i.mode=m,i.height=c,i.params=p,i.url=u,m==="html"){const f=yield I(d);i.htmlId=f.id}a["x-component-props"]=i,o.componentProps=w({},i),o.data={v:j.uid()},l.emit("patch",{schema:{"x-uid":a["x-uid"],"x-component-props":i}})});return{title:t("Edit iframe"),asyncGetInitialValues:()=>P(this,null,function*(){var u,d,c;const m={mode:h,url:v,height:F,params:y};if(k){const{data:p}=yield(d=(u=s.resource("iframeHtml")).get)==null?void 0:d.call(u,{filterByTk:k});m.html=((c=p==null?void 0:p.data)==null?void 0:c.html)||""}return m}),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:M(w({},C),{required:!0}),params:H,html:{title:t("html"),type:"string","x-decorator":"FormItem","x-component":se(e.Variable.RawTextArea),"x-component-props":{rows:10},required:!0,"x-reactions":{dependencies:["mode"],fulfill:{state:{hidden:'{{$deps[0] === "url"}}'}}}}}},onSubmit:B,noRecord:!0}}},{name:"setTheBlockHeight",Component:e.SchemaSettingsBlockHeightItem},{name:"divider",type:"divider"},{name:"delete",type:"remove",useComponentProps(){return{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}}}]},ie=new e.SchemaSettings(w({name:"iframeBlockSchemaSettings"},$)),le=new e.SchemaSettings(w({name:"blockSettings:iframe"},$));class R extends e.Plugin{load(){return P(this,null,function*(){this.app.schemaSettingsManager.add(ie),this.app.schemaSettingsManager.add(le),this.app.use(ae);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 l=this.app.schemaInitializerManager.get("popup:common:addBlock");l==null||l.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"})})}}r.PluginBlockIframeClient=R,r.default=R,Object.defineProperties(r,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/externalVersion.js
CHANGED
|
@@ -10,14 +10,13 @@
|
|
|
10
10
|
module.exports = {
|
|
11
11
|
"@formily/react": "2.3.0",
|
|
12
12
|
"@formily/shared": "2.3.0",
|
|
13
|
-
"@nocobase/client": "1.2.
|
|
13
|
+
"@nocobase/client": "1.2.14-alpha",
|
|
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
|
-
"@
|
|
20
|
-
"@nocobase/
|
|
21
|
-
"@nocobase/
|
|
22
|
-
"@nocobase/database": "1.2.12-alpha"
|
|
19
|
+
"@nocobase/server": "1.2.14-alpha",
|
|
20
|
+
"@nocobase/actions": "1.2.14-alpha",
|
|
21
|
+
"@nocobase/database": "1.2.14-alpha"
|
|
23
22
|
};
|
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.2.
|
|
7
|
+
"version": "1.2.14-alpha",
|
|
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": "717c71eee8cec8d230f1856759d97d6a843f8be6",
|
|
29
29
|
"keywords": [
|
|
30
30
|
"Blocks"
|
|
31
31
|
]
|