fix: field assignment to support variable value as 0 (#5663)

* fix:  associationFieldMobile

* fix: bug
This commit is contained in:
Katherine 2024-11-17 13:51:06 +08:00 committed by GitHub
parent af599493d1
commit e7cb99ea47
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 5 deletions

View File

@ -156,7 +156,6 @@ export function useCollectValuesToSubmit() {
const waitList = Object.keys(originalAssignedValues).map(async (key) => {
const value = originalAssignedValues[key];
const collectionField = getField(key);
if (process.env.NODE_ENV !== 'production') {
if (!collectionField) {
throw new Error(`field "${key}" not found in collection "${name}"`);
@ -165,7 +164,7 @@ export function useCollectValuesToSubmit() {
if (isVariable(value)) {
const { value: parsedValue } = (await variables?.parseVariable(value, localVariables)) || {};
if (parsedValue) {
if (parsedValue !== null && parsedValue !== undefined) {
assignedValues[key] = transformVariableValue(parsedValue, { targetCollectionField: collectionField });
}
} else if (value != null && value !== '') {

View File

@ -14,6 +14,19 @@ import { Button as MobileButton, Dialog as MobileDialog } from 'antd-mobile';
import { MobilePicker } from './components/MobilePicker';
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 = {
Button: MobileButton,
Select: (props) => {
@ -34,9 +47,7 @@ const mobileComponents = {
},
UnixTimestamp: MobileDateTimePicker,
Modal: MobileDialog,
AssociationField: (props) => {
return <AssociationField {...props} popupMatchSelectWidth={true} />;
},
AssociationField: AssociationFieldMobile,
};
export const MobilePage = () => {