Commit 8af72fbf authored by 金昶's avatar 金昶
Browse files

feat: change FK to input component

parent 75f417a0
Showing with 65 additions and 25 deletions
+65 -25
......@@ -84,10 +84,10 @@ export const m2m: IField = {
'x-decorator': 'FormItem',
'x-component': 'Select',
enum: [
{ label: 'One to one', value: 'hasOne' },
{ label: 'One to many', value: 'hasMany' },
{ label: 'Many to one', value: 'belongsTo' },
{ label: 'Many to many', value: 'belongsToMany' },
{ label: "{{t('One to one')}}", value: 'hasOne' },
{ label: "{{t('One to many')}}", value: 'hasMany' },
{ label: "{{t('Many to one')}}", value: 'belongsTo' },
{ label: "{{t('Many to many')}}", value: 'belongsToMany' },
],
},
grid: {
......@@ -118,9 +118,9 @@ export const m2m: IField = {
through: {
type: 'string',
title: '{{t("Through collection")}}',
'x-decorator': 'FormItem',
'x-disabled': '{{ !createOnly }}',
'x-reactions': ['{{useAsyncDataSource(loadCollections)}}'],
'x-decorator': 'FormItem',
'x-component': 'Select',
'x-component-props': {
allowClear: true,
......@@ -170,8 +170,12 @@ export const m2m: IField = {
foreignKey: {
type: 'string',
title: '{{t("Foreign key 1")}}',
required: true,
default: `f_${uid()}`,
description:
"{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}",
'x-decorator': 'FormItem',
'x-component': 'ThroughForeignKey',
'x-component': 'Input',
'x-disabled': '{{ !createOnly }}',
},
},
......@@ -179,7 +183,9 @@ export const m2m: IField = {
col23: {
type: 'void',
'x-component': 'Grid.Col',
properties: {},
properties: {
},
},
},
},
......@@ -199,8 +205,12 @@ export const m2m: IField = {
otherKey: {
type: 'string',
title: '{{t("Foreign key 2")}}',
required: true,
default: `f_${uid()}`,
description:
"{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}",
'x-decorator': 'FormItem',
'x-component': 'ThroughForeignKey',
'x-component': 'Input',
'x-disabled': '{{ !createOnly }}',
},
},
......
......@@ -100,10 +100,10 @@ export const m2o: IField = {
'x-decorator': 'FormItem',
'x-component': 'Select',
enum: [
{ label: 'One to one', value: 'hasOne' },
{ label: 'One to many', value: 'hasMany' },
{ label: 'Many to one', value: 'belongsTo' },
{ label: 'Many to many', value: 'belongsToMany' },
{ label: "{{t('One to one')}}", value: 'hasOne' },
{ label: "{{t('One to many')}}", value: 'hasMany' },
{ label: "{{t('Many to one')}}", value: 'belongsTo' },
{ label: "{{t('Many to many')}}", value: 'belongsToMany' },
],
},
grid: {
......@@ -155,8 +155,12 @@ export const m2o: IField = {
foreignKey: {
type: 'string',
title: '{{t("Foreign key")}}',
required: true,
default: `f_${uid()}`,
description:
"{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}",
'x-decorator': 'FormItem',
'x-component': 'SourceForeignKey',
'x-component': 'Input',
'x-disabled': '{{ !createOnly }}',
},
},
......
......@@ -17,6 +17,8 @@ export const o2m: IField = {
uiSchema: {
// title,
'x-component': 'RecordPicker',
// type: 'void',
// 'x-component': 'TableField',
'x-component-props': {
// mode: 'tags',
multiple: true,
......@@ -29,13 +31,14 @@ export const o2m: IField = {
reverseField: {
interface: 'm2o',
type: 'belongsTo',
title: '{{t("Many to one")}}',
// name,
uiSchema: {
// title,
'x-component': 'RecordPicker',
'x-component-props': {
// mode: 'tags',
multiple: true,
multiple: false,
fieldNames: {
label: 'id',
value: 'id',
......@@ -100,10 +103,10 @@ export const o2m: IField = {
'x-decorator': 'FormItem',
'x-component': 'Select',
enum: [
{ label: 'One to one', value: 'hasOne' },
{ label: 'One to many', value: 'hasMany' },
{ label: 'Many to one', value: 'belongsTo' },
{ label: 'Many to many', value: 'belongsToMany' },
{ label: "{{t('One to one')}}", value: 'hasOne' },
{ label: "{{t('One to many')}}", value: 'hasMany' },
{ label: "{{t('Many to one')}}", value: 'belongsTo' },
{ label: "{{t('Many to many')}}", value: 'belongsToMany' },
],
},
grid: {
......@@ -168,8 +171,13 @@ export const o2m: IField = {
foreignKey: {
type: 'string',
title: '{{t("Foreign key")}}',
required: true,
default: `f_${uid()}`,
description:
"{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}",
'x-decorator': 'FormItem',
'x-component': 'TargetForeignKey',
'x-component': 'Input',
'x-disabled': '{{ !createOnly }}',
},
},
},
......
......@@ -29,13 +29,14 @@ export const o2o: IField = {
reverseField: {
interface: 'm2o',
type: 'belongsTo',
title: '{{t("One to one")}}',
// name,
uiSchema: {
// title,
'x-component': 'RecordPicker',
'x-component-props': {
// mode: 'tags',
multiple: true,
multiple: false,
fieldNames: {
label: 'id',
value: 'id',
......@@ -100,10 +101,10 @@ export const o2o: IField = {
'x-decorator': 'FormItem',
'x-component': 'Select',
enum: [
{ label: 'One to one', value: 'hasOne' },
{ label: 'One to many', value: 'hasMany' },
{ label: 'Many to one', value: 'belongsTo' },
{ label: 'Many to many', value: 'belongsToMany' },
{ label: "{{t('One to one')}}", value: 'hasOne' },
{ label: "{{t('One to many')}}", value: 'hasMany' },
{ label: "{{t('Many to one')}}", value: 'belongsTo' },
{ label: "{{t('Many to many')}}", value: 'belongsToMany' },
],
},
grid: {
......@@ -167,8 +168,12 @@ export const o2o: IField = {
foreignKey: {
type: 'string',
title: '{{t("Foreign key")}}',
required: true,
default: `f_${uid()}`,
description:
"{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}",
'x-decorator': 'FormItem',
'x-component': 'TargetForeignKey',
'x-component': 'Input',
'x-disabled': '{{ !createOnly }}',
},
},
......
......@@ -156,6 +156,19 @@ export default {
"Time format": "时间格式",
"12 hour": "12 小时制",
"24 hour": "24 小时制",
"Relationship type": "关联类型",
"Source collection": "源数据表",
"Source key": "源数据表字段标识",
"Target collection": "目标数据表",
"Through collection": "中间数据表",
"Target key": "目标数据表字段标识",
"Foreign key": "外键",
"One to one": "一对一",
"One to many": "一对多",
"Many to one": "多对一",
"Many to many": "多对多",
"Foreign key 1": "外键1",
"Foreign key 2": "外键2",
"Add filter": "添加筛选条件",
"Add filter group": "添加筛选分组",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment