-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
061d8b7
commit 60bf5e9
Showing
61 changed files
with
11,758 additions
and
8,184 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,114 +1,110 @@ | ||
import React from 'react'; | ||
import logo from './logo.svg'; | ||
import './App.css'; | ||
import { NepaliDatePicker } from './nepali_date_picker/index.js' | ||
import moment from 'moment'; | ||
import NepaliCalendarRange from './nepali_date_picker/calendar_range'; | ||
import { getCalendarType, get_ad_bs_listener, AD_BS_RENDERER } from './nepali_date_picker/ad_bs_date_render'; | ||
import { Switch, Space } from 'antd'; | ||
// import 'antd/dist/antd.css'; | ||
import NepaliRangeInputPicker from './nepali_date_picker/range_input_picker'; | ||
import CustomDateRangeToggler from './nepali_date_picker/custom_daterange_toggler'; | ||
import NepaliCalendar from './nepali_date_picker/calendar'; | ||
import React, { useState } from "react"; | ||
import { NepaliDatePicker } from "./nepali_date_picker/index.js"; | ||
import NepaliCalendarRange from "./nepali_date_picker/calendar_range"; | ||
import { | ||
getCalendarType, | ||
get_ad_bs_listener, | ||
} from "./nepali_date_picker/ad_bs_date_render"; | ||
import { Switch, Space } from "antd"; | ||
import NepaliRangeInputPicker from "./nepali_date_picker/range_input_picker"; | ||
import CustomDateRangeToggler from "./nepali_date_picker/custom_daterange_toggler"; | ||
|
||
class App extends React.Component { | ||
constructor(props) { | ||
super(props) | ||
import AdBsDateRenderer from "./lib/NepaliDatePicker/AdBsDateRenderer"; | ||
import NepaliCalendar from "./lib/NepaliDatePicker/Calendar"; | ||
import DatePicker from "./lib/NepaliDatePicker/DatePicker"; | ||
|
||
this.state = { | ||
date: '', | ||
checked: getCalendarType() == "BS" | ||
} | ||
} | ||
render() { | ||
import "./App.css"; | ||
|
||
return ( | ||
<Space direction='vertical' size={40} style={{ | ||
width: '100%', | ||
padding: 80, | ||
backgroundColor:'tomato' | ||
}}> | ||
<Switch checked={this.state.checked} | ||
unCheckedChildren="AD" | ||
checkedChildren="BS" | ||
onChange={(checked) => { | ||
if (checked) { | ||
// to bs | ||
let ad_bs_listener = get_ad_bs_listener(); | ||
ad_bs_listener.ad_bs.publish("BS") | ||
} else { | ||
// to ad | ||
let ad_bs_listener = get_ad_bs_listener(); | ||
ad_bs_listener.ad_bs.publish("AD") | ||
}; | ||
this.setState({ | ||
checked: checked | ||
}) | ||
}}></Switch> | ||
|
||
<NepaliCalendar | ||
initialDate={this.state.selected_date} | ||
showExtra={true} | ||
disableDate={this.props.disableDate} | ||
shouldPressOK={true} | ||
initialDateType="BS" | ||
calendarType={"AD"} | ||
dateFormat="DD-MM-YYYY" | ||
withReference={true} | ||
zeroDayName="Receipt Date" | ||
reference_date={"24-08-2020"} | ||
rangeReference={[0,5,15,20,30,40,50,60,70,80,90]} | ||
onSelect={(ad_date, bs_date) => { | ||
console.log("Ad date", ad_date) | ||
let _ad = moment().date(ad_date.day).month(ad_date.month - 1).year(ad_date.year); | ||
this.setState({ | ||
selected_date: _ad.format("DD-MM-YYYY"), | ||
calendarVisible: false | ||
}) | ||
// typeof this.props.onChange === 'function' && this.props.onChange(_ad.format("DD-MM-YYYY")) | ||
// this.setState({ | ||
// selected_date:`${date.day}-${date.month}-${date.year}` | ||
// }) | ||
// console.log("date is",date) | ||
}} /> | ||
const App = ({ disableDate }) => { | ||
const [date, setDate] = useState(""); | ||
const [checked, setChecked] = useState(getCalendarType() === "BS"); | ||
const [selectedDate, setSelectedDate] = useState(); | ||
|
||
<div>For input, type DATE{"<space>"}Month{"<space>"}Year and press ENTER or TAB to select date. NOTE: DATE,MONTH,YEAR field can be neglected</div> | ||
<NepaliDatePicker | ||
value={this.state.date} | ||
onChange={(val) => { | ||
this.setState({ | ||
date: val | ||
}) | ||
return ( | ||
<Space | ||
direction="vertical" | ||
size={40} | ||
style={{ | ||
width: "100%", | ||
padding: 80, | ||
backgroundColor: "tomato", | ||
}} | ||
> | ||
<Switch | ||
checked={checked} | ||
unCheckedChildren="AD" | ||
checkedChildren="BS" | ||
onChange={(checked) => { | ||
if (checked) { | ||
// to bs | ||
let ad_bs_listener = get_ad_bs_listener(); | ||
ad_bs_listener.ad_bs.publish("BS"); | ||
} else { | ||
// to ad | ||
let ad_bs_listener = get_ad_bs_listener(); | ||
ad_bs_listener.ad_bs.publish("AD"); | ||
} | ||
setChecked(checked); | ||
}} | ||
></Switch> | ||
This is neapli calendar | ||
<NepaliCalendar | ||
initialDate={selectedDate} | ||
showExtra={true} | ||
disableDate={disableDate} | ||
shouldPressOK={true} | ||
initialDateType="BS" | ||
calendarType={"BS"} | ||
dateFormat="yyyy-dd-mm" | ||
showMonthDropdown={true} | ||
showYearDropdown={true} | ||
// withReference={true} | ||
// zeroDayName="Receipt Date" | ||
// reference_date={"24-08-2020"} | ||
// rangeReference={[0, 5, 15, 20, 30, 40, 50, 60, 70, 80, 90]} | ||
onSelect={(formatttedDate, bs_date, date, formattedDate) => { | ||
setSelectedDate(formattedDate); | ||
}} | ||
/> | ||
<div> | ||
For input, type DATE{"<space>"}Month{"<space>"}Year and press ENTER or | ||
TAB to select date. NOTE: DATE,MONTH,YEAR field can be neglected | ||
</div> | ||
<NepaliDatePicker | ||
value={date} | ||
onChange={(val) => { | ||
setDate(val); | ||
}} | ||
/> | ||
new Date Picker | ||
<DatePicker | ||
value={date} | ||
onChange={(val) => { | ||
setDate(val); | ||
}} | ||
/> | ||
<CustomDateRangeToggler /> | ||
<NepaliRangeInputPicker /> | ||
<NepaliCalendarRange /> | ||
<div>RENDERED DATE IN AD/BS</div> | ||
<div> | ||
<Space | ||
size={40} | ||
style={{ | ||
display: "flex", | ||
flexDirection: "row", | ||
flexWrap: "wrap", | ||
}} | ||
// disableDate={(d) => { | ||
// if (d <= moment()) { | ||
// return true | ||
// } | ||
// }} | ||
/> | ||
<CustomDateRangeToggler /> | ||
|
||
<NepaliRangeInputPicker /> | ||
|
||
<NepaliCalendarRange /> | ||
<div>RENDERED DATE IN AD/BS</div> | ||
<div > | ||
<Space size={40} style={{ | ||
display: 'flex', | ||
flexDirection: 'row', | ||
flexWrap: 'wrap' | ||
}}> | ||
{Array(20).fill("").map((it, ind) => { | ||
return <AD_BS_RENDERER adDate={moment().add('day', ind).format("DD-MM-YYYY")} /> | ||
> | ||
{Array(20) | ||
.fill("") | ||
.map((it, ind) => { | ||
return <AdBsDateRenderer adDate={"02-04-2021"} />; //TODO | ||
})} | ||
</Space> | ||
</div> | ||
{/* <NepaliDatePicker /> */} | ||
|
||
|
||
</Space> | ||
); | ||
} | ||
} | ||
</Space> | ||
</div> | ||
</Space> | ||
); | ||
}; | ||
|
||
export default App; |
Oops, something went wrong.