wini-web-components 0.3.0 → 0.4.0
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/dist/index.js +1 -0
- package/package.json +25 -9
- package/src/component/calendar/calendar.css +0 -133
- package/src/component/calendar/calendar.tsx +0 -448
- package/src/component/checkbox/checkbox.css +0 -46
- package/src/component/checkbox/checkbox.tsx +0 -59
- package/src/component/component-status.tsx +0 -53
- package/src/component/date-picker/date-picker.css +0 -114
- package/src/component/date-picker/date-picker.tsx +0 -363
- package/src/component/dialog/dialog.css +0 -125
- package/src/component/dialog/dialog.tsx +0 -91
- package/src/component/import-file/import-file.css +0 -86
- package/src/component/import-file/import-file.tsx +0 -154
- package/src/component/infinite-scroll/infinite-scroll.css +0 -37
- package/src/component/infinite-scroll/infinite-scroll.tsx +0 -33
- package/src/component/input-multi-select/input-multi-select.css +0 -127
- package/src/component/input-multi-select/input-multi-select.tsx +0 -261
- package/src/component/pagination/pagination.css +0 -69
- package/src/component/pagination/pagination.tsx +0 -65
- package/src/component/popup/popup.css +0 -90
- package/src/component/popup/popup.tsx +0 -105
- package/src/component/progress-bar/progress-bar.css +0 -47
- package/src/component/progress-bar/progress-bar.tsx +0 -34
- package/src/component/progress-circle/progress-circle.css +0 -47
- package/src/component/progress-circle/progress-circle.tsx +0 -24
- package/src/component/radio-button/radio-button.css +0 -49
- package/src/component/radio-button/radio-button.tsx +0 -59
- package/src/component/rating/rating.css +0 -11
- package/src/component/rating/rating.tsx +0 -65
- package/src/component/select1/select1.css +0 -155
- package/src/component/select1/select1.tsx +0 -241
- package/src/component/slider/slider.css +0 -16
- package/src/component/slider/slider.tsx +0 -87
- package/src/component/switch/switch.css +0 -53
- package/src/component/switch/switch.tsx +0 -67
- package/src/component/table/table.css +0 -74
- package/src/component/table/table.tsx +0 -99
- package/src/component/text/text.css +0 -16
- package/src/component/text/text.tsx +0 -21
- package/src/component/text-area/text-area.css +0 -63
- package/src/component/text-area/text-area.tsx +0 -55
- package/src/component/text-field/text-field.css +0 -64
- package/src/component/text-field/text-field.tsx +0 -63
- package/src/component/toast-noti/toast-noti.css +0 -0
- package/src/component/toast-noti/toast-noti.tsx +0 -21
- package/src/index.js +0 -51
- package/src/logo.svg +0 -1
- package/src/skin/color.css +0 -17
- package/src/skin/layout.css +0 -601
- package/src/skin/typography.css +0 -378
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wini-web-components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@fortawesome/free-solid-svg-icons": "^6.5.2",
|
|
6
6
|
"@fortawesome/react-fontawesome": "^0.2.2",
|
|
7
|
-
"
|
|
7
|
+
"date-fns": "^3.6.0",
|
|
8
|
+
"react": "^18.0.0",
|
|
8
9
|
"react-awesome-slider": "^4.1.0",
|
|
9
|
-
"react-dom": "^18.
|
|
10
|
+
"react-dom": "^18.0.0",
|
|
10
11
|
"react-hook-form": "^7.52.0",
|
|
11
12
|
"react-paginate": "^8.2.0",
|
|
12
13
|
"react-scripts": "5.0.1",
|
|
@@ -14,10 +15,8 @@
|
|
|
14
15
|
"web-vitals": "^2.1.4"
|
|
15
16
|
},
|
|
16
17
|
"scripts": {
|
|
17
|
-
"
|
|
18
|
-
"build": "
|
|
19
|
-
"test": "react-scripts test",
|
|
20
|
-
"eject": "react-scripts eject"
|
|
18
|
+
"build": "webpack --mode development",
|
|
19
|
+
"build:prod": "webpack --mode production"
|
|
21
20
|
},
|
|
22
21
|
"eslintConfig": {
|
|
23
22
|
"extends": [
|
|
@@ -38,8 +37,25 @@
|
|
|
38
37
|
]
|
|
39
38
|
},
|
|
40
39
|
"description": "This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).",
|
|
41
|
-
"main": "index.js",
|
|
42
|
-
"
|
|
40
|
+
"main": "dist/index.js",
|
|
41
|
+
"peerDependencies": {
|
|
42
|
+
"react": "^18.0.0",
|
|
43
|
+
"react-dom": "^18.0.0"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@babel/core": "^7.0.0",
|
|
47
|
+
"@babel/preset-env": "^7.0.0",
|
|
48
|
+
"@babel/preset-react": "^7.0.0",
|
|
49
|
+
"@babel/preset-typescript": "^7.0.0",
|
|
50
|
+
"@types/react": "^18.0.0",
|
|
51
|
+
"@types/react-dom": "^18.0.0",
|
|
52
|
+
"babel-loader": "^8.0.0",
|
|
53
|
+
"css-loader": "^5.0.0",
|
|
54
|
+
"style-loader": "^2.0.0",
|
|
55
|
+
"typescript": "^4.0.0",
|
|
56
|
+
"webpack": "^5.0.0",
|
|
57
|
+
"webpack-cli": "^4.0.0"
|
|
58
|
+
},
|
|
43
59
|
"publishConfig": {
|
|
44
60
|
"@WiniGit:registry": "https://npm.pkg.github.com"
|
|
45
61
|
},
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
.calendar-container {
|
|
2
|
-
background-color: #ffffff;
|
|
3
|
-
border-radius: 0.8rem;
|
|
4
|
-
align-items: stretch;
|
|
5
|
-
border: var(--border-grey1);
|
|
6
|
-
width: fit-content;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.calendar-container button {
|
|
10
|
-
outline: none;
|
|
11
|
-
padding: 0;
|
|
12
|
-
border: none;
|
|
13
|
-
cursor: pointer;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.calendar-container>.calendar-body:has(*:nth-child(2))>.row:first-child {
|
|
17
|
-
border-bottom: var(--border-grey1);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.calendar-sidebar-options {
|
|
21
|
-
padding: 0.8rem 2.4rem 0.8rem 0;
|
|
22
|
-
border-right: var(--border-grey1);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.calendar-sidebar-options>.calendar-sidebar-option-buttton {
|
|
26
|
-
color: #00204DE5;
|
|
27
|
-
padding: 0.8rem 1.6rem;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.picker-time-container {
|
|
31
|
-
border-left: var(--border-grey1);
|
|
32
|
-
height: 34.2rem;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
.picker-time-container>.heading-7 {
|
|
36
|
-
padding: 1.2rem 1.6rem;
|
|
37
|
-
border-bottom: var(--border-grey1);
|
|
38
|
-
text-align: center;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.picker-time-container div[class*="scroll-picker-"] {
|
|
42
|
-
flex: 1;
|
|
43
|
-
height: 100%;
|
|
44
|
-
gap: 0.4rem;
|
|
45
|
-
padding: 0.4rem 0;
|
|
46
|
-
overflow: hidden auto;
|
|
47
|
-
scrollbar-width: thin;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.picker-time-container .scroll-picker-minutes {
|
|
51
|
-
border-left: var(--border-grey1);
|
|
52
|
-
border-right: var(--border-grey1);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.picker-time-container div[class*="scroll-picker-"]>button {
|
|
56
|
-
width: 5.6rem;
|
|
57
|
-
padding: 0.4rem 0;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.picker-time-container div[class*="scroll-picker-"]>button.selected {
|
|
61
|
-
background-color: var(--infor-background);
|
|
62
|
-
color: var(--infor-color);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.picker-date-header {
|
|
66
|
-
padding: 1.2rem 1.6rem;
|
|
67
|
-
gap: 1.2rem;
|
|
68
|
-
background-color: transparent !important;
|
|
69
|
-
border-bottom: var(--border-grey1);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
.picker-date-header>span {
|
|
73
|
-
width: 100%;
|
|
74
|
-
flex: 1;
|
|
75
|
-
text-align: center;
|
|
76
|
-
cursor: pointer;
|
|
77
|
-
;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
.picker-date-header>button {
|
|
81
|
-
width: 1.6rem;
|
|
82
|
-
height: 1.6rem;
|
|
83
|
-
display: flex;
|
|
84
|
-
align-items: center;
|
|
85
|
-
justify-content: center;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
.picker-date-header>button>svg {
|
|
89
|
-
font-size: 1.4rem;
|
|
90
|
-
color: #00204D99;
|
|
91
|
-
pointer-events: none;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
.picker-date-body {
|
|
95
|
-
padding: 1.2rem 1.6rem;
|
|
96
|
-
width: 31.2rem;
|
|
97
|
-
gap: 0.8rem;
|
|
98
|
-
flex-wrap: wrap;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
.date-picker-circle {
|
|
102
|
-
width: calc((100% - 0.8rem * 6) / 7);
|
|
103
|
-
height: 3.2rem;
|
|
104
|
-
display: flex;
|
|
105
|
-
align-items: center;
|
|
106
|
-
justify-content: center;
|
|
107
|
-
border-radius: 50%;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
.month-picker-circle,
|
|
111
|
-
.year-picker-circle {
|
|
112
|
-
width: calc((100% - 0.8rem * 2) / 3);
|
|
113
|
-
height: 3.2rem;
|
|
114
|
-
display: flex;
|
|
115
|
-
align-items: center;
|
|
116
|
-
justify-content: center;
|
|
117
|
-
border-radius: 2.4rem;
|
|
118
|
-
color: #00204de5;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
button[class*="-picker-circle"] {
|
|
122
|
-
border: 1px solid transparent;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
button[class*="-picker-circle"].selected {
|
|
126
|
-
background-color: var(--infor-color);
|
|
127
|
-
color: #ffffff;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
button[class*="-picker-circle"][in-range="false"] {
|
|
131
|
-
opacity: 0.24 !important;
|
|
132
|
-
pointer-events: none !important;
|
|
133
|
-
}
|
|
@@ -1,448 +0,0 @@
|
|
|
1
|
-
import React, { CSSProperties, ReactNode } from "react"
|
|
2
|
-
import './calendar.css'
|
|
3
|
-
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
|
|
4
|
-
import { faAngleDoubleLeft, faAngleDoubleRight, faAngleLeft, faAngleRight } from "@fortawesome/free-solid-svg-icons"
|
|
5
|
-
import { differenceInCalendarDays } from "date-fns"
|
|
6
|
-
|
|
7
|
-
export const today = new Date()
|
|
8
|
-
export const startDate = new Date(
|
|
9
|
-
today.getFullYear() - 100,
|
|
10
|
-
today.getMonth(),
|
|
11
|
-
today.getDate()
|
|
12
|
-
)
|
|
13
|
-
export const endDate = new Date(
|
|
14
|
-
today.getFullYear() + 100,
|
|
15
|
-
today.getMonth(),
|
|
16
|
-
today.getDate()
|
|
17
|
-
)
|
|
18
|
-
|
|
19
|
-
export const inRangeTime = (date: Date, startDate: Date, endDate: Date) => (differenceInCalendarDays(date, startDate) > -1 && differenceInCalendarDays(endDate, date) > -1)
|
|
20
|
-
|
|
21
|
-
export const enum CalendarType {
|
|
22
|
-
DATE,
|
|
23
|
-
MONTH,
|
|
24
|
-
YEAR,
|
|
25
|
-
DATETIME,
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
interface CalendarProps {
|
|
29
|
-
value?: Date,
|
|
30
|
-
min?: Date,
|
|
31
|
-
max?: Date,
|
|
32
|
-
onSelect?: (props: Date) => void,
|
|
33
|
-
disabled?: boolean,
|
|
34
|
-
helperText?: string,
|
|
35
|
-
helperTextColor?: string,
|
|
36
|
-
placeholder?: string,
|
|
37
|
-
className?: string,
|
|
38
|
-
style?: CSSProperties,
|
|
39
|
-
type: CalendarType,
|
|
40
|
-
showSidebar?: boolean,
|
|
41
|
-
footer?: ReactNode
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
interface CalendarState {
|
|
45
|
-
value: Date,
|
|
46
|
-
selectDate?: Date,
|
|
47
|
-
selectMonth: number,
|
|
48
|
-
selectYear: number,
|
|
49
|
-
selectHours: number,
|
|
50
|
-
selectMinutes: number,
|
|
51
|
-
selectSeconds: number,
|
|
52
|
-
type: CalendarType,
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export class Calendar extends React.Component<CalendarProps, CalendarState> {
|
|
56
|
-
state: Readonly<CalendarState> = {
|
|
57
|
-
value: this.props.value ?? today,
|
|
58
|
-
selectDate: this.props.value ?? today,
|
|
59
|
-
selectMonth: (this.props.value ?? today).getMonth(),
|
|
60
|
-
selectYear: (this.props.value ?? today).getFullYear(),
|
|
61
|
-
type: CalendarType.DATE,
|
|
62
|
-
selectHours: this.props.value?.getHours() ?? 0,
|
|
63
|
-
selectMinutes: this.props.value?.getMinutes() ?? 0,
|
|
64
|
-
selectSeconds: this.props.value?.getSeconds() ?? 0,
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
showDateInMonth() {
|
|
68
|
-
let firstDayOfMonth = new Date(this.state.selectYear, this.state.selectMonth, 1)
|
|
69
|
-
return <>
|
|
70
|
-
{Array.from({ length: 7 }).map((_, i) => {
|
|
71
|
-
switch (i) {
|
|
72
|
-
case 0:
|
|
73
|
-
var weekdayTitle = 'Su'
|
|
74
|
-
break
|
|
75
|
-
case 1:
|
|
76
|
-
weekdayTitle = 'Mo'
|
|
77
|
-
break
|
|
78
|
-
case 2:
|
|
79
|
-
weekdayTitle = 'Tu'
|
|
80
|
-
break
|
|
81
|
-
case 3:
|
|
82
|
-
weekdayTitle = 'We'
|
|
83
|
-
break
|
|
84
|
-
case 4:
|
|
85
|
-
weekdayTitle = 'Th'
|
|
86
|
-
break
|
|
87
|
-
case 5:
|
|
88
|
-
weekdayTitle = 'Fr'
|
|
89
|
-
break
|
|
90
|
-
case 6:
|
|
91
|
-
weekdayTitle = 'Sa'
|
|
92
|
-
break
|
|
93
|
-
default:
|
|
94
|
-
weekdayTitle = ''
|
|
95
|
-
break
|
|
96
|
-
}
|
|
97
|
-
return <div key={'dtwk-' + i} className='date-picker-circle label-4' style={{ color: '#00204D99' }}>
|
|
98
|
-
{weekdayTitle}
|
|
99
|
-
</div>
|
|
100
|
-
})}
|
|
101
|
-
{Array.from({ length: 42 }).map((_, i) => {
|
|
102
|
-
let dateNumber = (i % 7) + (Math.floor(i / 7) * 7) - firstDayOfMonth.getDay()
|
|
103
|
-
const timeValue = new Date(this.state.selectYear, this.state.selectMonth, dateNumber + 1, this.state.selectHours, this.state.selectMinutes, this.state.selectSeconds)
|
|
104
|
-
let style = {}
|
|
105
|
-
let additionProps = {}
|
|
106
|
-
let selected = false
|
|
107
|
-
if (dateNumber + 1 === today.getDate() && this.state.selectMonth === today.getMonth() && this.state.selectYear === today.getFullYear()) {
|
|
108
|
-
style = { borderColor: 'var(--infor-color)' }
|
|
109
|
-
}
|
|
110
|
-
if (!inRangeTime(timeValue, startDate, endDate)) {
|
|
111
|
-
additionProps = { 'in-range': 'false' }
|
|
112
|
-
} else if (!inRangeTime(timeValue, this.props.min ?? startDate, this.props.min ?? endDate)) {
|
|
113
|
-
style = {
|
|
114
|
-
...style,
|
|
115
|
-
color: 'var(--disabled-font-color)',
|
|
116
|
-
pointerEvents: 'none'
|
|
117
|
-
}
|
|
118
|
-
} else if (this.state.value.valueOf() === timeValue.valueOf()) {
|
|
119
|
-
additionProps = { ...additionProps }
|
|
120
|
-
selected = true
|
|
121
|
-
} else if (timeValue.getMonth() !== this.state.selectMonth) {
|
|
122
|
-
style = { ...style, color: '#9fb0c7' }
|
|
123
|
-
}
|
|
124
|
-
return <button type="button" key={timeValue.toString()} className={`date-picker-circle body-3 ${selected ? 'selected' : ''}`} style={style} {...additionProps}
|
|
125
|
-
onClick={() => {
|
|
126
|
-
this.setState({ ...this.state, value: timeValue })
|
|
127
|
-
if (this.props.onSelect) this.props.onSelect(timeValue)
|
|
128
|
-
}} >
|
|
129
|
-
{timeValue.getDate()}
|
|
130
|
-
</button>
|
|
131
|
-
})}
|
|
132
|
-
</>
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
showMonthInYear() {
|
|
136
|
-
return <>
|
|
137
|
-
{Array.from({ length: 12 }).map((_, i) => {
|
|
138
|
-
let monthTitle: string = ''
|
|
139
|
-
switch (i) {
|
|
140
|
-
case 0:
|
|
141
|
-
monthTitle = 'Jan'
|
|
142
|
-
break
|
|
143
|
-
case 1:
|
|
144
|
-
monthTitle = 'Feb'
|
|
145
|
-
break
|
|
146
|
-
case 2:
|
|
147
|
-
monthTitle = 'Mar'
|
|
148
|
-
break
|
|
149
|
-
case 3:
|
|
150
|
-
monthTitle = 'Apr'
|
|
151
|
-
break
|
|
152
|
-
case 4:
|
|
153
|
-
monthTitle = 'May'
|
|
154
|
-
break
|
|
155
|
-
case 5:
|
|
156
|
-
monthTitle = 'Jun'
|
|
157
|
-
break
|
|
158
|
-
case 6:
|
|
159
|
-
monthTitle = 'Jul'
|
|
160
|
-
break
|
|
161
|
-
case 7:
|
|
162
|
-
monthTitle = 'Aug'
|
|
163
|
-
break
|
|
164
|
-
case 8:
|
|
165
|
-
monthTitle = 'Sep'
|
|
166
|
-
break
|
|
167
|
-
case 9:
|
|
168
|
-
monthTitle = 'Oct'
|
|
169
|
-
break
|
|
170
|
-
case 10:
|
|
171
|
-
monthTitle = 'Nov'
|
|
172
|
-
break
|
|
173
|
-
case 11:
|
|
174
|
-
monthTitle = 'Dec'
|
|
175
|
-
break
|
|
176
|
-
default:
|
|
177
|
-
break
|
|
178
|
-
}
|
|
179
|
-
const timeValue = new Date(this.state.selectYear, i, today.getDate())
|
|
180
|
-
let additionProps = {}
|
|
181
|
-
let style = {}
|
|
182
|
-
let selected = false
|
|
183
|
-
if (this.state.selectYear === today.getFullYear() && today.getMonth() === i) {
|
|
184
|
-
style = { borderColor: 'var(--infor-color)' }
|
|
185
|
-
} if (!inRangeTime(timeValue, startDate, endDate)) {
|
|
186
|
-
additionProps = { 'in-range': 'false' }
|
|
187
|
-
} else if (!inRangeTime(new Date(this.state.selectYear, this.state.selectMonth), this.props.min ?? startDate, this.props.min ?? endDate)) {
|
|
188
|
-
if (this.state.selectYear === this.state.selectDate?.getFullYear() && this.state.selectDate.getMonth() === i) {
|
|
189
|
-
style = {
|
|
190
|
-
color: 'var(--disabled-font-color)',
|
|
191
|
-
pointerEvents: 'none'
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
if (this.state.selectYear === this.state.value.getFullYear() && i === this.state.value.getMonth()) {
|
|
196
|
-
selected = true
|
|
197
|
-
}
|
|
198
|
-
return <button type="button" key={timeValue.toString()} className={`month-picker-circle body-3 row ${selected ? 'selected' : ''}`} style={style} {...additionProps}
|
|
199
|
-
onClick={() => {
|
|
200
|
-
if (this.props.type === CalendarType.MONTH) {
|
|
201
|
-
this.setState({ ...this.state, value: timeValue })
|
|
202
|
-
if (this.props.onSelect) this.props.onSelect(timeValue)
|
|
203
|
-
} else {
|
|
204
|
-
this.setState({ ...this.state, selectMonth: i, type: CalendarType.DATE })
|
|
205
|
-
}
|
|
206
|
-
}}
|
|
207
|
-
>
|
|
208
|
-
{monthTitle}
|
|
209
|
-
</button>
|
|
210
|
-
})}
|
|
211
|
-
</>
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
showYearInRange() {
|
|
215
|
-
return <>
|
|
216
|
-
{Array.from({ length: 12 }).map((_, i) => {
|
|
217
|
-
let firstYearInTable = this.state.selectYear - ((this.state.selectYear - startDate.getFullYear()) % 12)
|
|
218
|
-
let yearNumber = i + firstYearInTable
|
|
219
|
-
let additionProps = {}
|
|
220
|
-
let style = {}
|
|
221
|
-
let selected = false
|
|
222
|
-
if (yearNumber === today.getFullYear()) {
|
|
223
|
-
style = { borderColor: 'var(--infor-color)' }
|
|
224
|
-
} else if (yearNumber < ((this.props.min ?? startDate).getFullYear()) || yearNumber > ((this.props.min ?? endDate).getFullYear())) {
|
|
225
|
-
additionProps = { 'in-range': 'false' }
|
|
226
|
-
}
|
|
227
|
-
if (yearNumber === this.state.value.getFullYear()) {
|
|
228
|
-
selected = true
|
|
229
|
-
}
|
|
230
|
-
return <button type="button" key={yearNumber.toString()} className={`year-picker-circle body-3 row ${selected ? 'selected' : ''}`} style={style} {...additionProps}
|
|
231
|
-
onClick={() => {
|
|
232
|
-
if (this.props.type === CalendarType.YEAR) {
|
|
233
|
-
this.setState({ ...this.state, value: new Date(yearNumber) })
|
|
234
|
-
if (this.props.onSelect) this.props.onSelect(new Date(yearNumber))
|
|
235
|
-
} else {
|
|
236
|
-
this.setState({ ...this.state, type: CalendarType.MONTH, selectYear: yearNumber })
|
|
237
|
-
}
|
|
238
|
-
}}
|
|
239
|
-
>
|
|
240
|
-
{yearNumber}
|
|
241
|
-
</button>
|
|
242
|
-
})}
|
|
243
|
-
</>
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
getTitle() {
|
|
247
|
-
switch (this.state.type) {
|
|
248
|
-
case CalendarType.YEAR:
|
|
249
|
-
let firstYearInTable = this.state.selectYear - ((this.state.selectYear - startDate.getFullYear()) % 12)
|
|
250
|
-
return `${firstYearInTable}-${firstYearInTable + 11}`
|
|
251
|
-
case CalendarType.MONTH:
|
|
252
|
-
return this.state.selectYear
|
|
253
|
-
default:
|
|
254
|
-
switch (this.state.selectMonth) {
|
|
255
|
-
case 0:
|
|
256
|
-
var monthName = 'January'
|
|
257
|
-
break
|
|
258
|
-
case 1:
|
|
259
|
-
monthName = 'February'
|
|
260
|
-
break
|
|
261
|
-
case 2:
|
|
262
|
-
monthName = 'March'
|
|
263
|
-
break
|
|
264
|
-
case 3:
|
|
265
|
-
monthName = 'April'
|
|
266
|
-
break
|
|
267
|
-
case 4:
|
|
268
|
-
monthName = 'May'
|
|
269
|
-
break
|
|
270
|
-
case 5:
|
|
271
|
-
monthName = 'June'
|
|
272
|
-
break
|
|
273
|
-
case 6:
|
|
274
|
-
monthName = 'July'
|
|
275
|
-
break
|
|
276
|
-
case 7:
|
|
277
|
-
monthName = 'August'
|
|
278
|
-
break
|
|
279
|
-
case 8:
|
|
280
|
-
monthName = 'September'
|
|
281
|
-
break
|
|
282
|
-
case 9:
|
|
283
|
-
monthName = 'October'
|
|
284
|
-
break
|
|
285
|
-
case 10:
|
|
286
|
-
monthName = 'November'
|
|
287
|
-
break
|
|
288
|
-
case 11:
|
|
289
|
-
monthName = 'December'
|
|
290
|
-
break
|
|
291
|
-
default:
|
|
292
|
-
monthName = ''
|
|
293
|
-
break
|
|
294
|
-
}
|
|
295
|
-
return `${monthName} ${this.state.selectYear}`
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
render(): React.ReactNode {
|
|
300
|
-
return <div className={`row calendar-container ${this.props.className}`} style={this.props.style}>
|
|
301
|
-
{this.props.showSidebar ? <div className="calendar-sidebar-options col">
|
|
302
|
-
<button type="button" onClick={() => { }} className="label-4 calendar-sidebar-option-buttton">Yesterday</button>
|
|
303
|
-
<button type="button" className="label-4 calendar-sidebar-option-buttton">Last week</button>
|
|
304
|
-
<button type="button" className="label-4 calendar-sidebar-option-buttton">Last month</button>
|
|
305
|
-
<button type="button" className="label-4 calendar-sidebar-option-buttton">Last year</button>
|
|
306
|
-
</div> : null}
|
|
307
|
-
<div className="calendar-body col">
|
|
308
|
-
<div className="row" style={{ alignItems: 'start' }} >
|
|
309
|
-
<div className="picker-date-container col">
|
|
310
|
-
<div className='picker-date-header row'>
|
|
311
|
-
<button type='button'
|
|
312
|
-
onClick={() => {
|
|
313
|
-
switch (this.state.type) {
|
|
314
|
-
case CalendarType.YEAR:
|
|
315
|
-
if (this.state.selectYear - 20 < startDate.getFullYear()) {
|
|
316
|
-
this.setState({ ...this.state, selectYear: startDate.getFullYear() })
|
|
317
|
-
} else {
|
|
318
|
-
this.setState({ ...this.state, selectYear: this.state.selectYear - 20 })
|
|
319
|
-
}
|
|
320
|
-
break
|
|
321
|
-
case CalendarType.MONTH:
|
|
322
|
-
if (this.state.selectYear - 10 < startDate.getFullYear()) {
|
|
323
|
-
this.setState({ ...this.state, selectYear: startDate.getFullYear() })
|
|
324
|
-
} else {
|
|
325
|
-
this.setState({ ...this.state, selectYear: this.state.selectYear - 10 })
|
|
326
|
-
}
|
|
327
|
-
break
|
|
328
|
-
default:
|
|
329
|
-
this.setState({ ...this.state, selectYear: this.state.selectYear - 1 })
|
|
330
|
-
break
|
|
331
|
-
}
|
|
332
|
-
}}
|
|
333
|
-
>
|
|
334
|
-
<FontAwesomeIcon icon={faAngleDoubleLeft} />
|
|
335
|
-
</button>
|
|
336
|
-
<button type='button'
|
|
337
|
-
onClick={() => {
|
|
338
|
-
switch (this.state.type) {
|
|
339
|
-
case CalendarType.YEAR:
|
|
340
|
-
if (this.state.selectYear - 10 < startDate.getFullYear()) {
|
|
341
|
-
this.setState({ ...this.state, selectYear: startDate.getFullYear() })
|
|
342
|
-
} else {
|
|
343
|
-
this.setState({ ...this.state, selectYear: this.state.selectYear - 10 })
|
|
344
|
-
}
|
|
345
|
-
break
|
|
346
|
-
case CalendarType.MONTH:
|
|
347
|
-
if (this.state.selectYear - 1 >= startDate.getFullYear()) {
|
|
348
|
-
this.setState({ ...this.state, selectYear: this.state.selectYear - 1 })
|
|
349
|
-
}
|
|
350
|
-
break
|
|
351
|
-
default:
|
|
352
|
-
const newDataVl = new Date(this.state.selectYear, this.state.selectMonth - 1, 1)
|
|
353
|
-
this.setState({ ...this.state, selectMonth: newDataVl.getMonth(), selectYear: newDataVl.getFullYear() })
|
|
354
|
-
break
|
|
355
|
-
}
|
|
356
|
-
}}
|
|
357
|
-
>
|
|
358
|
-
<FontAwesomeIcon icon={faAngleLeft} />
|
|
359
|
-
</button>
|
|
360
|
-
<span className="heading-7" onClick={() => {
|
|
361
|
-
if (this.state.type !== CalendarType.YEAR)
|
|
362
|
-
this.setState({ ...this.state, type: this.state.type === CalendarType.DATE ? CalendarType.MONTH : CalendarType.YEAR })
|
|
363
|
-
}} >
|
|
364
|
-
{this.getTitle()}
|
|
365
|
-
</span>
|
|
366
|
-
<button type='button'
|
|
367
|
-
onClick={() => {
|
|
368
|
-
switch (this.state.type) {
|
|
369
|
-
case CalendarType.YEAR:
|
|
370
|
-
if (this.state.selectYear + 10 > endDate.getFullYear()) {
|
|
371
|
-
this.setState({ ...this.state, selectYear: endDate.getFullYear() })
|
|
372
|
-
} else {
|
|
373
|
-
this.setState({ ...this.state, selectYear: this.state.selectYear + 10 })
|
|
374
|
-
}
|
|
375
|
-
break
|
|
376
|
-
case CalendarType.MONTH:
|
|
377
|
-
if (this.state.selectYear + 1 <= endDate.getFullYear()) {
|
|
378
|
-
this.setState({ ...this.state, selectYear: this.state.selectYear + 1 })
|
|
379
|
-
}
|
|
380
|
-
break
|
|
381
|
-
default:
|
|
382
|
-
const newDataVl = new Date(this.state.selectYear, this.state.selectMonth + 1, 1)
|
|
383
|
-
this.setState({ ...this.state, selectMonth: newDataVl.getMonth(), selectYear: newDataVl.getFullYear() })
|
|
384
|
-
break
|
|
385
|
-
}
|
|
386
|
-
}}
|
|
387
|
-
>
|
|
388
|
-
<FontAwesomeIcon icon={faAngleRight} />
|
|
389
|
-
</button>
|
|
390
|
-
<button type='button'
|
|
391
|
-
onClick={() => {
|
|
392
|
-
switch (this.state.type) {
|
|
393
|
-
case CalendarType.YEAR:
|
|
394
|
-
if (this.state.selectYear + 20 > endDate.getFullYear()) {
|
|
395
|
-
this.setState({ ...this.state, selectYear: endDate.getFullYear() })
|
|
396
|
-
} else {
|
|
397
|
-
this.setState({ ...this.state, selectYear: this.state.selectYear + 20 })
|
|
398
|
-
}
|
|
399
|
-
break
|
|
400
|
-
case CalendarType.MONTH:
|
|
401
|
-
if (this.state.selectYear + 10 < endDate.getFullYear()) {
|
|
402
|
-
this.setState({ ...this.state, selectYear: endDate.getFullYear() })
|
|
403
|
-
} else {
|
|
404
|
-
this.setState({ ...this.state, selectYear: this.state.selectYear + 10 })
|
|
405
|
-
}
|
|
406
|
-
break
|
|
407
|
-
default:
|
|
408
|
-
this.setState({ ...this.state, selectYear: this.state.selectYear + 1 })
|
|
409
|
-
break
|
|
410
|
-
}
|
|
411
|
-
}}
|
|
412
|
-
>
|
|
413
|
-
<FontAwesomeIcon icon={faAngleDoubleRight} />
|
|
414
|
-
</button>
|
|
415
|
-
</div>
|
|
416
|
-
<div className='picker-date-body row' >
|
|
417
|
-
{this.state.type === CalendarType.YEAR ? this.showYearInRange() : this.state.type === CalendarType.MONTH ? this.showMonthInYear() : this.showDateInMonth()}
|
|
418
|
-
</div>
|
|
419
|
-
</div>
|
|
420
|
-
{this.props.type === CalendarType.DATETIME ? <div className="picker-time-container col">
|
|
421
|
-
<div className="heading-7">{this.state.selectHours < 10 ? `0${this.state.selectHours}` : this.state.selectHours}:{this.state.selectMinutes < 10 ? `0${this.state.selectMinutes}` : this.state.selectMinutes}:{this.state.selectSeconds < 10 ? `0${this.state.selectSeconds}` : this.state.selectSeconds}</div>
|
|
422
|
-
<div className="row" style={{ alignItems: 'start', flex: 1, height: '100%' }}>
|
|
423
|
-
<div className="scroll-picker-hours col">{Array.from({ length: 24 }).map((_, i) => <button type="button" onClick={() => {
|
|
424
|
-
let newValue = this.state.value
|
|
425
|
-
newValue.setHours(i)
|
|
426
|
-
this.setState({ ...this.state, selectHours: i, value: newValue })
|
|
427
|
-
if (this.props.onSelect) this.props.onSelect(newValue)
|
|
428
|
-
}} key={`hours-${i}`} className={`label-4 ${this.state.selectHours === (i) ? 'selected' : ''}`} >{i < 10 ? `0${i}` : i}</button>)}</div>
|
|
429
|
-
<div className="scroll-picker-minutes col">{Array.from({ length: 60 }).map((_, i) => <button type="button" onClick={() => {
|
|
430
|
-
let newValue = this.state.value
|
|
431
|
-
newValue.setMinutes(i)
|
|
432
|
-
this.setState({ ...this.state, selectMinutes: i, value: newValue })
|
|
433
|
-
if (this.props.onSelect) this.props.onSelect(newValue)
|
|
434
|
-
}} key={`hours-${i}`} className={`label-4 ${this.state.selectMinutes === (i) ? 'selected' : ''}`} >{i < 10 ? `0${i}` : i}</button>)}</div>
|
|
435
|
-
<div className="scroll-picker-seconds col">{Array.from({ length: 60 }).map((_, i) => <button type="button" onClick={() => {
|
|
436
|
-
let newValue = this.state.value
|
|
437
|
-
newValue.setSeconds(i)
|
|
438
|
-
this.setState({ ...this.state, selectSeconds: i, value: newValue })
|
|
439
|
-
if (this.props.onSelect) this.props.onSelect(newValue)
|
|
440
|
-
}} key={`hours-${i}`} className={`label-4 ${this.state.selectSeconds === (i) ? 'selected' : ''}`} >{i < 10 ? `0${i}` : i}</button>)}</div>
|
|
441
|
-
</div>
|
|
442
|
-
</div> : null}
|
|
443
|
-
</div>
|
|
444
|
-
{this.props.footer}
|
|
445
|
-
</div>
|
|
446
|
-
</div>
|
|
447
|
-
}
|
|
448
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
.checkbox-container {
|
|
2
|
-
position: relative;
|
|
3
|
-
border-radius: 0.4rem;
|
|
4
|
-
border: 1px solid #00358033;
|
|
5
|
-
background-color: var(--infor-color);
|
|
6
|
-
transition: border, background-color 0.5s;
|
|
7
|
-
cursor: pointer;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.checkbox-container:not(*:has(> input:checked)) {
|
|
11
|
-
background-color: transparent !important;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.checkbox-container>input {
|
|
15
|
-
position: absolute;
|
|
16
|
-
opacity: 0;
|
|
17
|
-
cursor: pointer;
|
|
18
|
-
height: 0;
|
|
19
|
-
width: 0;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.checkbox-container>svg {
|
|
23
|
-
width: 100%;
|
|
24
|
-
height: 100%;
|
|
25
|
-
visibility: hidden;
|
|
26
|
-
opacity: 0 !important;
|
|
27
|
-
transition: visibility, opacity 0.5s;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.checkbox-container>input:checked~svg {
|
|
31
|
-
visibility: visible;
|
|
32
|
-
opacity: 1 !important;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
.checkbox-container:has(> input:checked) {
|
|
36
|
-
border: none !important;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.checkbox-container:has(> input:disabled) {
|
|
40
|
-
background-color: var(--disabled-background) !important;
|
|
41
|
-
border: 1px solid #00358033 !important;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.checkbox-container:has(> input:disabled) > svg > path {
|
|
45
|
-
stroke: #00204D40 !important;
|
|
46
|
-
}
|