Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: start from future date #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .eslintcache

This file was deleted.

27 changes: 27 additions & 0 deletions css-dist/csstohtml.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const fs = require('fs');

try {
const documentStyles = fs.readFileSync('./style.css');
const document = `
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.4.0/styles/default.min.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.4.0/highlight.min.js"></script>
</head>
<body>
<label>Flex Box</label>
<pre><code class="css">${documentStyles}</code></pre>
<label>Flex Box</label>
</body>
</html>
`;

fs.appendFile('css.html', document, function (err) {
if (err) throw err;
console.log('Saved!');
});
} catch(e) {
console.log('Error:', e.stack);
}
95 changes: 20 additions & 75 deletions src/assets/styles/css/app.css
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
@import '@css/_settings.css';

*{
box-sizing: border-box;
* {
box-sizing: border-box;
}

body {
font-family: 'Open Sans', sans-serif;
color: $black;
margin: 0px;
padding: 0px;
input {
font-family: 'Open Sans', sans-serif;
color: $black;
margin: 0px;
padding: 0px;
input {
outline: none;
&:focus{
&:focus {
outline: none;
}
}
Expand All @@ -22,31 +22,31 @@ body {
font-size: 24px;
}
a {
color: $white;
color: $white;
text-decoration: none;
}
}

.flex-block{
.flex-block {
display: flex;
align-items: center;
margin-top: 20px;
.change-btn{
.change-btn {
margin-left: 20px;
display: flex;
align-items: center;
button{
margin-right: 20px;
button {
margin-right: 20px;
}
}
@media screen and (max-width: 768px) {
flex-flow: row wrap;
.change-btn{
.change-btn {
margin-top: 20px;
margin-left: 0px;
flex-flow: row wrap;
button{
margin-right: 0px;
button {
margin-right: 0px;
}
}
}
Expand Down Expand Up @@ -84,12 +84,12 @@ body {
width: 100%;
left: auto;
}
.code-block{
.code-block {
display: flex;
justify-content: space-around;
@media screen and (max-width: 768px) {
flex-direction: column;
.codesnippet{
.codesnippet {
width: 100%;
}
}
Expand Down Expand Up @@ -146,68 +146,13 @@ body {
width: 100%;
}
}
.md-hidden{
.md-hidden {
@media screen and (min-width: 768px) {
display: none;
}
}
.sm-hidden{
.sm-hidden {
@media screen and (max-width: 768px) {
display: none;
}
}
.hamburger-icon {
position: absolute;
height: 25px;
width: 30px;
display: block;
z-index: 3;
right: 40px;
z-index: 10;
hr {
background-color: $white;
position: absolute;
height: 3px;
border: none;
width: 100%;
border-radius: 10px;
margin: 0px;
top: 11px;
transition: 0.45s;
}
&.active {
hr {
opacity: 0;
}
}
&:after,
&:before {
content: '';
transform-origin: center;
left: 0px;
height: 3px;
border-radius: 10px;
transition: 0.45s;
width: 100%;
background-color: $white;
position: absolute;
}
&:after {
top: 0px;
}
&:before {
bottom: 0px;
}
&.active {
&:before {
transform: rotate(45deg);
top: 11px;
left: 1px;
}
&:after {
transform: rotate(-45deg);
top: 11px;
left: 1px;
}
}
}
12 changes: 12 additions & 0 deletions src/components/datepicker/Datepicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,14 @@ export default defineComponent({
default: 'green',
type: String,
},
startFromFutureDate: {
default: false,
boolean: true,
},
futureDate: {
validator: (val: Date): boolean => validateDateInput(val),
type: Date as new () => Date,
},
},
emits: [
'input',
Expand All @@ -291,6 +299,9 @@ export default defineComponent({
selectedDate.value = initmodelvalue;
} else {
pageTimestamp.value = setDate(new Date(), 1);
if (props.startFromFutureDate && props.futureDate) {
pageTimestamp.value = setDate(new Date(props.futureDate), 1);
}
}
const showDayView = ref(false);
const showMonthView = ref(false);
Expand Down Expand Up @@ -598,6 +609,7 @@ export default defineComponent({
setPageDate();
}
);

watch(
() => props.initialView,
() => {
Expand Down
10 changes: 8 additions & 2 deletions src/components/examples/DefaultValue.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@
<template v-slot:label> Default Value </template>
<template v-slot:content>
<div class="flex-block">
<appdate-picker placeholder="Select Date" @input="dateSelected" :value="defaultValue"> </appdate-picker>
<appdate-picker
placeholder="Select Date"
@input="dateSelected"
:value="defaultValue"
:startFromFutureDate="true"
:futureDate="new Date('2022-03-01')"
></appdate-picker>
<div class="change-btn">
<button @click="changeDefaultValue">Change Default Value</button>
</div>
Expand All @@ -24,7 +30,7 @@ export default defineComponent({
'appdate-picker': Datepicker,
},
setup() {
const defaultValue = ref(new Date());
const defaultValue = ref(new Date('2022-03-16'));
const template = `<template>
<appdate-picker
placeholder="Select Date"
Expand Down