mirror of
https://github.com/cool-team-official/cool-admin-vue.git
synced 2025-12-11 13:02:49 +00:00
优化 crud
This commit is contained in:
parent
3aeccff7b2
commit
6412330d2e
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@cool-vue/crud",
|
||||
"version": "7.2.10",
|
||||
"version": "7.2.12",
|
||||
"private": false,
|
||||
"main": "./dist/index.umd.min.js",
|
||||
"typings": "types/index.d.ts",
|
||||
|
||||
2064
packages/crud/pnpm-lock.yaml
generated
2064
packages/crud/pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -111,20 +111,23 @@ export default defineComponent({
|
||||
|
||||
// 搜素请求
|
||||
function search(params?: any) {
|
||||
const form = Form.value?.getForm();
|
||||
|
||||
function next(data: any) {
|
||||
Form.value?.done();
|
||||
close();
|
||||
|
||||
return crud.refresh({
|
||||
...data,
|
||||
...params,
|
||||
page: 1
|
||||
});
|
||||
}
|
||||
|
||||
if (config.onSearch) {
|
||||
config.onSearch(params, { next, close });
|
||||
config.onSearch(form, { next, close });
|
||||
} else {
|
||||
next(params);
|
||||
next(form);
|
||||
}
|
||||
}
|
||||
|
||||
@ -151,7 +154,9 @@ export default defineComponent({
|
||||
{
|
||||
type: e == "search" ? "primary" : null,
|
||||
size: style.size,
|
||||
onClick: fns[e]
|
||||
onClick: () => {
|
||||
fns[e]();
|
||||
}
|
||||
},
|
||||
{ default: () => crud.dict.label[e] }
|
||||
);
|
||||
|
||||
@ -96,7 +96,7 @@ export default defineComponent({
|
||||
// 清空表单验证
|
||||
function clear() {
|
||||
for (const i in form) {
|
||||
delete form[i];
|
||||
form[i] = undefined;
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { Mitt } from "../utils/mitt";
|
||||
import { isFunction } from "lodash-es";
|
||||
import { getCurrentInstance, inject, reactive } from "vue";
|
||||
import { computed, getCurrentInstance, inject, reactive } from "vue";
|
||||
|
||||
export function useCore() {
|
||||
const crud = inject("crud") as ClCrud.Ref;
|
||||
@ -60,22 +60,10 @@ export function useProxy(ctx: any) {
|
||||
}
|
||||
|
||||
export function useElApi(keys: string[], el: any) {
|
||||
const apis: obj = {};
|
||||
|
||||
keys.forEach((e) => {
|
||||
apis[e] = (...args: any[]) => {
|
||||
return el.value[e](...args);
|
||||
};
|
||||
});
|
||||
|
||||
return apis;
|
||||
}
|
||||
|
||||
export function useEventListener(name: string, cb: () => any) {
|
||||
window.removeEventListener(name, cb);
|
||||
window.addEventListener(name, cb);
|
||||
|
||||
cb();
|
||||
return keys.reduce((apis, key) => {
|
||||
apis[key] = computed(() => el.value?.[key]);
|
||||
return apis;
|
||||
}, {} as obj);
|
||||
}
|
||||
|
||||
export * from "./crud";
|
||||
|
||||
17
packages/crud/types/components/add-btn.d.ts
vendored
17
packages/crud/types/components/add-btn.d.ts
vendored
@ -1,17 +0,0 @@
|
||||
declare const _default: import("vue").DefineComponent<
|
||||
{},
|
||||
() => false | JSX.Element,
|
||||
{},
|
||||
{},
|
||||
{},
|
||||
import("vue").ComponentOptionsMixin,
|
||||
import("vue").ComponentOptionsMixin,
|
||||
{},
|
||||
string,
|
||||
import("vue").VNodeProps &
|
||||
import("vue").AllowedComponentProps &
|
||||
import("vue").ComponentCustomProps,
|
||||
Readonly<import("vue").ExtractPropTypes<{}>>,
|
||||
{}
|
||||
>;
|
||||
export default _default;
|
||||
17
packages/crud/types/components/adv-btn.d.ts
vendored
17
packages/crud/types/components/adv-btn.d.ts
vendored
@ -1,17 +0,0 @@
|
||||
declare const _default: import("vue").DefineComponent<
|
||||
{},
|
||||
() => JSX.Element,
|
||||
{},
|
||||
{},
|
||||
{},
|
||||
import("vue").ComponentOptionsMixin,
|
||||
import("vue").ComponentOptionsMixin,
|
||||
{},
|
||||
string,
|
||||
import("vue").VNodeProps &
|
||||
import("vue").AllowedComponentProps &
|
||||
import("vue").ComponentCustomProps,
|
||||
Readonly<import("vue").ExtractPropTypes<{}>>,
|
||||
{}
|
||||
>;
|
||||
export default _default;
|
||||
67
packages/crud/types/components/adv-search.d.ts
vendored
67
packages/crud/types/components/adv-search.d.ts
vendored
@ -1,67 +0,0 @@
|
||||
/// <reference types="../index" />
|
||||
import { PropType } from "vue";
|
||||
declare const _default: import("vue").DefineComponent<
|
||||
{
|
||||
items: {
|
||||
type: PropType<ClForm.Item[]>;
|
||||
default: () => never[];
|
||||
};
|
||||
title: StringConstructor;
|
||||
size: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: string;
|
||||
};
|
||||
op: {
|
||||
type: ArrayConstructor;
|
||||
default: () => string[];
|
||||
};
|
||||
onSearch: FunctionConstructor;
|
||||
},
|
||||
{
|
||||
open: () => void;
|
||||
close: () => void;
|
||||
reset: () => void;
|
||||
clear: () => void;
|
||||
search: () => void;
|
||||
Drawer: import("vue").Ref<any>;
|
||||
Form: import("vue").Ref<ClForm.Ref | undefined>;
|
||||
visible: import("vue").Ref<boolean>;
|
||||
},
|
||||
unknown,
|
||||
{},
|
||||
{},
|
||||
import("vue").ComponentOptionsMixin,
|
||||
import("vue").ComponentOptionsMixin,
|
||||
("clear" | "reset")[],
|
||||
"clear" | "reset",
|
||||
import("vue").VNodeProps &
|
||||
import("vue").AllowedComponentProps &
|
||||
import("vue").ComponentCustomProps,
|
||||
Readonly<
|
||||
import("vue").ExtractPropTypes<{
|
||||
items: {
|
||||
type: PropType<ClForm.Item[]>;
|
||||
default: () => never[];
|
||||
};
|
||||
title: StringConstructor;
|
||||
size: {
|
||||
type: (NumberConstructor | StringConstructor)[];
|
||||
default: string;
|
||||
};
|
||||
op: {
|
||||
type: ArrayConstructor;
|
||||
default: () => string[];
|
||||
};
|
||||
onSearch: FunctionConstructor;
|
||||
}>
|
||||
> & {
|
||||
onReset?: ((...args: any[]) => any) | undefined;
|
||||
onClear?: ((...args: any[]) => any) | undefined;
|
||||
},
|
||||
{
|
||||
items: ClForm.Item[];
|
||||
op: unknown[];
|
||||
size: string | number;
|
||||
}
|
||||
>;
|
||||
export default _default;
|
||||
@ -1,23 +0,0 @@
|
||||
declare const _default: import("vue").DefineComponent<
|
||||
{
|
||||
title: StringConstructor;
|
||||
},
|
||||
() => JSX.Element,
|
||||
unknown,
|
||||
{},
|
||||
{},
|
||||
import("vue").ComponentOptionsMixin,
|
||||
import("vue").ComponentOptionsMixin,
|
||||
{},
|
||||
string,
|
||||
import("vue").VNodeProps &
|
||||
import("vue").AllowedComponentProps &
|
||||
import("vue").ComponentCustomProps,
|
||||
Readonly<
|
||||
import("vue").ExtractPropTypes<{
|
||||
title: StringConstructor;
|
||||
}>
|
||||
>,
|
||||
{}
|
||||
>;
|
||||
export default _default;
|
||||
58
packages/crud/types/components/filter-group.d.ts
vendored
58
packages/crud/types/components/filter-group.d.ts
vendored
@ -1,58 +0,0 @@
|
||||
/// <reference types="../index" />
|
||||
import { PropType } from "vue";
|
||||
declare const _default: import("vue").DefineComponent<
|
||||
{
|
||||
data: {
|
||||
type: ObjectConstructor;
|
||||
default: () => {};
|
||||
};
|
||||
items: {
|
||||
type: PropType<ClForm.Item[]>;
|
||||
default: () => never[];
|
||||
};
|
||||
resetBtn: {
|
||||
type: BooleanConstructor;
|
||||
default: boolean;
|
||||
};
|
||||
onSearch: FunctionConstructor;
|
||||
},
|
||||
{
|
||||
Form: import("vue").Ref<ClForm.Ref | undefined>;
|
||||
loading: import("vue").Ref<boolean>;
|
||||
search: () => void;
|
||||
reset: () => void;
|
||||
},
|
||||
unknown,
|
||||
{},
|
||||
{},
|
||||
import("vue").ComponentOptionsMixin,
|
||||
import("vue").ComponentOptionsMixin,
|
||||
{},
|
||||
string,
|
||||
import("vue").VNodeProps &
|
||||
import("vue").AllowedComponentProps &
|
||||
import("vue").ComponentCustomProps,
|
||||
Readonly<
|
||||
import("vue").ExtractPropTypes<{
|
||||
data: {
|
||||
type: ObjectConstructor;
|
||||
default: () => {};
|
||||
};
|
||||
items: {
|
||||
type: PropType<ClForm.Item[]>;
|
||||
default: () => never[];
|
||||
};
|
||||
resetBtn: {
|
||||
type: BooleanConstructor;
|
||||
default: boolean;
|
||||
};
|
||||
onSearch: FunctionConstructor;
|
||||
}>
|
||||
>,
|
||||
{
|
||||
items: ClForm.Item[];
|
||||
data: Record<string, any>;
|
||||
resetBtn: boolean;
|
||||
}
|
||||
>;
|
||||
export default _default;
|
||||
23
packages/crud/types/components/filter.d.ts
vendored
23
packages/crud/types/components/filter.d.ts
vendored
@ -1,23 +0,0 @@
|
||||
declare const _default: import("vue").DefineComponent<
|
||||
{
|
||||
label: StringConstructor;
|
||||
},
|
||||
unknown,
|
||||
unknown,
|
||||
{},
|
||||
{},
|
||||
import("vue").ComponentOptionsMixin,
|
||||
import("vue").ComponentOptionsMixin,
|
||||
{},
|
||||
string,
|
||||
import("vue").VNodeProps &
|
||||
import("vue").AllowedComponentProps &
|
||||
import("vue").ComponentCustomProps,
|
||||
Readonly<
|
||||
import("vue").ExtractPropTypes<{
|
||||
label: StringConstructor;
|
||||
}>
|
||||
>,
|
||||
{}
|
||||
>;
|
||||
export default _default;
|
||||
53
packages/crud/types/components/filter/group.d.ts
vendored
53
packages/crud/types/components/filter/group.d.ts
vendored
@ -1,53 +0,0 @@
|
||||
/// <reference types="../index" />
|
||||
import { PropType } from "vue";
|
||||
declare const _default: import("vue").DefineComponent<
|
||||
{
|
||||
data: {
|
||||
type: ObjectConstructor;
|
||||
default: () => {};
|
||||
};
|
||||
items: {
|
||||
type: PropType<ClForm.Item[]>;
|
||||
default: () => never[];
|
||||
};
|
||||
resetBtn: {
|
||||
type: BooleanConstructor;
|
||||
default: boolean;
|
||||
};
|
||||
onSearch: FunctionConstructor;
|
||||
},
|
||||
() => true | JSX.Element,
|
||||
unknown,
|
||||
{},
|
||||
{},
|
||||
import("vue").ComponentOptionsMixin,
|
||||
import("vue").ComponentOptionsMixin,
|
||||
{},
|
||||
string,
|
||||
import("vue").VNodeProps &
|
||||
import("vue").AllowedComponentProps &
|
||||
import("vue").ComponentCustomProps,
|
||||
Readonly<
|
||||
import("vue").ExtractPropTypes<{
|
||||
data: {
|
||||
type: ObjectConstructor;
|
||||
default: () => {};
|
||||
};
|
||||
items: {
|
||||
type: PropType<ClForm.Item[]>;
|
||||
default: () => never[];
|
||||
};
|
||||
resetBtn: {
|
||||
type: BooleanConstructor;
|
||||
default: boolean;
|
||||
};
|
||||
onSearch: FunctionConstructor;
|
||||
}>
|
||||
>,
|
||||
{
|
||||
items: ClForm.Item[];
|
||||
data: Record<string, any>;
|
||||
resetBtn: boolean;
|
||||
}
|
||||
>;
|
||||
export default _default;
|
||||
17
packages/crud/types/components/flex1.d.ts
vendored
17
packages/crud/types/components/flex1.d.ts
vendored
@ -1,17 +0,0 @@
|
||||
declare const _default: import("vue").DefineComponent<
|
||||
{},
|
||||
() => JSX.Element,
|
||||
{},
|
||||
{},
|
||||
{},
|
||||
import("vue").ComponentOptionsMixin,
|
||||
import("vue").ComponentOptionsMixin,
|
||||
{},
|
||||
string,
|
||||
import("vue").VNodeProps &
|
||||
import("vue").AllowedComponentProps &
|
||||
import("vue").ComponentCustomProps,
|
||||
Readonly<import("vue").ExtractPropTypes<{}>>,
|
||||
{}
|
||||
>;
|
||||
export default _default;
|
||||
42
packages/crud/types/components/form-card.d.ts
vendored
42
packages/crud/types/components/form-card.d.ts
vendored
@ -1,42 +0,0 @@
|
||||
declare const _default: import("vue").DefineComponent<
|
||||
{
|
||||
label: StringConstructor;
|
||||
expand: {
|
||||
type: BooleanConstructor;
|
||||
default: boolean;
|
||||
};
|
||||
isExpand: {
|
||||
type: BooleanConstructor;
|
||||
default: boolean;
|
||||
};
|
||||
},
|
||||
() => JSX.Element,
|
||||
unknown,
|
||||
{},
|
||||
{},
|
||||
import("vue").ComponentOptionsMixin,
|
||||
import("vue").ComponentOptionsMixin,
|
||||
{},
|
||||
string,
|
||||
import("vue").VNodeProps &
|
||||
import("vue").AllowedComponentProps &
|
||||
import("vue").ComponentCustomProps,
|
||||
Readonly<
|
||||
import("vue").ExtractPropTypes<{
|
||||
label: StringConstructor;
|
||||
expand: {
|
||||
type: BooleanConstructor;
|
||||
default: boolean;
|
||||
};
|
||||
isExpand: {
|
||||
type: BooleanConstructor;
|
||||
default: boolean;
|
||||
};
|
||||
}>
|
||||
>,
|
||||
{
|
||||
expand: boolean;
|
||||
isExpand: boolean;
|
||||
}
|
||||
>;
|
||||
export default _default;
|
||||
76
packages/crud/types/components/form-tabs.d.ts
vendored
76
packages/crud/types/components/form-tabs.d.ts
vendored
@ -1,76 +0,0 @@
|
||||
import { PropType } from "vue";
|
||||
declare const _default: import("vue").DefineComponent<
|
||||
{
|
||||
modelValue: (NumberConstructor | StringConstructor)[];
|
||||
labels: {
|
||||
type: ArrayConstructor;
|
||||
default: () => never[];
|
||||
};
|
||||
justify: {
|
||||
type: StringConstructor;
|
||||
default: string;
|
||||
};
|
||||
color: {
|
||||
type: StringConstructor;
|
||||
default: string;
|
||||
};
|
||||
type: {
|
||||
type: PropType<"default" | "card">;
|
||||
default: string;
|
||||
};
|
||||
},
|
||||
{
|
||||
active: import("vue").Ref<string>;
|
||||
list: import("vue").Ref<any[]>;
|
||||
line: {
|
||||
width: string;
|
||||
offsetLeft: string;
|
||||
transform: string;
|
||||
backgroundColor: string;
|
||||
};
|
||||
refs: any;
|
||||
setRefs: (index: number) => (el: HTMLElement) => void;
|
||||
update: (val: any) => false | undefined;
|
||||
},
|
||||
unknown,
|
||||
{},
|
||||
{},
|
||||
import("vue").ComponentOptionsMixin,
|
||||
import("vue").ComponentOptionsMixin,
|
||||
("update:modelValue" | "change")[],
|
||||
"update:modelValue" | "change",
|
||||
import("vue").VNodeProps &
|
||||
import("vue").AllowedComponentProps &
|
||||
import("vue").ComponentCustomProps,
|
||||
Readonly<
|
||||
import("vue").ExtractPropTypes<{
|
||||
modelValue: (NumberConstructor | StringConstructor)[];
|
||||
labels: {
|
||||
type: ArrayConstructor;
|
||||
default: () => never[];
|
||||
};
|
||||
justify: {
|
||||
type: StringConstructor;
|
||||
default: string;
|
||||
};
|
||||
color: {
|
||||
type: StringConstructor;
|
||||
default: string;
|
||||
};
|
||||
type: {
|
||||
type: PropType<"default" | "card">;
|
||||
default: string;
|
||||
};
|
||||
}>
|
||||
> & {
|
||||
onChange?: ((...args: any[]) => any) | undefined;
|
||||
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
||||
},
|
||||
{
|
||||
type: "default" | "card";
|
||||
labels: unknown[];
|
||||
justify: string;
|
||||
color: string;
|
||||
}
|
||||
>;
|
||||
export default _default;
|
||||
41
packages/crud/types/components/form/helper.d.ts
vendored
41
packages/crud/types/components/form/helper.d.ts
vendored
@ -1,41 +0,0 @@
|
||||
/// <reference types="../index" />
|
||||
import { Ref } from "vue";
|
||||
declare type Config = ClForm.Config;
|
||||
declare type Form = Vue.Ref<any>;
|
||||
export declare function useAction({
|
||||
config,
|
||||
form,
|
||||
Form
|
||||
}: {
|
||||
config: Config;
|
||||
form: obj;
|
||||
Form: Form;
|
||||
}): {
|
||||
getForm: (prop: string) => any;
|
||||
setForm: (prop: string, value: any) => void;
|
||||
setData: (prop: string, value: any) => void;
|
||||
setConfig: (path: string, value: any) => void;
|
||||
setOptions: (prop: string, value: any[]) => void;
|
||||
setProps: (prop: string, value: any) => void;
|
||||
toggleItem: (prop: string, value?: boolean) => void;
|
||||
hideItem: (...props: string[]) => void;
|
||||
showItem: (...props: string[]) => void;
|
||||
setTitle: (value: string) => void;
|
||||
collapseItem: (e: any) => void;
|
||||
};
|
||||
export declare function useTabs({ config, Form }: { config: Config; Form: Form }): {
|
||||
active: Ref<any>;
|
||||
get: () => ClForm.Item | undefined;
|
||||
set: (data: any) => void;
|
||||
change: (value: any, isValid?: boolean) => Promise<unknown>;
|
||||
clear: () => void;
|
||||
mergeProp: (item: ClForm.Item) => void;
|
||||
};
|
||||
export declare function useApi({ Form }: { Form: Form }): {
|
||||
[key: string]: any;
|
||||
};
|
||||
export declare function usePlugins({ visible }: { visible: Ref<boolean> }): {
|
||||
create: (plugins?: ClForm.Plugin[]) => void;
|
||||
submit: (data: any) => Promise<any>;
|
||||
};
|
||||
export {};
|
||||
@ -1,17 +0,0 @@
|
||||
declare const _default: import("vue").DefineComponent<
|
||||
{},
|
||||
() => false | JSX.Element,
|
||||
{},
|
||||
{},
|
||||
{},
|
||||
import("vue").ComponentOptionsMixin,
|
||||
import("vue").ComponentOptionsMixin,
|
||||
{},
|
||||
string,
|
||||
import("vue").VNodeProps &
|
||||
import("vue").AllowedComponentProps &
|
||||
import("vue").ComponentCustomProps,
|
||||
Readonly<import("vue").ExtractPropTypes<{}>>,
|
||||
{}
|
||||
>;
|
||||
export default _default;
|
||||
24
packages/crud/types/components/pagination.d.ts
vendored
24
packages/crud/types/components/pagination.d.ts
vendored
@ -1,24 +0,0 @@
|
||||
declare const _default: import("vue").DefineComponent<
|
||||
{},
|
||||
{
|
||||
total: import("vue").Ref<number>;
|
||||
currentPage: import("vue").Ref<number>;
|
||||
pageSize: import("vue").Ref<number>;
|
||||
onCurrentChange: (index: number) => void;
|
||||
onSizeChange: (size: number) => void;
|
||||
setPagination: (res: any) => void;
|
||||
},
|
||||
{},
|
||||
{},
|
||||
{},
|
||||
import("vue").ComponentOptionsMixin,
|
||||
import("vue").ComponentOptionsMixin,
|
||||
{},
|
||||
string,
|
||||
import("vue").VNodeProps &
|
||||
import("vue").AllowedComponentProps &
|
||||
import("vue").ComponentCustomProps,
|
||||
Readonly<import("vue").ExtractPropTypes<{}>>,
|
||||
{}
|
||||
>;
|
||||
export default _default;
|
||||
58
packages/crud/types/components/query.d.ts
vendored
58
packages/crud/types/components/query.d.ts
vendored
@ -1,58 +0,0 @@
|
||||
declare const _default: import("vue").DefineComponent<
|
||||
{
|
||||
modelValue: null;
|
||||
list: {
|
||||
type: ArrayConstructor;
|
||||
required: true;
|
||||
};
|
||||
field: {
|
||||
type: StringConstructor;
|
||||
default: string;
|
||||
};
|
||||
multiple: BooleanConstructor;
|
||||
callback: FunctionConstructor;
|
||||
},
|
||||
{
|
||||
list: import("vue").Ref<
|
||||
{
|
||||
label: string;
|
||||
value: any;
|
||||
active: boolean;
|
||||
}[]
|
||||
>;
|
||||
selectItem: (event: any, item: any) => void;
|
||||
},
|
||||
unknown,
|
||||
{},
|
||||
{},
|
||||
import("vue").ComponentOptionsMixin,
|
||||
import("vue").ComponentOptionsMixin,
|
||||
("update:modelValue" | "change")[],
|
||||
"update:modelValue" | "change",
|
||||
import("vue").VNodeProps &
|
||||
import("vue").AllowedComponentProps &
|
||||
import("vue").ComponentCustomProps,
|
||||
Readonly<
|
||||
import("vue").ExtractPropTypes<{
|
||||
modelValue: null;
|
||||
list: {
|
||||
type: ArrayConstructor;
|
||||
required: true;
|
||||
};
|
||||
field: {
|
||||
type: StringConstructor;
|
||||
default: string;
|
||||
};
|
||||
multiple: BooleanConstructor;
|
||||
callback: FunctionConstructor;
|
||||
}>
|
||||
> & {
|
||||
onChange?: ((...args: any[]) => any) | undefined;
|
||||
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
||||
},
|
||||
{
|
||||
field: string;
|
||||
multiple: boolean;
|
||||
}
|
||||
>;
|
||||
export default _default;
|
||||
49
packages/crud/types/components/query/index.d.ts
vendored
49
packages/crud/types/components/query/index.d.ts
vendored
@ -1,49 +0,0 @@
|
||||
declare const _default: import("vue").DefineComponent<
|
||||
{
|
||||
modelValue: null;
|
||||
list: {
|
||||
type: ArrayConstructor;
|
||||
required: true;
|
||||
};
|
||||
field: {
|
||||
type: StringConstructor;
|
||||
default: string;
|
||||
};
|
||||
multiple: BooleanConstructor;
|
||||
callback: FunctionConstructor;
|
||||
},
|
||||
() => JSX.Element,
|
||||
unknown,
|
||||
{},
|
||||
{},
|
||||
import("vue").ComponentOptionsMixin,
|
||||
import("vue").ComponentOptionsMixin,
|
||||
("change" | "update:modelValue")[],
|
||||
"change" | "update:modelValue",
|
||||
import("vue").VNodeProps &
|
||||
import("vue").AllowedComponentProps &
|
||||
import("vue").ComponentCustomProps,
|
||||
Readonly<
|
||||
import("vue").ExtractPropTypes<{
|
||||
modelValue: null;
|
||||
list: {
|
||||
type: ArrayConstructor;
|
||||
required: true;
|
||||
};
|
||||
field: {
|
||||
type: StringConstructor;
|
||||
default: string;
|
||||
};
|
||||
multiple: BooleanConstructor;
|
||||
callback: FunctionConstructor;
|
||||
}>
|
||||
> & {
|
||||
onChange?: ((...args: any[]) => any) | undefined;
|
||||
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
||||
},
|
||||
{
|
||||
field: string;
|
||||
multiple: boolean;
|
||||
}
|
||||
>;
|
||||
export default _default;
|
||||
17
packages/crud/types/components/refresh-btn.d.ts
vendored
17
packages/crud/types/components/refresh-btn.d.ts
vendored
@ -1,17 +0,0 @@
|
||||
declare const _default: import("vue").DefineComponent<
|
||||
{},
|
||||
() => JSX.Element,
|
||||
{},
|
||||
{},
|
||||
{},
|
||||
import("vue").ComponentOptionsMixin,
|
||||
import("vue").ComponentOptionsMixin,
|
||||
{},
|
||||
string,
|
||||
import("vue").VNodeProps &
|
||||
import("vue").AllowedComponentProps &
|
||||
import("vue").ComponentCustomProps,
|
||||
Readonly<import("vue").ExtractPropTypes<{}>>,
|
||||
{}
|
||||
>;
|
||||
export default _default;
|
||||
17
packages/crud/types/components/row.d.ts
vendored
17
packages/crud/types/components/row.d.ts
vendored
@ -1,17 +0,0 @@
|
||||
declare const _default: import("vue").DefineComponent<
|
||||
{},
|
||||
() => JSX.Element,
|
||||
{},
|
||||
{},
|
||||
{},
|
||||
import("vue").ComponentOptionsMixin,
|
||||
import("vue").ComponentOptionsMixin,
|
||||
{},
|
||||
string,
|
||||
import("vue").VNodeProps &
|
||||
import("vue").AllowedComponentProps &
|
||||
import("vue").ComponentCustomProps,
|
||||
Readonly<import("vue").ExtractPropTypes<{}>>,
|
||||
{}
|
||||
>;
|
||||
export default _default;
|
||||
82
packages/crud/types/components/search-key.d.ts
vendored
82
packages/crud/types/components/search-key.d.ts
vendored
@ -1,82 +0,0 @@
|
||||
import { PropType } from "vue";
|
||||
declare const _default: import("vue").DefineComponent<
|
||||
{
|
||||
modelValue: StringConstructor;
|
||||
field: {
|
||||
type: StringConstructor;
|
||||
default: string;
|
||||
};
|
||||
fieldList: {
|
||||
type: PropType<
|
||||
{
|
||||
label: string;
|
||||
value: string;
|
||||
}[]
|
||||
>;
|
||||
default: () => never[];
|
||||
};
|
||||
onSearch: FunctionConstructor;
|
||||
placeholder: StringConstructor;
|
||||
width: {
|
||||
type: StringConstructor;
|
||||
default: string;
|
||||
};
|
||||
},
|
||||
{
|
||||
value: import("vue").Ref<string>;
|
||||
placeholder: import("vue").ComputedRef<string>;
|
||||
selectField: import("vue").Ref<string>;
|
||||
search: (this: any, ...args: any[]) => any;
|
||||
onKeydown: ({ keyCode }: any) => void;
|
||||
onInput: (val: string) => void;
|
||||
onChange: () => void;
|
||||
onFieldChange: () => void;
|
||||
},
|
||||
unknown,
|
||||
{},
|
||||
{},
|
||||
import("vue").ComponentOptionsMixin,
|
||||
import("vue").ComponentOptionsMixin,
|
||||
("update:modelValue" | "change" | "field-change")[],
|
||||
"update:modelValue" | "change" | "field-change",
|
||||
import("vue").VNodeProps &
|
||||
import("vue").AllowedComponentProps &
|
||||
import("vue").ComponentCustomProps,
|
||||
Readonly<
|
||||
import("vue").ExtractPropTypes<{
|
||||
modelValue: StringConstructor;
|
||||
field: {
|
||||
type: StringConstructor;
|
||||
default: string;
|
||||
};
|
||||
fieldList: {
|
||||
type: PropType<
|
||||
{
|
||||
label: string;
|
||||
value: string;
|
||||
}[]
|
||||
>;
|
||||
default: () => never[];
|
||||
};
|
||||
onSearch: FunctionConstructor;
|
||||
placeholder: StringConstructor;
|
||||
width: {
|
||||
type: StringConstructor;
|
||||
default: string;
|
||||
};
|
||||
}>
|
||||
> & {
|
||||
onChange?: ((...args: any[]) => any) | undefined;
|
||||
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
||||
"onField-change"?: ((...args: any[]) => any) | undefined;
|
||||
},
|
||||
{
|
||||
width: string;
|
||||
field: string;
|
||||
fieldList: {
|
||||
label: string;
|
||||
value: string;
|
||||
}[];
|
||||
}
|
||||
>;
|
||||
export default _default;
|
||||
78
packages/crud/types/components/table/helper.d.ts
vendored
78
packages/crud/types/components/table/helper.d.ts
vendored
@ -1,78 +0,0 @@
|
||||
/// <reference types="../index" />
|
||||
declare type Emit = (name: "selection-change" | "sort-change", ...args: any[]) => void;
|
||||
declare type Table = Vue.Ref<any>;
|
||||
declare type Config = ClTable.Config;
|
||||
declare interface Sort {
|
||||
defaultSort: {
|
||||
prop?: string;
|
||||
order?: string;
|
||||
};
|
||||
changeSort(prop: string, order: string): void;
|
||||
}
|
||||
export declare function useSort({
|
||||
config,
|
||||
emit,
|
||||
Table
|
||||
}: {
|
||||
config: Config;
|
||||
emit: Emit;
|
||||
Table: Table;
|
||||
}): {
|
||||
defaultSort:
|
||||
| {
|
||||
prop: string;
|
||||
order: "descending" | "ascending";
|
||||
}
|
||||
| {
|
||||
prop?: undefined;
|
||||
order?: undefined;
|
||||
};
|
||||
onSortChange: ({ prop, order }: { prop: string | undefined; order: string }) => void;
|
||||
changeSort: (prop: string, order: string) => void;
|
||||
};
|
||||
export declare function useRow({
|
||||
Table,
|
||||
config,
|
||||
Sort
|
||||
}: {
|
||||
Table: Table;
|
||||
config: Config;
|
||||
Sort: Sort;
|
||||
}): {
|
||||
onRowContextMenu: (row: any, column: any, event: any) => void;
|
||||
};
|
||||
export declare function useHeight({ config, Table }: { Table: Table; config: Config }): {
|
||||
isAuto: import("vue").ComputedRef<boolean>;
|
||||
maxHeight: import("vue").Ref<number>;
|
||||
calcMaxHeight: (this: any, ...args: any[]) => any;
|
||||
};
|
||||
export declare function useSelection({ emit }: { emit: Emit }): {
|
||||
selection: obj[];
|
||||
onSelectionChange: (selection: any[]) => void;
|
||||
};
|
||||
export declare function useData({ config, Table }: { config: Config; Table: Table }): {
|
||||
data: import("vue").Ref<any[]>;
|
||||
setData: (list: any[]) => void;
|
||||
};
|
||||
export declare function useOp({ config }: { config: Config }): {
|
||||
visible: import("vue").Ref<boolean>;
|
||||
reBuild: (cb?: fn) => Promise<void>;
|
||||
showColumn: (prop: string | string[], status?: boolean) => void;
|
||||
hideColumn: (prop: string | string[]) => void;
|
||||
setColumns: (list: ClTable.Column[]) => void;
|
||||
};
|
||||
export declare function useRender(): {
|
||||
renderColumn: (columns: ClTable.Column[]) => (
|
||||
| import("vue").VNode<
|
||||
import("vue").RendererNode,
|
||||
import("vue").RendererElement,
|
||||
{
|
||||
[key: string]: any;
|
||||
}
|
||||
>
|
||||
| null
|
||||
)[];
|
||||
renderEmpty: (emptyText: string) => JSX.Element;
|
||||
renderAppend: () => JSX.Element;
|
||||
};
|
||||
export {};
|
||||
9
packages/crud/types/hooks/browser.d.ts
vendored
9
packages/crud/types/hooks/browser.d.ts
vendored
@ -1,9 +0,0 @@
|
||||
import { App } from "vue";
|
||||
export declare type Browser = {
|
||||
screen: string;
|
||||
isMini: boolean;
|
||||
};
|
||||
export declare function useBrowser(app?: App): {
|
||||
screen: string;
|
||||
isMini: boolean;
|
||||
};
|
||||
43
packages/crud/types/hooks/core.d.ts
vendored
43
packages/crud/types/hooks/core.d.ts
vendored
@ -1,43 +0,0 @@
|
||||
/// <reference types="../index" />
|
||||
import { Browser } from "./browser";
|
||||
export declare function useRefs(): {
|
||||
refs: {
|
||||
[key: string]: obj;
|
||||
};
|
||||
setRefs: (name: string) => (el: any) => void;
|
||||
};
|
||||
export declare function useGlobal(): GlobalOptions;
|
||||
export declare function useTools(): {
|
||||
slots: Readonly<{
|
||||
[name: string]: import("vue").Slot | undefined;
|
||||
}>;
|
||||
getValue: (data: any, params?: any) => any;
|
||||
dict: ClCrud.Dict;
|
||||
permission: ClCrud.Permission;
|
||||
style: {
|
||||
size: ElementPlus.Size;
|
||||
};
|
||||
events: {
|
||||
[key: string]: (...args: any[]) => any;
|
||||
};
|
||||
render: {
|
||||
autoHeight: boolean;
|
||||
functionSlots: {
|
||||
exclude: string[];
|
||||
};
|
||||
};
|
||||
crud: any;
|
||||
browser: Browser;
|
||||
};
|
||||
export declare function useCore(): {
|
||||
crud: ClCrud.Provide;
|
||||
mitt: Emitter;
|
||||
};
|
||||
export declare function useElApi(
|
||||
keys: string[],
|
||||
el: any
|
||||
): {
|
||||
[key: string]: any;
|
||||
};
|
||||
export declare function useConfig({ props }: any): any;
|
||||
export declare function useEventListener(name: string, cb: () => any): void;
|
||||
6
packages/crud/types/hooks/form.d.ts
vendored
6
packages/crud/types/hooks/form.d.ts
vendored
@ -1,6 +0,0 @@
|
||||
export declare const format: any;
|
||||
declare const _default: {
|
||||
bind(data: any): any;
|
||||
submit(data: any): any;
|
||||
};
|
||||
export default _default;
|
||||
1
packages/crud/types/hooks/index.d.ts
vendored
1
packages/crud/types/hooks/index.d.ts
vendored
@ -13,5 +13,4 @@ export declare function useRefs(): {
|
||||
};
|
||||
export declare function useProxy(ctx: any): any;
|
||||
export declare function useElApi(keys: string[], el: any): obj;
|
||||
export declare function useEventListener(name: string, cb: () => any): void;
|
||||
export * from "./crud";
|
||||
|
||||
7
packages/crud/types/hooks/plugins.d.ts
vendored
7
packages/crud/types/hooks/plugins.d.ts
vendored
@ -1,7 +0,0 @@
|
||||
/// <reference types="../index" />
|
||||
/**
|
||||
* 设置聚焦,prop为空则默认第一个选项
|
||||
* @param prop
|
||||
* @returns
|
||||
*/
|
||||
export declare function setFocus(prop?: string): ClForm.Plugin;
|
||||
1
packages/crud/types/hooks/proxy.d.ts
vendored
1
packages/crud/types/hooks/proxy.d.ts
vendored
@ -1 +0,0 @@
|
||||
export declare function useProxy(ctx: any): any;
|
||||
7
packages/crud/types/utils/temp.d.ts
vendored
7
packages/crud/types/utils/temp.d.ts
vendored
@ -1,7 +0,0 @@
|
||||
import { App } from "vue";
|
||||
declare const _default: {
|
||||
readonly vue: App<any>;
|
||||
get(key: string): any;
|
||||
set(key: string, value: any): void;
|
||||
};
|
||||
export default _default;
|
||||
34
packages/crud/types/utils/test.d.ts
vendored
34
packages/crud/types/utils/test.d.ts
vendored
@ -1,34 +0,0 @@
|
||||
export declare const UserList: (
|
||||
| {
|
||||
id: number;
|
||||
name: string;
|
||||
createTime: string;
|
||||
price: number;
|
||||
status: number;
|
||||
hook: string;
|
||||
user: {
|
||||
name: string;
|
||||
};
|
||||
t2: string;
|
||||
tags: number[];
|
||||
}
|
||||
| {
|
||||
id: number;
|
||||
name: string;
|
||||
createTime: string;
|
||||
price: number;
|
||||
status: number;
|
||||
tags: number[];
|
||||
hook?: undefined;
|
||||
user?: undefined;
|
||||
t2?: undefined;
|
||||
}
|
||||
)[];
|
||||
export declare const TestService: {
|
||||
page: (p: any) => Promise<unknown>;
|
||||
list: (p: any) => Promise<unknown>;
|
||||
info: (d: any) => Promise<unknown>;
|
||||
add: (d: any) => Promise<void>;
|
||||
delete: (d: any) => Promise<unknown>;
|
||||
update: (d: any) => Promise<void>;
|
||||
};
|
||||
@ -7,6 +7,8 @@
|
||||
|
||||
<template #right>
|
||||
<cl-crud ref="Crud">
|
||||
<cl-adv-search ref="AdvSearch" />
|
||||
|
||||
<cl-row>
|
||||
<!-- 刷新按钮 -->
|
||||
<cl-refresh-btn />
|
||||
@ -25,6 +27,8 @@
|
||||
</el-button>
|
||||
<cl-flex1 />
|
||||
<cl-search-key placeholder="搜索用户名、姓名" />
|
||||
|
||||
<cl-adv-btn />
|
||||
</cl-row>
|
||||
|
||||
<cl-row>
|
||||
@ -59,7 +63,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="sys-user" setup>
|
||||
import { useTable, useUpsert, useCrud, setFocus } from '@cool-vue/crud';
|
||||
import { useTable, useUpsert, useCrud, setFocus, useAdvSearch } from '@cool-vue/crud';
|
||||
import { useCool } from '/@/cool';
|
||||
import DeptList from './components/dept-list.vue';
|
||||
import UserMove from './components/user-move.vue';
|
||||
@ -330,4 +334,16 @@ async function toMove(item?: Eps.BaseSysDepartmentEntity) {
|
||||
|
||||
refs.userMove.open(ids);
|
||||
}
|
||||
|
||||
const AdvSearch = useAdvSearch({
|
||||
items: [
|
||||
{
|
||||
label: '11',
|
||||
prop: 'name',
|
||||
component: {
|
||||
name: 'el-input'
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
</script>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user