fix(json-schema): bugFix

This commit is contained in:
baiqi 2024-07-15 16:19:02 +08:00 committed by 刘瑞斌
parent b55b3451bf
commit d9ac6f0387
5 changed files with 59 additions and 27 deletions

View File

@ -82,7 +82,6 @@
title: '', title: '',
disabled: false, disabled: false,
size: 'medium', size: 'medium',
maxLength: 255,
} }
); );
const emit = defineEmits<{ const emit = defineEmits<{

View File

@ -20,13 +20,28 @@
> >
<!-- 展开行--> <!-- 展开行-->
<template #expand-icon="{ expanded, record }"> <template #expand-icon="{ expanded, record }">
<div <a-tooltip
class="flex items-end gap-[2px] text-[var(--color-text-4)]" :content="
:class="expanded ? '!text-[rgb(var(--primary-5))]' : ''" t(
record.children.length === 0
? 'msFormTable.noChildren'
: expanded
? 'msFormTable.collapse'
: 'msFormTable.expand'
)
"
> >
<MsIcon type="icon-icon_split_turn-down_arrow" /> <div
<div v-if="record.children" class="break-keep">{{ record.children.length }}</div> class="flex items-end gap-[2px] text-[var(--color-text-4)]"
</div> :class="[
expanded ? '!text-[rgb(var(--primary-5))]' : '',
record.children.length === 0 ? 'cursor-not-allowed' : '',
]"
>
<MsIcon type="icon-icon_split_turn-down_arrow" />
<div v-if="record.children" class="break-keep">{{ record.children.length }}</div>
</div>
</a-tooltip>
</template> </template>
<template <template
v-for="item of props.columns.filter((e) => e.slotName !== undefined)" v-for="item of props.columns.filter((e) => e.slotName !== undefined)"

View File

@ -1 +1,8 @@
export default {}; export default {
'msFormTable.paramRequired': 'Required',
'msFormTable.paramNotRequired': 'Not required',
'msFormTable.paramRepeatMessage': 'Unique, cannot be repeated',
'msFormTable.noChildren': 'No children',
'msFormTable.expand': 'Expand children',
'msFormTable.collapse': 'Collapse children',
};

View File

@ -2,4 +2,7 @@ export default {
'msFormTable.paramRequired': '必填', 'msFormTable.paramRequired': '必填',
'msFormTable.paramNotRequired': '非必填', 'msFormTable.paramNotRequired': '非必填',
'msFormTable.paramRepeatMessage': '唯一,不能重复', 'msFormTable.paramRepeatMessage': '唯一,不能重复',
'msFormTable.noChildren': '无子级',
'msFormTable.expand': '展开子级',
'msFormTable.collapse': '折叠子级',
}; };

View File

@ -245,6 +245,14 @@
> >
</MsQuickInput> </MsQuickInput>
</template> </template>
<template #format="{ record }">
<a-select
v-if="record.type === 'string'"
v-model:model-value="record.format"
:options="formatOptions"
class="ms-form-table-input"
></a-select>
</template>
<template #action="{ record, rowIndex }"> <template #action="{ record, rowIndex }">
<div class="flex w-full items-center gap-[8px]"> <div class="flex w-full items-center gap-[8px]">
<a-tooltip :content="t('common.advancedSettings')"> <a-tooltip :content="t('common.advancedSettings')">
@ -415,21 +423,23 @@
@change="handleSettingFormChange" @change="handleSettingFormChange"
/> />
</a-form-item> </a-form-item>
<a-form-item v-if="activeRecord.type === 'string'" :label="t('ms.json.schema.regex')"> <template v-if="activeRecord.type === 'string'">
<a-input <a-form-item :label="t('ms.json.schema.regex')">
v-model:model-value="activeRecord.regex" <a-input
:placeholder="t('ms.json.schema.regexPlaceholder', { reg: '/<title(.*?)</title>' })" v-model:model-value="activeRecord.regex"
@change="handleSettingFormChange" :placeholder="t('ms.json.schema.regexPlaceholder', { reg: '/<title(.*?)</title>' })"
/> @change="handleSettingFormChange"
</a-form-item> />
<a-form-item :label="t('ms.json.schema.format')"> </a-form-item>
<a-select <a-form-item :label="t('ms.json.schema.format')">
v-model:model-value="activeRecord.format" <a-select
:placeholder="t('common.pleaseSelect')" v-model:model-value="activeRecord.format"
:options="formatOptions" :placeholder="t('common.pleaseSelect')"
@change="handleSettingFormChange" :options="formatOptions"
/> @change="handleSettingFormChange"
</a-form-item> />
</a-form-item>
</template>
</template> </template>
</template> </template>
<div v-if="activeRecord.type === 'array'" class="flex items-center gap-[24px]"> <div v-if="activeRecord.type === 'array'" class="flex items-center gap-[24px]">
@ -821,12 +831,10 @@
title: t('ms.json.schema.format'), title: t('ms.json.schema.format'),
dataIndex: 'format', dataIndex: 'format',
slotName: 'format', slotName: 'format',
inputType: 'select',
size: 'medium', size: 'medium',
options: formatOptions,
addLineDisabled: true,
showInTable: false, showInTable: false,
isNull: (record) => ['object', 'array', 'null', 'boolean'].includes(record.type), isNull: (record) => record.type !== 'string',
width: 100,
}, },
{ {
title: '', title: '',