@gm-mobile/c-react 3.9.7-beta.4 → 3.9.7
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.
- package/package.json +5 -5
- package/src/component/calendar/base.tsx +1 -1
- package/src/component/calendar/calendar.tsx +1 -1
- package/src/component/calendar/day.tsx +1 -1
- package/src/component/calendar/month.tsx +5 -5
- package/src/component/calendar/months_list.tsx +3 -3
- package/src/component/calendar/types.ts +3 -3
- package/src/component/date_selector/container.tsx +3 -2
- package/src/component/date_selector/date_selector.tsx +1 -1
- package/src/component/date_selector/day.tsx +2 -2
- package/src/component/date_selector/stories.tsx +2 -1
- package/src/component/digital_keyboard/index.tsx +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gm-mobile/c-react",
|
|
3
|
-
"version": "3.9.7
|
|
3
|
+
"version": "3.9.7",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"author": "liyatang <liyatang@qq.com>",
|
|
6
6
|
"homepage": "https://github.com/gmfe/gm-mobile#readme",
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"url": "https://github.com/gmfe/gm-mobile/issues"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@gm-mobile/c-font": "^3.9.7
|
|
25
|
-
"@gm-mobile/c-tool": "^3.9.7
|
|
26
|
-
"@gm-mobile/locales": "^3.9.7
|
|
24
|
+
"@gm-mobile/c-font": "^3.9.7",
|
|
25
|
+
"@gm-mobile/c-tool": "^3.9.7",
|
|
26
|
+
"@gm-mobile/locales": "^3.9.7"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"@tarojs/components": "3.0.18",
|
|
@@ -33,5 +33,5 @@
|
|
|
33
33
|
"prop-types": "^15.7.2",
|
|
34
34
|
"react": "^16.13.1"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "0899027d262122bf32d9d1ea09d3474fbd0247c5"
|
|
37
37
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getLocale } from '@gm-mobile/locales'
|
|
2
2
|
import React, { FC } from 'react'
|
|
3
3
|
import _ from 'lodash'
|
|
4
|
-
import moment, {
|
|
4
|
+
import moment, { Dayjs } from 'dayjs'
|
|
5
5
|
|
|
6
6
|
import { Flex } from '../flex'
|
|
7
7
|
import Day from './day'
|
|
@@ -32,7 +32,7 @@ const Month: FC<MonthProps> = ({
|
|
|
32
32
|
currentMoment,
|
|
33
33
|
showDateLabel,
|
|
34
34
|
}) => {
|
|
35
|
-
const getDayRowOfMonth = (currentMoment:
|
|
35
|
+
const getDayRowOfMonth = (currentMoment: Dayjs) => {
|
|
36
36
|
if (
|
|
37
37
|
moment(currentMoment).day(0).add(35, 'day').month() !==
|
|
38
38
|
currentMoment.month()
|
|
@@ -64,7 +64,7 @@ const Month: FC<MonthProps> = ({
|
|
|
64
64
|
return disabled
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
let lastDay = moment(currentMoment).day(0).add(-1, 'day')
|
|
68
68
|
const month = currentMoment.month()
|
|
69
69
|
const dayGroup = getDayRowOfMonth(currentMoment)
|
|
70
70
|
|
|
@@ -83,8 +83,8 @@ const Month: FC<MonthProps> = ({
|
|
|
83
83
|
style={{ padding: _.size(dayGroup) > 5 ? '5px 0' : '9px 0' }}
|
|
84
84
|
>
|
|
85
85
|
{_.map(v, (value, index) => {
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
lastDay = lastDay.add(1, 'day')
|
|
87
|
+
const day = moment(lastDay)
|
|
88
88
|
return (
|
|
89
89
|
<Day
|
|
90
90
|
key={`${value}${index}`}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { FC, useRef, useEffect } from 'react'
|
|
2
|
-
import moment, {
|
|
2
|
+
import moment, { Dayjs } from 'dayjs'
|
|
3
3
|
import _ from 'lodash'
|
|
4
4
|
|
|
5
5
|
import { VList, VListRef } from '../v_list'
|
|
@@ -43,7 +43,7 @@ const MonthsList: FC<MonthListProps> = ({
|
|
|
43
43
|
// eslint-disable-next-line
|
|
44
44
|
while (mMin <= mMax) {
|
|
45
45
|
arr.push(moment(mMin))
|
|
46
|
-
mMin.add(1, 'month')
|
|
46
|
+
mMin = mMin.add(1, 'month')
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
return arr
|
|
@@ -74,7 +74,7 @@ const MonthsList: FC<MonthListProps> = ({
|
|
|
74
74
|
height={height}
|
|
75
75
|
itemHeight={MONTH_HEIGHT}
|
|
76
76
|
distance={0}
|
|
77
|
-
renderItem={(month: { item:
|
|
77
|
+
renderItem={(month: { item: Dayjs; index: number }) => {
|
|
78
78
|
return (
|
|
79
79
|
<Month
|
|
80
80
|
key={month.index}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HTMLAttributes } from 'react'
|
|
2
|
-
import {
|
|
2
|
+
import { Dayjs } from 'dayjs'
|
|
3
3
|
|
|
4
4
|
type CalendarType = 'single' | 'range' | 'multiple'
|
|
5
5
|
|
|
@@ -9,7 +9,7 @@ interface DayProps {
|
|
|
9
9
|
type: CalendarType
|
|
10
10
|
onClick: (date: Date) => void
|
|
11
11
|
/** 日期,可能是该月 / 上月 / 下月 */
|
|
12
|
-
value:
|
|
12
|
+
value: Dayjs
|
|
13
13
|
/** 当前日历所在月份 */
|
|
14
14
|
currentMonth: number
|
|
15
15
|
disabled: boolean
|
|
@@ -19,7 +19,7 @@ interface DayProps {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
interface MonthProps {
|
|
22
|
-
currentMoment:
|
|
22
|
+
currentMoment: Dayjs
|
|
23
23
|
selected: Date[]
|
|
24
24
|
type: CalendarType
|
|
25
25
|
onSelectDay: (date: Date) => void
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import React, { FC } from 'react'
|
|
2
2
|
import { View } from '../view'
|
|
3
3
|
import { Flex } from '../flex'
|
|
4
|
-
import moment from '
|
|
4
|
+
import moment, { extend } from 'dayjs'
|
|
5
5
|
import _ from 'lodash'
|
|
6
6
|
|
|
7
|
+
import weekday from 'dayjs/plugin/weekday'
|
|
7
8
|
import { ContainerProps } from './types'
|
|
8
9
|
import Day from './day'
|
|
9
|
-
|
|
10
|
+
extend(weekday)
|
|
10
11
|
const WEEK_COUNT = 7
|
|
11
12
|
|
|
12
13
|
const Container: FC<ContainerProps> = ({ min, max, selected, ...rest }) => {
|
|
@@ -2,7 +2,7 @@ import { getLocale } from '@gm-mobile/locales'
|
|
|
2
2
|
import React, { FC } from 'react'
|
|
3
3
|
import { View } from '../view'
|
|
4
4
|
import _ from 'lodash'
|
|
5
|
-
import moment from '
|
|
5
|
+
import moment from 'dayjs'
|
|
6
6
|
|
|
7
7
|
import { DateSelectorProps } from './types'
|
|
8
8
|
import Container from './container'
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React, { FC, memo } from 'react'
|
|
2
2
|
import { getLocale } from '@gm-mobile/locales'
|
|
3
3
|
import classNames from 'classnames'
|
|
4
|
-
import moment, {
|
|
4
|
+
import moment, { Dayjs } from 'dayjs'
|
|
5
5
|
import { View } from '../view'
|
|
6
6
|
import _ from 'lodash'
|
|
7
7
|
|
|
8
8
|
import { DayProps } from './types'
|
|
9
9
|
|
|
10
|
-
const formatDay = (day: Date, span = 0):
|
|
10
|
+
const formatDay = (day: Date, span = 0): Dayjs => {
|
|
11
11
|
return moment(day).add(span, 'day').startOf('day')
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -75,6 +75,7 @@ export class DigitalKeyboard {
|
|
|
75
75
|
actionKeys={this.actionKeys}
|
|
76
76
|
value={this.form[this.active]}
|
|
77
77
|
onInput={(value, btn) => {
|
|
78
|
+
if (typeof wx !== 'undefined') wx.vibrateShort({ type: 'light' })
|
|
78
79
|
const oldValue = value
|
|
79
80
|
// rewriteMode
|
|
80
81
|
if (state.needClear) {
|