mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-05 13:39:24 +08:00
fix: use desktop components for select in mobile configuration mode & fix error when using variables as default values in datePicker (#5662)
* refactor: use desktop components for select in mobile configuration mode * fix: bug
This commit is contained in:
parent
41c4919776
commit
6f170df2f1
@ -69,9 +69,12 @@ export const toLocal = (value: dayjs.Dayjs) => {
|
||||
};
|
||||
|
||||
const convertQuarterToFirstDay = (quarterStr) => {
|
||||
if (dayjs(quarterStr).isValid()) {
|
||||
const year = parseInt(quarterStr.slice(0, 4)); // 提取年份
|
||||
const quarter = parseInt(quarterStr.slice(-1)); // 提取季度数字
|
||||
return dayjs().quarter(quarter).year(year);
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
const toMoment = (val: any, options?: Str2momentOptions) => {
|
||||
|
@ -7,7 +7,7 @@
|
||||
* For more information, please refer to: https://www.nocobase.com/agreement.
|
||||
*/
|
||||
|
||||
import { RemoteSchemaComponent, AssociationField } from '@nocobase/client';
|
||||
import { RemoteSchemaComponent, AssociationField, useDesignable, Select, DatePicker } from '@nocobase/client';
|
||||
import React, { useCallback } from 'react';
|
||||
import { Outlet, useParams } from 'react-router-dom';
|
||||
import { Button as MobileButton, Dialog as MobileDialog } from 'antd-mobile';
|
||||
@ -16,8 +16,22 @@ import { MobileDateTimePicker } from './components/MobileDatePicker';
|
||||
|
||||
const mobileComponents = {
|
||||
Button: MobileButton,
|
||||
Select: MobilePicker,
|
||||
DatePicker: MobileDateTimePicker,
|
||||
Select: (props) => {
|
||||
const { designable } = useDesignable();
|
||||
if (designable !== false) {
|
||||
return <Select {...props} />;
|
||||
} else {
|
||||
return <MobilePicker {...props} />;
|
||||
}
|
||||
},
|
||||
DatePicker: (props) => {
|
||||
const { designable } = useDesignable();
|
||||
if (designable !== false) {
|
||||
return <DatePicker {...props} />;
|
||||
} else {
|
||||
return <MobileDateTimePicker {...props} />;
|
||||
}
|
||||
},
|
||||
UnixTimestamp: MobileDateTimePicker,
|
||||
Modal: MobileDialog,
|
||||
AssociationField: (props) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user