@gothassos/easepick-preset-plugin
TIP
This package does not need to be installed if you are using @gothassos/easepick-bundle.
Adds predefined ranges.
Required:
Quick example
html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>easepick</title>
<script src="https://cdn.jsdelivr.net/npm/@gothassos/easepick-datetime@1.5.0/dist/index.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@gothassos/easepick-core@1.5.0/dist/index.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@gothassos/easepick-base-plugin@1.5.0/dist/index.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@gothassos/easepick-range-plugin@1.5.0/dist/index.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@gothassos/easepick-preset-plugin@1.5.0/dist/index.umd.js"></script>
</head>
<body>
<input id="datepicker"/>
<script>
const picker = new easepick.create({
element: document.getElementById('datepicker'),
css: [
'https://cdn.jsdelivr.net/npm/@gothassos/easepick-core@1.5.0/dist/index.css',
'https://cdn.jsdelivr.net/npm/@gothassos/easepick-range-plugin@1.5.0/dist/index.css',
'https://cdn.jsdelivr.net/npm/@gothassos/easepick-preset-plugin@1.5.0/dist/index.css',
],
plugins: ['RangePlugin', 'PresetPlugin'],
PresetPlugin: {
position: 'left',
},
});
</script>
</body>
</html>Installation
NPM
bash
npm install @gothassos/easepick-core @gothassos/easepick-preset-pluginCDN
html
<script src="https://cdn.jsdelivr.net/npm/@gothassos/easepick-datetime@1.5.0/dist/index.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@gothassos/easepick-core@1.5.0/dist/index.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@gothassos/easepick-base-plugin@1.5.0/dist/index.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@gothassos/easepick-range-plugin@1.5.0/dist/index.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@gothassos/easepick-preset-plugin@1.5.0/dist/index.umd.js"></script>Usage
If you’re using a bundler, e.g. webpack:
ts
import { easepick } from '@gothassos/easepick-core';
import { RangePlugin } from '@gothassos/easepick-range-plugin';
import { PresetPlugin } from '@gothassos/easepick-preset-plugin';
const picker = new easepick.create({
element: document.getElementById('datepicker'),
css: [
'https://cdn.jsdelivr.net/npm/@gothassos/easepick-core@1.5.0/dist/index.css',
'https://cdn.jsdelivr.net/npm/@gothassos/easepick-range-plugin@1.5.0/dist/index.css',
'https://cdn.jsdelivr.net/npm/@gothassos/easepick-preset-plugin@1.5.0/dist/index.css',
],
plugins: [RangePlugin, PresetPlugin],
});Another way to initialize easypick:
js
const picker = new easepick.create({
element: document.getElementById('datepicker'),
css: [
'https://cdn.jsdelivr.net/npm/@gothassos/easepick-core@1.5.0/dist/index.css',
'https://cdn.jsdelivr.net/npm/@gothassos/easepick-range-plugin@1.5.0/dist/index.css',
'https://cdn.jsdelivr.net/npm/@gothassos/easepick-preset-plugin@1.5.0/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. |