Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
5 changes: 2 additions & 3 deletions src/packages/calendarcard/demos/h5/demo1.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import React from 'react'
import { CalendarCard, type CalendarCardValue } from '@nutui/nutui-react'

// const date = null;
const date = new Date('2023-01-01')
const date = new Date('2025-01-01')

const Demo1 = () => {
const onChange = (val: CalendarCardValue) => {
console.log(val)
console.log('onChange', val)
}
return <CalendarCard defaultValue={date} onChange={onChange} />
}
Expand Down
4 changes: 2 additions & 2 deletions src/packages/calendarcard/demos/h5/demo11.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ const Demo11 = () => {
<Button onClick={() => CalendarCardRef.current?.jump(1)}>+ 1</Button>
<Button onClick={() => CalendarCardRef.current?.jump(12)}>+ 12</Button>
<Button onClick={() => CalendarCardRef.current?.jump(-12)}>- 12</Button>
<Button onClick={() => CalendarCardRef.current?.jumpTo(2023, 1)}>
2023 01
<Button onClick={() => CalendarCardRef.current?.jumpTo(2025, 1)}>
2025 01
</Button>
</Space>
<CalendarCard ref={CalendarCardRef} />
Expand Down
5 changes: 2 additions & 3 deletions src/packages/calendarcard/demos/h5/demo2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ import {

const Demo2 = () => {
const [val, setVal] = useState(() => {
// return [];
return [new Date('2023-01-01'), new Date('2023-01-03')]
return [new Date('2025-01-01'), new Date('2025-01-03')]
})
const onChange = (val: CalendarCardValue) => {
setVal(val as Date[])
console.log(val)
console.log('onChange', val)
}
return (
<>
Expand Down
2 changes: 1 addition & 1 deletion src/packages/calendarcard/demos/h5/demo3.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CalendarCard, type CalendarCardValue } from '@nutui/nutui-react'

const Demo3 = () => {
const onChange = (val: CalendarCardValue) => {
console.log(val)
console.log('onChange', val)
}
return <CalendarCard type="range" onChange={onChange} />
}
Expand Down
2 changes: 1 addition & 1 deletion src/packages/calendarcard/demos/h5/demo4.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CalendarCard, type CalendarCardValue } from '@nutui/nutui-react'

const Demo4 = () => {
const onChange = (val: CalendarCardValue) => {
console.log(val)
console.log('onChange', val)
}
return <CalendarCard type="week" onChange={onChange} />
}
Expand Down
4 changes: 2 additions & 2 deletions src/packages/calendarcard/demos/h5/demo5.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import React, { useState } from 'react'
import { CalendarCard, type CalendarCardValue } from '@nutui/nutui-react'

const Demo5 = () => {
const [date, setDate] = useState(() => new Date('2023-01-01'))
const [date, setDate] = useState(() => new Date('2025-01-01'))
const onChange = (val: CalendarCardValue) => {
console.log(val)
console.log('onChange', val)
setDate(val as Date)
}
return <CalendarCard value={date} onChange={onChange} />
Expand Down
2 changes: 1 addition & 1 deletion src/packages/calendarcard/demos/h5/demo7.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CalendarCard, type CalendarCardValue } from '@nutui/nutui-react'

const Demo7 = () => {
const onChange = (val: CalendarCardValue) => {
console.log(val)
console.log('onChange', val)
}
return <CalendarCard firstDayOfWeek={1} onChange={onChange} />
}
Expand Down
4 changes: 2 additions & 2 deletions src/packages/calendarcard/demos/h5/demo8.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { CalendarCard, type CalendarCardValue } from '@nutui/nutui-react'

const Demo8 = () => {
const onChange = (val: CalendarCardValue) => {
console.log(val)
console.log('onChange', val)
}
return (
<CalendarCard
startDate={new Date('2023-08-01')}
startDate={new Date('2025-08-01')}
endDate={new Date('2025-11-11')}
onChange={onChange}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/packages/calendarcard/demos/h5/demo9.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CalendarCard, type CalendarCardValue } from '@nutui/nutui-react'

const Demo9 = () => {
const onChange = (val: CalendarCardValue) => {
console.log(val)
console.log('onChange', val)
}
return (
<CalendarCard
Expand Down
5 changes: 2 additions & 3 deletions src/packages/calendarcard/demos/taro/demo1.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import React from 'react'
import { CalendarCard, type CalendarCardValue } from '@nutui/nutui-react-taro'

// const date = null;
const date = new Date('2023-01-01')
const date = new Date('2025-01-01')

const Demo1 = () => {
const onChange = (val: CalendarCardValue) => {
console.log(val)
console.log('onChange', val)
}
return <CalendarCard defaultValue={date} onChange={onChange} />
}
Expand Down
2 changes: 1 addition & 1 deletion src/packages/calendarcard/demos/taro/demo10.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const Demo10 = () => {
value={date}
onChange={(d: CalendarCardValue) => setDate(d as Date)}
/>
<View style={{ padding: '10px' }}>
<View style={{ padding: 10 }}>
<Button block type="danger" onClick={() => setVisible(false)}>
确定
</Button>
Expand Down
6 changes: 3 additions & 3 deletions src/packages/calendarcard/demos/taro/demo11.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ const Demo11 = () => {
const CalendarCardRef = useRef<CalendarCardRef>(null)
return (
<>
<Space>
<Space style={{ marginBottom: 10 }}>
<Button onClick={() => CalendarCardRef.current?.jump(1)}>+ 1</Button>
<Button onClick={() => CalendarCardRef.current?.jump(12)}>+ 12</Button>
<Button onClick={() => CalendarCardRef.current?.jump(-12)}>- 12</Button>
<Button onClick={() => CalendarCardRef.current?.jumpTo(2023, 1)}>
2023 01
<Button onClick={() => CalendarCardRef.current?.jumpTo(2026, 1)}>
2026 01
</Button>
</Space>
<CalendarCard ref={CalendarCardRef} />
Expand Down
5 changes: 2 additions & 3 deletions src/packages/calendarcard/demos/taro/demo2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,15 @@ import {

const Demo2 = () => {
const [val, setVal] = useState(() => {
// return [];
return [new Date('2023-01-01'), new Date('2023-01-03')]
return [new Date('2023-01-01'), new Date('2025-01-03')]
})
const onChange = (val: CalendarCardValue) => {
setVal(val as Date[])
console.log(val)
}
return (
<>
<Space wrap>
<Space wrap style={{ marginBottom: 10 }}>
{val.map((d) => {
return (
<Tag key={d.getTime()} type="info">
Expand Down
2 changes: 1 addition & 1 deletion src/packages/calendarcard/demos/taro/demo3.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CalendarCard, type CalendarCardValue } from '@nutui/nutui-react-taro'

const Demo3 = () => {
const onChange = (val: CalendarCardValue) => {
console.log(val)
console.log('onChange', val)
}
return <CalendarCard type="range" onChange={onChange} />
}
Expand Down
2 changes: 1 addition & 1 deletion src/packages/calendarcard/demos/taro/demo4.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CalendarCard, type CalendarCardValue } from '@nutui/nutui-react-taro'

const Demo4 = () => {
const onChange = (val: CalendarCardValue) => {
console.log(val)
console.log('onChange', val)
}
return <CalendarCard type="week" onChange={onChange} />
}
Expand Down
4 changes: 2 additions & 2 deletions src/packages/calendarcard/demos/taro/demo5.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import React, { useState } from 'react'
import { CalendarCard, type CalendarCardValue } from '@nutui/nutui-react-taro'

const Demo5 = () => {
const [date, setDate] = useState(() => new Date('2023-01-01'))
const [date, setDate] = useState(() => new Date('2025-01-01'))
const onChange = (val: CalendarCardValue) => {
console.log(val)
console.log('onChange', val)
setDate(val as Date)
}
return <CalendarCard value={date} onChange={onChange} />
Expand Down
2 changes: 1 addition & 1 deletion src/packages/calendarcard/demos/taro/demo7.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CalendarCard, type CalendarCardValue } from '@nutui/nutui-react-taro'

const Demo7 = () => {
const onChange = (val: CalendarCardValue) => {
console.log(val)
console.log('onChange', val)
}
return <CalendarCard firstDayOfWeek={1} onChange={onChange} />
}
Expand Down
2 changes: 1 addition & 1 deletion src/packages/calendarcard/demos/taro/demo8.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CalendarCard, type CalendarCardValue } from '@nutui/nutui-react-taro'

const Demo8 = () => {
const onChange = (val: CalendarCardValue) => {
console.log(val)
console.log('onChange', val)
}
return (
<CalendarCard
Expand Down
2 changes: 1 addition & 1 deletion src/packages/calendarcard/demos/taro/demo9.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CalendarCard, type CalendarCardValue } from '@nutui/nutui-react-taro'

const Demo9 = () => {
const onChange = (val: CalendarCardValue) => {
console.log(val)
console.log('onChange', val)
}
return (
<CalendarCard
Expand Down
11 changes: 4 additions & 7 deletions src/packages/dialog/dialog.taro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ export const BaseDialog: FunctionComponent<Partial<DialogBasicProps>> & {
>
<Content
className={className}
style={style}
style={{ ...style, zIndex: zIndex + 1 }} // zIndex: zIndex + 1;解决harmony层级问题
title={title}
header={header}
close={renderCloseIcon()}
Expand All @@ -249,7 +249,7 @@ export const BaseDialog: FunctionComponent<Partial<DialogBasicProps>> & {
ref={refObject}
catchMove={lockScroll}
>
{overlay ? (
{overlay && (
<Overlay
zIndex={zIndex}
visible={visible}
Expand All @@ -258,12 +258,9 @@ export const BaseDialog: FunctionComponent<Partial<DialogBasicProps>> & {
closeOnOverlayClick={closeOnOverlayClick}
lockScroll={lockScroll}
onClick={onHandleClickOverlay}
>
{renderContent()}
</Overlay>
) : (
renderContent()
/>
)}
{renderContent()}
</View>
)
}
Expand Down
50 changes: 31 additions & 19 deletions src/packages/popup/popup.taro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { defaultOverlayProps } from '@/packages/overlay/overlay.taro'
import Overlay from '@/packages/overlay/index.taro'
import { useLockScrollTaro } from '@/hooks/use-lock-scoll-taro'
import { PopupProps, Teleport } from './types.taro'
import { harmony } from '@/utils/platform-taro'

const defaultProps: PopupProps = {
...defaultOverlayProps,
Expand Down Expand Up @@ -84,7 +85,7 @@ export const Popup: FunctionComponent<
const overlayStyles = {
...overlayStyle,
}
const popStyles = { ...style, zIndex: index }
const popStyles = { ...style, zIndex: index + 1 }
const popClassName = classNames(
classPrefix,
{
Expand Down Expand Up @@ -179,18 +180,10 @@ export const Popup: FunctionComponent<
return renderCloseIcon()
}
}
const renderPop = () => {

const renderContent = () => {
return (
<CSSTransition
nodeRef={refObject}
classNames={transitionName}
mountOnEnter
unmountOnExit={destroyOnClose}
timeout={duration}
in={innerVisible}
onEntered={afterShow}
onExited={afterClose}
>
<>
<View
ref={refObject}
style={popStyles}
Expand All @@ -201,7 +194,29 @@ export const Popup: FunctionComponent<
{renderTitle()}
{showChildren ? children : null}
</View>
</CSSTransition>
</>
)
}
const renderPop = () => {
return (
<>
{!harmony() ? (
<CSSTransition
nodeRef={refObject}
classNames={transitionName}
mountOnEnter
unmountOnExit={destroyOnClose}
timeout={duration}
in={innerVisible}
onEntered={afterShow}
onExited={afterClose}
>
{renderContent()}
</CSSTransition>
) : (
innerVisible && renderContent()
)}
</>
)
}

Expand All @@ -218,12 +233,9 @@ export const Popup: FunctionComponent<
lockScroll={lockScroll}
duration={duration}
onClick={handleOverlayClick}
>
{renderPop()}
</Overlay>
) : (
renderPop()
)}
/>
) : null}
{renderPop()}
</>
)
}
Expand Down
2 changes: 1 addition & 1 deletion src/packages/textarea/demo.taro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const TextAreaDemo = () => {
<Demo7 />
<View className="h2">{translated.textAlign}</View>
<Demo8 />
<h2>{translated.error}</h2>
<View className="h2">{translated.error}</View>
<Demo9 />
</ScrollView>
</>
Expand Down
4 changes: 2 additions & 2 deletions src/packages/textarea/demos/h5/demo1.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import { Space, TextArea } from '@nutui/nutui-react'

const Demo1 = () => {
const Demo = () => {
return (
<Space direction="vertical">
<TextArea
Expand All @@ -20,4 +20,4 @@ const Demo1 = () => {
</Space>
)
}
export default Demo1
export default Demo
4 changes: 2 additions & 2 deletions src/packages/textarea/demos/h5/demo2.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React, { useState } from 'react'
import { TextArea } from '@nutui/nutui-react'

const Demo2 = () => {
const Demo = () => {
const [value, setValue] = useState('')
return <TextArea value={value} onChange={(value) => setValue(value)} />
}
export default Demo2
export default Demo
4 changes: 2 additions & 2 deletions src/packages/textarea/demos/h5/demo3.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import { TextArea } from '@nutui/nutui-react'

const Demo3 = () => {
const Demo = () => {
return <TextArea showCount maxLength={20} />
}
export default Demo3
export default Demo
4 changes: 2 additions & 2 deletions src/packages/textarea/demos/h5/demo4.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import { TextArea } from '@nutui/nutui-react'

const Demo4 = () => {
const Demo = () => {
return <TextArea autoSize maxLength={-1} />
}
export default Demo4
export default Demo
Loading
Loading