@nocobase/client-v2 2.1.21 → 2.1.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,8 +12,23 @@ import { Select } from 'antd';
12
12
  import { Button, CheckList, Popup, SearchBar } from 'antd-mobile';
13
13
  import React, { useEffect, useMemo, useState } from 'react';
14
14
 
15
+ const mobileSelectSafeAreaPaddingBottom = 'calc(12px + env(safe-area-inset-bottom, 0px))';
16
+
17
+ const mobileSelectConfirmFooterStyle: React.CSSProperties = {
18
+ paddingBottom: mobileSelectSafeAreaPaddingBottom,
19
+ };
20
+
21
+ function getMobileSelectListStyle(hasConfirmFooter: boolean): React.CSSProperties {
22
+ return {
23
+ maxHeight: '60vh',
24
+ overflowY: 'auto',
25
+ paddingBottom: hasConfirmFooter ? undefined : mobileSelectSafeAreaPaddingBottom,
26
+ };
27
+ }
28
+
15
29
  export function MobileSelect(props) {
16
30
  const { value, displayValue, onChange, onChangeComplete, disabled, options = [], mode } = props;
31
+ const isMultiple = ['multiple', 'tags'].includes(mode);
17
32
  const ctx = useFlowModelContext();
18
33
  const t = ctx.t;
19
34
  const [visible, setVisible] = useState(false);
@@ -64,17 +79,12 @@ export function MobileSelect(props) {
64
79
  <div style={{ margin: '10px' }}>
65
80
  <SearchBar placeholder={t('search')} value={searchText} onChange={(v) => setSearchText(v)} showCancelButton />
66
81
  </div>
67
- <div
68
- style={{
69
- maxHeight: '60vh',
70
- overflowY: 'auto',
71
- }}
72
- >
82
+ <div style={getMobileSelectListStyle(isMultiple)}>
73
83
  <CheckList
74
- multiple={['multiple', 'tags'].includes(mode)}
84
+ multiple={isMultiple}
75
85
  value={Array.isArray(selected) ? selected : [selected]}
76
86
  onChange={(val) => {
77
- if (['multiple', 'tags'].includes(mode)) {
87
+ if (isMultiple) {
78
88
  setSelected(val);
79
89
  } else {
80
90
  setSelected(val[0]);
@@ -91,10 +101,12 @@ export function MobileSelect(props) {
91
101
  ))}
92
102
  </CheckList>
93
103
  </div>
94
- {['multiple', 'tags'].includes(mode) && (
95
- <Button block color="primary" onClick={handleConfirm} style={{ marginTop: '16px' }}>
96
- {t('Confirm')}
97
- </Button>
104
+ {isMultiple && (
105
+ <div style={mobileSelectConfirmFooterStyle}>
106
+ <Button block color="primary" onClick={handleConfirm} style={{ marginTop: '16px' }}>
107
+ {t('Confirm')}
108
+ </Button>
109
+ </div>
98
110
  )}
99
111
  </Popup>
100
112
  </>