From 2e55d718a8b3079dc87138867c0b6c5d22be0cc4 Mon Sep 17 00:00:00 2001 From: xion Date: Fri, 27 Sep 2024 01:55:52 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=84=E8=A7=88=E6=B7=BB=E5=8A=A0=E9=80=89?= =?UTF-8?q?=E4=B8=AD=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 18 +- pnpm-lock.yaml | 277 ++++++++++++++------------ src/pages/container/preview/index.tsx | 2 +- src/pages/panel/deck/index.tsx | 101 +++++++++- src/pages/panel/store/panel.ts | 25 +++ 5 files changed, 275 insertions(+), 148 deletions(-) diff --git a/package.json b/package.json index ad2ab8e..bbeebf6 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "deploy": "rsync -avz --delete ./dist/ light:/root/apps/envision/web" }, "dependencies": { - "@abearxiong/container": "0.0.1-alpha.8", + "@abearxiong/container": "0.0.1-alpha.9", "@abearxiong/flows": "0.0.1-alpha.9", "@abearxiong/ui": "0.0.1-alpha.0", "@ant-design/icons": "^5.5.1", @@ -21,8 +21,8 @@ "@kevisual/query": "^0.0.2", "@kevisual/ui": "^0.0.2", "@uiw/react-textarea-code-editor": "^3.0.2", - "@xyflow/react": "^12.3.0", - "antd": "^5.21.0", + "@xyflow/react": "^12.3.1", + "antd": "^5.21.1", "classnames": "^2.5.1", "clsx": "^2.1.1", "copy-to-clipboard": "^3.3.3", @@ -41,18 +41,18 @@ "zustand": "^4.5.5" }, "devDependencies": { - "@eslint/js": "^9.11.0", + "@eslint/js": "^9.11.1", "@tailwindcss/aspect-ratio": "^0.4.2", "@tailwindcss/line-clamp": "^0.4.4", "@tailwindcss/typography": "^0.5.15", "@types/d3": "^7.4.3", "@types/lodash-es": "^4.17.12", - "@types/node": "^22.5.5", - "@types/react": "^18.3.8", + "@types/node": "^22.7.2", + "@types/react": "^18.3.9", "@types/react-dom": "^18.3.0", "@vitejs/plugin-react": "^4.3.1", "autoprefixer": "^10.4.20", - "eslint": "^9.11.0", + "eslint": "^9.11.1", "eslint-plugin-react-hooks": "^5.1.0-rc.0", "eslint-plugin-react-refresh": "^0.4.12", "globals": "^15.9.0", @@ -62,7 +62,7 @@ "tailwindcss": "^3.4.13", "tailwindcss-animate": "^1.0.7", "typescript": "^5.6.2", - "typescript-eslint": "^8.6.0", - "vite": "^5.4.7" + "typescript-eslint": "^8.7.0", + "vite": "^5.4.8" } } \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3928fbc..5298453 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,11 +9,11 @@ importers: .: dependencies: '@abearxiong/container': - specifier: 0.0.1-alpha.8 - version: 0.0.1-alpha.8(@emotion/css@11.13.0)(crypto-js@4.2.0)(eventemitter3@5.0.1) + specifier: 0.0.1-alpha.9 + version: 0.0.1-alpha.9(@emotion/css@11.13.0)(crypto-js@4.2.0)(eventemitter3@5.0.1) '@abearxiong/flows': specifier: 0.0.1-alpha.9 - version: 0.0.1-alpha.9(@xyflow/react@12.3.0(@types/react@18.3.8)(immer@10.1.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(immer@10.1.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(zustand@4.5.5(@types/react@18.3.8)(immer@10.1.1)(react@18.3.1)) + version: 0.0.1-alpha.9(@xyflow/react@12.3.1(@types/react@18.3.9)(immer@10.1.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(immer@10.1.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(zustand@4.5.5(@types/react@18.3.9)(immer@10.1.1)(react@18.3.1)) '@abearxiong/ui': specifier: 0.0.1-alpha.0 version: 0.0.1-alpha.0 @@ -36,11 +36,11 @@ importers: specifier: ^3.0.2 version: 3.0.2(@babel/runtime@7.25.6)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@xyflow/react': - specifier: ^12.3.0 - version: 12.3.0(@types/react@18.3.8)(immer@10.1.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + specifier: ^12.3.1 + version: 12.3.1(@types/react@18.3.9)(immer@10.1.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) antd: - specifier: ^5.21.0 - version: 5.21.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + specifier: ^5.21.1 + version: 5.21.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1) classnames: specifier: ^2.5.1 version: 2.5.1 @@ -85,14 +85,14 @@ importers: version: 10.0.5(react-dom@18.3.1(react@18.3.1))(react@18.3.1) vite-plugin-tsconfig-paths: specifier: ^1.4.1 - version: 1.4.1(typescript@5.6.2)(vite@5.4.7(@types/node@22.5.5)) + version: 1.4.1(typescript@5.6.2)(vite@5.4.8(@types/node@22.7.2)) zustand: specifier: ^4.5.5 - version: 4.5.5(@types/react@18.3.8)(immer@10.1.1)(react@18.3.1) + version: 4.5.5(@types/react@18.3.9)(immer@10.1.1)(react@18.3.1) devDependencies: '@eslint/js': - specifier: ^9.11.0 - version: 9.11.0 + specifier: ^9.11.1 + version: 9.11.1 '@tailwindcss/aspect-ratio': specifier: ^0.4.2 version: 0.4.2(tailwindcss@3.4.13) @@ -109,29 +109,29 @@ importers: specifier: ^4.17.12 version: 4.17.12 '@types/node': - specifier: ^22.5.5 - version: 22.5.5 + specifier: ^22.7.2 + version: 22.7.2 '@types/react': - specifier: ^18.3.8 - version: 18.3.8 + specifier: ^18.3.9 + version: 18.3.9 '@types/react-dom': specifier: ^18.3.0 version: 18.3.0 '@vitejs/plugin-react': specifier: ^4.3.1 - version: 4.3.1(vite@5.4.7(@types/node@22.5.5)) + version: 4.3.1(vite@5.4.8(@types/node@22.7.2)) autoprefixer: specifier: ^10.4.20 version: 10.4.20(postcss@8.4.47) eslint: - specifier: ^9.11.0 - version: 9.11.0(jiti@1.21.6) + specifier: ^9.11.1 + version: 9.11.1(jiti@1.21.6) eslint-plugin-react-hooks: specifier: ^5.1.0-rc.0 - version: 5.1.0-rc-fb9a90fa48-20240614(eslint@9.11.0(jiti@1.21.6)) + version: 5.1.0-rc-fb9a90fa48-20240614(eslint@9.11.1(jiti@1.21.6)) eslint-plugin-react-refresh: specifier: ^0.4.12 - version: 0.4.12(eslint@9.11.0(jiti@1.21.6)) + version: 0.4.12(eslint@9.11.1(jiti@1.21.6)) globals: specifier: ^15.9.0 version: 15.9.0 @@ -154,16 +154,16 @@ importers: specifier: ^5.6.2 version: 5.6.2 typescript-eslint: - specifier: ^8.6.0 - version: 8.6.0(eslint@9.11.0(jiti@1.21.6))(typescript@5.6.2) + specifier: ^8.7.0 + version: 8.7.0(eslint@9.11.1(jiti@1.21.6))(typescript@5.6.2) vite: - specifier: ^5.4.7 - version: 5.4.7(@types/node@22.5.5) + specifier: ^5.4.8 + version: 5.4.8(@types/node@22.7.2) packages: - '@abearxiong/container@0.0.1-alpha.8': - resolution: {integrity: sha512-7DNio7j1YYGIQ1tVLD8p49spwmY1zf+PeX+M5VRw9dQXnKWlFr3FLAWoEJH2Lk7ODEMkRfzwsLMAh1vXFossfQ==, tarball: https://npm.pkg.github.com/download/@abearxiong/container/0.0.1-alpha.8/6191afd30d2b3040a41596d4bf96a319d15ee664} + '@abearxiong/container@0.0.1-alpha.9': + resolution: {integrity: sha512-8dYT4KUe69njM2oMxceqoI7MMhhEhbjsmP6ZHG2agHRQqQFRaU+9MhdoRCBL9b2jOPWQ411G7zVFPgHvXtYriA==, tarball: https://npm.pkg.github.com/download/@abearxiong/container/0.0.1-alpha.9/1a72c871d91259a315d37237d6672cc126311e49} peerDependencies: '@emotion/css': ^11.13.0 crypto-js: ^4.2.0 @@ -505,12 +505,16 @@ packages: resolution: {integrity: sha512-fTxvnS1sRMu3+JjXwJG0j/i4RT9u4qJ+lqS/yCGap4lH4zZGzQ7tu+xZqQmcMZq5OBZDL4QRxQzRjkWcGt8IVw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@eslint/core@0.6.0': + resolution: {integrity: sha512-8I2Q8ykA4J0x0o7cg67FPVnehcqWTBehu/lmY+bolPFHGjh49YzGBMXTvpqVgEbBdvNCSxj6iFgiIyHzf03lzg==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@eslint/eslintrc@3.1.0': resolution: {integrity: sha512-4Bfj15dVJdoy3RfZmmo86RK1Fwzn6SstsvK9JS+BaVKqC6QQQQyXekNaC+g+LKNgkQ+2VhGAzm6hO40AhMR3zQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@eslint/js@9.11.0': - resolution: {integrity: sha512-LPkkenkDqyzTFauZLLAPhIb48fj6drrfMvRGSL9tS3AcZBSVTllemLSNyCvHNNL2t797S/6DJNSIwRwXgMO/eQ==} + '@eslint/js@9.11.1': + resolution: {integrity: sha512-/qu+TWz8WwPWc7/HcIJKi+c+MOm46GdVaSlTTQcaqaL53+GsoA6MxWp5PtTx48qbSP7ylM1Kn7nhvkugfJvRSA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} '@eslint/object-schema@2.1.4': @@ -863,6 +867,9 @@ packages: '@types/estree@1.0.5': resolution: {integrity: sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==} + '@types/estree@1.0.6': + resolution: {integrity: sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==} + '@types/geojson@7946.0.14': resolution: {integrity: sha512-WCfD5Ht3ZesJUsONdhvm84dmzWOiOzOAqOncN0++w0lBw1o8OuDNJF2McvvCef/yBqb/HYRahp1BYtODFQ8bRg==} @@ -872,6 +879,9 @@ packages: '@types/hast@3.0.4': resolution: {integrity: sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==} + '@types/json-schema@7.0.15': + resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} + '@types/lodash-es@4.17.12': resolution: {integrity: sha512-0NgftHUcV4v34VhXm8QBSftKVXtbkBG3ViCjs6+eJ5a6y6Mi/jiFGPc1sC7QK+9BFhWrURE3EOggmWaSxL9OzQ==} @@ -881,8 +891,8 @@ packages: '@types/mdast@4.0.4': resolution: {integrity: sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==} - '@types/node@22.5.5': - resolution: {integrity: sha512-Xjs4y5UPO/CLdzpgR6GirZJx36yScjh73+2NlLlkFRSoQN8B0DpfXPdZGnvVmLRLOsqDpOfTNv7D9trgGhmOIA==} + '@types/node@22.7.2': + resolution: {integrity: sha512-866lXSrpGpgyHBZUa2m9YNWqHDjjM0aBTJlNtYaGEw4rqY/dcD7deRVTbBBAJelfA7oaGDbNftXF/TL/A6RgoA==} '@types/parse-json@4.0.2': resolution: {integrity: sha512-dISoDXWWQwUquiKsyZ4Ng+HX2KsPL7LyHKHQwgGFEA3IaKac4Obd+h2a/a6waisAoepJlBcx9paWqjA8/HVjCw==} @@ -896,8 +906,8 @@ packages: '@types/react-dom@18.3.0': resolution: {integrity: sha512-EhwApuTmMBmXuFOikhQLIBUn6uFg81SwLMOAUgodJF14SOBOCMdU04gDoYi0WOJJHD144TL32z4yDqCW3dnkQg==} - '@types/react@18.3.8': - resolution: {integrity: sha512-syBUrW3/XpnW4WJ41Pft+I+aPoDVbrBVQGEnbD7NijDGlVC+8gV/XKRY+7vMDlfPpbwYt0l1vd/Sj8bJGMbs9Q==} + '@types/react@18.3.9': + resolution: {integrity: sha512-+BpAVyTpJkNWWSSnaLBk6ePpHLOGJKnEQNbINNovPWzvEUyAe3e+/d494QdEh71RekM/qV7lw6jzf1HGrJyAtQ==} '@types/unist@2.0.11': resolution: {integrity: sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA==} @@ -905,8 +915,8 @@ packages: '@types/unist@3.0.3': resolution: {integrity: sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==} - '@typescript-eslint/eslint-plugin@8.6.0': - resolution: {integrity: sha512-UOaz/wFowmoh2G6Mr9gw60B1mm0MzUtm6Ic8G2yM1Le6gyj5Loi/N+O5mocugRGY+8OeeKmkMmbxNqUCq3B4Sg==} + '@typescript-eslint/eslint-plugin@8.7.0': + resolution: {integrity: sha512-RIHOoznhA3CCfSTFiB6kBGLQtB/sox+pJ6jeFu6FxJvqL8qRxq/FfGO/UhsGgQM9oGdXkV4xUgli+dt26biB6A==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: '@typescript-eslint/parser': ^8.0.0 || ^8.0.0-alpha.0 @@ -916,8 +926,8 @@ packages: typescript: optional: true - '@typescript-eslint/parser@8.6.0': - resolution: {integrity: sha512-eQcbCuA2Vmw45iGfcyG4y6rS7BhWfz9MQuk409WD47qMM+bKCGQWXxvoOs1DUp+T7UBMTtRTVT+kXr7Sh4O9Ow==} + '@typescript-eslint/parser@8.7.0': + resolution: {integrity: sha512-lN0btVpj2unxHlNYLI//BQ7nzbMJYBVQX5+pbNXvGYazdlgYonMn4AhhHifQ+J4fGRYA/m1DjaQjx+fDetqBOQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.57.0 || ^9.0.0 @@ -926,12 +936,12 @@ packages: typescript: optional: true - '@typescript-eslint/scope-manager@8.6.0': - resolution: {integrity: sha512-ZuoutoS5y9UOxKvpc/GkvF4cuEmpokda4wRg64JEia27wX+PysIE9q+lzDtlHHgblwUWwo5/Qn+/WyTUvDwBHw==} + '@typescript-eslint/scope-manager@8.7.0': + resolution: {integrity: sha512-87rC0k3ZlDOuz82zzXRtQ7Akv3GKhHs0ti4YcbAJtaomllXoSO8hi7Ix3ccEvCd824dy9aIX+j3d2UMAfCtVpg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@typescript-eslint/type-utils@8.6.0': - resolution: {integrity: sha512-dtePl4gsuenXVwC7dVNlb4mGDcKjDT/Ropsk4za/ouMBPplCLyznIaR+W65mvCvsyS97dymoBRrioEXI7k0XIg==} + '@typescript-eslint/type-utils@8.7.0': + resolution: {integrity: sha512-tl0N0Mj3hMSkEYhLkjREp54OSb/FI6qyCzfiiclvJvOqre6hsZTGSnHtmFLDU8TIM62G7ygEa1bI08lcuRwEnQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: typescript: '*' @@ -939,12 +949,12 @@ packages: typescript: optional: true - '@typescript-eslint/types@8.6.0': - resolution: {integrity: sha512-rojqFZGd4MQxw33SrOy09qIDS8WEldM8JWtKQLAjf/X5mGSeEFh5ixQlxssMNyPslVIk9yzWqXCsV2eFhYrYUw==} + '@typescript-eslint/types@8.7.0': + resolution: {integrity: sha512-LLt4BLHFwSfASHSF2K29SZ+ZCsbQOM+LuarPjRUuHm+Qd09hSe3GCeaQbcCr+Mik+0QFRmep/FyZBO6fJ64U3w==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@typescript-eslint/typescript-estree@8.6.0': - resolution: {integrity: sha512-MOVAzsKJIPIlLK239l5s06YXjNqpKTVhBVDnqUumQJja5+Y94V3+4VUFRA0G60y2jNnTVwRCkhyGQpavfsbq/g==} + '@typescript-eslint/typescript-estree@8.7.0': + resolution: {integrity: sha512-MC8nmcGHsmfAKxwnluTQpNqceniT8SteVwd2voYlmiSWGOtjvGXdPl17dYu2797GVscK30Z04WRM28CrKS9WOg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: typescript: '*' @@ -952,14 +962,14 @@ packages: typescript: optional: true - '@typescript-eslint/utils@8.6.0': - resolution: {integrity: sha512-eNp9cWnYf36NaOVjkEUznf6fEgVy1TWpE0o52e4wtojjBx7D1UV2WAWGzR+8Y5lVFtpMLPwNbC67T83DWSph4A==} + '@typescript-eslint/utils@8.7.0': + resolution: {integrity: sha512-ZbdUdwsl2X/s3CiyAu3gOlfQzpbuG3nTWKPoIvAu1pu5r8viiJvv2NPN2AqArL35NCYtw/lrPPfM4gxrMLNLPw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.57.0 || ^9.0.0 - '@typescript-eslint/visitor-keys@8.6.0': - resolution: {integrity: sha512-wapVFfZg9H0qOYh4grNVQiMklJGluQrOUiOhYRrQWhx7BY/+I1IYb8BczWNbbUpO+pqy0rDciv3lQH5E1bCLrg==} + '@typescript-eslint/visitor-keys@8.7.0': + resolution: {integrity: sha512-b1tx0orFCCh/THWPQa2ZwWzvOeyzzp36vkJYOpVg0u8UVOIsfVrnuC9FqAw9gRKn+rG2VmWQ/zDJZzkxUnj/XQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} '@uiw/react-textarea-code-editor@3.0.2': @@ -978,14 +988,14 @@ packages: peerDependencies: vite: ^4.2.0 || ^5.0.0 - '@xyflow/react@12.3.0': - resolution: {integrity: sha512-dujEbjOn+5gMGg/wsojxtI7v2CfWm7ieRyiOHiZTPyw6p/VIdCoS3nLfSBP3TT+swoHSAXZ78iomHSKoUl4tMg==} + '@xyflow/react@12.3.1': + resolution: {integrity: sha512-PurYFxwzJa0U6RRX9k4VbNRU+vQd6mRKFR8Uk1dF81diCKZDj495y6AupqsjMHtkO66tGHV0LdenLpIHvnOEFw==} peerDependencies: react: '>=17' react-dom: '>=17' - '@xyflow/system@0.0.42': - resolution: {integrity: sha512-kWYj+Y0GOct0jKYTdyRMNOLPxGNbb2TYvPg2gTmJnZ31DOOMkL5uRBLX825DR2gOACDu+i5FHLxPJUPf/eGOJw==} + '@xyflow/system@0.0.43': + resolution: {integrity: sha512-1zHgad1cWr1mKm2xbFaarK0Jg8WRgaQ8ubSBIo/pRdq3fEgCuqgNkL9NSAP6Rvm8zi3+Lu4JPUMN+EEx5QgX9A==} acorn-jsx@5.3.2: resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} @@ -1020,8 +1030,8 @@ packages: resolution: {integrity: sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==} engines: {node: '>=12'} - antd@5.21.0: - resolution: {integrity: sha512-eoY3LruXq/8MRCXG46O2cwc+Q8HW8Bhc+pWw7loIt6Dn22tLHckxYF/663kn55JTIOVUnJdmJDP9njdJmLXJsQ==} + antd@5.21.1: + resolution: {integrity: sha512-JBNv11RmZj5npBp77eyHPVp+ona1YcqCNxJF4kJ1CTXvCittqyMyXL+PLN3dXRIIDFQ8NYlf+v/Yn2pHZXXknA==} any-promise@1.3.0: resolution: {integrity: sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==} @@ -1401,8 +1411,8 @@ packages: resolution: {integrity: sha512-OtIRv/2GyiF6o/d8K7MYKKbXrOUBIK6SfkIRM4Z0dY3w+LiQ0vy3F57m0Z71bjbyeiWFiHJ8brqnmE6H6/jEuw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - eslint@9.11.0: - resolution: {integrity: sha512-yVS6XODx+tMFMDFcG4+Hlh+qG7RM6cCJXtQhCKLSsr3XkLvWggHjCqjfh0XsPPnt1c56oaT6PMgW9XWQQjdHXA==} + eslint@9.11.1: + resolution: {integrity: sha512-MobhYKIoAO1s1e4VUrgx1l1Sk2JBR/Gqjjgw8+mfgoLE2xwsHur4gdfTxyTgShrhvdVFTaJSgMiQBl1jv/AWxg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} hasBin: true peerDependencies: @@ -2041,8 +2051,8 @@ packages: react: '>=16.9.0' react-dom: '>=16.9.0' - rc-picker@4.6.14: - resolution: {integrity: sha512-7DuTfUFdkxmsNpWQ0TWv6FPGna5e6KKC4nxtx3x9xhumLz7jb3fhlDdWQvqEL6tpt9DOb1+N5j+wB+lDOSS9kg==} + rc-picker@4.6.15: + resolution: {integrity: sha512-OWZ1yrMie+KN2uEUfYCfS4b2Vu6RC1FWwNI0s+qypsc3wRt7g+peuZKVIzXCTaJwyyZruo80+akPg2+GmyiJjw==} engines: {node: '>=8.x'} peerDependencies: date-fns: '>= 2.x' @@ -2419,8 +2429,8 @@ packages: resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==} engines: {node: '>= 0.8.0'} - typescript-eslint@8.6.0: - resolution: {integrity: sha512-eEhhlxCEpCd4helh3AO1hk0UP2MvbRi9CtIAJTVPQjuSXOOO2jsEacNi4UdcJzZJbeuVg1gMhtZ8UYb+NFYPrA==} + typescript-eslint@8.7.0: + resolution: {integrity: sha512-nEHbEYJyHwsuf7c3V3RS7Saq+1+la3i0ieR3qP0yjqWSzVmh8Drp47uOl9LjbPANac4S7EFSqvcYIKXUUwIfIQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: typescript: '*' @@ -2517,8 +2527,8 @@ packages: peerDependencies: vite: '*' - vite@5.4.7: - resolution: {integrity: sha512-5l2zxqMEPVENgvzTuBpHer2awaetimj2BGkhBPdnwKbPNOlHsODU+oiazEZzLK7KhAnOrO+XGYJYn4ZlUhDtDQ==} + vite@5.4.8: + resolution: {integrity: sha512-FqrItQ4DT1NC4zCUqMB4c4AZORMKIa0m8/URVCZ77OZ/QSNeJ54bU1vrFADbDsuwfIPcgknRkmqakQcgnL4GiQ==} engines: {node: ^18.0.0 || >=20.0.0} hasBin: true peerDependencies: @@ -2604,24 +2614,24 @@ packages: snapshots: - '@abearxiong/container@0.0.1-alpha.8(@emotion/css@11.13.0)(crypto-js@4.2.0)(eventemitter3@5.0.1)': + '@abearxiong/container@0.0.1-alpha.9(@emotion/css@11.13.0)(crypto-js@4.2.0)(eventemitter3@5.0.1)': dependencies: '@emotion/css': 11.13.0 crypto-js: 4.2.0 eventemitter3: 5.0.1 nanoid: 5.0.7 - '@abearxiong/flows@0.0.1-alpha.9(@xyflow/react@12.3.0(@types/react@18.3.8)(immer@10.1.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(immer@10.1.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(zustand@4.5.5(@types/react@18.3.8)(immer@10.1.1)(react@18.3.1))': + '@abearxiong/flows@0.0.1-alpha.9(@xyflow/react@12.3.1(@types/react@18.3.9)(immer@10.1.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(immer@10.1.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(zustand@4.5.5(@types/react@18.3.9)(immer@10.1.1)(react@18.3.1))': dependencies: '@ant-design/icons': 5.5.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@icon-park/react': 1.4.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@xyflow/react': 12.3.0(@types/react@18.3.8)(immer@10.1.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + '@xyflow/react': 12.3.1(@types/react@18.3.9)(immer@10.1.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) clsx: 2.1.1 eventemitter3: 5.0.1 immer: 10.1.1 react: 18.3.1 react-tooltip: 5.28.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - zustand: 4.5.5(@types/react@18.3.8)(immer@10.1.1)(react@18.3.1) + zustand: 4.5.5(@types/react@18.3.9)(immer@10.1.1)(react@18.3.1) transitivePeerDependencies: - react-dom @@ -2940,9 +2950,9 @@ snapshots: '@esbuild/win32-x64@0.21.5': optional: true - '@eslint-community/eslint-utils@4.4.0(eslint@9.11.0(jiti@1.21.6))': + '@eslint-community/eslint-utils@4.4.0(eslint@9.11.1(jiti@1.21.6))': dependencies: - eslint: 9.11.0(jiti@1.21.6) + eslint: 9.11.1(jiti@1.21.6) eslint-visitor-keys: 3.4.3 '@eslint-community/regexpp@4.11.1': {} @@ -2955,6 +2965,8 @@ snapshots: transitivePeerDependencies: - supports-color + '@eslint/core@0.6.0': {} + '@eslint/eslintrc@3.1.0': dependencies: ajv: 6.12.6 @@ -2969,7 +2981,7 @@ snapshots: transitivePeerDependencies: - supports-color - '@eslint/js@9.11.0': {} + '@eslint/js@9.11.1': {} '@eslint/object-schema@2.1.4': {} @@ -3323,6 +3335,8 @@ snapshots: '@types/estree@1.0.5': {} + '@types/estree@1.0.6': {} + '@types/geojson@7946.0.14': {} '@types/hast@2.3.10': @@ -3333,6 +3347,8 @@ snapshots: dependencies: '@types/unist': 3.0.3 + '@types/json-schema@7.0.15': {} + '@types/lodash-es@4.17.12': dependencies: '@types/lodash': 4.17.9 @@ -3343,7 +3359,7 @@ snapshots: dependencies: '@types/unist': 3.0.3 - '@types/node@22.5.5': + '@types/node@22.7.2': dependencies: undici-types: 6.19.8 @@ -3355,9 +3371,9 @@ snapshots: '@types/react-dom@18.3.0': dependencies: - '@types/react': 18.3.8 + '@types/react': 18.3.9 - '@types/react@18.3.8': + '@types/react@18.3.9': dependencies: '@types/prop-types': 15.7.13 csstype: 3.1.3 @@ -3366,15 +3382,15 @@ snapshots: '@types/unist@3.0.3': {} - '@typescript-eslint/eslint-plugin@8.6.0(@typescript-eslint/parser@8.6.0(eslint@9.11.0(jiti@1.21.6))(typescript@5.6.2))(eslint@9.11.0(jiti@1.21.6))(typescript@5.6.2)': + '@typescript-eslint/eslint-plugin@8.7.0(@typescript-eslint/parser@8.7.0(eslint@9.11.1(jiti@1.21.6))(typescript@5.6.2))(eslint@9.11.1(jiti@1.21.6))(typescript@5.6.2)': dependencies: '@eslint-community/regexpp': 4.11.1 - '@typescript-eslint/parser': 8.6.0(eslint@9.11.0(jiti@1.21.6))(typescript@5.6.2) - '@typescript-eslint/scope-manager': 8.6.0 - '@typescript-eslint/type-utils': 8.6.0(eslint@9.11.0(jiti@1.21.6))(typescript@5.6.2) - '@typescript-eslint/utils': 8.6.0(eslint@9.11.0(jiti@1.21.6))(typescript@5.6.2) - '@typescript-eslint/visitor-keys': 8.6.0 - eslint: 9.11.0(jiti@1.21.6) + '@typescript-eslint/parser': 8.7.0(eslint@9.11.1(jiti@1.21.6))(typescript@5.6.2) + '@typescript-eslint/scope-manager': 8.7.0 + '@typescript-eslint/type-utils': 8.7.0(eslint@9.11.1(jiti@1.21.6))(typescript@5.6.2) + '@typescript-eslint/utils': 8.7.0(eslint@9.11.1(jiti@1.21.6))(typescript@5.6.2) + '@typescript-eslint/visitor-keys': 8.7.0 + eslint: 9.11.1(jiti@1.21.6) graphemer: 1.4.0 ignore: 5.3.2 natural-compare: 1.4.0 @@ -3384,28 +3400,28 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/parser@8.6.0(eslint@9.11.0(jiti@1.21.6))(typescript@5.6.2)': + '@typescript-eslint/parser@8.7.0(eslint@9.11.1(jiti@1.21.6))(typescript@5.6.2)': dependencies: - '@typescript-eslint/scope-manager': 8.6.0 - '@typescript-eslint/types': 8.6.0 - '@typescript-eslint/typescript-estree': 8.6.0(typescript@5.6.2) - '@typescript-eslint/visitor-keys': 8.6.0 + '@typescript-eslint/scope-manager': 8.7.0 + '@typescript-eslint/types': 8.7.0 + '@typescript-eslint/typescript-estree': 8.7.0(typescript@5.6.2) + '@typescript-eslint/visitor-keys': 8.7.0 debug: 4.3.7 - eslint: 9.11.0(jiti@1.21.6) + eslint: 9.11.1(jiti@1.21.6) optionalDependencies: typescript: 5.6.2 transitivePeerDependencies: - supports-color - '@typescript-eslint/scope-manager@8.6.0': + '@typescript-eslint/scope-manager@8.7.0': dependencies: - '@typescript-eslint/types': 8.6.0 - '@typescript-eslint/visitor-keys': 8.6.0 + '@typescript-eslint/types': 8.7.0 + '@typescript-eslint/visitor-keys': 8.7.0 - '@typescript-eslint/type-utils@8.6.0(eslint@9.11.0(jiti@1.21.6))(typescript@5.6.2)': + '@typescript-eslint/type-utils@8.7.0(eslint@9.11.1(jiti@1.21.6))(typescript@5.6.2)': dependencies: - '@typescript-eslint/typescript-estree': 8.6.0(typescript@5.6.2) - '@typescript-eslint/utils': 8.6.0(eslint@9.11.0(jiti@1.21.6))(typescript@5.6.2) + '@typescript-eslint/typescript-estree': 8.7.0(typescript@5.6.2) + '@typescript-eslint/utils': 8.7.0(eslint@9.11.1(jiti@1.21.6))(typescript@5.6.2) debug: 4.3.7 ts-api-utils: 1.3.0(typescript@5.6.2) optionalDependencies: @@ -3414,12 +3430,12 @@ snapshots: - eslint - supports-color - '@typescript-eslint/types@8.6.0': {} + '@typescript-eslint/types@8.7.0': {} - '@typescript-eslint/typescript-estree@8.6.0(typescript@5.6.2)': + '@typescript-eslint/typescript-estree@8.7.0(typescript@5.6.2)': dependencies: - '@typescript-eslint/types': 8.6.0 - '@typescript-eslint/visitor-keys': 8.6.0 + '@typescript-eslint/types': 8.7.0 + '@typescript-eslint/visitor-keys': 8.7.0 debug: 4.3.7 fast-glob: 3.3.2 is-glob: 4.0.3 @@ -3431,20 +3447,20 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/utils@8.6.0(eslint@9.11.0(jiti@1.21.6))(typescript@5.6.2)': + '@typescript-eslint/utils@8.7.0(eslint@9.11.1(jiti@1.21.6))(typescript@5.6.2)': dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@9.11.0(jiti@1.21.6)) - '@typescript-eslint/scope-manager': 8.6.0 - '@typescript-eslint/types': 8.6.0 - '@typescript-eslint/typescript-estree': 8.6.0(typescript@5.6.2) - eslint: 9.11.0(jiti@1.21.6) + '@eslint-community/eslint-utils': 4.4.0(eslint@9.11.1(jiti@1.21.6)) + '@typescript-eslint/scope-manager': 8.7.0 + '@typescript-eslint/types': 8.7.0 + '@typescript-eslint/typescript-estree': 8.7.0(typescript@5.6.2) + eslint: 9.11.1(jiti@1.21.6) transitivePeerDependencies: - supports-color - typescript - '@typescript-eslint/visitor-keys@8.6.0': + '@typescript-eslint/visitor-keys@8.7.0': dependencies: - '@typescript-eslint/types': 8.6.0 + '@typescript-eslint/types': 8.7.0 eslint-visitor-keys: 3.4.3 '@uiw/react-textarea-code-editor@3.0.2(@babel/runtime@7.25.6)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': @@ -3457,29 +3473,29 @@ snapshots: '@ungap/structured-clone@1.2.0': {} - '@vitejs/plugin-react@4.3.1(vite@5.4.7(@types/node@22.5.5))': + '@vitejs/plugin-react@4.3.1(vite@5.4.8(@types/node@22.7.2))': dependencies: '@babel/core': 7.25.2 '@babel/plugin-transform-react-jsx-self': 7.24.7(@babel/core@7.25.2) '@babel/plugin-transform-react-jsx-source': 7.24.7(@babel/core@7.25.2) '@types/babel__core': 7.20.5 react-refresh: 0.14.2 - vite: 5.4.7(@types/node@22.5.5) + vite: 5.4.8(@types/node@22.7.2) transitivePeerDependencies: - supports-color - '@xyflow/react@12.3.0(@types/react@18.3.8)(immer@10.1.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': + '@xyflow/react@12.3.1(@types/react@18.3.9)(immer@10.1.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': dependencies: - '@xyflow/system': 0.0.42 + '@xyflow/system': 0.0.43 classcat: 5.0.5 react: 18.3.1 react-dom: 18.3.1(react@18.3.1) - zustand: 4.5.5(@types/react@18.3.8)(immer@10.1.1)(react@18.3.1) + zustand: 4.5.5(@types/react@18.3.9)(immer@10.1.1)(react@18.3.1) transitivePeerDependencies: - '@types/react' - immer - '@xyflow/system@0.0.42': + '@xyflow/system@0.0.43': dependencies: '@types/d3-drag': 3.0.7 '@types/d3-selection': 3.0.10 @@ -3516,7 +3532,7 @@ snapshots: ansi-styles@6.2.1: {} - antd@5.21.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1): + antd@5.21.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1): dependencies: '@ant-design/colors': 7.1.0 '@ant-design/cssinjs': 1.21.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1) @@ -3548,7 +3564,7 @@ snapshots: rc-motion: 2.9.3(react-dom@18.3.1(react@18.3.1))(react@18.3.1) rc-notification: 5.6.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1) rc-pagination: 4.3.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - rc-picker: 4.6.14(dayjs@1.11.13)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + rc-picker: 4.6.15(dayjs@1.11.13)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) rc-progress: 4.0.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1) rc-rate: 2.13.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1) rc-resize-observer: 1.4.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1) @@ -3948,13 +3964,13 @@ snapshots: escape-string-regexp@4.0.0: {} - eslint-plugin-react-hooks@5.1.0-rc-fb9a90fa48-20240614(eslint@9.11.0(jiti@1.21.6)): + eslint-plugin-react-hooks@5.1.0-rc-fb9a90fa48-20240614(eslint@9.11.1(jiti@1.21.6)): dependencies: - eslint: 9.11.0(jiti@1.21.6) + eslint: 9.11.1(jiti@1.21.6) - eslint-plugin-react-refresh@0.4.12(eslint@9.11.0(jiti@1.21.6)): + eslint-plugin-react-refresh@0.4.12(eslint@9.11.1(jiti@1.21.6)): dependencies: - eslint: 9.11.0(jiti@1.21.6) + eslint: 9.11.1(jiti@1.21.6) eslint-scope@8.0.2: dependencies: @@ -3965,17 +3981,20 @@ snapshots: eslint-visitor-keys@4.0.0: {} - eslint@9.11.0(jiti@1.21.6): + eslint@9.11.1(jiti@1.21.6): dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@9.11.0(jiti@1.21.6)) + '@eslint-community/eslint-utils': 4.4.0(eslint@9.11.1(jiti@1.21.6)) '@eslint-community/regexpp': 4.11.1 '@eslint/config-array': 0.18.0 + '@eslint/core': 0.6.0 '@eslint/eslintrc': 3.1.0 - '@eslint/js': 9.11.0 + '@eslint/js': 9.11.1 '@eslint/plugin-kit': 0.2.0 '@humanwhocodes/module-importer': 1.0.1 '@humanwhocodes/retry': 0.3.0 '@nodelib/fs.walk': 1.2.8 + '@types/estree': 1.0.6 + '@types/json-schema': 7.0.15 ajv: 6.12.6 chalk: 4.1.2 cross-spawn: 7.0.3 @@ -4668,7 +4687,7 @@ snapshots: react: 18.3.1 react-dom: 18.3.1(react@18.3.1) - rc-picker@4.6.14(dayjs@1.11.13)(react-dom@18.3.1(react@18.3.1))(react@18.3.1): + rc-picker@4.6.15(dayjs@1.11.13)(react-dom@18.3.1(react@18.3.1))(react@18.3.1): dependencies: '@babel/runtime': 7.25.6 '@rc-component/trigger': 2.2.3(react-dom@18.3.1(react@18.3.1))(react@18.3.1) @@ -5121,11 +5140,11 @@ snapshots: dependencies: prelude-ls: 1.2.1 - typescript-eslint@8.6.0(eslint@9.11.0(jiti@1.21.6))(typescript@5.6.2): + typescript-eslint@8.7.0(eslint@9.11.1(jiti@1.21.6))(typescript@5.6.2): dependencies: - '@typescript-eslint/eslint-plugin': 8.6.0(@typescript-eslint/parser@8.6.0(eslint@9.11.0(jiti@1.21.6))(typescript@5.6.2))(eslint@9.11.0(jiti@1.21.6))(typescript@5.6.2) - '@typescript-eslint/parser': 8.6.0(eslint@9.11.0(jiti@1.21.6))(typescript@5.6.2) - '@typescript-eslint/utils': 8.6.0(eslint@9.11.0(jiti@1.21.6))(typescript@5.6.2) + '@typescript-eslint/eslint-plugin': 8.7.0(@typescript-eslint/parser@8.7.0(eslint@9.11.1(jiti@1.21.6))(typescript@5.6.2))(eslint@9.11.1(jiti@1.21.6))(typescript@5.6.2) + '@typescript-eslint/parser': 8.7.0(eslint@9.11.1(jiti@1.21.6))(typescript@5.6.2) + '@typescript-eslint/utils': 8.7.0(eslint@9.11.1(jiti@1.21.6))(typescript@5.6.2) optionalDependencies: typescript: 5.6.2 transitivePeerDependencies: @@ -5256,20 +5275,20 @@ snapshots: '@types/unist': 3.0.3 vfile-message: 4.0.2 - vite-plugin-tsconfig-paths@1.4.1(typescript@5.6.2)(vite@5.4.7(@types/node@22.5.5)): + vite-plugin-tsconfig-paths@1.4.1(typescript@5.6.2)(vite@5.4.8(@types/node@22.7.2)): dependencies: typescript-paths: 1.5.1(typescript@5.6.2) - vite: 5.4.7(@types/node@22.5.5) + vite: 5.4.8(@types/node@22.7.2) transitivePeerDependencies: - typescript - vite@5.4.7(@types/node@22.5.5): + vite@5.4.8(@types/node@22.7.2): dependencies: esbuild: 0.21.5 postcss: 8.4.47 rollup: 4.22.0 optionalDependencies: - '@types/node': 22.5.5 + '@types/node': 22.7.2 fsevents: 2.3.3 web-namespaces@2.0.1: {} @@ -5300,11 +5319,11 @@ snapshots: yocto-queue@0.1.0: {} - zustand@4.5.5(@types/react@18.3.8)(immer@10.1.1)(react@18.3.1): + zustand@4.5.5(@types/react@18.3.9)(immer@10.1.1)(react@18.3.1): dependencies: use-sync-external-store: 1.2.2(react@18.3.1) optionalDependencies: - '@types/react': 18.3.8 + '@types/react': 18.3.9 immer: 10.1.1 react: 18.3.1 diff --git a/src/pages/container/preview/index.tsx b/src/pages/container/preview/index.tsx index d88d773..eb541cd 100644 --- a/src/pages/container/preview/index.tsx +++ b/src/pages/container/preview/index.tsx @@ -196,7 +196,7 @@ export const PreviewWrapper = () => { style={{ height: 'calc(100% - 32px)', }}> -
+
); diff --git a/src/pages/panel/deck/index.tsx b/src/pages/panel/deck/index.tsx index eb4be81..9737df4 100644 --- a/src/pages/panel/deck/index.tsx +++ b/src/pages/panel/deck/index.tsx @@ -4,6 +4,8 @@ import { useParams } from 'react-router'; import { query, useStore, ws } from '@/modules'; import { message } from 'antd'; import { getContainerData } from '@/modules/deck-to-flow/deck'; +import { usePanelStore } from '../store'; +import { useShallow } from 'zustand/react/shallow'; export const useListener = (id?: string, opts?: any) => { const { refresh } = opts || {}; const connected = useStore((state) => state.connected); @@ -65,11 +67,25 @@ export const Deck = () => { const id = params.id; const ref = useRef(null); const containerRef = useRef(null); - + const [pageData, setPageData] = useState({}); + const [selected, setSelected] = useState(null); + const panelStore = usePanelStore( + useShallow((state) => { + return { + updateNodeDataStyle: state.updateNodeDataStyle, + }; + }), + ); useEffect(() => { if (!id) return; fetch(); }, []); + useEffect(() => { + ref.current?.addEventListener('onContainer', onContainer); + return () => { + ref.current?.removeEventListener('onContainer', onContainer); + }; + }, []); const fetch = async () => { const res = await query.post({ path: 'page', @@ -81,6 +97,7 @@ export const Deck = () => { console.log('data', data); const { page, containerList } = data; const result = getContainerData({ page, containerList }); + setPageData(result); init(result); } // if (res.code === 200) { @@ -122,7 +139,60 @@ export const Deck = () => { window.c = container; }; useListener(id, { refresh }); + const onContainer = (e) => { + const { data } = e; + const types = ['position', 'resize']; + if (types.includes(data.type)) { + const { type, data: containerData } = data; + console.log('containerData', containerData); + if (type === 'position') { + const { cid, left, top, rid } = containerData; + const newData = { + id: rid, + nodeData: { + id: cid, + data: { + style: { + left, + top, + }, + }, + }, + }; + if (left && top) { + panelStore.updateNodeDataStyle(newData); + } + } else if (type === 'resize') { + const { cid, rid, width, height } = containerData; + const newData = { + id: rid, + nodeData: { + id: cid, + data: { + style: { + width, + height, + }, + }, + }, + }; + if (width && height) { + panelStore.updateNodeDataStyle(newData); + } + } + } else if (data.type === 'active') { + if (!data?.data?.cid) { + setSelected(null); + return; + } + const { cid, rid } = data; + console.log('getParent', cid, pageData); + setSelected(data); + } else { + console.log('onContainer', data); + } + }; const init = async (data: any[]) => { console.log( 'init', @@ -137,17 +207,30 @@ export const Deck = () => { }); container.render(id!); containerRef.current = container; + containerRef.current.event.on('save', (data) => { + console.log('save', data); + const { id, code } = data; + }); }; return ( -
-
Preview
-
-
+
+
+
Deck
+
+
+
+ {selected && ( +
+
+
{JSON.stringify(selected, null, 2)}
+
+
+ )}
); }; diff --git a/src/pages/panel/store/panel.ts b/src/pages/panel/store/panel.ts index 8412bea..f001dc2 100644 --- a/src/pages/panel/store/panel.ts +++ b/src/pages/panel/store/panel.ts @@ -13,6 +13,7 @@ type PanelStore = { getPanel: (id?: string) => Promise; saveNodesEdges: (data: { nodes?: any[]; edges?: any[]; viewport?: any }) => Promise; updateNodeData: (data: any) => Promise; + updateNodeDataStyle: (data: any) => Promise; }; export const usePanelStore = create((set, get) => { return { @@ -97,5 +98,29 @@ export const usePanelStore = create((set, get) => { message.error(res.msg || 'Request failed'); } }, + updateNodeDataStyle: async (data) => { + const { loading } = get(); + if (loading) { + message.error('Request in progress, please wait'); + return; + } + const loaded = message.loading('Saving...', 0); + set({ loading: true }); + const res = await query.post({ + path: 'page', + key: 'updateNode', + data: data, + }); + loaded(); + set({ loading: false }); + if (res.code === 200) { + message.success('Success'); + // getList(); + return true; + } else { + message.error(res.msg || 'Request failed'); + } + return false; + }, }; });