神仙都没用 1 年之前
父节点
当前提交
56e5357800

+ 2 - 1
packages/crud/index.d.ts

@@ -743,9 +743,10 @@ declare interface Config {
 			autoHeight: boolean;
 			contextMenu: ClTable.ContextMenu;
 			column: {
-				minWidth: number;
+				minWidth: number | string;
 				align: ElementPlus.Align;
 				headerAlign: ElementPlus.Align;
+				opWidth: number | string;
 			};
 			plugins: ClTable.Plugin[];
 		};

+ 1 - 1
packages/crud/package.json

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

+ 1 - 1
packages/crud/src/components/table/helper/height.ts

@@ -39,7 +39,7 @@ export function useHeight({ config, Table }: { Table: Vue.Ref<any>; config: ClTa
 				let n = vm.$el.nextSibling;
 
 				// 集合
-				let arr = [vm.$el];
+				const arr = [vm.$el];
 
 				while (n) {
 					if (n.offsetHeight > 0) {

+ 1 - 1
packages/crud/src/components/table/helper/render.tsx

@@ -46,7 +46,7 @@ export function useRender() {
 						ElTableColumn,
 						{
 							label: crud.dict.label.op,
-							width: "160px",
+							width: style.table.column.opWidth,
 							fixed: browser.isMini ? null : "right",
 							...item
 						},

+ 2 - 3
packages/crud/src/index.ts

@@ -1,13 +1,12 @@
 import { App } from "vue";
 import { useComponent } from "./components";
 import { useProvide } from "./provide";
-import temp from "./utils/temp";
+import global from "./utils/global";
 import "./static/index.scss";
 
 const Crud = {
 	install(app: App, options?: Options) {
-		// 临时
-		temp.set("__CrudApp__", app);
+		global.set("__CrudApp__", app);
 
 		// 穿透值
 		useProvide(app, options);

+ 4 - 2
packages/crud/src/main.ts

@@ -1,6 +1,8 @@
 import { createApp } from "vue";
 import App from "./App.vue";
-import Crud, { locale } from "./index";
+// import Crud, { locale } from "./index";
+import Crud, { locale } from "../dist/index.umd";
+import "../dist/index.css";
 
 import ElementPlus from "element-plus";
 import "element-plus/dist/index.css";
@@ -14,7 +16,7 @@ app.use(ElementPlus)
 				prop: "order",
 				order: "sort"
 			},
-			label: locale.en
+			label: locale.zhCn
 		},
 		style: {
 			// size: "default"

+ 4 - 3
packages/crud/src/provide.ts

@@ -64,13 +64,14 @@ function setConfig(app: App, options: Options = {}) {
 					autoHeight: true,
 					contextMenu: ["refresh", "check", "edit", "delete", "order-asc", "order-desc"],
 					column: {
-						align: "center"
+						align: "center",
+						opWidth: 160
 					}
 				}
 			},
 			events: {}
-		},
-		options || {}
+		} as Options,
+		options
 	);
 
 	// 初始化事件

+ 4 - 4
packages/crud/src/static/index.scss

@@ -508,10 +508,10 @@
 }
 
 .cl-dialog {
-	display: flex;
-	flex-direction: column;
-	border-radius: 6px;
-	padding: 0;
+	&.el-dialog {
+		border-radius: 6px;
+		padding: 0;
+	}
 
 	.el-dialog {
 		&__header {

+ 18 - 18
packages/crud/src/test/service.ts

@@ -3,92 +3,92 @@ import { uuid } from "../utils";
 
 const userList = [
 	{
-		id: "110000199206102819",
+		id: 1,
 		name: "楚行云",
 		createTime: "1996-09-14",
 		wages: 73026,
 		status: 1,
-		account: "ihknssft",
+		account: "chuxingyun",
 		occupation: 4,
 		phone: 13797353874
 	},
 	{
-		id: "410000199208224044",
+		id: 2,
 		name: "秦尘",
 		createTime: "1977-11-09",
 		wages: 74520,
 		status: 0,
-		account: "xlabchey",
+		account: "qincheng",
 		occupation: 3,
 		phone: 18593911044
 	},
 	{
-		id: "120000199708139664",
+		id: 3,
 		name: "叶凡",
 		createTime: "1982-11-28",
 		wages: 81420,
 		status: 0,
-		account: "xpqbtkul",
+		account: "yefan",
 		occupation: 1,
 		phone: 16234136338
 	},
 	{
-		id: "710000200203060278",
+		id: 4,
 		name: "白小纯",
 		createTime: "2012-12-17",
 		wages: 65197,
 		status: 1,
-		account: "kirukkje",
+		account: "baixiaochun",
 		occupation: 2,
 		phone: 16325661110
 	},
 	{
-		id: "210000201007157714",
+		id: 5,
 		name: "韩立",
 		createTime: "1982-07-10",
 		wages: 99107,
 		status: 1,
-		account: "rbrohvoj",
+		account: "hanli",
 		occupation: 2,
 		phone: 18486594866
 	},
 	{
-		id: "420000200901038044",
+		id: 6,
 		name: "唐三",
 		createTime: "2019-07-31",
 		wages: 80658,
 		status: 1,
-		account: "qtuwsfuh",
+		account: "tangsan",
 		occupation: 5,
 		phone: 15565014642
 	},
 	{
-		id: "150000197711136225",
+		id: 7,
 		name: "王林",
 		createTime: "2009-07-26",
 		wages: 57408,
 		status: 1,
-		account: "gxyhlwdq",
+		account: "wanglin",
 		occupation: 1,
 		phone: 13852767084
 	},
 	{
-		id: "710000198106232170",
+		id: 8,
 		name: "李强",
 		createTime: "2016-04-26",
 		wages: 71782,
 		status: 1,
-		account: "vruiimiy",
+		account: "liqiang",
 		occupation: 3,
 		phone: 18365332834
 	},
 	{
-		id: "530000199311309764",
+		id: 9,
 		name: "秦羽",
 		createTime: "1984-01-18",
 		wages: 87860,
 		status: 1,
-		account: "dtvkpyag",
+		account: "qinyu",
 		occupation: 0,
 		phone: 18149247129
 	}

+ 0 - 0
packages/crud/src/utils/temp.ts → packages/crud/src/utils/global.ts


+ 2 - 2
packages/crud/src/utils/vnode.tsx

@@ -1,7 +1,7 @@
 import { h, resolveComponent, toRaw, VNode } from "vue";
 import { isObject } from "./index";
 import { parseExtensionComponent } from "./parse";
-import temp from "./temp";
+import global from "./global";
 import { useConfig } from "../hooks";
 import { isFunction, isString } from "lodash-es";
 
@@ -48,7 +48,7 @@ export function parseNode(vnode: any, options: Options): VNode {
 
 	// 实例模式下,先注册到全局,再分解组件渲染
 	if (vnode.vm && !regs.get(vnode.name)) {
-		temp.vue.component(vnode.name, { ...vnode.vm });
+		global.vue.component(vnode.name, { ...vnode.vm });
 		regs.set(vnode.name, { ...vnode.vm });
 	}
 

+ 2 - 2
packages/crud/types/test/service.d.ts

@@ -8,7 +8,7 @@ declare class TestService {
     info(params: {
         id: any;
     }): Promise<{
-        id: string;
+        id: number;
         name: string;
         createTime: string;
         wages: number;
@@ -21,7 +21,7 @@ declare class TestService {
         ids: any[];
     }): Promise<void>;
     list(): Promise<{
-        id: string;
+        id: number;
         name: string;
         createTime: string;
         wages: number;

+ 7 - 0
packages/crud/types/utils/global.d.ts

@@ -0,0 +1,7 @@
+import { App } from "vue";
+declare const _default: {
+    readonly vue: App<any>;
+    get(key: string): any;
+    set(key: string, value: any): void;
+};
+export default _default;