Skip to content

Commit

Permalink
Merge 5bd7cd1 into 7056546
Browse files Browse the repository at this point in the history
  • Loading branch information
simllll committed May 5, 2019
2 parents 7056546 + 5bd7cd1 commit 38bc787
Show file tree
Hide file tree
Showing 30 changed files with 281 additions and 6,917 deletions.
22 changes: 10 additions & 12 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
{
"presets": [
[
"env",
"@babel/preset-env",
{
"modules": false
"loose": true
}
],
"stage-2"
]
],
"plugins": [
"transform-runtime",
"transform-strict-mode",
"transform-es2015-modules-commonjs",
"transform-es2015-spread",
"transform-es2015-destructuring",
"transform-es2015-parameters",
"transform-async-to-generator"
"@babel/plugin-transform-runtime",
"@babel/plugin-transform-strict-mode",
"@babel/plugin-transform-async-to-generator",
"@babel/plugin-transform-spread",
"@babel/plugin-transform-destructuring",
"@babel/plugin-transform-parameters"
],
"comments": false,
"env": {
"test": {
"presets": ["env", "stage-2"]
"presets": ["@babel/preset-env"]
}
}
}
10 changes: 5 additions & 5 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

module.exports = {
root: true,
parser: 'babel-eslint',
env: {
browser: true,
node: true
},
parser: 'vue-eslint-parser',
parserOptions: {
sourceType: 'module'
},
// https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style
extends: 'standard',
// required to lint *.vue files
plugins: [
'html'
],
// add your custom rules here
'rules': {
// allow paren-less arrow functions
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ Inline always open version
| open-date | Date\|String | | If set, open on that date |
| minimum-view | String | 'day' | If set, lower-level views won't show |
| maximum-view | String | 'year' | If set, higher-level views won't show |

| parse-typed-date | Function: Date | | Use to parse custom date for typed input |

## Events

Expand Down Expand Up @@ -276,6 +276,10 @@ to show some custom text:
</datepicker>
```

#### beforeDateInput

To implement some custom styling on DateINput, you might need to add elemnt beore the DateInput. Similar to afterDateInput, just it is before in the html DOM.

#### afterDateInput

To implement some custom styling (for instance to add an animated placeholder) on DateInput, you might need to add elements as DateInput siblings. Slot named
Expand Down
24 changes: 24 additions & 0 deletions example/Demo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,22 @@
</code>
</div>

<div class="example">
<h3>Typeable datepicker with custom formatter (DD.MM.YYYY)</h3>
<datepicker placeholder="Type or select date" :typeable="true" format="dd.MM.yyyy" :parse-typed-date="parseTypedDate" />
<code>
&lt;datepicker placeholder="Type or select date" :typeable="true"&gt;&lt;/datepicker&gt;
</code>
</div>

<div class="example">
<h3>datepicker opens on focus</h3>
<datepicker placeholder="Type or select date" :typeable="true" :show-calendar-on-focus="true"/>
<code>
&lt;datepicker placeholder="Type or select date" :show-calendar-on-focus="true"&gt;&lt;/datepicker&gt;
</code>
</div>

<div class="example">
<h3>Bootstrap styled datepicker</h3>
<datepicker
Expand Down Expand Up @@ -252,6 +268,7 @@
<script>
import Datepicker from '../src/components/Datepicker.vue'
import * as lang from '../src/locale/index.js'
import moment from 'moment'
const state = {
date1: new Date()
Expand Down Expand Up @@ -357,6 +374,13 @@ export default {
}
}
this.disabledDates.from = val
},
parseTypedDate (input) {
console.log('input', input)
let momentDate = moment(input, 'DD.MM.YYYY')
console.log('momentDate.toDate()', momentDate.toDate())
return momentDate.toDate()
}
}
}
Expand Down
103 changes: 51 additions & 52 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
{
"name": "vuejs-datepicker",
"version": "1.5.4",
"description": "A simple Vue.js datepicker component. Supports disabling of dates, inline mode, translations",
"name": "@hokify/vuejs-datepicker",
"version": "1.6.3",
"publishConfig": {
"access": "public"
},
"description": "A simple Vue.js datepicker component. Supports disabling of dates, inline mode, translations. Fork of initial vuejs-datepicker which is abandoned.",
"keywords": [
"vue",
"datepicker",
"date-picker",
"calendar"
],
"main": "dist/vuejs-datepicker.js",
"main": "dist/vuejs-datepicker.common.js",
"module": "dist/vuejs-datepicker.esm.js",
"unpkg": "dist/vuejs-datepicker.min.js",
"style": "dist/vuejs-datepicker.css",
"files": [
"src",
"dist"
Expand All @@ -26,68 +30,63 @@
"private": false,
"license": "MIT",
"scripts": {
"build": "yarn lint && rm -rf dist/* && babel-node scripts/build.js && babel-node scripts/build-locale.js",
"build": "npm run lint && rm -rf dist/* && babel-node scripts/build.js && babel-node scripts/build-locale.js",
"serve": "rollup -c scripts/serve.js --watch",
"test": "jest --config test/unit/jest.conf.js --coverage",
"lint": "eslint --ext .js,.vue src test/unit/specs",
"prepublishOnly": "yarn build"
"prepublishOnly": "npm run build"
},
"pre-commit": [
"lint",
"test"
],
"dependencies": {},
"peerDependencies": {
"vue": "^2.3.0"
"vue": "^2.6.10"
},
"devDependencies": {
"@babel/cli": "^7.4.4",
"@babel/core": "^7.4.4",
"@babel/node": "^7.2.2",
"@babel/plugin-transform-async-to-generator": "^7.4.4",
"@babel/plugin-transform-destructuring": "^7.4.4",
"@babel/plugin-transform-parameters": "^7.4.4",
"@babel/plugin-transform-runtime": "^7.4.4",
"@babel/plugin-transform-spread": "^7.2.2",
"@babel/plugin-transform-strict-mode": "^7.2.0",
"@babel/preset-env": "^7.4.4",
"@babel/runtime": "^7.4.4",
"@vue/test-utils": "^1.0.0-beta.12",
"autoprefixer": "^8.3.0",
"babel-cli": "^6.26.0",
"babel-core": "^6.22.1",
"babel-eslint": "^7.1.1",
"babel-jest": "^22.4.3",
"babel-plugin-external-helpers": "^6.22.0",
"babel-plugin-transform-async-to-generator": "^6.24.1",
"babel-plugin-transform-runtime": "^6.22.0",
"babel-preset-env": "^1.3.2",
"babel-preset-stage-2": "^6.22.0",
"babel-register": "^6.22.0",
"babel-runtime": "^6.0.0",
"chalk": "^1.1.3",
"connect-history-api-fallback": "^1.3.0",
"coveralls": "^2.13.1",
"eslint": "^3.19.0",
"eslint-config-standard": "^6.2.1",
"eslint-friendly-formatter": "^2.0.7",
"eslint-plugin-html": "^2.0.0",
"eslint-plugin-promise": "^3.4.0",
"eslint-plugin-standard": "^2.0.1",
"eventsource-polyfill": "^0.9.6",
"jest": "^22.4.3",
"jest-serializer-vue": "^1.0.0",
"lolex": "^1.5.2",
"opn": "^4.0.2",
"ora": "^1.2.0",
"parse5": "^2.1.0",
"autoprefixer": "^9.5.1",
"babel-jest": "^24.7.1",
"chalk": "^2.4.2",
"coveralls": "^3.0.3",
"eslint": "^5.16.0",
"eslint-config-standard": "^12.0.0",
"eslint-friendly-formatter": "^4.0.1",
"eslint-plugin-import": "^2.17.2",
"eslint-plugin-node": "^9.0.1",
"eslint-plugin-promise": "^4.1.1",
"eslint-plugin-standard": "^4.0.0",
"jest": "^24.7.1",
"lolex": "^4.0.1",
"moment": "^2.24.0",
"pre-commit": "^1.2.2",
"rimraf": "^2.6.0",
"rollup": "^0.57.1",
"rollup-plugin-buble": "^0.19.2",
"rollup-plugin-commonjs": "^9.1.0",
"rollup-plugin-livereload": "^0.6.0",
"rollup-plugin-node-resolve": "^3.3.0",
"rollup-plugin-postcss": "^1.6.1",
"rollup-plugin-replace": "^2.0.0",
"rollup-plugin-serve": "^0.4.2",
"rollup-plugin-uglify": "^3.0.0",
"rollup-plugin-vue": "^2.3.0",
"semver": "^5.3.0",
"shelljs": "^0.7.6",
"stylus": "^0.54.5",
"rollup": "^1.11.2",
"rollup-plugin-buble": "^0.19.6",
"rollup-plugin-commonjs": "^9.3.4",
"rollup-plugin-css-only": "^1.0.0",
"rollup-plugin-livereload": "^1.0.0",
"rollup-plugin-node-resolve": "^4.2.3",
"rollup-plugin-postcss": "^2.0.3",
"rollup-plugin-replace": "^2.2.0",
"rollup-plugin-serve": "^1.0.1",
"rollup-plugin-uglify": "^6.0.2",
"rollup-plugin-vue": "^5.0.0",
"semver": "^6.0.0",
"vue": "^2.5.16",
"vue-jest": "^2.2.1",
"vue-server-renderer": "^2.5.16",
"vue-template-compiler": "^2.5.16"
"vue-eslint-parser": "^6.0.4",
"vue-jest": "^4.0.0-beta.2",
"vue-template-compiler": "^2.6.10"
}
}
8 changes: 4 additions & 4 deletions scripts/build-locale.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fs from 'fs'
import path from 'path'
import {rollup} from 'rollup'
import uglify from 'rollup-plugin-uglify'
import { rollup } from 'rollup'
import { uglify } from 'rollup-plugin-uglify'
import chalk from 'chalk'
import buble from 'rollup-plugin-buble'

Expand All @@ -19,7 +19,7 @@ async function build () {
const bundle = await rollup(inputOptions)
const outputOptions = {
file: path.join(__dirname, '..', 'dist', 'locale', 'translations', file),
format: 'es'
format: 'cjs'
}
await bundle.write(outputOptions)
})
Expand All @@ -37,7 +37,7 @@ async function buildAll () {
})
await bundle.write({
file: path.join(__dirname, '..', 'dist', 'locale', 'index.js'),
format: 'es'
format: 'cjs'
})
await console.log(chalk.green('All translations built.'))
}
Expand Down
27 changes: 23 additions & 4 deletions scripts/build.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import path from 'path'
import uglify from 'rollup-plugin-uglify'
import { uglify } from 'rollup-plugin-uglify'
import vue from 'rollup-plugin-vue'
import buble from 'rollup-plugin-buble'

import postcss from 'rollup-plugin-postcss'
import autoprefixer from 'autoprefixer'
import {rollup} from 'rollup'
import { rollup } from 'rollup'
import chalk from 'chalk'
import common from 'rollup-plugin-commonjs'
import replace from 'rollup-plugin-replace'
import node from 'rollup-plugin-node-resolve'
import css from 'rollup-plugin-css-only'

const version = require('../package.json').version
const banner =
Expand Down Expand Up @@ -42,14 +47,26 @@ async function build () {
const inputOptions = {
input: path.join(__dirname, '..', 'src', 'components', 'Datepicker.vue'),
plugins: [
node({
extensions: ['.js', '.jsx', '.vue']
}),
common(),
css(),
vue({
css: true
css: false,
compileTemplate: true,
template: {
isProduction: true
}
}),
postcss({
plugins: [
autoprefixer()
]
}),
replace({
'process.env.NODE_ENV': JSON.stringify('production')
}),
buble({
objectAssign: 'Object.assign'
})
Expand All @@ -60,7 +77,9 @@ async function build () {
file: path.join(__dirname, '..', 'dist', config.output),
format: config.format,
banner: banner,
name: 'vuejsDatepicker'
name: 'vuejsDatepicker',
exports: 'named',
sourcemap: false
}
await bundle.write(outputOptions)
})
Expand Down
10 changes: 4 additions & 6 deletions scripts/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,19 @@ export default {
sourcemap: true
},
plugins: [
common(),
vue({
css: true
}),
replace({
'process.env.NODE_ENV': JSON.stringify('development')
}),
resolve({
module: true,
jsnext: true,
browser: true
mainFields: ['module', 'jsnext', 'browser']
}),
common(),
buble({
/*buble({
objectAssign: 'Object.assign'
}),
}),*/
serve({
contentBase: path.join(__dirname, '..', 'example'),
host: 'localhost',
Expand Down

0 comments on commit 38bc787

Please sign in to comment.