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.
@@ -229,6 +229,11 @@ class MonkeyUtils {
229
229
  .join('');
230
230
  return randomString;
231
231
  }
232
+ static handleOnlyNumbersCurrency(value) {
233
+ if (!value)
234
+ return null;
235
+ return value.replace(new RegExp(/[^0-9.]/g), '');
236
+ }
232
237
  static handleOnlyNumbers(value) {
233
238
  if (!value)
234
239
  return null;
@@ -3070,16 +3075,24 @@ class MonkeyDateRangePickerComponent {
3070
3075
  this._daysArrSecond = [];
3071
3076
  this._disabled = false;
3072
3077
  this._minDate = null;
3078
+ this._startDate = null;
3079
+ this._endDate = null;
3080
+ this.unsubscribeAll = new Subject();
3073
3081
  this.initDateRange();
3074
3082
  }
3075
3083
  set minDate(value) {
3076
3084
  this._minDate = !this.moveDaysForward ? null : value;
3077
3085
  }
3078
3086
  initDateRange() {
3079
- return (this._dateForm = this.fb.group({
3087
+ this._dateForm = this.fb.group({
3080
3088
  startDate: [null, Validators.required],
3081
3089
  endDate: [null, Validators.required],
3082
- }));
3090
+ });
3091
+ this._dateForm?.valueChanges?.pipe(takeUntil(this.unsubscribeAll))?.subscribe((values) => {
3092
+ const { startDate, endDate } = values;
3093
+ this._startDate = startDate && moment.default(startDate);
3094
+ this._endDate = endDate && moment.default(endDate);
3095
+ });
3083
3096
  }
3084
3097
  createCalendar(month) {
3085
3098
  let firstDay = moment.default(month).startOf('M');
@@ -3284,6 +3297,38 @@ MonkeyDateRangePickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
3284
3297
  {{ helperMessage }}
3285
3298
  </helper>
3286
3299
  </mecx-date-range-picker-group-header>
3300
+ <mecx-date-range-picker-selected-dates>
3301
+ <div class="from"
3302
+ [class.actual]="!_startDate">
3303
+ <span class="title">
3304
+ {{ i18n?.from }}
3305
+ </span>
3306
+ <span class="data">
3307
+ <ng-container *ngIf="_startDate; else select">
3308
+ {{ _startDate?.format('DD') }}
3309
+ {{ i18n?.of }}
3310
+ {{ i18n?.months?.[_startDate.format('M')] }},
3311
+ {{ _startDate.format('YYYY') }}
3312
+ </ng-container>
3313
+ </span>
3314
+ </div>
3315
+ <div class="to" [class.actual]="_startDate">
3316
+ <span class="title">
3317
+ {{ i18n?.to }}
3318
+ </span>
3319
+ <span class="data">
3320
+ <ng-container *ngIf="_endDate; else select">
3321
+ {{ _endDate.format('DD') }}
3322
+ {{ i18n?.of }}
3323
+ {{ i18n?.months?.[_endDate.format('M')] }},
3324
+ {{ _endDate.format('YYYY') }}
3325
+ </ng-container>
3326
+ </span>
3327
+ </div>
3328
+ <ng-template #select>
3329
+ {{ i18n?.select }}
3330
+ </ng-template>
3331
+ </mecx-date-range-picker-selected-dates>
3287
3332
  <mecx-date-range-picker-group-body>
3288
3333
  <mecx-date-range-picker class="first-date-range">
3289
3334
  <mecx-date-range-picker-header>
@@ -3429,7 +3474,7 @@ MonkeyDateRangePickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
3429
3474
  </monkey-button>
3430
3475
  </mecx-date-range-picker-group-action>
3431
3476
  </mecx-date-range-picker-group>
3432
- `, 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 });
3477
+ `, 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 });
3433
3478
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: MonkeyDateRangePickerComponent, decorators: [{
3434
3479
  type: Component,
3435
3480
  args: [{
@@ -3444,6 +3489,38 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImpor
3444
3489
  {{ helperMessage }}
3445
3490
  </helper>
3446
3491
  </mecx-date-range-picker-group-header>
3492
+ <mecx-date-range-picker-selected-dates>
3493
+ <div class="from"
3494
+ [class.actual]="!_startDate">
3495
+ <span class="title">
3496
+ {{ i18n?.from }}
3497
+ </span>
3498
+ <span class="data">
3499
+ <ng-container *ngIf="_startDate; else select">
3500
+ {{ _startDate?.format('DD') }}
3501
+ {{ i18n?.of }}
3502
+ {{ i18n?.months?.[_startDate.format('M')] }},
3503
+ {{ _startDate.format('YYYY') }}
3504
+ </ng-container>
3505
+ </span>
3506
+ </div>
3507
+ <div class="to" [class.actual]="_startDate">
3508
+ <span class="title">
3509
+ {{ i18n?.to }}
3510
+ </span>
3511
+ <span class="data">
3512
+ <ng-container *ngIf="_endDate; else select">
3513
+ {{ _endDate.format('DD') }}
3514
+ {{ i18n?.of }}
3515
+ {{ i18n?.months?.[_endDate.format('M')] }},
3516
+ {{ _endDate.format('YYYY') }}
3517
+ </ng-container>
3518
+ </span>
3519
+ </div>
3520
+ <ng-template #select>
3521
+ {{ i18n?.select }}
3522
+ </ng-template>
3523
+ </mecx-date-range-picker-selected-dates>
3447
3524
  <mecx-date-range-picker-group-body>
3448
3525
  <mecx-date-range-picker class="first-date-range">
3449
3526
  <mecx-date-range-picker-header>
@@ -3671,7 +3748,11 @@ class MonkeyInputComponent {
3671
3748
  else if (this.capitalize)
3672
3749
  return MonkeyUtils.capitalize(`${value}`.toUpperCase());
3673
3750
  else if (this.currency || this.percent) {
3674
- return MonkeyUtils.handleOnlyNumbers(`${value}`) / (apply ? 100 : 1);
3751
+ const handled = MonkeyUtils.handleOnlyNumbers(`${value}`);
3752
+ const result = handled / 100;
3753
+ if (!result)
3754
+ return '';
3755
+ return result.toFixed(2);
3675
3756
  }
3676
3757
  return value;
3677
3758
  }