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
463509d3
Commit
463509d3
authored
2 years ago
by
金昶
Browse files
Options
Download
Email Patches
Plain Diff
feat: add hasDefaultValue property
parent
f6077107
feat-default-value
No related merge requests found
Changes
21
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
packages/core/client/src/collection-manager/CollectionField.tsx
+0
-2
...es/core/client/src/collection-manager/CollectionField.tsx
packages/core/client/src/collection-manager/Configuration/AddFieldAction.tsx
+1
-1
...t/src/collection-manager/Configuration/AddFieldAction.tsx
packages/core/client/src/collection-manager/Configuration/EditFieldAction.tsx
+1
-1
.../src/collection-manager/Configuration/EditFieldAction.tsx
packages/core/client/src/collection-manager/interfaces/checkbox.ts
+1
-0
...core/client/src/collection-manager/interfaces/checkbox.ts
packages/core/client/src/collection-manager/interfaces/checkboxGroup.ts
+1
-0
...client/src/collection-manager/interfaces/checkboxGroup.ts
packages/core/client/src/collection-manager/interfaces/datetime.ts
+1
-0
...core/client/src/collection-manager/interfaces/datetime.ts
packages/core/client/src/collection-manager/interfaces/email.ts
+1
-0
...es/core/client/src/collection-manager/interfaces/email.ts
packages/core/client/src/collection-manager/interfaces/icon.ts
+1
-0
...ges/core/client/src/collection-manager/interfaces/icon.ts
packages/core/client/src/collection-manager/interfaces/input.ts
+1
-0
...es/core/client/src/collection-manager/interfaces/input.ts
packages/core/client/src/collection-manager/interfaces/integer.ts
+1
-0
.../core/client/src/collection-manager/interfaces/integer.ts
packages/core/client/src/collection-manager/interfaces/markdown.ts
+1
-0
...core/client/src/collection-manager/interfaces/markdown.ts
packages/core/client/src/collection-manager/interfaces/multipleSelect.ts
+1
-0
...lient/src/collection-manager/interfaces/multipleSelect.ts
packages/core/client/src/collection-manager/interfaces/number.ts
+1
-0
...s/core/client/src/collection-manager/interfaces/number.ts
packages/core/client/src/collection-manager/interfaces/password.ts
+1
-0
...core/client/src/collection-manager/interfaces/password.ts
packages/core/client/src/collection-manager/interfaces/percent.ts
+1
-0
.../core/client/src/collection-manager/interfaces/percent.ts
packages/core/client/src/collection-manager/interfaces/phone.ts
+1
-0
...es/core/client/src/collection-manager/interfaces/phone.ts
packages/core/client/src/collection-manager/interfaces/radioGroup.ts
+1
-0
...re/client/src/collection-manager/interfaces/radioGroup.ts
packages/core/client/src/collection-manager/interfaces/richText.ts
+1
-0
...core/client/src/collection-manager/interfaces/richText.ts
packages/core/client/src/collection-manager/interfaces/select.ts
+1
-0
...s/core/client/src/collection-manager/interfaces/select.ts
packages/core/client/src/collection-manager/interfaces/textarea.ts
+1
-0
...core/client/src/collection-manager/interfaces/textarea.ts
with
19 additions
and
4 deletions
+19
-4
packages/core/client/src/collection-manager/CollectionField.tsx
+
0
-
2
View file @
463509d3
...
...
@@ -26,8 +26,6 @@ const InternalField: React.FC = (props) => {
};
const
ctx
=
useFormBlockContext
();
console
.
log
(
'
InternalField
'
,
fieldSchema
,
collectionField
,
ctx
);
useEffect
(()
=>
{
if
(
ctx
?.
field
)
{
ctx
.
field
.
added
=
ctx
.
field
.
added
||
new
Set
();
...
...
This diff is collapsed.
Click to expand it.
packages/core/client/src/collection-manager/Configuration/AddFieldAction.tsx
+
1
-
1
View file @
463509d3
...
...
@@ -22,7 +22,7 @@ const getSchema = (schema: IField, record: any, compile): ISchema => {
const
properties
=
cloneDeep
(
schema
.
properties
)
as
any
;
if
(
!
[
'
systemInfo
'
,
'
relation
'
,
'
advanced
'
].
includes
(
schema
.
group
)
)
{
if
(
schema
.
hasDefaultValue
===
true
)
{
properties
[
'
defaultValue
'
]
=
cloneDeep
(
schema
.
default
.
uiSchema
);
properties
[
'
defaultValue
'
][
'
title
'
]
=
compile
(
'
{{ t("Default value") }}
'
);
properties
[
'
defaultValue
'
][
'
x-decorator
'
]
=
'
FormItem
'
;
...
...
This diff is collapsed.
Click to expand it.
packages/core/client/src/collection-manager/Configuration/EditFieldAction.tsx
+
1
-
1
View file @
463509d3
...
...
@@ -20,7 +20,7 @@ const getSchema = (schema: IField, record: any, compile): ISchema => {
const
properties
=
cloneDeep
(
schema
.
properties
)
as
any
;
properties
.
name
[
'
x-disabled
'
]
=
true
;
if
(
!
[
'
systemInfo
'
,
'
relation
'
,
'
advanced
'
].
includes
(
schema
.
group
)
)
{
if
(
schema
.
hasDefaultValue
===
true
)
{
properties
[
'
defaultValue
'
]
=
cloneDeep
(
schema
.
default
.
uiSchema
);
properties
[
'
defaultValue
'
][
'
title
'
]
=
compile
(
'
{{ t("Default value") }}
'
);
properties
[
'
defaultValue
'
][
'
x-decorator
'
]
=
'
FormItem
'
;
...
...
This diff is collapsed.
Click to expand it.
packages/core/client/src/collection-manager/interfaces/checkbox.ts
+
1
-
0
View file @
463509d3
...
...
@@ -15,6 +15,7 @@ export const checkbox: IField = {
'
x-component
'
:
'
Checkbox
'
,
},
},
hasDefaultValue
:
true
,
properties
:
{
...
defaultProps
,
},
...
...
This diff is collapsed.
Click to expand it.
packages/core/client/src/collection-manager/interfaces/checkboxGroup.ts
+
1
-
0
View file @
463509d3
...
...
@@ -17,6 +17,7 @@ export const checkboxGroup: IField = {
'
x-component
'
:
'
Checkbox.Group
'
,
},
},
hasDefaultValue
:
true
,
properties
:
{
...
defaultProps
,
'
uiSchema.enum
'
:
dataSource
,
...
...
This diff is collapsed.
Click to expand it.
packages/core/client/src/collection-manager/interfaces/datetime.ts
+
1
-
0
View file @
463509d3
...
...
@@ -20,6 +20,7 @@ export const datetime: IField = {
},
},
},
hasDefaultValue
:
true
,
properties
:
{
...
defaultProps
,
...
dateTimeProps
,
...
...
This diff is collapsed.
Click to expand it.
packages/core/client/src/collection-manager/interfaces/email.ts
+
1
-
0
View file @
463509d3
...
...
@@ -18,6 +18,7 @@ export const email: IField = {
'
x-validator
'
:
'
email
'
,
},
},
hasDefaultValue
:
true
,
properties
:
{
...
defaultProps
,
},
...
...
This diff is collapsed.
Click to expand it.
packages/core/client/src/collection-manager/interfaces/icon.ts
+
1
-
0
View file @
463509d3
...
...
@@ -16,6 +16,7 @@ export const icon: IField = {
'
x-component
'
:
'
IconPicker
'
,
},
},
hasDefaultValue
:
true
,
properties
:
{
...
defaultProps
,
},
...
...
This diff is collapsed.
Click to expand it.
packages/core/client/src/collection-manager/interfaces/input.ts
+
1
-
0
View file @
463509d3
...
...
@@ -18,6 +18,7 @@ export const input: IField = {
'
x-component
'
:
'
Input
'
,
},
},
hasDefaultValue
:
true
,
properties
:
{
...
defaultProps
,
},
...
...
This diff is collapsed.
Click to expand it.
packages/core/client/src/collection-manager/interfaces/integer.ts
+
1
-
0
View file @
463509d3
...
...
@@ -30,6 +30,7 @@ export const integer: IField = {
'
x-validator
'
:
'
integer
'
,
},
},
hasDefaultValue
:
true
,
properties
:
{
...
defaultProps
,
},
...
...
This diff is collapsed.
Click to expand it.
packages/core/client/src/collection-manager/interfaces/markdown.ts
+
1
-
0
View file @
463509d3
...
...
@@ -17,6 +17,7 @@ export const markdown: IField = {
'
x-component
'
:
'
Markdown
'
,
},
},
hasDefaultValue
:
true
,
properties
:
{
...
defaultProps
,
},
...
...
This diff is collapsed.
Click to expand it.
packages/core/client/src/collection-manager/interfaces/multipleSelect.ts
+
1
-
0
View file @
463509d3
...
...
@@ -21,6 +21,7 @@ export const multipleSelect: IField = {
enum
:
[],
},
},
hasDefaultValue
:
true
,
properties
:
{
...
defaultProps
,
'
uiSchema.enum
'
:
dataSource
,
...
...
This diff is collapsed.
Click to expand it.
packages/core/client/src/collection-manager/interfaces/number.ts
+
1
-
0
View file @
463509d3
...
...
@@ -24,6 +24,7 @@ export const number: IField = {
},
},
},
hasDefaultValue
:
true
,
properties
:
{
...
defaultProps
,
'
uiSchema.x-component-props.step
'
:
{
...
...
This diff is collapsed.
Click to expand it.
packages/core/client/src/collection-manager/interfaces/password.ts
+
1
-
0
View file @
463509d3
...
...
@@ -18,6 +18,7 @@ export const password: IField = {
'
x-component
'
:
'
Password
'
,
},
},
hasDefaultValue
:
true
,
properties
:
{
...
defaultProps
,
},
...
...
This diff is collapsed.
Click to expand it.
packages/core/client/src/collection-manager/interfaces/percent.ts
+
1
-
0
View file @
463509d3
...
...
@@ -68,6 +68,7 @@ export const percent: IField = {
},
},
},
hasDefaultValue
:
true
,
properties
:
{
...
defaultProps
,
'
uiSchema.x-component-props.step
'
:
{
...
...
This diff is collapsed.
Click to expand it.
packages/core/client/src/collection-manager/interfaces/phone.ts
+
1
-
0
View file @
463509d3
...
...
@@ -21,6 +21,7 @@ export const phone: IField = {
// 'x-validator': 'phone',
},
},
hasDefaultValue
:
true
,
properties
:
{
...
defaultProps
,
},
...
...
This diff is collapsed.
Click to expand it.
packages/core/client/src/collection-manager/interfaces/radioGroup.ts
+
1
-
0
View file @
463509d3
...
...
@@ -17,6 +17,7 @@ export const radioGroup: IField = {
'
x-component
'
:
'
Radio.Group
'
,
},
},
hasDefaultValue
:
true
,
properties
:
{
...
defaultProps
,
'
uiSchema.enum
'
:
dataSource
,
...
...
This diff is collapsed.
Click to expand it.
packages/core/client/src/collection-manager/interfaces/richText.ts
+
1
-
0
View file @
463509d3
...
...
@@ -18,6 +18,7 @@ export const richText: IField = {
'
x-component
'
:
'
RichText
'
,
},
},
hasDefaultValue
:
true
,
properties
:
{
...
defaultProps
,
},
...
...
This diff is collapsed.
Click to expand it.
packages/core/client/src/collection-manager/interfaces/select.ts
+
1
-
0
View file @
463509d3
...
...
@@ -18,6 +18,7 @@ export const select: IField = {
enum
:
[],
},
},
hasDefaultValue
:
true
,
properties
:
{
...
defaultProps
,
'
uiSchema.enum
'
:
dataSource
,
...
...
This diff is collapsed.
Click to expand it.
packages/core/client/src/collection-manager/interfaces/textarea.ts
+
1
-
0
View file @
463509d3
...
...
@@ -18,6 +18,7 @@ export const textarea: IField = {
'
x-component
'
:
'
Input.TextArea
'
,
},
},
hasDefaultValue
:
true
,
properties
:
{
...
defaultProps
,
},
...
...
This diff is collapsed.
Click to expand it.
Prev
1
2
Next
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