@nocobase/plugin-block-workbench 2.1.0-beta.9 → 2.1.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.
@@ -0,0 +1,11 @@
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
+ export declare const NAMESPACE = "block-workbench";
10
+ export declare function tExpr(key: string): string;
11
+ export declare function useT(): (key: string, options?: Record<string, any>) => string;
@@ -7,7 +7,7 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
  import React from 'react';
10
- import { BlockModel } from '@nocobase/client';
10
+ import { BlockModel } from '@nocobase/client-v2';
11
11
  export declare const WorkbenchLayout: {
12
12
  Grid: string;
13
13
  List: string;
@@ -6,6 +6,6 @@
6
6
  * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
- import { ActionGroupModel } from '@nocobase/client';
9
+ import { ActionGroupModel } from '@nocobase/client-v2';
10
10
  export declare class ActionPanelGroupActionModel extends ActionGroupModel {
11
11
  }
@@ -7,7 +7,7 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
  import type { ButtonProps } from 'antd/es/button';
10
- import { ActionModel } from '@nocobase/client';
10
+ import { ActionModel } from '@nocobase/client-v2';
11
11
  export declare class ActionPanelScanActionModel extends ActionModel {
12
12
  onClick(event: any): void;
13
13
  defaultProps: ButtonProps;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ type QRCodeScannerInnerProps = {
3
+ setVisible: React.Dispatch<React.SetStateAction<boolean>>;
4
+ app?: any;
5
+ navigate: (path: string) => void;
6
+ onClose?: () => void;
7
+ t: (key: string, options?: Record<string, any>) => string;
8
+ };
9
+ export declare const QRCodeScannerInner: ({ setVisible, app, navigate, onClose, t }: QRCodeScannerInnerProps) => React.JSX.Element;
10
+ export {};
@@ -0,0 +1,20 @@
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
+ import { Html5Qrcode } from 'html5-qrcode';
10
+ export declare function useScanner({ onScannerSizeChanged, elementId, onScanSuccess, app: appCtx, navigate, t }: {
11
+ onScannerSizeChanged: any;
12
+ elementId: any;
13
+ onScanSuccess: any;
14
+ app: any;
15
+ navigate: any;
16
+ t: any;
17
+ }): {
18
+ startScanCamera: (scanner: Html5Qrcode) => Promise<null>;
19
+ startScanFile: (file: File) => Promise<void>;
20
+ };
@@ -0,0 +1,13 @@
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
+ import { Plugin } from '@nocobase/client-v2';
10
+ export declare class PluginBlockWorkbenchClient extends Plugin {
11
+ load(): Promise<void>;
12
+ }
13
+ export default PluginBlockWorkbenchClient;
@@ -11,14 +11,15 @@ module.exports = {
11
11
  "@formily/react": "2.3.7",
12
12
  "react": "18.2.0",
13
13
  "react-i18next": "11.18.6",
14
- "@nocobase/client": "2.1.0-beta.9",
14
+ "@nocobase/client": "2.1.1",
15
15
  "@emotion/css": "11.13.0",
16
16
  "antd": "5.24.2",
17
17
  "antd-style": "3.7.1",
18
- "@nocobase/server": "2.1.0-beta.9",
19
- "@nocobase/flow-engine": "2.1.0-beta.9",
18
+ "@nocobase/flow-engine": "2.1.1",
19
+ "@nocobase/client-v2": "2.1.1",
20
+ "@nocobase/server": "2.1.1",
20
21
  "@ant-design/icons": "5.6.1",
21
- "@nocobase/plugin-mobile": "2.1.0-beta.9",
22
+ "@nocobase/plugin-mobile": "2.1.1",
22
23
  "react-router-dom": "6.30.1",
23
24
  "react-dom": "18.2.0"
24
25
  };
@@ -19,6 +19,7 @@
19
19
  "Scan QR code": "Scan QR code",
20
20
  "Scan QR code action settings": "Scan QR code action settings",
21
21
  "The image size is too large. Please compress it to below 1MB before uploading": "The image size is too large. Please compress it to below 1MB before uploading",
22
+ "The image size is too large. Please compress it to below 10MB before uploading": "The image size is too large. Please compress it to below 10MB before uploading",
22
23
  "Unknown error": "Unknown error",
23
24
  "You have not granted permission to use the camera": "You have not granted permission to use the camera"
24
- }
25
+ }
@@ -19,7 +19,8 @@
19
19
  "Scan QR code": "扫描二维码",
20
20
  "Scan QR code action settings": "扫码按钮设置",
21
21
  "The image size is too large. Please compress it to below 1MB before uploading": "图片尺寸过大,请压缩到1MB以下上传",
22
+ "The image size is too large. Please compress it to below 10MB before uploading": "图片尺寸过大,请压缩到10MB以下上传",
22
23
  "Unknown error": "未知错误",
23
24
  "You have not granted permission to use the camera": "您未授权使用摄像头",
24
25
  "Ellipsis action title": "省略超出长度的操作标题"
25
- }
26
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-block-workbench",
3
- "version": "2.1.0-beta.9",
3
+ "version": "2.1.1",
4
4
  "displayName": "Block: Action panel",
5
5
  "displayName.ru-RU": "Блок: Панель действий",
6
6
  "displayName.zh-CN": "区块:操作面板",
@@ -10,6 +10,7 @@
10
10
  "main": "dist/server/index.js",
11
11
  "peerDependencies": {
12
12
  "@nocobase/client": "2.x",
13
+ "@nocobase/client-v2": "2.x",
13
14
  "@nocobase/plugin-mobile": "2.x",
14
15
  "@nocobase/server": "2.x",
15
16
  "@nocobase/test": "2.x"
@@ -24,5 +25,5 @@
24
25
  "Blocks"
25
26
  ],
26
27
  "license": "Apache-2.0",
27
- "gitHead": "c3a2875e4cbbb43b1f2361e6f9f5f84a7d3f3c3c"
28
+ "gitHead": "13ba59813dc5420e61cb403960d588f9ada7f28e"
28
29
  }
@@ -1,10 +0,0 @@
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([["397"],{626: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,7 +0,0 @@
1
- import React from 'react';
2
- export declare const QRCodeScannerInner: ({ setVisible, app, navigate, onClose }: {
3
- setVisible: any;
4
- app: any;
5
- navigate: any;
6
- onClose: any;
7
- }) => React.JSX.Element;
@@ -1,11 +0,0 @@
1
- import { Html5Qrcode } from 'html5-qrcode';
2
- export declare function useScanner({ onScannerSizeChanged, elementId, onScanSuccess, app: appCtx, navigate }: {
3
- onScannerSizeChanged: any;
4
- elementId: any;
5
- onScanSuccess: any;
6
- app: any;
7
- navigate: any;
8
- }): {
9
- startScanCamera: (scanner: Html5Qrcode) => Promise<null>;
10
- startScanFile: (file: File) => Promise<void>;
11
- };
File without changes