Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: v15 popup #2844

Merged
merged 19 commits into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28,078 changes: 28,078 additions & 0 deletions pnpm-lock.pr!oasis-cloud!2842.yaml
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个文件不提交

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion src/packages/cascader/cascader.taro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,6 @@ const InternalCascader: ForwardRefRenderFunction<
{...popupProps}
visible={innerVisible}
position="bottom"
style={{ overflowY: 'hidden' }}
round
closeIcon={closeIcon}
closeable={closeable}
Expand Down
12 changes: 6 additions & 6 deletions src/packages/overlay/overlay.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@
z-index: $overlay-zIndex;
}

[dir='rtl'] .nut-overlay,
.nut-rtl .nut-overlay {
left: auto;
right: 0;
}

.nut-overflow-hidden {
overflow: hidden !important;
}
Expand Down Expand Up @@ -67,3 +61,9 @@
animation-duration: $overlay-animation-duration;
}
}

[dir='rtl'] .nut-overlay,
.nut-rtl .nut-overlay {
left: auto;
right: 0;
}
4 changes: 1 addition & 3 deletions src/packages/popup/demo.taro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,7 @@ const PopupDemo = () => {
return (
<>
<Header />
<ScrollView
className={`${!harmonyAndRn() ? `demo ${Taro.getEnv() === 'WEB' ? 'web' : ''}` : ''}`}
>
<ScrollView className={`demo ${Taro.getEnv() === 'WEB' ? 'web' : ''}`}>
<View className="h2">{translated.ce5c5446}</View>
<Demo1 />

Expand Down
21 changes: 12 additions & 9 deletions src/packages/popup/demos/h5/demo1.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
import React, { useState } from 'react'
import { Popup, Cell } from '@nutui/nutui-react'

const Demo1 = () => {
const [showBasic, setShowBasic] = useState(false)
const Demo = () => {
const [showIcon, setShowIcon] = useState(false)

return (
<>
<Cell
title="展示弹出层"
title="基础弹框"
onClick={() => {
setShowBasic(true)
setShowIcon(true)
}}
/>
<Popup
zIndex={2000}
visible={showBasic}
style={{ padding: '30px 50px' }}
closeable
visible={showIcon}
title="标题"
description="这里是副标题这是副标题"
position="bottom"
onClose={() => {
setShowBasic(false)
setShowIcon(false)
}}
/>
</>
)
}
export default Demo1
export default Demo
24 changes: 22 additions & 2 deletions src/packages/popup/demos/h5/demo2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const Demo2 = () => {
const [showBottom, setShowBottom] = useState(false)
const [showLeft, setShowLeft] = useState(false)
const [showRight, setShowRight] = useState(false)
const [showText, setShowText] = useState(false)

return (
<>
Expand Down Expand Up @@ -33,6 +34,12 @@ const Demo2 = () => {
setShowRight(true)
}}
/>
<Cell
title="居中弹出"
onClick={() => {
setShowText(true)
}}
/>
<Popup
visible={showTop}
destroyOnClose
Expand All @@ -50,20 +57,33 @@ const Demo2 = () => {
/>
<Popup
visible={showLeft}
style={{ width: '40%', height: '100%' }}
position="left"
onClose={() => {
setShowLeft(false)
}}
/>
<Popup
visible={showRight}
style={{ width: '40%', height: '100%' }}
position="right"
onClose={() => {
setShowRight(false)
}}
/>
<Popup
visible={showText}
style={{ padding: '30px 50px' }}
onClose={() => {
setShowText(false)
}}
>
<div style={{ height: '100px', overflowY: 'auto' }}>
{Array.from({ length: 10 })
.fill('')
.map((_, i) => (
<Cell key={i}>正文</Cell>
))}
</div>
</Popup>
</>
)
}
Expand Down
33 changes: 13 additions & 20 deletions src/packages/popup/demos/taro/demo1.tsx
Original file line number Diff line number Diff line change
@@ -1,35 +1,28 @@
import React, { useState } from 'react'
import { Popup, Cell } from '@nutui/nutui-react-taro'
import { ScrollView, Text } from '@tarojs/components'

const Demo1 = () => {
const [showBasic, setShowBasic] = useState(false)
const Demo = () => {
const [showIcon, setShowIcon] = useState(false)

return (
<>
<Cell
title="展示弹出层"
title="基础弹框"
onClick={() => {
setShowBasic(true)
setShowIcon(true)
}}
/>
<Popup
visible={showBasic}
style={{ padding: '30px 50px' }}
closeable
visible={showIcon}
title="标题"
description="这里是副标题这是副标题"
position="bottom"
onClose={() => {
setShowBasic(false)
setShowIcon(false)
}}
>
<ScrollView style={{ height: '200px', overflowY: 'scroll' }}>
{Array.from({ length: 1 })
.fill('')
.map((_, i) => (
<Cell key={i}>
<Text>正文</Text>
</Cell>
))}
</ScrollView>
</Popup>
/>
</>
)
}
export default Demo1
export default Demo
43 changes: 29 additions & 14 deletions src/packages/popup/demos/taro/demo2.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import React, { useState } from 'react'
import { Popup, Cell } from '@nutui/nutui-react-taro'
import { ScrollView, View } from '@tarojs/components'
import { ScrollView, Text } from '@tarojs/components'

const Demo2 = () => {
const [showTop, setShowTop] = useState(false)
const [showBottom, setShowBottom] = useState(false)
const [showLeft, setShowLeft] = useState(false)
const [showRight, setShowRight] = useState(false)
const [showText, setShowText] = useState(false)

return (
<>
Expand Down Expand Up @@ -34,6 +35,12 @@ const Demo2 = () => {
setShowRight(true)
}}
/>
<Cell
title="居中弹出"
onClick={() => {
setShowText(true)
}}
/>
<Popup
visible={showTop}
destroyOnClose
Expand All @@ -45,37 +52,45 @@ const Demo2 = () => {
<Popup
visible={showBottom}
position="bottom"
title="底部弹层"
style={{ height: '300px' }}
onClose={() => {
setShowBottom(false)
}}
lockScroll
>
<ScrollView scrollY style={{ height: '200px' }}>
{Array.from({ length: 200 })
.fill('')
.map((_, i) => (
<View key={i}>
<Cell>底部弹出-{i}</Cell>
</View>
))}
</ScrollView>
</Popup>
/>
<Popup
visible={showLeft}
style={{ width: '20%', height: '100%' }}
style={{ width: '20%' }}
position="left"
onClose={() => {
setShowLeft(false)
}}
/>
<Popup
visible={showRight}
style={{ width: '20%', height: '100%' }}
position="right"
onClose={() => {
setShowRight(false)
}}
/>
<Popup
visible={showText}
style={{ padding: '30px 50px' }}
onClose={() => {
setShowText(false)
}}
>
<ScrollView style={{ height: 200 }} scrollY>
{Array.from({ length: 10 })
.fill('')
.map((_, i) => (
<Cell key={i}>
<Text>正文</Text>
</Cell>
))}
</ScrollView>
</Popup>
</>
)
}
Expand Down
9 changes: 7 additions & 2 deletions src/packages/popup/demos/taro/demo8.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,13 @@ const Demo8 = () => {
setScrollPenetration(true)
}}
/>
<Popup visible={scrollPenetration} position="bottom" lockScroll>
<ScrollView scrollY style={{ height: '200px' }}>
<Popup
visible={scrollPenetration}
title="禁止滚动穿透"
position="bottom"
lockScroll
>
<ScrollView scrollY style={{ height: '300px' }}>
{Array.from({ length: 200 })
.fill('')
.map((_, i) => (
Expand Down
Loading
Loading