Skip to content

Commit f2282ac

Browse files
committed
chore: merge branch dev into ui-next
2 parents 5da4427 + 1b66687 commit f2282ac

File tree

18 files changed

+236
-238
lines changed

18 files changed

+236
-238
lines changed

src/components/action-sheet/body/item/index.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import classNames from 'classnames'
2-
import _isFunction from 'lodash/isFunction'
32
import PropTypes, { InferProps } from 'prop-types'
43
import React from 'react'
54
import { AtActionSheetItemProps } from 'types/action-sheet'
@@ -12,7 +11,7 @@ export default class AtActionSheetItem extends React.Component<
1211
public static propTypes: InferProps<AtActionSheetItemProps>
1312

1413
private handleClick = (args: any): void => {
15-
if (_isFunction(this.props.onClick)) {
14+
if (typeof this.props.onClick === 'function') {
1615
this.props.onClick(args)
1716
}
1817
}

src/components/action-sheet/footer/index.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import classNames from 'classnames'
2-
import _isFunction from 'lodash/isFunction'
32
import PropTypes, { InferProps } from 'prop-types'
43
import React from 'react'
54
import { AtActionSheetFooterProps } from 'types/action-sheet'
@@ -12,7 +11,7 @@ export default class AtActionSheetFooter extends React.Component<
1211
public static propTypes: InferProps<AtActionSheetFooterProps>
1312

1413
private handleClick = (...args: any[]): void => {
15-
if (_isFunction(this.props.onClick)) {
14+
if (typeof this.props.onClick === 'function') {
1615
this.props.onClick(...args)
1716
}
1817
}

src/components/action-sheet/index.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import classNames from 'classnames'
2-
import _isFunction from 'lodash/isFunction'
32
import PropTypes, { InferProps } from 'prop-types'
43
import React from 'react'
54
import { AtActionSheetProps, AtActionSheetState } from 'types/action-sheet'
@@ -37,13 +36,13 @@ export default class AtActionSheet extends React.Component<
3736
}
3837

3938
private handleClose = (): void => {
40-
if (_isFunction(this.props.onClose)) {
39+
if (typeof this.props.onClose === 'function') {
4140
this.props.onClose()
4241
}
4342
}
4443

4544
private handleCancel = (): void => {
46-
if (_isFunction(this.props.onCancel)) {
45+
if (typeof this.props.onCancel === 'function') {
4746
return this.props.onCancel()
4847
}
4948
this.close()

src/components/badge/index.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import classNames from 'classnames'
2-
import isNaN from 'lodash/isNaN'
32
import PropTypes, { InferProps } from 'prop-types'
43
import React from 'react'
54
import { AtBadgeProps } from 'types/badge'
@@ -21,7 +20,7 @@ export default class AtBadge extends React.Component<AtBadgeProps> {
2120
if (value === '' || value === null || typeof value === 'undefined')
2221
return ''
2322
const numValue = +value
24-
if (isNaN(numValue)) {
23+
if (Number.isNaN(numValue)) {
2524
return value
2625
}
2726
return numValue > maxValue ? `${maxValue}+` : numValue

src/components/calendar/body/index.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,12 @@ export default class AtCalendarBody extends React.Component<
217217
this.animateMoveSlide(0)
218218
}
219219

220-
private handleChange = (e: BaseEventOrig<any>): void => {
220+
private handleChange = (
221+
e: BaseEventOrig<{
222+
current: number
223+
source: string
224+
}>
225+
): void => {
221226
const { current, source } = e.detail
222227

223228
if (source === 'touch') {

src/components/calendar/index.tsx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import classnames from 'classnames'
22
import dayjs, { Dayjs } from 'dayjs'
3-
import _isFunction from 'lodash/isFunction'
43
import React from 'react'
54
import {
65
AtCalendarDefaultProps,
@@ -169,7 +168,7 @@ export default class AtCalendar extends React.Component<
169168
private triggerChangeDate = (value: Dayjs): void => {
170169
const { format } = this.props
171170

172-
if (!_isFunction(this.props.onMonthChange)) return
171+
if (typeof this.props.onMonthChange !== 'function') return
173172

174173
this.props.onMonthChange(value.format(format))
175174
}
@@ -183,7 +182,7 @@ export default class AtCalendar extends React.Component<
183182
generateDate: _generateDate.valueOf()
184183
})
185184

186-
if (vectorCount && _isFunction(this.props.onMonthChange)) {
185+
if (vectorCount && typeof this.props.onMonthChange === 'function') {
187186
this.props.onMonthChange(_generateDate.format(format))
188187
}
189188
}
@@ -195,7 +194,7 @@ export default class AtCalendar extends React.Component<
195194

196195
this.setMonth(-1)
197196

198-
if (_isFunction(this.props.onClickPreMonth)) {
197+
if (typeof this.props.onClickPreMonth === 'function') {
199198
this.props.onClickPreMonth()
200199
}
201200
}
@@ -207,7 +206,7 @@ export default class AtCalendar extends React.Component<
207206

208207
this.setMonth(1)
209208

210-
if (_isFunction(this.props.onClickNextMonth)) {
209+
if (typeof this.props.onClickNextMonth === 'function') {
211210
this.props.onClickNextMonth()
212211
}
213212
}
@@ -247,14 +246,14 @@ export default class AtCalendar extends React.Component<
247246
this.handleSelectedDate()
248247
})
249248

250-
if (_isFunction(this.props.onDayClick)) {
249+
if (typeof this.props.onDayClick === 'function') {
251250
this.props.onDayClick({ value: item.value })
252251
}
253252
}
254253

255254
private handleSelectedDate = (): void => {
256255
const selectDate = this.state.selectedDate
257-
if (_isFunction(this.props.onSelectDate)) {
256+
if (typeof this.props.onSelectDate === 'function') {
258257
const info: Calendar.SelectedDate = {
259258
start: dayjs(selectDate.start).format(this.props.format)
260259
}
@@ -270,7 +269,7 @@ export default class AtCalendar extends React.Component<
270269
}
271270

272271
private handleDayLongClick = (item: Calendar.Item): void => {
273-
if (_isFunction(this.props.onDayLongClick)) {
272+
if (typeof this.props.onDayLongClick === 'function') {
274273
this.props.onDayLongClick({ value: item.value })
275274
}
276275
}

src/components/calendar/ui/date-list/index.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import classnames from 'classnames'
2-
import _isFunction from 'lodash/isFunction'
32
import React from 'react'
43
import { Calendar } from 'types/calendar'
54
import { Text, View } from '@tarojs/components'
@@ -21,13 +20,13 @@ export interface Props {
2120

2221
export default class AtCalendarList extends React.Component<Props> {
2322
private handleClick = (item: Calendar.Item): void => {
24-
if (_isFunction(this.props.onClick)) {
23+
if (typeof this.props.onClick === 'function') {
2524
this.props.onClick(item)
2625
}
2726
}
2827

2928
private handleLongClick = (item: Calendar.Item): void => {
30-
if (_isFunction(this.props.onLongClick)) {
29+
if (typeof this.props.onLongClick === 'function') {
3130
this.props.onLongClick(item)
3231
}
3332
}

src/components/card/index.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import classNames from 'classnames'
2-
import _isFunction from 'lodash/isFunction'
32
import PropTypes, { InferProps } from 'prop-types'
43
import React from 'react'
54
import { AtCardProps } from 'types/card'
@@ -10,7 +9,7 @@ export default class AtCard extends React.Component<AtCardProps> {
109
public static propTypes: InferProps<AtCardProps>
1110

1211
private handleClick = (args: any): void => {
13-
if (_isFunction(this.props.onClick)) {
12+
if (typeof this.props.onClick === 'function') {
1413
this.props.onClick(args)
1514
}
1615
}

src/components/fab/index.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,28 @@ import PropTypes, { InferProps } from 'prop-types'
33
import React from 'react'
44
import { AtFabProps } from 'types/fab'
55
import { View } from '@tarojs/components'
6+
import { CommonEvent } from '@tarojs/components/types/common'
67

78
export default class AtFab extends React.Component<AtFabProps> {
89
public static defaultProps: AtFabProps
910
public static propTypes: InferProps<AtFabProps>
1011

11-
private onClick(): void {
12-
this.props.onClick && this.props.onClick(arguments as any)
12+
private onClick(e: CommonEvent): void {
13+
if (typeof this.props.onClick === 'function') {
14+
this.props.onClick(e)
15+
}
1316
}
1417

1518
public render(): JSX.Element {
16-
const { size, className } = this.props
19+
const { size, className, children } = this.props
1720

1821
const rootClass = classNames('at-fab', className, {
1922
[`at-fab--${size}`]: size
2023
})
2124

2225
return (
2326
<View className={rootClass} onClick={this.onClick.bind(this)}>
24-
{this.props.children}
27+
{children}
2528
</View>
2629
)
2730
}

src/components/float-layout/index.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import classNames from 'classnames'
2-
import _isFunction from 'lodash/isFunction'
32
import PropTypes, { InferProps } from 'prop-types'
43
import React from 'react'
54
import { AtFloatLayoutProps, AtFloatLayoutState } from 'types/float-layout'
@@ -38,7 +37,7 @@ export default class AtFloatLayout extends React.Component<
3837
}
3938

4039
private handleClose = (): void => {
41-
if (_isFunction(this.props.onClose)) {
40+
if (typeof this.props.onClose === 'function') {
4241
// TODO: Fix typings
4342
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
4443
// @ts-ignore

0 commit comments

Comments
 (0)