mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-05 21:49:25 +08:00
fix: field assignment to support variable value as 0 (#5663)
* fix: associationFieldMobile * fix: bug
This commit is contained in:
parent
af599493d1
commit
e7cb99ea47
@ -156,7 +156,6 @@ export function useCollectValuesToSubmit() {
|
|||||||
const waitList = Object.keys(originalAssignedValues).map(async (key) => {
|
const waitList = Object.keys(originalAssignedValues).map(async (key) => {
|
||||||
const value = originalAssignedValues[key];
|
const value = originalAssignedValues[key];
|
||||||
const collectionField = getField(key);
|
const collectionField = getField(key);
|
||||||
|
|
||||||
if (process.env.NODE_ENV !== 'production') {
|
if (process.env.NODE_ENV !== 'production') {
|
||||||
if (!collectionField) {
|
if (!collectionField) {
|
||||||
throw new Error(`field "${key}" not found in collection "${name}"`);
|
throw new Error(`field "${key}" not found in collection "${name}"`);
|
||||||
@ -165,7 +164,7 @@ export function useCollectValuesToSubmit() {
|
|||||||
|
|
||||||
if (isVariable(value)) {
|
if (isVariable(value)) {
|
||||||
const { value: parsedValue } = (await variables?.parseVariable(value, localVariables)) || {};
|
const { value: parsedValue } = (await variables?.parseVariable(value, localVariables)) || {};
|
||||||
if (parsedValue) {
|
if (parsedValue !== null && parsedValue !== undefined) {
|
||||||
assignedValues[key] = transformVariableValue(parsedValue, { targetCollectionField: collectionField });
|
assignedValues[key] = transformVariableValue(parsedValue, { targetCollectionField: collectionField });
|
||||||
}
|
}
|
||||||
} else if (value != null && value !== '') {
|
} else if (value != null && value !== '') {
|
||||||
|
@ -14,6 +14,19 @@ import { Button as MobileButton, Dialog as MobileDialog } from 'antd-mobile';
|
|||||||
import { MobilePicker } from './components/MobilePicker';
|
import { MobilePicker } from './components/MobilePicker';
|
||||||
import { MobileDateTimePicker } from './components/MobileDatePicker';
|
import { MobileDateTimePicker } from './components/MobileDatePicker';
|
||||||
|
|
||||||
|
const AssociationFieldMobile = (props) => {
|
||||||
|
return <AssociationField {...props} popupMatchSelectWidth={true} />;
|
||||||
|
};
|
||||||
|
|
||||||
|
AssociationFieldMobile.SubTable = AssociationField.SubTable;
|
||||||
|
AssociationFieldMobile.Nester = AssociationField.Nester;
|
||||||
|
AssociationFieldMobile.AddNewer = AssociationField.Container;
|
||||||
|
AssociationFieldMobile.Selector = AssociationField.Container;
|
||||||
|
AssociationFieldMobile.Viewer = AssociationField.Container;
|
||||||
|
AssociationFieldMobile.InternalSelect = AssociationField.InternalSelect;
|
||||||
|
AssociationFieldMobile.ReadPretty = AssociationField.ReadPretty;
|
||||||
|
AssociationFieldMobile.FileSelector = AssociationField.FileSelector;
|
||||||
|
|
||||||
const mobileComponents = {
|
const mobileComponents = {
|
||||||
Button: MobileButton,
|
Button: MobileButton,
|
||||||
Select: (props) => {
|
Select: (props) => {
|
||||||
@ -34,9 +47,7 @@ const mobileComponents = {
|
|||||||
},
|
},
|
||||||
UnixTimestamp: MobileDateTimePicker,
|
UnixTimestamp: MobileDateTimePicker,
|
||||||
Modal: MobileDialog,
|
Modal: MobileDialog,
|
||||||
AssociationField: (props) => {
|
AssociationField: AssociationFieldMobile,
|
||||||
return <AssociationField {...props} popupMatchSelectWidth={true} />;
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const MobilePage = () => {
|
export const MobilePage = () => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user