This commit is contained in:
神仙都没用 2024-07-14 13:49:56 +08:00
parent c128d3ee7f
commit 56e5357800
13 changed files with 48 additions and 38 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,7 +1,7 @@
import { h, resolveComponent, toRaw, VNode } from "vue"; import { h, resolveComponent, toRaw, VNode } from "vue";
import { isObject } from "./index"; import { isObject } from "./index";
import { parseExtensionComponent } from "./parse"; import { parseExtensionComponent } from "./parse";
import temp from "./temp"; import global from "./global";
import { useConfig } from "../hooks"; import { useConfig } from "../hooks";
import { isFunction, isString } from "lodash-es"; 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)) { 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 }); regs.set(vnode.name, { ...vnode.vm });
} }

View File

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

7
packages/crud/types/utils/global.d.ts vendored Normal file
View File

@ -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;