Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Nocobase
Commits
8af72fbf
Commit
8af72fbf
authored
2 years ago
by
金昶
Browse files
Options
Download
Email Patches
Plain Diff
feat: change FK to input component
parent
75f417a0
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
packages/core/client/src/collection-manager/interfaces/m2m.tsx
+18
-8
...ges/core/client/src/collection-manager/interfaces/m2m.tsx
packages/core/client/src/collection-manager/interfaces/m2o.tsx
+9
-5
...ges/core/client/src/collection-manager/interfaces/m2o.tsx
packages/core/client/src/collection-manager/interfaces/o2m.tsx
+14
-6
...ges/core/client/src/collection-manager/interfaces/o2m.tsx
packages/core/client/src/collection-manager/interfaces/o2o.tsx
+11
-6
...ges/core/client/src/collection-manager/interfaces/o2o.tsx
packages/core/client/src/locale/zh_CN.ts
+13
-0
packages/core/client/src/locale/zh_CN.ts
with
65 additions
and
25 deletions
+65
-25
packages/core/client/src/collection-manager/interfaces/m2m.tsx
+
18
-
8
View file @
8af72fbf
...
...
@@ -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 }}
'
,
},
},
...
...
This diff is collapsed.
Click to expand it.
packages/core/client/src/collection-manager/interfaces/m2o.tsx
+
9
-
5
View file @
8af72fbf
...
...
@@ -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 }}
'
,
},
},
...
...
This diff is collapsed.
Click to expand it.
packages/core/client/src/collection-manager/interfaces/o2m.tsx
+
14
-
6
View file @
8af72fbf
...
...
@@ -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
:
tru
e
,
multiple
:
fals
e
,
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 }}
'
,
},
},
},
...
...
This diff is collapsed.
Click to expand it.
packages/core/client/src/collection-manager/interfaces/o2o.tsx
+
11
-
6
View file @
8af72fbf
...
...
@@ -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
:
tru
e
,
multiple
:
fals
e
,
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 }}
'
,
},
},
...
...
This diff is collapsed.
Click to expand it.
packages/core/client/src/locale/zh_CN.ts
+
13
-
0
View file @
8af72fbf
...
...
@@ -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
"
:
"
添加筛选分组
"
,
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help