Parcourir la source

fix: Fix context menu not working

vben il y a 3 ans
Parent
commit
b0a0cbcd6a

+ 28 - 28
package.json

@@ -36,14 +36,14 @@
     "@ant-design/colors": "^6.0.0",
     "@ant-design/icons-vue": "^6.0.1",
     "@iconify/iconify": "^2.1.0",
-    "@logicflow/core": "^0.7.11",
-    "@logicflow/extension": "^0.7.11",
-    "@vue/runtime-core": "^3.2.23",
-    "@vue/shared": "^3.2.23",
-    "@vueuse/core": "^7.1.2",
-    "@vueuse/shared": "^7.1.2",
+    "@logicflow/core": "^0.7.14",
+    "@logicflow/extension": "^0.7.14",
+    "@vue/runtime-core": "^3.2.26",
+    "@vue/shared": "^3.2.26",
+    "@vueuse/core": "^7.3.0",
+    "@vueuse/shared": "^7.3.0",
     "@zxcvbn-ts/core": "^1.0.0",
-    "ant-design-vue": "3.0.0-alpha.13",
+    "ant-design-vue": "3.0.0-alpha.15",
     "axios": "^0.24.0",
     "codemirror": "^5.64.0",
     "cropperjs": "^1.5.12",
@@ -55,16 +55,16 @@
     "mockjs": "^1.1.0",
     "nprogress": "^0.2.0",
     "path-to-regexp": "^6.2.0",
-    "pinia": "2.0.4",
+    "pinia": "2.0.6",
     "print-js": "^1.6.0",
     "qrcode": "^1.5.0",
-    "qs": "^6.10.1",
+    "qs": "^6.10.2",
     "resize-observer-polyfill": "^1.5.1",
     "showdown": "^1.9.1",
     "sortablejs": "^1.14.0",
     "tinymce": "^5.10.2",
-    "vditor": "^3.8.7",
-    "vue": "^3.2.23",
+    "vditor": "^3.8.8",
+    "vue": "^3.2.26",
     "vue-i18n": "^9.1.9",
     "vue-json-pretty": "^2.0.6",
     "vue-router": "^4.0.12",
@@ -74,7 +74,7 @@
   "devDependencies": {
     "@commitlint/cli": "^15.0.0",
     "@commitlint/config-conventional": "^15.0.0",
-    "@iconify/json": "^2.0.4",
+    "@iconify/json": "^2.0.9",
     "@purge-icons/generated": "^0.7.0",
     "@types/codemirror": "^5.60.5",
     "@types/crypto-js": "^4.0.2",
@@ -84,42 +84,42 @@
     "@types/jest": "^27.0.3",
     "@types/lodash-es": "^4.17.5",
     "@types/mockjs": "^1.0.4",
-    "@types/node": "^16.11.11",
+    "@types/node": "^16.11.12",
     "@types/nprogress": "^0.2.0",
     "@types/qrcode": "^1.4.1",
     "@types/qs": "^6.9.7",
     "@types/showdown": "^1.9.4",
     "@types/sortablejs": "^1.10.7",
-    "@typescript-eslint/eslint-plugin": "^5.5.0",
-    "@typescript-eslint/parser": "^5.5.0",
-    "@vitejs/plugin-legacy": "^1.6.3",
-    "@vitejs/plugin-vue": "^1.10.1",
-    "@vitejs/plugin-vue-jsx": "^1.3.0",
-    "@vue/compiler-sfc": "3.2.23",
+    "@typescript-eslint/eslint-plugin": "^5.6.0",
+    "@typescript-eslint/parser": "^5.6.0",
+    "@vitejs/plugin-legacy": "^1.6.4",
+    "@vitejs/plugin-vue": "^2.0.0",
+    "@vitejs/plugin-vue-jsx": "^1.3.1",
+    "@vue/compiler-sfc": "3.2.26",
     "@vue/test-utils": "^2.0.0-rc.17",
     "autoprefixer": "^10.4.0",
     "commitizen": "^4.2.4",
     "conventional-changelog-cli": "^2.1.1",
     "cross-env": "^7.0.3",
     "dotenv": "^10.0.0",
-    "eslint": "^8.3.0",
+    "eslint": "^8.4.1",
     "eslint-config-prettier": "^8.3.0",
     "eslint-define-config": "^1.2.0",
     "eslint-plugin-jest": "^25.3.0",
     "eslint-plugin-prettier": "^4.0.0",
-    "eslint-plugin-vue": "^8.1.1",
+    "eslint-plugin-vue": "^8.2.0",
     "esno": "^0.12.1",
     "fs-extra": "^10.0.0",
     "husky": "^7.0.4",
     "inquirer": "^8.2.0",
-    "jest": "^27.4.2",
+    "jest": "^27.4.4",
     "less": "^4.1.2",
     "lint-staged": "12.1.2",
     "npm-run-all": "^4.1.5",
     "postcss": "^8.4.4",
     "postcss-html": "^1.3.0",
     "postcss-less": "^5.0.0",
-    "prettier": "^2.5.0",
+    "prettier": "^2.5.1",
     "rimraf": "^3.0.2",
     "rollup-plugin-visualizer": "^5.5.2",
     "stylelint": "^14.1.0",
@@ -128,21 +128,21 @@
     "stylelint-config-recommended": "^6.0.0",
     "stylelint-config-standard": "^24.0.0",
     "stylelint-order": "^5.0.0",
-    "ts-jest": "^27.0.7",
+    "ts-jest": "^27.1.1",
     "ts-node": "^10.4.0",
-    "typescript": "^4.5.2",
-    "vite": "^2.7.0-beta.9",
+    "typescript": "^4.5.3",
+    "vite": "^2.7.1",
     "vite-plugin-compression": "^0.3.6",
     "vite-plugin-html": "^2.1.1",
     "vite-plugin-imagemin": "^0.4.6",
     "vite-plugin-mock": "^2.9.6",
     "vite-plugin-purge-icons": "^0.7.0",
-    "vite-plugin-pwa": "^0.11.9",
+    "vite-plugin-pwa": "^0.11.11",
     "vite-plugin-style-import": "^1.4.0",
     "vite-plugin-svg-icons": "^1.0.5",
     "vite-plugin-theme": "^0.8.1",
     "vite-plugin-vue-setup-extend": "^0.1.0",
-    "vite-plugin-windicss": "^1.5.3",
+    "vite-plugin-windicss": "^1.5.4",
     "vue-eslint-parser": "^8.0.1",
     "vue-tsc": "^0.29.8"
   },

Fichier diff supprimé car celui-ci est trop grand
+ 260 - 263
pnpm-lock.yaml


+ 9 - 9
src/components/ContextMenu/src/ContextMenu.vue

@@ -60,6 +60,7 @@
         const top = body.clientHeight < y + menuHeight ? y - menuHeight : y;
         return {
           ...styles,
+          position: 'absolute',
           width: `${width}px`,
           left: `${left + 1}px`,
           top: `${top + 1}px`,
@@ -124,15 +125,11 @@
         }
         const { items } = props;
         return (
-          <Menu
-            inlineIndent={12}
-            mode="vertical"
-            class={prefixCls}
-            ref={wrapRef}
-            style={unref(getStyle)}
-          >
-            {renderMenuItem(items)}
-          </Menu>
+          <div class={prefixCls}>
+            <Menu inlineIndent={12} mode="vertical" ref={wrapRef} style={unref(getStyle)}>
+              {renderMenuItem(items)}
+            </Menu>
+          </div>
         );
       };
     },
@@ -185,6 +182,9 @@
     background-clip: padding-box;
     user-select: none;
 
+    &__item {
+      margin: 0 !important;
+    }
     .item-style();
 
     .ant-divider {

+ 2 - 2
src/components/Tree/src/Tree.vue

@@ -386,8 +386,8 @@
               class={`${bem('title')} pl-2`}
               onClick={handleClickNode.bind(null, item[keyField], item[childrenField])}
             >
-              {item.slots?.title ? (
-                getSlot(slots, item.slots?.title, item)
+              {slots?.title ? (
+                getSlot(slots, 'title', item)
               ) : (
                 <>
                   {icon && <TreeIcon icon={icon} />}

+ 3 - 0
src/components/Tree/style/index.less

@@ -10,6 +10,9 @@
       position: absolute;
       left: 0;
       width: 100%;
+      overflow: hidden;
+      text-overflow: ellipsis;
+      white-space: nowrap;
     }
   }
 

+ 21 - 24
src/views/demo/tree/data.ts

@@ -38,21 +38,21 @@ export const treeData2: any[] = [
   {
     name: 'parent ',
     id: '0-0',
-    slots: { title: 'title' },
+
     children: [
-      { name: 'leaf', id: '0-0-0', slots: { title: 'title' } },
+      { name: 'leaf', id: '0-0-0' },
       {
         name: 'leaf',
         id: '0-0-1',
-        slots: { title: 'title' },
+
         children: [
           {
             name: 'leaf',
-            slots: { title: 'title' },
+
             id: '0-0-0-0',
-            children: [{ name: 'leaf', id: '0-0-0-0-1', slots: { title: 'title' } }],
+            children: [{ name: 'leaf', id: '0-0-0-0-1' }],
           },
-          { name: 'leaf', slots: { title: 'title' }, id: '0-0-0-1' },
+          { name: 'leaf', id: '0-0-0-1' },
         ],
       },
     ],
@@ -60,19 +60,19 @@ export const treeData2: any[] = [
   {
     name: 'parent 2',
     id: '1-1',
-    slots: { title: 'title' },
+
     children: [
-      { name: 'leaf', slots: { title: 'title' }, id: '1-1-0' },
-      { name: 'leaf', slots: { title: 'title' }, id: '1-1-1' },
+      { name: 'leaf', id: '1-1-0' },
+      { name: 'leaf', id: '1-1-1' },
     ],
   },
   {
     name: 'parent 3',
     id: '2-2',
-    slots: { title: 'title' },
+
     children: [
-      { name: 'leaf', slots: { title: 'title' }, id: '2-2-0' },
-      { name: 'leaf', slots: { title: 'title' }, id: '2-2-1' },
+      { name: 'leaf', id: '2-2-0' },
+      { name: 'leaf', id: '2-2-1' },
     ],
   },
 ];
@@ -81,21 +81,18 @@ export const treeData3: any[] = [
   {
     name: 'parent ',
     key: '0-0',
-    slots: { title: 'title' },
     children: [
-      { name: 'leaf', key: '0-0-0', slots: { title: 'title' } },
+      { name: 'leaf', key: '0-0-0' },
       {
         name: 'leaf',
         key: '0-0-1',
-        slots: { title: 'title' },
         children: [
           {
             name: 'leaf',
-            slots: { title: 'title' },
             key: '0-0-0-0',
-            children: [{ name: 'leaf', key: '0-0-0-0-1', slots: { title: 'title' } }],
+            children: [{ name: 'leaf', key: '0-0-0-0-1' }],
           },
-          { name: 'leaf', slots: { title: 'title' }, key: '0-0-0-1' },
+          { name: 'leaf', key: '0-0-0-1' },
         ],
       },
     ],
@@ -103,19 +100,19 @@ export const treeData3: any[] = [
   {
     name: 'parent 2',
     key: '1-1',
-    slots: { title: 'title' },
+
     children: [
-      { name: 'leaf', slots: { title: 'title' }, key: '1-1-0' },
-      { name: 'leaf', slots: { title: 'title' }, key: '1-1-1' },
+      { name: 'leaf', key: '1-1-0' },
+      { name: 'leaf', key: '1-1-1' },
     ],
   },
   {
     name: 'parent 3',
     key: '2-2',
-    slots: { title: 'title' },
+
     children: [
-      { name: 'leaf', slots: { title: 'title' }, key: '2-2-0' },
-      { name: 'leaf', slots: { title: 'title' }, key: '2-2-1' },
+      { name: 'leaf', key: '2-2-0' },
+      { name: 'leaf', key: '2-2-1' },
     ],
   },
 ];

+ 3 - 1
src/views/demo/tree/index.vue

@@ -2,7 +2,9 @@
   <PageWrapper title="Tree基础示例">
     <Row :gutter="[16, 16]">
       <Col :span="8">
-        <BasicTree title="基础示例,默认展开第一层" :treeData="treeData" defaultExpandLevel="1" />
+        <BasicTree title="基础示例,默认展开第一层" :treeData="treeData" defaultExpandLevel="1">
+          <template #title> 123123 </template>
+        </BasicTree>
       </Col>
       <Col :span="8">
         <BasicTree

+ 3 - 3
tests/server/package.json

@@ -24,13 +24,13 @@
     "@types/koa": "^2.13.4",
     "@types/koa-bodyparser": "^5.0.2",
     "@types/koa-router": "^7.4.4",
-    "@types/node": "^16.11.11",
+    "@types/node": "^16.11.12",
     "nodemon": "^2.0.15",
     "pm2": "^5.1.2",
     "rimraf": "^3.0.2",
     "ts-node": "^10.4.0",
     "tsconfig-paths": "^3.12.0",
-    "tsup": "^5.10.0",
-    "typescript": "^4.5.2"
+    "tsup": "^5.11.1",
+    "typescript": "^4.5.3"
   }
 }

Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff