Skip to content

Commit

Permalink
Merge branch 'v3'
Browse files Browse the repository at this point in the history
  • Loading branch information
t1m0n committed Jan 12, 2023
2 parents d426c39 + 01b639b commit 3db6b5d
Show file tree
Hide file tree
Showing 12 changed files with 77 additions and 21 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

### v3.3.4
* recreate global container if it was removed from DOM [#516](https://github.com/t1m0n/air-datepicker/issues/516)
* added Greek locale, thanks to [sonole](https://github.com/sonole), in [#515](https://github.com/t1m0n/air-datepicker/pull/515)

### v3.3.3
* fixed time format in timepicker body [#512](https://github.com/t1m0n/air-datepicker/issues/512)

Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ new AirDatepicker('#el' [, options]);

## Recent updates

### v3.3.4
* recreate global container if it was removed from DOM [#516](https://github.com/t1m0n/air-datepicker/issues/516)
* added Greek locale, thanks to [sonole](https://github.com/sonole), in [#515](https://github.com/t1m0n/air-datepicker/pull/515)

### v3.3.3
* fixed time format in timepicker body [#512](https://github.com/t1m0n/air-datepicker/issues/512)

Expand Down
4 changes: 4 additions & 0 deletions dist/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ new AirDatepicker('#el' [, options]);

## Recent updates

### v3.3.4
* recreate global container if it was removed from DOM [#516](https://github.com/t1m0n/air-datepicker/issues/516)
* added Greek locale, thanks to [sonole](https://github.com/sonole), in [#515](https://github.com/t1m0n/air-datepicker/pull/515)

### v3.3.3
* fixed time format in timepicker body [#512](https://github.com/t1m0n/air-datepicker/issues/512)

Expand Down
3 changes: 3 additions & 0 deletions dist/air-datepicker.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,10 @@ export declare type AirDatepickerOptions = {

declare class AirDatepicker<E extends HTMLElement = HTMLInputElement> {
constructor(el: string | E, opts? : Partial<AirDatepickerOptions>)
static defaults: AirDatepickerOptions
static version: string
static defaultGlobalContainerId: string
static buildGlobalContainer: (id?: string) => void;
show: () => void
hide: () => void
next: () => void
Expand Down
2 changes: 1 addition & 1 deletion dist/air-datepicker.js

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions dist/locale/el.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
declare module 'air-datepicker/locale/el' {
import {AirDatepickerLocale} from 'air-datepicker';
const el: AirDatepickerLocale;

export default el;
}
19 changes: 19 additions & 0 deletions dist/locale/el.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
"use strict";

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _default = {
days: ['Κυριακή', 'Δευτέρα', 'Τρίτη', 'Τετάρτη', 'Πέμπτη', 'Παρασκευή', 'Σάββατο'],
daysShort: ['Κυρ', 'Δευ', 'Τρί', 'Τετ', 'Πέμ', 'Παρ', 'Σάβ'],
daysMin: ['Κυ', 'Δε', 'Τρ', 'Τε', 'Πε', 'Πα', 'Σα'],
months: ['Ιανουάριος', 'Φεβρουάριος', 'Μάρτιος', 'Απρίλιος', 'Μάιος', 'Ιούνιος', 'Ιούλιος', 'Αύγουστος', 'Σεπτέμβριος', 'Οκτώβριος', 'Νοέμβριος', 'Δεκέμβριος'],
monthsShort: ['Ιαν', 'Φεβ', 'Μαρ', 'Απρ', 'Μάι', 'Ιούν', 'Ιούλ', 'Αύγ', 'Σεπ', 'Οκτ', 'Νοε', 'Δεκ'],
today: 'Σήμερα',
clear: 'Καθαρισμός',
dateFormat: 'dd/MM/yyyy',
timeFormat: 'hh:mm aa',
firstDay: 1
};
exports.default = _default;
2 changes: 1 addition & 1 deletion dist/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "air-datepicker",
"version": "3.3.3",
"version": "3.3.4",
"scripts": {
"dev": "set NODE_ENV=development&& webpack",
"dev:serve": "npm run browser&& set NODE_ENV=development&& webpack serve",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "air-datepicker",
"version": "3.3.3",
"version": "3.3.4",
"scripts": {
"dev": "set NODE_ENV=development&& webpack",
"dev:serve": "npm run browser&& set NODE_ENV=development&& webpack serve",
Expand Down
3 changes: 3 additions & 0 deletions src/datepicker.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,10 @@ export declare type AirDatepickerOptions = {

declare class AirDatepicker<E extends HTMLElement = HTMLInputElement> {
constructor(el: string | E, opts? : Partial<AirDatepickerOptions>)
static defaults: AirDatepickerOptions
static version: string
static defaultGlobalContainerId: string
static buildGlobalContainer: (id?: string) => void;
show: () => void
hide: () => void
next: () => void
Expand Down
37 changes: 19 additions & 18 deletions src/datepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,24 @@ import consts from './consts';
import './datepickerVars.scss';
import './datepicker.scss';

let $body = '',
$datepickersContainer = '',
let $datepickersContainer = '',
$datepickerOverlay = '',
containerBuilt = false,
baseTemplate = '' +
'<i class="air-datepicker--pointer"></i>' +
'<div class="air-datepicker--navigation"></div>' +
'<div class="air-datepicker--content"></div>';

function buildDatepickersContainer(id) {
containerBuilt = true;

$datepickersContainer = createElement({className: id, id});
$body.appendChild($datepickersContainer);

return $datepickersContainer;
}

export default class Datepicker {
static defaults = defaults
static version = '3.3.3'
static defaultContainerId = 'air-datepicker-global-container'
static version = '3.3.4'
static defaultGlobalContainerId = 'air-datepicker-global-container'
static buildGlobalContainer(id) {
containerBuilt = true;

$datepickersContainer = createElement({className: id, id});
getEl('body').appendChild($datepickersContainer);
}
constructor(el, opts) {
this.$el = getEl(el);

Expand All @@ -57,9 +53,6 @@ export default class Datepicker {
this.$customContainer = this.opts.container ? getEl(this.opts.container) : false;
this.$altField = getEl(this.opts.altField || false);

if (!$body) {
$body = getEl('body');
}

let {view, startDate} = this.opts;

Expand Down Expand Up @@ -104,9 +97,17 @@ export default class Datepicker {
onlyTimepicker
}
} = this;
let $body = getEl('body');

let shouldBuildGlobalContainer =
// Check if global container still exist in DOM
(!containerBuilt || containerBuilt && $datepickersContainer && !$body.contains($datepickersContainer))
&& !inline
&& this.elIsInput
&& !this.$customContainer;

if (!containerBuilt && !inline && this.elIsInput) {
buildDatepickersContainer(Datepicker.defaultContainerId);
if (shouldBuildGlobalContainer) {
Datepicker.buildGlobalContainer(Datepicker.defaultGlobalContainerId);
}

if (isMobile && !$datepickerOverlay && !treatAsInline) {
Expand Down
12 changes: 12 additions & 0 deletions src/locale/el.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export default {
days: ['Κυριακή', 'Δευτέρα', 'Τρίτη', 'Τετάρτη', 'Πέμπτη', 'Παρασκευή', 'Σάββατο'],
daysShort: ['Κυρ', 'Δευ', 'Τρί', 'Τετ', 'Πέμ', 'Παρ', 'Σάβ'],
daysMin: ['Κυ', 'Δε', 'Τρ', 'Τε', 'Πε', 'Πα', 'Σα'],
months: ['Ιανουάριος', 'Φεβρουάριος', 'Μάρτιος', 'Απρίλιος', 'Μάιος', 'Ιούνιος', 'Ιούλιος', 'Αύγουστος', 'Σεπτέμβριος', 'Οκτώβριος', 'Νοέμβριος', 'Δεκέμβριος'],
monthsShort: ['Ιαν', 'Φεβ', 'Μαρ', 'Απρ', 'Μάι', 'Ιούν', 'Ιούλ', 'Αύγ', 'Σεπ', 'Οκτ', 'Νοε', 'Δεκ'],
today: 'Σήμερα',
clear: 'Καθαρισμός',
dateFormat: 'dd/MM/yyyy',
timeFormat: 'hh:mm aa',
firstDay: 1
};

1 comment on commit 3db6b5d

@vercel
Copy link

@vercel vercel bot commented on 3db6b5d Jan 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.