Skip to content

Commit

Permalink
Development (#2520)
Browse files Browse the repository at this point in the history
* sonarqube issues

* plugins and locales!

* sonarqube issues

* plugins and locales!

* trying out some plugin stuff

* tiny di works

* clean packagelock

* fixed docs, plugin examples, add other locales

* update build

* doc updates. moved cheese

* types

* I spel real good

* Fixed month manipulation issue #2474

* fixed start/end of week #2473

* If view option is passed do not override with default.

* dark mode and minification!

* input event trigger

* fix for disposing inline calender gives an exception


#2493

* fix reshow should not call dates.setValue with the current

fixes: #2488

when a reshow is done, especially with inline calender
the useCurrent or useDefault should not be used if there is already
someting in the dates.
If there is already a date set, but then you update some options it
should stick to that date, not reset to the current or default..

* #fixes 2424

* bit of code clean up
added view mode information to events

* code cleanup

* update paint

* sonar

* sonar

* sonar

* sonar

* sonar

* sonar

Co-authored-by: jorge <[email protected]>
Co-authored-by: Johan Compagner <[email protected]>
  • Loading branch information
3 people authored Mar 22, 2022
1 parent 89f69f8 commit 3ab219d
Show file tree
Hide file tree
Showing 120 changed files with 8,608 additions and 17,725 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ site
*.sln
*.nupkg
src/docs/partials/examples/test.html
docs/
/docs/
/dist/plugins/examples/
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

[![Rate on Openbase](https://badges.openbase.com/js/rating/@eonasdan/tempus-dominus.svg)](https://openbase.com/js/@eonasdan/tempus-dominus?utm_source=embedded&utm_medium=badge&utm_campaign=rate-badge)

# Tempus Dominus Date/Time Picker v6.0.0-beta2
# Tempus Dominus Date/Time Picker v6.0.0-beta4

Tempus Dominus is a powerful and robust date time picker for javascript. Version 6 is another major rewrite over the previous version. V6 is written with modern browsers in mind and is written in typescript. Bootstrap, momentjs and jQuery are no longer required dependencies. Popper2 is all that is required for the picker to position correctly. If you still require jQuery (seriously, you should move off that asap) there's a jQuery provider that wraps the native js functions.

# Alpha State
The alpha version is working in my tests. There's still plenty of things that can be worked on and you can see the [rough roadmap here](https://github.com/Eonasdan/tempus-dominus/projects).
# Ready State
The beta is here. There's still plenty of things that can be worked on and you can see the [rough roadmap here](https://github.com/Eonasdan/tempus-dominus/projects).

# Community

Expand Down
2 changes: 1 addition & 1 deletion build/banner.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const year = new Date().getFullYear()
function getBanner() {
return `/*!
* Tempus Dominus v${pkg.version} (${pkg.homepage})
* Copyright 2013-${year} ${pkg.author}
* Copyright 2013-${year} ${pkg.author.name}
* Licensed under MIT (https://github.com/Eonasdan/tempus-dominus/blob/master/LICENSE)
*/`
}
Expand Down
5 changes: 1 addition & 4 deletions build/browser-sync-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@ module.exports = {
ignoreInitial: true,
},
server: "docs",
https: {
key: 'C:\\projects\\https\\localhost.key',
cert: 'C:\\projects\\https\\localhost.crt',
},
https: false,
proxy: false,
port: 3001,
middleware: false,
Expand Down
2 changes: 1 addition & 1 deletion build/change-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const DRY_RUN = process.argv.includes('--dry') || process.argv.includes('--dry-r

// These are the filetypes we only care about replacing the version
const GLOB = [
'**/*.{css,html,js,json,md,scss,txt,yml}'
'**/*.{css,html,js,json,md,scss,txt,yml,ts}'
]
const GLOBBY_OPTIONS = {
cwd: path.join(__dirname, '..'),
Expand Down
81 changes: 81 additions & 0 deletions build/plugins.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
const rollup = require('rollup')
const genericRollup = require('./rollup-plugin.config')
const fs = require('fs')
const util = require('util')
const path = require('path')

const { promisify } = util

const promisifyReadDir = promisify(fs.readdir)
const promisifyReadFile = promisify(fs.readFile)
const promisifyWriteFile = promisify(fs.writeFile)

const localeNameRegex = /\/\/ (.*) \[/
const formatName = n => n.replace(/\.ts/, '').replace(/-/g, '_')

const localePath = path.join(__dirname, '../src/locales')

async function build(option) {
const bundle = await rollup.rollup(option.input)
await bundle.write(option.output)
}

async function listLocaleJson(localeArr) {
const localeListArr = []
await Promise.all(localeArr.map(async (l) => {
const localeData = await promisifyReadFile(path.join(localePath, l), 'utf-8')
localeListArr.push({
key: l.slice(0, -3),
name: localeData.match(localeNameRegex)[1]
})
}))
promisifyWriteFile(path.join(__dirname, '../locales.json'), JSON.stringify(localeListArr), 'utf8')
}

(async () => {
try {
/* eslint-disable no-restricted-syntax, no-await-in-loop */
// We use await-in-loop to make rollup run sequentially to save on RAM
const locales = await promisifyReadDir(localePath)
for (const l of locales) {
// run builds sequentially to limit RAM usage
await build(genericRollup({
input: `./src/locales/${l}`,
fileName: `./dist/locales/${l.replace('.ts', '.js')}`,
name: `tempusDominus.locales.${formatName(l)}`
}))
}

const plugins = await promisifyReadDir(path.join(__dirname, '../src/plugins'))
for (const plugin of plugins.filter(x => x !== 'examples')) {
// run builds sequentially to limit RAM usage
await build(genericRollup({
input: `./src/plugins/${plugin}/index.ts`,
fileName: `./dist/plugins/${plugin}.js`,
name: `tempusDominus.plugins.${formatName(plugin)}`
}))
}

const examplePlugins = await promisifyReadDir(path.join(__dirname, '../src/plugins/examples'))
for (const plugin of examplePlugins.map(x => x.replace('.ts', ''))) {
// run builds sequentially to limit RAM usage
await build(genericRollup({
input: `./src/plugins/examples/${plugin}.ts`,
fileName: `./dist/plugins/examples/${plugin}.js`,
name: `tempusDominus.plugins.${formatName(plugin)}`
}))
}

/* build(configFactory({
input: './src/index.js',
fileName: './tempusDominus.min.js'
}))*/

//await promisify(ncp)('./types/', './')

// list locales
// await listLocaleJson(locales)
} catch (e) {
console.error(e) // eslint-disable-line no-console
}
})()
35 changes: 35 additions & 0 deletions build/rollup-plugin.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
const typescript = require('rollup-plugin-typescript2'); //todo investigate why the other one doesn't work
//const typescript = require('@rollup/plugin-typescript');
//import { terser } from "rollup-plugin-terser";

const banner = require('./banner.js');
const globals = {
'@popperjs/core': 'Popper',
tempusDominus: 'tempusDominus'
};

module.exports = (config) => {
const { input, fileName, name } = config
return {
input: {
input,
external: [
'tempusDominus'
],
plugins: [
typescript({
declaration: true,
declarationDir: 'types'
})
]
},
output: {
banner,
file: fileName,
format: 'umd',
name: name || 'tempusDominus',
globals,
compact: true
}
}
}
45 changes: 37 additions & 8 deletions build/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import typescript from '@rollup/plugin-typescript';
//const typescript = require('rollup-plugin-typescript2'); //this doesn't produce map files correctly ...sigh
const typescript = require('@rollup/plugin-typescript');
import postcss from 'rollup-plugin-postcss';
import { terser } from "rollup-plugin-terser";

const pkg = require('../package.json');
const banner = require('./banner.js');
Expand Down Expand Up @@ -27,6 +29,22 @@ export default [
name: 'tempusDominus',
sourcemap: true,
globals
},
{
banner,
file: `${pkg.main.replace('.js','')}.min.js`,
format: 'umd',
name: 'tempusDominus',
globals,
plugins: [terser()]
},
{
banner,
file: `${pkg.module.replace('.js','')}.min.js`,
format: 'es',
name: 'tempusDominus',
globals,
plugins: [terser()]
}
],
external: ['@popperjs/core'],
Expand All @@ -37,6 +55,15 @@ export default [
})
]
},
{
input: 'dist/js/jQuery-provider.js',
output: [
{
file: 'dist/js/jQuery-provider.min.js',
}
],
plugins: [terser()]
},
{
input: 'src/sass/tempus-dominus.scss',
output: [
Expand All @@ -51,18 +78,20 @@ export default [
extract: true
})
]
}
/*{
},
{
input: 'src/sass/tempus-dominus.scss',
output: {
banner,
file: 'dist/css/tempus-dominus.min.css'
},
output: [
{
banner,
file: 'dist/css/tempus-dominus.min.css'
}
],
plugins: [
postcss({
extract: true,
minimize: true
})
]
}*/
}
];
74 changes: 65 additions & 9 deletions dist/css/tempus-dominus.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/css/tempus-dominus.css.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/css/tempus-dominus.min.css

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions dist/js/jQuery-provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*global $ */

/*!
* Tempus Dominus v6.0.0-beta2 (https://getdatepicker.com/)
* Tempus Dominus v6.0.0-beta4 (https://getdatepicker.com/)
* Copyright 2013-2021 [object Object]
* Licensed under MIT (https://github.com/Eonasdan/tempus-dominus/blob/master/LICENSE)
*/
Expand Down Expand Up @@ -147,7 +147,8 @@ $(document)
const name = 'tempusDominus';
$.fn[name] = tempusDominus.jQueryInterface;
$.fn[name].Constructor = tempusDominus.TempusDominus;
const JQUERY_NO_CONFLICT = $.fn[name];
$.fn[name].noConflict = function () {
$.fn[name] = $.fn[name];
$.fn[name] = JQUERY_NO_CONFLICT;
return tempusDominus.jQueryInterface;
};
Loading

0 comments on commit 3ab219d

Please sign in to comment.