Skip to content
This repository has been archived by the owner on Dec 6, 2021. It is now read-only.

Commit

Permalink
Merge pull request #93 from b2nil/dev
Browse files Browse the repository at this point in the history
for release alpha.20
  • Loading branch information
b2nil authored Apr 25, 2021
2 parents ac6efda + fbc03b1 commit 6a3c0c9
Show file tree
Hide file tree
Showing 62 changed files with 1,165 additions and 781 deletions.
27 changes: 14 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,32 +80,32 @@
"lodash-es": "^4.17.15"
},
"peerDependencies": {
"@tarojs/components": "^3.1.4",
"@tarojs/taro": "^3.1.4",
"vue": "^3.0.6"
"@tarojs/components": "^3.2.1",
"@tarojs/taro": "^3.2.1",
"vue": "^3.0.10"
},
"devDependencies": {
"@babel/core": "^7.8.0",
"@babel/runtime": "^7.7.7",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^9.0.0",
"@tarojs/components": "^3.1.4",
"@tarojs/mini-runner": "^3.1.4",
"@tarojs/runtime": "^3.1.4",
"@tarojs/taro": "^3.1.4",
"@tarojs/webpack-runner": "^3.1.4",
"@tarojs/components": "^3.2.1",
"@tarojs/mini-runner": "^3.2.1",
"@tarojs/runtime": "^3.2.1",
"@tarojs/taro": "^3.2.1",
"@tarojs/webpack-runner": "^3.2.1",
"@types/jest": "^26.0.17",
"@types/lodash-es": "^4.17.3",
"@types/webpack-env": "^1.13.6",
"@typescript-eslint/eslint-plugin": "^2.x",
"@typescript-eslint/parser": "^2.x",
"@vue/babel-plugin-jsx": "^1.0.0-rc.4",
"@vue/compiler-sfc": "^3.0.6",
"@vue/compiler-sfc": "^3.0.10",
"@vue/test-utils": "2.0.0-rc.0",
"babel-preset-taro": "^3.0.5",
"cross-env": "^7.0.2",
"csstype": "^2.6.11",
"esbuild": "^0.9.0",
"esbuild": "^0.11.0",
"eslint": "^6.8.0",
"eslint-config-taro": "^3.0.5",
"eslint-plugin-vue": "^7.0.0-alpha.6",
Expand All @@ -116,14 +116,15 @@
"rollup": "^2.29.0",
"rollup-plugin-copy": "^3.3.0",
"rollup-plugin-sass": "^1.2.2",
"rollup-plugin-typescript2": "^0.27.2",
"rollup-plugin-typescript2": "0.30.0",
"shelljs": "^0.8.4",
"stylelint": "^9.3.0",
"tiny-glob": "^0.2.8",
"ts-jest": "^26.4.4",
"ts-loader": "^8.0.2",
"typescript": "^3.7.0",
"vue": "^3.0.6",
"tslib": "^2.1.0",
"typescript": "^4.2.0",
"vue": "^3.0.10",
"vue-jest": "^5.0.0-alpha.7",
"vue-loader": "^16.1.0",
"webpack-bundle-analyzer": "^4.2.0"
Expand Down
2 changes: 1 addition & 1 deletion src/components/accordion/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const AtAccordion = defineComponent({
type: String,
default: ''
},
onClick: Function as PropType<AtAccordionProps['onClick']>
onClick: Function as unknown as PropType<AtAccordionProps['onClick']>
},

setup(props: AtAccordionProps, { attrs, slots }) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/action-sheet/body/item/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const AtActionSheetItem = defineComponent({
name: "AtActionSheetItem",

props: {
onClick: Function as PropType<(event?: CommonEvent) => void>
onClick: Function as unknown as PropType<(event?: CommonEvent) => void>
},

setup(props: AtActionSheetItemProps, { attrs, slots }) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/action-sheet/footer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const AtActionSheetFooter = defineComponent({
name: "AtActionSheetFooter",

props: {
onClick: Function as PropType<AtActionSheetFooterProps['onClick']>
onClick: Function as unknown as PropType<AtActionSheetFooterProps['onClick']>
},

setup(props: AtActionSheetFooterProps, { attrs, slots }) {
Expand Down
4 changes: 2 additions & 2 deletions src/components/action-sheet/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ const AtActionSheet = defineComponent({
type: String,
default: ''
},
onClose: Function as PropType<(event?: CommonEvent) => void>,
onCancel: Function as PropType<(event?: CommonEvent) => void>
onClose: Function as unknown as PropType<(event?: CommonEvent) => void>,
onCancel: Function as unknown as PropType<(event?: CommonEvent) => void>
},

setup(props: AtActionSheetProps, { attrs, slots }) {
Expand Down
18 changes: 9 additions & 9 deletions src/components/button/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const AtButton = defineComponent({
full: Boolean,
loading: Boolean,
disabled: Boolean,
onClick: Function as PropType<AtButtonProps['onClick']>,
onClick: Function as unknown as PropType<AtButtonProps['onClick']>,

// Taro Button Props
formType: {
Expand Down Expand Up @@ -74,14 +74,14 @@ const AtButton = defineComponent({
scope: String as PropType<AtButtonProps['scope']>, // alipay scope

// Taro Button Events
onGetUserInfo: Function as PropType<AtButtonProps['onGetUserInfo']>,
onGetAuthorize: Function as PropType<AtButtonProps['onGetAuthorize']>, // Alipay auth
onContact: Function as PropType<AtButtonProps['onContact']>,
onGetPhoneNumber: Function as PropType<AtButtonProps['onGetPhoneNumber']>,
onGetRealnameAuthInfo: Function as PropType<AtButtonProps['onGetRealnameAuthInfo']>,
onError: Function as PropType<AtButtonProps['onError']>,
onOpenSetting: Function as PropType<AtButtonProps['onOpenSetting']>,
onLaunchapp: Function as PropType<AtButtonProps['onLaunchapp']>,
onGetUserInfo: Function as unknown as PropType<AtButtonProps['onGetUserInfo']>,
onGetAuthorize: Function as unknown as PropType<AtButtonProps['onGetAuthorize']>, // Alipay auth
onContact: Function as unknown as PropType<AtButtonProps['onContact']>,
onGetPhoneNumber: Function as unknown as PropType<AtButtonProps['onGetPhoneNumber']>,
onGetRealnameAuthInfo: Function as unknown as PropType<AtButtonProps['onGetRealnameAuthInfo']>,
onError: Function as unknown as PropType<AtButtonProps['onError']>,
onOpenSetting: Function as unknown as PropType<AtButtonProps['onOpenSetting']>,
onLaunchapp: Function as unknown as PropType<AtButtonProps['onLaunchapp']>,
},

setup(props: AtButtonProps, { attrs, slots }) {
Expand Down
4 changes: 2 additions & 2 deletions src/components/calendar/__tests__/calendar.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ describe('AtCalendar', () => {
today.setDate(today.getDate() - 28)
const prevM = new Date(today).toISOString().substring(0, 10)
const wrapper = mountFactory(AtCalendar, undefined, { marks: [{ value: prevM }] })
expect(wrapper.findAll('.mark').length).toBe(1)
expect(wrapper.findAll('.flex__item:not(.flex__item--blur) .mark').length).toBe(1)
await wrapper.setProps({ marks: [{ value: `${dString}-21` }, { value: prevM }, { value: `${dString}-23` }] })
wrapper.vm.$nextTick()
expect(wrapper.findAll('.mark').length).toBe(3)
expect(wrapper.findAll('.flex__item:not(.flex__item--blur) .mark').length).toBe(3)
})

it('should render minDate and maxDate', () => {
Expand Down
6 changes: 3 additions & 3 deletions src/components/calendar/body/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ const AtCalendarBody = defineComponent({
default: () => []
},
onDayClick: {
type: Function as PropType<AtCalendarBodyProps['onDayClick']>,
type: Function as unknown as PropType<AtCalendarBodyProps['onDayClick']>,
default: () => () => { }
},
onLongClick: {
type: Function as PropType<AtCalendarBodyProps['onLongClick']>,
type: Function as unknown as PropType<AtCalendarBodyProps['onLongClick']>,
default: () => () => { }
},
onSwipeMonth: {
type: Function as PropType<AtCalendarBodyProps['onSwipeMonth']>,
type: Function as unknown as PropType<AtCalendarBodyProps['onSwipeMonth']>,
default: () => () => { }
},
},
Expand Down
20 changes: 10 additions & 10 deletions src/components/calendar/common/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ export function handleActive(
const dayjsStart = start ? dayjs(start) : dayjsEnd

item.isSelected =
_value.isSame(dayjsEnd) ||
_value.isSame(dayjsStart) ||
(_value.isAfter(dayjsStart) && _value.isBefore(dayjsEnd))
_value!.isSame(dayjsEnd) ||
_value!.isSame(dayjsStart) ||
(_value!.isAfter(dayjsStart) && _value!.isBefore(dayjsEnd))

item.isSelectedHead = _value.isSame(dayjsStart)
item.isSelectedTail = _value.isSame(dayjsEnd)
item.isSelectedHead = _value!.isSame(dayjsStart)
item.isSelectedTail = _value!.isSame(dayjsEnd)

item.isToday = _value.diff(dayjs(Date.now()).startOf('day'), 'day') === 0
item.isToday = _value!.diff(dayjs(Date.now()).startOf('day'), 'day') === 0

return item
}
Expand All @@ -44,7 +44,7 @@ export function handleMarks(
const markList = marks.filter(mark =>
dayjs(mark.value)
.startOf('day')
.isSame(_value)
.isSame(_value!)
)

item.marks = markList.slice(0, 1)
Expand Down Expand Up @@ -96,8 +96,8 @@ export function handleDisabled(
const dayjsMaxDate = dayjs(maxDate)

item.isDisabled =
!!(minDate && _value.isBefore(dayjsMinDate)) ||
!!(maxDate && _value.isAfter(dayjsMaxDate))
!!(minDate && _value!.isBefore(dayjsMinDate)) ||
!!(maxDate && _value!.isAfter(dayjsMaxDate))

return item
}
Expand All @@ -114,7 +114,7 @@ export function handleValid(
const isInclude = validDates.some(date =>
dayjs(date.value)
.startOf('day')
.isSame(_value)
.isSame(_value!)
)

item.isDisabled = !isInclude
Expand Down
9 changes: 4 additions & 5 deletions src/components/calendar/controller/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ const AtCalendarController = defineComponent({
props: {
generateDate: {
type: [String, Number] as PropType<AtCalendarControllerProps["generateDate"]>,
default: Date.now(),
required: true
default: Date.now()
},
minDate: [String, Number, Date] as PropType<AtCalendarControllerProps["minDate"]>,
maxDate: [String, Number, Date] as PropType<AtCalendarControllerProps["maxDate"]>,
Expand All @@ -21,9 +20,9 @@ const AtCalendarController = defineComponent({
type: String as PropType<AtCalendarControllerProps["monthFormat"]>,
default: 'YYYY年MM月'
},
onPreMonth: Function as PropType<AtCalendarControllerProps["onPreMonth"]>,
onNextMonth: Function as PropType<AtCalendarControllerProps["onNextMonth"]>,
onSelectDate: Function as PropType<AtCalendarControllerProps["onSelectDate"]>
onPreMonth: Function as unknown as PropType<AtCalendarControllerProps["onPreMonth"]>,
onNextMonth: Function as unknown as PropType<AtCalendarControllerProps["onNextMonth"]>,
onSelectDate: Function as unknown as PropType<AtCalendarControllerProps["onSelectDate"]>
},

setup(props: AtCalendarControllerProps) {
Expand Down
12 changes: 6 additions & 6 deletions src/components/calendar/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ const AtCalendar = defineComponent({
default: () => []
},
// 事件
onClickPreMonth: Function as PropType<AtCalendarProps['onClickPreMonth']>,
onClickNextMonth: Function as PropType<AtCalendarProps['onClickNextMonth']>,
onDayClick: Function as PropType<AtCalendarProps['onDayClick']>,
onDayLongClick: Function as PropType<AtCalendarProps['onDayLongClick']>,
onMonthChange: Function as PropType<AtCalendarProps['onMonthChange']>,
onSelectDate: Function as PropType<AtCalendarProps['onSelectDate']>
onClickPreMonth: Function as unknown as PropType<AtCalendarProps['onClickPreMonth']>,
onClickNextMonth: Function as unknown as PropType<AtCalendarProps['onClickNextMonth']>,
onDayClick: Function as unknown as PropType<AtCalendarProps['onDayClick']>,
onDayLongClick: Function as unknown as PropType<AtCalendarProps['onDayLongClick']>,
onMonthChange: Function as unknown as PropType<AtCalendarProps['onMonthChange']>,
onSelectDate: Function as unknown as PropType<AtCalendarProps['onSelectDate']>
},

setup(props: AtCalendarProps, { attrs }) {
Expand Down
4 changes: 2 additions & 2 deletions src/components/calendar/ui/date-list/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ const AtCalendarList = defineComponent({
type: Array as PropType<AtCalendarListProps["list"]>,
default: () => [] as Calendar.List<Calendar.Item>
},
onClick: Function as PropType<AtCalendarListProps["onClick"]>,
onLongClick: Function as PropType<AtCalendarListProps["onLongClick"]>,
onClick: Function as unknown as PropType<AtCalendarListProps["onClick"]>,
onLongClick: Function as unknown as PropType<AtCalendarListProps["onLongClick"]>,
},

setup(props: AtCalendarListProps) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/card/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const AtCard = defineComponent({
},
icon: Object as PropType<AtCardProps['icon']>,
renderIcon: Object as PropType<AtCardProps['renderIcon']>,
onClick: Function as PropType<AtCardProps['onClick']>
onClick: Function as unknown as PropType<AtCardProps['onClick']>
},

setup(props: AtCardProps, { attrs, slots }) {
Expand Down
5 changes: 2 additions & 3 deletions src/components/checkbox/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@ const AtCheckbox = defineComponent({
// 参数
options: {
type: Array as PropType<AtCheckboxProps<any>['options']>,
default: () => [],
required: true
default: () => []
},
selectedList: {
type: Array as PropType<AtCheckboxProps<any>['selectedList']>,
default: () => []
},
// 事件
onChange: Function as PropType<AtCheckboxProps<any>['onChange']>
onChange: Function as unknown as PropType<AtCheckboxProps<any>['onChange']>
},

setup(props: AtCheckboxProps<any>, { attrs, emit }) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/countdown/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const AtCountdown = defineComponent({
default: 0,
},
// 事件
onTimeUp: Function as PropType<AtCountDownProps['onTimeUp']>
onTimeUp: Function as unknown as PropType<AtCountDownProps['onTimeUp']>
},

onShow() {
Expand Down
3 changes: 1 addition & 2 deletions src/components/countdown/item/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ const AtCountdownItem = defineComponent({
// 参数
num: {
type: Number as PropType<AtCountdownItemProps['num']>,
default: 0,
required: true
default: 0
},
separator: {
type: String as PropType<AtCountdownItemProps['separator']>,
Expand Down
2 changes: 1 addition & 1 deletion src/components/curtain/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const AtCurtain = defineComponent({
},
// 事件
onClose: {
type: Function as PropType<AtCurtainProps['onClose']>,
type: Function as unknown as PropType<AtCurtainProps['onClose']>,
default: () => () => { }
}
},
Expand Down
7 changes: 3 additions & 4 deletions src/components/drawer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ const AtDrawer = defineComponent({
props: {
show: {
type: Boolean,
default: false,
required: true
default: false
},
mask: {
type: Boolean,
Expand All @@ -27,11 +26,11 @@ const AtDrawer = defineComponent({
default: () => [],
},
onItemClick: {
type: Function as PropType<AtDrawerProps['onItemClick']>,
type: Function as unknown as PropType<AtDrawerProps['onItemClick']>,
default: () => () => { }
},
onClose: {
type: Function as PropType<AtDrawerProps['onClose']>,
type: Function as unknown as PropType<AtDrawerProps['onClose']>,
default: () => () => { }
}
},
Expand Down
2 changes: 1 addition & 1 deletion src/components/fab/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const AtFab = defineComponent({
validator: (prop: string) => ['normal', 'small'].includes(prop)
},
onClick: {
type: Function as PropType<AtFabProps['onClick']>,
type: Function as unknown as PropType<AtFabProps['onClick']>,
default: () => () => { }
}
},
Expand Down
11 changes: 5 additions & 6 deletions src/components/float-layout/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ const AtFloatLayout = defineComponent({
// 参数
isOpened: {
type: Boolean,
default: false,
required: true
default: false
},
title: {
type: String as PropType<AtFloatLayoutProps['title']>,
Expand All @@ -30,10 +29,10 @@ const AtFloatLayout = defineComponent({
lowerThreshold: Number as PropType<AtFloatLayoutProps['lowerThreshold']>,
scrollWithAnimation: Boolean,
// 事件
onClose: Function as PropType<AtFloatLayoutProps['onClose']>,
onScroll: Function as PropType<AtFloatLayoutProps['onScroll']>,
onScrollToUpper: Function as PropType<AtFloatLayoutProps['onScrollToUpper']>,
onScrollToLower: Function as PropType<AtFloatLayoutProps['onScrollToLower']>,
onClose: Function as unknown as PropType<AtFloatLayoutProps['onClose']>,
onScroll: Function as unknown as PropType<AtFloatLayoutProps['onScroll']>,
onScrollToUpper: Function as unknown as PropType<AtFloatLayoutProps['onScrollToUpper']>,
onScrollToLower: Function as unknown as PropType<AtFloatLayoutProps['onScrollToLower']>,
},

setup(props: AtFloatLayoutProps, { attrs, slots }) {
Expand Down
4 changes: 2 additions & 2 deletions src/components/form/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ const AtForm = defineComponent({

props: {
reportSubmit: Boolean as PropType<AtFormProps['reportSubmit']>,
onSubmit: Function as PropType<AtFormProps['onSubmit']>,
onReset: Function as PropType<AtFormProps['onReset']>,
onSubmit: Function as unknown as PropType<AtFormProps['onSubmit']>,
onReset: Function as unknown as PropType<AtFormProps['onReset']>,
},

setup(props: AtFormProps, { attrs, slots }) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/grid/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const AtGrid = defineComponent({
default: 'square',
},
onClick: {
type: Function as PropType<AtGridProps['onClick']>,
type: Function as unknown as PropType<AtGridProps['onClick']>,
default: () => () => { }
}
},
Expand Down
Loading

0 comments on commit 6a3c0c9

Please sign in to comment.