diff --git a/packages/core/client/src/modules/fields/component/Select/selectComponentFieldSettings.tsx b/packages/core/client/src/modules/fields/component/Select/selectComponentFieldSettings.tsx index b72239bad..b6b546431 100644 --- a/packages/core/client/src/modules/fields/component/Select/selectComponentFieldSettings.tsx +++ b/packages/core/client/src/modules/fields/component/Select/selectComponentFieldSettings.tsx @@ -1,12 +1,14 @@ -import { Field } from '@tachybase/schema'; -import { useField, useFieldSchema } from '@tachybase/schema'; -import _ from 'lodash'; import React from 'react'; +import { Field, useField, useFieldSchema } from '@tachybase/schema'; + +import _ from 'lodash'; import { useTranslation } from 'react-i18next'; + import { SchemaSettings } from '../../../../application/schema-settings/SchemaSettings'; import { useFormBlockContext } from '../../../../block-provider'; -import { useCollectionManager_deprecated, useCollection_deprecated } from '../../../../collection-manager'; +import { useCollection_deprecated, useCollectionManager_deprecated } from '../../../../collection-manager'; import { useFieldComponentName } from '../../../../common/useFieldComponentName'; +import { useCollectionField } from '../../../../data-source'; import { useRecord } from '../../../../record-provider'; import { removeNullCondition, useDesignable, useFieldModeOptions, useIsAddNewForm } from '../../../../schema-component'; import { isSubMode } from '../../../../schema-component/antd/association-field/util'; @@ -18,12 +20,11 @@ import { useTitleFieldOptions, } from '../../../../schema-component/antd/form-item/FormItem.Settings'; import { useColumnSchema } from '../../../../schema-component/antd/table-v2/Table.Column.Decorator'; -import { VariableInput, getShouldChange } from '../../../../schema-settings'; +import { getShouldChange, VariableInput } from '../../../../schema-settings'; +import { useIsShowMultipleSwitch } from '../../../../schema-settings/hooks/useIsShowMultipleSwitch'; import { SchemaSettingsDataScope } from '../../../../schema-settings/SchemaSettingsDataScope'; import { SchemaSettingsSortingRule } from '../../../../schema-settings/SchemaSettingsSortingRule'; -import { useIsShowMultipleSwitch } from '../../../../schema-settings/hooks/useIsShowMultipleSwitch'; import { useLocalVariables, useVariables } from '../../../../variables'; -import { useCollectionField } from '../../../../data-source'; const enableLink = { name: 'enableLink', diff --git a/packages/core/client/src/schema-component/antd/association-field/components/CreateRecordAction.tsx b/packages/core/client/src/schema-component/antd/association-field/components/CreateRecordAction.tsx index 0adca18bd..b6ddc9a45 100644 --- a/packages/core/client/src/schema-component/antd/association-field/components/CreateRecordAction.tsx +++ b/packages/core/client/src/schema-component/antd/association-field/components/CreateRecordAction.tsx @@ -1,5 +1,6 @@ -import { RecursionField, observer, useField, useFieldSchema } from '@tachybase/schema'; import React, { useState } from 'react'; +import { observer, RecursionField, useField, useFieldSchema } from '@tachybase/schema'; + import { CollectionProvider_deprecated, useCollectionManager_deprecated } from '../../../../collection-manager'; import { CreateAction } from '../../../../schema-initializer/components'; import { ActionContextProvider, useActionContext } from '../../action'; diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/index.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/index.tsx index 36760c16d..4223bddbb 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/index.tsx +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/index.tsx @@ -19,6 +19,7 @@ import { MMenuBlockInitializer, MPage, MRadio, + MSelect, MSettings, MSettingsBlockInitializer, MTabBar, @@ -87,6 +88,7 @@ export const MobileCore: React.FC = (props) => { MRadio, MImageUploader, CollectionField: CollectionField, + MSelect, }} scope={{ useGridCardBlockItemProps, diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/CustomComponent.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/CustomComponent.tsx index eb554c69a..dffa306d3 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/CustomComponent.tsx +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/CustomComponent.tsx @@ -1,10 +1,11 @@ -const custonComponent = { +const customComponent = { Input: 'MInput', 'Input.TextArea': 'MInput.TextArea', 'Radio.Group': 'MRadio.Group', 'Checkbox.Group': 'MCheckbox.Group', 'Upload.Attachment': 'MImageUploader', DatePicker: 'MDatePicker', + Select: 'MSelect', }; -export const canMobileField = (componentName: string) => custonComponent[componentName]; +export const canMobileField = (componentName: string) => customComponent[componentName]; diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/antd-mobile/Checkbox/Checkbox.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/antd-mobile/Checkbox/Checkbox.tsx index f202b9238..1d52fbf60 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/antd-mobile/Checkbox/Checkbox.tsx +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/antd-mobile/Checkbox/Checkbox.tsx @@ -1,5 +1,5 @@ import React, { useEffect } from 'react'; -import { useCollectionField } from '@tachybase/client'; +import { css, useCollectionField } from '@tachybase/client'; import { connect, isValid, mapProps, mapReadPretty, useField } from '@tachybase/schema'; import { Checkbox, CheckboxGroupProps, CheckboxProps, Tag } from 'antd-mobile'; @@ -27,7 +27,7 @@ MCheckbox.Group = connect( { if (status) { check.push(item.value); @@ -37,6 +37,7 @@ MCheckbox.Group = connect( } props.onChange(check); }} + {...props} > {item.label} diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/antd-mobile/DatePicker/DatePicker.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/antd-mobile/DatePicker/DatePicker.tsx index 4db36bcab..8015544af 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/antd-mobile/DatePicker/DatePicker.tsx +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/antd-mobile/DatePicker/DatePicker.tsx @@ -36,8 +36,8 @@ export const MDatePicker = connect( }), mapReadPretty((props) => { const changeProps = { ...props }; - changeProps.value = dayjs(props.value).format(props.dateFormat); - return ; + changeProps.value = props.value ? dayjs(props.value).format('YYYY-MM-DD') : ''; + return
{changeProps.value}
; }), ); export default MDatePicker; diff --git a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/antd-mobile/Input/Input.tsx b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/antd-mobile/Input/Input.tsx index a05671f98..416e95578 100644 --- a/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/antd-mobile/Input/Input.tsx +++ b/packages/plugins/@tachybase/plugin-mobile-client/src/client/core/schema/components/antd-mobile/Input/Input.tsx @@ -1,4 +1,5 @@ import React from 'react'; +import { css } from '@tachybase/client'; import { connect, mapProps, mapReadPretty } from '@tachybase/schema'; import { Input, InputProps, TextArea, TextAreaProps } from 'antd-mobile'; @@ -10,20 +11,40 @@ type ComposedInput = React.FC & { export const MInput: ComposedInput = connect( Input, mapProps((props) => { - return { placeholder: '请输入内容', clearable: true, ...props, style: { fontSize: '12px' } }; + return { placeholder: '请输入内容', clearable: true, ...props, style: { '--font-size': '12px' } }; }), mapReadPretty((props) => { - return ; + return ( + + ); }), ); const MTextArea = connect( TextArea, mapProps((props) => { - return { ...props, placeholder: '请输入内容', clearable: true, style: { fontSize: '12px' } }; + return { ...props, placeholder: '请输入内容', clearable: true, style: { '--font-size': '12px' } }; }), mapReadPretty((props) => { - return