├── .gitignore ├── .npmignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── config ├── helpers.js ├── karma-test-shim.js ├── karma.conf.js ├── webpack.common.js ├── webpack.dev.js ├── webpack.prod.js └── webpack.test.js ├── dist ├── app.142434dec34b45bd91ad.js ├── app.142434dec34b45bd91ad.js.map ├── assets │ ├── glyphicons-halflings-regular.448c34a56d699c29117adc64c43affeb.woff2 │ ├── glyphicons-halflings-regular.89889688147bd7575d6327160d64e760.svg │ ├── glyphicons-halflings-regular.e18bbf611f2a2e43afc071aa2f4e1512.ttf │ ├── glyphicons-halflings-regular.f4769f9bdb7466be65088239c12046d1.eot │ └── glyphicons-halflings-regular.fa2772327f55d8198301fdb8bcfc8158.woff ├── index.html ├── libs.142434dec34b45bd91ad.css ├── libs.142434dec34b45bd91ad.css.map ├── libs.142434dec34b45bd91ad.js ├── libs.142434dec34b45bd91ad.js.map ├── polyfills.142434dec34b45bd91ad.js └── polyfills.142434dec34b45bd91ad.js.map ├── index.html ├── karma.conf.js ├── ng2-datetime.js ├── ng2-datetime.js.map ├── ng2-datetime.ts ├── package.json ├── src ├── app │ ├── app.component.html │ ├── app.component.ts │ └── app.module.ts ├── main.ts ├── ng2-datetime │ ├── ITimepickerEvent.js │ ├── ITimepickerEvent.js.map │ ├── ITimepickerEvent.ts │ ├── ng2-datetime.js │ ├── ng2-datetime.js.map │ ├── ng2-datetime.module.js │ ├── ng2-datetime.module.js.map │ ├── ng2-datetime.module.ts │ ├── ng2-datetime.spec.ts │ └── ng2-datetime.ts ├── polyfills.ts └── vendor.ts ├── tsconfig.json ├── tslint.json ├── webpack.config.js └── yarn.lock /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | node_modules/ 3 | 4 | src/app/app.component.js 5 | src/app/app.component.js.map 6 | src/app/app.module.js 7 | src/app/app.module.js.map 8 | src/main.js 9 | src/main.js.map 10 | src/polyfills.js 11 | src/polyfills.js.map 12 | src/vendor.js 13 | src/vendor.js.map 14 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | .idea 2 | node_modules/ 3 | config/ 4 | dist/ 5 | src/* 6 | !src/ng2-datetime/ 7 | 8 | index.html 9 | karma.conf.js 10 | tsconfig.json 11 | webpack.config.js 12 | yarn.lock -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkalinov/ng2-datetime/8685c1f76d40b77c2a2f0c15a0ea92c677e74809/CHANGELOG.md -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Nikola Kalinov 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Not maintaned 2 | 3 | # ng2-datetime 4 | [![npm version](https://badge.fury.io/js/ng2-datetime.svg)](https://badge.fury.io/js/ng2-datetime) 5 | 6 | Datetime picker (plugins wrapper) for Angular. 7 | 8 | ##### Demo and docs: https://nkalinov.github.io/ng2-datetime 9 | 10 | ## Dependencies 11 | - [Bootstrap3 (__CSS only__)](http://getbootstrap.com/) 12 | - [jQuery 2+ (supports v3)](http://jquery.com/) 13 | - [Bootstrap-datepicker __(JS+CSS)__](http://eternicode.github.io/bootstrap-datepicker/) 14 | - [Bootstrap-timepicker __(JS+CSS)__](http://jdewit.github.io/bootstrap-timepicker/) 15 | 16 | ## Installation 17 | `npm install --save ng2-datetime` 18 | 19 | ## Usage 20 | 1. import some way or another the required dependencies in the following order: 21 | - Bootstrap CSS 22 | - jQuery 23 | - bootstrap-timepicker + bootstrap-datepicker 24 | 25 | See [this example](https://github.com/nkalinov/ng2-datetime/blob/master/src/vendor.ts#L8) 26 | 2. `import { NKDatetimeModule } from 'ng2-datetime/ng2-datetime';` 27 | 3. Add it to your app module's `imports` property 28 | ``` 29 | @NgModule({ 30 | ... 31 | imports: [NKDatetimeModule, ...], 32 | ... 33 | }) 34 | ``` 35 | 4. Use it: `` 36 | 37 | See the [__DEMO__](https://nkalinov.github.io/ng2-datetime) and it [__source__](https://github.com/nkalinov/ng2-datetime/tree/master/demo) for more info and available options. 38 | 39 | ## Contributing 40 | Fork > Create > Pull request 41 | 42 | ## Thanks to 43 | - @jdewit for the [timepicker plugin](https://github.com/jdewit/bootstrap-timepicker) 44 | - @eternicode for the [datepicker plugin](https://github.com/eternicode/bootstrap-datepicker) 45 | - you 46 | -------------------------------------------------------------------------------- /config/helpers.js: -------------------------------------------------------------------------------- 1 | var path = require('path'); 2 | var _root = path.resolve(__dirname, '..'); 3 | function root(args) { 4 | args = Array.prototype.slice.call(arguments, 0); 5 | return path.join.apply(path, [_root].concat(args)); 6 | } 7 | exports.root = root; 8 | -------------------------------------------------------------------------------- /config/karma-test-shim.js: -------------------------------------------------------------------------------- 1 | Error.stackTraceLimit = Infinity; 2 | 3 | require('core-js/es6'); 4 | require('core-js/es7/reflect'); 5 | 6 | require('zone.js/dist/zone'); 7 | require('zone.js/dist/long-stack-trace-zone'); 8 | require('zone.js/dist/proxy'); 9 | require('zone.js/dist/sync-test'); 10 | require('zone.js/dist/jasmine-patch'); 11 | require('zone.js/dist/async-test'); 12 | require('zone.js/dist/fake-async-test'); 13 | 14 | window.jQuery = window.$ = require('jquery'); 15 | require('bootstrap-datepicker'); 16 | require('bootstrap-timepicker'); 17 | 18 | var appContext = require.context('../src', true, /\.spec\.ts/); 19 | 20 | appContext.keys().forEach(appContext); 21 | 22 | var testing = require('@angular/core/testing'); 23 | var browser = require('@angular/platform-browser-dynamic/testing'); 24 | 25 | testing.TestBed.initTestEnvironment(browser.BrowserDynamicTestingModule, browser.platformBrowserDynamicTesting()); 26 | -------------------------------------------------------------------------------- /config/karma.conf.js: -------------------------------------------------------------------------------- 1 | var webpackConfig = require('./webpack.test'); 2 | 3 | module.exports = function (config) { 4 | var _config = { 5 | basePath: '', 6 | 7 | frameworks: ['jasmine'], 8 | 9 | files: [ 10 | {pattern: './config/karma-test-shim.js', watched: false} 11 | ], 12 | 13 | preprocessors: { 14 | './config/karma-test-shim.js': ['webpack', 'sourcemap'] 15 | }, 16 | 17 | webpack: webpackConfig, 18 | 19 | webpackMiddleware: { 20 | stats: 'errors-only' 21 | }, 22 | 23 | webpackServer: { 24 | noInfo: true 25 | }, 26 | 27 | reporters: ['progress'], 28 | port: 9876, 29 | colors: true, 30 | logLevel: config.LOG_INFO, 31 | autoWatch: false, 32 | browsers: ['PhantomJS'], 33 | singleRun: true 34 | }; 35 | 36 | config.set(_config); 37 | }; 38 | -------------------------------------------------------------------------------- /config/webpack.common.js: -------------------------------------------------------------------------------- 1 | var webpack = require('webpack'); 2 | var HtmlWebpackPlugin = require('html-webpack-plugin'); 3 | var ExtractTextPlugin = require('extract-text-webpack-plugin'); 4 | var helpers = require('./helpers'); 5 | 6 | module.exports = { 7 | entry: { 8 | 'polyfills': './src/polyfills.ts', 9 | 'libs': './src/vendor.ts', 10 | 'app': './src/main.ts' 11 | }, 12 | 13 | resolve: { 14 | extensions: ['', '.ts', '.js'] 15 | }, 16 | 17 | module: { 18 | loaders: [ 19 | { 20 | test: /\.ts$/, 21 | loaders: ['awesome-typescript-loader', 'angular2-template-loader'] 22 | }, 23 | { 24 | test: /\.html$/, 25 | loader: 'html' 26 | }, 27 | { 28 | test: /\.(png|jpe?g|gif|svg|woff|woff2|ttf|eot|ico)$/, 29 | loader: 'file?name=assets/[name].[hash].[ext]' 30 | }, 31 | { 32 | test: /\.css$/, 33 | exclude: helpers.root('src', 'app'), 34 | loader: ExtractTextPlugin.extract('style', 'css?sourceMap') 35 | }, 36 | { 37 | test: /\.css$/, 38 | include: helpers.root('src', 'app'), 39 | loader: 'raw' 40 | } 41 | ] 42 | }, 43 | 44 | plugins: [ 45 | new webpack.optimize.CommonsChunkPlugin({ 46 | name: ['app', 'libs', 'polyfills'] 47 | }), 48 | 49 | new HtmlWebpackPlugin({ 50 | template: 'index.html' 51 | }), 52 | 53 | new webpack.ProvidePlugin({ 54 | $: "jquery", 55 | jQuery: "jquery" 56 | }) 57 | ] 58 | }; 59 | -------------------------------------------------------------------------------- /config/webpack.dev.js: -------------------------------------------------------------------------------- 1 | var webpackMerge = require('webpack-merge'); 2 | var ExtractTextPlugin = require('extract-text-webpack-plugin'); 3 | var commonConfig = require('./webpack.common.js'); 4 | var helpers = require('./helpers'); 5 | 6 | module.exports = webpackMerge(commonConfig, { 7 | devtool: 'source-map', 8 | 9 | output: { 10 | path: helpers.root('dist'), 11 | publicPath: 'http://localhost:8080/', 12 | filename: '[name].js', 13 | chunkFilename: '[id].chunk.js' 14 | }, 15 | 16 | plugins: [ 17 | new ExtractTextPlugin('[name].css') 18 | ], 19 | 20 | devServer: { 21 | historyApiFallback: true, 22 | stats: 'minimal' 23 | } 24 | }); 25 | -------------------------------------------------------------------------------- /config/webpack.prod.js: -------------------------------------------------------------------------------- 1 | var webpack = require('webpack'); 2 | var webpackMerge = require('webpack-merge'); 3 | var ExtractTextPlugin = require('extract-text-webpack-plugin'); 4 | var commonConfig = require('./webpack.common.js'); 5 | var helpers = require('./helpers'); 6 | 7 | const ENV = process.env.NODE_ENV = process.env.ENV = 'production'; 8 | 9 | module.exports = webpackMerge(commonConfig, { 10 | devtool: 'source-map', 11 | 12 | output: { 13 | path: helpers.root('dist'), 14 | publicPath: '', 15 | filename: '[name].[hash].js', 16 | chunkFilename: '[id].[hash].chunk.js' 17 | }, 18 | 19 | htmlLoader: { 20 | minimize: false // workaround for ng2 21 | }, 22 | 23 | plugins: [ 24 | new webpack.NoErrorsPlugin(), 25 | new webpack.optimize.DedupePlugin(), 26 | new webpack.optimize.UglifyJsPlugin({ // https://github.com/angular/angular/issues/10618 27 | mangle: { 28 | keep_fnames: true 29 | } 30 | }), 31 | new ExtractTextPlugin('[name].[hash].css'), 32 | new webpack.DefinePlugin({ 33 | 'process.env': { 34 | 'ENV': JSON.stringify(ENV) 35 | } 36 | }) 37 | ] 38 | }); 39 | -------------------------------------------------------------------------------- /config/webpack.test.js: -------------------------------------------------------------------------------- 1 | var helpers = require('./helpers'); 2 | 3 | module.exports = { 4 | devtool: 'inline-source-map', 5 | 6 | resolve: { 7 | extensions: ['', '.ts', '.js'] 8 | }, 9 | 10 | module: { 11 | loaders: [ 12 | { 13 | test: /\.ts$/, 14 | loaders: ['awesome-typescript-loader', 'angular2-template-loader'] 15 | }, 16 | { 17 | test: /\.html$/, 18 | loader: 'html' 19 | 20 | }, 21 | { 22 | test: /\.(png|jpe?g|gif|svg|woff|woff2|ttf|eot|ico)$/, 23 | loader: 'null' 24 | }, 25 | { 26 | test: /\.css$/, 27 | exclude: helpers.root('src', 'app'), 28 | loader: 'null' 29 | }, 30 | { 31 | test: /\.css$/, 32 | include: helpers.root('src', 'app'), 33 | loader: 'raw' 34 | } 35 | ] 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /dist/app.142434dec34b45bd91ad.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([0],{0:function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=r(1),n=r(3),i=r(39);n.enableProdMode(),o.platformBrowserDynamic().bootstrapModule(i.AppModule)},39:function(t,e,r){"use strict";var o=this&&this.__decorate||function(t,e,r,o){var n,i=arguments.length,a=i<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,r,o);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(a=(i<3?n(a):i>3?n(e,r,a):n(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a};Object.defineProperty(e,"__esModule",{value:!0});var n=r(3),i=r(38),a=r(40),s=r(46),l=r(48),c=function(){function AppModule(){}return AppModule}();c=o([n.NgModule({imports:[i.BrowserModule,a.FormsModule,a.ReactiveFormsModule,l.NKDatetimeModule],bootstrap:[s.AppComponent],declarations:[s.AppComponent]})],c),e.AppModule=c},40:function(t,e,r){/** 2 | * @license Angular v4.1.1 3 | * (c) 2010-2017 Google, Inc. https://angular.io/ 4 | * License: MIT 5 | */ 6 | !function(t,o){o(e,r(3),r(41),r(43),r(45),r(38))}(this,function(t,e,r,o,n,i){"use strict";function isEmptyInputValue(t){return null==t||0===t.length}function isPresent(t){return null!=t}function toObservable(t){var r=e.ɵisPromise(t)?o.fromPromise(t):t;if(!e.ɵisObservable(r))throw new Error("Expected validator to return Promise or Observable.");return r}function _executeValidators(t,e){return e.map(function(e){return e(t)})}function _executeAsyncValidators(t,e){return e.map(function(e){return e(t)})}function _mergeErrors(t){var e=t.reduce(function(t,e){return null!=e?c({},t,e):t},{});return 0===Object.keys(e).length?null:e}function _isAndroid(){var t=i.ɵgetDOM()?i.ɵgetDOM().getUserAgent():"";return/android (\d+)/.test(t.toLowerCase())}/** 7 | * @license 8 | * Copyright Google Inc. All Rights Reserved. 9 | * 10 | * Use of this source code is governed by an MIT-style license that can be 11 | * found in the LICENSE file at https://angular.io/license 12 | */ 13 | function normalizeValidator(t){return t.validate?function(e){return t.validate(e)}:t}function normalizeAsyncValidator(t){return t.validate?function(e){return t.validate(e)}:t}/** 14 | * @license 15 | * Copyright Google Inc. All Rights Reserved. 16 | * 17 | * Use of this source code is governed by an MIT-style license that can be 18 | * found in the LICENSE file at https://angular.io/license 19 | */ 20 | function unimplemented(){throw new Error("unimplemented")}function _buildValueString(t,e){return null==t?""+e:(e&&"object"==typeof e&&(e="Object"),(t+": "+e).slice(0,50))}function _extractId(t){return t.split(":")[0]}function _buildValueString$1(t,e){return null==t?""+e:("string"==typeof e&&(e="'"+e+"'"),e&&"object"==typeof e&&(e="Object"),(t+": "+e).slice(0,50))}function _extractId$1(t){return t.split(":")[0]}/** 21 | * @license 22 | * Copyright Google Inc. All Rights Reserved. 23 | * 24 | * Use of this source code is governed by an MIT-style license that can be 25 | * found in the LICENSE file at https://angular.io/license 26 | */ 27 | function controlPath(t,e){return e.path.concat([t])}function setUpControl(t,e){t||_throwError(e,"Cannot find control with"),e.valueAccessor||_throwError(e,"No value accessor for form control with"),t.validator=h.compose([t.validator,e.validator]),t.asyncValidator=h.composeAsync([t.asyncValidator,e.asyncValidator]),e.valueAccessor.writeValue(t.value),e.valueAccessor.registerOnChange(function(r){e.viewToModelUpdate(r),t.markAsDirty(),t.setValue(r,{emitModelToViewChange:!1})}),e.valueAccessor.registerOnTouched(function(){return t.markAsTouched()}),t.registerOnChange(function(t,r){e.valueAccessor.writeValue(t),r&&e.viewToModelUpdate(t)}),e.valueAccessor.setDisabledState&&t.registerOnDisabledChange(function(t){e.valueAccessor.setDisabledState(t)}),e._rawValidators.forEach(function(e){e.registerOnValidatorChange&&e.registerOnValidatorChange(function(){return t.updateValueAndValidity()})}),e._rawAsyncValidators.forEach(function(e){e.registerOnValidatorChange&&e.registerOnValidatorChange(function(){return t.updateValueAndValidity()})})}function cleanUpControl(t,e){e.valueAccessor.registerOnChange(function(){return _noControlError(e)}),e.valueAccessor.registerOnTouched(function(){return _noControlError(e)}),e._rawValidators.forEach(function(t){t.registerOnValidatorChange&&t.registerOnValidatorChange(null)}),e._rawAsyncValidators.forEach(function(t){t.registerOnValidatorChange&&t.registerOnValidatorChange(null)}),t&&t._clearChangeFns()}function setUpFormContainer(t,e){null==t&&_throwError(e,"Cannot find control with"),t.validator=h.compose([t.validator,e.validator]),t.asyncValidator=h.composeAsync([t.asyncValidator,e.asyncValidator])}function _noControlError(t){return _throwError(t,"There is no FormControl instance attached to form control element with")}function _throwError(t,e){var r;throw r=t.path.length>1?"path: '"+t.path.join(" -> ")+"'":t.path[0]?"name: '"+t.path+"'":"unspecified name attribute",new Error(e+" "+r)}function composeValidators(t){return null!=t?h.compose(t.map(normalizeValidator)):null}function composeAsyncValidators(t){return null!=t?h.composeAsync(t.map(normalizeAsyncValidator)):null}function isPropertyUpdated(t,r){if(!t.hasOwnProperty("model"))return!1;var o=t.model;return!!o.isFirstChange()||!e.ɵlooseIdentical(r,o.currentValue)}function isBuiltInAccessor(t){return G.some(function(e){return t.constructor===e})}function selectValueAccessor(t,e){if(!e)return null;var r=void 0,o=void 0,n=void 0;return e.forEach(function(e){e.constructor===b?r=e:isBuiltInAccessor(e)?(o&&_throwError(t,"More than one built-in value accessor matches form control with"),o=e):(n&&_throwError(t,"More than one custom value accessor matches form control with"),n=e)}),n?n:o?o:r?r:(_throwError(t,"No valid value accessor for form control with"),null)}function _find(t,e,r){return null==e?null:(e instanceof Array||(e=e.split(r)),e instanceof Array&&0===e.length?null:e.reduce(function(t,e){return t instanceof H?t.controls[e]||null:t instanceof W?t.at(e)||null:null},t))}function coerceToValidator(t){return Array.isArray(t)?composeValidators(t):t||null}function coerceToAsyncValidator(t){return Array.isArray(t)?composeAsyncValidators(t):t||null}function remove(t,e){var r=t.indexOf(e);r>-1&&t.splice(r,1)}function _hasInvalidParent(t){return!(t instanceof ut||t instanceof lt||t instanceof dt)}var a=function(t,e){function __(){this.constructor=t}for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);t.prototype=null===e?Object.create(e):(__.prototype=e.prototype,new __)},s=function(){function AbstractControlDirective(){}return AbstractControlDirective.prototype.control=function(){},Object.defineProperty(AbstractControlDirective.prototype,"value",{get:function(){return this.control?this.control.value:null},enumerable:!0,configurable:!0}),Object.defineProperty(AbstractControlDirective.prototype,"valid",{get:function(){return this.control?this.control.valid:null},enumerable:!0,configurable:!0}),Object.defineProperty(AbstractControlDirective.prototype,"invalid",{get:function(){return this.control?this.control.invalid:null},enumerable:!0,configurable:!0}),Object.defineProperty(AbstractControlDirective.prototype,"pending",{get:function(){return this.control?this.control.pending:null},enumerable:!0,configurable:!0}),Object.defineProperty(AbstractControlDirective.prototype,"errors",{get:function(){return this.control?this.control.errors:null},enumerable:!0,configurable:!0}),Object.defineProperty(AbstractControlDirective.prototype,"pristine",{get:function(){return this.control?this.control.pristine:null},enumerable:!0,configurable:!0}),Object.defineProperty(AbstractControlDirective.prototype,"dirty",{get:function(){return this.control?this.control.dirty:null},enumerable:!0,configurable:!0}),Object.defineProperty(AbstractControlDirective.prototype,"touched",{get:function(){return this.control?this.control.touched:null},enumerable:!0,configurable:!0}),Object.defineProperty(AbstractControlDirective.prototype,"untouched",{get:function(){return this.control?this.control.untouched:null},enumerable:!0,configurable:!0}),Object.defineProperty(AbstractControlDirective.prototype,"disabled",{get:function(){return this.control?this.control.disabled:null},enumerable:!0,configurable:!0}),Object.defineProperty(AbstractControlDirective.prototype,"enabled",{get:function(){return this.control?this.control.enabled:null},enumerable:!0,configurable:!0}),Object.defineProperty(AbstractControlDirective.prototype,"statusChanges",{get:function(){return this.control?this.control.statusChanges:null},enumerable:!0,configurable:!0}),Object.defineProperty(AbstractControlDirective.prototype,"valueChanges",{get:function(){return this.control?this.control.valueChanges:null},enumerable:!0,configurable:!0}),Object.defineProperty(AbstractControlDirective.prototype,"path",{get:function(){return null},enumerable:!0,configurable:!0}),AbstractControlDirective.prototype.reset=function(t){void 0===t&&(t=void 0),this.control&&this.control.reset(t)},AbstractControlDirective.prototype.hasError=function(t,e){return!!this.control&&this.control.hasError(t,e)},AbstractControlDirective.prototype.getError=function(t,e){return this.control?this.control.getError(t,e):null},AbstractControlDirective}(),l=function(t){function ControlContainer(){return null!==t&&t.apply(this,arguments)||this}return a(ControlContainer,t),Object.defineProperty(ControlContainer.prototype,"formDirective",{get:function(){return null},enumerable:!0,configurable:!0}),Object.defineProperty(ControlContainer.prototype,"path",{get:function(){return null},enumerable:!0,configurable:!0}),ControlContainer}(s),c=Object.assign||function(t){for(var e,r=1,o=arguments.length;rt?{maxlength:{requiredLength:t,actualLength:r}}:null}},Validators.pattern=function(t){if(!t)return Validators.nullValidator;var e,r;return"string"==typeof t?(r="^"+t+"$",e=new RegExp(r)):(r=t.toString(),e=t),function(t){if(isEmptyInputValue(t.value))return null;var o=t.value;return e.test(o)?null:{pattern:{requiredPattern:r,actualValue:o}}}},Validators.nullValidator=function(t){return null},Validators.compose=function(t){if(!t)return null;var e=t.filter(isPresent);return 0==e.length?null:function(t){return _mergeErrors(_executeValidators(t,e))}},Validators.composeAsync=function(t){if(!t)return null;var e=t.filter(isPresent);return 0==e.length?null:function(t){var o=_executeAsyncValidators(t,e).map(toObservable);return n.map.call(r.forkJoin(o),_mergeErrors)}},Validators}(),f=new e.InjectionToken("NgValueAccessor"),m={provide:f,useExisting:e.forwardRef(function(){return y}),multi:!0},y=function(){function CheckboxControlValueAccessor(t,e){this._renderer=t,this._elementRef=e,this.onChange=function(t){},this.onTouched=function(){}}return CheckboxControlValueAccessor.prototype.writeValue=function(t){this._renderer.setElementProperty(this._elementRef.nativeElement,"checked",t)},CheckboxControlValueAccessor.prototype.registerOnChange=function(t){this.onChange=t},CheckboxControlValueAccessor.prototype.registerOnTouched=function(t){this.onTouched=t},CheckboxControlValueAccessor.prototype.setDisabledState=function(t){this._renderer.setElementProperty(this._elementRef.nativeElement,"disabled",t)},CheckboxControlValueAccessor}();y.decorators=[{type:e.Directive,args:[{selector:"input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]",host:{"(change)":"onChange($event.target.checked)","(blur)":"onTouched()"},providers:[m]}]}],y.ctorParameters=function(){return[{type:e.Renderer},{type:e.ElementRef}]};/** 28 | * @license 29 | * Copyright Google Inc. All Rights Reserved. 30 | * 31 | * Use of this source code is governed by an MIT-style license that can be 32 | * found in the LICENSE file at https://angular.io/license 33 | */ 34 | var g={provide:f,useExisting:e.forwardRef(function(){return b}),multi:!0},v=new e.InjectionToken("CompositionEventMode"),b=function(){function DefaultValueAccessor(t,e,r){this._renderer=t,this._elementRef=e,this._compositionMode=r,this.onChange=function(t){},this.onTouched=function(){},this._composing=!1,null==this._compositionMode&&(this._compositionMode=!_isAndroid())}return DefaultValueAccessor.prototype.writeValue=function(t){var e=null==t?"":t;this._renderer.setElementProperty(this._elementRef.nativeElement,"value",e)},DefaultValueAccessor.prototype.registerOnChange=function(t){this.onChange=t},DefaultValueAccessor.prototype.registerOnTouched=function(t){this.onTouched=t},DefaultValueAccessor.prototype.setDisabledState=function(t){this._renderer.setElementProperty(this._elementRef.nativeElement,"disabled",t)},DefaultValueAccessor.prototype._handleInput=function(t){(!this._compositionMode||this._compositionMode&&!this._composing)&&this.onChange(t)},DefaultValueAccessor.prototype._compositionStart=function(){this._composing=!0},DefaultValueAccessor.prototype._compositionEnd=function(t){this._composing=!1,this._compositionMode&&this.onChange(t)},DefaultValueAccessor}();b.decorators=[{type:e.Directive,args:[{selector:"input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]",host:{"(input)":"_handleInput($event.target.value)","(blur)":"onTouched()","(compositionstart)":"_compositionStart()","(compositionend)":"_compositionEnd($event.target.value)"},providers:[g]}]}],b.ctorParameters=function(){return[{type:e.Renderer},{type:e.ElementRef},{type:void 0,decorators:[{type:e.Optional},{type:e.Inject,args:[v]}]}]};/** 35 | * @license 36 | * Copyright Google Inc. All Rights Reserved. 37 | * 38 | * Use of this source code is governed by an MIT-style license that can be 39 | * found in the LICENSE file at https://angular.io/license 40 | */ 41 | var _={provide:f,useExisting:e.forwardRef(function(){return C}),multi:!0},C=function(){function NumberValueAccessor(t,e){this._renderer=t,this._elementRef=e,this.onChange=function(t){},this.onTouched=function(){}}return NumberValueAccessor.prototype.writeValue=function(t){var e=null==t?"":t;this._renderer.setElementProperty(this._elementRef.nativeElement,"value",e)},NumberValueAccessor.prototype.registerOnChange=function(t){this.onChange=function(e){t(""==e?null:parseFloat(e))}},NumberValueAccessor.prototype.registerOnTouched=function(t){this.onTouched=t},NumberValueAccessor.prototype.setDisabledState=function(t){this._renderer.setElementProperty(this._elementRef.nativeElement,"disabled",t)},NumberValueAccessor}();C.decorators=[{type:e.Directive,args:[{selector:"input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]",host:{"(change)":"onChange($event.target.value)","(input)":"onChange($event.target.value)","(blur)":"onTouched()"},providers:[_]}]}],C.ctorParameters=function(){return[{type:e.Renderer},{type:e.ElementRef}]};var V=function(t){function NgControl(){var e=t.apply(this,arguments)||this;return e._parent=null,e.name=null,e.valueAccessor=null,e._rawValidators=[],e._rawAsyncValidators=[],e}return a(NgControl,t),Object.defineProperty(NgControl.prototype,"validator",{get:function(){return unimplemented()},enumerable:!0,configurable:!0}),Object.defineProperty(NgControl.prototype,"asyncValidator",{get:function(){return unimplemented()},enumerable:!0,configurable:!0}),NgControl.prototype.viewToModelUpdate=function(t){},NgControl}(s),A={provide:f,useExisting:e.forwardRef(function(){return D}),multi:!0},O=function(){function RadioControlRegistry(){this._accessors=[]}return RadioControlRegistry.prototype.add=function(t,e){this._accessors.push([t,e])},RadioControlRegistry.prototype.remove=function(t){for(var e=this._accessors.length-1;e>=0;--e)if(this._accessors[e][1]===t)return void this._accessors.splice(e,1)},RadioControlRegistry.prototype.select=function(t){var e=this;this._accessors.forEach(function(r){e._isSameGroup(r,t)&&r[1]!==t&&r[1].fireUncheck(t.value)})},RadioControlRegistry.prototype._isSameGroup=function(t,e){return!!t[0].control&&(t[0]._parent===e._control._parent&&t[1].name===e.name)},RadioControlRegistry}();O.decorators=[{type:e.Injectable}],O.ctorParameters=function(){return[]};var D=function(){function RadioControlValueAccessor(t,e,r,o){this._renderer=t,this._elementRef=e,this._registry=r,this._injector=o,this.onChange=function(){},this.onTouched=function(){}}return RadioControlValueAccessor.prototype.ngOnInit=function(){this._control=this._injector.get(V),this._checkName(),this._registry.add(this._control,this)},RadioControlValueAccessor.prototype.ngOnDestroy=function(){this._registry.remove(this)},RadioControlValueAccessor.prototype.writeValue=function(t){this._state=t===this.value,this._renderer.setElementProperty(this._elementRef.nativeElement,"checked",this._state)},RadioControlValueAccessor.prototype.registerOnChange=function(t){var e=this;this._fn=t,this.onChange=function(){t(e.value),e._registry.select(e)}},RadioControlValueAccessor.prototype.fireUncheck=function(t){this.writeValue(t)},RadioControlValueAccessor.prototype.registerOnTouched=function(t){this.onTouched=t},RadioControlValueAccessor.prototype.setDisabledState=function(t){this._renderer.setElementProperty(this._elementRef.nativeElement,"disabled",t)},RadioControlValueAccessor.prototype._checkName=function(){this.name&&this.formControlName&&this.name!==this.formControlName&&this._throwNameError(),!this.name&&this.formControlName&&(this.name=this.formControlName)},RadioControlValueAccessor.prototype._throwNameError=function(){throw new Error('\n If you define both a name and a formControlName attribute on your radio button, their values\n must match. Ex: \n ')},RadioControlValueAccessor}();D.decorators=[{type:e.Directive,args:[{selector:"input[type=radio][formControlName],input[type=radio][formControl],input[type=radio][ngModel]",host:{"(change)":"onChange()","(blur)":"onTouched()"},providers:[A]}]}],D.ctorParameters=function(){return[{type:e.Renderer},{type:e.ElementRef},{type:O},{type:e.Injector}]},D.propDecorators={name:[{type:e.Input}],formControlName:[{type:e.Input}],value:[{type:e.Input}]};/** 42 | * @license 43 | * Copyright Google Inc. All Rights Reserved. 44 | * 45 | * Use of this source code is governed by an MIT-style license that can be 46 | * found in the LICENSE file at https://angular.io/license 47 | */ 48 | var E={provide:f,useExisting:e.forwardRef(function(){return M}),multi:!0},M=function(){function RangeValueAccessor(t,e){this._renderer=t,this._elementRef=e,this.onChange=function(t){},this.onTouched=function(){}}return RangeValueAccessor.prototype.writeValue=function(t){this._renderer.setElementProperty(this._elementRef.nativeElement,"value",parseFloat(t))},RangeValueAccessor.prototype.registerOnChange=function(t){this.onChange=function(e){t(""==e?null:parseFloat(e))}},RangeValueAccessor.prototype.registerOnTouched=function(t){this.onTouched=t},RangeValueAccessor.prototype.setDisabledState=function(t){this._renderer.setElementProperty(this._elementRef.nativeElement,"disabled",t)},RangeValueAccessor}();M.decorators=[{type:e.Directive,args:[{selector:"input[type=range][formControlName],input[type=range][formControl],input[type=range][ngModel]",host:{"(change)":"onChange($event.target.value)","(input)":"onChange($event.target.value)","(blur)":"onTouched()"},providers:[E]}]}],M.ctorParameters=function(){return[{type:e.Renderer},{type:e.ElementRef}]};/** 49 | * @license 50 | * Copyright Google Inc. All Rights Reserved. 51 | * 52 | * Use of this source code is governed by an MIT-style license that can be 53 | * found in the LICENSE file at https://angular.io/license 54 | */ 55 | var F={provide:f,useExisting:e.forwardRef(function(){return N}),multi:!0},N=function(){function SelectControlValueAccessor(t,r){this._renderer=t,this._elementRef=r,this._optionMap=new Map,this._idCounter=0,this.onChange=function(t){},this.onTouched=function(){},this._compareWith=e.ɵlooseIdentical}return Object.defineProperty(SelectControlValueAccessor.prototype,"compareWith",{set:function(t){if("function"!=typeof t)throw new Error("compareWith must be a function, but received "+JSON.stringify(t));this._compareWith=t},enumerable:!0,configurable:!0}),SelectControlValueAccessor.prototype.writeValue=function(t){this.value=t;var e=this._getOptionId(t);null==e&&this._renderer.setElementProperty(this._elementRef.nativeElement,"selectedIndex",-1);var r=_buildValueString(e,t);this._renderer.setElementProperty(this._elementRef.nativeElement,"value",r)},SelectControlValueAccessor.prototype.registerOnChange=function(t){var e=this;this.onChange=function(r){e.value=r,t(e._getOptionValue(r))}},SelectControlValueAccessor.prototype.registerOnTouched=function(t){this.onTouched=t},SelectControlValueAccessor.prototype.setDisabledState=function(t){this._renderer.setElementProperty(this._elementRef.nativeElement,"disabled",t)},SelectControlValueAccessor.prototype._registerOption=function(){return(this._idCounter++).toString()},SelectControlValueAccessor.prototype._getOptionId=function(t){for(var e=0,r=Array.from(this._optionMap.keys());e-1)}}else r=function(t,e){t._setSelected(!1)};this._optionMap.forEach(r)},SelectMultipleControlValueAccessor.prototype.registerOnChange=function(t){var e=this;this.onChange=function(r){var o=[];if(r.hasOwnProperty("selectedOptions"))for(var n=r.selectedOptions,i=0;i0||this.disabled},FormGroup.prototype._checkAllValuesPresent=function(t){this._forEachChild(function(e,r){if(void 0===t[r])throw new Error("Must supply a value for form control with name: '"+r+"'.")})},FormGroup}($),W=function(t){function FormArray(e,r,o){var n=t.call(this,r||null,o||null)||this;return n.controls=e,n._initObservables(),n._setUpControls(),n.updateValueAndValidity({onlySelf:!0,emitEvent:!1}),n}return a(FormArray,t),FormArray.prototype.at=function(t){return this.controls[t]},FormArray.prototype.push=function(t){this.controls.push(t),this._registerControl(t),this.updateValueAndValidity(),this._onCollectionChange()},FormArray.prototype.insert=function(t,e){this.controls.splice(t,0,e),this._registerControl(e),this.updateValueAndValidity(),this._onCollectionChange()},FormArray.prototype.removeAt=function(t){this.controls[t]&&this.controls[t]._registerOnCollectionChange(function(){}),this.controls.splice(t,1),this.updateValueAndValidity(),this._onCollectionChange()},FormArray.prototype.setControl=function(t,e){this.controls[t]&&this.controls[t]._registerOnCollectionChange(function(){}),this.controls.splice(t,1),e&&(this.controls.splice(t,0,e),this._registerControl(e)),this.updateValueAndValidity(),this._onCollectionChange()},Object.defineProperty(FormArray.prototype,"length",{get:function(){return this.controls.length},enumerable:!0,configurable:!0}),FormArray.prototype.setValue=function(t,e){var r=this;void 0===e&&(e={}),this._checkAllValuesPresent(t),t.forEach(function(t,o){r._throwIfControlMissing(o),r.at(o).setValue(t,{onlySelf:!0,emitEvent:e.emitEvent})}),this.updateValueAndValidity(e)},FormArray.prototype.patchValue=function(t,e){var r=this;void 0===e&&(e={}),t.forEach(function(t,o){r.at(o)&&r.at(o).patchValue(t,{onlySelf:!0,emitEvent:e.emitEvent})}),this.updateValueAndValidity(e)},FormArray.prototype.reset=function(t,e){void 0===t&&(t=[]),void 0===e&&(e={}),this._forEachChild(function(r,o){r.reset(t[o],{onlySelf:!0,emitEvent:e.emitEvent})}),this.updateValueAndValidity(e),this._updatePristine(e),this._updateTouched(e)},FormArray.prototype.getRawValue=function(){return this.controls.map(function(t){return t instanceof K?t.value:t.getRawValue()})},FormArray.prototype._throwIfControlMissing=function(t){if(!this.controls.length)throw new Error("\n There are no form controls registered with this array yet. If you're using ngModel,\n you may want to check next tick (e.g. use setTimeout).\n ");if(!this.at(t))throw new Error("Cannot find form control at index "+t)},FormArray.prototype._forEachChild=function(t){this.controls.forEach(function(e,r){t(e,r)})},FormArray.prototype._updateValue=function(){var t=this;this._value=this.controls.filter(function(e){return e.enabled||t.disabled}).map(function(t){return t.value})},FormArray.prototype._anyControls=function(t){return this.controls.some(function(e){return e.enabled&&t(e)})},FormArray.prototype._setUpControls=function(){var t=this;this._forEachChild(function(e){return t._registerControl(e)})},FormArray.prototype._checkAllValuesPresent=function(t){this._forEachChild(function(e,r){if(void 0===t[r])throw new Error("Must supply a value for form control at index: "+r+".")})},FormArray.prototype._allControlsDisabled=function(){for(var t=0,e=this.controls;t0||this.disabled},FormArray.prototype._registerControl=function(t){t.setParent(this),t._registerOnCollectionChange(this._onCollectionChange)},FormArray}($),z={provide:l,useExisting:e.forwardRef(function(){return Y})},Z=Promise.resolve(null),Y=function(t){function NgForm(r,o){var n=t.call(this)||this;return n._submitted=!1,n.ngSubmit=new e.EventEmitter,n.form=new H({},composeValidators(r),composeAsyncValidators(o)),n}return a(NgForm,t),Object.defineProperty(NgForm.prototype,"submitted",{get:function(){return this._submitted},enumerable:!0,configurable:!0}),Object.defineProperty(NgForm.prototype,"formDirective",{get:function(){return this},enumerable:!0,configurable:!0}),Object.defineProperty(NgForm.prototype,"control",{get:function(){return this.form},enumerable:!0,configurable:!0}),Object.defineProperty(NgForm.prototype,"path",{get:function(){return[]},enumerable:!0,configurable:!0}),Object.defineProperty(NgForm.prototype,"controls",{get:function(){return this.form.controls},enumerable:!0,configurable:!0}),NgForm.prototype.addControl=function(t){var e=this;Z.then(function(){var r=e._findContainer(t.path);t._control=r.registerControl(t.name,t.control),setUpControl(t.control,t),t.control.updateValueAndValidity({emitEvent:!1})})},NgForm.prototype.getControl=function(t){return this.form.get(t.path)},NgForm.prototype.removeControl=function(t){var e=this;Z.then(function(){var r=e._findContainer(t.path);r&&r.removeControl(t.name)})},NgForm.prototype.addFormGroup=function(t){var e=this;Z.then(function(){var r=e._findContainer(t.path),o=new H({});setUpFormContainer(o,t),r.registerControl(t.name,o),o.updateValueAndValidity({emitEvent:!1})})},NgForm.prototype.removeFormGroup=function(t){var e=this;Z.then(function(){var r=e._findContainer(t.path);r&&r.removeControl(t.name)})},NgForm.prototype.getFormGroup=function(t){return this.form.get(t.path)},NgForm.prototype.updateModel=function(t,e){var r=this;Z.then(function(){var o=r.form.get(t.path);o.setValue(e)})},NgForm.prototype.setValue=function(t){this.control.setValue(t)},NgForm.prototype.onSubmit=function(t){return this._submitted=!0,this.ngSubmit.emit(t),!1},NgForm.prototype.onReset=function(){this.resetForm()},NgForm.prototype.resetForm=function(t){void 0===t&&(t=void 0),this.form.reset(t),this._submitted=!1},NgForm.prototype._findContainer=function(t){return t.pop(),t.length?this.form.get(t):this.form},NgForm}(l);Y.decorators=[{type:e.Directive,args:[{selector:"form:not([ngNoForm]):not([formGroup]),ngForm,[ngForm]",providers:[z],host:{"(submit)":"onSubmit($event)","(reset)":"onReset()"},outputs:["ngSubmit"],exportAs:"ngForm"}]}],Y.ctorParameters=function(){return[{type:Array,decorators:[{type:e.Optional},{type:e.Self},{type:e.Inject,args:[u]}]},{type:Array,decorators:[{type:e.Optional},{type:e.Self},{type:e.Inject,args:[p]}]}]};/** 70 | * @license 71 | * Copyright Google Inc. All Rights Reserved. 72 | * 73 | * Use of this source code is governed by an MIT-style license that can be 74 | * found in the LICENSE file at https://angular.io/license 75 | */ 76 | var J={formControlName:'\n
\n \n
\n\n In your class:\n\n this.myGroup = new FormGroup({\n firstName: new FormControl()\n });',formGroupName:'\n
\n
\n \n
\n
\n\n In your class:\n\n this.myGroup = new FormGroup({\n person: new FormGroup({ firstName: new FormControl() })\n });',formArrayName:'\n
\n
\n
\n \n
\n
\n
\n\n In your class:\n\n this.cityArray = new FormArray([new FormControl(\'SF\')]);\n this.myGroup = new FormGroup({\n cities: this.cityArray\n });',ngModelGroup:'\n
\n
\n \n
\n
',ngModelWithFormGroup:'\n
\n \n \n
\n '},Q=function(){function TemplateDrivenErrors(){}return TemplateDrivenErrors.modelParentException=function(){throw new Error('\n ngModel cannot be used to register form controls with a parent formGroup directive. Try using\n formGroup\'s partner directive "formControlName" instead. Example:\n\n '+J.formControlName+"\n\n Or, if you'd like to avoid registering this form control, indicate that it's standalone in ngModelOptions:\n\n Example:\n\n "+J.ngModelWithFormGroup)},TemplateDrivenErrors.formGroupNameException=function(){throw new Error("\n ngModel cannot be used to register form controls with a parent formGroupName or formArrayName directive.\n\n Option 1: Use formControlName instead of ngModel (reactive strategy):\n\n "+J.formGroupName+"\n\n Option 2: Update ngModel's parent be ngModelGroup (template-driven strategy):\n\n "+J.ngModelGroup)},TemplateDrivenErrors.missingNameException=function(){throw new Error('If ngModel is used within a form tag, either the name attribute must be set or the form\n control must be defined as \'standalone\' in ngModelOptions.\n\n Example 1: \n Example 2: ')},TemplateDrivenErrors.modelGroupParentException=function(){throw new Error("\n ngModelGroup cannot be used with a parent formGroup directive.\n\n Option 1: Use formGroupName instead of ngModelGroup (reactive strategy):\n\n "+J.formGroupName+"\n\n Option 2: Use a regular form tag instead of the formGroup directive (template-driven strategy):\n\n "+J.ngModelGroup)},TemplateDrivenErrors}(),X={provide:l,useExisting:e.forwardRef(function(){return tt})},tt=function(t){function NgModelGroup(e,r,o){var n=t.call(this)||this;return n._parent=e,n._validators=r,n._asyncValidators=o,n}return a(NgModelGroup,t),NgModelGroup.prototype._checkParentType=function(){this._parent instanceof NgModelGroup||this._parent instanceof Y||Q.modelGroupParentException()},NgModelGroup}(j);tt.decorators=[{type:e.Directive,args:[{selector:"[ngModelGroup]",providers:[X],exportAs:"ngModelGroup"}]}],tt.ctorParameters=function(){return[{type:l,decorators:[{type:e.Host},{type:e.SkipSelf}]},{type:Array,decorators:[{type:e.Optional},{type:e.Self},{type:e.Inject,args:[u]}]},{type:Array,decorators:[{type:e.Optional},{type:e.Self},{type:e.Inject,args:[p]}]}]},tt.propDecorators={name:[{type:e.Input,args:["ngModelGroup"]}]};/** 77 | * @license 78 | * Copyright Google Inc. All Rights Reserved. 79 | * 80 | * Use of this source code is governed by an MIT-style license that can be 81 | * found in the LICENSE file at https://angular.io/license 82 | */ 83 | var et={provide:V,useExisting:e.forwardRef(function(){return ot})},rt=Promise.resolve(null),ot=function(t){function NgModel(r,o,n,i){var a=t.call(this)||this;return a._control=new K,a._registered=!1,a.update=new e.EventEmitter,a._parent=r,a._rawValidators=o||[],a._rawAsyncValidators=n||[],a.valueAccessor=selectValueAccessor(a,i),a}return a(NgModel,t),NgModel.prototype.ngOnChanges=function(t){this._checkForErrors(),this._registered||this._setUpControl(),"isDisabled"in t&&this._updateDisabled(t),isPropertyUpdated(t,this.viewModel)&&(this._updateValue(this.model),this.viewModel=this.model)},NgModel.prototype.ngOnDestroy=function(){this.formDirective&&this.formDirective.removeControl(this)},Object.defineProperty(NgModel.prototype,"control",{get:function(){return this._control},enumerable:!0,configurable:!0}),Object.defineProperty(NgModel.prototype,"path",{get:function(){return this._parent?controlPath(this.name,this._parent):[this.name]},enumerable:!0,configurable:!0}),Object.defineProperty(NgModel.prototype,"formDirective",{get:function(){return this._parent?this._parent.formDirective:null},enumerable:!0,configurable:!0}),Object.defineProperty(NgModel.prototype,"validator",{get:function(){return composeValidators(this._rawValidators)},enumerable:!0,configurable:!0}),Object.defineProperty(NgModel.prototype,"asyncValidator",{get:function(){return composeAsyncValidators(this._rawAsyncValidators)},enumerable:!0,configurable:!0}),NgModel.prototype.viewToModelUpdate=function(t){this.viewModel=t,this.update.emit(t)},NgModel.prototype._setUpControl=function(){this._isStandalone()?this._setUpStandalone():this.formDirective.addControl(this),this._registered=!0},NgModel.prototype._isStandalone=function(){return!this._parent||!(!this.options||!this.options.standalone)},NgModel.prototype._setUpStandalone=function(){setUpControl(this._control,this),this._control.updateValueAndValidity({emitEvent:!1})},NgModel.prototype._checkForErrors=function(){this._isStandalone()||this._checkParentType(),this._checkName()},NgModel.prototype._checkParentType=function(){!(this._parent instanceof tt)&&this._parent instanceof j?Q.formGroupNameException():this._parent instanceof tt||this._parent instanceof Y||Q.modelParentException()},NgModel.prototype._checkName=function(){this.options&&this.options.name&&(this.name=this.options.name),this._isStandalone()||this.name||Q.missingNameException()},NgModel.prototype._updateValue=function(t){var e=this;rt.then(function(){e.control.setValue(t,{emitViewToModelChange:!1})})},NgModel.prototype._updateDisabled=function(t){var e=this,r=t.isDisabled.currentValue,o=""===r||r&&"false"!==r;rt.then(function(){o&&!e.control.disabled?e.control.disable():!o&&e.control.disabled&&e.control.enable()})},NgModel}(V);ot.decorators=[{type:e.Directive,args:[{selector:"[ngModel]:not([formControlName]):not([formControl])",providers:[et],exportAs:"ngModel"}]}],ot.ctorParameters=function(){return[{type:l,decorators:[{type:e.Optional},{type:e.Host}]},{type:Array,decorators:[{type:e.Optional},{type:e.Self},{type:e.Inject,args:[u]}]},{type:Array,decorators:[{type:e.Optional},{type:e.Self},{type:e.Inject,args:[p]}]},{type:Array,decorators:[{type:e.Optional},{type:e.Self},{type:e.Inject,args:[f]}]}]},ot.propDecorators={name:[{type:e.Input}],isDisabled:[{type:e.Input,args:["disabled"]}],model:[{type:e.Input,args:["ngModel"]}],options:[{type:e.Input,args:["ngModelOptions"]}],update:[{type:e.Output,args:["ngModelChange"]}]};/** 84 | * @license 85 | * Copyright Google Inc. All Rights Reserved. 86 | * 87 | * Use of this source code is governed by an MIT-style license that can be 88 | * found in the LICENSE file at https://angular.io/license 89 | */ 90 | var nt=function(){function ReactiveErrors(){}return ReactiveErrors.controlParentException=function(){throw new Error("formControlName must be used with a parent formGroup directive. You'll want to add a formGroup\n directive and pass it an existing FormGroup instance (you can create one in your class).\n\n Example:\n\n "+J.formControlName)},ReactiveErrors.ngModelGroupException=function(){throw new Error('formControlName cannot be used with an ngModelGroup parent. It is only compatible with parents\n that also have a "form" prefix: formGroupName, formArrayName, or formGroup.\n\n Option 1: Update the parent to be formGroupName (reactive form strategy)\n\n '+J.formGroupName+"\n\n Option 2: Use ngModel instead of formControlName (template-driven strategy)\n\n "+J.ngModelGroup)},ReactiveErrors.missingFormException=function(){throw new Error("formGroup expects a FormGroup instance. Please pass one in.\n\n Example:\n\n "+J.formControlName)},ReactiveErrors.groupParentException=function(){throw new Error("formGroupName must be used with a parent formGroup directive. You'll want to add a formGroup\n directive and pass it an existing FormGroup instance (you can create one in your class).\n\n Example:\n\n "+J.formGroupName)},ReactiveErrors.arrayParentException=function(){throw new Error("formArrayName must be used with a parent formGroup directive. You'll want to add a formGroup\n directive and pass it an existing FormGroup instance (you can create one in your class).\n\n Example:\n\n "+J.formArrayName)},ReactiveErrors.disabledAttrWarning=function(){console.warn("\n It looks like you're using the disabled attribute with a reactive form directive. If you set disabled to true\n when you set up this control in your component class, the disabled attribute will actually be set in the DOM for\n you. We recommend using this approach to avoid 'changed after checked' errors.\n \n Example: \n form = new FormGroup({\n first: new FormControl({value: 'Nancy', disabled: true}, Validators.required),\n last: new FormControl('Drew', Validators.required)\n });\n ")},ReactiveErrors}(),it={provide:V,useExisting:e.forwardRef(function(){return at})},at=function(t){function FormControlDirective(r,o,n){var i=t.call(this)||this;return i.update=new e.EventEmitter,i._rawValidators=r||[],i._rawAsyncValidators=o||[],i.valueAccessor=selectValueAccessor(i,n),i}return a(FormControlDirective,t),Object.defineProperty(FormControlDirective.prototype,"isDisabled",{set:function(t){nt.disabledAttrWarning()},enumerable:!0,configurable:!0}),FormControlDirective.prototype.ngOnChanges=function(t){this._isControlChanged(t)&&(setUpControl(this.form,this),this.control.disabled&&this.valueAccessor.setDisabledState&&this.valueAccessor.setDisabledState(!0),this.form.updateValueAndValidity({emitEvent:!1})),isPropertyUpdated(t,this.viewModel)&&(this.form.setValue(this.model),this.viewModel=this.model)},Object.defineProperty(FormControlDirective.prototype,"path",{get:function(){return[]},enumerable:!0,configurable:!0}),Object.defineProperty(FormControlDirective.prototype,"validator",{get:function(){return composeValidators(this._rawValidators)},enumerable:!0,configurable:!0}),Object.defineProperty(FormControlDirective.prototype,"asyncValidator",{get:function(){return composeAsyncValidators(this._rawAsyncValidators)},enumerable:!0,configurable:!0}),Object.defineProperty(FormControlDirective.prototype,"control",{get:function(){return this.form},enumerable:!0,configurable:!0}),FormControlDirective.prototype.viewToModelUpdate=function(t){this.viewModel=t,this.update.emit(t)},FormControlDirective.prototype._isControlChanged=function(t){return t.hasOwnProperty("form")},FormControlDirective}(V);at.decorators=[{type:e.Directive,args:[{selector:"[formControl]",providers:[it],exportAs:"ngForm"}]}],at.ctorParameters=function(){return[{type:Array,decorators:[{type:e.Optional},{type:e.Self},{type:e.Inject,args:[u]}]},{type:Array,decorators:[{type:e.Optional},{type:e.Self},{type:e.Inject,args:[p]}]},{type:Array,decorators:[{type:e.Optional},{type:e.Self},{type:e.Inject,args:[f]}]}]},at.propDecorators={form:[{type:e.Input,args:["formControl"]}],model:[{type:e.Input,args:["ngModel"]}],update:[{type:e.Output,args:["ngModelChange"]}],isDisabled:[{type:e.Input,args:["disabled"]}]};/** 91 | * @license 92 | * Copyright Google Inc. All Rights Reserved. 93 | * 94 | * Use of this source code is governed by an MIT-style license that can be 95 | * found in the LICENSE file at https://angular.io/license 96 | */ 97 | var st={provide:l,useExisting:e.forwardRef(function(){return lt})},lt=function(t){function FormGroupDirective(r,o){var n=t.call(this)||this;return n._validators=r,n._asyncValidators=o,n._submitted=!1,n.directives=[],n.form=null,n.ngSubmit=new e.EventEmitter,n}return a(FormGroupDirective,t),FormGroupDirective.prototype.ngOnChanges=function(t){this._checkFormPresent(),t.hasOwnProperty("form")&&(this._updateValidators(),this._updateDomValue(),this._updateRegistrations())},Object.defineProperty(FormGroupDirective.prototype,"submitted",{get:function(){return this._submitted},enumerable:!0,configurable:!0}),Object.defineProperty(FormGroupDirective.prototype,"formDirective",{get:function(){return this},enumerable:!0,configurable:!0}),Object.defineProperty(FormGroupDirective.prototype,"control",{get:function(){return this.form},enumerable:!0,configurable:!0}),Object.defineProperty(FormGroupDirective.prototype,"path",{get:function(){return[]},enumerable:!0,configurable:!0}),FormGroupDirective.prototype.addControl=function(t){var e=this.form.get(t.path);return setUpControl(e,t),e.updateValueAndValidity({emitEvent:!1}),this.directives.push(t),e},FormGroupDirective.prototype.getControl=function(t){return this.form.get(t.path)},FormGroupDirective.prototype.removeControl=function(t){remove(this.directives,t)},FormGroupDirective.prototype.addFormGroup=function(t){var e=this.form.get(t.path);setUpFormContainer(e,t),e.updateValueAndValidity({emitEvent:!1})},FormGroupDirective.prototype.removeFormGroup=function(t){},FormGroupDirective.prototype.getFormGroup=function(t){return this.form.get(t.path)},FormGroupDirective.prototype.addFormArray=function(t){var e=this.form.get(t.path);setUpFormContainer(e,t),e.updateValueAndValidity({emitEvent:!1})},FormGroupDirective.prototype.removeFormArray=function(t){},FormGroupDirective.prototype.getFormArray=function(t){return this.form.get(t.path)},FormGroupDirective.prototype.updateModel=function(t,e){var r=this.form.get(t.path);r.setValue(e)},FormGroupDirective.prototype.onSubmit=function(t){return this._submitted=!0,this.ngSubmit.emit(t),!1},FormGroupDirective.prototype.onReset=function(){this.resetForm()},FormGroupDirective.prototype.resetForm=function(t){void 0===t&&(t=void 0),this.form.reset(t),this._submitted=!1},FormGroupDirective.prototype._updateDomValue=function(){var t=this;this.directives.forEach(function(e){var r=t.form.get(e.path);e._control!==r&&(cleanUpControl(e._control,e),r&&setUpControl(r,e),e._control=r)}),this.form._updateTreeValidity({emitEvent:!1})},FormGroupDirective.prototype._updateRegistrations=function(){var t=this;this.form._registerOnCollectionChange(function(){return t._updateDomValue()}),this._oldForm&&this._oldForm._registerOnCollectionChange(function(){}),this._oldForm=this.form},FormGroupDirective.prototype._updateValidators=function(){var t=composeValidators(this._validators);this.form.validator=h.compose([this.form.validator,t]);var e=composeAsyncValidators(this._asyncValidators);this.form.asyncValidator=h.composeAsync([this.form.asyncValidator,e])},FormGroupDirective.prototype._checkFormPresent=function(){this.form||nt.missingFormException()},FormGroupDirective}(l);lt.decorators=[{type:e.Directive,args:[{selector:"[formGroup]",providers:[st],host:{"(submit)":"onSubmit($event)","(reset)":"onReset()"},exportAs:"ngForm"}]}],lt.ctorParameters=function(){return[{type:Array,decorators:[{type:e.Optional},{type:e.Self},{type:e.Inject,args:[u]}]},{type:Array,decorators:[{type:e.Optional},{type:e.Self},{type:e.Inject,args:[p]}]}]},lt.propDecorators={form:[{type:e.Input,args:["formGroup"]}],ngSubmit:[{type:e.Output}]};/** 98 | * @license 99 | * Copyright Google Inc. All Rights Reserved. 100 | * 101 | * Use of this source code is governed by an MIT-style license that can be 102 | * found in the LICENSE file at https://angular.io/license 103 | */ 104 | var ct={provide:l,useExisting:e.forwardRef(function(){return ut})},ut=function(t){function FormGroupName(e,r,o){var n=t.call(this)||this;return n._parent=e,n._validators=r,n._asyncValidators=o,n}return a(FormGroupName,t),FormGroupName.prototype._checkParentType=function(){_hasInvalidParent(this._parent)&&nt.groupParentException()},FormGroupName}(j);ut.decorators=[{type:e.Directive,args:[{selector:"[formGroupName]",providers:[ct]}]}],ut.ctorParameters=function(){return[{type:l,decorators:[{type:e.Optional},{type:e.Host},{type:e.SkipSelf}]},{type:Array,decorators:[{type:e.Optional},{type:e.Self},{type:e.Inject,args:[u]}]},{type:Array,decorators:[{type:e.Optional},{type:e.Self},{type:e.Inject,args:[p]}]}]},ut.propDecorators={name:[{type:e.Input,args:["formGroupName"]}]};var pt={provide:l,useExisting:e.forwardRef(function(){return dt})},dt=function(t){function FormArrayName(e,r,o){var n=t.call(this)||this;return n._parent=e,n._validators=r,n._asyncValidators=o,n}return a(FormArrayName,t),FormArrayName.prototype.ngOnInit=function(){this._checkParentType(),this.formDirective.addFormArray(this)},FormArrayName.prototype.ngOnDestroy=function(){this.formDirective&&this.formDirective.removeFormArray(this)},Object.defineProperty(FormArrayName.prototype,"control",{get:function(){return this.formDirective.getFormArray(this)},enumerable:!0,configurable:!0}),Object.defineProperty(FormArrayName.prototype,"formDirective",{get:function(){return this._parent?this._parent.formDirective:null},enumerable:!0,configurable:!0}),Object.defineProperty(FormArrayName.prototype,"path",{get:function(){return controlPath(this.name,this._parent)},enumerable:!0,configurable:!0}),Object.defineProperty(FormArrayName.prototype,"validator",{get:function(){return composeValidators(this._validators)},enumerable:!0,configurable:!0}),Object.defineProperty(FormArrayName.prototype,"asyncValidator",{get:function(){return composeAsyncValidators(this._asyncValidators)},enumerable:!0,configurable:!0}),FormArrayName.prototype._checkParentType=function(){_hasInvalidParent(this._parent)&&nt.arrayParentException()},FormArrayName}(l);dt.decorators=[{type:e.Directive,args:[{selector:"[formArrayName]",providers:[pt]}]}],dt.ctorParameters=function(){return[{type:l,decorators:[{type:e.Optional},{type:e.Host},{type:e.SkipSelf}]},{type:Array,decorators:[{type:e.Optional},{type:e.Self},{type:e.Inject,args:[u]}]},{type:Array,decorators:[{type:e.Optional},{type:e.Self},{type:e.Inject,args:[p]}]}]},dt.propDecorators={name:[{type:e.Input,args:["formArrayName"]}]};/** 105 | * @license 106 | * Copyright Google Inc. All Rights Reserved. 107 | * 108 | * Use of this source code is governed by an MIT-style license that can be 109 | * found in the LICENSE file at https://angular.io/license 110 | */ 111 | var ht={provide:V,useExisting:e.forwardRef(function(){return ft})},ft=function(t){function FormControlName(r,o,n,i){var a=t.call(this)||this;return a._added=!1,a.update=new e.EventEmitter,a._parent=r,a._rawValidators=o||[],a._rawAsyncValidators=n||[],a.valueAccessor=selectValueAccessor(a,i),a}return a(FormControlName,t),Object.defineProperty(FormControlName.prototype,"isDisabled",{set:function(t){nt.disabledAttrWarning()},enumerable:!0,configurable:!0}),FormControlName.prototype.ngOnChanges=function(t){this._added||this._setUpControl(),isPropertyUpdated(t,this.viewModel)&&(this.viewModel=this.model,this.formDirective.updateModel(this,this.model))},FormControlName.prototype.ngOnDestroy=function(){this.formDirective&&this.formDirective.removeControl(this)},FormControlName.prototype.viewToModelUpdate=function(t){this.viewModel=t,this.update.emit(t)},Object.defineProperty(FormControlName.prototype,"path",{get:function(){return controlPath(this.name,this._parent)},enumerable:!0,configurable:!0}),Object.defineProperty(FormControlName.prototype,"formDirective",{get:function(){return this._parent?this._parent.formDirective:null},enumerable:!0,configurable:!0}),Object.defineProperty(FormControlName.prototype,"validator",{get:function(){return composeValidators(this._rawValidators)},enumerable:!0,configurable:!0}),Object.defineProperty(FormControlName.prototype,"asyncValidator",{get:function(){return composeAsyncValidators(this._rawAsyncValidators)},enumerable:!0,configurable:!0}),Object.defineProperty(FormControlName.prototype,"control",{get:function(){return this._control},enumerable:!0,configurable:!0}),FormControlName.prototype._checkParentType=function(){!(this._parent instanceof ut)&&this._parent instanceof j?nt.ngModelGroupException():this._parent instanceof ut||this._parent instanceof lt||this._parent instanceof dt||nt.controlParentException()},FormControlName.prototype._setUpControl=function(){this._checkParentType(),this._control=this.formDirective.addControl(this),this.control.disabled&&this.valueAccessor.setDisabledState&&this.valueAccessor.setDisabledState(!0),this._added=!0},FormControlName}(V);ft.decorators=[{type:e.Directive,args:[{selector:"[formControlName]",providers:[ht]}]}],ft.ctorParameters=function(){return[{type:l,decorators:[{type:e.Optional},{type:e.Host},{type:e.SkipSelf}]},{type:Array,decorators:[{type:e.Optional},{type:e.Self},{type:e.Inject,args:[u]}]},{type:Array,decorators:[{type:e.Optional},{type:e.Self},{type:e.Inject,args:[p]}]},{type:Array,decorators:[{type:e.Optional},{type:e.Self},{type:e.Inject,args:[f]}]}]},ft.propDecorators={name:[{type:e.Input,args:["formControlName"]}],model:[{type:e.Input,args:["ngModel"]}],update:[{type:e.Output,args:["ngModelChange"]}],isDisabled:[{type:e.Input,args:["disabled"]}]};/** 112 | * @license 113 | * Copyright Google Inc. All Rights Reserved. 114 | * 115 | * Use of this source code is governed by an MIT-style license that can be 116 | * found in the LICENSE file at https://angular.io/license 117 | */ 118 | var mt={provide:u,useExisting:e.forwardRef(function(){return gt}),multi:!0},yt={provide:u,useExisting:e.forwardRef(function(){return vt}),multi:!0},gt=function(){function RequiredValidator(){}return Object.defineProperty(RequiredValidator.prototype,"required",{get:function(){return this._required},set:function(t){this._required=null!=t&&t!==!1&&""+t!="false",this._onChange&&this._onChange()},enumerable:!0,configurable:!0}),RequiredValidator.prototype.validate=function(t){return this.required?h.required(t):null},RequiredValidator.prototype.registerOnValidatorChange=function(t){this._onChange=t},RequiredValidator}();gt.decorators=[{type:e.Directive,args:[{selector:":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]",providers:[mt],host:{"[attr.required]":'required ? "" : null'}}]}],gt.ctorParameters=function(){return[]},gt.propDecorators={required:[{type:e.Input}]};var vt=function(t){function CheckboxRequiredValidator(){return null!==t&&t.apply(this,arguments)||this}return a(CheckboxRequiredValidator,t),CheckboxRequiredValidator.prototype.validate=function(t){return this.required?h.requiredTrue(t):null},CheckboxRequiredValidator}(gt);vt.decorators=[{type:e.Directive,args:[{selector:"input[type=checkbox][required][formControlName],input[type=checkbox][required][formControl],input[type=checkbox][required][ngModel]",providers:[yt],host:{"[attr.required]":'required ? "" : null'}}]}],vt.ctorParameters=function(){return[]};var bt={provide:u,useExisting:e.forwardRef(function(){return _t}),multi:!0},_t=function(){function EmailValidator(){}return Object.defineProperty(EmailValidator.prototype,"email",{set:function(t){this._enabled=""===t||t===!0||"true"===t,this._onChange&&this._onChange()},enumerable:!0,configurable:!0}),EmailValidator.prototype.validate=function(t){return this._enabled?h.email(t):null},EmailValidator.prototype.registerOnValidatorChange=function(t){this._onChange=t},EmailValidator}();_t.decorators=[{type:e.Directive,args:[{selector:"[email][formControlName],[email][formControl],[email][ngModel]",providers:[bt]}]}],_t.ctorParameters=function(){return[]},_t.propDecorators={email:[{type:e.Input}]};var Ct={provide:u,useExisting:e.forwardRef(function(){return Vt}),multi:!0},Vt=function(){function MinLengthValidator(){}return MinLengthValidator.prototype.ngOnChanges=function(t){"minlength"in t&&(this._createValidator(),this._onChange&&this._onChange())},MinLengthValidator.prototype.validate=function(t){return null==this.minlength?null:this._validator(t)},MinLengthValidator.prototype.registerOnValidatorChange=function(t){this._onChange=t},MinLengthValidator.prototype._createValidator=function(){this._validator=h.minLength(parseInt(this.minlength,10))},MinLengthValidator}();Vt.decorators=[{type:e.Directive,args:[{selector:"[minlength][formControlName],[minlength][formControl],[minlength][ngModel]",providers:[Ct],host:{"[attr.minlength]":"minlength ? minlength : null"}}]}],Vt.ctorParameters=function(){return[]},Vt.propDecorators={minlength:[{type:e.Input}]};var At={provide:u,useExisting:e.forwardRef(function(){return Ot}),multi:!0},Ot=function(){function MaxLengthValidator(){}return MaxLengthValidator.prototype.ngOnChanges=function(t){"maxlength"in t&&(this._createValidator(),this._onChange&&this._onChange())},MaxLengthValidator.prototype.validate=function(t){return null!=this.maxlength?this._validator(t):null},MaxLengthValidator.prototype.registerOnValidatorChange=function(t){this._onChange=t},MaxLengthValidator.prototype._createValidator=function(){this._validator=h.maxLength(parseInt(this.maxlength,10))},MaxLengthValidator}();Ot.decorators=[{type:e.Directive,args:[{selector:"[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]",providers:[At],host:{"[attr.maxlength]":"maxlength ? maxlength : null"}}]}],Ot.ctorParameters=function(){return[]},Ot.propDecorators={maxlength:[{type:e.Input}]};var Dt={provide:u,useExisting:e.forwardRef(function(){return Et}),multi:!0},Et=function(){function PatternValidator(){}return PatternValidator.prototype.ngOnChanges=function(t){"pattern"in t&&(this._createValidator(),this._onChange&&this._onChange())},PatternValidator.prototype.validate=function(t){return this._validator(t)},PatternValidator.prototype.registerOnValidatorChange=function(t){this._onChange=t},PatternValidator.prototype._createValidator=function(){this._validator=h.pattern(this.pattern)},PatternValidator}();Et.decorators=[{type:e.Directive,args:[{selector:"[pattern][formControlName],[pattern][formControl],[pattern][ngModel]",providers:[Dt],host:{"[attr.pattern]":"pattern ? pattern : null"}}]}],Et.ctorParameters=function(){return[]},Et.propDecorators={pattern:[{type:e.Input}]};/** 119 | * @license 120 | * Copyright Google Inc. All Rights Reserved. 121 | * 122 | * Use of this source code is governed by an MIT-style license that can be 123 | * found in the LICENSE file at https://angular.io/license 124 | */ 125 | var Mt=function(){function FormBuilder(){}return FormBuilder.prototype.group=function(t,e){void 0===e&&(e=null);var r=this._reduceControls(t),o=null!=e?e.validator:null,n=null!=e?e.asyncValidator:null;return new H(r,o,n)},FormBuilder.prototype.control=function(t,e,r){return new K(t,e,r)},FormBuilder.prototype.array=function(t,e,r){var o=this,n=t.map(function(t){return o._createControl(t)});return new W(n,e,r)},FormBuilder.prototype._reduceControls=function(t){var e=this,r={};return Object.keys(t).forEach(function(o){r[o]=e._createControl(t[o])}),r},FormBuilder.prototype._createControl=function(t){if(t instanceof K||t instanceof H||t instanceof W)return t;if(Array.isArray(t)){var e=t[0],r=t.length>1?t[1]:null,o=t.length>2?t[2]:null;return this.control(e,r,o)}return this.control(t)},FormBuilder}();Mt.decorators=[{type:e.Injectable}],Mt.ctorParameters=function(){return[]};/** 126 | * @license 127 | * Copyright Google Inc. All Rights Reserved. 128 | * 129 | * Use of this source code is governed by an MIT-style license that can be 130 | * found in the LICENSE file at https://angular.io/license 131 | */ 132 | var Ft=new e.Version("4.1.1"),Nt=function(){function NgNoValidate(){}return NgNoValidate}();Nt.decorators=[{type:e.Directive,args:[{selector:"form:not([ngNoForm]):not([ngNativeValidate])",host:{novalidate:""}}]}],Nt.ctorParameters=function(){return[]};/** 133 | * @license 134 | * Copyright Google Inc. All Rights Reserved. 135 | * 136 | * Use of this source code is governed by an MIT-style license that can be 137 | * found in the LICENSE file at https://angular.io/license 138 | */ 139 | var Pt=[Nt,P,S,b,C,M,y,N,w,D,I,T,gt,Vt,Ot,Et,vt,_t],kt=[ot,tt,Y],wt=[at,lt,ft,ut,dt],St=function(){function InternalFormsSharedModule(){}return InternalFormsSharedModule}();St.decorators=[{type:e.NgModule,args:[{declarations:Pt,exports:Pt}]}],St.ctorParameters=function(){return[]};/** 140 | * @license 141 | * Copyright Google Inc. All Rights Reserved. 142 | * 143 | * Use of this source code is governed by an MIT-style license that can be 144 | * found in the LICENSE file at https://angular.io/license 145 | */ 146 | var Gt=function(){function FormsModule(){}return FormsModule}();Gt.decorators=[{type:e.NgModule,args:[{declarations:kt,providers:[O],exports:[St,kt]}]}],Gt.ctorParameters=function(){return[]};var jt=function(){function ReactiveFormsModule(){}return ReactiveFormsModule}();jt.decorators=[{type:e.NgModule,args:[{declarations:[wt],providers:[Mt,O],exports:[St,wt]}]}],jt.ctorParameters=function(){return[]},t.AbstractControlDirective=s,t.AbstractFormGroupDirective=j,t.CheckboxControlValueAccessor=y,t.ControlContainer=l,t.NG_VALUE_ACCESSOR=f,t.COMPOSITION_BUFFER_MODE=v,t.DefaultValueAccessor=b,t.NgControl=V,t.NgControlStatus=I,t.NgControlStatusGroup=T,t.NgForm=Y,t.NgModel=ot,t.NgModelGroup=tt,t.RadioControlValueAccessor=D,t.FormControlDirective=at,t.FormControlName=ft,t.FormGroupDirective=lt,t.FormArrayName=dt,t.FormGroupName=ut,t.NgSelectOption=P,t.SelectControlValueAccessor=N,t.SelectMultipleControlValueAccessor=w,t.CheckboxRequiredValidator=vt,t.EmailValidator=_t,t.MaxLengthValidator=Ot,t.MinLengthValidator=Vt,t.PatternValidator=Et,t.RequiredValidator=gt,t.FormBuilder=Mt,t.AbstractControl=$,t.FormArray=W,t.FormControl=K,t.FormGroup=H,t.NG_ASYNC_VALIDATORS=p,t.NG_VALIDATORS=u,t.Validators=h,t.VERSION=Ft,t.FormsModule=Gt,t.ReactiveFormsModule=jt,t.ɵba=St,t.ɵz=wt,t.ɵx=Pt,t.ɵy=kt,t.ɵa=m,t.ɵb=g,t.ɵc=R,t.ɵd=x,t.ɵe=z,t.ɵf=et,t.ɵg=X,t.ɵbf=Nt,t.ɵbb=_,t.ɵbc=C,t.ɵh=A,t.ɵi=O,t.ɵbd=E,t.ɵbe=M,t.ɵj=it,t.ɵk=ht,t.ɵl=st,t.ɵn=pt,t.ɵm=ct,t.ɵo=F,t.ɵq=S,t.ɵp=k,t.ɵs=yt,t.ɵt=bt,t.ɵv=At,t.ɵu=Ct,t.ɵw=Dt,t.ɵr=mt,Object.defineProperty(t,"__esModule",{value:!0})})},46:function(t,e,r){"use strict";var o=this&&this.__decorate||function(t,e,r,o){var n,i=arguments.length,a=i<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,r,o);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(a=(i<3?n(a):i>3?n(e,r,a):n(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},n=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};Object.defineProperty(e,"__esModule",{value:!0});var i=r(3),a=r(40),s=function(){function AppComponent(t){this.formBuilder=t,this.date2=new Date(2016,5,10),this.datepickerOpts={startDate:new Date(2016,5,10),autoclose:!0,todayBtn:"linked",todayHighlight:!0,assumeNearbyYear:!0,format:"D, d MM yyyy"},this.date5=new Date,this.date6=new Date,this.datepickerToOpts={}}return AppComponent.prototype.ngOnInit=function(){this.form=this.formBuilder.group({date:[new Date(1991,8,12)]})},AppComponent.prototype.handleDateFromChange=function(t){this.dateFrom=t,this.datepickerToOpts={startDate:t}},AppComponent.prototype.getDate=function(t){return t&&t.getTime()},AppComponent}();s=o([i.Component({selector:"my-app",template:r(47)}),n("design:paramtypes",[a.FormBuilder])],s),e.AppComponent=s},47:function(t,e){t.exports='
\r\n \r\n
\r\n
\r\n

\r\n Default behaviour (plugins default options)\r\n

\r\n
\r\n
\r\n
<datetime [(ngModel)]="date"></datetime>
\r\n
\r\n \r\n
\r\n
ngModel: {{getDate(form.get(\'date\').value) | date: "medium"}}
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n

\r\n Disable datepicker\r\n

\r\n
\r\n
\r\n
<datetime [datepicker]="false" [(ngModel)]="date3"></datetime>
\r\n \r\n
ngModel: {{getDate(date3) | date: "medium"}}
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n

\r\n Disable timepicker\r\n

\r\n
\r\n
\r\n
<datetime [timepicker]="false" [(ngModel)]="date3"></datetime>
\r\n \r\n
ngModel: {{getDate(date3) | date: "medium"}}
\r\n
\r\n
\r\n
\r\n
\r\n

Options

\r\n
\r\n
\r\n
\r\n

\r\n Component options:\r\n

\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
Option (default)Description
hasClearButton (false)clear button
readonly (false)adds the readonly property to the datepicker input and sets the\r\n \r\n enableOnReadonly option\r\n \r\n
\r\n
\r\n
\r\n

\r\n Datepicker\r\n \r\n all plugin options \r\n + above:\r\n

\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
Option (default)Description
icon (glyphicon glyphicon-th)datepicker button icon
placeholderdatepicker input placeholder (\'Choose date\')
\r\n
\r\n
\r\n

\r\n Timepicker\r\n \r\n all plugin options \r\n + above:\r\n

\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
Option (default)Description
icon (glyphicon glyphicon-time)timepicker button icon
placeholder (\'Set time\')timepicker input placeholder
\r\n
\r\n
\r\n
\r\n
\r\n

Setting options

\r\n
\r\n
<datetime [timepicker]="{ showMeridian: false, minuteStep: 1 }" [datepicker]="datepickerOpts" [(ngModel)]="date2"></datetime>
\r\n In your component:
\r\n
date2: Date = new Date(2016, 5, 10);\r\ndatepickerOpts = {\r\n    startDate: new Date(2016, 5, 10),\r\n    autoclose: true,\r\n    todayBtn: \'linked\',\r\n    todayHighlight: true,\r\n    assumeNearbyYear: true,\r\n    format: \'D, d MM yyyy\'\r\n}
\r\n \r\n
ngModel: {{getDate(date2) | date: "medium"}}
\r\n
\r\n
\r\n
\r\n
\r\n

\r\n Buttons icons (FontAwesome)\r\n

\r\n
\r\n
\r\n
<datetime [(ngModel)]="date4" [timepicker]="{ icon: \'fa fa-clock-o\' }" [datepicker]="{ icon: \'fa fa-calendar\' }"></datetime>
\r\n \r\n
ngModel: {{getDate(date4) | date: "medium"}}
\r\n
\r\n
\r\n

Examples

\r\n
\r\n

From-To

\r\n
\r\n
<datetime [ngModel]="dateFrom" (ngModelChange)="handleDateFromChange($event)" [timepicker]="false"></datetime>
\r\n
<datetime [(ngModel)]="dateTo" [timepicker]="false" [datepicker]="datepickerToOpts"></datetime>
\r\n \r\n \r\n
dateFrom: {{getDate(dateFrom) | date: "medium"}}
\r\n
dateTo: {{getDate(dateTo) | date: "medium"}}
\r\n
\r\n
\r\n
\r\n

Clear button

\r\n
\r\n
<datetime [(ngModel)]="date5" [hasClearButton]="true"></datetime>
\r\n \r\n
ngModel: {{getDate(date5) | date: "medium"}}
\r\n
\r\n
\r\n
\r\n

Readonly

\r\n
\r\n
<datetime [(ngModel)]="date6" [readonly]="true" [timepicker]="false"></datetime>
\r\n \r\n
ngModel: {{getDate(date6) | date: "medium"}}
\r\n
\r\n
\r\n
'},48:function(t,e,r){"use strict";var o=this&&this.__decorate||function(t,e,r,o){var n,i=arguments.length,a=i<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,r,o);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(a=(i<3?n(a):i>3?n(e,r,a):n(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a};Object.defineProperty(e,"__esModule",{value:!0});var n=r(3),i=r(37),a=r(40),s=r(49),l=function(){function NKDatetimeModule(){}return NKDatetimeModule}();l=o([n.NgModule({imports:[i.CommonModule,a.FormsModule,a.ReactiveFormsModule],exports:[s.NKDatetime],declarations:[s.NKDatetime]})],l),e.NKDatetimeModule=l},49:function(t,e,r){(function(t,o){"use strict";function uniqueId(t){return t+ ++u}function isDate(t){return"[object Date]"===Object.prototype.toString.call(t)}var n=this&&this.__decorate||function(t,e,r,o){var n,i=arguments.length,a=i<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,r,o);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(a=(i<3?n(a):i>3?n(e,r,a):n(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},i=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};Object.defineProperty(e,"__esModule",{value:!0});var a=r(3),s=r(40),l={provide:s.NG_VALUE_ACCESSOR,useExisting:a.forwardRef(function(){return c}),multi:!0},c=function(){function NKDatetime(){this.timepickerOptions={},this.datepickerOptions={},this.idDatePicker=uniqueId("q-datepicker_"),this.idTimePicker=uniqueId("q-timepicker_"),this.onChange=function(t){},this.onTouched=function(){}}return Object.defineProperty(NKDatetime.prototype,"tabindexAttr",{get:function(){return void 0===this.tabindex?"-1":void 0},enumerable:!0,configurable:!0}),NKDatetime.prototype.ngAfterViewInit=function(){this.init()},NKDatetime.prototype.ngOnDestroy=function(){this.datepicker&&this.datepicker.datepicker("destroy"),this.timepicker&&this.timepicker.timepicker("remove")},NKDatetime.prototype.ngOnChanges=function(t){t&&(t.datepickerOptions&&this.datepicker&&(this.datepicker.datepicker("destroy"),t.datepickerOptions.currentValue?(this.datepicker=null,this.init()):t.datepickerOptions.currentValue===!1&&this.datepicker.remove()),t.timepickerOptions&&this.timepicker&&(this.timepicker.timepicker("remove"),t.timepickerOptions.currentValue?(this.timepicker=null,this.init()):t.timepickerOptions.currentValue===!1&&this.timepicker.parent().remove()))},NKDatetime.prototype.writeValue=function(t){var e=this;this.date=t,isDate(this.date)?setTimeout(function(){e.updateModel(e.date)},0):this.clearModels()},NKDatetime.prototype.registerOnChange=function(t){this.onChange=t},NKDatetime.prototype.registerOnTouched=function(t){this.onTouched=t},NKDatetime.prototype.checkEmptyValue=function(t){var e=t.target.value;""===e&&(this.timepickerOptions===!1||this.datepickerOptions===!1||""===this.timeModel&&""===this.dateModel)&&this.onChange(void 0)},NKDatetime.prototype.clearModels=function(){this.onChange(void 0),this.timepicker&&this.timepicker.timepicker("setTime",null),this.updateDatepicker(null)},NKDatetime.prototype.showTimepicker=function(){this.timepicker.timepicker("showWidget")},NKDatetime.prototype.showDatepicker=function(){this.datepicker.datepicker("show")},NKDatetime.prototype.init=function(){var e=this;if(this.datepicker||this.datepickerOptions===!1)this.datepickerOptions===!1&&o("#"+this.idDatePicker).remove();else{var r=t.extend({enableOnReadonly:!this.readonly},this.datepickerOptions);this.datepicker=o("#"+this.idDatePicker).datepicker(r),this.datepicker.on("changeDate",function(t){var r=t.date;isDate(e.date)&&isDate(r)&&(r.setHours(e.date.getHours()),r.setMinutes(e.date.getMinutes()),r.setSeconds(e.date.getSeconds())),e.date=r,e.onChange(r)})}if(this.timepicker||this.timepickerOptions===!1)this.timepickerOptions===!1&&o("#"+this.idTimePicker).parent().remove();else{var r=t.extend({defaultTime:!1},this.timepickerOptions);this.timepicker=o("#"+this.idTimePicker).timepicker(r),this.timepicker.on("changeTime.timepicker",function(t){var r=t.time,o=r.meridian,n=r.hours;o&&("PM"===o&&n<12&&(n+=12),"AM"===o&&12===n&&(n-=12),n=parseInt(e.pad(n))),isDate(e.date)||(e.date=new Date,e.updateDatepicker(e.date)),e.date.setHours(n),e.date.setMinutes(t.time.minutes),e.date.setSeconds(t.time.seconds),e.onChange(e.date)})}this.updateModel(this.date)},NKDatetime.prototype.updateModel=function(t){if(this.updateDatepicker(t),void 0!==this.timepicker&&isDate(t)){var e=t.getHours();this.timepickerOptions.showMeridian&&(e=0===e||12===e?12:e%12);var r=t.getHours()>=12?" PM":" AM",o=this.pad(e)+":"+this.pad(this.date.getMinutes())+":"+this.pad(this.date.getSeconds())+(this.timepickerOptions.showMeridian||void 0===this.timepickerOptions.showMeridian?r:"");this.timepicker.timepicker("setTime",o),this.timeModel=o}},NKDatetime.prototype.updateDatepicker=function(t){void 0!==this.datepicker&&this.datepicker.datepicker("update",t)},NKDatetime.prototype.pad=function(t){return t.toString().length<2?"0"+t:t.toString()},NKDatetime}();n([a.Input("timepicker"),i("design:type",Object)],c.prototype,"timepickerOptions",void 0),n([a.Input("datepicker"),i("design:type",Object)],c.prototype,"datepickerOptions",void 0),n([a.Input("hasClearButton"),i("design:type",Boolean)],c.prototype,"hasClearButton",void 0),n([a.Input(),i("design:type",Boolean)],c.prototype,"readonly",void 0),n([a.Input(),i("design:type",Boolean)],c.prototype,"required",void 0),n([a.Input(),i("design:type",String)],c.prototype,"tabindex",void 0),n([a.HostListener("blur"),i("design:type",Object)],c.prototype,"onTouched",void 0),n([a.HostBinding("attr.tabindex"),i("design:type",String),i("design:paramtypes",[])],c.prototype,"tabindexAttr",null),c=n([a.Component({selector:"datetime",providers:[l],template:'\n
\n
\n \n
\n \n
\n
\n
\n \n \n \n \n
\n \n
\n ',styles:[".ng2-datetime *[hidden] { display: none; }"]})],c),e.NKDatetime=c;var u=0}).call(e,r(50),r(50))}}); 147 | //# sourceMappingURL=app.142434dec34b45bd91ad.js.map -------------------------------------------------------------------------------- /dist/assets/glyphicons-halflings-regular.448c34a56d699c29117adc64c43affeb.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkalinov/ng2-datetime/8685c1f76d40b77c2a2f0c15a0ea92c677e74809/dist/assets/glyphicons-halflings-regular.448c34a56d699c29117adc64c43affeb.woff2 -------------------------------------------------------------------------------- /dist/assets/glyphicons-halflings-regular.e18bbf611f2a2e43afc071aa2f4e1512.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkalinov/ng2-datetime/8685c1f76d40b77c2a2f0c15a0ea92c677e74809/dist/assets/glyphicons-halflings-regular.e18bbf611f2a2e43afc071aa2f4e1512.ttf -------------------------------------------------------------------------------- /dist/assets/glyphicons-halflings-regular.f4769f9bdb7466be65088239c12046d1.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkalinov/ng2-datetime/8685c1f76d40b77c2a2f0c15a0ea92c677e74809/dist/assets/glyphicons-halflings-regular.f4769f9bdb7466be65088239c12046d1.eot -------------------------------------------------------------------------------- /dist/assets/glyphicons-halflings-regular.fa2772327f55d8198301fdb8bcfc8158.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nkalinov/ng2-datetime/8685c1f76d40b77c2a2f0c15a0ea92c677e74809/dist/assets/glyphicons-halflings-regular.fa2772327f55d8198301fdb8bcfc8158.woff -------------------------------------------------------------------------------- /dist/index.html: -------------------------------------------------------------------------------- 1 | ng2-datetime Fork me on GitHub Loading... -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | ng2-datetime 4 | 5 | 7 | 8 | 9 | 10 | 11 | 12 | Fork me on GitHub 16 | 17 | Loading... 18 | 19 | 20 | -------------------------------------------------------------------------------- /karma.conf.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./config/karma.conf.js'); -------------------------------------------------------------------------------- /ng2-datetime.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var ng2_datetime_1 = require("./src/ng2-datetime/ng2-datetime"); 4 | exports.NKDatetime = ng2_datetime_1.NKDatetime; 5 | var ng2_datetime_module_1 = require("./src/ng2-datetime/ng2-datetime.module"); 6 | exports.NKDatetimeModule = ng2_datetime_module_1.NKDatetimeModule; 7 | //# sourceMappingURL=ng2-datetime.js.map -------------------------------------------------------------------------------- /ng2-datetime.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"ng2-datetime.js","sourceRoot":"","sources":["ng2-datetime.ts"],"names":[],"mappings":";;AAAA,gEAA6D;AAApD,oCAAA,UAAU,CAAA;AACnB,8EAA0E;AAAjE,iDAAA,gBAAgB,CAAA"} -------------------------------------------------------------------------------- /ng2-datetime.ts: -------------------------------------------------------------------------------- 1 | export { NKDatetime } from './src/ng2-datetime/ng2-datetime'; 2 | export { NKDatetimeModule } from './src/ng2-datetime/ng2-datetime.module'; 3 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ng2-datetime", 3 | "version": "1.4.0", 4 | "description": "Bootstrap datetime picker for Angular", 5 | "main": "ng2-datetime.js", 6 | "typings": "ng2-datetime.d.ts", 7 | "keywords": [ 8 | "angular2", 9 | "ng2", 10 | "bootstrap", 11 | "date", 12 | "time", 13 | "datetime", 14 | "picker" 15 | ], 16 | "author": "Nikola Kalinov (http://nkalinov.com)", 17 | "scripts": { 18 | "start": "webpack-dev-server --inline --progress --port 8080", 19 | "test": "karma start", 20 | "tsc": "tsc", 21 | "build": "rimraf dist && webpack --config config/webpack.prod.js --progress --profile --bail && npm run tsc" 22 | }, 23 | "license": "MIT", 24 | "repository": { 25 | "type": "git", 26 | "url": "https://github.com/nkalinov/ng2-datetime.git" 27 | }, 28 | "dependencies": { 29 | "bootstrap": ">=3.0.0", 30 | "bootstrap-datepicker": "1.7.0-RC1", 31 | "bootstrap-timepicker": "^0.5.2", 32 | "jquery": ">=2.2.1" 33 | }, 34 | "devDependencies": { 35 | "@angular/common": "^4.0.3", 36 | "@angular/compiler": "^4.0.3", 37 | "@angular/core": "^4.0.3", 38 | "@angular/forms": "^4.0.3", 39 | "@angular/platform-browser": "^4.0.3", 40 | "@angular/platform-browser-dynamic": "^4.0.3", 41 | "@types/core-js": "^0.9.35", 42 | "@types/jasmine": "^2.5.40", 43 | "@types/jquery": "^2.0.37", 44 | "@types/node": "^6.0.55", 45 | "angular2-template-loader": "^0.4.0", 46 | "awesome-typescript-loader": "^3.1.2", 47 | "core-js": "^2.4.1", 48 | "css-loader": "^0.23.1", 49 | "extract-text-webpack-plugin": "^1.0.1", 50 | "file-loader": "^0.8.5", 51 | "html-loader": "^0.4.3", 52 | "html-webpack-plugin": "^2.25.0", 53 | "jasmine-core": "^2.4.1", 54 | "karma": "^1.2.0", 55 | "karma-jasmine": "^1.1.0", 56 | "karma-phantomjs-launcher": "^1.0.2", 57 | "karma-sourcemap-loader": "^0.3.7", 58 | "karma-webpack": "^1.8.1", 59 | "null-loader": "^0.1.1", 60 | "phantomjs-prebuilt": "^2.1.14", 61 | "raw-loader": "^0.5.1", 62 | "reflect-metadata": "^0.1.9", 63 | "rimraf": "^2.5.2", 64 | "rxjs": "^5.0.2", 65 | "style-loader": "^0.13.1", 66 | "tslint": "^4.5.1", 67 | "typescript": "^2.2.2", 68 | "webpack": "^1.14.0", 69 | "webpack-dev-server": "^1.14.1", 70 | "webpack-merge": "^0.14.0", 71 | "zone.js": "^0.8.4" 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/app/app.component.html: -------------------------------------------------------------------------------- 1 |
2 | 7 |
8 |
9 |

10 | Default behaviour (plugins default options) 11 |

12 |
13 |
14 |
<datetime [(ngModel)]="date"></datetime>
15 |
16 | 17 |
18 |
ngModel: {{getDate(form.get('date').value) | date: "medium"}}
19 |
20 |
21 |
22 |
23 |
24 |
25 |

26 | Disable datepicker 27 |

28 |
29 |
30 |
<datetime [datepicker]="false" [(ngModel)]="date3"></datetime>
31 | 32 |
ngModel: {{getDate(date3) | date: "medium"}}
33 |
34 |
35 |
36 |
37 |
38 |
39 |

40 | Disable timepicker 41 |

42 |
43 |
44 |
<datetime [timepicker]="false" [(ngModel)]="date3"></datetime>
45 | 46 |
ngModel: {{getDate(date3) | date: "medium"}}
47 |
48 |
49 |
50 |
51 |

Options

52 |
53 |
54 |
55 |

56 | Component options: 57 |

58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 75 | 76 |
Option (default)Description
hasClearButton (false)clear button
readonly (false)adds the readonly property to the datepicker input and sets the 70 | 72 | enableOnReadonly option 73 | 74 |
77 |
78 |
79 |

80 | Datepicker 81 | 82 | all plugin options 83 | + above: 84 |

85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 |
Option (default)Description
icon (glyphicon glyphicon-th)datepicker button icon
placeholderdatepicker input placeholder ('Choose date')
99 |
100 |
101 |

102 | Timepicker 103 | 104 | all plugin options 105 | + above: 106 |

107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 |
Option (default)Description
icon (glyphicon glyphicon-time)timepicker button icon
placeholder ('Set time')timepicker input placeholder
121 |
122 |
123 |
124 |
125 |

Setting options

126 |
127 |
<datetime [timepicker]="{ showMeridian: false, minuteStep: 1 }" [datepicker]="datepickerOpts" [(ngModel)]="date2"></datetime>
128 | In your component:
129 |
date2: Date = new Date(2016, 5, 10);
130 | datepickerOpts = {
131 |     startDate: new Date(2016, 5, 10),
132 |     autoclose: true,
133 |     todayBtn: 'linked',
134 |     todayHighlight: true,
135 |     assumeNearbyYear: true,
136 |     format: 'D, d MM yyyy'
137 | }
138 | 141 |
ngModel: {{getDate(date2) | date: "medium"}}
142 |
143 |
144 |
145 |
146 |

147 | Buttons icons (FontAwesome) 148 |

149 |
150 |
151 |
<datetime [(ngModel)]="date4" [timepicker]="{ icon: 'fa fa-clock-o' }" [datepicker]="{ icon: 'fa fa-calendar' }"></datetime>
152 | 154 |
ngModel: {{getDate(date4) | date: "medium"}}
155 |
156 |
157 |

Examples

158 |
159 |

From-To

160 |
161 |
<datetime [ngModel]="dateFrom" (ngModelChange)="handleDateFromChange($event)" [timepicker]="false"></datetime>
162 |
<datetime [(ngModel)]="dateTo" [timepicker]="false" [datepicker]="datepickerToOpts"></datetime>
163 | 167 | 170 |
dateFrom: {{getDate(dateFrom) | date: "medium"}}
171 |
dateTo: {{getDate(dateTo) | date: "medium"}}
172 |
173 |
174 |
175 |

Clear button

176 |
177 |
<datetime [(ngModel)]="date5" [hasClearButton]="true"></datetime>
178 | 179 |
ngModel: {{getDate(date5) | date: "medium"}}
180 |
181 |
182 |
183 |

Readonly

184 |
185 |
<datetime [(ngModel)]="date6" [readonly]="true" [timepicker]="false"></datetime>
186 | 187 |
ngModel: {{getDate(date6) | date: "medium"}}
188 |
189 |
190 |
-------------------------------------------------------------------------------- /src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { FormGroup, FormBuilder } from '@angular/forms'; 3 | 4 | @Component({ 5 | selector: 'my-app', 6 | templateUrl: './app.component.html' 7 | }) 8 | export class AppComponent { 9 | date2: Date = new Date(2016, 5, 10); 10 | date3: Date; 11 | date4: Date; 12 | datepickerOpts: any = { 13 | startDate: new Date(2016, 5, 10), 14 | autoclose: true, 15 | todayBtn: 'linked', 16 | todayHighlight: true, 17 | assumeNearbyYear: true, 18 | format: 'D, d MM yyyy' 19 | }; 20 | date5: Date = new Date(); 21 | date6: Date = new Date(); 22 | dateFrom: Date; 23 | dateTo: Date; 24 | datepickerToOpts: any = {}; 25 | form: FormGroup; 26 | 27 | constructor(private formBuilder: FormBuilder) { } 28 | 29 | ngOnInit() { 30 | this.form = this.formBuilder.group({ 31 | date: [new Date(1991, 8, 12)] 32 | }); 33 | } 34 | 35 | handleDateFromChange(dateFrom: Date) { 36 | // update the model 37 | this.dateFrom = dateFrom; 38 | 39 | // do not mutate the object or angular won't detect the changes 40 | this.datepickerToOpts = { 41 | startDate: dateFrom 42 | }; 43 | } 44 | 45 | getDate(dt: Date): number { 46 | return dt && dt.getTime(); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { BrowserModule } from '@angular/platform-browser'; 3 | import { FormsModule, ReactiveFormsModule } from '@angular/forms'; 4 | import { AppComponent } from './app.component'; 5 | import { NKDatetimeModule } from '../ng2-datetime/ng2-datetime.module'; 6 | 7 | @NgModule({ 8 | imports: [BrowserModule, FormsModule, ReactiveFormsModule, NKDatetimeModule], 9 | bootstrap: [AppComponent], 10 | declarations: [AppComponent] 11 | }) 12 | export class AppModule { 13 | } 14 | -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 2 | import { enableProdMode } from '@angular/core'; 3 | import { AppModule } from './app/app.module'; 4 | 5 | if (process.env.ENV === 'production') { 6 | enableProdMode(); 7 | } 8 | 9 | platformBrowserDynamic().bootstrapModule(AppModule); 10 | -------------------------------------------------------------------------------- /src/ng2-datetime/ITimepickerEvent.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | //# sourceMappingURL=ITimepickerEvent.js.map -------------------------------------------------------------------------------- /src/ng2-datetime/ITimepickerEvent.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"ITimepickerEvent.js","sourceRoot":"","sources":["ITimepickerEvent.ts"],"names":[],"mappings":""} -------------------------------------------------------------------------------- /src/ng2-datetime/ITimepickerEvent.ts: -------------------------------------------------------------------------------- 1 | export interface ITimepickerEvent { 2 | time: { 3 | value: number, // getTime() 4 | meridian: string, // AM || PM 5 | hours: number, 6 | minutes: number, 7 | seconds: number 8 | }; 9 | } 10 | -------------------------------------------------------------------------------- /src/ng2-datetime/ng2-datetime.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { 3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; 4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; 6 | return c > 3 && r && Object.defineProperty(target, key, r), r; 7 | }; 8 | var __metadata = (this && this.__metadata) || function (k, v) { 9 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); 10 | }; 11 | Object.defineProperty(exports, "__esModule", { value: true }); 12 | var core_1 = require("@angular/core"); 13 | var forms_1 = require("@angular/forms"); 14 | var CUSTOM_ACCESSOR = { 15 | provide: forms_1.NG_VALUE_ACCESSOR, 16 | useExisting: core_1.forwardRef(function () { return NKDatetime; }), 17 | multi: true 18 | }; 19 | var NKDatetime = (function () { 20 | function NKDatetime() { 21 | this.timepickerOptions = {}; 22 | this.datepickerOptions = {}; 23 | this.idDatePicker = uniqueId('q-datepicker_'); 24 | this.idTimePicker = uniqueId('q-timepicker_'); 25 | this.onChange = function (_) { 26 | }; 27 | this.onTouched = function () { 28 | }; 29 | } 30 | Object.defineProperty(NKDatetime.prototype, "tabindexAttr", { 31 | get: function () { 32 | return this.tabindex === undefined ? '-1' : undefined; 33 | }, 34 | enumerable: true, 35 | configurable: true 36 | }); 37 | NKDatetime.prototype.ngAfterViewInit = function () { 38 | this.init(); 39 | }; 40 | NKDatetime.prototype.ngOnDestroy = function () { 41 | if (this.datepicker) { 42 | this.datepicker.datepicker('destroy'); 43 | } 44 | if (this.timepicker) { 45 | this.timepicker.timepicker('remove'); 46 | } 47 | }; 48 | NKDatetime.prototype.ngOnChanges = function (changes) { 49 | if (changes) { 50 | if (changes['datepickerOptions'] && this.datepicker) { 51 | this.datepicker.datepicker('destroy'); 52 | if (changes['datepickerOptions'].currentValue) { 53 | this.datepicker = null; 54 | this.init(); 55 | } 56 | else if (changes['datepickerOptions'].currentValue === false) { 57 | this.datepicker.remove(); 58 | } 59 | } 60 | if (changes['timepickerOptions'] && this.timepicker) { 61 | this.timepicker.timepicker('remove'); 62 | if (changes['timepickerOptions'].currentValue) { 63 | this.timepicker = null; 64 | this.init(); 65 | } 66 | else if (changes['timepickerOptions'].currentValue === false) { 67 | this.timepicker.parent().remove(); 68 | } 69 | } 70 | } 71 | }; 72 | NKDatetime.prototype.writeValue = function (value) { 73 | var _this = this; 74 | this.date = value; 75 | if (isDate(this.date)) { 76 | setTimeout(function () { 77 | _this.updateModel(_this.date); 78 | }, 0); 79 | } 80 | else { 81 | this.clearModels(); 82 | } 83 | }; 84 | NKDatetime.prototype.registerOnChange = function (fn) { 85 | this.onChange = fn; 86 | }; 87 | NKDatetime.prototype.registerOnTouched = function (fn) { 88 | this.onTouched = fn; 89 | }; 90 | NKDatetime.prototype.checkEmptyValue = function (e) { 91 | var value = e.target.value; 92 | if (value === '' && (this.timepickerOptions === false || 93 | this.datepickerOptions === false || 94 | (this.timeModel === '' && this.dateModel === ''))) { 95 | this.onChange(undefined); 96 | } 97 | }; 98 | NKDatetime.prototype.clearModels = function () { 99 | this.onChange(undefined); 100 | if (this.timepicker) { 101 | this.timepicker.timepicker('setTime', null); 102 | } 103 | this.updateDatepicker(null); 104 | }; 105 | NKDatetime.prototype.showTimepicker = function () { 106 | this.timepicker.timepicker('showWidget'); 107 | }; 108 | NKDatetime.prototype.showDatepicker = function () { 109 | this.datepicker.datepicker('show'); 110 | }; 111 | ////////////////////////////////// 112 | NKDatetime.prototype.init = function () { 113 | var _this = this; 114 | if (!this.datepicker && this.datepickerOptions !== false) { 115 | var options = jQuery.extend({ enableOnReadonly: !this.readonly }, this.datepickerOptions); 116 | this.datepicker = $('#' + this.idDatePicker).datepicker(options); 117 | this.datepicker 118 | .on('changeDate', function (e) { 119 | var newDate = e.date; 120 | if (isDate(_this.date) && isDate(newDate)) { 121 | // get hours/minutes 122 | newDate.setHours(_this.date.getHours()); 123 | newDate.setMinutes(_this.date.getMinutes()); 124 | newDate.setSeconds(_this.date.getSeconds()); 125 | } 126 | _this.date = newDate; 127 | _this.onChange(newDate); 128 | }); 129 | } 130 | else if (this.datepickerOptions === false) { 131 | $('#' + this.idDatePicker).remove(); 132 | } 133 | if (!this.timepicker && this.timepickerOptions !== false) { 134 | var options = jQuery.extend({ defaultTime: false }, this.timepickerOptions); 135 | this.timepicker = $('#' + this.idTimePicker).timepicker(options); 136 | this.timepicker 137 | .on('changeTime.timepicker', function (e) { 138 | var _a = e.time, meridian = _a.meridian, hours = _a.hours; 139 | if (meridian) { 140 | // has meridian -> convert 12 to 24h 141 | if (meridian === 'PM' && hours < 12) { 142 | hours = hours + 12; 143 | } 144 | if (meridian === 'AM' && hours === 12) { 145 | hours = hours - 12; 146 | } 147 | hours = parseInt(_this.pad(hours), 10); 148 | } 149 | if (!isDate(_this.date)) { 150 | _this.date = new Date(); 151 | _this.updateDatepicker(_this.date); 152 | } 153 | _this.date.setHours(hours); 154 | _this.date.setMinutes(e.time.minutes); 155 | _this.date.setSeconds(e.time.seconds); 156 | _this.onChange(_this.date); 157 | }); 158 | } 159 | else if (this.timepickerOptions === false) { 160 | $('#' + this.idTimePicker).parent().remove(); 161 | } 162 | this.updateModel(this.date); 163 | }; 164 | NKDatetime.prototype.updateModel = function (date) { 165 | this.updateDatepicker(date); 166 | // update timepicker 167 | if (this.timepicker !== undefined && isDate(date)) { 168 | var hours = date.getHours(); 169 | if (this.timepickerOptions.showMeridian) { 170 | // Convert 24 to 12 hour system 171 | hours = (hours === 0 || hours === 12) ? 12 : hours % 12; 172 | } 173 | var meridian = date.getHours() >= 12 ? ' PM' : ' AM'; 174 | var time = this.pad(hours) + ':' + 175 | this.pad(this.date.getMinutes()) + ':' + 176 | this.pad(this.date.getSeconds()) + 177 | (this.timepickerOptions.showMeridian || this.timepickerOptions.showMeridian === undefined 178 | ? meridian : ''); 179 | this.timepicker.timepicker('setTime', time); 180 | this.timeModel = time; // fix initial empty timeModel bug 181 | } 182 | }; 183 | NKDatetime.prototype.updateDatepicker = function (date) { 184 | if (this.datepicker !== undefined) { 185 | this.datepicker.datepicker('update', date); 186 | } 187 | }; 188 | NKDatetime.prototype.pad = function (value) { 189 | return value.toString().length < 2 ? '0' + value : value.toString(); 190 | }; 191 | return NKDatetime; 192 | }()); 193 | __decorate([ 194 | core_1.Input('timepicker'), 195 | __metadata("design:type", Object) 196 | ], NKDatetime.prototype, "timepickerOptions", void 0); 197 | __decorate([ 198 | core_1.Input('datepicker'), 199 | __metadata("design:type", Object) 200 | ], NKDatetime.prototype, "datepickerOptions", void 0); 201 | __decorate([ 202 | core_1.Input('hasClearButton'), 203 | __metadata("design:type", Boolean) 204 | ], NKDatetime.prototype, "hasClearButton", void 0); 205 | __decorate([ 206 | core_1.Input(), 207 | __metadata("design:type", Boolean) 208 | ], NKDatetime.prototype, "readonly", void 0); 209 | __decorate([ 210 | core_1.Input(), 211 | __metadata("design:type", Boolean) 212 | ], NKDatetime.prototype, "required", void 0); 213 | __decorate([ 214 | core_1.Input(), 215 | __metadata("design:type", String) 216 | ], NKDatetime.prototype, "tabindex", void 0); 217 | __decorate([ 218 | core_1.HostListener('blur'), 219 | __metadata("design:type", Object) 220 | ], NKDatetime.prototype, "onTouched", void 0); 221 | __decorate([ 222 | core_1.HostBinding('attr.tabindex'), 223 | __metadata("design:type", String), 224 | __metadata("design:paramtypes", []) 225 | ], NKDatetime.prototype, "tabindexAttr", null); 226 | NKDatetime = __decorate([ 227 | core_1.Component({ 228 | selector: 'datetime', 229 | providers: [CUSTOM_ACCESSOR], 230 | template: "\n
\n
\n \n
\n \n
\n
\n
\n \n \n \n \n
\n \n
\n ", 231 | styles: [ 232 | '.ng2-datetime *[hidden] { display: none; }' 233 | ] 234 | }) 235 | ], NKDatetime); 236 | exports.NKDatetime = NKDatetime; 237 | var id = 0; 238 | function uniqueId(prefix) { 239 | return prefix + ++id; 240 | } 241 | function isDate(obj) { 242 | return Object.prototype.toString.call(obj) === '[object Date]'; 243 | } 244 | //# sourceMappingURL=ng2-datetime.js.map -------------------------------------------------------------------------------- /src/ng2-datetime/ng2-datetime.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"ng2-datetime.js","sourceRoot":"","sources":["ng2-datetime.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,sCAGuB;AACvB,wCAAuE;AAGvE,IAAM,eAAe,GAAG;IACpB,OAAO,EAAE,yBAAiB;IAC1B,WAAW,EAAE,iBAAU,CAAC,cAAM,OAAA,UAAU,EAAV,CAAU,CAAC;IACzC,KAAK,EAAE,IAAI;CACd,CAAC;AA4CF,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-------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { 3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; 4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; 6 | return c > 3 && r && Object.defineProperty(target, key, r), r; 7 | }; 8 | Object.defineProperty(exports, "__esModule", { value: true }); 9 | var core_1 = require("@angular/core"); 10 | var common_1 = require("@angular/common"); 11 | var forms_1 = require("@angular/forms"); 12 | var ng2_datetime_1 = require("./ng2-datetime"); 13 | var NKDatetimeModule = (function () { 14 | function NKDatetimeModule() { 15 | } 16 | return NKDatetimeModule; 17 | }()); 18 | NKDatetimeModule = __decorate([ 19 | core_1.NgModule({ 20 | imports: [common_1.CommonModule, forms_1.FormsModule, forms_1.ReactiveFormsModule], 21 | exports: [ng2_datetime_1.NKDatetime], 22 | declarations: [ng2_datetime_1.NKDatetime] 23 | }) 24 | ], NKDatetimeModule); 25 | exports.NKDatetimeModule = NKDatetimeModule; 26 | //# sourceMappingURL=ng2-datetime.module.js.map -------------------------------------------------------------------------------- /src/ng2-datetime/ng2-datetime.module.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"ng2-datetime.module.js","sourceRoot":"","sources":["ng2-datetime.module.ts"],"names":[],"mappings":";;;;;;;;AAAA,sCAAyC;AACzC,0CAA+C;AAC/C,wCAAkE;AAClE,+CAA4C;AAO5C,IAAa,gBAAgB;IAA7B;IACA,CAAC;IAAD,uBAAC;AAAD,CAAC,AADD,IACC;AADY,gBAAgB;IAL5B,eAAQ,CAAC;QACN,OAAO,EAAE,CAAC,qBAAY,EAAE,mBAAW,EAAE,2BAAmB,CAAC;QACzD,OAAO,EAAE,CAAC,yBAAU,CAAC;QACrB,YAAY,EAAE,CAAC,yBAAU,CAAC;KAC7B,CAAC;GACW,gBAAgB,CAC5B;AADY,4CAAgB"} -------------------------------------------------------------------------------- /src/ng2-datetime/ng2-datetime.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | import { FormsModule, ReactiveFormsModule } from '@angular/forms'; 4 | import { NKDatetime } from './ng2-datetime'; 5 | 6 | @NgModule({ 7 | imports: [CommonModule, FormsModule, ReactiveFormsModule], 8 | exports: [NKDatetime], 9 | declarations: [NKDatetime] 10 | }) 11 | export class NKDatetimeModule { 12 | } 13 | -------------------------------------------------------------------------------- /src/ng2-datetime/ng2-datetime.spec.ts: -------------------------------------------------------------------------------- 1 | import { Component, Type } from '@angular/core'; 2 | import { FormsModule } from '@angular/forms'; 3 | import { By } from '@angular/platform-browser'; 4 | import { TestBed, ComponentFixture, fakeAsync, tick } from '@angular/core/testing'; 5 | import { NKDatetimeModule } from './ng2-datetime.module'; 6 | import { NKDatetime } from './ng2-datetime'; 7 | 8 | describe('ng2-datetime', () => { 9 | 10 | beforeEach(() => { 11 | TestBed.configureTestingModule({ 12 | imports: [FormsModule, NKDatetimeModule], 13 | declarations: [DatePickerComponent] 14 | }); 15 | }); 16 | 17 | it('should instantiate', () => { 18 | const component = TestBed.createComponent(NKDatetime).componentInstance; 19 | expect(component).not.toBeNull(); 20 | expect(component instanceof NKDatetime).toEqual(true); 21 | }); 22 | 23 | describe('datepicker', () => { 24 | it('should update ngModel when datepicker value changes', fakeAsync(() => { 25 | const fixture = TestBed.createComponent(DatePickerComponent); 26 | const component = getComponent(fixture, NKDatetime); 27 | 28 | (fixture.componentInstance).date = null; 29 | 30 | tickAndDetect(fixture); 31 | 32 | component.datepicker.datepicker('setDate', new Date(2011, 2, 5)); 33 | 34 | tickAndDetect(fixture); 35 | 36 | expect(fixture.componentInstance.date).toEqual(new Date(2011, 2, 5)); 37 | })); 38 | }); 39 | 40 | describe('timepicker', () => { 41 | it('should update ngModel when timepicker value changes', fakeAsync(() => { 42 | const fixture = TestBed.createComponent(DatePickerComponent); 43 | const component = getComponent(fixture, NKDatetime); 44 | 45 | fixture.componentInstance.date = new Date(2011, 2, 5, 0, 0); 46 | 47 | tickAndDetect(fixture); 48 | tickAndDetect(fixture); 49 | 50 | component.timepicker.timepicker('setTime', '12:45 AM'); 51 | 52 | tickAndDetect(fixture); 53 | 54 | expect(fixture.componentInstance.date).toEqual(new Date(2011, 2, 5, 0, 45)); 55 | })); 56 | }); 57 | }); 58 | 59 | function getComponent(fixture: ComponentFixture, type: Type): T { 60 | // tick for each component in the component tree 61 | tickAndDetect(fixture); 62 | tickAndDetect(fixture); 63 | return fixture.debugElement.query(By.directive(type)).componentInstance; 64 | } 65 | 66 | function tickAndDetect(fixture: ComponentFixture) { 67 | tick(); 68 | fixture.detectChanges(); 69 | } 70 | 71 | @Component({ 72 | template: ` 73 | 74 | ` 75 | }) 76 | class DatePickerComponent { 77 | date: Date; 78 | } 79 | -------------------------------------------------------------------------------- /src/ng2-datetime/ng2-datetime.ts: -------------------------------------------------------------------------------- 1 | import { 2 | Component, Input, HostListener, AfterViewInit, OnDestroy, 3 | SimpleChanges, OnChanges, HostBinding, forwardRef 4 | } from '@angular/core'; 5 | import {ControlValueAccessor, NG_VALUE_ACCESSOR} from '@angular/forms'; 6 | import {ITimepickerEvent} from './ITimepickerEvent'; 7 | 8 | const CUSTOM_ACCESSOR = { 9 | provide: NG_VALUE_ACCESSOR, 10 | useExisting: forwardRef(() => NKDatetime), 11 | multi: true 12 | }; 13 | 14 | @Component({ 15 | selector: 'datetime', 16 | providers: [CUSTOM_ACCESSOR], 17 | template: ` 18 |
19 |
20 | 28 |
31 | 32 |
33 |
34 |
35 | 44 | 45 | 46 | 47 |
48 | 49 |
50 | `, 51 | styles: [ 52 | '.ng2-datetime *[hidden] { display: none; }' 53 | ] 54 | }) 55 | 56 | export class NKDatetime implements ControlValueAccessor, AfterViewInit, OnDestroy, OnChanges { 57 | @Input('timepicker') timepickerOptions: any = {}; 58 | @Input('datepicker') datepickerOptions: any = {}; 59 | @Input('hasClearButton') hasClearButton: boolean; 60 | @Input() readonly: boolean; 61 | @Input() required: boolean; 62 | @Input() tabindex: string; 63 | 64 | date: Date; // ngModel 65 | dateModel: string; 66 | timeModel: string; 67 | 68 | // instances 69 | datepicker: any; 70 | timepicker: any; 71 | 72 | idDatePicker: string = uniqueId('q-datepicker_'); 73 | idTimePicker: string = uniqueId('q-timepicker_'); 74 | 75 | onChange = (_: any) => { 76 | } 77 | 78 | @HostListener('blur') 79 | onTouched = () => { 80 | } 81 | 82 | @HostBinding('attr.tabindex') 83 | get tabindexAttr(): string | undefined { 84 | return this.tabindex === undefined ? '-1' : undefined; 85 | } 86 | 87 | ngAfterViewInit() { 88 | this.init(); 89 | } 90 | 91 | ngOnDestroy() { 92 | if (this.datepicker) { 93 | this.datepicker.datepicker('destroy'); 94 | } 95 | if (this.timepicker) { 96 | this.timepicker.timepicker('remove'); 97 | } 98 | } 99 | 100 | ngOnChanges(changes: SimpleChanges) { 101 | if (changes) { 102 | if (changes['datepickerOptions'] && this.datepicker) { 103 | this.datepicker.datepicker('destroy'); 104 | 105 | if (changes['datepickerOptions'].currentValue) { 106 | this.datepicker = null; 107 | this.init(); 108 | } else if (changes['datepickerOptions'].currentValue === false) { 109 | this.datepicker.remove(); 110 | } 111 | } 112 | if (changes['timepickerOptions'] && this.timepicker) { 113 | this.timepicker.timepicker('remove'); 114 | 115 | if (changes['timepickerOptions'].currentValue) { 116 | this.timepicker = null; 117 | this.init(); 118 | } else if (changes['timepickerOptions'].currentValue === false) { 119 | this.timepicker.parent().remove(); 120 | } 121 | } 122 | } 123 | } 124 | 125 | writeValue(value: any) { 126 | this.date = value; 127 | if (isDate(this.date)) { 128 | setTimeout(() => { 129 | this.updateModel(this.date); 130 | }, 0); 131 | } else { 132 | this.clearModels(); 133 | } 134 | } 135 | 136 | registerOnChange(fn: (_: any) => void) { 137 | this.onChange = fn; 138 | } 139 | 140 | registerOnTouched(fn: () => void) { 141 | this.onTouched = fn; 142 | } 143 | 144 | checkEmptyValue(e: any) { 145 | const value = e.target.value; 146 | if (value === '' && ( 147 | this.timepickerOptions === false || 148 | this.datepickerOptions === false || 149 | (this.timeModel === '' && this.dateModel === '') 150 | )) { 151 | this.onChange(undefined); 152 | } 153 | } 154 | 155 | clearModels() { 156 | this.onChange(undefined); 157 | if (this.timepicker) { 158 | this.timepicker.timepicker('setTime', null); 159 | } 160 | this.updateDatepicker(null); 161 | } 162 | 163 | showTimepicker() { 164 | this.timepicker.timepicker('showWidget'); 165 | } 166 | 167 | showDatepicker() { 168 | this.datepicker.datepicker('show'); 169 | } 170 | 171 | ////////////////////////////////// 172 | 173 | private init(): void { 174 | if (!this.datepicker && this.datepickerOptions !== false) { 175 | let options = jQuery.extend({enableOnReadonly: !this.readonly}, this.datepickerOptions); 176 | this.datepicker = ($('#' + this.idDatePicker)).datepicker(options); 177 | this.datepicker 178 | .on('changeDate', (e: any) => { 179 | let newDate: Date = e.date; 180 | 181 | if (isDate(this.date) && isDate(newDate)) { 182 | // get hours/minutes 183 | newDate.setHours(this.date.getHours()); 184 | newDate.setMinutes(this.date.getMinutes()); 185 | newDate.setSeconds(this.date.getSeconds()); 186 | } 187 | 188 | this.date = newDate; 189 | this.onChange(newDate); 190 | }); 191 | } else if (this.datepickerOptions === false) { 192 | ($('#' + this.idDatePicker)).remove(); 193 | } 194 | 195 | if (!this.timepicker && this.timepickerOptions !== false) { 196 | let options = jQuery.extend({defaultTime: false}, this.timepickerOptions); 197 | this.timepicker = ($('#' + this.idTimePicker)).timepicker(options); 198 | this.timepicker 199 | .on('changeTime.timepicker', (e: ITimepickerEvent) => { 200 | let {meridian, hours} = e.time; 201 | 202 | if (meridian) { 203 | // has meridian -> convert 12 to 24h 204 | if (meridian === 'PM' && hours < 12) { 205 | hours = hours + 12; 206 | } 207 | if (meridian === 'AM' && hours === 12) { 208 | hours = hours - 12; 209 | } 210 | hours = parseInt(this.pad(hours), 10); 211 | } 212 | 213 | if (!isDate(this.date)) { 214 | this.date = new Date(); 215 | this.updateDatepicker(this.date); 216 | } 217 | 218 | this.date.setHours(hours); 219 | this.date.setMinutes(e.time.minutes); 220 | this.date.setSeconds(e.time.seconds); 221 | this.onChange(this.date); 222 | }); 223 | } else if (this.timepickerOptions === false) { 224 | ($('#' + this.idTimePicker)).parent().remove(); 225 | } 226 | 227 | this.updateModel(this.date); 228 | } 229 | 230 | private updateModel(date: Date): void { 231 | this.updateDatepicker(date); 232 | 233 | // update timepicker 234 | if (this.timepicker !== undefined && isDate(date)) { 235 | let hours = date.getHours(); 236 | if (this.timepickerOptions.showMeridian) { 237 | // Convert 24 to 12 hour system 238 | hours = (hours === 0 || hours === 12) ? 12 : hours % 12; 239 | } 240 | const meridian = date.getHours() >= 12 ? ' PM' : ' AM'; 241 | const time = 242 | this.pad(hours) + ':' + 243 | this.pad(this.date.getMinutes()) + ':' + 244 | this.pad(this.date.getSeconds()) + 245 | (this.timepickerOptions.showMeridian || this.timepickerOptions.showMeridian === undefined 246 | ? meridian : ''); 247 | this.timepicker.timepicker('setTime', time); 248 | this.timeModel = time; // fix initial empty timeModel bug 249 | } 250 | } 251 | 252 | private updateDatepicker(date?: any) { 253 | if (this.datepicker !== undefined) { 254 | this.datepicker.datepicker('update', date); 255 | } 256 | } 257 | 258 | private pad(value: any): string { 259 | return value.toString().length < 2 ? '0' + value : value.toString(); 260 | } 261 | } 262 | 263 | let id = 0; 264 | function uniqueId(prefix: string): string { 265 | return prefix + ++id; 266 | } 267 | 268 | function isDate(obj: any) { 269 | return Object.prototype.toString.call(obj) === '[object Date]'; 270 | } 271 | -------------------------------------------------------------------------------- /src/polyfills.ts: -------------------------------------------------------------------------------- 1 | import 'core-js/es6'; 2 | import 'core-js/es7/reflect'; 3 | require('zone.js/dist/zone'); 4 | 5 | if (process.env.ENV === 'production') { 6 | // Production 7 | } else { 8 | // Development 9 | Error['stackTraceLimit'] = Infinity; 10 | require('zone.js/dist/long-stack-trace-zone'); 11 | } 12 | -------------------------------------------------------------------------------- /src/vendor.ts: -------------------------------------------------------------------------------- 1 | import '@angular/platform-browser'; 2 | import '@angular/platform-browser-dynamic'; 3 | import '@angular/core'; 4 | import '@angular/common'; 5 | 6 | import 'rxjs'; 7 | 8 | import 'bootstrap/dist/css/bootstrap.css'; 9 | import 'jquery/dist/jquery.min.js'; 10 | import 'bootstrap-datepicker/dist/css/bootstrap-datepicker3.min.css'; 11 | import 'bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js'; 12 | import 'bootstrap-timepicker/css/bootstrap-timepicker.min.css'; 13 | import 'bootstrap-timepicker/js/bootstrap-timepicker.js'; 14 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "module": "commonjs", 5 | "moduleResolution": "node", 6 | "sourceMap": true, 7 | "emitDecoratorMetadata": true, 8 | "experimentalDecorators": true, 9 | "removeComments": false, 10 | "noImplicitAny": true, 11 | "suppressImplicitAnyIndexErrors": true, 12 | "strictNullChecks": true, 13 | "skipLibCheck": true, 14 | "lib": [ 15 | "dom", 16 | "es2015" 17 | ] 18 | }, 19 | "exclude": [ 20 | "node_modules/*" 21 | ] 22 | } -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "class-name": true, 4 | "comment-format": [ 5 | true, 6 | "check-space" 7 | ], 8 | "curly": true, 9 | "eofline": true, 10 | "forin": true, 11 | "indent": [ 12 | true, 13 | "spaces" 14 | ], 15 | "label-position": true, 16 | "max-line-length": [ 17 | true, 18 | 140 19 | ], 20 | "member-access": false, 21 | "member-ordering": [ 22 | true, 23 | "static-before-instance", 24 | "variables-before-functions" 25 | ], 26 | "no-arg": true, 27 | "no-bitwise": true, 28 | "no-console": [ 29 | true, 30 | "debug", 31 | "info", 32 | "time", 33 | "timeEnd", 34 | "trace" 35 | ], 36 | "no-construct": true, 37 | "no-debugger": true, 38 | "no-duplicate-variable": true, 39 | "no-empty": false, 40 | "no-eval": true, 41 | "no-inferrable-types": true, 42 | "no-shadowed-variable": true, 43 | "no-string-literal": false, 44 | "no-switch-case-fall-through": true, 45 | "no-trailing-whitespace": true, 46 | "no-unused-expression": true, 47 | "no-use-before-declare": true, 48 | "no-var-keyword": true, 49 | "object-literal-sort-keys": false, 50 | "one-line": [ 51 | true, 52 | "check-open-brace", 53 | "check-catch", 54 | "check-else", 55 | "check-whitespace" 56 | ], 57 | "quotemark": [ 58 | true, 59 | "single" 60 | ], 61 | "radix": true, 62 | "semicolon": [ 63 | "always" 64 | ], 65 | "triple-equals": [ 66 | true, 67 | "allow-null-check" 68 | ], 69 | "typedef-whitespace": [ 70 | true, 71 | { 72 | "call-signature": "nospace", 73 | "index-signature": "nospace", 74 | "parameter": "nospace", 75 | "property-declaration": "nospace", 76 | "variable-declaration": "nospace" 77 | } 78 | ], 79 | "variable-name": false, 80 | "whitespace": [ 81 | true, 82 | "check-branch", 83 | "check-decl", 84 | "check-operator", 85 | "check-separator", 86 | "check-type" 87 | ] 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./config/webpack.dev.js'); --------------------------------------------------------------------------------