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

chore:
perf: v-model editable-row示例
chore: mock tip
fix: 修复行编辑模式下,render、conditionalRender无效的bug
fix: 修复行编辑初始化无效的bug
pull/14/head
GitHub Actions Bot 2023-06-29 19:24:00 +00:00
parent 47cb00857c
commit aa0c5972fb
8 changed files with 47 additions and 6 deletions

View File

@ -5,11 +5,15 @@ import Antd from "ant-design-vue";
import "ant-design-vue/dist/antd.less";
// import "virtual:windi.css";
import "./style/common.less";
import "./mock";
import i18n from "./i18n";
import store from "./store";
import components from "./components";
import plugin from "./plugin/";
// 正式项目请删除mock避免影响性能
import "./mock";
// @ts-ignore
const app = createApp(App);
app.use(Antd);

View File

@ -1,5 +1,5 @@
import { request, requestForMock } from "/src/api/service";
import "/src/mock";
// import "/src/mock";
import { ColumnCompositionProps, CrudOptions, FastCrud, PageQuery, PageRes, setLogger, TransformResProps, useColumns, UseCrudProps, UserPageQuery, useTypes } from "@fast-crud/fast-crud";
import "@fast-crud/fast-crud/dist/style.css";
import { FsExtendsCopyable, FsExtendsEditor, FsExtendsJson, FsExtendsTime, FsExtendsUploader } from "@fast-crud/fast-extends";

View File

@ -576,7 +576,7 @@ export const crudResources = [
{
title: "v-model",
name: "FeatureVModel",
path: "/crud/feature/v-model",
path: "/crud/feature/local-v-model",
component: "/crud/feature/local-v-model/index.vue"
},
{

View File

@ -1,5 +1,5 @@
import * as api from "./api";
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
import { AddReq, compute, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
return await api.GetList(query);
@ -24,6 +24,7 @@ export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOpti
editRequest,
delRequest
},
//将 addRow 按钮启用
actionbar: { buttons: { add: { show: false }, addRow: { show: true } } },
table: {
editable: {
@ -61,6 +62,24 @@ export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOpti
url: "/mock/dicts/OpenStatusEnum?single"
})
},
target: {
title: "根据状态动态显隐",
search: { show: true },
type: "text",
form: {
conditionalRender: {
match: ({ form }) => {
return form.radio === "2";
},
render: ({ form }) => {
return <div></div>;
}
},
show: compute(({ form }) => {
return form.radio !== "0";
})
}
},
name: {
title: "姓名",
type: "text"

View File

@ -21,6 +21,7 @@ export default defineComponent({
//
onMounted(() => {
crudExpose.doRefresh();
crudExpose.editable.enable({ mode: "row" });
});
return {

View File

@ -8,6 +8,19 @@ export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOpti
isMergeWhenUpdate: true,
isAppendWhenAdd: true
},
//启用addRow按钮
actionbar: { buttons: { add: { show: false }, addRow: { show: true } } },
table: {
remove: {
//删除数据后不请求后台
refreshTable: false
},
editable: {
enabled: true,
mode: "row",
activeTrigger: false
}
},
search: {
show: false
},

View File

@ -22,7 +22,7 @@
</template>
<script lang="ts">
import { defineComponent, reactive } from "vue";
import { defineComponent, onMounted, reactive } from "vue";
import { message } from "ant-design-vue";
import FeatureLocalModelValueInput from "./local.vue";
export default defineComponent({

View File

@ -3,7 +3,7 @@
</template>
<script lang="ts">
import { defineComponent, watch } from "vue";
import { defineComponent, onMounted, watch } from "vue";
import createCrudOptions from "./crud";
import { useFs } from "@fast-crud/fast-crud";
@ -19,6 +19,10 @@ export default defineComponent({
setup(props) {
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions });
onMounted(() => {
crudExpose.editable.enable({ mode: "row" });
});
//modelValue, input
watch(
() => {