From b138837d2a827b0ac854cd78052acd704e2dfa0b Mon Sep 17 00:00:00 2001
From: ken
Date: Sat, 20 Mar 2021 03:46:04 +0700
Subject: [PATCH] added i18n, fix issues placement and locale mode changed
---
CHANGELOG.md | 10 +-
README.md | 8 +
dev/serve.vue | 16 +-
package-lock.json | 4 +-
package.json | 2 +-
src/components/Calendar.vue | 67 +++---
src/components/Shortcut.vue | 36 +++-
src/lib/fn.js | 7 +
src/litepie-datepicker.vue | 392 +++++++++++++++++++++++-------------
src/locale/en.js | 13 ++
src/locale/id.js | 13 ++
11 files changed, 375 insertions(+), 193 deletions(-)
create mode 100644 src/locale/en.js
create mode 100644 src/locale/id.js
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 36a8dad..15626a8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -38,7 +38,14 @@ All notable changes to this project will be documented in this file.
## [1.0.7]
-- Fix some style
+- Fix some style.
+
+## [1.0.8]
+
+- Add localization for `shortcuts`, `footer` & `dayjs` locale.
+- New props `i18n`, [Example](https://litepie.com/#i18n).
+- Change local model `value` to `pickerValue`.
+- Fix issues placement arrow, `left` to `right`.
[Released]: https://github.com/kenhyuwa/litepie-datepicker/
[1.0.0]: https://github.com/kenhyuwa/litepie-datepicker/releases/tag/v1.0.0
@@ -49,3 +56,4 @@ All notable changes to this project will be documented in this file.
[1.0.5]: https://github.com/kenhyuwa/litepie-datepicker/releases/tag/v1.0.5
[1.0.6]: https://github.com/kenhyuwa/litepie-datepicker/releases/tag/v1.0.6
[1.0.7]: https://github.com/kenhyuwa/litepie-datepicker/releases/tag/v1.0.7
+[1.0.8]: https://github.com/kenhyuwa/litepie-datepicker/releases/tag/v1.0.8
diff --git a/README.md b/README.md
index 09a0a98..3735a83 100644
--- a/README.md
+++ b/README.md
@@ -64,6 +64,14 @@ export default {
+## Road map todo
+
+Add shortcuts and footer localization match with `dayjs` locale.
+
+- [x] English [en]
+- [x] Indonesia [id]
+- [ ] _other_
+
## Changelog
All notable changes to this project will be documented in this file, [Read](CHANGELOG.md).
diff --git a/dev/serve.vue b/dev/serve.vue
index face785..213dafe 100644
--- a/dev/serve.vue
+++ b/dev/serve.vue
@@ -5,13 +5,13 @@
>
{
- dateValue.value = {
- startDate: '20 Mar 2021',
- endDate: '20 Aug 2021'
- };
+ // dateValue.value = {
+ // startDate: '20 Mar 2021',
+ // endDate: '20 Aug 2021'
+ // };
// dateValue.value = [new Date(2019, 9, 8), new Date(2019, 9, 19)];
// dateValue.value = `${new Date(2019, 9, 8).toString()} ~ ${new Date(
// 2019,
@@ -120,8 +120,8 @@ export default defineComponent({
shortcuts,
away,
formatter: ref({
- date: 'DD MMM YYYY',
- month: 'MMM'
+ date: 'DD MMMM YYYY',
+ month: 'MMMM'
})
};
}
diff --git a/package-lock.json b/package-lock.json
index 822ddba..f4dc427 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,11 +1,11 @@
{
"name": "litepie-datepicker",
- "version": "1.0.7",
+ "version": "1.0.8",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
- "version": "1.0.7",
+ "version": "1.0.8",
"license": "MIT",
"devDependencies": {
"@babel/core": "^7.12.10",
diff --git a/package.json b/package.json
index c115322..f553162 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "litepie-datepicker",
- "version": "1.0.7",
+ "version": "1.0.8",
"description": "A date range picker component for Vue.js and Tailwind CSS, dependent to day.js",
"main": "dist/litepie-datepicker.ssr.js",
"browser": "dist/litepie-datepicker.esm.js",
diff --git a/src/components/Calendar.vue b/src/components/Calendar.vue
index 26bf1c6..06bb6f3 100644
--- a/src/components/Calendar.vue
+++ b/src/components/Calendar.vue
@@ -8,40 +8,41 @@
leave-from-class="opacity-100"
leave-to-class="opacity-0"
>
-
diff --git a/src/components/Shortcut.vue b/src/components/Shortcut.vue
index 72c35ed..b358460 100644
--- a/src/components/Shortcut.vue
+++ b/src/components/Shortcut.vue
@@ -27,7 +27,7 @@
class="block text-sm lg:text-xs px-2 py-2 sm:leading-4 whitespace-nowrap font-medium rounded text-litepie-primary-600 hover:text-litepie-primary-700 transition-colors hover:bg-litepie-secondary-100 focus:bg-litepie-secondary-100 focus:text-litepie-primary-600 dark:hover:bg-litepie-secondary-700 dark:hover:text-litepie-primary-300 dark:text-litepie-primary-400 dark:focus:bg-litepie-secondary-700 dark:focus:text-litepie-primary-300"
@click.prevent="setToToday"
>
- Today
+ {{ jsonLocale && jsonLocale.today }}
@@ -36,7 +36,7 @@
class="block text-sm lg:text-xs px-2 py-2 sm:leading-4 whitespace-nowrap font-medium rounded text-litepie-primary-600 hover:text-litepie-primary-700 transition-colors hover:bg-litepie-secondary-100 focus:bg-litepie-secondary-100 focus:text-litepie-primary-600 dark:hover:bg-litepie-secondary-700 dark:hover:text-litepie-primary-300 dark:text-litepie-primary-400 dark:focus:bg-litepie-secondary-700 dark:focus:text-litepie-primary-300"
@click.prevent="setToYesterday"
>
- Yesterday
+ {{ jsonLocale && jsonLocale.yesterday }}
@@ -45,7 +45,7 @@
class="block text-sm lg:text-xs px-2 py-2 sm:leading-4 whitespace-nowrap font-medium rounded text-litepie-primary-600 hover:text-litepie-primary-700 transition-colors hover:bg-litepie-secondary-100 focus:bg-litepie-secondary-100 focus:text-litepie-primary-600 dark:hover:bg-litepie-secondary-700 dark:hover:text-litepie-primary-300 dark:text-litepie-primary-400 dark:focus:bg-litepie-secondary-700 dark:focus:text-litepie-primary-300"
@click.prevent="setToLastDay(7)"
>
- Last 7 Days
+ {{ jsonLocale && jsonLocale.past(7) }}
@@ -54,7 +54,7 @@
class="block text-sm lg:text-xs px-2 py-2 sm:leading-4 whitespace-nowrap font-medium rounded text-litepie-primary-600 hover:text-litepie-primary-700 transition-colors hover:bg-litepie-secondary-100 focus:bg-litepie-secondary-100 focus:text-litepie-primary-600 dark:hover:bg-litepie-secondary-700 dark:hover:text-litepie-primary-300 dark:text-litepie-primary-400 dark:focus:bg-litepie-secondary-700 dark:focus:text-litepie-primary-300"
@click.prevent="setToLastDay(30)"
>
- Last 30 Days
+ {{ jsonLocale && jsonLocale.past(30) }}
@@ -63,7 +63,7 @@
class="block text-sm lg:text-xs px-2 py-2 sm:leading-4 whitespace-nowrap font-medium rounded text-litepie-primary-600 hover:text-litepie-primary-700 transition-colors hover:bg-litepie-secondary-100 focus:bg-litepie-secondary-100 focus:text-litepie-primary-600 dark:hover:bg-litepie-secondary-700 dark:hover:text-litepie-primary-300 dark:text-litepie-primary-400 dark:focus:bg-litepie-secondary-700 dark:focus:text-litepie-primary-300"
@click.prevent="setToThisMonth"
>
- This Month
+ {{ jsonLocale && jsonLocale.currentMonth }}
@@ -72,7 +72,7 @@
class="block text-sm lg:text-xs px-2 py-2 sm:leading-4 whitespace-nowrap font-medium rounded text-litepie-primary-600 hover:text-litepie-primary-700 transition-colors hover:bg-litepie-secondary-100 focus:bg-litepie-secondary-100 focus:text-litepie-primary-600 dark:hover:bg-litepie-secondary-700 dark:hover:text-litepie-primary-300 dark:text-litepie-primary-400 dark:focus:bg-litepie-secondary-700 dark:focus:text-litepie-primary-300"
@click.prevent="setToLastMonth"
>
- Last Month
+ {{ jsonLocale && jsonLocale.pastMonth }}
@@ -80,17 +80,19 @@