From 35cddcc80cd7457f048854596dc622d41b99f83f Mon Sep 17 00:00:00 2001 From: wjh Date: Wed, 10 Apr 2024 17:19:31 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=B0=83=E6=95=B4mobile=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E9=80=89=E6=8B=A9=E7=BB=84=E4=BB=B6=20(#670)=20Co-aut?= =?UTF-8?q?hored-by:=20wjh=20=20Co-committed-by:=20wjh?= =?UTF-8?q?=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TabSearchCollapsibleInputMItemChild.tsx | 44 ++++++++++++++----- .../schma-component/tab-search/utils.ts | 2 +- 2 files changed, 33 insertions(+), 13 deletions(-) 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 = [