mis-crystal-design-system 4.0.44 → 4.0.46-test-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/mis-crystal-design-system-input.umd.js +3 -1
- package/bundles/mis-crystal-design-system-input.umd.js.map +1 -1
- package/bundles/mis-crystal-design-system-input.umd.min.js +1 -1
- package/bundles/mis-crystal-design-system-input.umd.min.js.map +1 -1
- package/bundles/mis-crystal-design-system-phone-input.umd.js +48 -7
- package/bundles/mis-crystal-design-system-phone-input.umd.js.map +1 -1
- package/bundles/mis-crystal-design-system-phone-input.umd.min.js +1 -1
- package/bundles/mis-crystal-design-system-phone-input.umd.min.js.map +1 -1
- package/bundles/mis-crystal-design-system-timerangepicker.umd.js +6 -1
- package/bundles/mis-crystal-design-system-timerangepicker.umd.js.map +1 -1
- package/bundles/mis-crystal-design-system-timerangepicker.umd.min.js +1 -1
- package/bundles/mis-crystal-design-system-timerangepicker.umd.min.js.map +1 -1
- package/esm2015/input/mis-input.component.js +4 -2
- package/esm2015/phone-input/phone-input.component.js +45 -4
- package/esm2015/timerangepicker/timerangepicker.component.js +7 -2
- package/fesm2015/mis-crystal-design-system-input.js +3 -1
- package/fesm2015/mis-crystal-design-system-input.js.map +1 -1
- package/fesm2015/mis-crystal-design-system-phone-input.js +44 -3
- package/fesm2015/mis-crystal-design-system-phone-input.js.map +1 -1
- package/fesm2015/mis-crystal-design-system-timerangepicker.js +6 -1
- package/fesm2015/mis-crystal-design-system-timerangepicker.js.map +1 -1
- package/input/mis-crystal-design-system-input.metadata.json +1 -1
- package/input/mis-input.component.d.ts +1 -0
- package/package.json +1 -1
- package/phone-input/mis-crystal-design-system-phone-input.metadata.json +1 -1
- package/phone-input/phone-input.component.d.ts +12 -3
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
this.size = "sm";
|
|
47
47
|
this.noHints = false;
|
|
48
48
|
this.hasError = false; // show input in error state
|
|
49
|
+
this.isMandatory = false; // show input as mandatory
|
|
49
50
|
this.inputValidity = true;
|
|
50
51
|
}
|
|
51
52
|
Object.defineProperty(MisInputComponent.prototype, "formInput", {
|
|
@@ -73,7 +74,7 @@
|
|
|
73
74
|
MisInputComponent.decorators = [
|
|
74
75
|
{ type: core.Component, args: [{
|
|
75
76
|
selector: "mis-input",
|
|
76
|
-
template: "<div\n [class]=\"'input-container ' + size\"\n [ngClass]=\"{\n rounded: type === 'rounded',\n floating: type === 'floating',\n 'has-error': !inputValidity || hasError,\n 'no-hint': noHints,\n 'mis-disabled': inputCtrl?.disabled\n }\"\n>\n <div class=\"input-wrapper\">\n <ng-content select=\"[mis-input-icon]\"></ng-content>\n <div class=\"mis-input\">\n <ng-content select=\"input\"></ng-content>\n <span class=\"mis-placeholder\">{{ placeholder }}
|
|
77
|
+
template: "<div\n [class]=\"'input-container ' + size\"\n [ngClass]=\"{\n rounded: type === 'rounded',\n floating: type === 'floating',\n 'has-error': !inputValidity || hasError,\n 'no-hint': noHints,\n 'mis-disabled': inputCtrl?.disabled\n }\"\n>\n <div class=\"input-wrapper\">\n <ng-content select=\"[mis-input-icon]\"></ng-content>\n <div class=\"mis-input\">\n <ng-content select=\"input\"></ng-content>\n <span class=\"mis-placeholder\">{{ placeholder }}<span *ngIf=\"isMandatory\" style=\"color: red;\">*</span></span>\n </div>\n <ng-content select=\"[mis-input-act]\"></ng-content>\n </div>\n <ng-content select=\"[mis-input-hint]\"></ng-content>\n <ng-content select=\"[mis-input-error]\"></ng-content>\n</div>\n",
|
|
77
78
|
styles: [":root{--pmry-200:#99baf7;--pmry-100:#cbddfb;--pmry-500:#0937b2;--pmry-400:#3c68d0;--pmry-600:#062a99;--pmry-700:#041f80;--pmry-300:#638fe7;--pmry-800:#021567;--pmry-900:#010f55;--sec-d-purple:#40447f;--sec-maroon:#6b034e;--sec-mud-red:#b23600;--sec-orange:#ed711c;--sec-purple:#815fd5;--sec-teal:#10adae;--sec-yellow:#d4900c;--sec-green:#547f40;--sec-bright-green:#27d22e;--sec-dark-teal:#035f6b;--sec-chocolate:#7c2f33;--sec-rube-pink:#c13d6d;--sec-cerulean:#0087b2;--sem-error:#b00020;--sem-info:#0091ff;--sem-warning:#ff9d00;--sem-success:#38af49;--grey-bg-1:#fafafa;--grey-bg:#f5f5f5;--grey-seperators:#e0e0e0;--grey-disabled:#c8cdd3;--grey-hover:#f5f7fc;--grey-pressed:#e6ebf7;--grey-row:#f5f7fc;--dec-light-yellow:#f4e7c3;--dec-light-purple:#dacff9;--dec-light-green:#e4f5e9;--dec-light-green2:#f1fff3;--dec-light-pink:#fae1ea;--dec-:#f4cbc1;--dec-lt-orange:#faefed;--dec-light-blue:#cfecf9;--dec-row-selection:#f1fdf8;--dec-row-selection2:#f2fbff;--dec-row-lines:#d3e1e9;--text-white:#fff;--text-disabled:#929dab;--text-muted:#6a737d;--text-black:#181f33;--MR-solid-blue2:#c8d5f6;--MR-solid-purple:#c9c3fb;--MR-solid-orange:#eeac9f;--MR-solid-green:#acdada;--MR-solid-brown:#e8c8af;--MR-solid-yellow:#ffefc7;--MR-solid-blue:#bbe6ff;--MR-solid-pink:#ffc6f2;--tr-hover:#f0f3fa;--tr-pressed:#dae1f3}.input-container{position:relative;padding-bottom:24px}.input-container.mis-disabled .input-wrapper{pointer-events:none!important}.input-container .input-wrapper{box-sizing:border-box;display:flex;align-items:center;flex-direction:row;flex-wrap:nowrap;transition:all 60ms ease-in;background-color:#fff;padding:3px 16px;gap:16px}.input-container .input-wrapper .mis-input{flex:1 1 auto;z-index:0;position:relative;display:flex;align-items:center}.input-container .input-wrapper input{flex:1 1 auto;border:none;outline:none;height:100%;padding:0;font-family:Lato;font-style:normal;font-weight:400;font-size:16px;height:24px;color:#181f33;background-color:transparent;width:100%;vertical-align:middle}.input-container .input-wrapper input::-moz-placeholder{-moz-transition:all .1s ease-in;transition:all .1s ease-in;opacity:0;transform-origin:left center;color:transparent}.input-container .input-wrapper input:-ms-input-placeholder{-ms-transition:all .1s ease-in;transition:all .1s ease-in;opacity:0;transform-origin:left center;color:transparent}.input-container .input-wrapper input::placeholder{transition:all .1s ease-in;opacity:0;transform-origin:left center;color:transparent}.input-container .input-wrapper .mis-placeholder{position:absolute;font-family:Lato;font-style:normal;font-weight:400;font-size:16px;line-height:24px;color:#6a737d;z-index:-1;transition:all .15s ease-in}.input-container .input-wrapper:focus-within{background-color:#f5f5f5}.input-container .input-wrapper:focus-within{border:1px solid #0937b2}.input-container .input-wrapper [mis-input-act],.input-container .input-wrapper [mis-input-icon]{width:18px;height:18px;color:#6a737d;font-size:24px;line-height:18px}.input-container .input-wrapper [mis-input-act]{cursor:pointer}.input-container.no-hint{padding-bottom:0}.input-container.rounded input{box-sizing:initial}.input-container.rounded.sm input{padding:3px 16px}.input-container.rounded.md input{padding:9px 16px}.input-container.rounded.lg input{padding:15px 16px}.input-container.rounded .input-wrapper{border-radius:4px;border:1px solid #e0e0e0;padding:0}.input-container.rounded .input-wrapper:hover{background-color:#f5f5f5}.input-container.rounded .input-wrapper:focus-within{border:1px solid #0937b2}.input-container.rounded .input-wrapper input:not(:-moz-placeholder-shown)+.mis-placeholder{color:transparent!important}.input-container.rounded .input-wrapper input:not(:-ms-input-placeholder)+.mis-placeholder{color:transparent!important}.input-container.rounded .input-wrapper input:not(:placeholder-shown)+.mis-placeholder{color:transparent!important}.input-container.rounded .input-wrapper .mis-placeholder{margin-left:16px;transition-duration:50ms}.input-container.rounded.has-error .input-wrapper{border:1px solid #b00020!important}.input-container.floating .input-wrapper{padding-top:24px;padding-bottom:7px;border-bottom:1px solid #e0e0e0}.input-container.floating .input-wrapper input:focus+.mis-placeholder{color:#0937b2!important}.input-container.floating .input-wrapper input:not(:-moz-placeholder-shown)+.mis-placeholder{transform:translateY(calc(-100% + 6px))!important;font-size:12px!important;letter-spacing:.2px!important}.input-container.floating .input-wrapper input:not(:-ms-input-placeholder)+.mis-placeholder{transform:translateY(calc(-100% + 6px))!important;font-size:12px!important;letter-spacing:.2px!important}.input-container.floating .input-wrapper input:focus+.mis-placeholder,.input-container.floating .input-wrapper input:not(:placeholder-shown)+.mis-placeholder{transform:translateY(calc(-100% + 6px))!important;font-size:12px!important;letter-spacing:.2px!important}.input-container.floating .input-wrapper:focus-within{border:none;border-bottom:1px solid #0937b2}.input-container.floating .input-wrapper:focus-within input::-moz-placeholder{color:#6a737d;opacity:1;font-size:16px}.input-container.floating .input-wrapper:focus-within input:-ms-input-placeholder{color:#6a737d;opacity:1;font-size:16px}.input-container.floating .input-wrapper:focus-within input::placeholder{color:#6a737d;opacity:1;font-size:16px}.input-container.floating.has-error .input-wrapper{border-bottom:1px solid #b00020!important}.input-container.floating.has-error .input-wrapper .mis-placeholder{color:#b00020!important}.input-container [mis-input-error],.input-container [mis-input-hint]{position:absolute;left:0;right:0;bottom:0;line-height:24px;height:24px;font-size:12px;color:#6a737d;letter-spacing:.2px}.input-container [mis-input-error]{color:#b00020}"]
|
|
78
79
|
},] }
|
|
79
80
|
];
|
|
@@ -84,6 +85,7 @@
|
|
|
84
85
|
placeholder: [{ type: core.Input }],
|
|
85
86
|
noHints: [{ type: core.Input }],
|
|
86
87
|
hasError: [{ type: core.Input }],
|
|
88
|
+
isMandatory: [{ type: core.Input }],
|
|
87
89
|
formInput: [{ type: core.ContentChild, args: [MisInputDirective,] }]
|
|
88
90
|
};
|
|
89
91
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mis-crystal-design-system-input.umd.js","sources":["../../../projects/mis-components/input/directives/input/input.directive.ts","../../../projects/mis-components/input/mis-input.component.ts","../../../projects/mis-components/input/mis-input.module.ts","../../../projects/mis-components/input/mis-crystal-design-system-input.ts"],"sourcesContent":["import { Directive, ElementRef, OnDestroy, OnInit, Optional, Self } from \"@angular/core\";\nimport { NgControl } from \"@angular/forms\";\nimport { ReplaySubject, Subject, Subscription } from \"rxjs\";\nimport { takeUntil } from \"rxjs/operators\";\n\n@Directive({\n // tslint:disable-next-line\n selector: \"input[misInput]\"\n})\nexport class MisInputDirective implements OnInit, OnDestroy {\n constructor(public el: ElementRef, @Self() @Optional() public control: NgControl) {}\n private validityChange: ReplaySubject<boolean> = new ReplaySubject(1);\n validity = this.validityChange.asObservable();\n endObs: Subject<void> = new Subject();\n focus = false;\n hasValue = false;\n\n ngOnInit(): void {\n this.control?.control?.valueChanges.pipe(takeUntil(this.endObs)).subscribe(() => {\n this.validityChange.next(!this.control.control?.invalid);\n });\n this.el.nativeElement.placeholder += \" \";\n }\n ngOnDestroy(): void {\n this.endObs.next();\n this.endObs.complete();\n }\n}\n","import { Component, ContentChild, Input, OnDestroy, OnInit, ViewEncapsulation } from \"@angular/core\";\nimport { AbstractControl } from \"@angular/forms\";\nimport { Subscription } from \"rxjs\";\nimport { MisInputDirective } from \"./directives/input/input.directive\";\n\n@Component({\n selector: \"mis-input\",\n templateUrl: \"./mis-input.component.html\",\n styleUrls: [\"./mis-input.component.scss\"]\n})\nexport class MisInputComponent implements OnInit, OnDestroy {\n @Input() type: \"rounded\" | \"floating\" = \"floating\";\n @Input() size: \"sm\" | \"md\" | \"lg\" = \"sm\";\n @Input() placeholder: string; // floating placeholder text\n @Input() noHints = false;\n @Input() hasError = false; // show input in error state\n @ContentChild(MisInputDirective) set formInput(input: MisInputDirective) {\n if (!this.placeholder) {\n this.placeholder = input?.el.nativeElement.placeholder || \"\";\n }\n this.inputCtrl = input.control?.control;\n this.inputSubscription?.unsubscribe();\n this.inputSubscription = input?.validity.subscribe(res => (this.inputValidity = res));\n this.placeholder += \" \";\n }\n inputCtrl: AbstractControl;\n inputSubscription: Subscription | undefined;\n inputValidity: boolean = true;\n constructor() {}\n\n ngOnInit(): void {}\n ngOnDestroy(): void {\n this.inputSubscription?.unsubscribe();\n }\n}\n","import { CommonModule } from \"@angular/common\";\nimport { NgModule } from \"@angular/core\";\nimport { FormsModule } from \"@angular/forms\";\nimport { MisInputDirective } from \"./directives/input/input.directive\";\nimport { MisInputComponent } from \"./mis-input.component\";\n\n@NgModule({\n declarations: [MisInputComponent, MisInputDirective],\n imports: [CommonModule, FormsModule],\n exports: [MisInputComponent, MisInputDirective]\n})\nexport class MisInputModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["ReplaySubject","Subject","takeUntil","Directive","ElementRef","NgControl","Self","Optional","Component","Input","ContentChild","NgModule","CommonModule","FormsModule"],"mappings":";;;;;;;QAUE,2BAAmB,EAAc,EAA6B,OAAkB;YAA7D,OAAE,GAAF,EAAE,CAAY;YAA6B,YAAO,GAAP,OAAO,CAAW;YACxE,mBAAc,GAA2B,IAAIA,kBAAa,CAAC,CAAC,CAAC,CAAC;YACtE,aAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,YAAY,EAAE,CAAC;YAC9C,WAAM,GAAkB,IAAIC,YAAO,EAAE,CAAC;YACtC,UAAK,GAAG,KAAK,CAAC;YACd,aAAQ,GAAG,KAAK,CAAC;SALmE;QAOpF,oCAAQ,GAAR;YAAA,iBAKC;;YAJC,YAAA,IAAI,CAAC,OAAO,0CAAE,OAAO,0CAAE,YAAY,CAAC,IAAI,CAACC,mBAAS,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC;;gBACzE,KAAI,CAAC,cAAc,CAAC,IAAI,CAAC,QAAC,KAAI,CAAC,OAAO,CAAC,OAAO,0CAAE,OAAO,CAAA,CAAC,CAAC;aAC1D,EAAE;YACH,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,WAAW,IAAI,GAAG,CAAC;SAC1C;QACD,uCAAW,GAAX;YACE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;YACnB,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;SACxB;;;;gBArBFC,cAAS,SAAC;;oBAET,QAAQ,EAAE,iBAAiB;iBAC5B;;;gBARmBC,eAAU;gBACrBC,eAAS,uBASoBC,SAAI,YAAIC,aAAQ;;;;
|
|
1
|
+
{"version":3,"file":"mis-crystal-design-system-input.umd.js","sources":["../../../projects/mis-components/input/directives/input/input.directive.ts","../../../projects/mis-components/input/mis-input.component.ts","../../../projects/mis-components/input/mis-input.module.ts","../../../projects/mis-components/input/mis-crystal-design-system-input.ts"],"sourcesContent":["import { Directive, ElementRef, OnDestroy, OnInit, Optional, Self } from \"@angular/core\";\nimport { NgControl } from \"@angular/forms\";\nimport { ReplaySubject, Subject, Subscription } from \"rxjs\";\nimport { takeUntil } from \"rxjs/operators\";\n\n@Directive({\n // tslint:disable-next-line\n selector: \"input[misInput]\"\n})\nexport class MisInputDirective implements OnInit, OnDestroy {\n constructor(public el: ElementRef, @Self() @Optional() public control: NgControl) {}\n private validityChange: ReplaySubject<boolean> = new ReplaySubject(1);\n validity = this.validityChange.asObservable();\n endObs: Subject<void> = new Subject();\n focus = false;\n hasValue = false;\n\n ngOnInit(): void {\n this.control?.control?.valueChanges.pipe(takeUntil(this.endObs)).subscribe(() => {\n this.validityChange.next(!this.control.control?.invalid);\n });\n this.el.nativeElement.placeholder += \" \";\n }\n ngOnDestroy(): void {\n this.endObs.next();\n this.endObs.complete();\n }\n}\n","import { Component, ContentChild, Input, OnDestroy, OnInit, ViewEncapsulation } from \"@angular/core\";\nimport { AbstractControl } from \"@angular/forms\";\nimport { Subscription } from \"rxjs\";\nimport { MisInputDirective } from \"./directives/input/input.directive\";\n\n@Component({\n selector: \"mis-input\",\n templateUrl: \"./mis-input.component.html\",\n styleUrls: [\"./mis-input.component.scss\"]\n})\nexport class MisInputComponent implements OnInit, OnDestroy {\n @Input() type: \"rounded\" | \"floating\" = \"floating\";\n @Input() size: \"sm\" | \"md\" | \"lg\" = \"sm\";\n @Input() placeholder: string; // floating placeholder text\n @Input() noHints = false;\n @Input() hasError = false; // show input in error state\n @Input() isMandatory:boolean = false; // show input as mandatory\n @ContentChild(MisInputDirective) set formInput(input: MisInputDirective) {\n if (!this.placeholder) {\n this.placeholder = input?.el.nativeElement.placeholder || \"\";\n }\n this.inputCtrl = input.control?.control;\n this.inputSubscription?.unsubscribe();\n this.inputSubscription = input?.validity.subscribe(res => (this.inputValidity = res));\n this.placeholder += \" \";\n }\n inputCtrl: AbstractControl;\n inputSubscription: Subscription | undefined;\n inputValidity: boolean = true;\n constructor() {}\n\n ngOnInit(): void {}\n ngOnDestroy(): void {\n this.inputSubscription?.unsubscribe();\n }\n}\n","import { CommonModule } from \"@angular/common\";\nimport { NgModule } from \"@angular/core\";\nimport { FormsModule } from \"@angular/forms\";\nimport { MisInputDirective } from \"./directives/input/input.directive\";\nimport { MisInputComponent } from \"./mis-input.component\";\n\n@NgModule({\n declarations: [MisInputComponent, MisInputDirective],\n imports: [CommonModule, FormsModule],\n exports: [MisInputComponent, MisInputDirective]\n})\nexport class MisInputModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["ReplaySubject","Subject","takeUntil","Directive","ElementRef","NgControl","Self","Optional","Component","Input","ContentChild","NgModule","CommonModule","FormsModule"],"mappings":";;;;;;;QAUE,2BAAmB,EAAc,EAA6B,OAAkB;YAA7D,OAAE,GAAF,EAAE,CAAY;YAA6B,YAAO,GAAP,OAAO,CAAW;YACxE,mBAAc,GAA2B,IAAIA,kBAAa,CAAC,CAAC,CAAC,CAAC;YACtE,aAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,YAAY,EAAE,CAAC;YAC9C,WAAM,GAAkB,IAAIC,YAAO,EAAE,CAAC;YACtC,UAAK,GAAG,KAAK,CAAC;YACd,aAAQ,GAAG,KAAK,CAAC;SALmE;QAOpF,oCAAQ,GAAR;YAAA,iBAKC;;YAJC,YAAA,IAAI,CAAC,OAAO,0CAAE,OAAO,0CAAE,YAAY,CAAC,IAAI,CAACC,mBAAS,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC;;gBACzE,KAAI,CAAC,cAAc,CAAC,IAAI,CAAC,QAAC,KAAI,CAAC,OAAO,CAAC,OAAO,0CAAE,OAAO,CAAA,CAAC,CAAC;aAC1D,EAAE;YACH,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,WAA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;;iBAE1C;;;;uBAEEC,UAAK;uBACLA,UAAK;8BACLA,UAAK;0BACLA,UAAK;2BACLA,UAAK;8BACLA,UAAK;4BACLC,iBAAY,SAAC,iBAAiB;;;;QCNjC;;;;;gBALCC,aAAQ,SAAC;oBACR,YAAY,EAAE,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;oBACpD,OAAO,EAAE,CAACC,mBAAY,EAAEC,iBAAW,CAAC;oBACpC,OAAO,EAAE,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;iBAChD;;;ICVD;;;;;;;;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/forms"),require("rxjs"),require("rxjs/operators"),require("@angular/common")):"function"==typeof define&&define.amd?define("mis-crystal-design-system/input",["exports","@angular/core","@angular/forms","rxjs","rxjs/operators","@angular/common"],t):t(((n="undefined"!=typeof globalThis?globalThis:n||self)["mis-crystal-design-system"]=n["mis-crystal-design-system"]||{},n["mis-crystal-design-system"].input={}),n.ng.core,n.ng.forms,n.rxjs,n.rxjs.operators,n.ng.common)}(this,(function(n,t,e,i,r,o){"use strict";var p=function(){function n(n,t){this.el=n,this.control=t,this.validityChange=new i.ReplaySubject(1),this.validity=this.validityChange.asObservable(),this.endObs=new i.Subject,this.focus=!1,this.hasValue=!1}return n.prototype.ngOnInit=function(){var n,t,e=this;null===(t=null===(n=this.control)||void 0===n?void 0:n.control)||void 0===t||t.valueChanges.pipe(r.takeUntil(this.endObs)).subscribe((function(){var n;e.validityChange.next(!(null===(n=e.control.control)||void 0===n?void 0:n.invalid))})),this.el.nativeElement.placeholder+=" "},n.prototype.ngOnDestroy=function(){this.endObs.next(),this.endObs.complete()},n}();p.decorators=[{type:t.Directive,args:[{selector:"input[misInput]"}]}],p.ctorParameters=function(){return[{type:t.ElementRef},{type:e.NgControl,decorators:[{type:t.Self},{type:t.Optional}]}]};var a=function(){function n(){this.type="floating",this.size="sm",this.noHints=!1,this.hasError=!1,this.inputValidity=!0}return Object.defineProperty(n.prototype,"formInput",{set:function(n){var t,e,i=this;this.placeholder||(this.placeholder=(null==n?void 0:n.el.nativeElement.placeholder)||""),this.inputCtrl=null===(t=n.control)||void 0===t?void 0:t.control,null===(e=this.inputSubscription)||void 0===e||e.unsubscribe(),this.inputSubscription=null==n?void 0:n.validity.subscribe((function(n){return i.inputValidity=n})),this.placeholder+=" "},enumerable:!1,configurable:!0}),n.prototype.ngOnInit=function(){},n.prototype.ngOnDestroy=function(){var n;null===(n=this.inputSubscription)||void 0===n||n.unsubscribe()},n}();a.decorators=[{type:t.Component,args:[{selector:"mis-input",template:'<div\n [class]="\'input-container \' + size"\n [ngClass]="{\n rounded: type === \'rounded\',\n floating: type === \'floating\',\n \'has-error\': !inputValidity || hasError,\n \'no-hint\': noHints,\n \'mis-disabled\': inputCtrl?.disabled\n }"\n>\n <div class="input-wrapper">\n <ng-content select="[mis-input-icon]"></ng-content>\n <div class="mis-input">\n <ng-content select="input"></ng-content>\n <span class="mis-placeholder">{{ placeholder }}
|
|
1
|
+
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/forms"),require("rxjs"),require("rxjs/operators"),require("@angular/common")):"function"==typeof define&&define.amd?define("mis-crystal-design-system/input",["exports","@angular/core","@angular/forms","rxjs","rxjs/operators","@angular/common"],t):t(((n="undefined"!=typeof globalThis?globalThis:n||self)["mis-crystal-design-system"]=n["mis-crystal-design-system"]||{},n["mis-crystal-design-system"].input={}),n.ng.core,n.ng.forms,n.rxjs,n.rxjs.operators,n.ng.common)}(this,(function(n,t,e,i,r,o){"use strict";var p=function(){function n(n,t){this.el=n,this.control=t,this.validityChange=new i.ReplaySubject(1),this.validity=this.validityChange.asObservable(),this.endObs=new i.Subject,this.focus=!1,this.hasValue=!1}return n.prototype.ngOnInit=function(){var n,t,e=this;null===(t=null===(n=this.control)||void 0===n?void 0:n.control)||void 0===t||t.valueChanges.pipe(r.takeUntil(this.endObs)).subscribe((function(){var n;e.validityChange.next(!(null===(n=e.control.control)||void 0===n?void 0:n.invalid))})),this.el.nativeElement.placeholder+=" "},n.prototype.ngOnDestroy=function(){this.endObs.next(),this.endObs.complete()},n}();p.decorators=[{type:t.Directive,args:[{selector:"input[misInput]"}]}],p.ctorParameters=function(){return[{type:t.ElementRef},{type:e.NgControl,decorators:[{type:t.Self},{type:t.Optional}]}]};var a=function(){function n(){this.type="floating",this.size="sm",this.noHints=!1,this.hasError=!1,this.isMandatory=!1,this.inputValidity=!0}return Object.defineProperty(n.prototype,"formInput",{set:function(n){var t,e,i=this;this.placeholder||(this.placeholder=(null==n?void 0:n.el.nativeElement.placeholder)||""),this.inputCtrl=null===(t=n.control)||void 0===t?void 0:t.control,null===(e=this.inputSubscription)||void 0===e||e.unsubscribe(),this.inputSubscription=null==n?void 0:n.validity.subscribe((function(n){return i.inputValidity=n})),this.placeholder+=" "},enumerable:!1,configurable:!0}),n.prototype.ngOnInit=function(){},n.prototype.ngOnDestroy=function(){var n;null===(n=this.inputSubscription)||void 0===n||n.unsubscribe()},n}();a.decorators=[{type:t.Component,args:[{selector:"mis-input",template:'<div\n [class]="\'input-container \' + size"\n [ngClass]="{\n rounded: type === \'rounded\',\n floating: type === \'floating\',\n \'has-error\': !inputValidity || hasError,\n \'no-hint\': noHints,\n \'mis-disabled\': inputCtrl?.disabled\n }"\n>\n <div class="input-wrapper">\n <ng-content select="[mis-input-icon]"></ng-content>\n <div class="mis-input">\n <ng-content select="input"></ng-content>\n <span class="mis-placeholder">{{ placeholder }}<span *ngIf="isMandatory" style="color: red;">*</span></span>\n </div>\n <ng-content select="[mis-input-act]"></ng-content>\n </div>\n <ng-content select="[mis-input-hint]"></ng-content>\n <ng-content select="[mis-input-error]"></ng-content>\n</div>\n',styles:[":root{--pmry-200:#99baf7;--pmry-100:#cbddfb;--pmry-500:#0937b2;--pmry-400:#3c68d0;--pmry-600:#062a99;--pmry-700:#041f80;--pmry-300:#638fe7;--pmry-800:#021567;--pmry-900:#010f55;--sec-d-purple:#40447f;--sec-maroon:#6b034e;--sec-mud-red:#b23600;--sec-orange:#ed711c;--sec-purple:#815fd5;--sec-teal:#10adae;--sec-yellow:#d4900c;--sec-green:#547f40;--sec-bright-green:#27d22e;--sec-dark-teal:#035f6b;--sec-chocolate:#7c2f33;--sec-rube-pink:#c13d6d;--sec-cerulean:#0087b2;--sem-error:#b00020;--sem-info:#0091ff;--sem-warning:#ff9d00;--sem-success:#38af49;--grey-bg-1:#fafafa;--grey-bg:#f5f5f5;--grey-seperators:#e0e0e0;--grey-disabled:#c8cdd3;--grey-hover:#f5f7fc;--grey-pressed:#e6ebf7;--grey-row:#f5f7fc;--dec-light-yellow:#f4e7c3;--dec-light-purple:#dacff9;--dec-light-green:#e4f5e9;--dec-light-green2:#f1fff3;--dec-light-pink:#fae1ea;--dec-:#f4cbc1;--dec-lt-orange:#faefed;--dec-light-blue:#cfecf9;--dec-row-selection:#f1fdf8;--dec-row-selection2:#f2fbff;--dec-row-lines:#d3e1e9;--text-white:#fff;--text-disabled:#929dab;--text-muted:#6a737d;--text-black:#181f33;--MR-solid-blue2:#c8d5f6;--MR-solid-purple:#c9c3fb;--MR-solid-orange:#eeac9f;--MR-solid-green:#acdada;--MR-solid-brown:#e8c8af;--MR-solid-yellow:#ffefc7;--MR-solid-blue:#bbe6ff;--MR-solid-pink:#ffc6f2;--tr-hover:#f0f3fa;--tr-pressed:#dae1f3}.input-container{position:relative;padding-bottom:24px}.input-container.mis-disabled .input-wrapper{pointer-events:none!important}.input-container .input-wrapper{box-sizing:border-box;display:flex;align-items:center;flex-direction:row;flex-wrap:nowrap;transition:all 60ms ease-in;background-color:#fff;padding:3px 16px;gap:16px}.input-container .input-wrapper .mis-input{flex:1 1 auto;z-index:0;position:relative;display:flex;align-items:center}.input-container .input-wrapper input{flex:1 1 auto;border:none;outline:none;height:100%;padding:0;font-family:Lato;font-style:normal;font-weight:400;font-size:16px;height:24px;color:#181f33;background-color:transparent;width:100%;vertical-align:middle}.input-container .input-wrapper input::-moz-placeholder{-moz-transition:all .1s ease-in;transition:all .1s ease-in;opacity:0;transform-origin:left center;color:transparent}.input-container .input-wrapper input:-ms-input-placeholder{-ms-transition:all .1s ease-in;transition:all .1s ease-in;opacity:0;transform-origin:left center;color:transparent}.input-container .input-wrapper input::placeholder{transition:all .1s ease-in;opacity:0;transform-origin:left center;color:transparent}.input-container .input-wrapper .mis-placeholder{position:absolute;font-family:Lato;font-style:normal;font-weight:400;font-size:16px;line-height:24px;color:#6a737d;z-index:-1;transition:all .15s ease-in}.input-container .input-wrapper:focus-within{background-color:#f5f5f5}.input-container .input-wrapper:focus-within{border:1px solid #0937b2}.input-container .input-wrapper [mis-input-act],.input-container .input-wrapper [mis-input-icon]{width:18px;height:18px;color:#6a737d;font-size:24px;line-height:18px}.input-container .input-wrapper [mis-input-act]{cursor:pointer}.input-container.no-hint{padding-bottom:0}.input-container.rounded input{box-sizing:initial}.input-container.rounded.sm input{padding:3px 16px}.input-container.rounded.md input{padding:9px 16px}.input-container.rounded.lg input{padding:15px 16px}.input-container.rounded .input-wrapper{border-radius:4px;border:1px solid #e0e0e0;padding:0}.input-container.rounded .input-wrapper:hover{background-color:#f5f5f5}.input-container.rounded .input-wrapper:focus-within{border:1px solid #0937b2}.input-container.rounded .input-wrapper input:not(:-moz-placeholder-shown)+.mis-placeholder{color:transparent!important}.input-container.rounded .input-wrapper input:not(:-ms-input-placeholder)+.mis-placeholder{color:transparent!important}.input-container.rounded .input-wrapper input:not(:placeholder-shown)+.mis-placeholder{color:transparent!important}.input-container.rounded .input-wrapper .mis-placeholder{margin-left:16px;transition-duration:50ms}.input-container.rounded.has-error .input-wrapper{border:1px solid #b00020!important}.input-container.floating .input-wrapper{padding-top:24px;padding-bottom:7px;border-bottom:1px solid #e0e0e0}.input-container.floating .input-wrapper input:focus+.mis-placeholder{color:#0937b2!important}.input-container.floating .input-wrapper input:not(:-moz-placeholder-shown)+.mis-placeholder{transform:translateY(calc(-100% + 6px))!important;font-size:12px!important;letter-spacing:.2px!important}.input-container.floating .input-wrapper input:not(:-ms-input-placeholder)+.mis-placeholder{transform:translateY(calc(-100% + 6px))!important;font-size:12px!important;letter-spacing:.2px!important}.input-container.floating .input-wrapper input:focus+.mis-placeholder,.input-container.floating .input-wrapper input:not(:placeholder-shown)+.mis-placeholder{transform:translateY(calc(-100% + 6px))!important;font-size:12px!important;letter-spacing:.2px!important}.input-container.floating .input-wrapper:focus-within{border:none;border-bottom:1px solid #0937b2}.input-container.floating .input-wrapper:focus-within input::-moz-placeholder{color:#6a737d;opacity:1;font-size:16px}.input-container.floating .input-wrapper:focus-within input:-ms-input-placeholder{color:#6a737d;opacity:1;font-size:16px}.input-container.floating .input-wrapper:focus-within input::placeholder{color:#6a737d;opacity:1;font-size:16px}.input-container.floating.has-error .input-wrapper{border-bottom:1px solid #b00020!important}.input-container.floating.has-error .input-wrapper .mis-placeholder{color:#b00020!important}.input-container [mis-input-error],.input-container [mis-input-hint]{position:absolute;left:0;right:0;bottom:0;line-height:24px;height:24px;font-size:12px;color:#6a737d;letter-spacing:.2px}.input-container [mis-input-error]{color:#b00020}"]}]}],a.ctorParameters=function(){return[]},a.propDecorators={type:[{type:t.Input}],size:[{type:t.Input}],placeholder:[{type:t.Input}],noHints:[{type:t.Input}],hasError:[{type:t.Input}],isMandatory:[{type:t.Input}],formInput:[{type:t.ContentChild,args:[p]}]};var s=function(){};s.decorators=[{type:t.NgModule,args:[{declarations:[a,p],imports:[o.CommonModule,e.FormsModule],exports:[a,p]}]}],n.MisInputComponent=a,n.MisInputDirective=p,n.MisInputModule=s,Object.defineProperty(n,"__esModule",{value:!0})}));
|
|
2
2
|
//# sourceMappingURL=mis-crystal-design-system-input.umd.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../projects/mis-components/input/directives/input/input.directive.ts","../../../projects/mis-components/input/mis-input.component.ts","../../../projects/mis-components/input/mis-input.module.ts"],"names":["MisInputDirective","el","control","this","validityChange","ReplaySubject","validity","asObservable","endObs","Subject","focus","hasValue","prototype","ngOnInit","_this","_b","_a","valueChanges","pipe","takeUntil","subscribe","next","invalid","nativeElement","placeholder","ngOnDestroy","complete","Directive","args","selector","ElementRef","NgControl","decorators","type","Self","Optional","MisInputComponent","size","noHints","hasError","inputValidity","Object","defineProperty","input","inputCtrl","inputSubscription","unsubscribe","res","Component","template","Input","ContentChild","NgModule","declarations","imports","CommonModule","FormsModule","exports"],"mappings":"uoBAUE,SAAAA,EAAmBC,EAA2CC,GAA3CC,KAAAF,GAAAA,EAA2CE,KAAAD,QAAAA,EACtDC,KAAAC,eAAyC,IAAIC,EAAAA,cAAc,GACnEF,KAAAG,SAAWH,KAAKC,eAAeG,eAC/BJ,KAAAK,OAAwB,IAAIC,EAAAA,QAC5BN,KAAAO,OAAQ,EACRP,KAAAQ,UAAW,SAEXX,EAAAY,UAAAC,SAAA,WAAA,QAAAC,EAAAX,KACuB,QAArBY,EAAY,QAAZC,EAAAb,KAAKD,eAAO,IAAAc,OAAA,EAAAA,EAAEd,eAAO,IAAAa,GAAAA,EAAEE,aAAaC,KAAKC,EAAAA,UAAUhB,KAAKK,SAASY,WAAU,iBACzEN,EAAKV,eAAeiB,OAA0B,QAArBL,EAACF,EAAKZ,QAAQA,eAAO,IAAAc,OAAA,EAAAA,EAAEM,aAElDnB,KAAKF,GAAGsB,cAAcC,aAAe,KAEvCxB,EAAAY,UAAAa,YAAA,WACEtB,KAAKK,OAAOa,OACZlB,KAAKK,OAAOkB,qCApBfC,EAAAA,UAASC,KAAA,CAAC,CAETC,SAAU,+DAPQC,EAAAA,kBACXC,EAAAA,UAASC,WAAA,CAAA,CAAAC,KASoBC,EAAAA,MAAI,CAAAD,KAAIE,EAAAA,+
|
|
1
|
+
{"version":3,"sources":["../../../projects/mis-components/input/directives/input/input.directive.ts","../../../projects/mis-components/input/mis-input.component.ts","../../../projects/mis-components/input/mis-input.module.ts"],"names":["MisInputDirective","el","control","this","validityChange","ReplaySubject","validity","asObservable","endObs","Subject","focus","hasValue","prototype","ngOnInit","_this","_b","_a","valueChanges","pipe","takeUntil","subscribe","next","invalid","nativeElement","placeholder","ngOnDestroy","complete","Directive","args","selector","ElementRef","NgControl","decorators","type","Self","Optional","MisInputComponent","size","noHints","hasError","isMandatory","inputValidity","Object","defineProperty","input","inputCtrl","inputSubscription","unsubscribe","res","Component","template","Input","ContentChild","NgModule","declarations","imports","CommonModule","FormsModule","exports"],"mappings":"uoBAUE,SAAAA,EAAmBC,EAA2CC,GAA3CC,KAAAF,GAAAA,EAA2CE,KAAAD,QAAAA,EACtDC,KAAAC,eAAyC,IAAIC,EAAAA,cAAc,GACnEF,KAAAG,SAAWH,KAAKC,eAAeG,eAC/BJ,KAAAK,OAAwB,IAAIC,EAAAA,QAC5BN,KAAAO,OAAQ,EACRP,KAAAQ,UAAW,SAEXX,EAAAY,UAAAC,SAAA,WAAA,QAAAC,EAAAX,KACuB,QAArBY,EAAY,QAAZC,EAAAb,KAAKD,eAAO,IAAAc,OAAA,EAAAA,EAAEd,eAAO,IAAAa,GAAAA,EAAEE,aAAaC,KAAKC,EAAAA,UAAUhB,KAAKK,SAASY,WAAU,iBACzEN,EAAKV,eAAeiB,OAA0B,QAArBL,EAACF,EAAKZ,QAAQA,eAAO,IAAAc,OAAA,EAAAA,EAAEM,aAElDnB,KAAKF,GAAGsB,cAAcC,aAAe,KAEvCxB,EAAAY,UAAAa,YAAA,WACEtB,KAAKK,OAAOa,OACZlB,KAAKK,OAAOkB,qCApBfC,EAAAA,UAASC,KAAA,CAAC,CAETC,SAAU,+DAPQC,EAAAA,kBACXC,EAAAA,UAASC,WAAA,CAAA,CAAAC,KASoBC,EAAAA,MAAI,CAAAD,KAAIE,EAAAA,+BCmB5C,SAAAC,IAlBSjC,KAAA8B,KAA+B,WAC/B9B,KAAAkC,KAA2B,KAE3BlC,KAAAmC,SAAU,EACVnC,KAAAoC,UAAW,EACXpC,KAAAqC,aAAsB,EAY/BrC,KAAAsC,eAAyB,SAXzBC,OAAAC,eAAqCP,EAAAxB,UAAA,YAAS,KAA9C,SAA+CgC,GAA/C,QAAA9B,EAAAX,KACOA,KAAKqB,cACRrB,KAAKqB,aAAcoB,MAAAA,OAAK,EAALA,EAAO3C,GAAGsB,cAAcC,cAAe,IAE5DrB,KAAK0C,UAAyB,QAAhB7B,EAAG4B,EAAM1C,eAAO,IAAAc,OAAA,EAAAA,EAAEd,QACV,QAAtBa,EAAAZ,KAAK2C,yBAAiB,IAAA/B,GAAAA,EAAEgC,cACxB5C,KAAK2C,kBAAoBF,MAAAA,OAAK,EAALA,EAAOtC,SAASc,WAAU,SAAA4B,GAAO,OAAClC,EAAK2B,cAAgBO,KAChF7C,KAAKqB,aAAe,qCAOtBY,EAAAxB,UAAAC,SAAA,aACAuB,EAAAxB,UAAAa,YAAA,iBACwB,QAAtBT,EAAAb,KAAK2C,yBAAiB,IAAA9B,GAAAA,EAAE+B,wCA5B3BE,EAAAA,UAASrB,KAAA,CAAC,CACTC,SAAU,YACVqB,SAAA,k/MAICC,EAAAA,oBACAA,EAAAA,2BACAA,EAAAA,uBACAA,EAAAA,wBACAA,EAAAA,2BACAA,EAAAA,yBACAC,EAAAA,aAAYxB,KAAA,CAAC5B,YCNhB,iCALCqD,EAAAA,SAAQzB,KAAA,CAAC,CACR0B,aAAc,CAAClB,EAAmBpC,GAClCuD,QAAS,CAACC,EAAAA,aAAcC,EAAAA,aACxBC,QAAS,CAACtB,EAAmBpC","sourcesContent":["import { Directive, ElementRef, OnDestroy, OnInit, Optional, Self } from \"@angular/core\";\nimport { NgControl } from \"@angular/forms\";\nimport { ReplaySubject, Subject, Subscription } from \"rxjs\";\nimport { takeUntil } from \"rxjs/operators\";\n\n@Directive({\n // tslint:disable-next-line\n selector: \"input[misInput]\"\n})\nexport class MisInputDirective implements OnInit, OnDestroy {\n constructor(public el: ElementRef, @Self() @Optional() public control: NgControl) {}\n private validityChange: ReplaySubject<boolean> = new ReplaySubject(1);\n validity = this.validityChange.asObservable();\n endObs: Subject<void> = new Subject();\n focus = false;\n hasValue = false;\n\n ngOnInit(): void {\n this.control?.control?.valueChanges.pipe(takeUntil(this.endObs)).subscribe(() => {\n this.validityChange.next(!this.control.control?.invalid);\n });\n this.el.nativeElement.placeholder += \" \";\n }\n ngOnDestroy(): void {\n this.endObs.next();\n this.endObs.complete();\n }\n}\n","import { Component, ContentChild, Input, OnDestroy, OnInit, ViewEncapsulation } from \"@angular/core\";\nimport { AbstractControl } from \"@angular/forms\";\nimport { Subscription } from \"rxjs\";\nimport { MisInputDirective } from \"./directives/input/input.directive\";\n\n@Component({\n selector: \"mis-input\",\n templateUrl: \"./mis-input.component.html\",\n styleUrls: [\"./mis-input.component.scss\"]\n})\nexport class MisInputComponent implements OnInit, OnDestroy {\n @Input() type: \"rounded\" | \"floating\" = \"floating\";\n @Input() size: \"sm\" | \"md\" | \"lg\" = \"sm\";\n @Input() placeholder: string; // floating placeholder text\n @Input() noHints = false;\n @Input() hasError = false; // show input in error state\n @Input() isMandatory:boolean = false; // show input as mandatory\n @ContentChild(MisInputDirective) set formInput(input: MisInputDirective) {\n if (!this.placeholder) {\n this.placeholder = input?.el.nativeElement.placeholder || \"\";\n }\n this.inputCtrl = input.control?.control;\n this.inputSubscription?.unsubscribe();\n this.inputSubscription = input?.validity.subscribe(res => (this.inputValidity = res));\n this.placeholder += \" \";\n }\n inputCtrl: AbstractControl;\n inputSubscription: Subscription | undefined;\n inputValidity: boolean = true;\n constructor() {}\n\n ngOnInit(): void {}\n ngOnDestroy(): void {\n this.inputSubscription?.unsubscribe();\n }\n}\n","import { CommonModule } from \"@angular/common\";\nimport { NgModule } from \"@angular/core\";\nimport { FormsModule } from \"@angular/forms\";\nimport { MisInputDirective } from \"./directives/input/input.directive\";\nimport { MisInputComponent } from \"./mis-input.component\";\n\n@NgModule({\n declarations: [MisInputComponent, MisInputDirective],\n imports: [CommonModule, FormsModule],\n exports: [MisInputComponent, MisInputDirective]\n})\nexport class MisInputModule {}\n"]}
|
|
@@ -1,31 +1,69 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/forms'), require('@angular/common'), require('@angular/cdk/overlay'), require('@angular/cdk-experimental/scrolling'), require('mis-crystal-design-system/dropdown')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define('mis-crystal-design-system/phone-input', ['exports', '@angular/core', '@angular/forms', '@angular/common', '@angular/cdk/overlay', '@angular/cdk-experimental/scrolling', 'mis-crystal-design-system/dropdown'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global['mis-crystal-design-system'] = global['mis-crystal-design-system'] || {}, global['mis-crystal-design-system']['phone-input'] = {}), global.ng.core, global.ng.forms, global.ng.common, global.ng.cdk.overlay, global.ng.cdkExperimental.scrolling, global['mis-crystal-design-system'].dropdown));
|
|
5
|
-
}(this, (function (exports, core, forms, common, overlay, scrolling, dropdown) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/forms'), require('libphonenumber-js'), require('@angular/common'), require('@angular/cdk/overlay'), require('@angular/cdk-experimental/scrolling'), require('mis-crystal-design-system/dropdown')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('mis-crystal-design-system/phone-input', ['exports', '@angular/core', '@angular/forms', 'libphonenumber-js', '@angular/common', '@angular/cdk/overlay', '@angular/cdk-experimental/scrolling', 'mis-crystal-design-system/dropdown'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global['mis-crystal-design-system'] = global['mis-crystal-design-system'] || {}, global['mis-crystal-design-system']['phone-input'] = {}), global.ng.core, global.ng.forms, global.libphonenumberJs, global.ng.common, global.ng.cdk.overlay, global.ng.cdkExperimental.scrolling, global['mis-crystal-design-system'].dropdown));
|
|
5
|
+
}(this, (function (exports, core, forms, libphonenumberJs, common, overlay, scrolling, dropdown) { 'use strict';
|
|
6
6
|
|
|
7
7
|
var PhoneInputComponent = /** @class */ (function () {
|
|
8
8
|
function PhoneInputComponent() {
|
|
9
|
+
this.dropdownHeight = "";
|
|
10
|
+
this.dropdownWidth = "";
|
|
9
11
|
this.dropdownData = [];
|
|
10
12
|
this.dropdownSelectedItem = { value: "", label: "" };
|
|
13
|
+
this.defaultCountryCode = 'IN';
|
|
11
14
|
this.inputPlaceholder = 'Enter';
|
|
12
15
|
this.inputFormControl = new forms.FormControl();
|
|
13
16
|
this.onDropdownSelection = new core.EventEmitter();
|
|
14
|
-
this.
|
|
17
|
+
this.onInvalidPhoneNumber = new core.EventEmitter();
|
|
18
|
+
this.dropdownListWidth = "";
|
|
19
|
+
this.dropdownListHeight = "";
|
|
20
|
+
this.searchEnabled = true;
|
|
15
21
|
this.inputType = "number";
|
|
16
22
|
this.searchLabel = "Search Keyword";
|
|
23
|
+
this.phoneValidator = false;
|
|
24
|
+
this.countryCodes = [{ label: '', value: '' }];
|
|
25
|
+
this.selectedCountryName = '';
|
|
17
26
|
}
|
|
18
27
|
PhoneInputComponent.prototype.ngOnInit = function () {
|
|
28
|
+
var _this = this;
|
|
29
|
+
if (this.phoneValidator) {
|
|
30
|
+
this.loadCountryCodes();
|
|
31
|
+
this.dropdownData = this.countryCodes;
|
|
32
|
+
this.selectedCountryName = this.dropdownSelectedItem.label;
|
|
33
|
+
}
|
|
34
|
+
if (this.defaultCountryCode) {
|
|
35
|
+
var selectedCountry = this.dropdownData.find(function (country) { return country.value.toUpperCase() === _this.defaultCountryCode.toUpperCase(); });
|
|
36
|
+
if (selectedCountry) {
|
|
37
|
+
this.dropdownSelectedItem = selectedCountry;
|
|
38
|
+
this.selectedCountryName = selectedCountry.label;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
19
41
|
};
|
|
20
42
|
PhoneInputComponent.prototype.handleDropdownSelection = function (item) {
|
|
43
|
+
this.dropdownSelectedItem = item;
|
|
21
44
|
this.onDropdownSelection.emit(item);
|
|
45
|
+
this.selectedCountryName = item.label;
|
|
46
|
+
this.validatePhoneNumber(this.inputFormControl.value, this.dropdownSelectedItem.value);
|
|
47
|
+
};
|
|
48
|
+
PhoneInputComponent.prototype.loadCountryCodes = function () {
|
|
49
|
+
var countries = libphonenumberJs.getCountries();
|
|
50
|
+
this.countryCodes = countries.map(function (countryCode) { return ({
|
|
51
|
+
value: countryCode,
|
|
52
|
+
label: countryCode + " (+" + libphonenumberJs.getCountryCallingCode(countryCode) + ")"
|
|
53
|
+
}); });
|
|
54
|
+
};
|
|
55
|
+
PhoneInputComponent.prototype.validatePhoneNumber = function (phoneNumber, countryCode) {
|
|
56
|
+
var parsedPhoneNumber = libphonenumberJs.parsePhoneNumberFromString(phoneNumber, countryCode);
|
|
57
|
+
if (!parsedPhoneNumber || !parsedPhoneNumber.isValid()) {
|
|
58
|
+
this.onInvalidPhoneNumber.emit("Phone number is invalid for " + this.selectedCountryName);
|
|
59
|
+
}
|
|
22
60
|
};
|
|
23
61
|
return PhoneInputComponent;
|
|
24
62
|
}());
|
|
25
63
|
PhoneInputComponent.decorators = [
|
|
26
64
|
{ type: core.Component, args: [{
|
|
27
65
|
selector: "mis-phone-input",
|
|
28
|
-
template: "<div class=\"main-container-phone\">\n <mis-dropdown [height]=\"dropdownHeight\" [dropdownListWidth]=\"dropdownListWidth\"[dropdownListHeight]=\"dropdownListHeight\" [width]=\"dropdownWidth\" [data]=\"dropdownData\" [selectedItem]=\"dropdownSelectedItem\" [label]=\"label\" [searchEnabled]=\"searchEnabled\" [multiLine]=\"false\" (onChange)=\"handleDropdownSelection($event)\" [searchLabel]=\"searchLabel\"></mis-dropdown>\n <div class=\"details-field\">\n <div class=\"input-box\">\n <input\n [ngStyle]=\"{'height': inputHeight }\"\n class=\"black-text\"\n [placeholder]=\"inputPlaceholder\"\n [formControl]=\"inputFormControl\" \n [type]=\"inputType\"\n />\n </div>\n </div>\n</div>\n",
|
|
66
|
+
template: "<div class=\"main-container-phone\">\n <mis-dropdown [height]=\"dropdownHeight\" [dropdownListWidth]=\"dropdownListWidth\"[dropdownListHeight]=\"dropdownListHeight\" [width]=\"dropdownWidth\" [data]=\"dropdownData\" [selectedItem]=\"dropdownSelectedItem\" [label]=\"label\" [searchEnabled]=\"searchEnabled\" [multiLine]=\"false\" (onChange)=\"handleDropdownSelection($event)\" [searchLabel]=\"searchLabel\"></mis-dropdown>\n <div class=\"details-field\">\n <div class=\"input-box\">\n <input\n [ngStyle]=\"{'height': inputHeight }\"\n class=\"black-text\" \n [placeholder]=\"inputPlaceholder\"\n [formControl]=\"inputFormControl\" \n [type]=\"inputType\"\n />\n </div>\n </div>\n</div>\n",
|
|
29
67
|
styles: [".main-container-phone{display:flex;border:1px solid #e0e0e0;border-radius:6px}.details-field label{display:inline-block;min-width:224px;margin-right:24px}.details-field .input-box{width:100%}.details-field .input-box input{width:100%;height:32px}input{padding:10px 16px;border:none;outline:none;width:100%;height:auto;border-radius:6px}.black-text,input{color:#181f33;line-height:24px;font-size:16px}input::-webkit-inner-spin-button,input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.main-container-phone ::ng-deep .item{padding:8px!important}.main-container-phone ::ng-deep .dropdown{border:unset!important}"]
|
|
30
68
|
},] }
|
|
31
69
|
];
|
|
@@ -36,15 +74,18 @@
|
|
|
36
74
|
inputHeight: [{ type: core.Input }],
|
|
37
75
|
dropdownData: [{ type: core.Input }],
|
|
38
76
|
dropdownSelectedItem: [{ type: core.Input }],
|
|
77
|
+
defaultCountryCode: [{ type: core.Input }],
|
|
39
78
|
label: [{ type: core.Input }],
|
|
40
79
|
inputPlaceholder: [{ type: core.Input }],
|
|
41
80
|
inputFormControl: [{ type: core.Input }],
|
|
42
81
|
onDropdownSelection: [{ type: core.Output }],
|
|
82
|
+
onInvalidPhoneNumber: [{ type: core.Output }],
|
|
43
83
|
dropdownListWidth: [{ type: core.Input }],
|
|
44
84
|
dropdownListHeight: [{ type: core.Input }],
|
|
45
85
|
searchEnabled: [{ type: core.Input }],
|
|
46
86
|
inputType: [{ type: core.Input }],
|
|
47
|
-
searchLabel: [{ type: core.Input }]
|
|
87
|
+
searchLabel: [{ type: core.Input }],
|
|
88
|
+
phoneValidator: [{ type: core.Input }]
|
|
48
89
|
};
|
|
49
90
|
|
|
50
91
|
var PhoneInputModule = /** @class */ (function () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mis-crystal-design-system-phone-input.umd.js","sources":["../../../projects/mis-components/phone-input/phone-input.component.ts","../../../projects/mis-components/phone-input/phone-input.module.ts","../../../projects/mis-components/phone-input/mis-crystal-design-system-phone-input.ts"],"sourcesContent":["import { Component,
|
|
1
|
+
{"version":3,"file":"mis-crystal-design-system-phone-input.umd.js","sources":["../../../projects/mis-components/phone-input/phone-input.component.ts","../../../projects/mis-components/phone-input/phone-input.module.ts","../../../projects/mis-components/phone-input/mis-crystal-design-system-phone-input.ts"],"sourcesContent":["import { Component, EventEmitter, Input, OnInit, Output } from \"@angular/core\";\nimport { FormControl } from \"@angular/forms\";\nimport { parsePhoneNumberFromString, getCountryCallingCode, CountryCode, getCountries } from 'libphonenumber-js';\nimport { DropdownItem } from \"mis-crystal-design-system/dropdown\";\n\n@Component({\n selector: \"mis-phone-input\",\n templateUrl: \"./phone-input.component.html\",\n styleUrls: [\"./phone-input.component.scss\"]\n})\nexport class PhoneInputComponent implements OnInit {\n @Input() dropdownHeight?: string = \"\";\n @Input() dropdownWidth?: string = \"\";\n @Input() inputHeight?;\n @Input() dropdownData: DropdownItem[] = [];\n @Input() dropdownSelectedItem: DropdownItem = { value: \"\", label: \"\" };\n @Input() defaultCountryCode?: string = 'IN';\n @Input() label: string;\n @Input() inputPlaceholder: string = 'Enter';\n @Input() inputFormControl: FormControl = new FormControl();\n @Output() onDropdownSelection = new EventEmitter<any>();\n @Output() onInvalidPhoneNumber = new EventEmitter<string>();\n @Input() dropdownListWidth = \"\";\n @Input() dropdownListHeight = \"\";\n @Input() searchEnabled: boolean = true;\n @Input() inputType: string = \"number\";\n @Input() searchLabel: string = \"Search Keyword\"; \n @Input() phoneValidator? = false;\n \n countryCodes: DropdownItem[] = [{label:'',value:''}];\n countryCode: CountryCode | undefined;\n selectedCountryName: string = '';\n\n constructor() {}\n\n ngOnInit() {\n if (this.phoneValidator) {\n this.loadCountryCodes();\n this.dropdownData = this.countryCodes;\n this.selectedCountryName = this.dropdownSelectedItem.label;\n }\n\n if (this.defaultCountryCode) {\n const selectedCountry = this.dropdownData.find(\n country => country.value.toUpperCase() === this.defaultCountryCode.toUpperCase()\n );\n if (selectedCountry) {\n this.dropdownSelectedItem = selectedCountry;\n this.selectedCountryName = selectedCountry.label;\n }\n }\n }\n\n handleDropdownSelection(item: DropdownItem){\n this.dropdownSelectedItem = item;\n this.onDropdownSelection.emit(item);\n this.selectedCountryName = item.label;\n this.validatePhoneNumber(this.inputFormControl.value, this.dropdownSelectedItem.value);\n }\n\n loadCountryCodes() {\n const countries = getCountries();\n this.countryCodes = countries.map(countryCode => ({\n value: countryCode,\n label: `${countryCode} (+${getCountryCallingCode(countryCode)})`\n }));\n }\n\n validatePhoneNumber(phoneNumber: string, countryCode: string) {\n const parsedPhoneNumber = parsePhoneNumberFromString(phoneNumber, countryCode as CountryCode);\n\n if (!parsedPhoneNumber || !parsedPhoneNumber.isValid()) {\n this.onInvalidPhoneNumber.emit(`Phone number is invalid for ${this.selectedCountryName}`);\n }\n }\n\n}\n","import { CommonModule } from \"@angular/common\";\nimport { FormsModule } from \"@angular/forms\";\nimport { NgModule, ModuleWithProviders } from \"@angular/core\";\nimport { PhoneInputComponent } from \"./phone-input.component\";\nimport { OverlayModule } from \"@angular/cdk/overlay\";\nimport { ScrollingModule } from \"@angular/cdk-experimental/scrolling\";\nimport { DropdownModule } from \"mis-crystal-design-system/dropdown\";\nimport { ReactiveFormsModule } from \"@angular/forms\";\n\n\n@NgModule({\n declarations: [PhoneInputComponent],\n imports: [CommonModule,ReactiveFormsModule, FormsModule, OverlayModule, ScrollingModule, DropdownModule],\n exports: [PhoneInputComponent]\n})\nexport class PhoneInputModule {\n static forRoot(): ModuleWithProviders<PhoneInputModule> {\n return { ngModule: PhoneInputModule, providers: [] };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["FormControl","EventEmitter","getCountries","getCountryCallingCode","parsePhoneNumberFromString","Component","Input","Output","NgModule","CommonModule","ReactiveFormsModule","FormsModule","OverlayModule","ScrollingModule","DropdownModule"],"mappings":";;;;;;;QAiCE;YAtBS,mBAAc,GAAY,EAAE,CAAC;YAC7B,kBAAa,GAAY,EAAE,CAAC;YAE5B,iBAAY,GAAmB,EAAE,CAAC;YAClC,yBAAoB,GAAiB,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;YAC9D,uBAAkB,GAAY,IAAI,CAAC;YAEnC,qBAAgB,GAAW,OAAO,CAAC;YACnC,qBAAgB,GAAgB,IAAIA,iBAAW,EAAE,CAAC;YACjD,wBAAmB,GAAG,IAAIC,iBAAY,EAAO,CAAC;YAC9C,yBAAoB,GAAG,IAAIA,iBAAY,EAAU,CAAC;YACnD,sBAAiB,GAAG,EAAE,CAAC;YACvB,uBAAkB,GAAG,EAAE,CAAC;YACxB,kBAAa,GAAY,IAAI,CAAC;YAC9B,cAAS,GAAW,QAAQ,CAAC;YAC7B,gBAAW,GAAW,gBAAgB,CAAC;YACvC,mBAAc,GAAI,KAAK,CAAC;YAEjC,iBAAY,GAAmB,CAAC,EAAC,KAAK,EAAC,EAAE,EAAC,KAAK,EAAC,EAAE,EAAC,CAAC,CAAC;YAErD,wBAAmB,GAAW,EAAE,CAAC;SAEjB;QAEhB,sCAAQ,GAAR;YAAA,iBAgBC;YAfC,IAAI,IAAI,CAAC,cAAc,EAAE;gBACvB,IAAI,CAAC,gBAAgB,EAAE,CAAC;gBACxB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;gBACtC,IAAI,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BAAoB,CAAC,IAAI,CAAC,iCAA+B,IAAI,CAAC,mBAAqB,CAAC,CAAC;aAC3F;SACF;;;;gBArEFC,cAAS,SAAC;oBACT,QAAQ,EAAE,iBAAiB;oBAC3B,gvBAA2C;;iBAE5C;;;;iCAEEC,UAAK;gCACLA,UAAK;8BACLA,UAAK;+BACLA,UAAK;uCACLA,UAAK;qCACLA,UAAK;wBACLA,UAAK;mCACLA,UAAK;mCACLA,UAAK;sCACLC,WAAM;uCACNA,WAAM;oCACND,UAAK;qCACLA,UAAK;gCACLA,UAAK;4BACLA,UAAK;8BACLA,UAAK;iCACLA,UAAK;;;;QCZR;;QACS,wBAAO,GAAd;YACE,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;SACtD;;;;gBARFE,aAAQ,SAAC;oBACR,YAAY,EAAE,CAAC,mBAAmB,CAAC;oBACnC,OAAO,EAAE,CAACC,mBAAY,EAACC,yBAAmB,EAAEC,iBAAW,EAAEC,qBAAa,EAAEC,yBAAe,EAAEC,uBAAc,CAAC;oBACxG,OAAO,EAAE,CAAC,mBAAmB,CAAC;iBAC/B;;;ICdD;;;;;;;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/forms"),require("libphonenumber-js"),require("@angular/common"),require("@angular/cdk/overlay"),require("@angular/cdk-experimental/scrolling"),require("mis-crystal-design-system/dropdown")):"function"==typeof define&&define.amd?define("mis-crystal-design-system/phone-input",["exports","@angular/core","@angular/forms","libphonenumber-js","@angular/common","@angular/cdk/overlay","@angular/cdk-experimental/scrolling","mis-crystal-design-system/dropdown"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self)["mis-crystal-design-system"]=e["mis-crystal-design-system"]||{},e["mis-crystal-design-system"]["phone-input"]={}),e.ng.core,e.ng.forms,e.libphonenumberJs,e.ng.common,e.ng.cdk.overlay,e.ng.cdkExperimental.scrolling,e["mis-crystal-design-system"].dropdown)}(this,(function(e,t,n,o,i,r,d,p){"use strict";var a=function(){function e(){this.dropdownHeight="",this.dropdownWidth="",this.dropdownData=[],this.dropdownSelectedItem={value:"",label:""},this.defaultCountryCode="IN",this.inputPlaceholder="Enter",this.inputFormControl=new n.FormControl,this.onDropdownSelection=new t.EventEmitter,this.onInvalidPhoneNumber=new t.EventEmitter,this.dropdownListWidth="",this.dropdownListHeight="",this.searchEnabled=!0,this.inputType="number",this.searchLabel="Search Keyword",this.phoneValidator=!1,this.countryCodes=[{label:"",value:""}],this.selectedCountryName=""}return e.prototype.ngOnInit=function(){var e=this;if(this.phoneValidator&&(this.loadCountryCodes(),this.dropdownData=this.countryCodes,this.selectedCountryName=this.dropdownSelectedItem.label),this.defaultCountryCode){var t=this.dropdownData.find((function(t){return t.value.toUpperCase()===e.defaultCountryCode.toUpperCase()}));t&&(this.dropdownSelectedItem=t,this.selectedCountryName=t.label)}},e.prototype.handleDropdownSelection=function(e){this.dropdownSelectedItem=e,this.onDropdownSelection.emit(e),this.selectedCountryName=e.label,this.validatePhoneNumber(this.inputFormControl.value,this.dropdownSelectedItem.value)},e.prototype.loadCountryCodes=function(){var e=o.getCountries();this.countryCodes=e.map((function(e){return{value:e,label:e+" (+"+o.getCountryCallingCode(e)+")"}}))},e.prototype.validatePhoneNumber=function(e,t){var n=o.parsePhoneNumberFromString(e,t);n&&n.isValid()||this.onInvalidPhoneNumber.emit("Phone number is invalid for "+this.selectedCountryName)},e}();a.decorators=[{type:t.Component,args:[{selector:"mis-phone-input",template:'<div class="main-container-phone">\n <mis-dropdown [height]="dropdownHeight" [dropdownListWidth]="dropdownListWidth"[dropdownListHeight]="dropdownListHeight" [width]="dropdownWidth" [data]="dropdownData" [selectedItem]="dropdownSelectedItem" [label]="label" [searchEnabled]="searchEnabled" [multiLine]="false" (onChange)="handleDropdownSelection($event)" [searchLabel]="searchLabel"></mis-dropdown>\n <div class="details-field">\n <div class="input-box">\n <input\n [ngStyle]="{\'height\': inputHeight }"\n class="black-text" \n [placeholder]="inputPlaceholder"\n [formControl]="inputFormControl" \n [type]="inputType"\n />\n </div>\n </div>\n</div>\n',styles:[".main-container-phone{display:flex;border:1px solid #e0e0e0;border-radius:6px}.details-field label{display:inline-block;min-width:224px;margin-right:24px}.details-field .input-box{width:100%}.details-field .input-box input{width:100%;height:32px}input{padding:10px 16px;border:none;outline:none;width:100%;height:auto;border-radius:6px}.black-text,input{color:#181f33;line-height:24px;font-size:16px}input::-webkit-inner-spin-button,input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.main-container-phone ::ng-deep .item{padding:8px!important}.main-container-phone ::ng-deep .dropdown{border:unset!important}"]}]}],a.ctorParameters=function(){return[]},a.propDecorators={dropdownHeight:[{type:t.Input}],dropdownWidth:[{type:t.Input}],inputHeight:[{type:t.Input}],dropdownData:[{type:t.Input}],dropdownSelectedItem:[{type:t.Input}],defaultCountryCode:[{type:t.Input}],label:[{type:t.Input}],inputPlaceholder:[{type:t.Input}],inputFormControl:[{type:t.Input}],onDropdownSelection:[{type:t.Output}],onInvalidPhoneNumber:[{type:t.Output}],dropdownListWidth:[{type:t.Input}],dropdownListHeight:[{type:t.Input}],searchEnabled:[{type:t.Input}],inputType:[{type:t.Input}],searchLabel:[{type:t.Input}],phoneValidator:[{type:t.Input}]};var l=function(){function e(){}return e.forRoot=function(){return{ngModule:e,providers:[]}},e}();l.decorators=[{type:t.NgModule,args:[{declarations:[a],imports:[i.CommonModule,n.ReactiveFormsModule,n.FormsModule,r.OverlayModule,d.ScrollingModule,p.DropdownModule],exports:[a]}]}],e.PhoneInputComponent=a,e.PhoneInputModule=l,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
2
2
|
//# sourceMappingURL=mis-crystal-design-system-phone-input.umd.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../projects/mis-components/phone-input/phone-input.component.ts","../../../projects/mis-components/phone-input/phone-input.module.ts"],"names":["PhoneInputComponent","this","dropdownData","dropdownSelectedItem","value","label","inputPlaceholder","inputFormControl","FormControl","onDropdownSelection","EventEmitter","searchEnabled","inputType","searchLabel","prototype","ngOnInit","handleDropdownSelection","item","emit","Component","args","selector","template","Input","Output","PhoneInputModule","forRoot","ngModule","providers","NgModule","declarations","imports","CommonModule","ReactiveFormsModule","FormsModule","OverlayModule","ScrollingModule","DropdownModule","exports"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../projects/mis-components/phone-input/phone-input.component.ts","../../../projects/mis-components/phone-input/phone-input.module.ts"],"names":["PhoneInputComponent","this","dropdownHeight","dropdownWidth","dropdownData","dropdownSelectedItem","value","label","defaultCountryCode","inputPlaceholder","inputFormControl","FormControl","onDropdownSelection","EventEmitter","onInvalidPhoneNumber","dropdownListWidth","dropdownListHeight","searchEnabled","inputType","searchLabel","phoneValidator","countryCodes","selectedCountryName","prototype","ngOnInit","_this","loadCountryCodes","selectedCountry","find","country","toUpperCase","handleDropdownSelection","item","emit","validatePhoneNumber","countries","getCountries","map","countryCode","getCountryCallingCode","phoneNumber","parsedPhoneNumber","parsePhoneNumberFromString","isValid","Component","args","selector","template","Input","Output","PhoneInputModule","forRoot","ngModule","providers","NgModule","declarations","imports","CommonModule","ReactiveFormsModule","FormsModule","OverlayModule","ScrollingModule","DropdownModule","exports"],"mappings":"27BAiCE,SAAAA,IAtBSC,KAAAC,eAA0B,GAC1BD,KAAAE,cAAyB,GAEzBF,KAAAG,aAA+B,GAC/BH,KAAAI,qBAAqC,CAAEC,MAAO,GAAIC,MAAO,IACzDN,KAAAO,mBAA8B,KAE9BP,KAAAQ,iBAA2B,QAC3BR,KAAAS,iBAAgC,IAAIC,EAAAA,YACnCV,KAAAW,oBAAsB,IAAIC,EAAAA,aAC1BZ,KAAAa,qBAAuB,IAAID,EAAAA,aAC5BZ,KAAAc,kBAAoB,GACpBd,KAAAe,mBAAqB,GACrBf,KAAAgB,eAAyB,EACz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EAAAA,qBACAA,EAAAA,gCACAA,EAAAA,gCACAA,EAAAA,mCACAC,EAAAA,qCACAA,EAAAA,kCACAD,EAAAA,kCACAA,EAAAA,6BACAA,EAAAA,yBACAA,EAAAA,2BACAA,EAAAA,8BACAA,EAAAA,0BCZH,SAAAE,YACSA,EAAAC,QAAP,WACE,MAAO,CAAEC,SAAUF,EAAkBG,UAAW,8BAPnDC,EAAAA,SAAQT,KAAA,CAAC,CACRU,aAAc,CAACvD,GACfwD,QAAS,CAACC,EAAAA,aAAaC,EAAAA,oBAAqBC,EAAAA,YAAaC,EAAAA,cAAeC,EAAAA,gBAAiBC,EAAAA,gBACzFC,QAAS,CAAC/D","sourcesContent":["import { Component, EventEmitter, Input, OnInit, Output } from \"@angular/core\";\nimport { FormControl } from \"@angular/forms\";\nimport { parsePhoneNumberFromString, getCountryCallingCode, CountryCode, getCountries } from 'libphonenumber-js';\nimport { DropdownItem } from \"mis-crystal-design-system/dropdown\";\n\n@Component({\n selector: \"mis-phone-input\",\n templateUrl: \"./phone-input.component.html\",\n styleUrls: [\"./phone-input.component.scss\"]\n})\nexport class PhoneInputComponent implements OnInit {\n @Input() dropdownHeight?: string = \"\";\n @Input() dropdownWidth?: string = \"\";\n @Input() inputHeight?;\n @Input() dropdownData: DropdownItem[] = [];\n @Input() dropdownSelectedItem: DropdownItem = { value: \"\", label: \"\" };\n @Input() defaultCountryCode?: string = 'IN';\n @Input() label: string;\n @Input() inputPlaceholder: string = 'Enter';\n @Input() inputFormControl: FormControl = new FormControl();\n @Output() onDropdownSelection = new EventEmitter<any>();\n @Output() onInvalidPhoneNumber = new EventEmitter<string>();\n @Input() dropdownListWidth = \"\";\n @Input() dropdownListHeight = \"\";\n @Input() searchEnabled: boolean = true;\n @Input() inputType: string = \"number\";\n @Input() searchLabel: string = \"Search Keyword\"; \n @Input() phoneValidator? = false;\n \n countryCodes: DropdownItem[] = [{label:'',value:''}];\n countryCode: CountryCode | undefined;\n selectedCountryName: string = '';\n\n constructor() {}\n\n ngOnInit() {\n if (this.phoneValidator) {\n this.loadCountryCodes();\n this.dropdownData = this.countryCodes;\n this.selectedCountryName = this.dropdownSelectedItem.label;\n }\n\n if (this.defaultCountryCode) {\n const selectedCountry = this.dropdownData.find(\n country => country.value.toUpperCase() === this.defaultCountryCode.toUpperCase()\n );\n if (selectedCountry) {\n this.dropdownSelectedItem = selectedCountry;\n this.selectedCountryName = selectedCountry.label;\n }\n }\n }\n\n handleDropdownSelection(item: DropdownItem){\n this.dropdownSelectedItem = item;\n this.onDropdownSelection.emit(item);\n this.selectedCountryName = item.label;\n this.validatePhoneNumber(this.inputFormControl.value, this.dropdownSelectedItem.value);\n }\n\n loadCountryCodes() {\n const countries = getCountries();\n this.countryCodes = countries.map(countryCode => ({\n value: countryCode,\n label: `${countryCode} (+${getCountryCallingCode(countryCode)})`\n }));\n }\n\n validatePhoneNumber(phoneNumber: string, countryCode: string) {\n const parsedPhoneNumber = parsePhoneNumberFromString(phoneNumber, countryCode as CountryCode);\n\n if (!parsedPhoneNumber || !parsedPhoneNumber.isValid()) {\n this.onInvalidPhoneNumber.emit(`Phone number is invalid for ${this.selectedCountryName}`);\n }\n }\n\n}\n","import { CommonModule } from \"@angular/common\";\nimport { FormsModule } from \"@angular/forms\";\nimport { NgModule, ModuleWithProviders } from \"@angular/core\";\nimport { PhoneInputComponent } from \"./phone-input.component\";\nimport { OverlayModule } from \"@angular/cdk/overlay\";\nimport { ScrollingModule } from \"@angular/cdk-experimental/scrolling\";\nimport { DropdownModule } from \"mis-crystal-design-system/dropdown\";\nimport { ReactiveFormsModule } from \"@angular/forms\";\n\n\n@NgModule({\n declarations: [PhoneInputComponent],\n imports: [CommonModule,ReactiveFormsModule, FormsModule, OverlayModule, ScrollingModule, DropdownModule],\n exports: [PhoneInputComponent]\n})\nexport class PhoneInputModule {\n static forRoot(): ModuleWithProviders<PhoneInputModule> {\n return { ngModule: PhoneInputModule, providers: [] };\n }\n}\n"]}
|
|
@@ -60,13 +60,18 @@
|
|
|
60
60
|
var offset = this.interval - (minutes % this.interval);
|
|
61
61
|
// start date, 22 MAY === current date, 22 MAY
|
|
62
62
|
if (this.startDate === this.currDate) {
|
|
63
|
-
|
|
63
|
+
console.log("start date epoch:", this.startDateEpoch);
|
|
64
|
+
var currentTime = moment__namespace().valueOf();
|
|
64
65
|
// start date, 22 MAY === current date, 22 MAY === end date, 22 MAY
|
|
65
66
|
if (this.startDate === this.endDate) {
|
|
67
|
+
console.log("Current time:", currentTime);
|
|
68
|
+
console.log("end-interval:", moment__namespace(this.startDateEpoch).endOf("d").subtract(this.interval, "m").valueOf());
|
|
66
69
|
// current time is in last interval
|
|
67
70
|
if (currentTime >= moment__namespace(this.startDateEpoch).endOf("d").subtract(this.interval, "m").valueOf()) {
|
|
68
71
|
this.firstIntervalForStartPicker = currentTime;
|
|
69
72
|
this.firstIntervalForEndPicker = moment__namespace(this.endDateEpoch).endOf("d").valueOf();
|
|
73
|
+
console.log("firstIntervalForStartPicker", this.firstIntervalForStartPicker);
|
|
74
|
+
console.log("firstIntervalForEndPicker", this.firstIntervalForEndPicker);
|
|
70
75
|
}
|
|
71
76
|
// current time isn't in last interval
|
|
72
77
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mis-crystal-design-system-timerangepicker.umd.js","sources":["../../../projects/mis-components/timerangepicker/timerangepicker.component.ts","../../../projects/mis-components/timerangepicker/timerangepicker.module.ts","../../../projects/mis-components/timerangepicker/mis-crystal-design-system-timerangepicker.ts"],"sourcesContent":["import { Component, Input, ChangeDetectorRef, Output, EventEmitter } from \"@angular/core\";\nimport * as moment from \"moment-timezone\";\nimport { ITimeRange, ITime, TDirection } from \"./timerange.namespace\";\n\n@Component({\n selector: \"mis-timerangepicker\",\n templateUrl: \"./timerangepicker.component.html\",\n styleUrls: [\"./timerangepicker.component.scss\"]\n})\nexport class TimeRangePickerComponent {\n @Input() inputWidth: string = \"100px\";\n @Input() dropdownWidth?: string;\n @Input() height: string = \"46px\";\n @Input() timezone: string = \"Asia/Kolkata\";\n @Input() startDateEpoch: number = moment().tz(this.timezone).valueOf();\n @Input() endDateEpoch: number = moment().tz(this.timezone).valueOf();\n @Input() givenStartTime: number;\n @Input() givenEndTime: number;\n @Input() clockFormat: number = 12;\n @Input() interval: number = 15;\n @Input() showTooltip: boolean = true;\n @Input() direction: TDirection = 'row';\n @Input() gap: string = '1rem';\n\n @Output() timeRangeEmitter = new EventEmitter<ITimeRange>();\n\n startDate!: string;\n endDate!: string;\n currDate!: string;\n timeFormat!: string;\n firstIntervalForStartPicker: number = moment().valueOf();\n firstIntervalForEndPicker: number = moment().valueOf();\n startTime!: ITime;\n endTime!: ITime;\n rangeValidity: boolean = true;\n triggerChange: boolean = true;\n\n constructor(private cdr: ChangeDetectorRef) {}\n\n ngOnInit() {}\n\n ngOnChanges() {\n this.timeFormat = this.clockFormat === 12 ? \"hh:mm a\" : \"HH:mm\";\n moment.tz.setDefault(this.timezone);\n this.startDate = moment(this.startDateEpoch).format(\"DD-MM-YYYY\");\n this.endDate = moment(this.endDateEpoch).format(\"DD-MM-YYYY\");\n this.currDate = moment().format(\"DD-MM-YYYY\");\n this.setFirstIntervals();\n }\n\n // calculate the first interval of the picker\n setFirstIntervals(): void {\n const minutes = moment().minutes();\n const offset = this.interval - (minutes % this.interval);\n\n // start date, 22 MAY === current date, 22 MAY\n if( this.startDate === this.currDate ){\n const currentTime = moment(this.startDateEpoch).valueOf();\n\n // start date, 22 MAY === current date, 22 MAY === end date, 22 MAY\n if(this.startDate === this.endDate){\n\n // current time is in last interval\n if( currentTime >= moment(this.startDateEpoch).endOf(\"d\").subtract(this.interval,\"m\").valueOf()){\n this.firstIntervalForStartPicker = currentTime;\n this.firstIntervalForEndPicker = moment(this.endDateEpoch).endOf(\"d\").valueOf();\n }\n // current time isn't in last interval\n else {\n this.firstIntervalForStartPicker = moment().add(offset, \"m\").valueOf();\n this.firstIntervalForEndPicker = moment().add(offset, \"m\").add(this.interval, \"m\").valueOf();\n }\n } \n // start date, 22 MAY === current date, 22 MAY !== end date, 30 MAY\n else {\n // current time is in last interval\n if( currentTime >= moment(this.startDateEpoch).endOf(\"d\").subtract(this.interval,\"m\").valueOf()){\n this.firstIntervalForStartPicker = currentTime;\n this.firstIntervalForEndPicker = moment(this.endDateEpoch).endOf(\"d\").valueOf();\n }\n // current time isn't in last interval\n else {\n this.firstIntervalForStartPicker = moment().add(offset, \"m\").valueOf();\n this.firstIntervalForEndPicker = moment(this.endDateEpoch).valueOf();\n }\n }\n }\n // start date, 30 MAY !== current date, 22 MAY\n else {\n // start date === end Date\n if( this.startDate === this.endDate){\n this.firstIntervalForStartPicker = moment(this.startDateEpoch).startOf(\"d\").valueOf();\n this.firstIntervalForEndPicker = moment(this.endDateEpoch).add(this.interval, \"m\").valueOf();\n } \n // start date !== end date\n else {\n this.firstIntervalForStartPicker = moment(this.startDateEpoch).startOf(\"d\").valueOf();\n this.firstIntervalForEndPicker = moment(this.startDateEpoch).startOf(\"d\").valueOf();\n }\n\n }\n\n if(this.givenStartTime)\n this.firstIntervalForStartPicker = this.givenStartTime;\n \n if(this.givenEndTime)\n this.firstIntervalForEndPicker = this.givenEndTime;\n \n this.startTime = {\n valid: true,\n time: moment(this.firstIntervalForStartPicker).format(this.timeFormat),\n epoch: moment(this.firstIntervalForStartPicker).valueOf()\n };\n\n this.endTime = {\n valid: true,\n time: moment(this.firstIntervalForEndPicker).format(this.timeFormat),\n epoch: moment(this.firstIntervalForEndPicker).valueOf()\n };\n }\n\n emitTimeRange(data: ITimeRange): void {\n this.timeRangeEmitter.emit(data);\n }\n\n //handlers catch the emitted values and run validation\n startPickerHandler(time: ITime): void {\n this.startTime = time;\n this.rangeValidity = true;\n // if the start time changes and the start date is the same as the end date\n // and the start time >= end time\n // update the first interval of end picker according to the time set in start picker\n if (this.startDate === this.endDate) {\n let minutes = moment(this.startTime.time, this.timeFormat).minutes();\n let offset = this.interval - (minutes % this.interval);\n this.firstIntervalForEndPicker = moment(`${this.startDate} ${this.startTime.time}`, `'DD-MM-YYYY' ${this.timeFormat}`)\n .add(offset, \"m\")\n .valueOf();\n\n // if the first interval == 12:00am, set it as 11:59pm\n const intervalAsString = moment(this.firstIntervalForEndPicker).format(this.timeFormat);\n const endOfDayAsString = moment(moment(`${this.startDate}`, `DD-MM-YYYY ${this.timeFormat}`).endOf(\"d\").add(1, \"m\")).format(this.timeFormat);\n if (intervalAsString === endOfDayAsString) {\n this.firstIntervalForEndPicker = moment(`${this.startDate} ${this.startTime.time}`, `'DD-MM-YYYY' ${this.timeFormat}`).endOf(\"d\").valueOf();\n }\n\n } else {\n const validity =\n this.checkTimeValidity(this.startTime.time.trim(), this.startDateEpoch) &&\n this.checkTimeValidity(this.endTime.time.trim(), this.endDateEpoch);\n\n this.rangeValidation(validity);\n this.emitTimeRange({\n valid: validity && this.rangeValidity,\n startTime: this.startTime.time,\n endTime: this.endTime.time,\n startEpoch: moment(`${this.startDate} ${this.startTime.time}`, `DD-MM-YYYY ${this.timeFormat}`).valueOf(),\n endEpoch: moment(`${this.endDate} ${this.endTime.time}`, `DD-MM-YYYY ${this.timeFormat}`).valueOf()\n });\n }\n\n this.triggerChange = !this.triggerChange;\n }\n\n endPickerHandler(time: ITime): void {\n this.endTime = time;\n\n const validity =\n this.checkTimeValidity(this.startTime.time.trim(), this.startDateEpoch) && this.checkTimeValidity(this.endTime.time.trim(), this.endDateEpoch);\n\n this.rangeValidation(validity);\n this.emitTimeRange({\n valid: validity && this.rangeValidity,\n startTime: this.startTime.time,\n endTime: this.endTime.time,\n startEpoch: moment(`${this.startDate} ${this.startTime.time}`, `DD-MM-YYYY ${this.timeFormat}`).valueOf(),\n endEpoch: moment(`${this.endDate} ${this.endTime.time}`, `DD-MM-YYYY ${this.timeFormat}`).valueOf()\n });\n }\n\n checkTimeValidity(time: string, date: number): boolean {\n const RE12 = /^(([0][1-9]|1[0-2]):([0-5][0-9])( )?(am|pm|AM|PM))$/i;\n const RE24 = /^([01][0-9]|2[0-3]):[0-5][0-9]$/;\n const RE = this.clockFormat === 12 ? RE12 : RE24;\n\n const timeMoment = moment(`${moment(date).format(\"DD-MM-YYYY\")} ${time}`, `'DD-MM-YYYY' ${this.timeFormat}`);\n let flag: boolean = false;\n\n // if the first interval is set to the start of the day\n // then we don't check its validity against the current time\n if ((this.givenStartTime && this.givenEndTime) || (this.startDate !== this.endDate && this.startDate !== this.currDate)) {\n flag = time.match(RE) ? true : false;\n } else {\n flag = time.match(RE) && timeMoment.diff(moment(), \"m\") >= 0 ? true : false;\n }\n\n return flag;\n }\n\n // validates end picker's input according to the start picker's input\n rangeValidation(validity: boolean) {\n if (validity && this.startDate === this.endDate) {\n const startMoment = moment(this.startTime.time, this.timeFormat);\n const endMoment = moment(this.endTime.time, this.timeFormat);\n this.rangeValidity = endMoment.diff(startMoment, \"m\") >= 1 ? true : false;\n this.cdr.detectChanges();\n }\n }\n}\n","import { NgModule, ModuleWithProviders } from \"@angular/core\";\nimport { CommonModule } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\nimport { TimeRangePickerComponent } from \"./timerangepicker.component\";\nimport { TimePickerModule } from \"mis-crystal-design-system/timepicker\";\n\n@NgModule({\n declarations: [TimeRangePickerComponent],\n imports: [CommonModule, FormsModule, TimePickerModule],\n exports: [TimeRangePickerComponent]\n})\nexport class TimeRangePickerModule {\n static forRoot(): ModuleWithProviders<TimeRangePickerModule> {\n return { ngModule: TimeRangePickerModule, providers: [] };\n }\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["moment","EventEmitter","moment.tz","Component","ChangeDetectorRef","Input","Output","NgModule","CommonModule","FormsModule","TimePickerModule"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAqCE,kCAAoB,GAAsB;YAAtB,QAAG,GAAH,GAAG,CAAmB;YA3BjC,eAAU,GAAW,OAAO,CAAC;YAE7B,WAAM,GAAW,MAAM,CAAC;YACxB,aAAQ,GAAW,cAAc,CAAC;YAClC,mBAAc,GAA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6BAUzCC,UAAK;gCACLA,UAAK;yBACLA,UAAK;2BACLA,UAAK;iCACLA,UAAK;+BACLA,UAAK;iCACLA,UAAK;+BACLA,UAAK;8BACLA,UAAK;2BACLA,UAAK;8BACLA,UAAK;4BACLA,UAAK;sBACLA,UAAK;mCAELC,WAAM;;;;QCbT;;QACS,6BAAO,GAAd;YACE,OAAO,EAAE,QAAQ,EAAE,qBAAqB,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;SAC3D;;;;gBARFC,aAAQ,SAAC;oBACR,YAAY,EAAE,CAAC,wBAAwB,CAAC;oBACxC,OAAO,EAAE,CAACC,mBAAY,EAAEC,iBAAW,EAAEC,2BAAgB,CAAC;oBACtD,OAAO,EAAE,CAAC,wBAAwB,CAAC;iBACpC;;;ICVD;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"mis-crystal-design-system-timerangepicker.umd.js","sources":["../../../projects/mis-components/timerangepicker/timerangepicker.component.ts","../../../projects/mis-components/timerangepicker/timerangepicker.module.ts","../../../projects/mis-components/timerangepicker/mis-crystal-design-system-timerangepicker.ts"],"sourcesContent":["import { Component, Input, ChangeDetectorRef, Output, EventEmitter } from \"@angular/core\";\nimport * as moment from \"moment-timezone\";\nimport { ITimeRange, ITime, TDirection } from \"./timerange.namespace\";\n\n@Component({\n selector: \"mis-timerangepicker\",\n templateUrl: \"./timerangepicker.component.html\",\n styleUrls: [\"./timerangepicker.component.scss\"]\n})\nexport class TimeRangePickerComponent {\n @Input() inputWidth: string = \"100px\";\n @Input() dropdownWidth?: string;\n @Input() height: string = \"46px\";\n @Input() timezone: string = \"Asia/Kolkata\";\n @Input() startDateEpoch: number = moment().tz(this.timezone).valueOf();\n @Input() endDateEpoch: number = moment().tz(this.timezone).valueOf();\n @Input() givenStartTime: number;\n @Input() givenEndTime: number;\n @Input() clockFormat: number = 12;\n @Input() interval: number = 15;\n @Input() showTooltip: boolean = true;\n @Input() direction: TDirection = 'row';\n @Input() gap: string = '1rem';\n\n @Output() timeRangeEmitter = new EventEmitter<ITimeRange>();\n\n startDate!: string;\n endDate!: string;\n currDate!: string;\n timeFormat!: string;\n firstIntervalForStartPicker: number = moment().valueOf();\n firstIntervalForEndPicker: number = moment().valueOf();\n startTime!: ITime;\n endTime!: ITime;\n rangeValidity: boolean = true;\n triggerChange: boolean = true;\n\n constructor(private cdr: ChangeDetectorRef) {}\n\n ngOnInit() {}\n\n ngOnChanges() {\n this.timeFormat = this.clockFormat === 12 ? \"hh:mm a\" : \"HH:mm\";\n moment.tz.setDefault(this.timezone);\n this.startDate = moment(this.startDateEpoch).format(\"DD-MM-YYYY\");\n this.endDate = moment(this.endDateEpoch).format(\"DD-MM-YYYY\");\n this.currDate = moment().format(\"DD-MM-YYYY\");\n this.setFirstIntervals();\n }\n\n // calculate the first interval of the picker\n setFirstIntervals(): void {\n const minutes = moment().minutes();\n const offset = this.interval - (minutes % this.interval);\n\n // start date, 22 MAY === current date, 22 MAY\n if( this.startDate === this.currDate ){\n console.log(\"start date epoch:\",this.startDateEpoch);\n const currentTime = moment().valueOf();\n\n // start date, 22 MAY === current date, 22 MAY === end date, 22 MAY\n if(this.startDate === this.endDate){\n console.log(\"Current time:\",currentTime);\n console.log(\"end-interval:\",moment(this.startDateEpoch).endOf(\"d\").subtract(this.interval,\"m\").valueOf());\n // current time is in last interval\n if( currentTime >= moment(this.startDateEpoch).endOf(\"d\").subtract(this.interval,\"m\").valueOf()){\n this.firstIntervalForStartPicker = currentTime;\n this.firstIntervalForEndPicker = moment(this.endDateEpoch).endOf(\"d\").valueOf();\n console.log(\"firstIntervalForStartPicker\",this.firstIntervalForStartPicker);\n console.log(\"firstIntervalForEndPicker\",this.firstIntervalForEndPicker);\n }\n // current time isn't in last interval\n else {\n this.firstIntervalForStartPicker = moment().add(offset, \"m\").valueOf();\n this.firstIntervalForEndPicker = moment().add(offset, \"m\").add(this.interval, \"m\").valueOf();\n }\n } \n // start date, 22 MAY === current date, 22 MAY !== end date, 30 MAY\n else {\n // current time is in last interval\n if( currentTime >= moment(this.startDateEpoch).endOf(\"d\").subtract(this.interval,\"m\").valueOf()){\n this.firstIntervalForStartPicker = currentTime;\n this.firstIntervalForEndPicker = moment(this.endDateEpoch).endOf(\"d\").valueOf();\n }\n // current time isn't in last interval\n else {\n this.firstIntervalForStartPicker = moment().add(offset, \"m\").valueOf();\n this.firstIntervalForEndPicker = moment(this.endDateEpoch).valueOf();\n }\n }\n }\n // start date, 30 MAY !== current date, 22 MAY\n else {\n // start date === end Date\n if( this.startDate === this.endDate){\n this.firstIntervalForStartPicker = moment(this.startDateEpoch).startOf(\"d\").valueOf();\n this.firstIntervalForEndPicker = moment(this.endDateEpoch).add(this.interval, \"m\").valueOf();\n } \n // start date !== end date\n else {\n this.firstIntervalForStartPicker = moment(this.startDateEpoch).startOf(\"d\").valueOf();\n this.firstIntervalForEndPicker = moment(this.startDateEpoch).startOf(\"d\").valueOf();\n }\n\n }\n\n if(this.givenStartTime)\n this.firstIntervalForStartPicker = this.givenStartTime;\n \n if(this.givenEndTime)\n this.firstIntervalForEndPicker = this.givenEndTime;\n \n this.startTime = {\n valid: true,\n time: moment(this.firstIntervalForStartPicker).format(this.timeFormat),\n epoch: moment(this.firstIntervalForStartPicker).valueOf()\n };\n\n this.endTime = {\n valid: true,\n time: moment(this.firstIntervalForEndPicker).format(this.timeFormat),\n epoch: moment(this.firstIntervalForEndPicker).valueOf()\n };\n }\n\n emitTimeRange(data: ITimeRange): void {\n this.timeRangeEmitter.emit(data);\n }\n\n //handlers catch the emitted values and run validation\n startPickerHandler(time: ITime): void {\n this.startTime = time;\n this.rangeValidity = true;\n // if the start time changes and the start date is the same as the end date\n // and the start time >= end time\n // update the first interval of end picker according to the time set in start picker\n if (this.startDate === this.endDate) {\n let minutes = moment(this.startTime.time, this.timeFormat).minutes();\n let offset = this.interval - (minutes % this.interval);\n this.firstIntervalForEndPicker = moment(`${this.startDate} ${this.startTime.time}`, `'DD-MM-YYYY' ${this.timeFormat}`)\n .add(offset, \"m\")\n .valueOf();\n\n // if the first interval == 12:00am, set it as 11:59pm\n const intervalAsString = moment(this.firstIntervalForEndPicker).format(this.timeFormat);\n const endOfDayAsString = moment(moment(`${this.startDate}`, `DD-MM-YYYY ${this.timeFormat}`).endOf(\"d\").add(1, \"m\")).format(this.timeFormat);\n if (intervalAsString === endOfDayAsString) {\n this.firstIntervalForEndPicker = moment(`${this.startDate} ${this.startTime.time}`, `'DD-MM-YYYY' ${this.timeFormat}`).endOf(\"d\").valueOf();\n }\n\n } else {\n const validity =\n this.checkTimeValidity(this.startTime.time.trim(), this.startDateEpoch) &&\n this.checkTimeValidity(this.endTime.time.trim(), this.endDateEpoch);\n\n this.rangeValidation(validity);\n this.emitTimeRange({\n valid: validity && this.rangeValidity,\n startTime: this.startTime.time,\n endTime: this.endTime.time,\n startEpoch: moment(`${this.startDate} ${this.startTime.time}`, `DD-MM-YYYY ${this.timeFormat}`).valueOf(),\n endEpoch: moment(`${this.endDate} ${this.endTime.time}`, `DD-MM-YYYY ${this.timeFormat}`).valueOf()\n });\n }\n\n this.triggerChange = !this.triggerChange;\n }\n\n endPickerHandler(time: ITime): void {\n this.endTime = time;\n\n const validity =\n this.checkTimeValidity(this.startTime.time.trim(), this.startDateEpoch) && this.checkTimeValidity(this.endTime.time.trim(), this.endDateEpoch);\n\n this.rangeValidation(validity);\n this.emitTimeRange({\n valid: validity && this.rangeValidity,\n startTime: this.startTime.time,\n endTime: this.endTime.time,\n startEpoch: moment(`${this.startDate} ${this.startTime.time}`, `DD-MM-YYYY ${this.timeFormat}`).valueOf(),\n endEpoch: moment(`${this.endDate} ${this.endTime.time}`, `DD-MM-YYYY ${this.timeFormat}`).valueOf()\n });\n }\n\n checkTimeValidity(time: string, date: number): boolean {\n const RE12 = /^(([0][1-9]|1[0-2]):([0-5][0-9])( )?(am|pm|AM|PM))$/i;\n const RE24 = /^([01][0-9]|2[0-3]):[0-5][0-9]$/;\n const RE = this.clockFormat === 12 ? RE12 : RE24;\n\n const timeMoment = moment(`${moment(date).format(\"DD-MM-YYYY\")} ${time}`, `'DD-MM-YYYY' ${this.timeFormat}`);\n let flag: boolean = false;\n\n // if the first interval is set to the start of the day\n // then we don't check its validity against the current time\n if ((this.givenStartTime && this.givenEndTime) || (this.startDate !== this.endDate && this.startDate !== this.currDate)) {\n flag = time.match(RE) ? true : false;\n } else {\n flag = time.match(RE) && timeMoment.diff(moment(), \"m\") >= 0 ? true : false;\n }\n\n return flag;\n }\n\n // validates end picker's input according to the start picker's input\n rangeValidation(validity: boolean) {\n if (validity && this.startDate === this.endDate) {\n const startMoment = moment(this.startTime.time, this.timeFormat);\n const endMoment = moment(this.endTime.time, this.timeFormat);\n this.rangeValidity = endMoment.diff(startMoment, \"m\") >= 1 ? true : false;\n this.cdr.detectChanges();\n }\n }\n}\n","import { NgModule, ModuleWithProviders } from \"@angular/core\";\nimport { CommonModule } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\nimport { TimeRangePickerComponent } from \"./timerangepicker.component\";\nimport { TimePickerModule } from \"mis-crystal-design-system/timepicker\";\n\n@NgModule({\n declarations: [TimeRangePickerComponent],\n imports: [CommonModule, FormsModule, TimePickerModule],\n exports: [TimeRangePickerComponent]\n})\nexport class TimeRangePickerModule {\n static forRoot(): ModuleWithProviders<TimeRangePickerModule> {\n return { ngModule: TimeRangePickerModule, providers: [] };\n }\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["moment","EventEmitter","moment.tz","Component","ChangeDetectorRef","Input","Output","NgModule","CommonModule","FormsModule","TimePickerModule"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAqCE,kCAAoB,GAAsB;YAAtB,QAAG,GAAH,GAAG,CAAmB;YA3BjC,eAAU,GAAW,OAAO,CAAC;YAE7B,WAAM,GAAW,MAAM,CAAC;YACxB,aAAQ,GAAW,cAAc,CAAC;YAClC,mBAAc,GAAWA,iBAAM,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAA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AU,CAAC,CAAC;gBACjE,IAAM,SAAS,GAAGA,iBAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;gBAC7D,IAAI,CAAC,aAAa,GAAG,SAAS,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,KAAK,CAAC;gBAC1E,IAAI,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC;aAC1B;SACF;;;;gBA/MFG,cAAS,SAAC;oBACT,QAAQ,EAAE,qBAAqB;oBAC/B,wlCAA+C;;iBAEhD;;;gBAR0BC,sBAAiB;;;6BAUzCC,UAAK;gCACLA,UAAK;yBACLA,UAAK;2BACLA,UAAK;iCACLA,UAAK;+BACLA,UAAK;iCACLA,UAAK;+BACLA,UAAK;8BACLA,UAAK;2BACLA,UAAK;8BACLA,UAAK;4BACLA,UAAK;sBACLA,UAAK;mCAELC,WAAM;;;;QCbT;;QACS,6BAAO,GAAd;YACE,OAAO,EAAE,QAAQ,EAAE,qBAAqB,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;SAC3D;;;;gBARFC,aAAQ,SAAC;oBACR,YAAY,EAAE,CAAC,wBAAwB,CAAC;oBACxC,OAAO,EAAE,CAACC,mBAAY,EAAEC,iBAAW,EAAEC,2BAAgB,CAAC;oBACtD,OAAO,EAAE,CAAC,wBAAwB,CAAC;iBACpC;;;ICVD;;;;;;;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("moment-timezone"),require("@angular/common"),require("@angular/forms"),require("mis-crystal-design-system/timepicker")):"function"==typeof define&&define.amd?define("mis-crystal-design-system/timerangepicker",["exports","@angular/core","moment-timezone","@angular/common","@angular/forms","mis-crystal-design-system/timepicker"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self)["mis-crystal-design-system"]=t["mis-crystal-design-system"]||{},t["mis-crystal-design-system"].timerangepicker={}),t.ng.core,t.moment,t.ng.common,t.ng.forms,t["mis-crystal-design-system"].timepicker)}(this,(function(t,e,i,r,a,n){"use strict";function s(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(i){if("default"!==i){var r=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return t[i]}})}})),e.default=t,Object.freeze(e)}var o=s(i),h=function(){function t(t){this.cdr=t,this.inputWidth="100px",this.height="46px",this.timezone="Asia/Kolkata",this.startDateEpoch=o().tz(this.timezone).valueOf(),this.endDateEpoch=o().tz(this.timezone).valueOf(),this.clockFormat=12,this.interval=15,this.showTooltip=!0,this.direction="row",this.gap="1rem",this.timeRangeEmitter=new e.EventEmitter,this.firstIntervalForStartPicker=o().valueOf(),this.firstIntervalForEndPicker=o().valueOf(),this.rangeValidity=!0,this.triggerChange=!0}return t.prototype.ngOnInit=function(){},t.prototype.ngOnChanges=function(){this.timeFormat=12===this.clockFormat?"hh:mm a":"HH:mm",i.tz.setDefault(this.timezone),this.startDate=o(this.startDateEpoch).format("DD-MM-YYYY"),this.endDate=o(this.endDateEpoch).format("DD-MM-YYYY"),this.currDate=o().format("DD-MM-YYYY"),this.setFirstIntervals()},t.prototype.setFirstIntervals=function(){var t=o().minutes(),e=this.interval-t%this.interval;if(this.startDate===this.currDate){var i=o(
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("moment-timezone"),require("@angular/common"),require("@angular/forms"),require("mis-crystal-design-system/timepicker")):"function"==typeof define&&define.amd?define("mis-crystal-design-system/timerangepicker",["exports","@angular/core","moment-timezone","@angular/common","@angular/forms","mis-crystal-design-system/timepicker"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self)["mis-crystal-design-system"]=t["mis-crystal-design-system"]||{},t["mis-crystal-design-system"].timerangepicker={}),t.ng.core,t.moment,t.ng.common,t.ng.forms,t["mis-crystal-design-system"].timepicker)}(this,(function(t,e,i,r,a,n){"use strict";function s(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(i){if("default"!==i){var r=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return t[i]}})}})),e.default=t,Object.freeze(e)}var o=s(i),h=function(){function t(t){this.cdr=t,this.inputWidth="100px",this.height="46px",this.timezone="Asia/Kolkata",this.startDateEpoch=o().tz(this.timezone).valueOf(),this.endDateEpoch=o().tz(this.timezone).valueOf(),this.clockFormat=12,this.interval=15,this.showTooltip=!0,this.direction="row",this.gap="1rem",this.timeRangeEmitter=new e.EventEmitter,this.firstIntervalForStartPicker=o().valueOf(),this.firstIntervalForEndPicker=o().valueOf(),this.rangeValidity=!0,this.triggerChange=!0}return t.prototype.ngOnInit=function(){},t.prototype.ngOnChanges=function(){this.timeFormat=12===this.clockFormat?"hh:mm a":"HH:mm",i.tz.setDefault(this.timezone),this.startDate=o(this.startDateEpoch).format("DD-MM-YYYY"),this.endDate=o(this.endDateEpoch).format("DD-MM-YYYY"),this.currDate=o().format("DD-MM-YYYY"),this.setFirstIntervals()},t.prototype.setFirstIntervals=function(){var t=o().minutes(),e=this.interval-t%this.interval;if(this.startDate===this.currDate){console.log("start date epoch:",this.startDateEpoch);var i=o().valueOf();this.startDate===this.endDate?(console.log("Current time:",i),console.log("end-interval:",o(this.startDateEpoch).endOf("d").subtract(this.interval,"m").valueOf()),i>=o(this.startDateEpoch).endOf("d").subtract(this.interval,"m").valueOf()?(this.firstIntervalForStartPicker=i,this.firstIntervalForEndPicker=o(this.endDateEpoch).endOf("d").valueOf(),console.log("firstIntervalForStartPicker",this.firstIntervalForStartPicker),console.log("firstIntervalForEndPicker",this.firstIntervalForEndPicker)):(this.firstIntervalForStartPicker=o().add(e,"m").valueOf(),this.firstIntervalForEndPicker=o().add(e,"m").add(this.interval,"m").valueOf())):i>=o(this.startDateEpoch).endOf("d").subtract(this.interval,"m").valueOf()?(this.firstIntervalForStartPicker=i,this.firstIntervalForEndPicker=o(this.endDateEpoch).endOf("d").valueOf()):(this.firstIntervalForStartPicker=o().add(e,"m").valueOf(),this.firstIntervalForEndPicker=o(this.endDateEpoch).valueOf())}else this.startDate===this.endDate?(this.firstIntervalForStartPicker=o(this.startDateEpoch).startOf("d").valueOf(),this.firstIntervalForEndPicker=o(this.endDateEpoch).add(this.interval,"m").valueOf()):(this.firstIntervalForStartPicker=o(this.startDateEpoch).startOf("d").valueOf(),this.firstIntervalForEndPicker=o(this.startDateEpoch).startOf("d").valueOf());this.givenStartTime&&(this.firstIntervalForStartPicker=this.givenStartTime),this.givenEndTime&&(this.firstIntervalForEndPicker=this.givenEndTime),this.startTime={valid:!0,time:o(this.firstIntervalForStartPicker).format(this.timeFormat),epoch:o(this.firstIntervalForStartPicker).valueOf()},this.endTime={valid:!0,time:o(this.firstIntervalForEndPicker).format(this.timeFormat),epoch:o(this.firstIntervalForEndPicker).valueOf()}},t.prototype.emitTimeRange=function(t){this.timeRangeEmitter.emit(t)},t.prototype.startPickerHandler=function(t){if(this.startTime=t,this.rangeValidity=!0,this.startDate===this.endDate){var e=o(this.startTime.time,this.timeFormat).minutes(),i=this.interval-e%this.interval;this.firstIntervalForEndPicker=o(this.startDate+" "+this.startTime.time,"'DD-MM-YYYY' "+this.timeFormat).add(i,"m").valueOf(),o(this.firstIntervalForEndPicker).format(this.timeFormat)===o(o(""+this.startDate,"DD-MM-YYYY "+this.timeFormat).endOf("d").add(1,"m")).format(this.timeFormat)&&(this.firstIntervalForEndPicker=o(this.startDate+" "+this.startTime.time,"'DD-MM-YYYY' "+this.timeFormat).endOf("d").valueOf())}else{var r=this.checkTimeValidity(this.startTime.time.trim(),this.startDateEpoch)&&this.checkTimeValidity(this.endTime.time.trim(),this.endDateEpoch);this.rangeValidation(r),this.emitTimeRange({valid:r&&this.rangeValidity,startTime:this.startTime.time,endTime:this.endTime.time,startEpoch:o(this.startDate+" "+this.startTime.time,"DD-MM-YYYY "+this.timeFormat).valueOf(),endEpoch:o(this.endDate+" "+this.endTime.time,"DD-MM-YYYY "+this.timeFormat).valueOf()})}this.triggerChange=!this.triggerChange},t.prototype.endPickerHandler=function(t){this.endTime=t;var e=this.checkTimeValidity(this.startTime.time.trim(),this.startDateEpoch)&&this.checkTimeValidity(this.endTime.time.trim(),this.endDateEpoch);this.rangeValidation(e),this.emitTimeRange({valid:e&&this.rangeValidity,startTime:this.startTime.time,endTime:this.endTime.time,startEpoch:o(this.startDate+" "+this.startTime.time,"DD-MM-YYYY "+this.timeFormat).valueOf(),endEpoch:o(this.endDate+" "+this.endTime.time,"DD-MM-YYYY "+this.timeFormat).valueOf()})},t.prototype.checkTimeValidity=function(t,e){var i=12===this.clockFormat?/^(([0][1-9]|1[0-2]):([0-5][0-9])( )?(am|pm|AM|PM))$/i:/^([01][0-9]|2[0-3]):[0-5][0-9]$/,r=o(o(e).format("DD-MM-YYYY")+" "+t,"'DD-MM-YYYY' "+this.timeFormat);return this.givenStartTime&&this.givenEndTime||this.startDate!==this.endDate&&this.startDate!==this.currDate?!!t.match(i):!!(t.match(i)&&r.diff(o(),"m")>=0)},t.prototype.rangeValidation=function(t){if(t&&this.startDate===this.endDate){var e=o(this.startTime.time,this.timeFormat),i=o(this.endTime.time,this.timeFormat);this.rangeValidity=i.diff(e,"m")>=1,this.cdr.detectChanges()}},t}();h.decorators=[{type:e.Component,args:[{selector:"mis-timerangepicker",template:'<div class="rangepicker-container" [ngStyle]="{\'flexDirection\': direction, \'gap\': gap}">\n <mis-timepicker\n [clockFormat]="clockFormat"\n [interval]="interval"\n [dateAsEpoch]="startDateEpoch"\n [firstInterval]="firstIntervalForStartPicker"\n (timeEmitter)="startPickerHandler($event)"\n [timezone]="timezone"\n [height]="height"\n [inputWidth]="inputWidth"\n [dropdownWidth]="dropdownWidth"\n [showTooltip]="showTooltip"\n [givenTime]="givenStartTime"\n ></mis-timepicker>\n <p *ngIf="direction === \'row\'">-</p>\n <mis-timepicker\n [clockFormat]="clockFormat"\n [interval]="interval"\n [dateAsEpoch]="endDateEpoch"\n [firstInterval]="firstIntervalForEndPicker"\n (timeEmitter)="endPickerHandler($event)"\n [rangeValidity]="rangeValidity"\n [timezone]="timezone"\n [height]="height"\n [inputWidth]="inputWidth"\n [dropdownWidth]="dropdownWidth"\n [showTooltip]="showTooltip"\n [givenTime]="givenEndTime"\n [triggerChange]="triggerChange"\n ></mis-timepicker>\n</div>\n',styles:[".rangepicker-container{display:flex;gap:1rem;align-items:center}p{margin:0;display:inline-flex;align-items:center}"]}]}],h.ctorParameters=function(){return[{type:e.ChangeDetectorRef}]},h.propDecorators={inputWidth:[{type:e.Input}],dropdownWidth:[{type:e.Input}],height:[{type:e.Input}],timezone:[{type:e.Input}],startDateEpoch:[{type:e.Input}],endDateEpoch:[{type:e.Input}],givenStartTime:[{type:e.Input}],givenEndTime:[{type:e.Input}],clockFormat:[{type:e.Input}],interval:[{type:e.Input}],showTooltip:[{type:e.Input}],direction:[{type:e.Input}],gap:[{type:e.Input}],timeRangeEmitter:[{type:e.Output}]};var m=function(){function t(){}return t.forRoot=function(){return{ngModule:t,providers:[]}},t}();m.decorators=[{type:e.NgModule,args:[{declarations:[h],imports:[r.CommonModule,a.FormsModule,n.TimePickerModule],exports:[h]}]}],t.TimeRangePickerComponent=h,t.TimeRangePickerModule=m,Object.defineProperty(t,"__esModule",{value:!0})}));
|
|
2
2
|
//# sourceMappingURL=mis-crystal-design-system-timerangepicker.umd.min.js.map
|