mirror of
https://github.com/cool-team-official/cool-admin-vue.git
synced 2025-12-12 13:42:50 +00:00
优化
This commit is contained in:
parent
67e94cda63
commit
8109e99653
@ -9,7 +9,7 @@
|
||||
"lint:eslint": "eslint \"{src}/**/*.{vue,ts,tsx}\" --fix"
|
||||
},
|
||||
"dependencies": {
|
||||
"@cool-vue/crud": "^7.0.1-beta4",
|
||||
"@cool-vue/crud": "^7.0.1-beta6",
|
||||
"@element-plus/icons-vue": "^2.1.0",
|
||||
"@vueuse/core": "^10.4.0",
|
||||
"@wangeditor/editor": "^5.1.23",
|
||||
|
||||
4
packages/crud/index.d.ts
vendored
4
packages/crud/index.d.ts
vendored
@ -56,8 +56,8 @@ declare type List<T> = Array<DeepPartial<T> | (() => DeepPartial<T>)>;
|
||||
|
||||
// 字典选项
|
||||
declare type DictOptions = {
|
||||
label: string;
|
||||
value: any;
|
||||
label?: string;
|
||||
value?: any;
|
||||
color?: string;
|
||||
type?: string;
|
||||
[key: string]: any;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@cool-vue/crud",
|
||||
"version": "7.0.1-beta4",
|
||||
"version": "7.0.1-beta6",
|
||||
"private": false,
|
||||
"main": "./dist/index.umd.min.js",
|
||||
"typings": "types/index.d.ts",
|
||||
|
||||
@ -29,15 +29,14 @@ export function parseTableDict(value: any, item: ClTable.Column) {
|
||||
// 设置颜色
|
||||
if (item.dictColor) {
|
||||
options.forEach((e, i) => {
|
||||
if (!e.color) {
|
||||
e.color = style.colors[i];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 格式化方法
|
||||
const formatter = item.dictFormatter;
|
||||
|
||||
// 多个值
|
||||
const values = isArray(value) ? value : [value];
|
||||
// 绑定值
|
||||
const values = (isArray(value) ? value : [value]).filter((e) => e !== undefined);
|
||||
|
||||
// 返回值
|
||||
const list = values.map((v) => {
|
||||
@ -48,8 +47,8 @@ export function parseTableDict(value: any, item: ClTable.Column) {
|
||||
});
|
||||
|
||||
// 是否格式化
|
||||
if (formatter) {
|
||||
return formatter(list);
|
||||
if (item.dictFormatter) {
|
||||
return item.dictFormatter(list);
|
||||
} else {
|
||||
return list.map((e) => {
|
||||
return h(
|
||||
@ -66,14 +65,14 @@ export function parseTableDict(value: any, item: ClTable.Column) {
|
||||
/**
|
||||
* 解析 table.op.buttons
|
||||
*/
|
||||
export function parseTableOpButtons(buttons: any, { scope }: any) {
|
||||
export function parseTableOpButtons(buttons: any[], { scope }: any) {
|
||||
const { crud } = useCore();
|
||||
const { style } = useConfig();
|
||||
const slots = useSlots();
|
||||
|
||||
const list = getValue(buttons, { scope }) || ["edit", "delete"];
|
||||
const list: any[] = getValue(buttons, { scope }) || ["edit", "delete"];
|
||||
|
||||
return list.map((vnode: any) => {
|
||||
return list.map((vnode) => {
|
||||
if (vnode === "info") {
|
||||
return (
|
||||
<el-button
|
||||
|
||||
@ -74,15 +74,15 @@ export declare function useForm(): {
|
||||
name?: string | undefined;
|
||||
options?: {
|
||||
[x: string]: any;
|
||||
label: string;
|
||||
value: any;
|
||||
label?: string | undefined;
|
||||
value?: any;
|
||||
color?: string | undefined;
|
||||
type?: string | undefined;
|
||||
}[] | {
|
||||
value: {
|
||||
[x: string]: any;
|
||||
label: string;
|
||||
value: any;
|
||||
label?: string | undefined;
|
||||
value?: any;
|
||||
color?: string | undefined;
|
||||
type?: string | undefined;
|
||||
}[];
|
||||
@ -105,15 +105,15 @@ export declare function useForm(): {
|
||||
name?: string | undefined;
|
||||
options?: {
|
||||
[x: string]: any;
|
||||
label: string;
|
||||
value: any;
|
||||
label?: string | undefined;
|
||||
value?: any;
|
||||
color?: string | undefined;
|
||||
type?: string | undefined;
|
||||
}[] | {
|
||||
value: {
|
||||
[x: string]: any;
|
||||
label: string;
|
||||
value: any;
|
||||
label?: string | undefined;
|
||||
value?: any;
|
||||
color?: string | undefined;
|
||||
type?: string | undefined;
|
||||
}[];
|
||||
@ -136,15 +136,15 @@ export declare function useForm(): {
|
||||
name?: string | undefined;
|
||||
options?: {
|
||||
[x: string]: any;
|
||||
label: string;
|
||||
value: any;
|
||||
label?: string | undefined;
|
||||
value?: any;
|
||||
color?: string | undefined;
|
||||
type?: string | undefined;
|
||||
}[] | {
|
||||
value: {
|
||||
[x: string]: any;
|
||||
label: string;
|
||||
value: any;
|
||||
label?: string | undefined;
|
||||
value?: any;
|
||||
color?: string | undefined;
|
||||
type?: string | undefined;
|
||||
}[];
|
||||
|
||||
@ -13,15 +13,15 @@ export declare function useTable(props: any): {
|
||||
name?: string | undefined;
|
||||
options?: {
|
||||
[x: string]: any;
|
||||
label: string;
|
||||
value: any;
|
||||
label?: string | undefined;
|
||||
value?: any;
|
||||
color?: string | undefined;
|
||||
type?: string | undefined;
|
||||
}[] | {
|
||||
value: {
|
||||
[x: string]: any;
|
||||
label: string;
|
||||
value: any;
|
||||
label?: string | undefined;
|
||||
value?: any;
|
||||
color?: string | undefined;
|
||||
type?: string | undefined;
|
||||
}[];
|
||||
@ -41,15 +41,15 @@ export declare function useTable(props: any): {
|
||||
};
|
||||
dict: {
|
||||
[x: string]: any;
|
||||
label: string;
|
||||
value: any;
|
||||
label?: string | undefined;
|
||||
value?: any;
|
||||
color?: string | undefined;
|
||||
type?: string | undefined;
|
||||
}[] | {
|
||||
value: {
|
||||
[x: string]: any;
|
||||
label: string;
|
||||
value: any;
|
||||
label?: string | undefined;
|
||||
value?: any;
|
||||
color?: string | undefined;
|
||||
type?: string | undefined;
|
||||
}[];
|
||||
|
||||
2
packages/crud/types/utils/parse.d.ts
vendored
2
packages/crud/types/utils/parse.d.ts
vendored
@ -12,7 +12,7 @@ export declare function parseTableDict(value: any, item: ClTable.Column): string
|
||||
/**
|
||||
* 解析 table.op.buttons
|
||||
*/
|
||||
export declare function parseTableOpButtons(buttons: any, { scope }: any): any;
|
||||
export declare function parseTableOpButtons(buttons: any[], { scope }: any): any[];
|
||||
/**
|
||||
* 解析扩展组件
|
||||
*/
|
||||
|
||||
@ -9,13 +9,7 @@
|
||||
</cl-row>
|
||||
|
||||
<cl-row>
|
||||
<cl-table
|
||||
ref="Table"
|
||||
:default-sort="{
|
||||
prop: 'createTime',
|
||||
order: 'descending'
|
||||
}"
|
||||
/>
|
||||
<cl-table ref="Table" />
|
||||
</cl-row>
|
||||
|
||||
<cl-row>
|
||||
@ -154,7 +148,7 @@ const Table = useTable({
|
||||
{
|
||||
prop: "createTime",
|
||||
label: "创建时间",
|
||||
sortable: "custom",
|
||||
sortable: "desc",
|
||||
minWidth: 160
|
||||
},
|
||||
{
|
||||
|
||||
@ -282,10 +282,10 @@
|
||||
"@babel/helper-validator-identifier" "^7.22.20"
|
||||
to-fast-properties "^2.0.0"
|
||||
|
||||
"@cool-vue/crud@^7.0.1-beta4":
|
||||
version "7.0.1-beta4"
|
||||
resolved "https://registry.yarnpkg.com/@cool-vue/crud/-/crud-7.0.1-beta4.tgz#2bc541296edcb2af83aa5c7094795c996beff41f"
|
||||
integrity sha512-dD0lKPTSR5LGPJU9GHLyx/1fcGDq2Mnw6kj8rCLIqXlnDP78ufmE6iYVk2U23qgjxEDonHnij3/w6OmtRa1Vzg==
|
||||
"@cool-vue/crud@^7.0.1-beta6":
|
||||
version "7.0.1-beta6"
|
||||
resolved "https://registry.yarnpkg.com/@cool-vue/crud/-/crud-7.0.1-beta6.tgz#dc3b8d6c607fba4dc2b4b40f6906c8a70f58bb49"
|
||||
integrity sha512-DtUvZc4EQtfANvPMv9ydfNJxcmXsOaoUiWEf66vRSzDeOZ1K0a1u1Ha0y7R09C2HC2wla8GvKv0ySxM9aDLXNQ==
|
||||
dependencies:
|
||||
array.prototype.flat "^1.2.4"
|
||||
core-js "^3.21.1"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user