Bläddra i källkod

解决 crud default 插槽不传递参数问题

神仙都没用 1 år sedan
förälder
incheckning
893e88157f

+ 12 - 340
build/cool/dist/eps.d.ts

@@ -110,41 +110,6 @@ declare namespace Eps {
 		 */
 		[key: string]: any;
 	}
-
-	interface ChatMessageEntity {
-		/**
-		 * 任意键值
-		 */
-		[key: string]: any;
-	}
-
-	interface ChatSessionEntity {
-		/**
-		 * 任意键值
-		 */
-		[key: string]: any;
-	}
-
-	interface TestEntity {
-		/**
-		 * 任意键值
-		 */
-		[key: string]: any;
-	}
-
-	interface DemoUserFollowEntity {
-		/**
-		 * 任意键值
-		 */
-		[key: string]: any;
-	}
-
-	interface DemoUserInfoEntity {
-		/**
-		 * 任意键值
-		 */
-		[key: string]: any;
-	}
 	interface BaseComm {
 		/**
 		 * personUpdate
@@ -648,138 +613,6 @@ declare namespace Eps {
 		request: Service["request"];
 	}
 
-	interface DemoUserFollow {
-		/**
-		 * page
-		 */
-		"page"(data?: any): Promise<{
-			pagination: { size: number; page: number; total: number; [key: string]: any };
-			list: DemoUserFollowEntity[];
-			[key: string]: any;
-		}>;
-		/**
-		 * list
-		 */
-		"list"(data?: any): Promise<DemoUserFollowEntity[]>;
-		/**
-		 * info
-		 */
-		"info"(data?: any): Promise<DemoUserFollowEntity>;
-		/**
-		 * delete
-		 */
-		"delete"(data?: any): Promise<any>;
-		/**
-		 * update
-		 */
-		"update"(data?: any): Promise<any>;
-		/**
-		 * add
-		 */
-		"add"(data?: any): Promise<any>;
-		/**
-		 * 权限标识
-		 */
-		permission: {
-			page: string;
-			list: string;
-			info: string;
-			delete: string;
-			update: string;
-			add: string;
-		};
-		/**
-		 * 权限状态
-		 */
-		_permission: {
-			page: boolean;
-			list: boolean;
-			info: boolean;
-			delete: boolean;
-			update: boolean;
-			add: boolean;
-		};
-		/**
-		 * 请求
-		 */
-		request: Service["request"];
-	}
-
-	interface DemoUserInfo {
-		/**
-		 * t1
-		 */
-		"t1"(data?: any): Promise<any>;
-		/**
-		 * t2
-		 */
-		"t2"(data?: any): Promise<any>;
-		/**
-		 * t3
-		 */
-		"t3"(data?: any): Promise<any>;
-		/**
-		 * page
-		 */
-		"page"(data?: any): Promise<{
-			pagination: { size: number; page: number; total: number; [key: string]: any };
-			list: DemoUserInfoEntity[];
-			[key: string]: any;
-		}>;
-		/**
-		 * list
-		 */
-		"list"(data?: any): Promise<DemoUserInfoEntity[]>;
-		/**
-		 * info
-		 */
-		"info"(data?: any): Promise<DemoUserInfoEntity>;
-		/**
-		 * delete
-		 */
-		"delete"(data?: any): Promise<any>;
-		/**
-		 * update
-		 */
-		"update"(data?: any): Promise<any>;
-		/**
-		 * add
-		 */
-		"add"(data?: any): Promise<any>;
-		/**
-		 * 权限标识
-		 */
-		permission: {
-			t1: string;
-			t2: string;
-			t3: string;
-			page: string;
-			list: string;
-			info: string;
-			delete: string;
-			update: string;
-			add: string;
-		};
-		/**
-		 * 权限状态
-		 */
-		_permission: {
-			t1: boolean;
-			t2: boolean;
-			t3: boolean;
-			page: boolean;
-			list: boolean;
-			info: boolean;
-			delete: boolean;
-			update: boolean;
-			add: boolean;
-		};
-		/**
-		 * 请求
-		 */
-		request: Service["request"];
-	}
-
 	interface DictInfo {
 		/**
 		 * delete
@@ -872,6 +705,10 @@ declare namespace Eps {
 		 * add
 		 */
 		"add"(data?: any): Promise<any>;
+		/**
+		 * add
+		 */
+		"add"(data?: any): Promise<any>;
 		/**
 		 * 权限标识
 		 */
@@ -1295,202 +1132,39 @@ declare namespace Eps {
 		 * add
 		 */
 		"add"(data?: any): Promise<any>;
-		/**
-		 * add
-		 */
-		"add"(data?: any): Promise<any>;
-		/**
-		 * 权限标识
-		 */
-		permission: {
-			delete: string;
-			update: string;
-			info: string;
-			list: string;
-			page: string;
-			add: string;
-		};
-		/**
-		 * 权限状态
-		 */
-		_permission: {
-			delete: boolean;
-			update: boolean;
-			info: boolean;
-			list: boolean;
-			page: boolean;
-			add: boolean;
-		};
-		/**
-		 * 请求
-		 */
-		request: Service["request"];
-	}
-
-	interface ChatMessage {
-		/**
-		 * page
-		 */
-		"page"(data?: any): Promise<{
-			pagination: { size: number; page: number; total: number; [key: string]: any };
-			list: ChatMessageEntity[];
-			[key: string]: any;
-		}>;
 		/**
 		 * list
 		 */
-		"list"(data?: any): Promise<ChatMessageEntity[]>;
-		/**
-		 * info
-		 */
-		"info"(data?: any): Promise<ChatMessageEntity>;
-		/**
-		 * delete
-		 */
-		"delete"(data?: any): Promise<any>;
-		/**
-		 * update
-		 */
-		"update"(data?: any): Promise<any>;
-		/**
-		 * add
-		 */
-		"add"(data?: any): Promise<any>;
-		/**
-		 * 权限标识
-		 */
-		permission: {
-			page: string;
-			list: string;
-			info: string;
-			delete: string;
-			update: string;
-			add: string;
-		};
-		/**
-		 * 权限状态
-		 */
-		_permission: {
-			page: boolean;
-			list: boolean;
-			info: boolean;
-			delete: boolean;
-			update: boolean;
-			add: boolean;
-		};
-		/**
-		 * 请求
-		 */
-		request: Service["request"];
-	}
-
-	interface ChatSession {
+		"list"(data?: any): Promise<UserInfoEntity[]>;
 		/**
 		 * page
 		 */
 		"page"(data?: any): Promise<{
 			pagination: { size: number; page: number; total: number; [key: string]: any };
-			list: ChatSessionEntity[];
+			list: UserInfoEntity[];
 			[key: string]: any;
 		}>;
-		/**
-		 * list
-		 */
-		"list"(data?: any): Promise<ChatSessionEntity[]>;
-		/**
-		 * info
-		 */
-		"info"(data?: any): Promise<ChatSessionEntity>;
-		/**
-		 * delete
-		 */
-		"delete"(data?: any): Promise<any>;
-		/**
-		 * update
-		 */
-		"update"(data?: any): Promise<any>;
-		/**
-		 * add
-		 */
-		"add"(data?: any): Promise<any>;
 		/**
 		 * 权限标识
 		 */
 		permission: {
-			page: string;
-			list: string;
-			info: string;
 			delete: string;
 			update: string;
-			add: string;
-		};
-		/**
-		 * 权限状态
-		 */
-		_permission: {
-			page: boolean;
-			list: boolean;
-			info: boolean;
-			delete: boolean;
-			update: boolean;
-			add: boolean;
-		};
-		/**
-		 * 请求
-		 */
-		request: Service["request"];
-	}
-
-	interface Test {
-		/**
-		 * page
-		 */
-		"page"(data?: any): Promise<{
-			pagination: { size: number; page: number; total: number; [key: string]: any };
-			list: TestEntity[];
-			[key: string]: any;
-		}>;
-		/**
-		 * update
-		 */
-		"update"(data?: any): Promise<any>;
-		/**
-		 * add
-		 */
-		"add"(data?: any): Promise<any>;
-		/**
-		 * info
-		 */
-		"info"(data?: any): Promise<TestEntity>;
-		/**
-		 * delete
-		 */
-		"delete"(data?: any): Promise<any>;
-		/**
-		 * list
-		 */
-		"list"(data?: any): Promise<TestEntity[]>;
-		/**
-		 * 权限标识
-		 */
-		permission: {
-			page: string;
-			update: string;
-			add: string;
 			info: string;
-			delete: string;
 			list: string;
+			page: string;
+			add: string;
 		};
 		/**
 		 * 权限状态
 		 */
 		_permission: {
-			page: boolean;
+			delete: boolean;
 			update: boolean;
-			add: boolean;
 			info: boolean;
-			delete: boolean;
 			list: boolean;
+			page: boolean;
+			add: boolean;
 		};
 		/**
 		 * 请求
@@ -1525,14 +1199,12 @@ declare namespace Eps {
 				user: BaseSysUser;
 			};
 		};
-		demo: { goods: DemoGoods; user: { follow: DemoUserFollow; info: DemoUserInfo } };
+		demo: { goods: DemoGoods };
 		dict: { info: DictInfo; type: DictType };
 		plugin: { info: PluginInfo };
 		recycle: { data: RecycleData };
 		space: { info: SpaceInfo; type: SpaceType };
 		task: { info: TaskInfo };
 		user: { address: UserAddress; info: UserInfo };
-		chat: { message: ChatMessage; session: ChatSession };
-		test: Test;
 	};
 }

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
build/cool/dist/eps.json


+ 1 - 1
package.json

@@ -9,7 +9,7 @@
 		"lint:eslint": "eslint \"./src/**/*.{vue,ts,tsx}\" --fix"
 	},
 	"dependencies": {
-		"@cool-vue/crud": "^7.1.15",
+		"@cool-vue/crud": "^7.1.16",
 		"@element-plus/icons-vue": "^2.3.1",
 		"@vueuse/core": "^10.4.0",
 		"@wangeditor/editor": "^5.1.23",

+ 2 - 2
packages/crud/package.json

@@ -1,6 +1,6 @@
 {
 	"name": "@cool-vue/crud",
-	"version": "7.1.15",
+	"version": "7.1.16",
 	"private": false,
 	"main": "./dist/index.umd.min.js",
 	"typings": "types/index.d.ts",
@@ -13,7 +13,7 @@
 	"dependencies": {
 		"array.prototype.flat": "^1.2.4",
 		"core-js": "^3.21.1",
-		"element-plus": "^2.5.4",
+		"element-plus": "^2.6.1",
 		"lodash-es": "^4.17.21",
 		"mitt": "^3.0.1",
 		"vue": "^3.4.15"

+ 9 - 6
packages/crud/src/utils/vnode.tsx

@@ -82,13 +82,16 @@ export function parseNode(vnode: any, options: Options): VNode {
 	if (vnode.vm) {
 		comp = h(regs.get(vnode.name), props);
 	} else {
-		// 渲染组件
-		comp = h(toRaw(resolveComponent(vnode.name)), props, {
-			default() {
-				return children;
-			},
+		const slots = {
 			...vnode.slots
-		});
+		};
+
+		if (children) {
+			slots.default = () => children;
+		}
+
+		// 渲染组件
+		comp = h(toRaw(resolveComponent(vnode.name)), props, slots);
 	}
 
 	// 挂载到 refs 中

+ 4 - 4
packages/crud/yarn.lock

@@ -2917,10 +2917,10 @@ electron-to-chromium@^1.4.648:
   resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.655.tgz#112410db0d7f9c2b4ed8baa3b1b548522a6f89d4"
   integrity sha512-2yszojF7vIZ68adIOvzV4bku8OZad9w5H9xF3ZAMZjPuOjBarlflUkjN6DggdV+L71WZuKUfKUhov/34+G5QHg==
 
-element-plus@^2.5.4:
-  version "2.5.4"
-  resolved "https://registry.yarnpkg.com/element-plus/-/element-plus-2.5.4.tgz#c78c44cd6126e65c7f8d58aac664d688cc921e24"
-  integrity sha512-3z2BQ53B93wypOLFq+vmT2XibTGRm3WODVPdAGymqTVGRIeUfFh17ysymn81ZvEVs4b8Dq6Fxr3I1B/9NUwZ0A==
+element-plus@^2.6.1:
+  version "2.6.1"
+  resolved "https://registry.yarnpkg.com/element-plus/-/element-plus-2.6.1.tgz#d65a45d2b01cd8566fad6573e995ed40d6d406a4"
+  integrity sha512-6VRpLjwtIVdtUuITJPPKtpOH1NM6nuAkRE3q5O4Lrx0N1bYMhTkiqb2Jy7zfQuDPbOIkkF2OABTzegpNnzgsnQ==
   dependencies:
     "@ctrl/tinycolor" "^3.4.1"
     "@element-plus/icons-vue" "^2.3.1"

+ 5 - 3
src/plugins/crud/config.ts

@@ -13,8 +13,8 @@ export default (): Merge<ModuleConfig, CrudOptions> => {
 		label: "CRUD",
 		description: "快速增删改查及一系列辅助组件",
 		author: "COOL",
-		version: "1.0.5",
-		updateTime: "2024-02-28",
+		version: "1.0.6",
+		updateTime: "2024-03-19",
 		demo: "/demo/crud",
 
 		// 组件全注册
@@ -26,7 +26,9 @@ export default (): Merge<ModuleConfig, CrudOptions> => {
 				table: {
 					// 插件列表
 					plugins: []
-					// contextMenu: [], 是否关闭表格右键菜单
+
+					// 右键菜单,为空则关闭
+					// contextMenu: []
 				},
 				form: {
 					// 插件列表

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
stats.html


+ 27 - 6
yarn.lock

@@ -282,14 +282,14 @@
     "@babel/helper-validator-identifier" "^7.22.20"
     to-fast-properties "^2.0.0"
 
-"@cool-vue/crud@^7.1.15":
-  version "7.1.15"
-  resolved "https://registry.yarnpkg.com/@cool-vue/crud/-/crud-7.1.15.tgz#fca31c2e822657cf3bc663301f61a60a551b5bdf"
-  integrity sha512-46AK1mRRvVqas11vFLkkXpE+9Q9ppTIr+pr5Mconcu/PHThf5tCgSTexvtfe8sd1bpA45tFjkJHTVg4IbjqFiA==
+"@cool-vue/crud@^7.1.16":
+  version "7.1.16"
+  resolved "https://registry.yarnpkg.com/@cool-vue/crud/-/crud-7.1.16.tgz#43e0c39b12a6e567a1e5dbac4014914c3e1ae6d2"
+  integrity sha512-zNPgotaHO1uYk4fKskSgfOze53qQ7fOHrubiqtH5xb5eUI0L6W2VwtMFlQ+ro7PuLnJQ0f6xKqWlw348bMfwWg==
   dependencies:
     array.prototype.flat "^1.2.4"
     core-js "^3.21.1"
-    element-plus "^2.5.4"
+    element-plus "^2.6.1"
     lodash-es "^4.17.21"
     mitt "^3.0.1"
     vue "^3.4.15"
@@ -1690,7 +1690,7 @@ electron-to-chromium@^1.4.668:
   resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.682.tgz#27577b88ccccc810e09b05093345cf1830f1bd65"
   integrity sha512-oCglfs8yYKs9RQjJFOHonSnhikPK3y+0SvSYc/YpYJV//6rqc0/hbwd0c7vgK4vrl6y2gJAwjkhkSGWK+z4KRA==
 
-element-plus@^2.5.4, element-plus@^2.5.6:
+element-plus@^2.5.6:
   version "2.5.6"
   resolved "https://registry.yarnpkg.com/element-plus/-/element-plus-2.5.6.tgz#d63dabc6330c0e2abe6f97cf99013a30140940d1"
   integrity sha512-zctKTiyIDmcnMp3K5WG1hglgraW9EbiCLiIDVtaMCS5mPMl2fRKdS0vOFGnECIq9taFoxnyoDwxHD81nv0B4RA==
@@ -1711,6 +1711,27 @@ element-plus@^2.5.4, element-plus@^2.5.6:
     memoize-one "^6.0.0"
     normalize-wheel-es "^1.2.0"
 
+element-plus@^2.6.1:
+  version "2.6.1"
+  resolved "https://registry.yarnpkg.com/element-plus/-/element-plus-2.6.1.tgz#d65a45d2b01cd8566fad6573e995ed40d6d406a4"
+  integrity sha512-6VRpLjwtIVdtUuITJPPKtpOH1NM6nuAkRE3q5O4Lrx0N1bYMhTkiqb2Jy7zfQuDPbOIkkF2OABTzegpNnzgsnQ==
+  dependencies:
+    "@ctrl/tinycolor" "^3.4.1"
+    "@element-plus/icons-vue" "^2.3.1"
+    "@floating-ui/dom" "^1.0.1"
+    "@popperjs/core" "npm:@sxzz/popperjs-es@^2.11.7"
+    "@types/lodash" "^4.14.182"
+    "@types/lodash-es" "^4.17.6"
+    "@vueuse/core" "^9.1.0"
+    async-validator "^4.2.5"
+    dayjs "^1.11.3"
+    escape-html "^1.0.3"
+    lodash "^4.17.21"
+    lodash-es "^4.17.21"
+    lodash-unified "^1.0.2"
+    memoize-one "^6.0.0"
+    normalize-wheel-es "^1.2.0"
+
 emoji-regex@^8.0.0:
   version "8.0.0"
   resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37"

Vissa filer visades inte eftersom för många filer har ändrats