diff --git a/packages/plugins/@hera/plugin-mobile/src/client/schma-component/tab-search/components/field-item/TabSearchCollapsibleInputMItemChild.tsx b/packages/plugins/@hera/plugin-mobile/src/client/schma-component/tab-search/components/field-item/TabSearchCollapsibleInputMItemChild.tsx index 60e092b51..fd50bbcb1 100644 --- a/packages/plugins/@hera/plugin-mobile/src/client/schma-component/tab-search/components/field-item/TabSearchCollapsibleInputMItemChild.tsx +++ b/packages/plugins/@hera/plugin-mobile/src/client/schma-component/tab-search/components/field-item/TabSearchCollapsibleInputMItemChild.tsx @@ -1,10 +1,17 @@ import React, { useState } from 'react'; import { useTranslation } from '../../../../locale'; -import { Grid, Divider, Picker, Input, Space } from 'antd-mobile'; +import { Grid, Divider, Picker, Input, Space, ActionSheet } from 'antd-mobile'; import { DownOutline } from 'antd-mobile-icons'; +import type { Action } from 'antd-mobile/es/components/action-sheet'; export const ISelect = (props) => { const { options, onChange, customLabelKey } = props; + const actions: Action[] = options.map((item) => { + return { + text: item.label, + key: item.value, + }; + }); const [visible, setVisible] = useState(false); return options.length > 1 ? ( { {options.find((option) => option.value === customLabelKey).label} - { - setVisible(false); - }} - defaultValue={customLabelKey} - onConfirm={(v) => { - onChange(v[0]); - }} - /> + {options.length <= 3 ? ( + setVisible(false)} + onAction={(v) => { + onChange(v.key); + }} + /> + ) : ( + { + setVisible(false); + }} + defaultValue={customLabelKey} + onConfirm={(v) => { + onChange(v[0]); + }} + /> + )} + ) : null; diff --git a/packages/plugins/@hera/plugin-mobile/src/client/schma-component/tab-search/utils.ts b/packages/plugins/@hera/plugin-mobile/src/client/schma-component/tab-search/utils.ts index a11f0eb09..f65a218db 100644 --- a/packages/plugins/@hera/plugin-mobile/src/client/schma-component/tab-search/utils.ts +++ b/packages/plugins/@hera/plugin-mobile/src/client/schma-component/tab-search/utils.ts @@ -1,4 +1,4 @@ -const canBeOptionalFields = ['select', 'multipleSelect', 'radioGroup', 'checkbox', 'checkboxGroup']; +const canBeOptionalFields = ['select', 'multipleSelect', 'radioGroup', 'checkboxGroup']; const canBeRelatedFields = ['oho', 'obo', 'o2m', 'm2o', 'm2m']; const canBeSearchFields = [