monkey-style-guide 2.0.86 → 2.0.88

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.
Files changed (29) hide show
  1. package/assets/scss/partials/components/_index.scss +1 -0
  2. package/assets/scss/partials/components/_input-phone.scss +17 -0
  3. package/bundles/monkey-style-guide.umd.js +228 -9
  4. package/bundles/monkey-style-guide.umd.js.map +1 -1
  5. package/esm2015/lib/components/date-range-picker/date-range-picker.component.js +9 -6
  6. package/esm2015/lib/components/index.js +2 -1
  7. package/esm2015/lib/components/index.ngsummary.json +1 -1
  8. package/esm2015/lib/components/input-phone/index.js +3 -0
  9. package/esm2015/lib/components/input-phone/index.ngsummary.json +1 -0
  10. package/esm2015/lib/components/input-phone/input-phone.component.js +205 -0
  11. package/esm2015/lib/components/input-phone/input-phone.component.ngfactory.js +27 -0
  12. package/esm2015/lib/components/input-phone/input-phone.component.ngsummary.json +1 -0
  13. package/esm2015/lib/components/input-phone/input-phone.module.js +25 -0
  14. package/esm2015/lib/components/input-phone/input-phone.module.ngfactory.js +18 -0
  15. package/esm2015/lib/components/input-phone/input-phone.module.ngsummary.json +1 -0
  16. package/esm2015/monkey-style-guide.ngsummary.json +1 -1
  17. package/esm2015/public-api.ngsummary.json +1 -1
  18. package/fesm2015/monkey-style-guide.js +225 -6
  19. package/fesm2015/monkey-style-guide.js.map +1 -1
  20. package/lib/components/index.d.ts +1 -0
  21. package/lib/components/input-phone/index.d.ts +2 -0
  22. package/lib/components/input-phone/input-phone.component.d.ts +61 -0
  23. package/lib/components/input-phone/input-phone.component.ngfactory.d.ts +1 -0
  24. package/lib/components/input-phone/input-phone.module.d.ts +2 -0
  25. package/lib/components/input-phone/input-phone.module.ngfactory.d.ts +3 -0
  26. package/monkey-style-guide-2.0.88.tgz +0 -0
  27. package/monkey-style-guide.metadata.json +1 -1
  28. package/package.json +3 -2
  29. package/monkey-style-guide-2.0.86.tgz +0 -0
@@ -5,6 +5,7 @@
5
5
  **************************/
6
6
  @import 'badge';
7
7
  @import 'input';
8
+ @import 'input-phone';
8
9
  @import 'select';
9
10
  @import 'buttons';
10
11
  @import 'checkbox';
@@ -0,0 +1,17 @@
1
+ /**************************
2
+ * Copyright Monkey Exchange. All Rights Reserved
3
+ * This style guide was developed by Monkey Exchange Team
4
+ * MIT Licence
5
+ **************************/
6
+ @import '../variables';
7
+ @import '../breakpoints.scss';
8
+
9
+ monkey-input-phone {
10
+ mecx-form-field mecx-form-field-header {
11
+ display: none;
12
+ }
13
+
14
+ mecx-form-field mecx-form-field-footer {
15
+ display: none;
16
+ }
17
+ }
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common/http'), require('rxjs'), require('@angular/common'), require('@angular/forms'), require('rxjs/operators'), require('moment'), require('ngx-mask'), require('@angular/platform-browser')) :
3
- typeof define === 'function' && define.amd ? define('monkey-style-guide', ['exports', '@angular/core', '@angular/common/http', 'rxjs', '@angular/common', '@angular/forms', 'rxjs/operators', 'moment', 'ngx-mask', '@angular/platform-browser'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['monkey-style-guide'] = {}, global.ng.core, global.ng.common.http, global.rxjs, global.ng.common, global.ng.forms, global.rxjs.operators, global.moment, global['ngx-mask'], global.ng.platformBrowser));
5
- }(this, (function (exports, core, http, rxjs, common, forms, operators, moment_, ngxMask, platformBrowser) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common/http'), require('rxjs'), require('@angular/common'), require('@angular/forms'), require('rxjs/operators'), require('moment'), require('ngx-mask'), require('google-libphonenumber'), require('@angular/platform-browser')) :
3
+ typeof define === 'function' && define.amd ? define('monkey-style-guide', ['exports', '@angular/core', '@angular/common/http', 'rxjs', '@angular/common', '@angular/forms', 'rxjs/operators', 'moment', 'ngx-mask', 'google-libphonenumber', '@angular/platform-browser'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['monkey-style-guide'] = {}, global.ng.core, global.ng.common.http, global.rxjs, global.ng.common, global.ng.forms, global.rxjs.operators, global.moment, global['ngx-mask'], global['google-libphonenumber'], global.ng.platformBrowser));
5
+ }(this, (function (exports, core, http, rxjs, common, forms, operators, moment_, ngxMask, googleLibphonenumber, platformBrowser) { 'use strict';
6
6
 
7
7
  function _interopNamespace(e) {
8
8
  if (e && e.__esModule) return e;
@@ -2333,10 +2333,13 @@
2333
2333
  return this._dateForm.value;
2334
2334
  },
2335
2335
  set: function (value) {
2336
- this._dateForm.setValue(value);
2337
- this.cdr.detectChanges();
2338
- this.onModelChange(this._dateForm.value);
2339
- this.onModelTouched(this._dateForm.value);
2336
+ if (Object.prototype.hasOwnProperty.call(value, 'startDate') &&
2337
+ Object.prototype.hasOwnProperty.call(value, 'endDate')) {
2338
+ this._dateForm.setValue(value);
2339
+ this.cdr.detectChanges();
2340
+ this.onModelChange(this._dateForm.value);
2341
+ this.onModelTouched(this._dateForm.value);
2342
+ }
2340
2343
  },
2341
2344
  enumerable: false,
2342
2345
  configurable: true
@@ -2391,7 +2394,7 @@
2391
2394
  var dayFormatted = day.format('YYYY-MM-DD');
2392
2395
  if (_dateForm.valid) {
2393
2396
  _dateForm.setValue({ startDate: null, endDate: null });
2394
- this.writeValue(null);
2397
+ this.writeValue(_dateForm.value);
2395
2398
  return;
2396
2399
  }
2397
2400
  if (!_dateForm.get('startDate').value) {
@@ -2797,6 +2800,199 @@
2797
2800
  },] }
2798
2801
  ];
2799
2802
 
2803
+ /**************************
2804
+ * Copyright Monkey Exchange. All Rights Reserved
2805
+ * This style guide was developed by Monkey Exchange Team
2806
+ * MIT Licence
2807
+ **************************/
2808
+ var phoneUtil = googleLibphonenumber.PhoneNumberUtil.getInstance();
2809
+ var formatter = new googleLibphonenumber.AsYouTypeFormatter('US');
2810
+ var MonkeyInputPhoneComponent = /** @class */ (function () {
2811
+ function MonkeyInputPhoneComponent(currencyPipe, settingsService, cdr) {
2812
+ this.currencyPipe = currencyPipe;
2813
+ this.settingsService = settingsService;
2814
+ this.cdr = cdr;
2815
+ this.name = "mecx-input-phone-" + MonkeyUtils.getRandomString(10);
2816
+ this.helperMessage = '';
2817
+ this.placeholder = '';
2818
+ this.maxLength = 255;
2819
+ this.maxDateToday = false;
2820
+ this.onChange = new core.EventEmitter();
2821
+ this.onModelChange = function (value) { };
2822
+ this.onModelTouched = function (value) { };
2823
+ this._id = "mecx-input-phone-" + MonkeyUtils.getRandomString(10);
2824
+ this._disabled = false;
2825
+ this._maxDateToday = new Date().toISOString().split('T')[0];
2826
+ this._symbol = '';
2827
+ this._countryCodes = [];
2828
+ }
2829
+ MonkeyInputPhoneComponent.prototype.handleValue = function (value, apply) {
2830
+ if (apply === void 0) { apply = false; }
2831
+ if (this.onlyNumber) {
2832
+ return MonkeyUtils.handleOnlyNumbers("" + value);
2833
+ }
2834
+ else if (this.onlyAlphaNumeric)
2835
+ return MonkeyUtils.handleOnlyAlphaNumeric("" + value);
2836
+ else if (this.upperCase)
2837
+ return ("" + value).toUpperCase();
2838
+ else if (this.lowerCase)
2839
+ return ("" + value).toLowerCase();
2840
+ else if (this.capitalize)
2841
+ return MonkeyUtils.capitalize(("" + value).toUpperCase());
2842
+ else if (this.currency || this.percent) {
2843
+ return MonkeyUtils.handleOnlyNumbers("" + value) / (apply ? 100 : 1);
2844
+ }
2845
+ return value;
2846
+ };
2847
+ MonkeyInputPhoneComponent.prototype.replaceZero = function (value) {
2848
+ return ("" + value).replace(new RegExp(/0/, 'g'), '');
2849
+ };
2850
+ MonkeyInputPhoneComponent.prototype.formatValue = function (value) {
2851
+ //console.log(this.phoneUtil);
2852
+ //console.log(this.phoneUtil.formatInOriginalFormat(value, 'US'));
2853
+ //this.phoneUtil.inputDigit('2');
2854
+ console.log(formatter.inputDigit(value));
2855
+ var number = phoneUtil.parse(value, 'BR');
2856
+ console.log(phoneUtil.isPossibleNumber(number));
2857
+ console.log(phoneUtil.format(number, googleLibphonenumber.PhoneNumberFormat.INTERNATIONAL));
2858
+ return phoneUtil.format(number, googleLibphonenumber.PhoneNumberFormat.INTERNATIONAL);
2859
+ };
2860
+ MonkeyInputPhoneComponent.prototype.handleSymbol = function () {
2861
+ var _a;
2862
+ var settings = this.settings;
2863
+ if (this.currency) {
2864
+ this._symbol = {
2865
+ BRL: 'R$',
2866
+ CLP: 'CLP',
2867
+ }[((_a = settings === null || settings === void 0 ? void 0 : settings.currency) === null || _a === void 0 ? void 0 : _a.code) || 'BRL'];
2868
+ }
2869
+ else if (this.percent) {
2870
+ this._symbol = '%';
2871
+ }
2872
+ };
2873
+ MonkeyInputPhoneComponent.prototype.ngOnInit = function () {
2874
+ var _this = this;
2875
+ var settingsService = this.settingsService;
2876
+ this._oldType = this.type;
2877
+ settingsService.settings().subscribe(function (val) {
2878
+ _this.settings = val;
2879
+ _this.handleSymbol();
2880
+ });
2881
+ this._countryCodes = phoneUtil
2882
+ .getSupportedRegions()
2883
+ .map(function (code) {
2884
+ return phoneUtil.getCountryCodeForRegion(code);
2885
+ })
2886
+ .filter(function (v, i, a) { return a.indexOf(v) === i; })
2887
+ .sort(function (a, b) { return (a < b ? -1 : 1); });
2888
+ };
2889
+ MonkeyInputPhoneComponent.prototype.registerOnChange = function (fn) {
2890
+ this.onModelChange = fn;
2891
+ };
2892
+ MonkeyInputPhoneComponent.prototype.registerOnTouched = function (fn) {
2893
+ this.onModelTouched = fn;
2894
+ };
2895
+ MonkeyInputPhoneComponent.prototype.setDisabledState = function (isDisabled) {
2896
+ this._disabled = isDisabled;
2897
+ };
2898
+ Object.defineProperty(MonkeyInputPhoneComponent.prototype, "value", {
2899
+ get: function () {
2900
+ return this.handledValue;
2901
+ },
2902
+ set: function (value) {
2903
+ this.handledValue = value;
2904
+ this._formatedValue = this.formatValue(value);
2905
+ this.cdr.detectChanges();
2906
+ this.onModelChange(this.handledValue);
2907
+ this.onModelTouched(this.handledValue);
2908
+ },
2909
+ enumerable: false,
2910
+ configurable: true
2911
+ });
2912
+ MonkeyInputPhoneComponent.prototype.writeValue = function (value) {
2913
+ this.value = value;
2914
+ };
2915
+ MonkeyInputPhoneComponent.prototype.onChangeValue = function (event) {
2916
+ var value = this._formatedValue;
2917
+ event === null || event === void 0 ? void 0 : event.preventDefault();
2918
+ event === null || event === void 0 ? void 0 : event.stopPropagation();
2919
+ var handled = this.handleValue(value, true);
2920
+ this.writeValue(handled);
2921
+ this.onChange.next(handled);
2922
+ };
2923
+ MonkeyInputPhoneComponent.prototype.onShowAndHidePassword = function () {
2924
+ this.type = this.type === 'password' ? 'text' : 'password';
2925
+ };
2926
+ MonkeyInputPhoneComponent.prototype.onClick = function () {
2927
+ var _a, _b, _c;
2928
+ (_c = (_b = (_a = document === null || document === void 0 ? void 0 : document.getElementById(this._id)) === null || _a === void 0 ? void 0 : _a.getElementsByTagName('input')) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.focus();
2929
+ };
2930
+ MonkeyInputPhoneComponent.prototype.onKeyPress = function (event) {
2931
+ var _a;
2932
+ var pattern = null;
2933
+ var cmp = (_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.value;
2934
+ var inputChar = String.fromCharCode(event.charCode);
2935
+ if (this.currency || this.onlyNumber || this.percent) {
2936
+ pattern = /[0-9]/;
2937
+ if (inputChar === '0' && !this.replaceZero(cmp)) {
2938
+ event.preventDefault();
2939
+ return;
2940
+ }
2941
+ }
2942
+ else if (this.onlyAlphaNumeric) {
2943
+ pattern = /[^0-9A-Za-z]/;
2944
+ }
2945
+ if (pattern && !pattern.test(inputChar)) {
2946
+ event.preventDefault();
2947
+ }
2948
+ };
2949
+ return MonkeyInputPhoneComponent;
2950
+ }());
2951
+ MonkeyInputPhoneComponent.decorators = [
2952
+ { type: core.Component, args: [{
2953
+ selector: 'monkey-input-phone',
2954
+ template: "\n <monkey-select\n [label]=\"'teste'\"\n errorMessage=\"\"\n errorMessage=\"\"\n [placeholder]=\"'Selecione um banco'\"\n >\n <monkey-option label=\"op\" value=\"op\"> </monkey-option>\n <monkey-option label=\"op\" value=\"op\"> </monkey-option>\n <monkey-option label=\"op\" value=\"op\"> </monkey-option>\n </monkey-select>\n ",
2955
+ encapsulation: core.ViewEncapsulation.None,
2956
+ providers: [
2957
+ {
2958
+ provide: forms.NG_VALUE_ACCESSOR,
2959
+ useExisting: core.forwardRef(function () { return MonkeyInputPhoneComponent; }),
2960
+ multi: true,
2961
+ },
2962
+ common.CurrencyPipe,
2963
+ ]
2964
+ },] }
2965
+ ];
2966
+ MonkeyInputPhoneComponent.ctorParameters = function () { return [
2967
+ { type: common.CurrencyPipe },
2968
+ { type: MonkeyStyleGuideSettingsService },
2969
+ { type: core.ChangeDetectorRef }
2970
+ ]; };
2971
+ MonkeyInputPhoneComponent.propDecorators = {
2972
+ name: [{ type: core.Input }],
2973
+ label: [{ type: core.Input }],
2974
+ helperMessage: [{ type: core.Input }],
2975
+ placeholder: [{ type: core.Input }],
2976
+ icon: [{ type: core.Input }],
2977
+ type: [{ type: core.Input }],
2978
+ infoMessage: [{ type: core.Input }],
2979
+ errorMessage: [{ type: core.Input }],
2980
+ mask: [{ type: core.Input }],
2981
+ prefix: [{ type: core.Input }],
2982
+ maxLength: [{ type: core.Input }],
2983
+ onlyNumber: [{ type: core.Input }],
2984
+ onlyAlphaNumeric: [{ type: core.Input }],
2985
+ upperCase: [{ type: core.Input }],
2986
+ lowerCase: [{ type: core.Input }],
2987
+ capitalize: [{ type: core.Input }],
2988
+ currency: [{ type: core.Input }],
2989
+ percent: [{ type: core.Input }],
2990
+ maxDateToday: [{ type: core.Input }],
2991
+ onChange: [{ type: core.Output }],
2992
+ value: [{ type: core.Input }],
2993
+ onClick: [{ type: core.HostListener, args: ['click',] }]
2994
+ };
2995
+
2800
2996
  /**************************
2801
2997
  * Copyright Monkey Exchange. All Rights Reserved
2802
2998
  * This style guide was developed by Monkey Exchange Team
@@ -3604,6 +3800,27 @@
3604
3800
  },] }
3605
3801
  ];
3606
3802
 
3803
+ var MonkeyInputPhoneModule = /** @class */ (function () {
3804
+ function MonkeyInputPhoneModule() {
3805
+ }
3806
+ return MonkeyInputPhoneModule;
3807
+ }());
3808
+ MonkeyInputPhoneModule.decorators = [
3809
+ { type: core.NgModule, args: [{
3810
+ declarations: [MonkeyInputPhoneComponent],
3811
+ imports: [
3812
+ common.CommonModule,
3813
+ forms.FormsModule,
3814
+ forms.ReactiveFormsModule,
3815
+ ngxMask.NgxMaskModule.forRoot(),
3816
+ MonkeyIconModule,
3817
+ MonkeySelectModule,
3818
+ ],
3819
+ exports: [MonkeyInputPhoneComponent],
3820
+ schemas: [core.NO_ERRORS_SCHEMA],
3821
+ },] }
3822
+ ];
3823
+
3607
3824
  /**************************
3608
3825
  * Copyright Monkey Exchange. All Rights Reserved
3609
3826
  * This style guide was developed by Monkey Exchange Team
@@ -4978,6 +5195,8 @@
4978
5195
  exports.MonkeyInputComponent = MonkeyInputComponent;
4979
5196
  exports.MonkeyInputFilterComponent = MonkeyInputFilterComponent;
4980
5197
  exports.MonkeyInputModule = MonkeyInputModule;
5198
+ exports.MonkeyInputPhoneComponent = MonkeyInputPhoneComponent;
5199
+ exports.MonkeyInputPhoneModule = MonkeyInputPhoneModule;
4981
5200
  exports.MonkeyModalComponent = MonkeyModalComponent;
4982
5201
  exports.MonkeyModalModule = MonkeyModalModule;
4983
5202
  exports.MonkeyOptionComponent = MonkeyOptionComponent;