From 68890f8083bc226e3e0596d11fee90f37430e403 Mon Sep 17 00:00:00 2001 From: RainLoop Team Date: Fri, 24 Jun 2016 00:57:35 +0300 Subject: [PATCH] Add datepicker component (#716) --- dev/App/Abstract.jsx | 1 + dev/Component/Date.jsx | 7 +++++++ dev/External/ko.js | 15 +++++++++++++++ gulpfile.js | 1 + package.json | 1 + .../app/templates/Views/Components/Date.html | 14 ++++++++++++++ 6 files changed, 39 insertions(+) create mode 100644 dev/Component/Date.jsx create mode 100644 rainloop/v/0.0.0/app/templates/Views/Components/Date.html diff --git a/dev/App/Abstract.jsx b/dev/App/Abstract.jsx index 1d6b15cb6..ddb174b92 100644 --- a/dev/App/Abstract.jsx +++ b/dev/App/Abstract.jsx @@ -290,6 +290,7 @@ class AbstractApp extends AbstractBoot ko.components.register('Select', require('Component/Select')); ko.components.register('Radio', require('Component/Radio')); ko.components.register('TextArea', require('Component/TextArea')); + ko.components.register('Date', require('Component/Date')); ko.components.register('x-script', require('Component/Script')); // ko.components.register('svg-icon', require('Component/SvgIcon')); diff --git a/dev/Component/Date.jsx b/dev/Component/Date.jsx new file mode 100644 index 000000000..c287dc1aa --- /dev/null +++ b/dev/Component/Date.jsx @@ -0,0 +1,7 @@ + +import {componentExportHelper} from 'Component/Abstract'; +import {AbstractInput} from 'Component/AbstractInput'; + +class DateComponent extends AbstractInput {} + +module.exports = componentExportHelper(DateComponent, 'DateComponent'); diff --git a/dev/External/ko.js b/dev/External/ko.js index 61d8dbc42..2cc1fae17 100644 --- a/dev/External/ko.js +++ b/dev/External/ko.js @@ -9,6 +9,7 @@ $ = require('$'), JSON = require('JSON'), Opentip = require('Opentip'), + Pikaday = require('pikaday'), fDisposalTooltipHelper = function (oElement) { ko.utils.domNodeDisposal.addDisposeCallback(oElement, function () { @@ -124,6 +125,20 @@ } }; + ko.bindingHandlers.pikaday = { + 'init': function (oElement, fValueAccessor, fAllBindingsAccessor, oViewModel) { + + ko.bindingHandlers.textInput.init.apply(oViewModel, Array.prototype.slice.call(arguments)); + + if (Pikaday) + { + oElement.__pikaday = new Pikaday({ + field: oElement + }); + } + } + }; + ko.bindingHandlers.tooltip = { 'init': function (oElement, fValueAccessor) { diff --git a/gulpfile.js b/gulpfile.js index eb69bf951..4f7491d75 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -135,6 +135,7 @@ cfg.paths.css = { 'vendors/flags/flags-fixed.css', 'vendors/lightGallery/dist/css/lightgallery.min.css', 'vendors/lightGallery/dist/css/lg-transitions-lg-lollipop.css', + 'node_modules/pikaday/css/pikaday.css', cfg.paths.staticCSS + cfg.paths.less.main.name ] } diff --git a/package.json b/package.json index 73ea1ad1c..92fcc30d4 100644 --- a/package.json +++ b/package.json @@ -86,6 +86,7 @@ "json-loader": "^0.5.4", "node-fs": "*", "node-notifier": "~4.2.3", + "pikaday": "^1.4.0", "raw-loader": "^0.5.1", "rimraf": "*", "webpack": "2.1.0-beta.13" diff --git a/rainloop/v/0.0.0/app/templates/Views/Components/Date.html b/rainloop/v/0.0.0/app/templates/Views/Components/Date.html new file mode 100644 index 000000000..a680e7796 --- /dev/null +++ b/rainloop/v/0.0.0/app/templates/Views/Components/Date.html @@ -0,0 +1,14 @@ + + +   + +   + + +   +
+ \ No newline at end of file