monkey-style-guide 2.0.134 → 2.0.137

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.
@@ -222,6 +222,11 @@ class MonkeyUtils {
222
222
  .join('');
223
223
  return randomString;
224
224
  }
225
+ static handleOnlyNumbersCurrency(value) {
226
+ if (!value)
227
+ return null;
228
+ return value.replace(new RegExp(/[^0-9.]/g), '');
229
+ }
225
230
  static handleOnlyNumbers(value) {
226
231
  if (!value)
227
232
  return null;
@@ -3065,16 +3070,25 @@ class MonkeyDateRangePickerComponent {
3065
3070
  this._daysArrSecond = [];
3066
3071
  this._disabled = false;
3067
3072
  this._minDate = null;
3073
+ this._startDate = null;
3074
+ this._endDate = null;
3075
+ this.unsubscribeAll = new Subject();
3068
3076
  this.initDateRange();
3069
3077
  }
3070
3078
  set minDate(value) {
3071
3079
  this._minDate = !this.moveDaysForward ? null : value;
3072
3080
  }
3073
3081
  initDateRange() {
3074
- return (this._dateForm = this.fb.group({
3082
+ var _a, _b, _c;
3083
+ this._dateForm = this.fb.group({
3075
3084
  startDate: [null, Validators.required],
3076
3085
  endDate: [null, Validators.required],
3077
- }));
3086
+ });
3087
+ (_c = (_b = (_a = this._dateForm) === null || _a === void 0 ? void 0 : _a.valueChanges) === null || _b === void 0 ? void 0 : _b.pipe(takeUntil(this.unsubscribeAll))) === null || _c === void 0 ? void 0 : _c.subscribe((values) => {
3088
+ const { startDate, endDate } = values;
3089
+ this._startDate = startDate && moment.default(startDate);
3090
+ this._endDate = endDate && moment.default(endDate);
3091
+ });
3078
3092
  }
3079
3093
  createCalendar(month) {
3080
3094
  let firstDay = moment.default(month).startOf('M');
@@ -3279,6 +3293,38 @@ MonkeyDateRangePickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
3279
3293
  {{ helperMessage }}
3280
3294
  </helper>
3281
3295
  </mecx-date-range-picker-group-header>
3296
+ <mecx-date-range-picker-selected-dates>
3297
+ <div class="from"
3298
+ [class.actual]="!_startDate">
3299
+ <span class="title">
3300
+ {{ i18n?.from }}
3301
+ </span>
3302
+ <span class="data">
3303
+ <ng-container *ngIf="_startDate; else select">
3304
+ {{ _startDate?.format('DD') }}
3305
+ {{ i18n?.of }}
3306
+ {{ i18n?.months?.[_startDate.format('M')] }},
3307
+ {{ _startDate.format('YYYY') }}
3308
+ </ng-container>
3309
+ </span>
3310
+ </div>
3311
+ <div class="to" [class.actual]="_startDate">
3312
+ <span class="title">
3313
+ {{ i18n?.to }}
3314
+ </span>
3315
+ <span class="data">
3316
+ <ng-container *ngIf="_endDate; else select">
3317
+ {{ _endDate.format('DD') }}
3318
+ {{ i18n?.of }}
3319
+ {{ i18n?.months?.[_endDate.format('M')] }},
3320
+ {{ _endDate.format('YYYY') }}
3321
+ </ng-container>
3322
+ </span>
3323
+ </div>
3324
+ <ng-template #select>
3325
+ {{ i18n?.select }}
3326
+ </ng-template>
3327
+ </mecx-date-range-picker-selected-dates>
3282
3328
  <mecx-date-range-picker-group-body>
3283
3329
  <mecx-date-range-picker class="first-date-range">
3284
3330
  <mecx-date-range-picker-header>
@@ -3424,7 +3470,7 @@ MonkeyDateRangePickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
3424
3470
  </monkey-button>
3425
3471
  </mecx-date-range-picker-group-action>
3426
3472
  </mecx-date-range-picker-group>
3427
- `, isInline: true, components: [{ type: MonkeyButtonComponent, selector: "monkey-button", inputs: ["label", "icon", "iconPosition", "type", "color", "disabled", "size"] }], directives: [{ type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], encapsulation: i0.ViewEncapsulation.None });
3473
+ `, isInline: true, components: [{ type: MonkeyButtonComponent, selector: "monkey-button", inputs: ["label", "icon", "iconPosition", "type", "color", "disabled", "size"] }], directives: [{ type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], encapsulation: i0.ViewEncapsulation.None });
3428
3474
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: MonkeyDateRangePickerComponent, decorators: [{
3429
3475
  type: Component,
3430
3476
  args: [{
@@ -3439,6 +3485,38 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImpor
3439
3485
  {{ helperMessage }}
3440
3486
  </helper>
3441
3487
  </mecx-date-range-picker-group-header>
3488
+ <mecx-date-range-picker-selected-dates>
3489
+ <div class="from"
3490
+ [class.actual]="!_startDate">
3491
+ <span class="title">
3492
+ {{ i18n?.from }}
3493
+ </span>
3494
+ <span class="data">
3495
+ <ng-container *ngIf="_startDate; else select">
3496
+ {{ _startDate?.format('DD') }}
3497
+ {{ i18n?.of }}
3498
+ {{ i18n?.months?.[_startDate.format('M')] }},
3499
+ {{ _startDate.format('YYYY') }}
3500
+ </ng-container>
3501
+ </span>
3502
+ </div>
3503
+ <div class="to" [class.actual]="_startDate">
3504
+ <span class="title">
3505
+ {{ i18n?.to }}
3506
+ </span>
3507
+ <span class="data">
3508
+ <ng-container *ngIf="_endDate; else select">
3509
+ {{ _endDate.format('DD') }}
3510
+ {{ i18n?.of }}
3511
+ {{ i18n?.months?.[_endDate.format('M')] }},
3512
+ {{ _endDate.format('YYYY') }}
3513
+ </ng-container>
3514
+ </span>
3515
+ </div>
3516
+ <ng-template #select>
3517
+ {{ i18n?.select }}
3518
+ </ng-template>
3519
+ </mecx-date-range-picker-selected-dates>
3442
3520
  <mecx-date-range-picker-group-body>
3443
3521
  <mecx-date-range-picker class="first-date-range">
3444
3522
  <mecx-date-range-picker-header>
@@ -3666,7 +3744,11 @@ class MonkeyInputComponent {
3666
3744
  else if (this.capitalize)
3667
3745
  return MonkeyUtils.capitalize(`${value}`.toUpperCase());
3668
3746
  else if (this.currency || this.percent) {
3669
- return MonkeyUtils.handleOnlyNumbers(`${value}`) / (apply ? 100 : 1);
3747
+ const handled = MonkeyUtils.handleOnlyNumbers(`${value}`);
3748
+ const result = handled / 100;
3749
+ if (!result)
3750
+ return '';
3751
+ return result.toFixed(2);
3670
3752
  }
3671
3753
  return value;
3672
3754
  }