🔱: [client] sync upgrade with 5 commits [trident-sync]

refactor: 1
refactor: 1.11.1
refactor: 1.11.1
perf: useFs优化,增加context:UseFsContext
pull/14/head
GitHub Actions Bot 2023-03-17 19:23:57 +00:00
parent 6ec697b010
commit 9f1f36774d
30 changed files with 86 additions and 63 deletions

View File

@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.11.1](https://github.com/fast-crud/fast-crud/compare/v1.11.0...v1.11.1) (2023-03-17)
**Note:** Version bump only for package @fast-crud/fs-admin-antdv
# [1.11.0](https://github.com/fast-crud/fast-crud/compare/v1.10.0...v1.11.0) (2023-03-16)

View File

@ -1,6 +1,6 @@
{
"name": "@fast-crud/fs-admin-antdv",
"version": "1.11.0",
"version": "1.11.1",
"private": true,
"scripts": {
"dev": "vite",
@ -24,9 +24,9 @@
"@ant-design/icons-vue": "^6.1.0",
"@aws-sdk/client-s3": "^3.292.0",
"@aws-sdk/s3-request-presigner": "^3.292.0",
"@fast-crud/fast-crud": "^1.11.0",
"@fast-crud/fast-extends": "^1.11.0",
"@fast-crud/ui-antdv": "^1.11.0",
"@fast-crud/fast-crud": "^1.11.1",
"@fast-crud/fast-extends": "^1.11.1",
"@fast-crud/ui-antdv": "^1.11.1",
"@iconify/iconify": "^3.1.0",
"@iconify/json": "^2.2.35",
"@purge-icons/generated": "^0.9.0",

View File

@ -3,7 +3,7 @@ import cascaderData from "./cascader-data";
import pcaDataLittle from "./pca-data-little";
// @ts-ignore
import { TreeNodesLazyLoader, getPcaData } from "./pcas-data";
import _ from "lodash-es";
const openStatus = [
{ value: "1", label: "打开", color: "success", icon: "ion:radio-button-on" },
{ value: "2", label: "停止", color: "cyan" },
@ -22,6 +22,20 @@ const textStatus = [
{ id: "0", text: "关闭", color: "red" }
];
let manyStatus = [
{ value: "1", label: "打开", color: "success", icon: "ion:radio-button-on" },
{ value: "2", label: "停止", color: "cyan" },
{ value: "0", label: "关闭", color: "red", icon: "ion:radio-button-off" }
];
for (let i = 0; i < 8; i++) {
manyStatus = manyStatus.concat(_.cloneDeep(manyStatus));
}
let idIndex = 0;
for (const item of manyStatus) {
idIndex++;
item.value = idIndex + "";
}
export function GetTreeChildrenByParentId(parentId: any) {
return TreeNodesLazyLoader.getChildren(parentId);
}
@ -53,6 +67,17 @@ export default [
};
}
},
{
path: "/mock/dicts/ManyOpenStatusEnum",
method: "get",
handle() {
return {
code: 0,
msg: "success",
data: manyStatus
};
}
},
{
path: "/mock/dicts/moreOpenStatusEnum",
method: "get",

View File

@ -24,10 +24,10 @@ function install(app: any, options: any = {}) {
},
/**
* useCrud
* @param contextuseCrud
* @param propsuseCrud
*/
commonOptions(context: UseCrudProps): CrudOptions {
const crudBinding = context.crudExpose?.crudBinding;
commonOptions(props: UseCrudProps): CrudOptions {
const crudBinding = props.crudExpose?.crudBinding;
const opts: CrudOptions = {
table: {
size: "small",
@ -92,7 +92,8 @@ function install(app: any, options: any = {}) {
};
// 从 useCrud({permission}) 里获取permission参数去设置各个按钮的权限
const crudPermission = useCrudPermission({ permission: context.permission });
const permission = props.context?.permission || null;
const crudPermission = useCrudPermission({ permission });
return crudPermission.merge(opts);
}
});

View File

@ -57,70 +57,70 @@ export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOpti
title: "字典1",
type: "dict-select",
dict: dict({
url: "/mock/dicts/OpenStatusEnum?from=dict1"
url: "/mock/dicts/ManyOpenStatusEnum?from=dict1"
})
},
dict2: {
title: "字典2",
type: "dict-select",
dict: dict({
url: "/mock/dicts/OpenStatusEnum?from=dict2"
url: "/mock/dicts/ManyOpenStatusEnum?from=dict2"
})
},
dict3: {
title: "字典3",
type: "dict-select",
dict: dict({
url: "/mock/dicts/OpenStatusEnum?from=dict3"
url: "/mock/dicts/ManyOpenStatusEnum?from=dict3"
})
},
dict4: {
title: "字典4",
type: "dict-select",
dict: dict({
url: "/mock/dicts/OpenStatusEnum?from=dict4"
url: "/mock/dicts/ManyOpenStatusEnum?from=dict4"
})
},
dict5: {
title: "字典5",
type: "dict-select",
dict: dict({
url: "/mock/dicts/OpenStatusEnum?from=dict5"
url: "/mock/dicts/ManyOpenStatusEnum?from=dict5"
})
},
dict6: {
title: "字典6",
type: "dict-select",
dict: dict({
url: "/mock/dicts/OpenStatusEnum?from=dict6"
url: "/mock/dicts/ManyOpenStatusEnum?from=dict6"
})
},
dict7: {
title: "字典7",
type: "dict-select",
dict: dict({
url: "/mock/dicts/OpenStatusEnum?from=dict7"
url: "/mock/dicts/ManyOpenStatusEnum?from=dict7"
})
},
dict8: {
title: "字典8",
type: "dict-select",
dict: dict({
url: "/mock/dicts/OpenStatusEnum?from=dict8"
url: "/mock/dicts/ManyOpenStatusEnum?from=dict8"
})
},
dict9: {
title: "字典9",
type: "dict-select",
dict: dict({
url: "/mock/dicts/OpenStatusEnum?from=dict9"
url: "/mock/dicts/ManyOpenStatusEnum?from=dict9"
})
},
dict10: {
title: "字典10",
type: "dict-select",
dict: dict({
url: "/mock/dicts/OpenStatusEnum?from=dict10"
url: "/mock/dicts/ManyOpenStatusEnum?from=dict10"
})
},
text1: {

View File

@ -29,7 +29,7 @@ export default defineComponent({
//
onMounted(async () => {
const customValue = {};
const { crudExpose, extraExport } = await useFsAsync({ crudRef, crudBinding, createCrudOptions, customValue });
const { crudExpose, context } = await useFsAsync({ crudRef, crudBinding, createCrudOptions, context: customValue });
//
await crudExpose.doRefresh();
});

View File

@ -11,7 +11,7 @@ export default defineComponent({
name: "FormLinkage",
setup() {
const customValue: any = {}; //createCrudOptions
const { crudBinding, crudRef, crudExpose, customExport } = useFs({ createCrudOptions, customValue });
const { crudBinding, crudRef, crudExpose, context } = useFs({ createCrudOptions, context: customValue });
//
onMounted(() => {

View File

@ -2,7 +2,8 @@ import * as api from "./api.js";
import _ from "lodash-es";
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
export default function ({ crudExpose, localDataRef }: CreateCrudOptionsProps): CreateCrudOptionsRet {
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
const localDataRef = context.localDataRef;
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
const { page } = query;
//总数据

View File

@ -36,7 +36,7 @@ export default defineComponent({
const ret = await GetList({ page: { offset: 0, limit: 99999999 }, query: {}, sort: {} });
localDataRef.value = ret.records;
const { crudExpose } = useFs({ crudBinding, crudRef, createCrudOptions, localDataRef });
const { crudExpose } = useFs({ crudBinding, crudRef, createCrudOptions, context: { localDataRef } });
//
await crudExpose.doRefresh();

View File

@ -3,7 +3,7 @@ import { ref, shallowRef } from "vue";
import SubTable from "./sub-table/index.vue";
import { AddReq, compute, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
export default function ({ crudExpose, asideTableRef }: CreateCrudOptionsProps): CreateCrudOptionsRet {
export default function ({ crudExpose, context: { asideTableRef } }: CreateCrudOptionsProps): CreateCrudOptionsRet {
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
return await api.GetList(query);
};

View File

@ -26,7 +26,7 @@ export default defineComponent({
setup() {
const asideTableRef = ref();
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, asideTableRef });
const { crudBinding, crudRef, crudExpose, context } = useFs({ createCrudOptions, context: { asideTableRef } });
//
onMounted(() => {

View File

@ -1,7 +1,7 @@
import * as api from "./api";
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
export default function ({ crudExpose, props, ctx }: CreateCrudOptionsProps): CreateCrudOptionsRet {
export default function ({ crudExpose, context: { props, ctx } }: CreateCrudOptionsProps): CreateCrudOptionsRet {
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
return await api.GetList(query);
};

View File

@ -20,7 +20,7 @@ export default defineComponent({
},
emits: ["update:modelValue"],
setup(props, ctx) {
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, props, ctx });
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context: { props, ctx } });
//
onMounted(() => {

View File

@ -18,7 +18,6 @@ export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOpti
};
return {
output: {},
crudOptions: {
settings: {
viewFormUseCellComponent: true

View File

@ -19,8 +19,8 @@ import { useFs, UseFsProps } from "@fast-crud/fast-crud";
export default defineComponent({
name: "BasisColumnMergePlugin",
setup() {
const customValue: any = {}; //createCrudOptions
const { crudBinding, crudRef, crudExpose, customExport } = useFs({ createCrudOptions, customValue });
const context: any = {}; //createCrudOptions
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context });
//
onMounted(() => {
crudExpose.doRefresh();

View File

@ -1,6 +1,6 @@
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
import * as api from "./api";
export default function ({ crudExpose, customValue }: CreateCrudOptionsProps): CreateCrudOptionsRet {
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
return await api.GetList(query);
};
@ -17,8 +17,6 @@ export default function ({ crudExpose, customValue }: CreateCrudOptionsProps): C
};
return {
//自定义变量返回
customExport: {},
crudOptions: {
// 自定义crudOptions配置
request: {

View File

@ -19,9 +19,6 @@ import createCrudOptions from "./crud";
export default defineComponent({
name: "FsCrudFirst",
setup() {
// , createCrudOptions
const customValue: any = {};
// // crudref
// const crudRef: Ref = ref();
// // crud ref
@ -35,7 +32,7 @@ export default defineComponent({
// =======fs=========
// ===============
const { crudRef, crudBinding, crudExpose, customExport } = useFs({ createCrudOptions, customValue });
const { crudRef, crudBinding, crudExpose, context } = useFs({ createCrudOptions, context: {} });
//
onMounted(() => {

View File

@ -16,7 +16,7 @@ import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, Edi
import _ from "lodash-es";
//crudOptions
const createCrudOptions = function ({ crudOptions, customValue }: CreateCrudOptionsProps): CreateCrudOptionsRet {
const createCrudOptions = function ({}: CreateCrudOptionsProps): CreateCrudOptionsRet {
//crud ----
const records = [{ id: 1, name: "Hello World", type: 1 }];
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
@ -88,9 +88,6 @@ const createCrudOptions = function ({ crudOptions, customValue }: CreateCrudOpti
export default defineComponent({
name: "FsCrudHelloWorld",
setup() {
// , createCrudOptions
const customValue: any = {};
// // crudref
// const crudRef: Ref = ref();
// // crud ref
@ -98,13 +95,13 @@ export default defineComponent({
// //
// const { crudExpose } = useExpose({ crudRef, crudBinding });
// // crud
// const { crudOptions, customExport } = createCrudOptions({ crudExpose, customValue });
// const { crudOptions, customExport } = createCrudOptions({ crudExpose, context });
// // crud
// const { resetCrudOptions, appendCrudBinding } = useCrud({ crudExpose, crudOptions });
// =======fs=========
// ===============
const { crudRef, crudBinding, crudExpose, customExport } = useFs({ createCrudOptions, customValue });
const { crudRef, crudBinding, crudExpose, context } = useFs({ createCrudOptions, context: {} });
//
onMounted(() => {

View File

@ -21,8 +21,7 @@ import _ from "lodash-es";
export default defineComponent({
name: "BasisReset",
setup() {
const customValue: any = {}; //createCrudOptions
const { crudBinding, crudRef, crudExpose, customExport, crudOptions, resetCrudOptions, appendBindingOptions } = useFs({ createCrudOptions, customValue } as UseFsProps);
const { crudBinding, crudRef, crudExpose, context, crudOptions, resetCrudOptions, appendBindingOptions } = useFs({ createCrudOptions, context: {} });
setTimeout(() => {
//crudOptions

View File

@ -19,7 +19,6 @@ export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOpti
};
return {
output: {},
crudOptions: {
request: {
pageRequest,

View File

@ -18,7 +18,7 @@ import createCrudOptions from "./crud.js";
export default defineComponent({
name: "BasisValueChange",
setup() {
const { crudBinding, crudRef, crudExpose, output } = useFs({ createCrudOptions });
const { crudBinding, crudRef, crudExpose, context } = useFs({ createCrudOptions });
//
onMounted(() => {
@ -28,7 +28,7 @@ export default defineComponent({
return {
crudBinding,
crudRef,
...output
...context
};
}
});

View File

@ -18,8 +18,8 @@ import createCrudOptions from "./crud";
export default defineComponent({
name: "DictSharedManager",
setup() {
const customValue: any = {}; //createCrudOptions
const { crudBinding, crudRef, crudExpose, customExport } = useFs({ createCrudOptions, customValue });
const context: any = {}; //createCrudOptions
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context });
//
onMounted(() => {

View File

@ -20,7 +20,7 @@ export default defineComponent({
setup() {
// crudref
const customValue: any = {}; //createCrudOptions
const { crudBinding, crudRef, crudExpose, customExport } = useFs({ createCrudOptions, customValue });
const { crudBinding, crudRef, crudExpose, context } = useFs({ createCrudOptions, context: customValue });
//
onMounted(() => {

View File

@ -15,8 +15,7 @@ import createCrudOptions from "./crud.jsx";
export default defineComponent({
name: "FormBase",
setup() {
const customValue: any = {}; //createCrudOptions
const { crudBinding, crudRef, crudExpose, customExport } = useFs({ createCrudOptions, customValue } as UseFsProps);
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions });
//
onMounted(async () => {

View File

@ -19,7 +19,7 @@ export default defineComponent({
name: "FormCustomForm",
setup(props, ctx) {
//
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions } as UseFsProps);
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions });
onMounted(() => {
crudExpose.doRefresh();

View File

@ -16,7 +16,7 @@ export default defineComponent({
name: "FormSingleColumn",
setup() {
const customValue: any = {}; //createCrudOptions
const { crudBinding, crudRef, crudExpose, customExport } = useFs({ createCrudOptions, customValue } as UseFsProps);
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context: customValue });
//
onMounted(async () => {

View File

@ -26,7 +26,7 @@ export default defineComponent({
setup() {
// permissioncommonOptionsactionbarrowHandleshow
// ./src/plugin/fast-crud/index.js 75-77
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, permission: "sys:auth:per" });
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context: { permission: "sys:auth:per" } });
//
onMounted(async () => {

View File

@ -1,7 +1,7 @@
import * as api from "./api";
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
export default function ({ crudExpose, authz }: CreateCrudOptionsProps): CreateCrudOptionsRet {
export default function ({ crudExpose, context: { authz } }: CreateCrudOptionsProps): CreateCrudOptionsRet {
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
return await api.GetList(query);
};

View File

@ -11,14 +11,14 @@
</template>
<script lang="ts">
import {defineComponent, onMounted, ref} from "vue";
import {useFs} from "@fast-crud/fast-crud";
import { defineComponent, onMounted, ref } from "vue";
import { useFs } from "@fast-crud/fast-crud";
import createCrudOptions from "./crud";
import * as permissionApi from "../permission/api";
import * as api from "./api";
import {message} from "ant-design-vue";
import { message } from "ant-design-vue";
import FsPermissionTree from "../permission/fs-permission-tree.vue";
import {UseCrudPermissionCompProps, UseCrudPermissionExtraProps} from "/@/plugin/permission";
import { UseCrudPermissionCompProps, UseCrudPermissionExtraProps } from "/@/plugin/permission";
function useAuthz() {
const checkedKeys = ref();
@ -101,7 +101,7 @@ export default defineComponent({
// permissioncommonOptionsactionbarrowHandleshow
// ./src/plugin/fast-crud/index.js 75-77
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, authz, permission });
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context: { authz, permission } });
//
onMounted(() => {

View File

@ -17,7 +17,7 @@ export default defineComponent({
// crud
// commonOptionsactionbarrowHandleshow
// ./src/plugin/fast-crud/index.js 75-77
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, permission: "sys:auth:user" });
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context: { permission: "sys:auth:user" } });
//
onMounted(() => {