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: '',
disabled: false,
size: 'medium',
maxLength: 255,
}
);
const emit = defineEmits<{

View File

@ -20,13 +20,28 @@
>
<!-- 展开行-->
<template #expand-icon="{ expanded, record }">
<div
class="flex items-end gap-[2px] text-[var(--color-text-4)]"
:class="expanded ? '!text-[rgb(var(--primary-5))]' : ''"
<a-tooltip
:content="
t(
record.children.length === 0
? 'msFormTable.noChildren'
: expanded
? 'msFormTable.collapse'
: 'msFormTable.expand'
)
"
>
<MsIcon type="icon-icon_split_turn-down_arrow" />
<div v-if="record.children" class="break-keep">{{ record.children.length }}</div>
</div>
<div
class="flex items-end gap-[2px] text-[var(--color-text-4)]"
: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
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.paramNotRequired': '非必填',
'msFormTable.paramRepeatMessage': '唯一,不能重复',
'msFormTable.noChildren': '无子级',
'msFormTable.expand': '展开子级',
'msFormTable.collapse': '折叠子级',
};

View File

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