From dc6f6a7f09b1e4e70dbf5aff70f57b84ca615dda Mon Sep 17 00:00:00 2001 From: Beeant Date: Wed, 8 Mar 2023 02:57:08 +0000 Subject: [PATCH 1/7] feat: upgrade ant design to 5.x.x --- package.json | 2 +- packages/toolbar/package.json | 4 ++-- plugins/codeblock/package.json | 4 ++-- plugins/link/package.json | 4 ++-- plugins/mulit-codeblock/package.json | 4 ++-- plugins/tag/package.json | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index da551844..48d5803e 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "devDependencies": { "@types/sharedb": "^2.2.0", "@umijs/test": "^3.0.5", - "antd": "^4.15.5", + "antd": "^5.0.0-rc.3", "dumi": "^1.1.17", "father-build": "^1.19.4", "gh-pages": "^3.0.0", diff --git a/packages/toolbar/package.json b/packages/toolbar/package.json index 64bf154e..dafe4954 100644 --- a/packages/toolbar/package.json +++ b/packages/toolbar/package.json @@ -30,13 +30,13 @@ "@types/keymaster": "^1.6.28", "@types/lodash": "^4.14.178", "@types/tinycolor2": "^1.4.2", - "antd": "^4.12.3", + "antd": "^5.0.0-rc.3", "react": "^17.0.0", "react-dom": ">=17.0.0" }, "peerDependencies": { "@aomao/engine": ">=2.9", - "antd": "^4.12.3", + "antd": "^5.0.0-rc.3", "react": ">=17.0.0", "react-dom": ">=17.0.0" } diff --git a/plugins/codeblock/package.json b/plugins/codeblock/package.json index 0fb390ed..01e0a53e 100644 --- a/plugins/codeblock/package.json +++ b/plugins/codeblock/package.json @@ -36,13 +36,13 @@ "@types/codemirror": "^5.60.0", "@types/lodash": "^4.14.178", "@types/markdown-it": "^12.2.3", - "antd": "^4.12.3", + "antd": "^5.0.0-rc.3", "react": "^17.0.0", "react-dom": "^17.0.0" }, "peerDependencies": { "@aomao/engine": ">=2.9", - "antd": "^4.14.1", + "antd": "^5.0.0-rc.3", "react": ">=17.0.0", "react-dom": ">=17.0.0" } diff --git a/plugins/link/package.json b/plugins/link/package.json index 90359acb..51f7ea1c 100644 --- a/plugins/link/package.json +++ b/plugins/link/package.json @@ -29,13 +29,13 @@ }, "devDependencies": { "@types/markdown-it": "^12.2.3", - "antd": "^4.14.1", + "antd": "^5.0.0-rc.3", "react": "^17.0.0", "react-dom": "^17.0.0" }, "peerDependencies": { "@aomao/engine": ">=2.9", - "antd": "^4.14.1", + "antd": "^5.0.0-rc.3", "react": ">=17.0.0", "react-dom": ">=17.0.0" } diff --git a/plugins/mulit-codeblock/package.json b/plugins/mulit-codeblock/package.json index 69b47bcf..c951d612 100644 --- a/plugins/mulit-codeblock/package.json +++ b/plugins/mulit-codeblock/package.json @@ -42,13 +42,13 @@ "@types/markdown-it": "^12.2.3", "@types/markdown-it-container": "^2.0.5", "@types/react-beautiful-dnd": "^13.1.2", - "antd": "^4.12.3", + "antd": "^5.0.0-rc.3", "react": "^17.0.0", "react-dom": "^17.0.0" }, "peerDependencies": { "@aomao/engine": ">=2.9", - "antd": "^4.14.1", + "antd": "^5.0.0-rc.3", "react": ">=17.0.0", "react-dom": ">=17.0.0" } diff --git a/plugins/tag/package.json b/plugins/tag/package.json index d0d75c2f..1a46b769 100644 --- a/plugins/tag/package.json +++ b/plugins/tag/package.json @@ -24,14 +24,14 @@ "lodash": "^4.17.21" }, "devDependencies": { - "antd": "^4.12.3", + "antd": "^5.0.0-rc.3", "react": "^17.0.0", "react-dom": "^17.0.0" }, "peerDependencies": { "@aomao/engine": ">=^2.9", "@types/lodash": "^4.14.178", - "antd": "^4.14.1", + "antd": "^5.0.0-rc.3", "react": ">=17.0.0", "react-dom": ">=17.0.0" } From d0880af28d6da567e0db89e3763757851234a7cf Mon Sep 17 00:00:00 2001 From: Beeant Date: Fri, 24 Mar 2023 15:00:53 +0000 Subject: [PATCH 2/7] build: yarn.lock --- yarn.lock | 637 +++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 443 insertions(+), 194 deletions(-) diff --git a/yarn.lock b/yarn.lock index 62b9a6e5..fd62d582 100644 --- a/yarn.lock +++ b/yarn.lock @@ -17,6 +17,26 @@ dependencies: "@ctrl/tinycolor" "^3.4.0" +"@ant-design/colors@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@ant-design/colors/-/colors-7.0.0.tgz#eb7eecead124c3533aea05d61254f0a17f2b61b3" + integrity sha512-iVm/9PfGCbC0dSMBrz7oiEXZaaGH7ceU40OJEfKmyuzR9R5CRimJYPlRiFtMQGQcbNMea/ePcoIebi4ASGYXtg== + dependencies: + "@ctrl/tinycolor" "^3.4.0" + +"@ant-design/cssinjs@^1.5.6": + version "1.6.2" + resolved "https://registry.yarnpkg.com/@ant-design/cssinjs/-/cssinjs-1.6.2.tgz#b489651f56c0f0915edbeb94b392532ddff684c3" + integrity sha512-kmUo5xrfjOtDBp6LcBwPqPXei3Zar4SZfg7FpuahS1Fm9NyWckrxEVge6MjBgmZrpAnaJn00zy2jMELL7HuY6w== + dependencies: + "@babel/runtime" "^7.11.1" + "@emotion/hash" "^0.8.0" + "@emotion/unitless" "^0.7.5" + classnames "^2.3.1" + csstype "^3.0.10" + rc-util "^5.27.0" + stylis "^4.0.13" + "@ant-design/icons-svg@^4.2.1": version "4.2.1" resolved "https://registry.npmjs.org/@ant-design/icons-svg/-/icons-svg-4.2.1.tgz#8630da8eb4471a4aabdaed7d1ff6a97dcb2cf05a" @@ -30,27 +50,27 @@ "@ant-design/colors" "^6.0.0" "@ant-design/icons-svg" "^4.2.1" -"@ant-design/icons@^4.7.0": - version "4.7.0" - resolved "https://registry.npmjs.org/@ant-design/icons/-/icons-4.7.0.tgz#8c3cbe0a556ba92af5dc7d1e70c0b25b5179af0f" - integrity sha512-aoB4Z7JA431rt6d4u+8xcNPPCrdufSRMUOpxa1ab6mz1JCQZOEVolj2WVs/tDFmN62zzK30mNelEsprLYsSF3g== +"@ant-design/icons@^5.0.0": + version "5.0.1" + resolved "https://registry.yarnpkg.com/@ant-design/icons/-/icons-5.0.1.tgz#febb1fdc5776f58187b2c953ac9a4496069d045b" + integrity sha512-ZyF4ksXCcdtwA/1PLlnFLcF/q8/MhwxXhKHh4oCHDA4Ip+ZzAHoICtyp4wZWfiCVDP0yuz3HsjyvuldHFb3wjA== dependencies: - "@ant-design/colors" "^6.0.0" + "@ant-design/colors" "^7.0.0" "@ant-design/icons-svg" "^4.2.1" "@babel/runtime" "^7.11.2" classnames "^2.2.6" rc-util "^5.9.4" -"@ant-design/react-slick@~0.29.1": - version "0.29.2" - resolved "https://registry.npmjs.org/@ant-design/react-slick/-/react-slick-0.29.2.tgz#53e6a7920ea3562eebb304c15a7fc2d7e619d29c" - integrity sha512-kgjtKmkGHa19FW21lHnAfyyH9AAoh35pBdcJ53rHmQ3O+cfFHGHnUbj/HFrRNJ5vIts09FKJVAD8RpaC+RaWfA== +"@ant-design/react-slick@~1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@ant-design/react-slick/-/react-slick-1.0.0.tgz#4696eecaa2dea0429e47ae24c267015cfd6df35c" + integrity sha512-OKxZsn8TAf8fYxP79rDXgLs9zvKMTslK6dJ4iLhDXOujUqC5zJPBRszyrcEHXcMPOm1Sgk40JgyF3yiL/Swd7w== dependencies: "@babel/runtime" "^7.10.4" classnames "^2.2.5" json2mq "^0.2.0" - lodash "^4.17.21" resize-observer-polyfill "^1.5.1" + throttle-debounce "^5.0.0" "@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.4", "@babel/code-frame@^7.16.7", "@babel/code-frame@^7.18.6": version "7.18.6" @@ -1255,13 +1275,20 @@ dependencies: regenerator-runtime "^0.13.4" -"@babel/runtime@^7.1.2", "@babel/runtime@^7.10.1", "@babel/runtime@^7.10.2", "@babel/runtime@^7.10.4", "@babel/runtime@^7.10.5", "@babel/runtime@^7.11.1", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.1", "@babel/runtime@^7.12.5", "@babel/runtime@^7.13.10", "@babel/runtime@^7.15.4", "@babel/runtime@^7.18.0", "@babel/runtime@^7.18.3", "@babel/runtime@^7.7.6", "@babel/runtime@^7.8.4", "@babel/runtime@^7.9.2": +"@babel/runtime@^7.1.2", "@babel/runtime@^7.10.1", "@babel/runtime@^7.10.4", "@babel/runtime@^7.10.5", "@babel/runtime@^7.11.1", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.1", "@babel/runtime@^7.12.5", "@babel/runtime@^7.13.10", "@babel/runtime@^7.15.4", "@babel/runtime@^7.18.0", "@babel/runtime@^7.18.3", "@babel/runtime@^7.7.6", "@babel/runtime@^7.8.4", "@babel/runtime@^7.9.2": version "7.18.9" resolved "https://registry.npmjs.org/@babel/runtime/-/runtime-7.18.9.tgz#b4fcfce55db3d2e5e080d2490f608a3b9f407f4a" integrity sha512-lkqXDcvlFT5rvEjiu6+QYO+1GXrEHRo2LOtS7E4GtX5ESIZOgepqsZBVIj6Pv+a6zqsya9VCgiK1KAK4BvJDAw== dependencies: regenerator-runtime "^0.13.4" +"@babel/runtime@^7.16.7", "@babel/runtime@^7.20.0", "@babel/runtime@^7.20.7": + version "7.21.0" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.21.0.tgz#5b55c9d394e5fcf304909a8b00c07dc217b56673" + integrity sha512-xwII0//EObnq89Ji5AKYQaRYiW/nZ3llSv29d49IuxPhKbtJoLP+9QUUZ4nVragQVtaVGeZrpB+ZtG/Pdy/POw== + dependencies: + regenerator-runtime "^0.13.11" + "@babel/template@^7.16.7", "@babel/template@^7.18.6", "@babel/template@^7.3.3", "@babel/template@^7.4.0": version "7.18.6" resolved "https://registry.npmjs.org/@babel/template/-/template-7.18.6.tgz#1283f4993e00b929d6e2d3c72fdc9168a2977a31" @@ -1328,6 +1355,21 @@ resolved "https://registry.npmjs.org/@ctrl/tinycolor/-/tinycolor-3.4.1.tgz#75b4c27948c81e88ccd3a8902047bcd797f38d32" integrity sha512-ej5oVy6lykXsvieQtqZxCOaLT+xD4+QNarq78cIYISHmZXshCvROLudpQN3lfL8G0NL7plMSSK+zlyvCaIJ4Iw== +"@ctrl/tinycolor@^3.6.0": + version "3.6.0" + resolved "https://registry.yarnpkg.com/@ctrl/tinycolor/-/tinycolor-3.6.0.tgz#53fa5fe9c34faee89469e48f91d51a3766108bc8" + integrity sha512-/Z3l6pXthq0JvMYdUFyX9j0MaCltlIn6mfh9jLyQwg5aPKxkyNa0PTHtU1AlFXLNk55ZuAeJRcpvq+tmLfKmaQ== + +"@emotion/hash@^0.8.0": + version "0.8.0" + resolved "https://registry.yarnpkg.com/@emotion/hash/-/hash-0.8.0.tgz#bbbff68978fefdbe68ccb533bc8cbe1d1afb5413" + integrity sha512-kBJtf7PH6aWwZ6fka3zQ0p6SBYzx4fl1LoZXE2RrnYST9Xljm7WfKJrU4g/Xr3Beg72MLrp1AWNUmuYJTL7Cow== + +"@emotion/unitless@^0.7.5": + version "0.7.5" + resolved "https://registry.yarnpkg.com/@emotion/unitless/-/unitless-0.7.5.tgz#77211291c1900a700b8a78cfafda3160d76949ed" + integrity sha512-OWORNpfjMsSSUBVrRBVGECkhWcULOAJz9ZW8uK9qgxD+87M7jHRcvh/A96XXNhXTLmKcoYSQtBEX7lHMO7YRwg== + "@evocateur/libnpmaccess@^3.1.2": version "3.1.2" resolved "https://registry.npmjs.org/@evocateur/libnpmaccess/-/libnpmaccess-3.1.2.tgz#ecf7f6ce6b004e9f942b098d92200be4a4b1c845" @@ -2549,6 +2591,63 @@ dependencies: "@octokit/openapi-types" "^12.11.0" +"@rc-component/context@^1.3.0": + version "1.3.0" + resolved "https://registry.yarnpkg.com/@rc-component/context/-/context-1.3.0.tgz#608ccf0abcbec9406751b17a4b35db08e481c110" + integrity sha512-6QdaCJ7Wn5UZLJs15IEfqy4Ru3OaL5ctqpQYWd5rlfV9wwzrzdt6+kgAQZV/qdB0MUPN4nhyBfRembQCIvBf+w== + dependencies: + "@babel/runtime" "^7.10.1" + rc-util "^5.27.0" + +"@rc-component/mini-decimal@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@rc-component/mini-decimal/-/mini-decimal-1.0.1.tgz#e5dbc20a6a5b0e234d279bc71ce730ab865d3910" + integrity sha512-9N8nRk0oKj1qJzANKl+n9eNSMUGsZtjwNuDCiZ/KA+dt1fE3zq5x2XxclRcAbOIXnZcJ53ozP2Pa60gyELXagA== + dependencies: + "@babel/runtime" "^7.18.0" + +"@rc-component/mutate-observer@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@rc-component/mutate-observer/-/mutate-observer-1.0.0.tgz#ce99af3239ed9c74ee3e7302f1c67098de920b46" + integrity sha512-okqRJSfNisXdI6CUeOLZC5ukBW/8kir2Ii4PJiKpUt+3+uS7dxwJUMxsUZquxA1rQuL8YcEmKVp/TCnR+yUdZA== + dependencies: + "@babel/runtime" "^7.18.0" + classnames "^2.3.2" + rc-util "^5.24.4" + +"@rc-component/portal@^1.0.0-6", "@rc-component/portal@^1.0.0-8", "@rc-component/portal@^1.0.0-9", "@rc-component/portal@^1.0.2", "@rc-component/portal@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@rc-component/portal/-/portal-1.1.0.tgz#6b94450d2c2b00d50b141bd7a0be23bd96503dbe" + integrity sha512-tbXM9SB1r5FOuZjRCljERFByFiEUcMmCWMXLog/NmgCzlAzreXyf23Vei3ZpSMxSMavzPnhCovfZjZdmxS3d1w== + dependencies: + "@babel/runtime" "^7.18.0" + classnames "^2.3.2" + rc-util "^5.24.4" + +"@rc-component/tour@~1.8.0": + version "1.8.0" + resolved "https://registry.yarnpkg.com/@rc-component/tour/-/tour-1.8.0.tgz#fda8b533e36db1d4254e3ffbcefe3395c346eb1c" + integrity sha512-rrRGioHTLQlGca27G2+lw7QpRb3uuMYCUIJjj31/B44VCJS0P2tqYhOgtzvWQmaLMlWH3ZlpzotkKX13NT4XEA== + dependencies: + "@babel/runtime" "^7.18.0" + "@rc-component/portal" "^1.0.0-9" + "@rc-component/trigger" "^1.3.6" + classnames "^2.3.2" + rc-util "^5.24.4" + +"@rc-component/trigger@^1.0.4", "@rc-component/trigger@^1.3.6", "@rc-component/trigger@^1.4.0", "@rc-component/trigger@^1.5.0", "@rc-component/trigger@^1.5.9": + version "1.6.2" + resolved "https://registry.yarnpkg.com/@rc-component/trigger/-/trigger-1.6.2.tgz#1e860799eaefbf36f2dedc29144e708c4498911b" + integrity sha512-MxIokdiDnBACGYGWtGp19pnBVKPKmrP7yDjGfkE+HtyATLs9T8DOdd53EZnk1DbuEUn+6EMYigKMmXOqffTYxw== + dependencies: + "@babel/runtime" "^7.18.3" + "@rc-component/portal" "^1.1.0" + classnames "^2.3.2" + rc-align "^4.0.0" + rc-motion "^2.0.0" + rc-resize-observer "^1.3.1" + rc-util "^5.29.2" + "@rollup/plugin-babel@5.3.1": version "5.3.1" resolved "https://registry.npmjs.org/@rollup/plugin-babel/-/plugin-babel-5.3.1.tgz#04bc0608f4aa4b2e4b1aebf284344d0f68fda283" @@ -3786,55 +3885,59 @@ ant-design-vue@>=2.2.6: vue-types "^3.0.0" warning "^4.0.0" -antd@^4.12.3, antd@^4.14.1, antd@^4.15.5: - version "4.22.2" - resolved "https://registry.npmjs.org/antd/-/antd-4.22.2.tgz#8b022c7d234f9038f9aa018e837544bc1caace8c" - integrity sha512-3zyJ0Z9LaloCII0OLv7GUjKvigrmj44whPrNqrbLhcdc2O2oJNGtlPUf5bkrn98RIZSQ+EjXOuTlUSRbDjvLJA== +antd@^5.0.0-rc.3: + version "5.3.2" + resolved "https://registry.yarnpkg.com/antd/-/antd-5.3.2.tgz#6f225a3ae43c63c1003dc7af4d0045d3be612497" + integrity sha512-AOCZ+5krqvlLPR1v33K2PQtt9XBAC0gUdjxuHltUliE9u2zlZzGT+4DSHTNnw8CtotPV4lFKab3+K+FgdtyTlw== dependencies: - "@ant-design/colors" "^6.0.0" - "@ant-design/icons" "^4.7.0" - "@ant-design/react-slick" "~0.29.1" + "@ant-design/colors" "^7.0.0" + "@ant-design/cssinjs" "^1.5.6" + "@ant-design/icons" "^5.0.0" + "@ant-design/react-slick" "~1.0.0" "@babel/runtime" "^7.18.3" - "@ctrl/tinycolor" "^3.4.0" + "@ctrl/tinycolor" "^3.6.0" + "@rc-component/mutate-observer" "^1.0.0" + "@rc-component/tour" "~1.8.0" + "@rc-component/trigger" "^1.5.9" classnames "^2.2.6" copy-to-clipboard "^3.2.0" - lodash "^4.17.21" - memoize-one "^6.0.0" - moment "^2.29.2" - rc-cascader "~3.6.0" + dayjs "^1.11.1" + qrcode.react "^3.1.0" + rc-cascader "~3.9.0" rc-checkbox "~2.3.0" - rc-collapse "~3.3.0" - rc-dialog "~8.9.0" - rc-drawer "~5.1.0-alpha.1" + rc-collapse "~3.5.2" + rc-dialog "~9.0.2" + rc-drawer "~6.1.1" rc-dropdown "~4.0.0" - rc-field-form "~1.27.0" - rc-image "~5.7.0" - rc-input "~0.0.1-alpha.5" - rc-input-number "~7.3.5" - rc-mentions "~1.9.0" - rc-menu "~9.6.0" + rc-field-form "~1.28.0" + rc-image "~5.15.2" + rc-input "~0.2.1" + rc-input-number "~7.4.0" + rc-mentions "~2.1.0" + rc-menu "~9.8.2" rc-motion "^2.6.1" - rc-notification "~4.6.0" - rc-pagination "~3.1.17" - rc-picker "~2.6.10" - rc-progress "~3.3.2" - rc-rate "~2.9.0" + rc-notification "~5.0.0" + rc-pagination "~3.3.0" + rc-picker "~3.3.1" + rc-progress "~3.4.1" + rc-rate "~2.10.0" rc-resize-observer "^1.2.0" - rc-segmented "~2.1.0" - rc-select "~14.1.1" - rc-slider "~10.0.0" - rc-steps "~4.1.0" - rc-switch "~3.2.0" - rc-table "~7.25.3" - rc-tabs "~11.16.0" - rc-textarea "~0.3.0" - rc-tooltip "~5.2.0" - rc-tree "~5.6.5" - rc-tree-select "~5.4.0" - rc-trigger "^5.2.10" + rc-segmented "~2.1.2" + rc-select "~14.3.0" + rc-slider "~10.1.0" + rc-steps "~6.0.0" + rc-switch "~4.0.0" + rc-table "~7.31.0" + rc-tabs "~12.5.6" + rc-textarea "~1.1.0" + rc-tooltip "~6.0.0" + rc-tree "~5.7.0" + rc-tree-select "~5.7.0" + rc-trigger "^5.3.4" rc-upload "~4.3.0" - rc-util "^5.22.5" - scroll-into-view-if-needed "^2.2.25" + rc-util "^5.27.0" + scroll-into-view-if-needed "^3.0.3" + throttle-debounce "^5.0.0" any-promise@^1.0.0: version "1.3.0" @@ -4895,6 +4998,11 @@ classnames@2.x, classnames@^2.2.1, classnames@^2.2.3, classnames@^2.2.5, classna resolved "https://registry.npmjs.org/classnames/-/classnames-2.3.1.tgz#dfcfa3891e306ec1dad105d0e88f4417b8535e8e" integrity sha512-OlQdbZ7gLfGarSqxesMesDa5uz7KFbID8Kpq/SxIoNGDqY8lSYs0D+hhtBXhcdB3rcbXArFr7vlHheLk1voeNA== +classnames@^2.3.2: + version "2.3.2" + resolved "https://registry.yarnpkg.com/classnames/-/classnames-2.3.2.tgz#351d813bf0137fcc6a76a16b88208d2560a0d924" + integrity sha512-CSbhY4cFEJRe6/GQzIk5qXZ4Jeg5pcsP7b5peFSDpffpe1cqjASH/n9UTjBwOp6XpMSTwQ8Za2K5V02ueA7Tmw== + clean-stack@^2.0.0: version "2.2.0" resolved "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz#ee8472dbb129e727b31e8a10a427dee9dfe4008b" @@ -5223,6 +5331,11 @@ compute-scroll-into-view@^1.0.17: resolved "https://registry.npmjs.org/compute-scroll-into-view/-/compute-scroll-into-view-1.0.17.tgz#6a88f18acd9d42e9cf4baa6bec7e0522607ab7ab" integrity sha512-j4dx+Fb0URmzbwwMUrhqWM2BEWHdFGx+qZ9qqASHRPqvTYdqvWnHg0H1hIbcyLnvgnoNAVMlwkepyqM3DaIFUg== +compute-scroll-into-view@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/compute-scroll-into-view/-/compute-scroll-into-view-3.0.0.tgz#95d2f2f4653e7edda74dd1e38edaaa897918e0f0" + integrity sha512-Yk1An4qzo5++Cu6peT9PsmRKIU8tALpmdoE09n//AfGQFcPfx21/tMGMsmKYmLJWaBJrGOJ5Jz5hoU+7cZZUWQ== + concat-map@0.0.1: version "0.0.1" resolved "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" @@ -5785,6 +5898,11 @@ csstype@^2.6.8: resolved "https://registry.npmjs.org/csstype/-/csstype-2.6.20.tgz#9229c65ea0b260cf4d3d997cb06288e36a8d6dda" integrity sha512-/WwNkdXfckNgw6S5R125rrW8ez139lBHWouiBvX8dfMFtcn6V81REDqnH7+CRpRipfYlyU1CmOnOxrmGcFOjeA== +csstype@^3.0.10: + version "3.1.1" + resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.1.1.tgz#841b532c45c758ee546a11d5bd7b7b473c8c30b9" + integrity sha512-DJR/VvkAvSZW9bTouZue2sSxDwdTN92uHjqeKVm+0dAqdfNykRzQ95tay8aXMBAAPpUiq4Qcug2L7neoRh2Egw== + csstype@^3.0.2: version "3.1.0" resolved "https://registry.npmjs.org/csstype/-/csstype-3.1.0.tgz#4ddcac3718d787cf9df0d1b7d15033925c8f29f2" @@ -6350,21 +6468,21 @@ datauri@^3.0.0: image-size "0.8.3" mimer "1.1.0" -date-fns@2.x: - version "2.29.1" - resolved "https://registry.npmjs.org/date-fns/-/date-fns-2.29.1.tgz#9667c2615525e552b5135a3116b95b1961456e60" - integrity sha512-dlLD5rKaKxpFdnjrs+5azHDFOPEu4ANy/LTh04A1DTzMM7qoajmKCBc8pkKRFT41CNzw+4gQh79X5C+Jq27HAw== - dateformat@^3.0.0: version "3.0.3" resolved "https://registry.npmjs.org/dateformat/-/dateformat-3.0.3.tgz#a6e37499a4d9a9cf85ef5872044d62901c9889ae" integrity sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q== -dayjs@1.x, dayjs@^1.10.5: +dayjs@^1.10.5: version "1.11.4" resolved "https://registry.npmjs.org/dayjs/-/dayjs-1.11.4.tgz#3b3c10ca378140d8917e06ebc13a4922af4f433e" integrity sha512-Zj/lPM5hOvQ1Bf7uAvewDaUcsJoI6JmNqmHhHl3nyumwe0XHwt8sWdOVAPACJzCebL8gQCi+K49w7iKWnGwX9g== +dayjs@^1.11.1: + version "1.11.7" + resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.11.7.tgz#4b296922642f70999544d1144a2c25730fce63e2" + integrity sha512-+Yw9U6YO5TQohxLcIkrXBeY73WP3ejHWVvx8XCk3gxvQDCTEmS48ZrSZCKciI7Bhl/uCMyxYtE9UqRILmFphkQ== + debug@3.1.0, debug@=3.1.0: version "3.1.0" resolved "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" @@ -10695,11 +10813,6 @@ memoize-one@^5.1.1: resolved "https://registry.npmjs.org/memoize-one/-/memoize-one-5.2.1.tgz#8337aa3c4335581839ec01c3d594090cebe8f00e" integrity sha512-zYiwtZUcYyXKo/np96AGZAckk+FWWsUdJ3cHGGmld7+AhvcWmQyGCYUh1hc4Q/pkOhb65dQR/pqCyK0cOaHz4Q== -memoize-one@^6.0.0: - version "6.0.0" - resolved "https://registry.npmjs.org/memoize-one/-/memoize-one-6.0.0.tgz#b2591b871ed82948aee4727dc6abceeeac8c1045" - integrity sha512-rkpe71W0N0c0Xz6QD0eJETuWAJGnJ9afsl1srmwPrI+yBCkge5EycXXbYRyvL29zZVUWQCY7InPRCv3GDXuZNw== - memory-fs@^0.5.0: version "0.5.0" resolved "https://registry.npmjs.org/memory-fs/-/memory-fs-0.5.0.tgz#324c01288b88652966d161db77838720845a8e3c" @@ -11100,11 +11213,6 @@ moment-mini@2.24.0: resolved "https://registry.npmjs.org/moment-mini/-/moment-mini-2.24.0.tgz#fa68d98f7fe93ae65bf1262f6abb5fb6983d8d18" integrity sha512-9ARkWHBs+6YJIvrIp0Ik5tyTTtP9PoV0Ssu2Ocq5y9v8+NOOpWiRshAp8c4rZVWTOe+157on/5G+zj5pwIQFEQ== -moment@^2.24.0, moment@^2.29.2: - version "2.29.4" - resolved "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz#3dbe052889fe7c1b2ed966fcb3a77328964ef108" - integrity sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w== - move-concurrently@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz#be2c005fda32e0b29af1f05d7c4b33214c701f92" @@ -13113,6 +13221,11 @@ q@^1.1.2, q@^1.5.1: resolved "https://registry.npmjs.org/q/-/q-1.5.1.tgz#7e32f75b41381291d04611f1bf14109ac00651d7" integrity sha512-kV/CThkXo6xyFEZUugw/+pIOywXcDbFYgSct5cT3gqlbkBE1SJdwy6UQoZvodiWF/ckQLZyDE/Bu1M6gVu5lVw== +qrcode.react@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/qrcode.react/-/qrcode.react-3.1.0.tgz#5c91ddc0340f768316fbdb8fff2765134c2aecd8" + integrity sha512-oyF+Urr3oAMUG/OiOuONL3HXM+53wvuH3mtIWQrYmsXoAq0DkvZp2RYUWFSMFtbdOpuS++9v+WAkzNVkMlNW6Q== + qs@^6.9.4: version "6.11.0" resolved "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz#fd0d963446f7a65e1367e01abd85429453f0c37a" @@ -13207,16 +13320,16 @@ rc-align@^4.0.0: rc-util "^5.3.0" resize-observer-polyfill "^1.5.1" -rc-cascader@~3.6.0: - version "3.6.1" - resolved "https://registry.npmjs.org/rc-cascader/-/rc-cascader-3.6.1.tgz#2e94fb3ed770ffd71d87ebcf17a9b44a6442e76f" - integrity sha512-+GmN2Z0IybKT45t0Z94jkjmsOHGxAliobR2tzt05/Gw0AKBYLHX5bdvsVXR7abPnarYyYzZ/cWe8CoFgDjAFNw== +rc-cascader@~3.9.0: + version "3.9.1" + resolved "https://registry.yarnpkg.com/rc-cascader/-/rc-cascader-3.9.1.tgz#86f365016701b921bed1ecb36bbbae62f27cf5f0" + integrity sha512-wMOQrCWobkaQz3zHEFB82RNBLDkL6tDucOf4VSKQ8Z6SiVBqIfqnEHaEiYvL9GMI3/zStVGqwvOFar/xyOm+xw== dependencies: "@babel/runtime" "^7.12.5" array-tree-filter "^2.1.0" classnames "^2.3.1" - rc-select "~14.1.0" - rc-tree "~5.6.3" + rc-select "~14.3.0" + rc-tree "~5.7.0" rc-util "^5.6.1" rc-checkbox@~2.3.0: @@ -13227,33 +13340,34 @@ rc-checkbox@~2.3.0: "@babel/runtime" "^7.10.1" classnames "^2.2.1" -rc-collapse@~3.3.0: - version "3.3.1" - resolved "https://registry.npmjs.org/rc-collapse/-/rc-collapse-3.3.1.tgz#fc66d4c9cfeaf41e932b2de6da2d454874aee55a" - integrity sha512-cOJfcSe3R8vocrF8T+PgaHDrgeA1tX+lwfhwSj60NX9QVRidsILIbRNDLD6nAzmcvVC5PWiIRiR4S1OobxdhCg== +rc-collapse@~3.5.2: + version "3.5.2" + resolved "https://registry.yarnpkg.com/rc-collapse/-/rc-collapse-3.5.2.tgz#abb7d144ad55bd9cbd201fa95bc5b271da2aa7c3" + integrity sha512-/TNiT3DW1t3sUCiVD/DPUYooJZ3BLA93/2rZsB3eM2bGJCCla2X9D2E4tgm7LGMQGy5Atb2lMUn2FQuvQNvavQ== dependencies: "@babel/runtime" "^7.10.1" classnames "2.x" rc-motion "^2.3.4" - rc-util "^5.2.1" - shallowequal "^1.1.0" + rc-util "^5.27.0" -rc-dialog@~8.9.0: - version "8.9.0" - resolved "https://registry.npmjs.org/rc-dialog/-/rc-dialog-8.9.0.tgz#04dc39522f0321ed2e06018d4a7e02a4c32bd3ea" - integrity sha512-Cp0tbJnrvPchJfnwIvOMWmJ4yjX3HWFatO6oBFD1jx8QkgsQCR0p8nUWAKdd3seLJhEC39/v56kZaEjwp9muoQ== +rc-dialog@~9.0.0, rc-dialog@~9.0.2: + version "9.0.2" + resolved "https://registry.yarnpkg.com/rc-dialog/-/rc-dialog-9.0.2.tgz#aadfebdeba145f256c1fac9b9f509f893cdbb5b8" + integrity sha512-s3U+24xWUuB6Bn2Lk/Qt6rufy+uT+QvWkiFhNBcO9APLxcFFczWamaq7x9h8SCuhfc1nHcW4y8NbMsnAjNnWyg== dependencies: "@babel/runtime" "^7.10.1" + "@rc-component/portal" "^1.0.0-8" classnames "^2.2.6" rc-motion "^2.3.0" rc-util "^5.21.0" -rc-drawer@~5.1.0-alpha.1: - version "5.1.0-alpha.2" - resolved "https://registry.npmjs.org/rc-drawer/-/rc-drawer-5.1.0-alpha.2.tgz#402b37d65f43dd9e3dd2fba3ace2c88aba979fd3" - integrity sha512-tDT2WG9j4zLUL1kw7BJ1u+cCDypqgonwVO3OwIzksyqeqeLKWRJCwRSxwLYDsuVeCoXFndCGZ7qmRUG83z6mOQ== +rc-drawer@~6.1.1: + version "6.1.5" + resolved "https://registry.yarnpkg.com/rc-drawer/-/rc-drawer-6.1.5.tgz#c4137b944c16b7c179d0dba6f06ebe54f9311ec8" + integrity sha512-MDRomQXFi+tvDuwsRAddJ2Oy2ayLCZ29weMzp3rJFO9UNEVLEVV7nuyx5lEgNJIdM//tE6wWQV95cTUiMVqD6w== dependencies: "@babel/runtime" "^7.10.1" + "@rc-component/portal" "^1.0.0-6" classnames "^2.2.6" rc-motion "^2.6.1" rc-util "^5.21.2" @@ -13268,53 +13382,66 @@ rc-dropdown@~4.0.0: rc-trigger "^5.3.1" rc-util "^5.17.0" -rc-field-form@~1.27.0: - version "1.27.1" - resolved "https://registry.npmjs.org/rc-field-form/-/rc-field-form-1.27.1.tgz#11d61ccb43679e71fdbbff0d821326202554df84" - integrity sha512-RShegnwFu6TH8tl2olCxn+B4Wyh5EiQH8c/7wucbkLNyue05YiH5gomUAg1vbZjp71yFKwegClctsEG5CNBWAA== +rc-field-form@~1.28.0: + version "1.28.0" + resolved "https://registry.yarnpkg.com/rc-field-form/-/rc-field-form-1.28.0.tgz#e92be960b0cd73a0c39bd103e55aae414df946c5" + integrity sha512-k7VfxFiQQkaJV7G5TMfZfeN905WGwd6CQXsblH+s8g9wcOn7gIacjl2N7Xr4EPDFR4dAECtxcbd0guwIT01vjw== dependencies: "@babel/runtime" "^7.18.0" async-validator "^4.1.0" rc-util "^5.8.0" -rc-image@~5.7.0: - version "5.7.0" - resolved "https://registry.npmjs.org/rc-image/-/rc-image-5.7.0.tgz#e1a3b21099feb3fb9bf8ef3ce12c3fc11a8c1148" - integrity sha512-v6dzSgYfYrH4liKmOZKZZO+x21sJ9KPXNinBfkAoQg2Ihcd5QZ+P/JjB7v60X981XTPGjegy8U17Z8VUX4V36g== +rc-image@~5.15.2: + version "5.15.2" + resolved "https://registry.yarnpkg.com/rc-image/-/rc-image-5.15.2.tgz#5af0270aca7474476866fae6b047fb3a0461ed28" + integrity sha512-QaeWP20v51eGyrkl24PyusTmbMk42A3vGPl7hEa15jcQjECOX36tLtvLk5sjl3vaLQpMskB8BbwiqPsN7I7aow== dependencies: "@babel/runtime" "^7.11.2" + "@rc-component/portal" "^1.0.2" classnames "^2.2.6" - rc-dialog "~8.9.0" + rc-dialog "~9.0.0" + rc-motion "^2.6.2" rc-util "^5.0.6" -rc-input-number@~7.3.5: - version "7.3.6" - resolved "https://registry.npmjs.org/rc-input-number/-/rc-input-number-7.3.6.tgz#54d66bd3fdaef0abfded4c734a12ac6d9461ebab" - integrity sha512-Se62oMOBn9HwF/gSag+YtAYyKZsjJzEsqmyAJHAnAvPfjZJOu7dLMlQRwBbTtELbKXM/Y5Fztcq8CW2Y9f49qA== +rc-input-number@~7.4.0: + version "7.4.2" + resolved "https://registry.yarnpkg.com/rc-input-number/-/rc-input-number-7.4.2.tgz#7c52d26b986461aa16e486d469dc0476d97c6ea3" + integrity sha512-yGturTw7WGP+M1GbJ+UTAO7L4buxeW6oilhL9Sq3DezsRS8/9qec4UiXUbeoiX9bzvRXH11JvgskBtxSp4YSNg== dependencies: "@babel/runtime" "^7.10.1" + "@rc-component/mini-decimal" "^1.0.1" classnames "^2.2.5" - rc-util "^5.23.0" + rc-util "^5.28.0" -rc-input@~0.0.1-alpha.5: - version "0.0.1-alpha.7" - resolved "https://registry.npmjs.org/rc-input/-/rc-input-0.0.1-alpha.7.tgz#53e3f13871275c21d92b51f80b698f389ad45dd3" - integrity sha512-eozaqpCYWSY5LBMwlHgC01GArkVEP+XlJ84OMvdkwUnJBSv83Yxa15pZpn7vACAj84uDC4xOA2CoFdbLuqB08Q== +rc-input@^0.2.1, rc-input@^0.2.2, rc-input@~0.2.1: + version "0.2.2" + resolved "https://registry.yarnpkg.com/rc-input/-/rc-input-0.2.2.tgz#de1c3c0e090d15777a6b1a3fd4a9566e25b3fbee" + integrity sha512-xgkVcFgtRO0Hl9hmvslZhObNyxbSpTmy3nR1Tk4XrjjZ9lFJ7GcJBy6ss30Pdb0oX36cHzLN8I7VCjBGeRNB9A== dependencies: "@babel/runtime" "^7.11.1" classnames "^2.2.1" rc-util "^5.18.1" -rc-mentions@~1.9.0: - version "1.9.0" - resolved "https://registry.npmjs.org/rc-mentions/-/rc-mentions-1.9.0.tgz#0ddff6ab442dce58efa7b9f5ae561b0051173334" - integrity sha512-CSC2t8WxK8daS8lylJcquzCgKz4bXLAVNrSHXlTI8fNUy4toot8Sv79wT4fcP/bYgdt07/e3RXzkZfX6xjYYow== +rc-input@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/rc-input/-/rc-input-1.0.0.tgz#e1dfcceca4e67bf08e7fa176defa374177217de9" + integrity sha512-CK7uoCr+O75PkDDI1aqk4ZoVhO3fzVQ3d5VNGe4hFeTOsfe9nfpqOiYmT2V/KeObMTXJlNeq3L1KK6urjju83w== + dependencies: + "@babel/runtime" "^7.11.1" + classnames "^2.2.1" + rc-util "^5.18.1" + +rc-mentions@~2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/rc-mentions/-/rc-mentions-2.1.0.tgz#310f26411164f4c0a8f22913ca373a554a9910f2" + integrity sha512-yXfq/CcEbrbcVcbhjRSzVNjITfMwCO6KspmLIviAsxxMDHT/VYy9F0EgWNEuwUrDqJkN7c0foVJngR2dBvhMPw== dependencies: "@babel/runtime" "^7.10.1" + "@rc-component/trigger" "^1.5.0" classnames "^2.2.6" - rc-menu "~9.6.0" - rc-textarea "^0.3.0" - rc-trigger "^5.0.4" + rc-input "^0.2.2" + rc-menu "~9.8.0" + rc-textarea "^1.0.0" rc-util "^5.22.5" rc-menu@~9.6.0: @@ -13330,7 +13457,19 @@ rc-menu@~9.6.0: rc-util "^5.12.0" shallowequal "^1.1.0" -rc-motion@^2.0.0, rc-motion@^2.0.1, rc-motion@^2.2.0, rc-motion@^2.3.0, rc-motion@^2.3.4, rc-motion@^2.4.1, rc-motion@^2.4.3, rc-motion@^2.4.4, rc-motion@^2.6.1: +rc-menu@~9.8.0, rc-menu@~9.8.2: + version "9.8.2" + resolved "https://registry.yarnpkg.com/rc-menu/-/rc-menu-9.8.2.tgz#179df4ea0fc46fffb7a21e18d3cddb901ce35986" + integrity sha512-EahOJVjLuEnJsThoPN+mGnVm431RzVzDLZWHRS/YnXTQULa7OsgdJa/Y7qXxc3Z5sz8mgT6xYtgpmBXLxrZFaQ== + dependencies: + "@babel/runtime" "^7.10.1" + classnames "2.x" + rc-motion "^2.4.3" + rc-overflow "^1.2.8" + rc-trigger "^5.1.2" + rc-util "^5.27.0" + +rc-motion@^2.0.0, rc-motion@^2.0.1, rc-motion@^2.3.0, rc-motion@^2.3.4, rc-motion@^2.4.1, rc-motion@^2.4.3, rc-motion@^2.4.4, rc-motion@^2.6.1: version "2.6.2" resolved "https://registry.npmjs.org/rc-motion/-/rc-motion-2.6.2.tgz#3d31f97e41fb8e4f91a4a4189b6a98ac63342869" integrity sha512-4w1FaX3dtV749P8GwfS4fYnFG4Rb9pxvCYPc/b2fw1cmlHJWNNgOFIz7ysiD+eOrzJSvnLJWlNQQncpNMXwwpg== @@ -13339,14 +13478,23 @@ rc-motion@^2.0.0, rc-motion@^2.0.1, rc-motion@^2.2.0, rc-motion@^2.3.0, rc-motio classnames "^2.2.1" rc-util "^5.21.0" -rc-notification@~4.6.0: - version "4.6.0" - resolved "https://registry.npmjs.org/rc-notification/-/rc-notification-4.6.0.tgz#4e76fc2d0568f03cc93ac18c9e20763ebe29fa46" - integrity sha512-xF3MKgIoynzjQAO4lqsoraiFo3UXNYlBfpHs0VWvwF+4pimen9/H1DYLN2mfRWhHovW6gRpla73m2nmyIqAMZQ== +rc-motion@^2.6.0, rc-motion@^2.6.2: + version "2.6.3" + resolved "https://registry.yarnpkg.com/rc-motion/-/rc-motion-2.6.3.tgz#e6d8ca06591c2c1bcd3391a8e7a822ebc4d94e9c" + integrity sha512-xFLkes3/7VL/J+ah9jJruEW/Akbx5F6jVa2wG5o/ApGKQKSOd5FR3rseHLL9+xtJg4PmCwo6/1tqhDO/T+jFHA== + dependencies: + "@babel/runtime" "^7.11.1" + classnames "^2.2.1" + rc-util "^5.21.0" + +rc-notification@~5.0.0: + version "5.0.3" + resolved "https://registry.yarnpkg.com/rc-notification/-/rc-notification-5.0.3.tgz#2566d4a6b2334c171bad0cb9a8b80cb1a24b29e6" + integrity sha512-+wHbHu6RiTNtsZYx42WxWA+tC5m0qyKvJAauO4/6LIEyJspK8fRlFQz+OCFgFwGuNs3cOdo9tLs+cPfztSZwbQ== dependencies: "@babel/runtime" "^7.10.1" classnames "2.x" - rc-motion "^2.2.0" + rc-motion "^2.6.0" rc-util "^5.20.1" rc-overflow@^1.0.0, rc-overflow@^1.2.0: @@ -13359,41 +13507,47 @@ rc-overflow@^1.0.0, rc-overflow@^1.2.0: rc-resize-observer "^1.0.0" rc-util "^5.19.2" -rc-pagination@~3.1.17: - version "3.1.17" - resolved "https://registry.npmjs.org/rc-pagination/-/rc-pagination-3.1.17.tgz#91e690aa894806e344cea88ea4a16d244194a1bd" - integrity sha512-/BQ5UxcBnW28vFAcP2hfh+Xg15W0QZn8TWYwdCApchMH1H0CxiaUUcULP8uXcFM1TygcdKWdt3JqsL9cTAfdkQ== +rc-overflow@^1.2.8: + version "1.3.0" + resolved "https://registry.yarnpkg.com/rc-overflow/-/rc-overflow-1.3.0.tgz#964f7db14aab611c3047788d3b8ee472732fee09" + integrity sha512-p2Qt4SWPTHAYl4oAao1THy669Fm5q8pYBDBHRaFOekCvcdcrgIx0ByXQMEkyPm8wUDX4BK6aARWecvCRc/7CTA== + dependencies: + "@babel/runtime" "^7.11.1" + classnames "^2.2.1" + rc-resize-observer "^1.0.0" + rc-util "^5.19.2" + +rc-pagination@~3.3.0: + version "3.3.1" + resolved "https://registry.yarnpkg.com/rc-pagination/-/rc-pagination-3.3.1.tgz#38e364674adf2a753a4fa26e0d9d88ebe523ed0f" + integrity sha512-eI4dSeB3OrFxll7KzWa3ZH63LV2tHxt0AUmZmDwuI6vc3CK5lZhaKUYq0fRowb5586hN+L26j5WZoSz9cwEfjg== dependencies: "@babel/runtime" "^7.10.1" classnames "^2.2.1" -rc-picker@~2.6.10: - version "2.6.10" - resolved "https://registry.npmjs.org/rc-picker/-/rc-picker-2.6.10.tgz#8d0a473c079388bdb2d7358a2a54c7d5095893b4" - integrity sha512-9wYtw0DFWs9FO92Qh2D76P0iojUr8ZhLOtScUeOit6ks/F+TBLrOC1uze3IOu+u9gbDAjmosNWLKbBzx/Yuv2w== +rc-picker@~3.3.1: + version "3.3.4" + resolved "https://registry.yarnpkg.com/rc-picker/-/rc-picker-3.3.4.tgz#f9f2e9879fe4a638963f0ca213a4ca4c02705436" + integrity sha512-y7muUVAXqcacXXgLERCC9klEClZybOjWrcVZ54glxO5y+UO2MZmBk+ysWhhVHQ0l2nNtY+wj19gk1xnv+5eCxg== dependencies: "@babel/runtime" "^7.10.1" + "@rc-component/trigger" "^1.5.0" classnames "^2.2.1" - date-fns "2.x" - dayjs "1.x" - moment "^2.24.0" - rc-trigger "^5.0.4" - rc-util "^5.4.0" - shallowequal "^1.1.0" + rc-util "^5.27.0" -rc-progress@~3.3.2: - version "3.3.3" - resolved "https://registry.npmjs.org/rc-progress/-/rc-progress-3.3.3.tgz#eb9bffbacab1534f2542f9f6861ce772254362b1" - integrity sha512-MDVNVHzGanYtRy2KKraEaWeZLri2ZHWIRyaE1a9MQ2MuJ09m+Wxj5cfcaoaR6z5iRpHpA59YeUxAlpML8N4PJw== +rc-progress@~3.4.1: + version "3.4.1" + resolved "https://registry.yarnpkg.com/rc-progress/-/rc-progress-3.4.1.tgz#a9ffe099e88a4fc03afb09d8603162bf0760d743" + integrity sha512-eAFDHXlk8aWpoXl0llrenPMt9qKHQXphxcVsnKs0FHC6eCSk1ebJtyaVjJUzKe0233ogiLDeEFK1Uihz3s67hw== dependencies: "@babel/runtime" "^7.10.1" classnames "^2.2.6" rc-util "^5.16.1" -rc-rate@~2.9.0: - version "2.9.2" - resolved "https://registry.npmjs.org/rc-rate/-/rc-rate-2.9.2.tgz#4a58965d1ecf91896ebae01d458b59056df0b4ea" - integrity sha512-SaiZFyN8pe0Fgphv8t3+kidlej+cq/EALkAJAc3A0w0XcPaH2L1aggM8bhe1u6GAGuQNAoFvTLjw4qLPGRKV5g== +rc-rate@~2.10.0: + version "2.10.0" + resolved "https://registry.yarnpkg.com/rc-rate/-/rc-rate-2.10.0.tgz#b16fd906c13bfc26b4776e27a14d13d06d50c635" + integrity sha512-TCjEpKPeN1m0EnGDDbb1KyxjNTJRzoReiPdtbrBJEey4Ryf/UGOQ6vqmz2yC6DJdYVDVUoZPdoz043ryh0t/nQ== dependencies: "@babel/runtime" "^7.10.1" classnames "^2.2.5" @@ -13409,69 +13563,78 @@ rc-resize-observer@^1.0.0, rc-resize-observer@^1.1.0, rc-resize-observer@^1.2.0: rc-util "^5.15.0" resize-observer-polyfill "^1.5.1" -rc-segmented@~2.1.0: - version "2.1.0" - resolved "https://registry.npmjs.org/rc-segmented/-/rc-segmented-2.1.0.tgz#0e0afe646c1a0e44a0e18785f518c42633ec8efc" - integrity sha512-hUlonro+pYoZcwrH6Vm56B2ftLfQh046hrwif/VwLIw1j3zGt52p5mREBwmeVzXnSwgnagpOpfafspzs1asjGw== +rc-resize-observer@^1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/rc-resize-observer/-/rc-resize-observer-1.3.1.tgz#b61b9f27048001243617b81f95e53d7d7d7a6a3d" + integrity sha512-iFUdt3NNhflbY3mwySv5CA1TC06zdJ+pfo0oc27xpf4PIOvfZwZGtD9Kz41wGYqC4SLio93RVAirSSpYlV/uYg== + dependencies: + "@babel/runtime" "^7.20.7" + classnames "^2.2.1" + rc-util "^5.27.0" + resize-observer-polyfill "^1.5.1" + +rc-segmented@~2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/rc-segmented/-/rc-segmented-2.1.2.tgz#14c9077a1dae9c2ccb2ef5fbc5662c1c48c7ce8e" + integrity sha512-qGo1bCr83ESXpXVOCXjFe1QJlCAQXyi9KCiy8eX3rIMYlTeJr/ftySIaTnYsitL18SvWf5ZEHsfqIWoX0EMfFQ== dependencies: "@babel/runtime" "^7.11.1" classnames "^2.2.1" rc-motion "^2.4.4" rc-util "^5.17.0" -rc-select@~14.1.0, rc-select@~14.1.1: - version "14.1.9" - resolved "https://registry.npmjs.org/rc-select/-/rc-select-14.1.9.tgz#9c9eceff00920ad8a0a53b77b76afc177ffe5ab4" - integrity sha512-DK01+Q7oCWr5jVPiEp/BTQ8xCB4rI4LfXzZtSmBWJhOMuibyZD1Vlz/DlVKCUFmtBM4SzG4/SltGHoGlcbCqiw== +rc-select@~14.3.0: + version "14.3.0" + resolved "https://registry.yarnpkg.com/rc-select/-/rc-select-14.3.0.tgz#6efd69665f42b2f08e6db2744eea4c27e254989b" + integrity sha512-y+TeAKvAvfAS7WXn4nFU8xtWJ1kLC7SVBvX3UQYtfU+N3BYNpNzHw/3F1Gu34rN2YWTG4hwspwFvDuRtGXytlQ== dependencies: "@babel/runtime" "^7.10.1" + "@rc-component/trigger" "^1.4.0" classnames "2.x" rc-motion "^2.0.1" rc-overflow "^1.0.0" - rc-trigger "^5.0.4" rc-util "^5.16.1" - rc-virtual-list "^3.2.0" + rc-virtual-list "^3.4.13" -rc-slider@~10.0.0: - version "10.0.1" - resolved "https://registry.npmjs.org/rc-slider/-/rc-slider-10.0.1.tgz#7058c68ff1e1aa4e7c3536e5e10128bdbccb87f9" - integrity sha512-igTKF3zBet7oS/3yNiIlmU8KnZ45npmrmHlUUio8PNbIhzMcsh+oE/r2UD42Y6YD2D/s+kzCQkzQrPD6RY435Q== +rc-slider@~10.1.0: + version "10.1.1" + resolved "https://registry.yarnpkg.com/rc-slider/-/rc-slider-10.1.1.tgz#5e82036e60b61021aba3ea0e353744dd7c74e104" + integrity sha512-gn8oXazZISEhnmRinI89Z/JD/joAaM35jp+gDtIVSTD/JJMCCBqThqLk1SVJmvtfeiEF/kKaFY0+qt4SDHFUDw== dependencies: "@babel/runtime" "^7.10.1" classnames "^2.2.5" - rc-util "^5.18.1" - shallowequal "^1.1.0" + rc-util "^5.27.0" -rc-steps@~4.1.0: - version "4.1.4" - resolved "https://registry.npmjs.org/rc-steps/-/rc-steps-4.1.4.tgz#0ba82db202d59ca52d0693dc9880dd145b19dc23" - integrity sha512-qoCqKZWSpkh/b03ASGx1WhpKnuZcRWmvuW+ZUu4mvMdfvFzVxblTwUM+9aBd0mlEUFmt6GW8FXhMpHkK3Uzp3w== +rc-steps@~6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/rc-steps/-/rc-steps-6.0.0.tgz#f7148f8097d5d135f19b96c1b4f4b50ad6093753" + integrity sha512-+KfMZIty40mYCQSDvYbZ1jwnuObLauTiIskT1hL4FFOBHP6ZOr8LK0m143yD3kEN5XKHSEX1DIwCj3AYZpoeNQ== dependencies: - "@babel/runtime" "^7.10.2" + "@babel/runtime" "^7.16.7" classnames "^2.2.3" - rc-util "^5.0.1" + rc-util "^5.16.1" -rc-switch@~3.2.0: - version "3.2.2" - resolved "https://registry.npmjs.org/rc-switch/-/rc-switch-3.2.2.tgz#d001f77f12664d52595b4f6fb425dd9e66fba8e8" - integrity sha512-+gUJClsZZzvAHGy1vZfnwySxj+MjLlGRyXKXScrtCTcmiYNPzxDFOxdQ/3pK1Kt/0POvwJ/6ALOR8gwdXGhs+A== +rc-switch@~4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/rc-switch/-/rc-switch-4.0.0.tgz#55fbf99fc2d680791175037d379e170ba51fbe78" + integrity sha512-IfrYC99vN0gKaTyjQdqYuADU0eH00SAFHg3jOp8HrmUpJruhV1SohJzrCbPqPraZeX/6X/QKkdLfkdnUub05WA== dependencies: "@babel/runtime" "^7.10.1" classnames "^2.2.1" rc-util "^5.0.1" -rc-table@~7.25.3: - version "7.25.3" - resolved "https://registry.npmjs.org/rc-table/-/rc-table-7.25.3.tgz#a2941d4fde4c181e687e97a294faca8e4122e26d" - integrity sha512-McsLJ2rg8EEpRBRYN4Pf9gT7ZNYnjvF9zrBpUBBbUX/fxk+eGi5ff1iPIhMyiHsH71/BmTUzX9nc9XqupD0nMg== +rc-table@~7.31.0: + version "7.31.1" + resolved "https://registry.yarnpkg.com/rc-table/-/rc-table-7.31.1.tgz#85487b25d98559d6e684b3348e893da1d1f48232" + integrity sha512-KZPi35aGpv2VaL1Jbc58FBJo063HtKyVjhOFWX4AkBV7tjHHQokMdUoua5E+GPJh6QZUpK/a8PjKa9IZzPLIEA== dependencies: "@babel/runtime" "^7.10.1" + "@rc-component/context" "^1.3.0" classnames "^2.2.5" rc-resize-observer "^1.1.0" - rc-util "^5.22.5" - shallowequal "^1.1.0" + rc-util "^5.27.1" -rc-tabs@^11.7.1, rc-tabs@~11.16.0: +rc-tabs@^11.7.1: version "11.16.1" resolved "https://registry.npmjs.org/rc-tabs/-/rc-tabs-11.16.1.tgz#7c57b6a092d9d0e2df54413b0319f195c27214a9" integrity sha512-bR7Dap23YyfzZQwtKomhiFEFzZuE7WaKWo+ypNRSGB9PDKSc6tM12VP8LWYkvmmQHthgwP0WRN8nFbSJWuqLYw== @@ -13483,38 +13646,62 @@ rc-tabs@^11.7.1, rc-tabs@~11.16.0: rc-resize-observer "^1.0.0" rc-util "^5.5.0" -rc-textarea@^0.3.0, rc-textarea@~0.3.0: - version "0.3.7" - resolved "https://registry.npmjs.org/rc-textarea/-/rc-textarea-0.3.7.tgz#987142891efdedb774883c07e2f51b318fde5a11" - integrity sha512-yCdZ6binKmAQB13hc/oehh0E/QRwoPP1pjF21aHBxlgXO3RzPF6dUu4LG2R4FZ1zx/fQd2L1faktulrXOM/2rw== +rc-tabs@~12.5.6: + version "12.5.10" + resolved "https://registry.yarnpkg.com/rc-tabs/-/rc-tabs-12.5.10.tgz#0e41c723fac66c4f0bcad3271429fff6653b0721" + integrity sha512-Ay0l0jtd4eXepFH9vWBvinBjqOpqzcsJTerBGwJy435P2S90Uu38q8U/mvc1sxUEVOXX5ZCFbxcWPnfG3dH+tQ== + dependencies: + "@babel/runtime" "^7.11.2" + classnames "2.x" + rc-dropdown "~4.0.0" + rc-menu "~9.8.0" + rc-motion "^2.6.2" + rc-resize-observer "^1.0.0" + rc-util "^5.16.0" + +rc-textarea@^1.0.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/rc-textarea/-/rc-textarea-1.2.0.tgz#bb260e56ade7a6b181d9a268006446bc8b96a7a4" + integrity sha512-Ols7s5HYzOhgw11nuXfUOyDgXHmucPaXQVTbQDFJicXGccIRNO1XSF/52hGPSj57TfUgPn+2qOLWaCNFYsAUsg== dependencies: "@babel/runtime" "^7.10.1" classnames "^2.2.1" + rc-input "~1.0.0" rc-resize-observer "^1.0.0" - rc-util "^5.7.0" - shallowequal "^1.1.0" + rc-util "^5.27.0" -rc-tooltip@~5.2.0: - version "5.2.2" - resolved "https://registry.npmjs.org/rc-tooltip/-/rc-tooltip-5.2.2.tgz#e5cafa8ecebf78108936a0bcb93c150fa81ac93b" - integrity sha512-jtQzU/18S6EI3lhSGoDYhPqNpWajMtS5VV/ld1LwyfrDByQpYmw/LW6U7oFXXLukjfDHQ7Ju705A82PRNFWYhg== +rc-textarea@~1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/rc-textarea/-/rc-textarea-1.1.0.tgz#06882b0899e92fba694c8ee926cb2a8eeb25140b" + integrity sha512-NNYSrnCfVunH/ffGak33FDrQSwAljrqnKVYruBrDD8JcKmQFiPsW6v0HzouvqhcJX6hTqLFOci4tZMkmsJdwdw== + dependencies: + "@babel/runtime" "^7.10.1" + classnames "^2.2.1" + rc-input "^0.2.1" + rc-resize-observer "^1.0.0" + rc-util "^5.27.0" + +rc-tooltip@~6.0.0: + version "6.0.1" + resolved "https://registry.yarnpkg.com/rc-tooltip/-/rc-tooltip-6.0.1.tgz#6a5e33bd6c3f6afe8851ea90e7af43e5c26b3cc6" + integrity sha512-MdvPlsD1fDSxKp9+HjXrc/CxLmA/s11QYIh1R7aExxfodKP7CZA++DG1AjrW80F8IUdHYcR43HAm0Y2BYPelHA== dependencies: "@babel/runtime" "^7.11.2" + "@rc-component/trigger" "^1.0.4" classnames "^2.3.1" - rc-trigger "^5.0.0" -rc-tree-select@~5.4.0: - version "5.4.0" - resolved "https://registry.npmjs.org/rc-tree-select/-/rc-tree-select-5.4.0.tgz#c94b961aca68689f5ee3a43e33881cf693d195ef" - integrity sha512-reRbOqC7Ic/nQocJAJeCl4n6nJUY3NoqiwRXKvhjgZJU7NGr9vIccXEsY+Lghkw5UMpPoxGsIJB0jiAvM18XYA== +rc-tree-select@~5.7.0: + version "5.7.0" + resolved "https://registry.yarnpkg.com/rc-tree-select/-/rc-tree-select-5.7.0.tgz#e230659f3568ec57a1f6c727d043ee38a78d5eb3" + integrity sha512-YGMpBFK9qBkgng2ZhOw7yFiL9VnjHij+uNvP+tiU/QZGdf2XcO8LHXQNUZRGAEzx4PT5lUs6d7kIfkQ9a74bqg== dependencies: "@babel/runtime" "^7.10.1" classnames "2.x" - rc-select "~14.1.0" - rc-tree "~5.6.1" + rc-select "~14.3.0" + rc-tree "~5.7.0" rc-util "^5.16.1" -rc-tree@^5.2.0, rc-tree@~5.6.1, rc-tree@~5.6.3, rc-tree@~5.6.5: +rc-tree@^5.2.0: version "5.6.6" resolved "https://registry.npmjs.org/rc-tree/-/rc-tree-5.6.6.tgz#c04253d8f8345ec52fc196dec2be06c7e708125b" integrity sha512-HI/q4D4AHOp48OZcBUvJFWkI5OfnZivvGYI0xzI0dy0Mita2KcTGZv7/Yl6Aq3bL3od3x5AqAXq/7qxR3x4Kkg== @@ -13525,7 +13712,18 @@ rc-tree@^5.2.0, rc-tree@~5.6.1, rc-tree@~5.6.3, rc-tree@~5.6.5: rc-util "^5.16.1" rc-virtual-list "^3.4.8" -rc-trigger@^5.0.0, rc-trigger@^5.0.4, rc-trigger@^5.1.2, rc-trigger@^5.2.10, rc-trigger@^5.3.1: +rc-tree@~5.7.0: + version "5.7.3" + resolved "https://registry.yarnpkg.com/rc-tree/-/rc-tree-5.7.3.tgz#5da576ba87039486d59092eb4490831690b8b3b5" + integrity sha512-Oql2S9+ZmT+mfTp5SNo1XM0QvkENjc0mPRFsHWRFSPuKird0OYMZZKmLznUJ+0aGDeFFWN42wiUZJtMFhrLgLw== + dependencies: + "@babel/runtime" "^7.10.1" + classnames "2.x" + rc-motion "^2.0.1" + rc-util "^5.16.1" + rc-virtual-list "^3.4.8" + +rc-trigger@^5.1.2, rc-trigger@^5.3.1: version "5.3.1" resolved "https://registry.npmjs.org/rc-trigger/-/rc-trigger-5.3.1.tgz#acafadf3eaf384e7f466c303bfa0f34c8137d7b8" integrity sha512-5gaFbDkYSefZ14j2AdzucXzlWgU2ri5uEjkHvsf1ynRhdJbKxNOnw4PBZ9+FVULNGFiDzzlVF8RJnR9P/xrnKQ== @@ -13536,6 +13734,17 @@ rc-trigger@^5.0.0, rc-trigger@^5.0.4, rc-trigger@^5.1.2, rc-trigger@^5.2.10, rc- rc-motion "^2.0.0" rc-util "^5.19.2" +rc-trigger@^5.3.4: + version "5.3.4" + resolved "https://registry.yarnpkg.com/rc-trigger/-/rc-trigger-5.3.4.tgz#6b4b26e32825677c837d1eb4d7085035eecf9a61" + integrity sha512-mQv+vas0TwKcjAO2izNPkqR4j86OemLRmvL2nOzdP9OWNWA1ivoTt5hzFqYNW9zACwmTezRiN8bttrC7cZzYSw== + dependencies: + "@babel/runtime" "^7.18.3" + classnames "^2.2.6" + rc-align "^4.0.0" + rc-motion "^2.0.0" + rc-util "^5.19.2" + rc-upload@~4.3.0: version "4.3.4" resolved "https://registry.npmjs.org/rc-upload/-/rc-upload-4.3.4.tgz#83ff7d3867631c37adbfd72ea3d1fd7e97ca84af" @@ -13545,7 +13754,7 @@ rc-upload@~4.3.0: classnames "^2.2.5" rc-util "^5.2.0" -rc-util@^5.0.1, rc-util@^5.0.6, rc-util@^5.12.0, rc-util@^5.15.0, rc-util@^5.16.1, rc-util@^5.17.0, rc-util@^5.18.1, rc-util@^5.19.2, rc-util@^5.2.0, rc-util@^5.2.1, rc-util@^5.20.1, rc-util@^5.21.0, rc-util@^5.21.2, rc-util@^5.22.5, rc-util@^5.23.0, rc-util@^5.3.0, rc-util@^5.4.0, rc-util@^5.5.0, rc-util@^5.6.1, rc-util@^5.7.0, rc-util@^5.8.0, rc-util@^5.9.4: +rc-util@^5.0.1, rc-util@^5.0.6, rc-util@^5.12.0, rc-util@^5.15.0, rc-util@^5.16.1, rc-util@^5.17.0, rc-util@^5.18.1, rc-util@^5.19.2, rc-util@^5.2.0, rc-util@^5.20.1, rc-util@^5.21.0, rc-util@^5.21.2, rc-util@^5.22.5, rc-util@^5.3.0, rc-util@^5.5.0, rc-util@^5.6.1, rc-util@^5.8.0, rc-util@^5.9.4: version "5.23.0" resolved "https://registry.npmjs.org/rc-util/-/rc-util-5.23.0.tgz#a583b1ec3e1832a80eced7a700a494af0b590743" integrity sha512-lgm6diJ/pLgyfoZY59Vz7sW4mSoQCgozqbBye9IJ7/mb5w5h4T7h+i2JpXAx/UBQxscBZe68q0sP7EW+qfkKUg== @@ -13554,7 +13763,25 @@ rc-util@^5.0.1, rc-util@^5.0.6, rc-util@^5.12.0, rc-util@^5.15.0, rc-util@^5.16. react-is "^16.12.0" shallowequal "^1.1.0" -rc-virtual-list@^3.2.0, rc-virtual-list@^3.4.8: +rc-util@^5.16.0, rc-util@^5.24.4, rc-util@^5.27.0, rc-util@^5.27.1, rc-util@^5.28.0, rc-util@^5.29.2: + version "5.29.2" + resolved "https://registry.yarnpkg.com/rc-util/-/rc-util-5.29.2.tgz#a3741fca57b3dce78f315574ed099945f367b222" + integrity sha512-xHT9Dr3RD6tyvCibnH10l3mudC6TJjWNr9UDy3CrOGZqTY354OfdwP87ahKNe0b3A1dsysDldvx0SBuswhlOeA== + dependencies: + "@babel/runtime" "^7.18.3" + react-is "^16.12.0" + +rc-virtual-list@^3.4.13: + version "3.4.13" + resolved "https://registry.yarnpkg.com/rc-virtual-list/-/rc-virtual-list-3.4.13.tgz#20acc934b263abcf7b7c161f50ef82281b2f7e8d" + integrity sha512-cPOVDmcNM7rH6ANotanMDilW/55XnFPw0Jh/GQYtrzZSy3AmWvCnqVNyNC/pgg3lfVmX2994dlzAhuUrd4jG7w== + dependencies: + "@babel/runtime" "^7.20.0" + classnames "^2.2.6" + rc-resize-observer "^1.0.0" + rc-util "^5.15.0" + +rc-virtual-list@^3.4.8: version "3.4.8" resolved "https://registry.npmjs.org/rc-virtual-list/-/rc-virtual-list-3.4.8.tgz#c24c10c6940546b7e2a5e9809402c6716adfd26c" integrity sha512-qSN+Rv4i/E7RCTvTMr1uZo7f3crJJg/5DekoCagydo9zsXrxj07zsFSxqizqW+ldGA16lwa8So/bIbV9Ofjddg== @@ -13903,6 +14130,11 @@ regenerator-runtime@0.13.5: resolved "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.5.tgz#d878a1d094b4306d10b9096484b33ebd55e26697" integrity sha512-ZS5w8CpKFinUzOwW3c83oPeVXoNsrLsaCoLtJvAClH135j/R77RuymhiSErhm2lKcwSCIpmvIWSbDkIfAqKQlA== +regenerator-runtime@^0.13.11: + version "0.13.11" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz#f6dca3e7ceec20590d07ada785636a90cdca17f9" + integrity sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg== + regenerator-runtime@^0.13.4, regenerator-runtime@^0.13.7: version "0.13.9" resolved "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz#8925742a98ffd90814988d7566ad30ca3b263b52" @@ -14544,6 +14776,13 @@ scroll-into-view-if-needed@^2.2.25: dependencies: compute-scroll-into-view "^1.0.17" +scroll-into-view-if-needed@^3.0.3: + version "3.0.6" + resolved "https://registry.yarnpkg.com/scroll-into-view-if-needed/-/scroll-into-view-if-needed-3.0.6.tgz#2c803a509c1036bc4a9c009fecc5c145f87e47cf" + integrity sha512-x+CW0kOzlFNOnseF0DBr0AJ5m+TgGmSOdEZwyiZW0gV87XBvxQKw5A8DvFFgabznA68XqLgVX+PwPX8OzsFvRA== + dependencies: + compute-scroll-into-view "^3.0.0" + select@^1.1.2: version "1.1.2" resolved "https://registry.npmjs.org/select/-/select-1.1.2.tgz#0e7350acdec80b1108528786ec1d4418d11b396d" @@ -15322,6 +15561,11 @@ stylis@^4.0.10: resolved "https://registry.npmjs.org/stylis/-/stylis-4.1.2.tgz#870b3c1c2275f51b702bb3da9e94eedad87bba41" integrity sha512-Nn2CCrG2ZaFziDxaZPN43CXqn+j7tcdjPFCkRBkFue8QYXC2HdEwnw5TCBo4yQZ2WxKYeSi0fdoOrtEqgDrXbA== +stylis@^4.0.13: + version "4.1.3" + resolved "https://registry.yarnpkg.com/stylis/-/stylis-4.1.3.tgz#fd2fbe79f5fed17c55269e16ed8da14c84d069f7" + integrity sha512-GP6WDNWf+o403jrEp9c5jibKavrtLW+/qYGhFxFrG8maXhwTBI7gLLhiBb0o7uFccWN+EOS9aMO6cGHWAO07OA== + supports-color@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" @@ -15552,6 +15796,11 @@ throat@^5.0.0: resolved "https://registry.npmjs.org/throat/-/throat-5.0.0.tgz#c5199235803aad18754a667d659b5e72ce16764b" integrity sha512-fcwX4mndzpLQKBS1DVYhGAcYaYt7vsHNIvQV+WXMvnow5cgjPphq5CaayLaGsjRdSCKZFNGt7/GYAuXaNOiYCA== +throttle-debounce@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/throttle-debounce/-/throttle-debounce-5.0.0.tgz#a17a4039e82a2ed38a5e7268e4132d6960d41933" + integrity sha512-2iQTSgkkc1Zyk0MeVrt/3BvuOXYPl/R8Z0U2xxo9rjwNciaHDG3R+Lm6dh4EeUci49DanvBnuqI6jshoQQRGEg== + through2-filter@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/through2-filter/-/through2-filter-3.0.0.tgz#700e786df2367c2c88cd8aa5be4cf9c1e7831254" From 7b17d12e36b279d086bb939f8a75cf8f5e893973 Mon Sep 17 00:00:00 2001 From: Beeant Date: Fri, 24 Mar 2023 15:14:25 +0000 Subject: [PATCH 3/7] merge: upstream master --- .gitpod.yml | 11 +++++++++++ config/config.ts | 4 +++- config/nav.config.ts | 4 ++-- docs/api/engine.md | 27 +++++++++++++++++++++++---- packages/toolbar/package.json | 4 ++-- yarn.lock | 12 ++++++------ 6 files changed, 47 insertions(+), 15 deletions(-) create mode 100644 .gitpod.yml diff --git a/.gitpod.yml b/.gitpod.yml new file mode 100644 index 00000000..f2bf4259 --- /dev/null +++ b/.gitpod.yml @@ -0,0 +1,11 @@ +# This configuration file was automatically generated by Gitpod. +# Please adjust to your needs (see https://www.gitpod.io/docs/introduction/learn-gitpod/gitpod-yaml) +# and commit this file to your remote git repository to share the goodness with others. + +# Learn more from ready-to-use templates: https://www.gitpod.io/docs/introduction/getting-started/quickstart + +tasks: + - init: yarn install && yarn run build + command: yarn run start + + diff --git a/config/config.ts b/config/config.ts index bf410889..001de33d 100644 --- a/config/config.ts +++ b/config/config.ts @@ -9,6 +9,7 @@ export default defineConfig({ outputPath: 'docs-dist', hash: true, mode: 'site', + dynamicImport: {}, locales: [ ['en-US', 'English'], ['zh-CN', '中文'], @@ -63,7 +64,8 @@ export default defineConfig({ ], headScripts: [ { - src: 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js', + src: + 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js', 'data-ad-client': 'ca-pub-3706417744839656', } as any, ], diff --git a/config/nav.config.ts b/config/nav.config.ts index d3e78231..cd4368b4 100644 --- a/config/nav.config.ts +++ b/config/nav.config.ts @@ -31,7 +31,7 @@ export default () => { }, { title: 'Github', - path: 'https://github.com/yanmao-cc/am-editor', + path: 'https://github.com/big-camel/am-editor', }, { title: 'Editable', @@ -69,7 +69,7 @@ export default () => { }, { title: 'Github', - path: 'https://github.com/yanmao-cc/am-editor', + path: 'https://github.com/big-camel/am-editor', }, { title: 'Editable', diff --git a/docs/api/engine.md b/docs/api/engine.md index 5183d466..ca0cb61d 100644 --- a/docs/api/engine.md +++ b/docs/api/engine.md @@ -28,11 +28,11 @@ Key processing Type: `TypingInterface` -### `ot` +### `model` -Co-editing related +Data model related -Type: `OTInterface` +Type: `Model` ### `history` @@ -95,6 +95,8 @@ isEmpty(): boolean; ### `getValue` +> Use `model.toValue` instead, performance is better + Get editor value ```ts @@ -107,6 +109,8 @@ getValue(ignoreCursor?: boolean): string; ### `getValueAsync` +> Use `model.toValueAsync` instead, performance is better + Get the editor value asynchronously, and will wait for the plugin processing to complete before getting the value ```ts @@ -128,6 +132,8 @@ getValueAsync( ### `getHtml` +> Use `model.toHTML` instead, performance is better + Get the html of the editor ```ts @@ -137,6 +143,19 @@ Get the html of the editor getHtml(): string; ``` +### `getText` + +> Use `model.toText` instead, performance is better + +Get the text of the editor + +````ts +/** + * Get the text of the editor + */ +getText(): string; + + ### `getJsonValue` Get the value in JSON format @@ -146,7 +165,7 @@ Get the value in JSON format * Get the value in JSON format */ getJsonValue(): string | undefined | (string | {})[]; -``` +```` ### `setValue` diff --git a/packages/toolbar/package.json b/packages/toolbar/package.json index e6f2fcb8..d2a6d667 100644 --- a/packages/toolbar/package.json +++ b/packages/toolbar/package.json @@ -30,13 +30,13 @@ "@types/keymaster": "^1.6.28", "@types/lodash": "^4.14.178", "@types/tinycolor2": "^1.4.2", - "antd": "^5.0.0-rc.3", + "antd": "^5.3.2", "react": "^17.0.0", "react-dom": ">=17.0.0" }, "peerDependencies": { "@aomao/engine": ">=2.9", - "antd": "^5.0.0-rc.3", + "antd": "^5.3.2", "react": ">=17.0.0", "react-dom": ">=17.0.0" } diff --git a/yarn.lock b/yarn.lock index e70e0d27..569fa80c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3243,6 +3243,11 @@ dependencies: "@types/estree" "*" +"@types/tinycolor2@^1.4.2": + version "1.4.3" + resolved "https://registry.yarnpkg.com/@types/tinycolor2/-/tinycolor2-1.4.3.tgz#ed4a0901f954b126e6a914b4839c77462d56e706" + integrity sha512-Kf1w9NE5HEgGxCRyIcRXR/ZYtDv0V8FVPtYHwLxl0O+maGX0erE77pQlD0gpP+/KByMZ87mOA79SjifhSB3PjQ== + "@types/unist@*", "@types/unist@^2.0.0", "@types/unist@^2.0.2", "@types/unist@^2.0.3": version "2.0.6" resolved "https://registry.npmjs.org/@types/unist/-/unist-2.0.6.tgz#250a7b16c3b91f672a24552ec64678eeb1d3a08d" @@ -3941,7 +3946,7 @@ ant-design-vue@>=2.2.6: vue-types "^3.0.0" warning "^4.0.0" -antd@^5.0.0-rc.3: +antd@^5.0.0-rc.3, antd@^5.3.2: version "5.3.2" resolved "https://registry.yarnpkg.com/antd/-/antd-5.3.2.tgz#6f225a3ae43c63c1003dc7af4d0045d3be612497" integrity sha512-AOCZ+5krqvlLPR1v33K2PQtt9XBAC0gUdjxuHltUliE9u2zlZzGT+4DSHTNnw8CtotPV4lFKab3+K+FgdtyTlw== @@ -11416,11 +11421,6 @@ moment-mini@2.24.0: resolved "https://registry.npmjs.org/moment-mini/-/moment-mini-2.24.0.tgz#fa68d98f7fe93ae65bf1262f6abb5fb6983d8d18" integrity sha512-9ARkWHBs+6YJIvrIp0Ik5tyTTtP9PoV0Ssu2Ocq5y9v8+NOOpWiRshAp8c4rZVWTOe+157on/5G+zj5pwIQFEQ== -moment@^2.24.0, moment@^2.29.2: - version "2.29.4" - resolved "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz#3dbe052889fe7c1b2ed966fcb3a77328964ef108" - integrity sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w== - mongodb-connection-string-url@^2.6.0: version "2.6.0" resolved "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-2.6.0.tgz#57901bf352372abdde812c81be47b75c6b2ec5cf" From 8a25431836f60ef2d994c383a72de53048af751f Mon Sep 17 00:00:00 2001 From: Beeant Date: Sat, 25 Mar 2023 03:24:53 +0000 Subject: [PATCH 4/7] feat: ant design 5 --- examples/react/components/comment/edit.tsx | 2 -- examples/react/components/comment/index.tsx | 16 ++++++++-------- examples/react/components/comment/item.tsx | 7 +++---- .../react/components/editor/collaborators.tsx | 4 ---- examples/react/components/editor/config.tsx | 1 - examples/react/components/engine/index.tsx | 2 -- examples/react/components/loading/index.tsx | 1 - examples/react/components/view/index.tsx | 1 - examples/react/editor.tsx | 2 -- packages/toolbar/src/button/index.tsx | 1 - packages/toolbar/src/collapse/item.tsx | 1 - packages/toolbar/src/dropdown/list.tsx | 1 - packages/toolbar/src/group/index.tsx | 1 - plugins/codeblock/src/component/select.tsx | 1 - plugins/link/src/toolbar/editor.tsx | 2 -- plugins/link/src/toolbar/preview.tsx | 1 - .../src/component/common/header.tsx | 5 ++--- .../src/component/common/themeSelect.tsx | 1 - plugins/tag/src/component/tag.tsx | 6 ++---- 19 files changed, 15 insertions(+), 41 deletions(-) diff --git a/examples/react/components/comment/edit.tsx b/examples/react/components/comment/edit.tsx index 3fad31f2..c9c18c0c 100644 --- a/examples/react/components/comment/edit.tsx +++ b/examples/react/components/comment/edit.tsx @@ -2,8 +2,6 @@ import React, { useState, useContext } from 'react'; import Input from 'antd/es/input'; import Button from 'antd/es/button'; import Contentx from '../../context'; -import 'antd/es/input/style/css'; -import 'antd/es/button/style/css'; type EditProps = { defaultValue?: string; diff --git a/examples/react/components/comment/index.tsx b/examples/react/components/comment/index.tsx index 7fa92237..41e7ce0e 100644 --- a/examples/react/components/comment/index.tsx +++ b/examples/react/components/comment/index.tsx @@ -24,7 +24,6 @@ import { CursorData } from '@aomao/plugin-yjs'; import CommentItem from './item'; import context from '../../context'; import { useDispatch, useSelector } from '../../hooks'; -import 'antd/es/message/style/css'; import './index.css'; export type CommentProps = { @@ -64,13 +63,14 @@ const Comment: React.FC = forwardRef( const tempList: Array = []; dataSource.forEach((item: DataSourceItem) => { //获取评论编号对应在编辑器中的所有节点 - const elements: Array = editor.command.executeMethod( - 'mark-range', - 'action', //插件名称 - 'comment', //标记类型 - 'find', //调用的方法 - item.id, - ); + const elements: Array = + editor.command.executeMethod( + 'mark-range', + 'action', //插件名称 + 'comment', //标记类型 + 'find', //调用的方法 + item.id, + ); if (elements.length === 0) return; //获取目标评论在编辑器中的 top const top = getRectTop(elements[0]); diff --git a/examples/react/components/comment/item.tsx b/examples/react/components/comment/item.tsx index 4023c4fb..9e2551cf 100644 --- a/examples/react/components/comment/item.tsx +++ b/examples/react/components/comment/item.tsx @@ -1,10 +1,9 @@ import React, { useContext, forwardRef } from 'react'; -import moment from 'moment'; +import dayjs from 'dayjs'; import Space from 'antd/es/space'; import { DataItem } from './types'; import ItemEdit from './edit'; import Context from '../../context'; -import 'antd/es/space/style/css'; export type CommentItemProps = Omit< React.AnchorHTMLAttributes, @@ -76,8 +75,8 @@ const CommentItem = forwardRef( > {username} - {moment() - .startOf('seconds') + {dayjs() + .startOf('second') .from(new Date(createdAt))} { diff --git a/plugins/mulit-codeblock/src/component/common/themeSelect.tsx b/plugins/mulit-codeblock/src/component/common/themeSelect.tsx index 65627151..da5f5d4d 100644 --- a/plugins/mulit-codeblock/src/component/common/themeSelect.tsx +++ b/plugins/mulit-codeblock/src/component/common/themeSelect.tsx @@ -2,7 +2,6 @@ import React, { useState } from 'react'; import ReactDOM from 'react-dom'; import { cmTheme } from '../utils/index'; import Select from 'antd/es/select'; -import 'antd/es/select/style/css'; interface IThemeSelect { theme: string; diff --git a/plugins/tag/src/component/tag.tsx b/plugins/tag/src/component/tag.tsx index 5008f0d8..276d60be 100644 --- a/plugins/tag/src/component/tag.tsx +++ b/plugins/tag/src/component/tag.tsx @@ -1,9 +1,7 @@ import React, { useMemo, useState } from 'react'; import { TagValue, IType } from './type'; import Popover from 'antd/es/popover/index'; -import 'antd/es/popover/style/css'; import Input from 'antd/es/input/index'; -import 'antd/es/input/style/css'; import uniqBy from 'lodash/uniqBy'; import { EditorInterface } from '@aomao/engine'; @@ -222,11 +220,11 @@ export default function Tag({ return ( Date: Sat, 25 Mar 2023 07:46:47 +0000 Subject: [PATCH 5/7] feat: merge upstream master --- .../react/components/editor/collaborators.tsx | 161 +- plugins/codeblock/package.json | 4 +- plugins/link/package.json | 4 +- plugins/mulit-codeblock/package.json | 4 +- plugins/table/src/index.ts | 1492 +++++++++++------ plugins/tag/package.json | 4 +- 6 files changed, 1078 insertions(+), 591 deletions(-) diff --git a/examples/react/components/editor/collaborators.tsx b/examples/react/components/editor/collaborators.tsx index 31333a42..c1689f12 100644 --- a/examples/react/components/editor/collaborators.tsx +++ b/examples/react/components/editor/collaborators.tsx @@ -6,89 +6,88 @@ import { isMobile } from '@aomao/engine'; import { Popover, Tooltip } from 'antd'; const maxCount = isMobile ? 2 : 5; -export const Collaboration: React.FC<{ - members: Record; -}> = ({ members }) => { - const count = Object.keys(members).length; - const renderList = () => { - if (!maxCount) return; - const moreMembers: CursorData[] = []; - let count = 0; - for (const key in members) { - if (count >= maxCount) break; - moreMembers.push(members[key]); - count++; - } +export const Collaboration: React.FC<{ members: Record }> = + ({ members }) => { + const count = Object.keys(members).length; + const renderList = () => { + if (!maxCount) return; + const moreMembers: CursorData[] = []; + let count = 0; + for (const key in members) { + if (count >= maxCount) break; + moreMembers.push(members[key]); + count++; + } - return ( -
- {moreMembers.map(({ name, color, avatar }, index) => ( -
- - {name} - - {name} -
- ))} -
- ); - }; - - const renderMore = () => { - if (maxCount && count > maxCount) { return ( - -
- + {moreMembers.map(({ name, color, avatar }, index) => ( +
- +{count - maxCount} - -
- + + {name} + + {name} +
+ ))} + ); - } - return; - }; + }; + + const renderMore = () => { + if (maxCount && count > maxCount) { + return ( + +
+ + +{count - maxCount} + +
+
+ ); + } + return; + }; - return ( -
- - {Object.values(members).map( - ({ name, color, avatar }, index) => { - if (maxCount && index >= maxCount) return; - return ( - - - {name} - - - ); - }, - )} - {renderMore()} - -
- ); -}; + return ( +
+ + {Object.values(members).map( + ({ name, color, avatar }, index) => { + if (maxCount && index >= maxCount) return; + return ( + + + {name} + + + ); + }, + )} + {renderMore()} + +
+ ); + }; diff --git a/plugins/codeblock/package.json b/plugins/codeblock/package.json index 0605dd64..91c022ba 100644 --- a/plugins/codeblock/package.json +++ b/plugins/codeblock/package.json @@ -36,13 +36,13 @@ "@types/codemirror": "^5.60.0", "@types/lodash": "^4.14.178", "@types/markdown-it": "^12.2.3", - "antd": "^5.0.0-rc.3", + "antd": "^5.3.2", "react": "^17.0.0", "react-dom": "^17.0.0" }, "peerDependencies": { "@aomao/engine": ">=2.9", - "antd": "^5.0.0-rc.3", + "antd": "^5.3.2", "react": ">=17.0.0", "react-dom": ">=17.0.0" } diff --git a/plugins/link/package.json b/plugins/link/package.json index 7c8b54a7..a1ca2b47 100644 --- a/plugins/link/package.json +++ b/plugins/link/package.json @@ -29,13 +29,13 @@ }, "devDependencies": { "@types/markdown-it": "^12.2.3", - "antd": "^5.0.0-rc.3", + "antd": "^5.3.2", "react": "^17.0.0", "react-dom": "^17.0.0" }, "peerDependencies": { "@aomao/engine": ">=2.9", - "antd": "^5.0.0-rc.3", + "antd": "^5.3.2", "react": ">=17.0.0", "react-dom": ">=17.0.0" } diff --git a/plugins/mulit-codeblock/package.json b/plugins/mulit-codeblock/package.json index 5a1da2f4..b2f397ce 100644 --- a/plugins/mulit-codeblock/package.json +++ b/plugins/mulit-codeblock/package.json @@ -42,13 +42,13 @@ "@types/markdown-it": "^12.2.3", "@types/markdown-it-container": "^2.0.5", "@types/react-beautiful-dnd": "^13.1.2", - "antd": "^5.0.0-rc.3", + "antd": "^5.3.2", "react": "^17.0.0", "react-dom": "^17.0.0" }, "peerDependencies": { "@aomao/engine": ">=2.9", - "antd": "^5.0.0-rc.3", + "antd": "^5.3.2", "react": ">=17.0.0", "react-dom": ">=17.0.0" } diff --git a/plugins/table/src/index.ts b/plugins/table/src/index.ts index 95996c99..12192ba2 100644 --- a/plugins/table/src/index.ts +++ b/plugins/table/src/index.ts @@ -1,569 +1,1057 @@ import { $, - CARD_KEY, + Card, + CardToolbarItemOptions, + CardType, + closest, + DATA_CONTENTEDITABLE_KEY, + DATA_ELEMENT, EDITABLE_SELECTOR, + getComputedStyle, isEngine, + isMobile, NodeInterface, - Plugin, - SchemaBlock, - SchemaInterface, - getDocument, - READY_CARD_KEY, - decodeCardValue, - CARD_VALUE_KEY, - transformCustomTags, - DATA_ID, + Parser, + RangeInterface, + removeUnit, + Scrollbar, + SelectStyleType, + ToolbarItemOptions, } from '@aomao/engine'; -import type MarkdownIt from 'markdown-it'; -import TableComponent, { Template, Helper } from './component'; -import locales from './locale'; -import { TableInterface, TableOptions, TableValue } from './types'; -import './index.css'; -class Table extends Plugin { - static get pluginName() { +import { + ControllBarInterface, + HelperInterface, + TableCommandInterface, + TableInterface, + TableOptions, + TableSelectionInterface, + TableValue, + TemplateInterface, +} from '../types'; +import Helper from './helper'; +import Template from './template'; +import menuData from './menu'; +import ControllBar from './controllbar'; +import TableSelection from './selection'; +import TableCommand from './command'; +import { ColorTool, Palette } from './toolbar'; + +class TableComponent + extends Card + implements TableInterface +{ + readonly contenteditable: string[] = [ + `div${Template.TABLE_TD_CONTENT_CLASS}`, + ]; + + static get cardName() { return 'table'; } + static get cardType() { + return CardType.BLOCK; + } + + static get selectStyleType() { + return SelectStyleType.BACKGROUND; + } + + static get autoSelected() { + return false; + } + + static get lazyRender() { + return true; + } + + static colors = Palette.getColors().map((group) => + group.map((color) => { + return { color, border: Palette.getStroke(color) }; + }), + ); + + colMinWidth = + this.editor.plugin.findPlugin('table')?.options + .colMinWidth || 40; + rowMinHeight = + this.editor.plugin.findPlugin('table')?.options + .rowMinHeight || 35; + maxInsertNum = + this.editor.plugin.findPlugin('table')?.options + .maxInsertNum || 30; + wrapper?: NodeInterface; + helper: HelperInterface = new Helper(this.editor); + template: TemplateInterface = new Template(this); + selection: TableSelectionInterface = new TableSelection(this.editor, this); + conltrollBar: ControllBarInterface = new ControllBar(this.editor, this, { + col_min_width: this.colMinWidth, + row_min_height: this.rowMinHeight, + max_insert_num: this.maxInsertNum, + }); + command: TableCommandInterface = new TableCommand(this.editor, this); + scrollbar?: Scrollbar; + viewport?: NodeInterface; + colorTool?: ColorTool; + noBorderToolButton?: NodeInterface; + alignToolButton?: NodeInterface; + #changeTimeout?: NodeJS.Timeout; + init() { + super.init(); const editor = this.editor; - if (!this.options.colMinWidth) { - this.options.colMinWidth = 40; - } - if (!this.options.rowMinHeight) { - this.options.rowMinHeight = 30; - } - editor.language.add(locales); - editor.schema.add(this.schema()); - editor.conversion.add('th', 'td'); - editor.on('parse:html', this.parseHtml); - editor.on('paste:each', this.pasteEach); - editor.on('paste:each-after', this.pasteHtml); - editor.on('paste:schema', this.pasteSchema); if (isEngine(editor)) { - this.editor.on('markdown-it', this.markdownIt); - editor.change.event.onDocument('copy', this.onCopy, 0); - editor.change.event.onDocument('cut', this.onCut, 0); - editor.change.event.onDocument('paste', this.onPaste, 0); + // tab 键选择 + if (!editor.event.listeners['keydown:tab']) + editor.event.listeners['keydown:tab'] = []; + editor.event.listeners['keydown:tab'].unshift( + (event: KeyboardEvent) => { + if (!isEngine(editor) || editor.readonly) return; + const { change, block, node, card } = editor; + + const range = change.range.get(); + const td = range.endNode.closest('td'); + if (td.length === 0 || !td.inEditor()) return; + const component = card.closest(td, true); + if (!component?.equal(this.root)) return; + const closestBlock = block.closest(range.endNode); + if ( + td.length > 0 && + (block.isLastOffset(range, 'end') || + (closestBlock.name !== 'li' && + node.isEmptyWidthChild(closestBlock))) + ) { + let next = td.next(); + if (!next) { + const nextRow = td.parent()?.next(); + // 最后一行,最后一列 + if (!nextRow) { + // 新建一行 + this.command.insertRowDown(); + next = + td + .parent() + ?.next() + ?.find('td:first-child') || null; + } else { + next = nextRow.find('td:first-child') || null; + } + } + if (next) { + event.preventDefault(); + this.selection.focusCell(next); + return false; + } + } + if (td.length > 0) { + setTimeout(() => { + this.scrollbar?.refresh(); + }, 0); + } + return; + }, + ); + // 下键选择 + editor.on('keydown:down', (event) => { + if (!isEngine(editor) || editor.readonly) return; + const { change, card } = editor; + + const range = change.range.get(); + const td = range.endNode.closest('td'); + if (td.length === 0 || !td.inEditor()) return; + const component = card.closest(td, true); + if (!component?.equal(this.root)) return; + const contentElement = td.find('.table-main-content'); + if (!contentElement) return; + const tdRect = contentElement + .get()! + .getBoundingClientRect(); + const rangeRect = range.getBoundingClientRect(); + if ( + td.length > 0 && + (rangeRect.bottom === 0 || + tdRect.bottom - rangeRect.bottom < 10) + ) { + const index = td.index(); + const nextRow = td.parent()?.next(); + if (nextRow) { + let nextIndex = 0; + let nextTd = nextRow.find('td:last-child'); + this.selection.tableModel?.table[nextRow.index()].some( + (cell) => { + if ( + !this.helper.isEmptyModelCol(cell) && + nextIndex >= index && + cell.element + ) { + nextTd = $(cell.element); + return true; + } + nextIndex++; + return false; + }, + ); + if (nextTd) { + event.preventDefault(); + this.selection.focusCell(nextTd, true); + return false; + } + } else { + event.preventDefault(); + const cloneRange = range.cloneRange(); + const next = this.root.next(); + const cardComponent = next + ? card.find(next) + : undefined; + if (cardComponent?.onSelectDown) { + cardComponent.onSelectDown(event); + } else { + card.focusNextBlock(this, cloneRange, false); + change.range.select(cloneRange); + } + return false; + } + } + if (td.length > 0) { + setTimeout(() => { + this.scrollbar?.refresh(); + }, 0); + } + return; + }); + // 上键选择 + editor.on('keydown:up', (event) => { + if (!isEngine(editor) || editor.readonly) return; + const { change, card } = editor; + + const range = change.range.get(); + const td = range.endNode.closest('td'); + if (td.length === 0 || !td.inEditor()) return; + const component = card.closest(td, true); + if (!component?.equal(this.root)) return; + const contentElement = td.find('.table-main-content'); + if (!contentElement) return; + const tdRect = contentElement + .get()! + .getBoundingClientRect(); + const rangeRect = range.getBoundingClientRect(); + if ( + td.length > 0 && + (rangeRect.top === 0 || rangeRect.top - tdRect.top < 10) + ) { + const index = td.index(); + const prevRow = td.parent()?.prev(); + if (prevRow) { + let prevIndex = 0; + let prevTd = prevRow.find('td:first-child'); + this.selection.tableModel?.table[prevRow.index()].some( + (cell) => { + if ( + !this.helper.isEmptyModelCol(cell) && + prevIndex >= index && + cell.element + ) { + prevTd = $(cell.element); + return true; + } + prevIndex++; + return false; + }, + ); + if (prevTd) { + event.preventDefault(); + this.selection.focusCell(prevTd); + return false; + } + } else { + event.preventDefault(); + const cloneRange = range.cloneRange(); + const prev = this.root.prev(); + const cardComponent = prev + ? card.find(prev) + : undefined; + if (cardComponent?.onSelectUp) { + cardComponent.onSelectUp(event); + } else { + card.focusPrevBlock(this, cloneRange, false); + change.range.select(cloneRange); + } + return false; + } + } + if (td.length > 0) { + setTimeout(() => { + this.scrollbar?.refresh(); + }, 0); + } + return; + }); + // 左键选择 + editor.on('keydown:left', () => { + if (!isEngine(editor) || editor.readonly) return; + const { change, card } = editor; + + const range = change.range.get(); + const td = range.endNode.closest('td'); + if (td.length === 0 || !td.inEditor()) return; + const component = card.closest(td, true); + if (!component?.equal(this.root)) return; + const contentElement = td.find('.table-main-content'); + if (!contentElement) return; + if (td.length > 0) { + setTimeout(() => { + this.scrollbar?.refresh(); + }, 0); + } + }); + // 右键选择 + editor.on('keydown:right', () => { + if (!isEngine(editor) || editor.readonly) return; + const { change, card } = editor; + + const range = change.range.get(); + const td = range.endNode.closest('td'); + if (td.length === 0 || !td.inEditor()) return; + const component = card.closest(td, true); + if (!component?.equal(this.root)) return; + const contentElement = td.find('.table-main-content'); + if (!contentElement) return; + if (td.length > 0) { + setTimeout(() => { + this.scrollbar?.refresh(); + }, 0); + } + }); } + if (this.colorTool) return; + this.colorTool = new ColorTool(editor, this.id, { + colors: TableComponent.colors, + defaultColor: super.getValue()?.color, + onChange: (color: string) => { + this.conltrollBar.drawBackgroundColor(color); + const value = this.getValue(); + this.setValue({ ...value, color }); + }, + }); } - onCopy = (event: ClipboardEvent) => { - const editor = this.editor; - if (!isEngine(editor)) return true; - const { change, card } = editor; - const range = change.range.get(); - const component = card.find( - range.commonAncestorNode, - true, - ); - if ( - component && - component.name === TableComponent.cardName && - !component.isCursor(range.startNode) - ) { - const nodes = component.getSelectionNodes(); - if (nodes.length > 1) { - event.preventDefault(); - component.command.copy(); - editor.messageSuccess( - 'copy', - editor.language.get('copy', 'success'), - ); - return false; - } - } - return true; + doChange = () => { + this.remoteRefresh(); + this.handleChange('local'); }; - onCut = (event: ClipboardEvent) => { + toolbar(): (ToolbarItemOptions | CardToolbarItemOptions)[] { const editor = this.editor; - if (!isEngine(editor) || editor.readonly) return true; - const { change, card } = editor; - const range = change.range.get(); - const component = card.find( - range.commonAncestorNode, - true, - ); - if ( - component && - component.name === TableComponent.cardName && - !component.isCursor(range.startNode) - ) { - const nodes = component.getSelectionNodes(); - if (nodes.length > 1) { - event.preventDefault(); - component.command.cut(); - return false; + const getItems = (): ( + | ToolbarItemOptions + | CardToolbarItemOptions + )[] => { + if (!isEngine(editor) || editor.readonly) + return [ + { + key: 'maximize', + type: 'maximize', + }, + ]; + const language = editor.language.get('table'); + const funBtns: Array = + [ + { + key: 'color', + type: 'node', + title: editor.language.get( + 'table', + 'color', + 'title', + ), + node: this.colorTool!.getButton(), + }, + { + key: 'border', + type: 'button', + title: super.getValue()?.noBorder + ? language['showBorder'] + : language['noBorder'], + content: + '', + didMount: (node) => { + const value = super.getValue(); + if (value?.noBorder === true) { + node.addClass('active'); + } + this.noBorderToolButton = node; + }, + onClick: (_, node) => { + const value = super.getValue(); + this.setValue({ + noBorder: !value?.noBorder, + } as V); + const table = this.wrapper?.find('.data-table'); + if (value?.noBorder === true) { + table?.removeAttributes('data-table-no-border'); + node.removeClass('active'); + } else { + table?.attributes( + 'data-table-no-border', + 'true', + ); + node.addClass('active'); + } + }, + }, + { + key: 'align', + type: 'dropdown', + content: + '', + title: language['verticalAlign']['title'], + didMount: (node) => { + this.alignToolButton = + node.find('.data-toolbar-btn'); + }, + items: [ + { + type: 'button', + content: ` ${language['verticalAlign']['top']}`, + onClick: (event: MouseEvent) => + this.updateAlign(event, 'top'), + }, + { + type: 'button', + content: ` ${language['verticalAlign']['middle']}`, + onClick: (event: MouseEvent) => + this.updateAlign(event, 'middle'), + }, + { + type: 'button', + content: ` ${language['verticalAlign']['bottom']}`, + onClick: (event: MouseEvent) => + this.updateAlign(event, 'bottom'), + }, + ], + }, + { + key: 'merge', + type: 'button', + title: language['mergeCell'], + content: + '', + disabled: + this.conltrollBar.getMenuDisabled('mergeCell'), + onClick: () => { + this.command.mergeCell(); + }, + }, + { + key: 'split', + type: 'button', + title: language['splitCell'], + content: + '', + disabled: + this.conltrollBar.getMenuDisabled('splitCell'), + onClick: () => { + this.command.splitCell(); + }, + }, + ]; + if (this.isMaximize) return funBtns; + const toolbars: Array = + [ + { + key: 'maximize', + type: 'maximize', + }, + { + key: 'copy', + type: 'copy', + onClick: () => { + this.command.copy(true); + editor.messageSuccess( + 'copy', + editor.language.get('copy', 'success'), + ); + }, + }, + { + key: 'delete', + type: 'delete', + }, + { + key: 'separator', + type: 'separator', + }, + ...funBtns, + ]; + if (removeUnit(this.wrapper?.css('margin-left') || '0') === 0) { + toolbars.unshift({ + key: 'dnd', + type: 'dnd', + }); } + return toolbars; + }; + const options = + editor.plugin.findPlugin('table')?.options; + if (options?.cardToolbars) { + return options.cardToolbars(getItems(), this.editor); } - return true; - }; + return getItems(); + } - onPaste = (event: ClipboardEvent) => { - const editor = this.editor; - if (!isEngine(editor) || editor.readonly) return true; - const { change, card } = editor; - const range = change.range.get(); - const component = card.find( - range.commonAncestorNode, - true, - ); - if ( - component && - component.name === TableComponent.cardName && - !component.isCursor(range.startNode) - ) { - const data = editor.clipboard.getData(event); - if ( - !data || - !//gi.test( - data.html || '', - ) - ) { - return true; + onSelectLeft(event: KeyboardEvent) { + const { tableModel } = this.selection; + if (!tableModel) return; + for (let r = tableModel.rows - 1; r >= 0; r--) { + for (let c = tableModel.cols - 1; c >= 0; c--) { + const cell = tableModel.table[r][c]; + if (!this.helper.isEmptyModelCol(cell) && cell.element) { + event.preventDefault(); + this.selection.focusCell(cell.element, false); + return false; + } } - event.preventDefault(); - component.command.paste(data); - return false; } - return true; - }; - - hotkey() { - return this.options.hotkey || ''; + return; } - schema(): Array { - return [ - { - name: 'table', - type: 'block', - attributes: { - class: ['data-table'], - 'data-table-no-border': '*', - style: { - width: '@length', - }, - }, - }, - { - name: 'colgroup', - type: 'block', - allowIn: ['table'], - }, - { - name: 'col', - type: 'block', - isVoid: true, - attributes: { - width: '@number', - span: '@number', - }, - allowIn: ['colgroup'], - }, - { - name: 'thead', - type: 'block', - allowIn: ['table'], - }, - { - name: 'tbody', - type: 'block', - allowIn: ['table'], - }, - { - name: 'tr', - type: 'block', - attributes: { - style: { - height: '@length', - }, - }, - allowIn: ['tbody', 'thead', 'tfoot'], - }, - { - name: 'td', - type: 'block', - attributes: { - colspan: '@number', - rowspan: '@number', - class: [ - 'table-last-column', - 'table-last-row', - 'table-last-column', - 'table-cell-selection', - ], - style: { - 'background-color': '@color', - 'vertical-align': ['top', 'middle', 'bottom'], - }, - }, - allowIn: ['tr'], - }, - { - name: 'th', - type: 'block', - attributes: { - colspan: '@number', - rowspan: '@number', - }, - allowIn: ['tr'], - }, - ]; + onSelectRight(event: KeyboardEvent) { + const { tableModel } = this.selection; + if (!tableModel) return; + for (let r = 0; r < tableModel.rows; r++) { + for (let c = 0; c < tableModel.cols; c++) { + const cell = tableModel.table[r][c]; + if (!this.helper.isEmptyModelCol(cell) && cell.element) { + event.preventDefault(); + this.selection.focusCell(cell.element); + return false; + } + } + } + return; } - pasteSchema = (schema: SchemaInterface) => { - (schema.data.blocks as SchemaBlock[]).forEach((blockSchema) => { - if (!blockSchema.allowIn) { - blockSchema.allowIn = []; + onSelectUp(event: KeyboardEvent) { + const { tableModel } = this.selection; + if (!tableModel) return; + for (let r = tableModel.rows - 1; r >= 0; r--) { + for (let c = 0; c < tableModel.cols; c++) { + const cell = tableModel.table[r][c]; + if (!this.helper.isEmptyModelCol(cell) && cell.element) { + event.preventDefault(); + this.selection.focusCell(cell.element, false); + return false; + } } - if (blockSchema.allowIn.indexOf('td') < 0) { - blockSchema.allowIn.push('td'); + } + return; + } + + onSelectDown(event: KeyboardEvent) { + const { tableModel } = this.selection; + if (!tableModel) return; + for (let r = 0; r < tableModel.rows; r++) { + for (let c = 0; c < tableModel.cols; c++) { + const cell = tableModel.table[r][c]; + if (!this.helper.isEmptyModelCol(cell) && cell.element) { + event.preventDefault(); + this.selection.focusCell(cell.element); + return false; + } } + } + return; + } + + updateAlign(event: MouseEvent, align: 'top' | 'middle' | 'bottom' = 'top') { + event.preventDefault(); + this.conltrollBar.setAlign(align); + this.onChange('local'); + this.updateAlignText(align); + } + + updateAlignText(align: 'top' | 'middle' | 'bottom' = 'top') { + const alignHtml = ``; + this.alignToolButton?.html(alignHtml); + } + + getValue() { + const value = super.getValue(); + if (!this.wrapper) return value; + const tableRoot = this.wrapper.find(Template.TABLE_CLASS); + if (!tableRoot) return value; + const { tableModel } = this.selection; + if (!tableModel) return value; + const editor = this.editor; + const { schema, conversion } = editor; + const container = $('
'); + container.append(tableRoot.clone(true)); + const parser = new Parser(container, editor, (node) => { + node.find(Template.TABLE_TD_BG_CLASS).remove(); + node.find(EDITABLE_SELECTOR).each((root) => { + if (root.nodeName === 'TD') { + $(root).removeAttributes(DATA_ELEMENT); + } else editor.node.unwrap($(root)); + }); }); - const table = schema.find((r) => r.name === 'table')[0]; - table.attributes = { - class: ['data-table'], - 'data-table-no-border': '*', - 'data-width': '@length', - style: { - width: '@length', - background: '@color', - 'background-color': '@color', - }, - }; - const allowIn = (table as SchemaBlock).allowIn; - if (!allowIn) { - (table as SchemaBlock).allowIn = ['div']; + const { rows, cols, height, width } = tableModel; + const html = parser.toValue(schema, conversion, false, false); + if (!isEngine(editor)) return { ...value, html }; + return { + ...value, + rows, + cols, + height, + width, + html, + } as V; + } + + drawBackground?( + node: NodeInterface, + range: RangeInterface, + ): DOMRect | void | false | RangeInterface[] { + const backgroundRect = node.get()!.getBoundingClientRect(); + const domRect = new DOMRect(backgroundRect.x, backgroundRect.y, 0, 0); + const { startContainer, endContainer } = range; + const startElement = closest(startContainer, 'td'); + const endElement = closest(endContainer, 'td'); + if ( + !(startElement instanceof Element) || + !(endElement instanceof Element) || + startElement.nodeName !== 'TD' || + endElement?.nodeName !== 'TD' || + startElement === endElement + ) + return; + + const startRect = startElement.getBoundingClientRect(); + const endRect = endElement.getBoundingClientRect(); + const viewportRect = this.viewport?.getBoundingClientRect(); + const vLeft = (viewportRect?.left || 0) + (this.activated ? 13 : 0); + domRect.x = Math.max( + startRect.left - backgroundRect.left, + vLeft - (this.editor.root.getBoundingClientRect()?.left || 0), + ); + domRect.y = startRect.top - backgroundRect.top; + domRect.width = + (viewportRect + ? Math.min(endRect.right, viewportRect.right) + : endRect.right) - startRect.left; + domRect.height = startRect.bottom - startRect.top; + if (domRect.width < 0) domRect.width = 0; + domRect.height = endRect.bottom - startRect.top; + return domRect; + } + + activate(activated: boolean) { + super.activate(activated); + if (activated) { + this.conltrollBar.refresh(); + this.wrapper?.addClass('active'); } else { - allowIn.push('div'); + this.selection.clearSelect(); + this.conltrollBar.hideContextMenu(); + this.wrapper?.removeClass('active'); + } + this.scrollbar?.refresh(); + } + + handleChange = (trigger: 'remote' | 'local' = 'local') => { + const editor = this.editor; + this.conltrollBar.refresh(); + this.selection.render('change'); + const oldValue = super.getValue(); + if (oldValue?.noBorder) { + this.noBorderToolButton?.addClass('active'); + } else this.noBorderToolButton?.removeClass('active'); + if (trigger === 'local' && isEngine(editor)) { + const value = this.getValue(); + if (value) this.setValue(value); } - schema.find((r) => r.name === 'div')[0].attributes = { - class: { required: true, value: ['editor-table-wrapper'] }, - }; - schema.find((r) => r.name === 'tr')[0].attributes = { - class: ['data-table'], - 'data-table-no-border': '*', - style: { - height: '@length', - background: '@color', - 'background-color': '@color', - display: '*', - }, - }; - schema.find((r) => r.name === 'td')[0].attributes = { - colspan: '@number', - rowspan: '@number', - class: [ - 'table-last-column', - 'table-last-row', - 'table-last-column', - 'table-cell-selection', - ], - style: { - 'background-color': '@color', - background: '@color', - 'vertical-align': ['top', 'middle', 'bottom'], - valign: ['top', 'middle', 'bottom'], - }, - }; }; - execute(rows?: number, cols?: number): void { + onChange = (trigger: 'remote' | 'local' = 'local') => { const editor = this.editor; - if (!isEngine(editor)) return; - //可编辑子区域内不插入表格 - const { change } = editor; - const range = change.range.get(); - if (range.startNode.closest(EDITABLE_SELECTOR).length > 0) return; - //插入表格 - editor.card.insert(TableComponent.cardName, { - rows: rows || 3, - cols: cols || 3, - overflow: !!this.options.overflow, + if ( + isEngine(editor) && + trigger === 'local' && + editor.model.mutation.isStopped + ) + return; + if (this.#changeTimeout) clearTimeout(this.#changeTimeout); + this.#changeTimeout = setTimeout(() => { + this.handleChange(trigger); + if (trigger === 'remote') { + this.remoteRefresh(); + } + }, 50); + }; + + maximize() { + super.maximize(); + this.scrollbar?.refresh(); + const { editor } = this; + if (isEngine(editor) && !isMobile) { + this.getCenter().on('scroll', this.updateScrollbar, { + passive: true, + }); + } + } + + minimize() { + super.minimize(); + this.scrollbar?.refresh(); + this.getCenter().off('scroll', this.updateScrollbar); + } + + getSelectionNodes() { + const nodes: Array = []; + this.selection.each((cell) => { + if (!this.helper.isEmptyModelCol(cell) && cell.element) { + nodes.push($(cell.element).find(EDITABLE_SELECTOR)); + } }); + // 如果值选中了一个单元格,并且不是拖蓝方式选中就返回空的 + if ( + nodes.length === 1 && + nodes[0].closest('[table-cell-selection=true]').length === 0 + ) + return []; + return nodes; } - convertToPX(value: string) { - const match = /([\d\.]+)(pt|px)$/i.exec(value); - if (match && match[2] === 'pt') { - return ( - String(Math.round((parseInt(match[1], 10) * 96) / 72)) + 'px' + overflow(max: number) { + // 表格宽度 + const tableWidth = this.wrapper?.find('.data-table')?.width() || 0; + const rootWidth = this.getCenter().width(); + // 溢出的宽度 + const overflowWidth = tableWidth - rootWidth; + if (overflowWidth > 0 && !this.isMaximize) { + this.wrapper?.css( + 'margin-right', + `-${overflowWidth > max ? max : overflowWidth}px`, ); + } else if (overflowWidth < 0 || this.isMaximize) { + this.wrapper?.css('margin-right', ''); } - return value; } - pasteEach = (node: NodeInterface) => { - if ( - node.name === 'div' && - node.hasClass('editor-table-wrapper') && - node.first()?.name === 'table' - ) { - this.editor.node.unwrap(node); - } + updateScrollbar = () => { + if (!this.scrollbar) return; + const hideHeight = + (this.wrapper?.getBoundingClientRect()?.bottom || 0) - + (this.wrapper?.getViewport().bottom || 0); + this.wrapper?.find('.data-scrollbar-x').css({ + bottom: `${hideHeight > 0 ? hideHeight + 2 : 0}px`, + }); }; - pasteHtml = (root: NodeInterface) => { + initScrollbar() { + if (!this.viewport) return; const editor = this.editor; - if (!isEngine(editor)) return; - const clearWH = ( - node: NodeInterface, - type: 'width' | 'height' = 'width', - ) => { - const dataWidth = node.attributes('data-width'); - const width = dataWidth ? dataWidth : node.css(type); - if (width.endsWith('%')) node.css(type, ''); - if (width.endsWith('pt')) node.css(type, this.convertToPX(width)); - }; - const tables = root.find('table'); - if (tables.length === 0) return; - const helper = new Helper(editor); - // 判断当前是在可编辑卡片内,在可编辑卡片内不嵌套表格 - const { change } = editor; - const range = change.range.get(); - - const clearTable = (table: NodeInterface) => { - const thead = table.find('thead'); - const headTds = thead.find('th,td').toArray(); - headTds.forEach((td) => { - table.before(td.children()); - }); - const trs = table.find('tr').toArray(); - trs.forEach((tr) => { - const tds = tr.find('td').toArray(); - tds.forEach((td) => { - if (!editor.node.isEmpty(td)) table.before(td.children()); - }); - }); - const tfoot = table.find('tfoot'); - const footTds = tfoot.find('th,td').toArray(); - footTds.forEach((td) => { - table.after(td.children()); - }); - table.remove(); + const tablePlugin = editor.plugin.findPlugin('table'); + const tableOptions = tablePlugin?.options.overflow || {}; + const overflowLeftConfig = tableOptions.maxLeftWidth + ? { + onScrollX: (x: number) => { + if (this.isMaximize) x = 0; + const max = tableOptions.maxLeftWidth!(); + this.wrapper?.css( + 'margin-left', + `-${x > max ? max : x}px`, + ); + if (x > 0) { + editor.root.find('.data-card-dnd').hide(); + } else { + editor.root.find('.data-card-dnd').show(); + } + return x - max; + }, + getScrollLeft: (left: number) => { + return ( + left - + removeUnit(this.wrapper?.css('margin-left') || '0') + ); + }, + getOffsetWidth: (width: number) => { + return ( + width + + removeUnit(this.wrapper?.css('margin-left') || '0') + ); + }, + } + : undefined; + this.scrollbar = new Scrollbar( + this.viewport, + true, + false, + true, + overflowLeftConfig, + ); + this.scrollbar.setContentNode(this.viewport.find('.data-table')!); + this.scrollbar.on('display', (display: 'node' | 'block') => { + if (display === 'block') { + this.wrapper?.addClass('scrollbar-show'); + } else { + this.wrapper?.removeClass('scrollbar-show'); + } + }); + //this.scrollbar.disableScroll(); + let prevScrollData = { + x: 0, + y: 0, }; - const isClear = range.startNode.closest(EDITABLE_SELECTOR).length > 0; - tables.each((_, index) => { - let node = tables.eq(index); - if (!node) return; - if (isClear || node.parent()?.name === 'td') { - clearTable(node); - return; + const handleScrollbarChange = ({ x, y }: Record) => { + if (tableOptions['maxRightWidth']) + this.overflow(tableOptions['maxRightWidth']()); + if (prevScrollData.x === x && prevScrollData.y === y) return; + prevScrollData = { + x, + y, + }; + + if (isEngine(editor)) { + editor.trigger('scroll', this.root, { x, y }); + this.conltrollBar.refresh(); } - let trs = node.find('tr'); - trs.each((child) => { - const tr = $(child); - const display = tr.css('display'); - if (display === 'none') { - tr.remove(); - } else { - tr.css('display', ''); - } - // 不是td就用td标签包裹起来 - const childNodes = tr.children(); - childNodes.each((tdChild) => { - const td = $(tdChild); - const text = td.text(); - const childTable = td.find('table'); - if (childTable.length > 0) { - childTable.after( - document.createTextNode(childTable.text()), - ); - childTable.remove(); - } - // 排除空格 - if ( - td.name !== 'td' && - ['\n', '\r\n'].includes(text.trim()) - ) { - const newTd = $(``); - td.before(newTd); - newTd.append(td); - } - }); - }); - const dataWidth = node.attributes('data-width'); - if (dataWidth) node.css('width', dataWidth); - node = helper.normalizeTable(node); - clearWH(node); - clearWH(node, 'height'); - const tbody = node.find('tbody'); - - // 表头放在tbody最前面 - const thead = node.find('thead'); - if (thead && thead.length > 0) tbody.prepend(thead.children()); - thead.remove(); - // 表头放在tbody最前面 - const tfoot = node.find('tfoot'); - if (tfoot && tfoot.length > 0) tbody.append(tfoot.children()); - tfoot.remove(); - const ths = node.find('th'); - ths.each((_, index) => { - const th = ths.eq(index); - th?.replaceWith($(`${th.html()}`)); + }; + this.scrollbar.on('change', handleScrollbarChange); + if (!isMobile) + window.addEventListener('scroll', this.updateScrollbar, { + passive: true, }); - const tds = node.find('td'); - let fragment = getDocument().createDocumentFragment(); - tds.each((_, index) => { - fragment = getDocument().createDocumentFragment(); - const element = tds.eq(index); - if (!element) return; - clearWH(element); - clearWH(element, 'height'); - const background = element.css('background'); - if (background) element.css('background-color', background); - const valign = element.attributes('valign'); - if (valign) element.attributes('vertical-align', valign); - const children = element.children(); - for (let i = 0, len = children.length; i < len; i++) { - const child = children.eq(i); - // 移除单元格第一个和最后一个换行符,word 里面粘贴会存在,导致空行 - if ((i === 0 || i === len - 1) && child?.isText()) { - const text = child.text(); - if (/^\n(\s)*$/.test(text)) { - continue; - } - } - if (child) fragment.appendChild(child[0]); - } - // 对单元格内的内容标准化 - const fragmentNode = $(fragment); - element?.empty().append(editor.node.normalize(fragmentNode)); + window.addEventListener('resize', this.updateScrollbar); + if (isEngine(editor) && !isMobile) { + editor.scrollNode?.on('scroll', this.updateScrollbar, { + passive: true, }); - const background = - node?.css('background') || node?.css('background-color'); - if (background) tds.css('background', background); - - trs = node.find('tr'); - let rowSpan = 1; - trs.each((child) => { - const tr = $(child); - - const tds = tr?.find('td'); - if (tds?.length === 0 && rowSpan < 2) { - tr?.remove(); - } - if (tds && tds?.length > 0) { - const spans = tds - .toArray() - .map((td) => (td[0] as HTMLTableCellElement).rowSpan); - rowSpan = Math.max(...spans); - } + } + } - if (tr) { - clearWH(tr); - clearWH(tr, 'height'); - } + didRender() { + super.didRender(); + const editor = this.editor; + editor.on('undo', this.doChange); + editor.on('redo', this.doChange); + this.viewport = isEngine(editor) + ? this.wrapper?.find(Template.VIEWPORT) + : this.wrapper?.find(Template.VIEWPORT_READER); - const background = - tr?.css('background') || tr?.css('background-color'); - if (background) tds?.css('background', background); - }); - editor.nodeId.generateAll(node, true); - const children = node.allChildren(); - children.forEach((child) => { - if (editor.node.isInline(child)) { - editor.inline.repairCursor(child); - } - }); - const html = node - .get()! - .outerHTML.replace(/\n|\r\n/g, '') - .replace(/>\s+<'); - editor.card.replaceNode(node, TableComponent.cardName, { - html, - }); - node.remove(); + this.selection.init(); + this.conltrollBar.init(); + this.command.init(); + if (!isEngine(editor) || editor.readonly) + this.toolbarModel?.setOffset([0, 0]); + else this.toolbarModel?.setOffset([13, -28, 0, -6]); + const tablePlugin = editor.plugin.findPlugin('table'); + const tableOptions = tablePlugin?.options.overflow || {}; + if (this.viewport) { + this.selection.refreshModel(); + setTimeout(() => { + this.initScrollbar(); + }, 0); + } + this.selection.on('select', () => { + this.conltrollBar.refresh(false); + if (!isEngine(editor)) return; + const align = this.selection.getSingleCell()?.css('vertical-align'); + this.updateAlignText(align as any); + this.toolbarModel?.update(); }); - }; - parseHtml = ( - root: NodeInterface, - callback?: (node: NodeInterface, value: TableValue) => NodeInterface, - ) => { - const editor = this.editor; - const results: NodeInterface[] = []; - root.find( - `[${CARD_KEY}="${TableComponent.cardName}"],[${READY_CARD_KEY}="${TableComponent.cardName}"]`, - ).each((tableNode) => { - const node = $(tableNode); - let table = node.find('table'); - const value = decodeCardValue( - node.attributes(CARD_VALUE_KEY), - ); - if (table.length === 0) { - if (!value || !value.html) return; - // 表格值里面的卡片都是没有被转换过的,所以需要先把卡片转换过来 - table = $(transformCustomTags(value.html)); - if (table.length === 0) { - node.remove(); - return; - } else { - editor.trigger('parse:html', table); - } + this.conltrollBar.on('sizeChanged', () => { + this.selection.refreshModel(); + this.onChange(); + this.scrollbar?.refresh(); + }); + this.conltrollBar.on('sizeChanging', () => { + this.scrollbar?.refresh(); + editor.trigger('editor:resize'); + this.updateScrollbar(); + }); + this.command.on('actioned', (action, silence) => { + if (action === 'paste') { + editor.card.render(this.wrapper); } - const width = table.attributes('width') || table.css('width'); - table.css({ - outline: 'none', - 'border-collapse': 'collapse', - width: '100%', - }); - table.attributes('data-width', width); - const tds = table.find('td'); - tds.each((_, index) => { - const tdElement = tds.eq(index); - tdElement?.css({ - 'min-width': 'auto', - 'white-space': 'flat', - 'word-wrap': 'break-word', - margin: '4px 8px', - border: !!table.attributes('data-table-no-border') - ? '0 none' - : '1px solid #d9d9d9', - padding: '4px 8px', - cursor: 'default', - 'vertical-align': tdElement.css('vertical-align') || 'top', - }); - }); - table.find(Template.TABLE_TD_BG_CLASS).remove(); - table.find(Template.TABLE_TD_CONTENT_CLASS).each((content) => { - editor.node.unwrap($(content)); - }); - if (callback) { - table = callback(table, value); + if (['splitCell', 'mergeCell'].includes(action)) { + editor.trigger('editor:resize'); + } + this.selection.render(action); + this.toolbarModel?.update(); + if (!silence) { + this.onChange(); } + if (tableOptions.maxRightWidth) + this.overflow(tableOptions.maxRightWidth()); + this.scrollbar?.refresh(); + }); - //添加table的容器id; table 添加外部包裹div;用于table过长导致 文本溢出 - const tableId = table.attributes('data-id') + '-table'; - table = $( - `
`, - ).append(table); + const tableRoot = this.wrapper?.find(Template.TABLE_CLASS); + if (!tableRoot) return; + const value = super.getValue(); + if (!value?.html) { + const tableValue = this.getValue(); + if (tableValue && isEngine(editor)) this.setValue(tableValue); + this.onChange(); + } + if (tableOptions.maxRightWidth) + this.overflow(tableOptions.maxRightWidth()); + } + private remoteRefreshTimeout: NodeJS.Timeout | null = null; - node.replaceWith(table); - results.push(table); + remoteRefresh() { + if ( + !this.wrapper || + this.wrapper.length === 0 || + !(this.wrapper[0].parentElement ?? this.wrapper[0].parentNode) + ) + return; + // 重新绘制列头部和行头部 + const colsHeader = this.wrapper.find(Template.COLS_HEADER_CLASS); + const superValue = super.getValue(); + let colItems = colsHeader.find(Template.COLS_HEADER_ITEM_CLASS); + const colCount = colItems.length; + if (superValue.cols > colCount) { + colsHeader.append( + $( + this.template.renderColsHeader(superValue.cols - colCount), + ).find(Template.COLS_HEADER_ITEM_CLASS), + ); + colItems = colsHeader.find(Template.COLS_HEADER_ITEM_CLASS); + } else if (superValue.cols < colCount) { + for (let i = colCount; i > superValue.cols; i--) { + colItems.eq(i - 1)?.remove(); + } + } + const table = superValue.html + ? $(superValue.html) + : this.wrapper.find('table'); + const colElements = table.find('col').toArray(); + colElements.forEach((colElement, index) => { + const width = + colElement.attributes('width') || colElement.css('width'); + colItems + .eq(index) + ?.css( + 'width', + `${Math.max(parseInt(width), this.colMinWidth)}px`, + ); }); - return results; - }; - markdownIt = (mardown: MarkdownIt) => { - if (this.options.markdown !== false) { - mardown.enable('table'); + const rowsHeader = this.wrapper.find(Template.ROWS_HEADER_CLASS); + let rowItems = rowsHeader.find(Template.ROWS_HEADER_ITEM_CLASS); + const rowCount = rowItems.length; + if (superValue.rows > rowCount) { + rowsHeader.append( + $( + this.template.renderRowsHeader(superValue.rows - rowCount), + ).find(Template.ROWS_HEADER_ITEM_CLASS), + ); + rowItems = rowsHeader.find(Template.ROWS_HEADER_ITEM_CLASS); + } else if (superValue.rows < rowCount) { + for (let i = rowCount; i > superValue.rows; i--) { + rowItems.eq(i - 1)?.remove(); + } } - }; + const rowElements = table.find('tr').toArray(); + rowElements.forEach((rowElement, index) => { + rowItems + .eq(index) + ?.css( + 'height', + Math.max( + parseInt(rowElement.css('width')), + this.rowMinHeight, + ), + ); + }); + // this.conltrollBar.refresh(); + this.scrollbar?.refresh(); + if (this.remoteRefreshTimeout) clearTimeout(this.remoteRefreshTimeout); + this.remoteRefreshTimeout = setTimeout(() => { + // 找到所有可编辑节点,对没有 contenteditable 属性的节点添加contenteditable一下 + this.wrapper?.find(EDITABLE_SELECTOR).each((editableNode) => { + const editableElement = editableNode as Element; + if (!editableElement.hasAttribute(DATA_CONTENTEDITABLE_KEY)) { + editableElement.setAttribute( + DATA_CONTENTEDITABLE_KEY, + this.template.isReadonly ? 'false' : 'true', + ); + } + }); + }, 10); + } + + render() { + const editor = this.editor; + this.template.isReadonly = !isEngine(editor) || editor.readonly; + // 重新渲染 + if ( + this.wrapper && + this.wrapper.length > 0 && + !!(this.wrapper[0].parentElement ?? this.wrapper[0].parentNode) + ) { + this.remoteRefresh(); + return; + } + const value = this.getValue(); + // 第一次渲染 + if (!value) return 'Error value'; + if (value.html) { + let table: NodeInterface | undefined = $(value.html); + if (table && table.name !== 'table') { + table = table.toArray().find((child) => child.name === 'table'); + if (!table) { + value.html = `
${value.html}
`; + table = $(value.html); + } else { + value.html = table.get()!.outerHTML; + } + } + const model = this.helper.getTableModel(table); + value.rows = model.rows; + value.cols = model.cols; + } + //渲染卡片 + this.wrapper = isEngine(editor) + ? $( + this.template.htmlEdit( + value, + menuData(editor.language.get('table')), + ), + ) + : $(this.template.htmlView(value)); + if (!isEngine(editor)) { + this.wrapper + .find('table') + .addClass('data-table') + .addClass('data-table-view'); + } + value.rows = this.wrapper.find('tr').length; + if (value.width) + this.wrapper.find('table').css('width', `${value.width}px`); + return this.wrapper; + } destroy() { + super.destroy(); const editor = this.editor; - editor.off('parse:html', this.parseHtml); - editor.off('paste:each-after', this.pasteHtml); - editor.off('paste:schema', this.pasteSchema); - editor.off('markdown-it', this.markdownIt); + window.removeEventListener('scroll', this.updateScrollbar); + window.removeEventListener('resize', this.updateScrollbar); + editor.scrollNode?.off('scroll', this.updateScrollbar); + this.scrollbar?.destroy(); + this.command.removeAllListeners(); + const selection = this.selection; + selection.removeAllListeners(); + selection.destroy(); + const bar = this.conltrollBar; + bar.removeAllListeners(); + bar.destroy(); + editor.off('undo', this.doChange); + editor.off('redo', this.doChange); } } -export default Table; +export default TableComponent; -export { TableComponent }; -export type { TableValue, TableOptions }; +export { Template, Helper }; diff --git a/plugins/tag/package.json b/plugins/tag/package.json index c9d126bc..9c3ab9d4 100644 --- a/plugins/tag/package.json +++ b/plugins/tag/package.json @@ -24,14 +24,14 @@ "lodash": "^4.17.21" }, "devDependencies": { - "antd": "^5.0.0-rc.3", + "antd": "^5.3.2", "react": "^17.0.0", "react-dom": "^17.0.0" }, "peerDependencies": { "@aomao/engine": ">=^2.9", "@types/lodash": "^4.14.178", - "antd": "^5.0.0-rc.3", + "antd": "^5.3.2", "react": ">=17.0.0", "react-dom": ">=17.0.0" } From b5c76246c22dfca43ee3e43cf62131ba97868d12 Mon Sep 17 00:00:00 2001 From: Beeant Date: Sun, 26 Mar 2023 06:52:40 +0000 Subject: [PATCH 6/7] fix: merge error file --- plugins/table/src/index.ts | 1492 ++++++++++++------------------------ 1 file changed, 502 insertions(+), 990 deletions(-) diff --git a/plugins/table/src/index.ts b/plugins/table/src/index.ts index 12192ba2..95996c99 100644 --- a/plugins/table/src/index.ts +++ b/plugins/table/src/index.ts @@ -1,1057 +1,569 @@ import { $, - Card, - CardToolbarItemOptions, - CardType, - closest, - DATA_CONTENTEDITABLE_KEY, - DATA_ELEMENT, + CARD_KEY, EDITABLE_SELECTOR, - getComputedStyle, isEngine, - isMobile, NodeInterface, - Parser, - RangeInterface, - removeUnit, - Scrollbar, - SelectStyleType, - ToolbarItemOptions, + Plugin, + SchemaBlock, + SchemaInterface, + getDocument, + READY_CARD_KEY, + decodeCardValue, + CARD_VALUE_KEY, + transformCustomTags, + DATA_ID, } from '@aomao/engine'; -import { - ControllBarInterface, - HelperInterface, - TableCommandInterface, - TableInterface, - TableOptions, - TableSelectionInterface, - TableValue, - TemplateInterface, -} from '../types'; -import Helper from './helper'; -import Template from './template'; -import menuData from './menu'; -import ControllBar from './controllbar'; -import TableSelection from './selection'; -import TableCommand from './command'; -import { ColorTool, Palette } from './toolbar'; - -class TableComponent - extends Card - implements TableInterface -{ - readonly contenteditable: string[] = [ - `div${Template.TABLE_TD_CONTENT_CLASS}`, - ]; - - static get cardName() { +import type MarkdownIt from 'markdown-it'; +import TableComponent, { Template, Helper } from './component'; +import locales from './locale'; +import { TableInterface, TableOptions, TableValue } from './types'; +import './index.css'; +class Table extends Plugin { + static get pluginName() { return 'table'; } - static get cardType() { - return CardType.BLOCK; - } - - static get selectStyleType() { - return SelectStyleType.BACKGROUND; - } - - static get autoSelected() { - return false; - } - - static get lazyRender() { - return true; - } - - static colors = Palette.getColors().map((group) => - group.map((color) => { - return { color, border: Palette.getStroke(color) }; - }), - ); - - colMinWidth = - this.editor.plugin.findPlugin('table')?.options - .colMinWidth || 40; - rowMinHeight = - this.editor.plugin.findPlugin('table')?.options - .rowMinHeight || 35; - maxInsertNum = - this.editor.plugin.findPlugin('table')?.options - .maxInsertNum || 30; - wrapper?: NodeInterface; - helper: HelperInterface = new Helper(this.editor); - template: TemplateInterface = new Template(this); - selection: TableSelectionInterface = new TableSelection(this.editor, this); - conltrollBar: ControllBarInterface = new ControllBar(this.editor, this, { - col_min_width: this.colMinWidth, - row_min_height: this.rowMinHeight, - max_insert_num: this.maxInsertNum, - }); - command: TableCommandInterface = new TableCommand(this.editor, this); - scrollbar?: Scrollbar; - viewport?: NodeInterface; - colorTool?: ColorTool; - noBorderToolButton?: NodeInterface; - alignToolButton?: NodeInterface; - #changeTimeout?: NodeJS.Timeout; - init() { - super.init(); const editor = this.editor; - if (isEngine(editor)) { - // tab 键选择 - if (!editor.event.listeners['keydown:tab']) - editor.event.listeners['keydown:tab'] = []; - editor.event.listeners['keydown:tab'].unshift( - (event: KeyboardEvent) => { - if (!isEngine(editor) || editor.readonly) return; - const { change, block, node, card } = editor; - - const range = change.range.get(); - const td = range.endNode.closest('td'); - if (td.length === 0 || !td.inEditor()) return; - const component = card.closest(td, true); - if (!component?.equal(this.root)) return; - const closestBlock = block.closest(range.endNode); - if ( - td.length > 0 && - (block.isLastOffset(range, 'end') || - (closestBlock.name !== 'li' && - node.isEmptyWidthChild(closestBlock))) - ) { - let next = td.next(); - if (!next) { - const nextRow = td.parent()?.next(); - // 最后一行,最后一列 - if (!nextRow) { - // 新建一行 - this.command.insertRowDown(); - next = - td - .parent() - ?.next() - ?.find('td:first-child') || null; - } else { - next = nextRow.find('td:first-child') || null; - } - } - if (next) { - event.preventDefault(); - this.selection.focusCell(next); - return false; - } - } - if (td.length > 0) { - setTimeout(() => { - this.scrollbar?.refresh(); - }, 0); - } - return; - }, - ); - // 下键选择 - editor.on('keydown:down', (event) => { - if (!isEngine(editor) || editor.readonly) return; - const { change, card } = editor; - - const range = change.range.get(); - const td = range.endNode.closest('td'); - if (td.length === 0 || !td.inEditor()) return; - const component = card.closest(td, true); - if (!component?.equal(this.root)) return; - const contentElement = td.find('.table-main-content'); - if (!contentElement) return; - const tdRect = contentElement - .get()! - .getBoundingClientRect(); - const rangeRect = range.getBoundingClientRect(); - if ( - td.length > 0 && - (rangeRect.bottom === 0 || - tdRect.bottom - rangeRect.bottom < 10) - ) { - const index = td.index(); - const nextRow = td.parent()?.next(); - if (nextRow) { - let nextIndex = 0; - let nextTd = nextRow.find('td:last-child'); - this.selection.tableModel?.table[nextRow.index()].some( - (cell) => { - if ( - !this.helper.isEmptyModelCol(cell) && - nextIndex >= index && - cell.element - ) { - nextTd = $(cell.element); - return true; - } - nextIndex++; - return false; - }, - ); - if (nextTd) { - event.preventDefault(); - this.selection.focusCell(nextTd, true); - return false; - } - } else { - event.preventDefault(); - const cloneRange = range.cloneRange(); - const next = this.root.next(); - const cardComponent = next - ? card.find(next) - : undefined; - if (cardComponent?.onSelectDown) { - cardComponent.onSelectDown(event); - } else { - card.focusNextBlock(this, cloneRange, false); - change.range.select(cloneRange); - } - return false; - } - } - if (td.length > 0) { - setTimeout(() => { - this.scrollbar?.refresh(); - }, 0); - } - return; - }); - // 上键选择 - editor.on('keydown:up', (event) => { - if (!isEngine(editor) || editor.readonly) return; - const { change, card } = editor; - - const range = change.range.get(); - const td = range.endNode.closest('td'); - if (td.length === 0 || !td.inEditor()) return; - const component = card.closest(td, true); - if (!component?.equal(this.root)) return; - const contentElement = td.find('.table-main-content'); - if (!contentElement) return; - const tdRect = contentElement - .get()! - .getBoundingClientRect(); - const rangeRect = range.getBoundingClientRect(); - if ( - td.length > 0 && - (rangeRect.top === 0 || rangeRect.top - tdRect.top < 10) - ) { - const index = td.index(); - const prevRow = td.parent()?.prev(); - if (prevRow) { - let prevIndex = 0; - let prevTd = prevRow.find('td:first-child'); - this.selection.tableModel?.table[prevRow.index()].some( - (cell) => { - if ( - !this.helper.isEmptyModelCol(cell) && - prevIndex >= index && - cell.element - ) { - prevTd = $(cell.element); - return true; - } - prevIndex++; - return false; - }, - ); - if (prevTd) { - event.preventDefault(); - this.selection.focusCell(prevTd); - return false; - } - } else { - event.preventDefault(); - const cloneRange = range.cloneRange(); - const prev = this.root.prev(); - const cardComponent = prev - ? card.find(prev) - : undefined; - if (cardComponent?.onSelectUp) { - cardComponent.onSelectUp(event); - } else { - card.focusPrevBlock(this, cloneRange, false); - change.range.select(cloneRange); - } - return false; - } - } - if (td.length > 0) { - setTimeout(() => { - this.scrollbar?.refresh(); - }, 0); - } - return; - }); - // 左键选择 - editor.on('keydown:left', () => { - if (!isEngine(editor) || editor.readonly) return; - const { change, card } = editor; - - const range = change.range.get(); - const td = range.endNode.closest('td'); - if (td.length === 0 || !td.inEditor()) return; - const component = card.closest(td, true); - if (!component?.equal(this.root)) return; - const contentElement = td.find('.table-main-content'); - if (!contentElement) return; - if (td.length > 0) { - setTimeout(() => { - this.scrollbar?.refresh(); - }, 0); - } - }); - // 右键选择 - editor.on('keydown:right', () => { - if (!isEngine(editor) || editor.readonly) return; - const { change, card } = editor; - - const range = change.range.get(); - const td = range.endNode.closest('td'); - if (td.length === 0 || !td.inEditor()) return; - const component = card.closest(td, true); - if (!component?.equal(this.root)) return; - const contentElement = td.find('.table-main-content'); - if (!contentElement) return; - if (td.length > 0) { - setTimeout(() => { - this.scrollbar?.refresh(); - }, 0); - } - }); + if (!this.options.colMinWidth) { + this.options.colMinWidth = 40; } - if (this.colorTool) return; - this.colorTool = new ColorTool(editor, this.id, { - colors: TableComponent.colors, - defaultColor: super.getValue()?.color, - onChange: (color: string) => { - this.conltrollBar.drawBackgroundColor(color); - const value = this.getValue(); - this.setValue({ ...value, color }); - }, - }); - } - - doChange = () => { - this.remoteRefresh(); - this.handleChange('local'); - }; - - toolbar(): (ToolbarItemOptions | CardToolbarItemOptions)[] { - const editor = this.editor; - const getItems = (): ( - | ToolbarItemOptions - | CardToolbarItemOptions - )[] => { - if (!isEngine(editor) || editor.readonly) - return [ - { - key: 'maximize', - type: 'maximize', - }, - ]; - const language = editor.language.get('table'); - const funBtns: Array = - [ - { - key: 'color', - type: 'node', - title: editor.language.get( - 'table', - 'color', - 'title', - ), - node: this.colorTool!.getButton(), - }, - { - key: 'border', - type: 'button', - title: super.getValue()?.noBorder - ? language['showBorder'] - : language['noBorder'], - content: - '', - didMount: (node) => { - const value = super.getValue(); - if (value?.noBorder === true) { - node.addClass('active'); - } - this.noBorderToolButton = node; - }, - onClick: (_, node) => { - const value = super.getValue(); - this.setValue({ - noBorder: !value?.noBorder, - } as V); - const table = this.wrapper?.find('.data-table'); - if (value?.noBorder === true) { - table?.removeAttributes('data-table-no-border'); - node.removeClass('active'); - } else { - table?.attributes( - 'data-table-no-border', - 'true', - ); - node.addClass('active'); - } - }, - }, - { - key: 'align', - type: 'dropdown', - content: - '', - title: language['verticalAlign']['title'], - didMount: (node) => { - this.alignToolButton = - node.find('.data-toolbar-btn'); - }, - items: [ - { - type: 'button', - content: ` ${language['verticalAlign']['top']}`, - onClick: (event: MouseEvent) => - this.updateAlign(event, 'top'), - }, - { - type: 'button', - content: ` ${language['verticalAlign']['middle']}`, - onClick: (event: MouseEvent) => - this.updateAlign(event, 'middle'), - }, - { - type: 'button', - content: ` ${language['verticalAlign']['bottom']}`, - onClick: (event: MouseEvent) => - this.updateAlign(event, 'bottom'), - }, - ], - }, - { - key: 'merge', - type: 'button', - title: language['mergeCell'], - content: - '', - disabled: - this.conltrollBar.getMenuDisabled('mergeCell'), - onClick: () => { - this.command.mergeCell(); - }, - }, - { - key: 'split', - type: 'button', - title: language['splitCell'], - content: - '', - disabled: - this.conltrollBar.getMenuDisabled('splitCell'), - onClick: () => { - this.command.splitCell(); - }, - }, - ]; - if (this.isMaximize) return funBtns; - const toolbars: Array = - [ - { - key: 'maximize', - type: 'maximize', - }, - { - key: 'copy', - type: 'copy', - onClick: () => { - this.command.copy(true); - editor.messageSuccess( - 'copy', - editor.language.get('copy', 'success'), - ); - }, - }, - { - key: 'delete', - type: 'delete', - }, - { - key: 'separator', - type: 'separator', - }, - ...funBtns, - ]; - if (removeUnit(this.wrapper?.css('margin-left') || '0') === 0) { - toolbars.unshift({ - key: 'dnd', - type: 'dnd', - }); - } - return toolbars; - }; - const options = - editor.plugin.findPlugin('table')?.options; - if (options?.cardToolbars) { - return options.cardToolbars(getItems(), this.editor); + if (!this.options.rowMinHeight) { + this.options.rowMinHeight = 30; } - return getItems(); - } - - onSelectLeft(event: KeyboardEvent) { - const { tableModel } = this.selection; - if (!tableModel) return; - for (let r = tableModel.rows - 1; r >= 0; r--) { - for (let c = tableModel.cols - 1; c >= 0; c--) { - const cell = tableModel.table[r][c]; - if (!this.helper.isEmptyModelCol(cell) && cell.element) { - event.preventDefault(); - this.selection.focusCell(cell.element, false); - return false; - } - } + editor.language.add(locales); + editor.schema.add(this.schema()); + editor.conversion.add('th', 'td'); + editor.on('parse:html', this.parseHtml); + editor.on('paste:each', this.pasteEach); + editor.on('paste:each-after', this.pasteHtml); + editor.on('paste:schema', this.pasteSchema); + if (isEngine(editor)) { + this.editor.on('markdown-it', this.markdownIt); + editor.change.event.onDocument('copy', this.onCopy, 0); + editor.change.event.onDocument('cut', this.onCut, 0); + editor.change.event.onDocument('paste', this.onPaste, 0); } - return; } - onSelectRight(event: KeyboardEvent) { - const { tableModel } = this.selection; - if (!tableModel) return; - for (let r = 0; r < tableModel.rows; r++) { - for (let c = 0; c < tableModel.cols; c++) { - const cell = tableModel.table[r][c]; - if (!this.helper.isEmptyModelCol(cell) && cell.element) { - event.preventDefault(); - this.selection.focusCell(cell.element); - return false; - } + onCopy = (event: ClipboardEvent) => { + const editor = this.editor; + if (!isEngine(editor)) return true; + const { change, card } = editor; + const range = change.range.get(); + const component = card.find( + range.commonAncestorNode, + true, + ); + if ( + component && + component.name === TableComponent.cardName && + !component.isCursor(range.startNode) + ) { + const nodes = component.getSelectionNodes(); + if (nodes.length > 1) { + event.preventDefault(); + component.command.copy(); + editor.messageSuccess( + 'copy', + editor.language.get('copy', 'success'), + ); + return false; } } - return; - } + return true; + }; - onSelectUp(event: KeyboardEvent) { - const { tableModel } = this.selection; - if (!tableModel) return; - for (let r = tableModel.rows - 1; r >= 0; r--) { - for (let c = 0; c < tableModel.cols; c++) { - const cell = tableModel.table[r][c]; - if (!this.helper.isEmptyModelCol(cell) && cell.element) { - event.preventDefault(); - this.selection.focusCell(cell.element, false); - return false; - } + onCut = (event: ClipboardEvent) => { + const editor = this.editor; + if (!isEngine(editor) || editor.readonly) return true; + const { change, card } = editor; + const range = change.range.get(); + const component = card.find( + range.commonAncestorNode, + true, + ); + if ( + component && + component.name === TableComponent.cardName && + !component.isCursor(range.startNode) + ) { + const nodes = component.getSelectionNodes(); + if (nodes.length > 1) { + event.preventDefault(); + component.command.cut(); + return false; } } - return; - } + return true; + }; - onSelectDown(event: KeyboardEvent) { - const { tableModel } = this.selection; - if (!tableModel) return; - for (let r = 0; r < tableModel.rows; r++) { - for (let c = 0; c < tableModel.cols; c++) { - const cell = tableModel.table[r][c]; - if (!this.helper.isEmptyModelCol(cell) && cell.element) { - event.preventDefault(); - this.selection.focusCell(cell.element); - return false; - } + onPaste = (event: ClipboardEvent) => { + const editor = this.editor; + if (!isEngine(editor) || editor.readonly) return true; + const { change, card } = editor; + const range = change.range.get(); + const component = card.find( + range.commonAncestorNode, + true, + ); + if ( + component && + component.name === TableComponent.cardName && + !component.isCursor(range.startNode) + ) { + const data = editor.clipboard.getData(event); + if ( + !data || + !//gi.test( + data.html || '', + ) + ) { + return true; } + event.preventDefault(); + component.command.paste(data); + return false; } - return; - } + return true; + }; - updateAlign(event: MouseEvent, align: 'top' | 'middle' | 'bottom' = 'top') { - event.preventDefault(); - this.conltrollBar.setAlign(align); - this.onChange('local'); - this.updateAlignText(align); + hotkey() { + return this.options.hotkey || ''; } - updateAlignText(align: 'top' | 'middle' | 'bottom' = 'top') { - const alignHtml = ``; - this.alignToolButton?.html(alignHtml); + schema(): Array { + return [ + { + name: 'table', + type: 'block', + attributes: { + class: ['data-table'], + 'data-table-no-border': '*', + style: { + width: '@length', + }, + }, + }, + { + name: 'colgroup', + type: 'block', + allowIn: ['table'], + }, + { + name: 'col', + type: 'block', + isVoid: true, + attributes: { + width: '@number', + span: '@number', + }, + allowIn: ['colgroup'], + }, + { + name: 'thead', + type: 'block', + allowIn: ['table'], + }, + { + name: 'tbody', + type: 'block', + allowIn: ['table'], + }, + { + name: 'tr', + type: 'block', + attributes: { + style: { + height: '@length', + }, + }, + allowIn: ['tbody', 'thead', 'tfoot'], + }, + { + name: 'td', + type: 'block', + attributes: { + colspan: '@number', + rowspan: '@number', + class: [ + 'table-last-column', + 'table-last-row', + 'table-last-column', + 'table-cell-selection', + ], + style: { + 'background-color': '@color', + 'vertical-align': ['top', 'middle', 'bottom'], + }, + }, + allowIn: ['tr'], + }, + { + name: 'th', + type: 'block', + attributes: { + colspan: '@number', + rowspan: '@number', + }, + allowIn: ['tr'], + }, + ]; } - getValue() { - const value = super.getValue(); - if (!this.wrapper) return value; - const tableRoot = this.wrapper.find(Template.TABLE_CLASS); - if (!tableRoot) return value; - const { tableModel } = this.selection; - if (!tableModel) return value; - const editor = this.editor; - const { schema, conversion } = editor; - const container = $('
'); - container.append(tableRoot.clone(true)); - const parser = new Parser(container, editor, (node) => { - node.find(Template.TABLE_TD_BG_CLASS).remove(); - node.find(EDITABLE_SELECTOR).each((root) => { - if (root.nodeName === 'TD') { - $(root).removeAttributes(DATA_ELEMENT); - } else editor.node.unwrap($(root)); - }); + pasteSchema = (schema: SchemaInterface) => { + (schema.data.blocks as SchemaBlock[]).forEach((blockSchema) => { + if (!blockSchema.allowIn) { + blockSchema.allowIn = []; + } + if (blockSchema.allowIn.indexOf('td') < 0) { + blockSchema.allowIn.push('td'); + } }); - const { rows, cols, height, width } = tableModel; - const html = parser.toValue(schema, conversion, false, false); - if (!isEngine(editor)) return { ...value, html }; - return { - ...value, - rows, - cols, - height, - width, - html, - } as V; - } - - drawBackground?( - node: NodeInterface, - range: RangeInterface, - ): DOMRect | void | false | RangeInterface[] { - const backgroundRect = node.get()!.getBoundingClientRect(); - const domRect = new DOMRect(backgroundRect.x, backgroundRect.y, 0, 0); - const { startContainer, endContainer } = range; - const startElement = closest(startContainer, 'td'); - const endElement = closest(endContainer, 'td'); - if ( - !(startElement instanceof Element) || - !(endElement instanceof Element) || - startElement.nodeName !== 'TD' || - endElement?.nodeName !== 'TD' || - startElement === endElement - ) - return; - - const startRect = startElement.getBoundingClientRect(); - const endRect = endElement.getBoundingClientRect(); - const viewportRect = this.viewport?.getBoundingClientRect(); - const vLeft = (viewportRect?.left || 0) + (this.activated ? 13 : 0); - domRect.x = Math.max( - startRect.left - backgroundRect.left, - vLeft - (this.editor.root.getBoundingClientRect()?.left || 0), - ); - domRect.y = startRect.top - backgroundRect.top; - domRect.width = - (viewportRect - ? Math.min(endRect.right, viewportRect.right) - : endRect.right) - startRect.left; - domRect.height = startRect.bottom - startRect.top; - if (domRect.width < 0) domRect.width = 0; - domRect.height = endRect.bottom - startRect.top; - return domRect; - } - - activate(activated: boolean) { - super.activate(activated); - if (activated) { - this.conltrollBar.refresh(); - this.wrapper?.addClass('active'); + const table = schema.find((r) => r.name === 'table')[0]; + table.attributes = { + class: ['data-table'], + 'data-table-no-border': '*', + 'data-width': '@length', + style: { + width: '@length', + background: '@color', + 'background-color': '@color', + }, + }; + const allowIn = (table as SchemaBlock).allowIn; + if (!allowIn) { + (table as SchemaBlock).allowIn = ['div']; } else { - this.selection.clearSelect(); - this.conltrollBar.hideContextMenu(); - this.wrapper?.removeClass('active'); - } - this.scrollbar?.refresh(); - } - - handleChange = (trigger: 'remote' | 'local' = 'local') => { - const editor = this.editor; - this.conltrollBar.refresh(); - this.selection.render('change'); - const oldValue = super.getValue(); - if (oldValue?.noBorder) { - this.noBorderToolButton?.addClass('active'); - } else this.noBorderToolButton?.removeClass('active'); - if (trigger === 'local' && isEngine(editor)) { - const value = this.getValue(); - if (value) this.setValue(value); + allowIn.push('div'); } + schema.find((r) => r.name === 'div')[0].attributes = { + class: { required: true, value: ['editor-table-wrapper'] }, + }; + schema.find((r) => r.name === 'tr')[0].attributes = { + class: ['data-table'], + 'data-table-no-border': '*', + style: { + height: '@length', + background: '@color', + 'background-color': '@color', + display: '*', + }, + }; + schema.find((r) => r.name === 'td')[0].attributes = { + colspan: '@number', + rowspan: '@number', + class: [ + 'table-last-column', + 'table-last-row', + 'table-last-column', + 'table-cell-selection', + ], + style: { + 'background-color': '@color', + background: '@color', + 'vertical-align': ['top', 'middle', 'bottom'], + valign: ['top', 'middle', 'bottom'], + }, + }; }; - onChange = (trigger: 'remote' | 'local' = 'local') => { + execute(rows?: number, cols?: number): void { const editor = this.editor; - if ( - isEngine(editor) && - trigger === 'local' && - editor.model.mutation.isStopped - ) - return; - if (this.#changeTimeout) clearTimeout(this.#changeTimeout); - this.#changeTimeout = setTimeout(() => { - this.handleChange(trigger); - if (trigger === 'remote') { - this.remoteRefresh(); - } - }, 50); - }; - - maximize() { - super.maximize(); - this.scrollbar?.refresh(); - const { editor } = this; - if (isEngine(editor) && !isMobile) { - this.getCenter().on('scroll', this.updateScrollbar, { - passive: true, - }); - } - } - - minimize() { - super.minimize(); - this.scrollbar?.refresh(); - this.getCenter().off('scroll', this.updateScrollbar); - } - - getSelectionNodes() { - const nodes: Array = []; - this.selection.each((cell) => { - if (!this.helper.isEmptyModelCol(cell) && cell.element) { - nodes.push($(cell.element).find(EDITABLE_SELECTOR)); - } + if (!isEngine(editor)) return; + //可编辑子区域内不插入表格 + const { change } = editor; + const range = change.range.get(); + if (range.startNode.closest(EDITABLE_SELECTOR).length > 0) return; + //插入表格 + editor.card.insert(TableComponent.cardName, { + rows: rows || 3, + cols: cols || 3, + overflow: !!this.options.overflow, }); - // 如果值选中了一个单元格,并且不是拖蓝方式选中就返回空的 - if ( - nodes.length === 1 && - nodes[0].closest('[table-cell-selection=true]').length === 0 - ) - return []; - return nodes; } - overflow(max: number) { - // 表格宽度 - const tableWidth = this.wrapper?.find('.data-table')?.width() || 0; - const rootWidth = this.getCenter().width(); - // 溢出的宽度 - const overflowWidth = tableWidth - rootWidth; - if (overflowWidth > 0 && !this.isMaximize) { - this.wrapper?.css( - 'margin-right', - `-${overflowWidth > max ? max : overflowWidth}px`, + convertToPX(value: string) { + const match = /([\d\.]+)(pt|px)$/i.exec(value); + if (match && match[2] === 'pt') { + return ( + String(Math.round((parseInt(match[1], 10) * 96) / 72)) + 'px' ); - } else if (overflowWidth < 0 || this.isMaximize) { - this.wrapper?.css('margin-right', ''); } + return value; } - updateScrollbar = () => { - if (!this.scrollbar) return; - const hideHeight = - (this.wrapper?.getBoundingClientRect()?.bottom || 0) - - (this.wrapper?.getViewport().bottom || 0); - this.wrapper?.find('.data-scrollbar-x').css({ - bottom: `${hideHeight > 0 ? hideHeight + 2 : 0}px`, - }); + pasteEach = (node: NodeInterface) => { + if ( + node.name === 'div' && + node.hasClass('editor-table-wrapper') && + node.first()?.name === 'table' + ) { + this.editor.node.unwrap(node); + } }; - initScrollbar() { - if (!this.viewport) return; + pasteHtml = (root: NodeInterface) => { const editor = this.editor; - const tablePlugin = editor.plugin.findPlugin('table'); - const tableOptions = tablePlugin?.options.overflow || {}; - const overflowLeftConfig = tableOptions.maxLeftWidth - ? { - onScrollX: (x: number) => { - if (this.isMaximize) x = 0; - const max = tableOptions.maxLeftWidth!(); - this.wrapper?.css( - 'margin-left', - `-${x > max ? max : x}px`, - ); - if (x > 0) { - editor.root.find('.data-card-dnd').hide(); - } else { - editor.root.find('.data-card-dnd').show(); - } - return x - max; - }, - getScrollLeft: (left: number) => { - return ( - left - - removeUnit(this.wrapper?.css('margin-left') || '0') - ); - }, - getOffsetWidth: (width: number) => { - return ( - width + - removeUnit(this.wrapper?.css('margin-left') || '0') - ); - }, - } - : undefined; - this.scrollbar = new Scrollbar( - this.viewport, - true, - false, - true, - overflowLeftConfig, - ); - this.scrollbar.setContentNode(this.viewport.find('.data-table')!); - this.scrollbar.on('display', (display: 'node' | 'block') => { - if (display === 'block') { - this.wrapper?.addClass('scrollbar-show'); - } else { - this.wrapper?.removeClass('scrollbar-show'); - } - }); - //this.scrollbar.disableScroll(); - let prevScrollData = { - x: 0, - y: 0, + if (!isEngine(editor)) return; + const clearWH = ( + node: NodeInterface, + type: 'width' | 'height' = 'width', + ) => { + const dataWidth = node.attributes('data-width'); + const width = dataWidth ? dataWidth : node.css(type); + if (width.endsWith('%')) node.css(type, ''); + if (width.endsWith('pt')) node.css(type, this.convertToPX(width)); }; - const handleScrollbarChange = ({ x, y }: Record) => { - if (tableOptions['maxRightWidth']) - this.overflow(tableOptions['maxRightWidth']()); - if (prevScrollData.x === x && prevScrollData.y === y) return; - prevScrollData = { - x, - y, - }; - - if (isEngine(editor)) { - editor.trigger('scroll', this.root, { x, y }); - this.conltrollBar.refresh(); - } + const tables = root.find('table'); + if (tables.length === 0) return; + const helper = new Helper(editor); + // 判断当前是在可编辑卡片内,在可编辑卡片内不嵌套表格 + const { change } = editor; + const range = change.range.get(); + + const clearTable = (table: NodeInterface) => { + const thead = table.find('thead'); + const headTds = thead.find('th,td').toArray(); + headTds.forEach((td) => { + table.before(td.children()); + }); + const trs = table.find('tr').toArray(); + trs.forEach((tr) => { + const tds = tr.find('td').toArray(); + tds.forEach((td) => { + if (!editor.node.isEmpty(td)) table.before(td.children()); + }); + }); + const tfoot = table.find('tfoot'); + const footTds = tfoot.find('th,td').toArray(); + footTds.forEach((td) => { + table.after(td.children()); + }); + table.remove(); }; - this.scrollbar.on('change', handleScrollbarChange); - if (!isMobile) - window.addEventListener('scroll', this.updateScrollbar, { - passive: true, + const isClear = range.startNode.closest(EDITABLE_SELECTOR).length > 0; + tables.each((_, index) => { + let node = tables.eq(index); + if (!node) return; + if (isClear || node.parent()?.name === 'td') { + clearTable(node); + return; + } + let trs = node.find('tr'); + trs.each((child) => { + const tr = $(child); + const display = tr.css('display'); + if (display === 'none') { + tr.remove(); + } else { + tr.css('display', ''); + } + // 不是td就用td标签包裹起来 + const childNodes = tr.children(); + childNodes.each((tdChild) => { + const td = $(tdChild); + const text = td.text(); + const childTable = td.find('table'); + if (childTable.length > 0) { + childTable.after( + document.createTextNode(childTable.text()), + ); + childTable.remove(); + } + // 排除空格 + if ( + td.name !== 'td' && + ['\n', '\r\n'].includes(text.trim()) + ) { + const newTd = $(``); + td.before(newTd); + newTd.append(td); + } + }); }); - window.addEventListener('resize', this.updateScrollbar); - if (isEngine(editor) && !isMobile) { - editor.scrollNode?.on('scroll', this.updateScrollbar, { - passive: true, + const dataWidth = node.attributes('data-width'); + if (dataWidth) node.css('width', dataWidth); + node = helper.normalizeTable(node); + clearWH(node); + clearWH(node, 'height'); + const tbody = node.find('tbody'); + + // 表头放在tbody最前面 + const thead = node.find('thead'); + if (thead && thead.length > 0) tbody.prepend(thead.children()); + thead.remove(); + // 表头放在tbody最前面 + const tfoot = node.find('tfoot'); + if (tfoot && tfoot.length > 0) tbody.append(tfoot.children()); + tfoot.remove(); + const ths = node.find('th'); + ths.each((_, index) => { + const th = ths.eq(index); + th?.replaceWith($(`${th.html()}`)); }); - } - } + const tds = node.find('td'); + let fragment = getDocument().createDocumentFragment(); + tds.each((_, index) => { + fragment = getDocument().createDocumentFragment(); + const element = tds.eq(index); + if (!element) return; + clearWH(element); + clearWH(element, 'height'); + const background = element.css('background'); + if (background) element.css('background-color', background); + const valign = element.attributes('valign'); + if (valign) element.attributes('vertical-align', valign); + const children = element.children(); + for (let i = 0, len = children.length; i < len; i++) { + const child = children.eq(i); + // 移除单元格第一个和最后一个换行符,word 里面粘贴会存在,导致空行 + if ((i === 0 || i === len - 1) && child?.isText()) { + const text = child.text(); + if (/^\n(\s)*$/.test(text)) { + continue; + } + } + if (child) fragment.appendChild(child[0]); + } + // 对单元格内的内容标准化 + const fragmentNode = $(fragment); + element?.empty().append(editor.node.normalize(fragmentNode)); + }); + const background = + node?.css('background') || node?.css('background-color'); + if (background) tds.css('background', background); + + trs = node.find('tr'); + let rowSpan = 1; + trs.each((child) => { + const tr = $(child); + + const tds = tr?.find('td'); + if (tds?.length === 0 && rowSpan < 2) { + tr?.remove(); + } + if (tds && tds?.length > 0) { + const spans = tds + .toArray() + .map((td) => (td[0] as HTMLTableCellElement).rowSpan); + rowSpan = Math.max(...spans); + } - didRender() { - super.didRender(); - const editor = this.editor; - editor.on('undo', this.doChange); - editor.on('redo', this.doChange); - this.viewport = isEngine(editor) - ? this.wrapper?.find(Template.VIEWPORT) - : this.wrapper?.find(Template.VIEWPORT_READER); + if (tr) { + clearWH(tr); + clearWH(tr, 'height'); + } - this.selection.init(); - this.conltrollBar.init(); - this.command.init(); - if (!isEngine(editor) || editor.readonly) - this.toolbarModel?.setOffset([0, 0]); - else this.toolbarModel?.setOffset([13, -28, 0, -6]); - const tablePlugin = editor.plugin.findPlugin('table'); - const tableOptions = tablePlugin?.options.overflow || {}; - if (this.viewport) { - this.selection.refreshModel(); - setTimeout(() => { - this.initScrollbar(); - }, 0); - } - this.selection.on('select', () => { - this.conltrollBar.refresh(false); - if (!isEngine(editor)) return; - const align = this.selection.getSingleCell()?.css('vertical-align'); - this.updateAlignText(align as any); - this.toolbarModel?.update(); + const background = + tr?.css('background') || tr?.css('background-color'); + if (background) tds?.css('background', background); + }); + editor.nodeId.generateAll(node, true); + const children = node.allChildren(); + children.forEach((child) => { + if (editor.node.isInline(child)) { + editor.inline.repairCursor(child); + } + }); + const html = node + .get()! + .outerHTML.replace(/\n|\r\n/g, '') + .replace(/>\s+<'); + editor.card.replaceNode(node, TableComponent.cardName, { + html, + }); + node.remove(); }); + }; - this.conltrollBar.on('sizeChanged', () => { - this.selection.refreshModel(); - this.onChange(); - this.scrollbar?.refresh(); - }); - this.conltrollBar.on('sizeChanging', () => { - this.scrollbar?.refresh(); - editor.trigger('editor:resize'); - this.updateScrollbar(); - }); - this.command.on('actioned', (action, silence) => { - if (action === 'paste') { - editor.card.render(this.wrapper); - } - if (['splitCell', 'mergeCell'].includes(action)) { - editor.trigger('editor:resize'); + parseHtml = ( + root: NodeInterface, + callback?: (node: NodeInterface, value: TableValue) => NodeInterface, + ) => { + const editor = this.editor; + const results: NodeInterface[] = []; + root.find( + `[${CARD_KEY}="${TableComponent.cardName}"],[${READY_CARD_KEY}="${TableComponent.cardName}"]`, + ).each((tableNode) => { + const node = $(tableNode); + let table = node.find('table'); + const value = decodeCardValue( + node.attributes(CARD_VALUE_KEY), + ); + if (table.length === 0) { + if (!value || !value.html) return; + // 表格值里面的卡片都是没有被转换过的,所以需要先把卡片转换过来 + table = $(transformCustomTags(value.html)); + if (table.length === 0) { + node.remove(); + return; + } else { + editor.trigger('parse:html', table); + } } - this.selection.render(action); - this.toolbarModel?.update(); - if (!silence) { - this.onChange(); + const width = table.attributes('width') || table.css('width'); + table.css({ + outline: 'none', + 'border-collapse': 'collapse', + width: '100%', + }); + table.attributes('data-width', width); + const tds = table.find('td'); + tds.each((_, index) => { + const tdElement = tds.eq(index); + tdElement?.css({ + 'min-width': 'auto', + 'white-space': 'flat', + 'word-wrap': 'break-word', + margin: '4px 8px', + border: !!table.attributes('data-table-no-border') + ? '0 none' + : '1px solid #d9d9d9', + padding: '4px 8px', + cursor: 'default', + 'vertical-align': tdElement.css('vertical-align') || 'top', + }); + }); + table.find(Template.TABLE_TD_BG_CLASS).remove(); + table.find(Template.TABLE_TD_CONTENT_CLASS).each((content) => { + editor.node.unwrap($(content)); + }); + if (callback) { + table = callback(table, value); } - if (tableOptions.maxRightWidth) - this.overflow(tableOptions.maxRightWidth()); - this.scrollbar?.refresh(); - }); - const tableRoot = this.wrapper?.find(Template.TABLE_CLASS); - if (!tableRoot) return; - const value = super.getValue(); - if (!value?.html) { - const tableValue = this.getValue(); - if (tableValue && isEngine(editor)) this.setValue(tableValue); - this.onChange(); - } - if (tableOptions.maxRightWidth) - this.overflow(tableOptions.maxRightWidth()); - } - private remoteRefreshTimeout: NodeJS.Timeout | null = null; + //添加table的容器id; table 添加外部包裹div;用于table过长导致 文本溢出 + const tableId = table.attributes('data-id') + '-table'; + table = $( + `
`, + ).append(table); - remoteRefresh() { - if ( - !this.wrapper || - this.wrapper.length === 0 || - !(this.wrapper[0].parentElement ?? this.wrapper[0].parentNode) - ) - return; - // 重新绘制列头部和行头部 - const colsHeader = this.wrapper.find(Template.COLS_HEADER_CLASS); - const superValue = super.getValue(); - let colItems = colsHeader.find(Template.COLS_HEADER_ITEM_CLASS); - const colCount = colItems.length; - if (superValue.cols > colCount) { - colsHeader.append( - $( - this.template.renderColsHeader(superValue.cols - colCount), - ).find(Template.COLS_HEADER_ITEM_CLASS), - ); - colItems = colsHeader.find(Template.COLS_HEADER_ITEM_CLASS); - } else if (superValue.cols < colCount) { - for (let i = colCount; i > superValue.cols; i--) { - colItems.eq(i - 1)?.remove(); - } - } - const table = superValue.html - ? $(superValue.html) - : this.wrapper.find('table'); - const colElements = table.find('col').toArray(); - colElements.forEach((colElement, index) => { - const width = - colElement.attributes('width') || colElement.css('width'); - colItems - .eq(index) - ?.css( - 'width', - `${Math.max(parseInt(width), this.colMinWidth)}px`, - ); - }); - - const rowsHeader = this.wrapper.find(Template.ROWS_HEADER_CLASS); - let rowItems = rowsHeader.find(Template.ROWS_HEADER_ITEM_CLASS); - const rowCount = rowItems.length; - if (superValue.rows > rowCount) { - rowsHeader.append( - $( - this.template.renderRowsHeader(superValue.rows - rowCount), - ).find(Template.ROWS_HEADER_ITEM_CLASS), - ); - rowItems = rowsHeader.find(Template.ROWS_HEADER_ITEM_CLASS); - } else if (superValue.rows < rowCount) { - for (let i = rowCount; i > superValue.rows; i--) { - rowItems.eq(i - 1)?.remove(); - } - } - const rowElements = table.find('tr').toArray(); - rowElements.forEach((rowElement, index) => { - rowItems - .eq(index) - ?.css( - 'height', - Math.max( - parseInt(rowElement.css('width')), - this.rowMinHeight, - ), - ); + node.replaceWith(table); + results.push(table); }); - // this.conltrollBar.refresh(); - this.scrollbar?.refresh(); - if (this.remoteRefreshTimeout) clearTimeout(this.remoteRefreshTimeout); - this.remoteRefreshTimeout = setTimeout(() => { - // 找到所有可编辑节点,对没有 contenteditable 属性的节点添加contenteditable一下 - this.wrapper?.find(EDITABLE_SELECTOR).each((editableNode) => { - const editableElement = editableNode as Element; - if (!editableElement.hasAttribute(DATA_CONTENTEDITABLE_KEY)) { - editableElement.setAttribute( - DATA_CONTENTEDITABLE_KEY, - this.template.isReadonly ? 'false' : 'true', - ); - } - }); - }, 10); - } + return results; + }; - render() { - const editor = this.editor; - this.template.isReadonly = !isEngine(editor) || editor.readonly; - // 重新渲染 - if ( - this.wrapper && - this.wrapper.length > 0 && - !!(this.wrapper[0].parentElement ?? this.wrapper[0].parentNode) - ) { - this.remoteRefresh(); - return; + markdownIt = (mardown: MarkdownIt) => { + if (this.options.markdown !== false) { + mardown.enable('table'); } - const value = this.getValue(); - // 第一次渲染 - if (!value) return 'Error value'; - if (value.html) { - let table: NodeInterface | undefined = $(value.html); - if (table && table.name !== 'table') { - table = table.toArray().find((child) => child.name === 'table'); - if (!table) { - value.html = `
${value.html}
`; - table = $(value.html); - } else { - value.html = table.get()!.outerHTML; - } - } - const model = this.helper.getTableModel(table); - value.rows = model.rows; - value.cols = model.cols; - } - //渲染卡片 - this.wrapper = isEngine(editor) - ? $( - this.template.htmlEdit( - value, - menuData(editor.language.get('table')), - ), - ) - : $(this.template.htmlView(value)); - if (!isEngine(editor)) { - this.wrapper - .find('table') - .addClass('data-table') - .addClass('data-table-view'); - } - value.rows = this.wrapper.find('tr').length; - if (value.width) - this.wrapper.find('table').css('width', `${value.width}px`); - return this.wrapper; - } + }; destroy() { - super.destroy(); const editor = this.editor; - window.removeEventListener('scroll', this.updateScrollbar); - window.removeEventListener('resize', this.updateScrollbar); - editor.scrollNode?.off('scroll', this.updateScrollbar); - this.scrollbar?.destroy(); - this.command.removeAllListeners(); - const selection = this.selection; - selection.removeAllListeners(); - selection.destroy(); - const bar = this.conltrollBar; - bar.removeAllListeners(); - bar.destroy(); - editor.off('undo', this.doChange); - editor.off('redo', this.doChange); + editor.off('parse:html', this.parseHtml); + editor.off('paste:each-after', this.pasteHtml); + editor.off('paste:schema', this.pasteSchema); + editor.off('markdown-it', this.markdownIt); } } -export default TableComponent; +export default Table; -export { Template, Helper }; +export { TableComponent }; +export type { TableValue, TableOptions }; From d22c7705b340041af6d1cad8bb54bd296e7fb449 Mon Sep 17 00:00:00 2001 From: Beeant Date: Tue, 18 Apr 2023 03:43:25 +0000 Subject: [PATCH 7/7] fix: dayjs error in examples react --- examples/react/components/comment/item.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/examples/react/components/comment/item.tsx b/examples/react/components/comment/item.tsx index 9e2551cf..e8e5dcc0 100644 --- a/examples/react/components/comment/item.tsx +++ b/examples/react/components/comment/item.tsx @@ -1,10 +1,13 @@ import React, { useContext, forwardRef } from 'react'; import dayjs from 'dayjs'; +import relativeTime from 'dayjs/plugin/relativeTime'; import Space from 'antd/es/space'; import { DataItem } from './types'; import ItemEdit from './edit'; import Context from '../../context'; +dayjs.extend(relativeTime); + export type CommentItemProps = Omit< React.AnchorHTMLAttributes, 'onChange' @@ -75,9 +78,9 @@ const CommentItem = forwardRef( > {username} - {dayjs() - .startOf('second') - .from(new Date(createdAt))} + {dayjs(new Date(createdAt)).fromNow( + true, + )}
{