@nocobase/plugin-block-workbench 1.7.0-beta.9 → 1.8.0-beta.1

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/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Updated Date: February 20, 2025
1
+ Updated Date: April 1, 2025
2
2
 
3
3
  NocoBase License Agreement
4
4
 
@@ -88,7 +88,7 @@ Except for Third-Party Open Source Software, the Company owns all copyrights, tr
88
88
 
89
89
  6.6 Can sell plugins developed for Software in the Marketplace.
90
90
 
91
- 6.7 The User with an Enterprise Edition License can sell Upper Layer Application to their clients.
91
+ 6.7 The User with a Professional or Enterprise Edition License can sell Upper Layer Application to their clients.
92
92
 
93
93
  6.8 Not restricted by the AGPL-3.0 agreement.
94
94
 
@@ -106,9 +106,9 @@ Except for Third-Party Open Source Software, the Company owns all copyrights, tr
106
106
 
107
107
  7.4 It is not allowed to provide any form of no-code, zero-code, low-code platform SaaS products to the public using the original or modified Software.
108
108
 
109
- 7.5 It is not allowed for the User withot an Enterprise Edition license to sell Upper Layer Application to clients without a Commercial license.
109
+ 7.5 It is not allowed for the User withot a Professional or Enterprise Edition license to sell Upper Layer Application to clients without a Commercial license.
110
110
 
111
- 7.6 It is not allowed for the User with an Enterprise Edition license to sell Upper Layer Application to clients without a Commercial license with access to further development and configuration.
111
+ 7.6 It is not allowed for the User with a Professional or Enterprise Edition license to sell Upper Layer Application to clients without a Commercial license with access to further development and configuration.
112
112
 
113
113
  7.7 It is not allowed to publicly sell plugins developed for Software outside of the Marketplace.
114
114
 
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ "use strict";(self.webpackChunk_nocobase_plugin_block_workbench=self.webpackChunk_nocobase_plugin_block_workbench||[]).push([["713"],{192:function(e,t,n){n.r(t),n.d(t,{QRCodeScannerInner:function(){return S},QRCodeScanner:function(){return k}});var r=n(482),o=n(772),i=n(738),l=n(156),a=n.n(l),c=n(238);function u(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function s(e){var t=e.style,n={position:"absolute",backgroundColor:"rgb(255, 255, 255)"};return a().createElement("div",{id:"qr-scan-box",style:u({boxSizing:"border-box",inset:"0px"},void 0===t?{}:t)},a().createElement("div",{style:u({width:"40px",height:"5px",top:"-5px",left:"0px"},n)}),a().createElement("div",{style:u({width:"40px",height:"5px",top:"-5px",right:"0px"},n)}),a().createElement("div",{style:u({width:"40px",height:"5px",bottom:"-5px",left:"0px"},n)}),a().createElement("div",{style:u({width:"40px",height:"5px",bottom:"-5px",right:"0px"},n)}),a().createElement("div",{style:u({width:"5px",height:"45px",top:"-5px",left:"-5px"},n)}),a().createElement("div",{style:u({width:"5px",height:"45px",bottom:"-5px",left:"-5px"},n)}),a().createElement("div",{style:u({width:"5px",height:"45px",top:"-5px",right:"-5px"},n)}),a().createElement("div",{style:u({width:"5px",height:"45px",bottom:"-5px",right:"-5px"},n)}))}var f=n(58),h=n.n(f),p=n(128);function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function m(e,t,n,r,o,i,l){try{var a=e[i](l),c=a.value}catch(e){n(e);return}a.done?t(c):Promise.resolve(c).then(r,o)}function b(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function l(e){m(i,r,o,l,a,"next",e)}function a(e){m(i,r,o,l,a,"throw",e)}l(void 0)})}}function y(e,t){var n,r,o,i,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){var c=[i,a];if(n)throw TypeError("Generator is already executing.");for(;l;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=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++,r=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],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}function v(e,t){return e.startsWith(t)?e.slice(t.length):e}function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function x(e,t,n,r,o,i,l){try{var a=e[i](l),c=a.value}catch(e){n(e);return}a.done?t(c):Promise.resolve(c).then(r,o)}function w(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],l=!0,a=!1;try{for(o=o.call(e);!(l=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);l=!0);}catch(e){a=!0,r=e}finally{try{l||null==o.return||o.return()}finally{if(a)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return g(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return g(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var E="qrcode",S=function(e){var t,n,u,f,m,g,x,S,k,O,C,A,j,I,z,M,P,W,T,N,R,_,F=e.setVisible,H=(0,l.useRef)(),B=(0,l.useRef)(),D=(0,c.useTranslation)("block-workbench").t,Q=w((0,l.useState)({width:0,height:0}),2),V=Q[0],q=Q[1],G=Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),U=Math.max(document.documentElement.clientHeight||0,window.innerHeight||0),$=(n=(t={onScannerSizeChanged:q,elementId:E,onScanSuccess:(0,l.useCallback)(function(e){F(!1)},[F])}).onScannerSizeChanged,u=t.elementId,f=t.onScanSuccess,g=(m=(0,o.useApp)()).pm.get(h()).mobileRouter,x=m.router,S=((null==g?void 0:g.router)?null==g?void 0:g.basename:x.basename).replace(/\/+$/,""),C=(k=(0,l.useState)(),O=function(e){if(Array.isArray(e))return e}(k)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],l=!0,a=!1;try{for(o=o.call(e);!(l=(n=o.next()).done)&&(i.push(n.value),i.length!==t);l=!0);}catch(e){a=!0,r=e}finally{try{l||null==o.return||o.return()}finally{if(a)throw r}}return i}}(k,2)||function(e,t){if(e){if("string"==typeof e)return d(e,2);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return d(e,t)}}(k,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.")}())[0],A=O[1],j=(0,p.useNavigate)(),I=(0,c.useTranslation)("block-workbench").t,z=(0,l.useMemo)(function(){return{width:Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),height:Math.max(document.documentElement.clientHeight||0,window.innerHeight||0)}},[]),P=(0,l.useCallback)((M=b(function(e){return y(this,function(t){return[2,e.start({facingMode:"environment"},{fps:10,qrbox:function(e,t){return n({width:e,height:t}),{width:z.width,height:z.height}}},function(e){if(null==e?void 0:e.startsWith("http")){window.location.href=e;return}j(v(e,S)),f&&f(e)},void 0)]})}),function(e){return M.apply(this,arguments)}),[j,n,z,S,f]),T=(0,l.useCallback)((W=b(function(e){var t;return y(this,function(n){return(t=e.getState(),[i.lz.SCANNING,i.lz.PAUSED].includes(t))?[2,e.stop()]:[2]})}),function(e){return W.apply(this,arguments)}),[]),R=(0,l.useCallback)((N=b(function(e){var t;return y(this,function(n){switch(n.label){case 0:return[4,T(C)];case 1:n.sent(),n.label=2;case 2:return n.trys.push([2,4,,5]),[4,C.scanFileV2(e,!1)];case 3:if(null==(t=n.sent().decodedText)?void 0:t.startsWith("http"))return window.location.href=t,[2];return j(v(t,S)),f&&f(t),[3,5];case 4:return n.sent(),alert(I("QR code recognition failed, please scan again")),P(C),[3,5];case 5:return[2]}})}),function(e){return N.apply(this,arguments)}),[T,C,j,S,I,P,f]),(0,l.useEffect)(function(){var e=new i.t2(u);return A(e),P(e),function(){T(e)}},[u,P,T]),{startScanCamera:P,startScanFile:R}).startScanFile,L=function(){B.current&&B.current.click()},Y=function(e){var t=e.target.files;if(t.length>0){var n=t[0];n.size<1e6?$(n):alert(D("The image size is too large. Please compress it to below 1MB before uploading"))}};(0,l.useEffect)(function(){return document.documentElement.style.overscrollBehavior="none",function(){document.documentElement.style.overscrollBehavior="default"}},[]),(0,l.useEffect)(function(){var e=V.width,t=V.height,n=Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),r=Math.max(document.documentElement.clientHeight||0,window.innerHeight||0);if(e>0&&t>0&&t<r){var o=Math.floor(r/t*e),i=document.getElementsByTagName("video")[0];i.style.height="".concat(r,"px"),i.style.width="".concat(o,"px"),H.current.style.left="".concat((n-o)/2,"px"),H.current.style.position="absolute"}},[V]);var J={zIndex:"1003",fontSize:"1.8em",fontWeight:"bold"};return a().createElement(a().Fragment,null,a().createElement("div",{ref:H,id:E,style:{position:"absolute"}}),a().createElement(s,{style:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},(_=Math.floor(.6*Math.min(G,U)),{left:"".concat((G-_)/2,"px"),top:"".concat((U-_)/2,"px"),position:"fixed",width:"".concat(_,"px"),height:"".concat(_,"px")}))}),a().createElement(function(){return a().createElement("div",{style:{position:"absolute",bottom:"20px",left:"20px",padding:"10px 60px"}},a().createElement("div",{style:{color:"white",width:"40px",display:"flex",flexDirection:"column",alignItems:"center"}},a().createElement(r.FileImageOutlined,{style:J,onClick:L}),D("Album"),a().createElement("input",{ref:B,type:"file",accept:"image/*",onChange:Y,style:{visibility:"hidden"}})))},null))},k=function(e){var t=(0,o.useActionContext)(),n=t.visible,u=t.setVisible,s=w((0,l.useState)(!1),2),f=s[0],h=s[1],p=(0,c.useTranslation)("block-workbench").t;return(0,l.useEffect)(function(){var e,t,r=(e=function(){var e,t,n;return function(e,t){var n,r,o,i,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){var c=[i,a];if(n)throw TypeError("Generator is already executing.");for(;l;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=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++,r=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],r=0}finally{n=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:return r.trys.push([0,2,,3]),[4,i.t2.getCameras()];case 1:return 0===r.sent().length?alert(p("No camera device detected")):h(!0),[3,3];case 2:return e=r.sent(),t={NotFoundError:p("No camera device detected"),NotAllowedError:p("You have not granted permission to use the camera")},console.log(e),alert(null!=(n=t[e.name])?n:e),h(!1),u(!1),[3,3];case 3:return[2]}})},t=function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function l(e){x(i,r,o,l,a,"next",e)}function a(e){x(i,r,o,l,a,"throw",e)}l(void 0)})},function(){return t.apply(this,arguments)});n&&!f&&r()},[n,f,u,p]),n&&f?a().createElement("div",{style:{position:"fixed",width:"100%",height:"100%",background:"black",zIndex:"1001",top:0,left:0,overflow:"hidden"}},a().createElement(S,{setVisible:u}),a().createElement(r.LeftOutlined,{style:{position:"absolute",top:"22px",left:"20px",zIndex:"1003",color:"white",fontSize:"1.8em",fontWeight:"bold"},onClick:function(){return u(!1)}}),a().createElement("div",{style:{position:"absolute",color:"white",fontSize:"1.5em",left:0,right:0,top:"20px",zIndex:"1002",marginLeft:"auto",marginRight:"auto",textAlign:"center"}},p("Scan QR code"))):null}}}]);
@@ -1,3 +1,5 @@
1
1
  import React from 'react';
2
- export declare const QRCodeScannerInner: (props: any) => React.JSX.Element;
2
+ export declare const QRCodeScannerInner: ({ setVisible }: {
3
+ setVisible: any;
4
+ }) => React.JSX.Element;
3
5
  export declare const QRCodeScanner: (props: any) => React.JSX.Element;
@@ -1,7 +1,8 @@
1
1
  import { Html5Qrcode } from 'html5-qrcode';
2
- export declare function useScanner({ onScannerSizeChanged, elementId }: {
2
+ export declare function useScanner({ onScannerSizeChanged, elementId, onScanSuccess }: {
3
3
  onScannerSizeChanged: any;
4
4
  elementId: any;
5
+ onScanSuccess: any;
5
6
  }): {
6
7
  startScanCamera: (scanner: Html5Qrcode) => Promise<null>;
7
8
  startScanFile: (file: File) => Promise<void>;