icssoa 1 yıl önce
ebeveyn
işleme
f73742a432

+ 1 - 1
package.json

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

+ 1 - 1
packages/crud/package.json

@@ -1,6 +1,6 @@
 {
 	"name": "@cool-vue/crud",
-	"version": "7.1.13",
+	"version": "7.1.14",
 	"private": false,
 	"main": "./dist/index.umd.min.js",
 	"typings": "types/index.d.ts",

+ 1 - 1
packages/crud/src/components/adv/search.tsx

@@ -113,7 +113,7 @@ export default defineComponent({
 
 		// 渲染表单
 		function renderForm() {
-			return h(<cl-form ref={Form} inner />, {}, slots);
+			return h(<cl-form ref={Form} inner enable-plugin={false} />, {}, slots);
 		}
 
 		// 渲染底部

+ 5 - 1
packages/crud/src/components/form/helper/plugins.ts

@@ -1,7 +1,7 @@
 import { Ref, WatchStopHandle, getCurrentInstance, watch } from "vue";
 import { useConfig } from "../../../hooks";
 
-export function usePlugins({ visible }: { visible: Ref<boolean> }) {
+export function usePlugins(enable: boolean, { visible }: { visible: Ref<boolean> }) {
 	const that: any = getCurrentInstance();
 	const { style } = useConfig();
 
@@ -24,6 +24,10 @@ export function usePlugins({ visible }: { visible: Ref<boolean> }) {
 
 	// 插件创建
 	function create(plugins: ClForm.Plugin[] = []) {
+		if (!enable) {
+			return false;
+		}
+
 		for (const i in ev) {
 			ev[i] = [];
 		}

+ 6 - 2
packages/crud/src/components/form/index.tsx

@@ -12,7 +12,11 @@ export default defineComponent({
 
 	props: {
 		inner: Boolean,
-		inline: Boolean
+		inline: Boolean,
+		enablePlugin: {
+			type: Boolean,
+			default: true
+		}
 	},
 
 	setup(props, { expose, slots }) {
@@ -40,7 +44,7 @@ export default defineComponent({
 		);
 
 		// 插件
-		const plugin = usePlugins({ visible });
+		const plugin = usePlugins(props.enablePlugin, { visible });
 
 		// 显示加载中
 		function showLoading() {

+ 6 - 1
packages/crud/src/components/search/index.tsx

@@ -139,7 +139,12 @@ export default defineComponent({
 				isEmpty(config.items) || (
 					<div class="cl-search">
 						{h(
-							<cl-form ref={Form} inner inline={config.inline} />,
+							<cl-form
+								ref={Form}
+								inner
+								inline={config.inline}
+								enable-plugin={false}
+							/>,
 							{},
 							{
 								append() {

+ 2 - 2
packages/crud/types/components/form/helper/plugins.d.ts

@@ -1,8 +1,8 @@
 /// <reference types="../index" />
 import { Ref } from "vue";
-export declare function usePlugins({ visible }: {
+export declare function usePlugins(enable: boolean, { visible }: {
     visible: Ref<boolean>;
 }): {
-    create: (plugins?: ClForm.Plugin[]) => void;
+    create: (plugins?: ClForm.Plugin[]) => false | undefined;
     submit: (data: any) => Promise<any>;
 };

+ 9 - 0
packages/crud/types/components/form/index.d.ts

@@ -1,11 +1,20 @@
 declare const _default: import("vue").DefineComponent<{
     inner: BooleanConstructor;
     inline: BooleanConstructor;
+    enablePlugin: {
+        type: BooleanConstructor;
+        default: boolean;
+    };
 }, () => any, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
     inner: BooleanConstructor;
     inline: BooleanConstructor;
+    enablePlugin: {
+        type: BooleanConstructor;
+        default: boolean;
+    };
 }>>, {
     inline: boolean;
     inner: boolean;
+    enablePlugin: boolean;
 }, {}>;
 export default _default;