# @easepick/preset-plugin
TIP
This package does not need to be installed if you are using @easepick/bundle.
Adds predefined ranges.
# Required:
# Quick example
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>easepick</title>
<script src="https://cdn.jsdelivr.net/npm/@easepick/datetime@[version.number]/dist/index.umd.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@easepick/core@[version.number]/dist/index.umd.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@easepick/base-plugin@[version.number]/dist/index.umd.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@easepick/range-plugin@[version.number]/dist/index.umd.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@easepick/preset-plugin@[version.number]/dist/index.umd.min.js"></script>
</head>
<body>
<input id="datepicker"/>
<script>
const picker = new easepick.create({
element: document.getElementById('datepicker'),
css: [
'https://cdn.jsdelivr.net/npm/@easepick/core@[version.number]/dist/index.css',
'https://cdn.jsdelivr.net/npm/@easepick/range-plugin@[version.number]/dist/index.css',
'https://cdn.jsdelivr.net/npm/@easepick/preset-plugin@[version.number]/dist/index.css',
],
plugins: ['RangePlugin', 'PresetPlugin'],
PresetPlugin: {
position: 'left',
},
});
</script>
</body>
</html>
# Installation
# NPM
npm install @easepick/core @easepick/preset-plugin
# CDN
<script src="https://cdn.jsdelivr.net/npm/@easepick/datetime@[version.number]/dist/index.umd.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@easepick/core@[version.number]/dist/index.umd.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@easepick/base-plugin@[version.number]/dist/index.umd.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@easepick/range-plugin@[version.number]/dist/index.umd.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@easepick/preset-plugin@[version.number]/dist/index.umd.min.js"></script>
# Usage
If you’re using a bundler, e.g. webpack (opens new window):
import { easepick } from '@easepick/core';
import { RangePlugin } from '@easepick/range-plugin';
import { PresetPlugin } from '@easepick/preset-plugin';
const picker = new easepick.create({
element: document.getElementById('datepicker'),
css: [
'https://cdn.jsdelivr.net/npm/@easepick/core@[version.number]/dist/index.css',
'https://cdn.jsdelivr.net/npm/@easepick/range-plugin@[version.number]/dist/index.css',
'https://cdn.jsdelivr.net/npm/@easepick/preset-plugin@[version.number]/dist/index.css',
],
plugins: [RangePlugin, PresetPlugin],
});
Another way to initialize easypick
:
const picker = new easepick.create({
element: document.getElementById('datepicker'),
css: [
'https://cdn.jsdelivr.net/npm/@easepick/core@[version.number]/dist/index.css',
'https://cdn.jsdelivr.net/npm/@easepick/range-plugin@[version.number]/dist/index.css',
'https://cdn.jsdelivr.net/npm/@easepick/preset-plugin@[version.number]/dist/index.css',
],
plugins: ['RangePlugin', 'PresetPlugin'],
});
# Options
Name | Type | Default | Description |
---|---|---|---|
customPreset | object | null | Define your own ranges. |
customLabels | ['Today', 'Yesterday', 'Last 7 Days', 'Last 30 Days', 'This Month', 'Last Month'] | null | Define your own labels. |
position | string | 'left' | Position of preset block. |