monkey-style-guide 2.0.133 → 2.0.136

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(startDate);
3094
+ this._endDate = endDate && moment(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
  }
@@ -4015,6 +4096,7 @@ class MonkeyInputFilterComponent {
4015
4096
  this.elementRef = elementRef;
4016
4097
  this.currencyPipe = currencyPipe;
4017
4098
  this.settingsService = settingsService;
4099
+ this.iconPosition = 'right';
4018
4100
  this.onChange = new EventEmitter();
4019
4101
  this.onModelChange = (value) => { };
4020
4102
  this.onModelTouched = (value) => { };
@@ -4090,7 +4172,7 @@ class MonkeyInputFilterComponent {
4090
4172
  }
4091
4173
  }
4092
4174
  MonkeyInputFilterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: MonkeyInputFilterComponent, deps: [{ token: i0.ElementRef }, { token: i1$1.CurrencyPipe }, { token: MonkeyStyleGuideSettingsService }], target: i0.ɵɵFactoryTarget.Component });
4093
- MonkeyInputFilterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: MonkeyInputFilterComponent, selector: "monkey-input-filter", inputs: { name: "name", label: "label", helperMessage: "helperMessage", placeholder: "placeholder", icon: "icon", type: "type", infoMessage: "infoMessage", errorMessage: "errorMessage", mask: "mask", prefix: "prefix", onlyNumber: "onlyNumber", onlyAlphaNumeric: "onlyAlphaNumeric", upperCase: "upperCase", lowerCase: "lowerCase", capitalize: "capitalize", currency: "currency", value: "value" }, outputs: { onChange: "onChange" }, host: { listeners: { "click": "onClick($event)" } }, providers: [
4175
+ MonkeyInputFilterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: MonkeyInputFilterComponent, selector: "monkey-input-filter", inputs: { name: "name", label: "label", helperMessage: "helperMessage", placeholder: "placeholder", icon: "icon", type: "type", infoMessage: "infoMessage", errorMessage: "errorMessage", mask: "mask", prefix: "prefix", onlyNumber: "onlyNumber", onlyAlphaNumeric: "onlyAlphaNumeric", upperCase: "upperCase", lowerCase: "lowerCase", capitalize: "capitalize", currency: "currency", iconPosition: "iconPosition", value: "value" }, outputs: { onChange: "onChange" }, host: { listeners: { "click": "onClick($event)" } }, providers: [
4094
4176
  {
4095
4177
  provide: NG_VALUE_ACCESSOR,
4096
4178
  useExisting: forwardRef(() => MonkeyInputFilterComponent),
@@ -4108,6 +4190,8 @@ MonkeyInputFilterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0
4108
4190
  </helper>
4109
4191
  </mecx-form-field-header>
4110
4192
  <mecx-form-field-body>
4193
+ <monkey-icon [icon]="icon" [color]="'#4B4A53'"
4194
+ *ngIf="iconPosition === 'left' && icon"></monkey-icon>
4111
4195
  <input
4112
4196
  [name]="name"
4113
4197
  [type]="type"
@@ -4141,7 +4225,8 @@ MonkeyInputFilterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0
4141
4225
  [disabled]="_disabled"
4142
4226
  *ngIf="!mask && !prefix"
4143
4227
  />
4144
- <monkey-icon [icon]="icon" [color]="'#4B4A53'"></monkey-icon>
4228
+ <monkey-icon [icon]="icon" [color]="'#4B4A53'"
4229
+ *ngIf="iconPosition === 'right' && icon"></monkey-icon>
4145
4230
  <monkey-icon
4146
4231
  icon="eyes-16"
4147
4232
  [color]="'#4B4A53'"
@@ -4172,6 +4257,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImpor
4172
4257
  </helper>
4173
4258
  </mecx-form-field-header>
4174
4259
  <mecx-form-field-body>
4260
+ <monkey-icon [icon]="icon" [color]="'#4B4A53'"
4261
+ *ngIf="iconPosition === 'left' && icon"></monkey-icon>
4175
4262
  <input
4176
4263
  [name]="name"
4177
4264
  [type]="type"
@@ -4205,7 +4292,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImpor
4205
4292
  [disabled]="_disabled"
4206
4293
  *ngIf="!mask && !prefix"
4207
4294
  />
4208
- <monkey-icon [icon]="icon" [color]="'#4B4A53'"></monkey-icon>
4295
+ <monkey-icon [icon]="icon" [color]="'#4B4A53'"
4296
+ *ngIf="iconPosition === 'right' && icon"></monkey-icon>
4209
4297
  <monkey-icon
4210
4298
  icon="eyes-16"
4211
4299
  [color]="'#4B4A53'"
@@ -4263,6 +4351,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImpor
4263
4351
  type: Input
4264
4352
  }], currency: [{
4265
4353
  type: Input
4354
+ }], iconPosition: [{
4355
+ type: Input
4266
4356
  }], onChange: [{
4267
4357
  type: Output
4268
4358
  }], value: [{