@muraai/mnl-form 0.0.2-alpha-eef80c9 → 0.0.2-alpha-b2c48eb

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.
@@ -77,7 +77,7 @@ import * as i2$6 from '@angular/material/divider';
77
77
  import { MatDividerModule } from '@angular/material/divider';
78
78
  import * as i4$3 from '@angular/material/timepicker';
79
79
  import { MatTimepickerModule } from '@angular/material/timepicker';
80
- import { parse, isValid, format } from 'date-fns';
80
+ import { isValid, format, parse } from 'date-fns';
81
81
  import { FormlyMatCheckboxModule } from '@ngx-formly/material/checkbox';
82
82
  import { FormlyMatInputModule } from '@ngx-formly/material/input';
83
83
  import { FormlyMatRadioModule } from '@ngx-formly/material/radio';
@@ -193,8 +193,12 @@ class FormlyFieldTabsComponent extends FieldType {
193
193
  isLastTab(tabGroup) {
194
194
  return tabGroup && tabGroup.selectedIndex === (tabGroup._tabs?.length || 0) - 1;
195
195
  }
196
+ get initialTabIndex() {
197
+ return this.field.props?.['initialTabIndex'] ?? 0;
198
+ }
196
199
  ngOnInit() {
197
200
  this.user = JSON.parse(localStorage.getItem('loggedInUser') || '{}');
201
+ this.currentTabIndex = this.initialTabIndex;
198
202
  if (this.field.props?.['showSubmitBtnForStatus']?.length) {
199
203
  this.showSubmitBtn = this.field.props?.['showSubmitBtnForStatus'].find((role) => this.options.formState?.status == role) && !this.options.formState?.isReadonly;
200
204
  }
@@ -297,13 +301,14 @@ class FormlyFieldTabsComponent extends FieldType {
297
301
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.4", ngImport: i0, type: FormlyFieldTabsComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
298
302
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.4", type: FormlyFieldTabsComponent, isStandalone: true, selector: "mu-tabs", viewQueries: [{ propertyName: "tabGroup", first: true, predicate: ["tabGroup"], descendants: true }], usesInheritance: true, ngImport: i0, template: `
299
303
  <div class="mb-4">
300
- <mat-tab-group #tabGroup (selectedTabChange)="onTabChange($event)">
304
+ <mat-tab-group #tabGroup [selectedIndex]="initialTabIndex" (selectedTabChange)="onTabChange($event)">
301
305
  @for(tab of visibleTabs; track tab; let i = $index; let last =
302
306
  $last; let first = $first){
303
307
  <mat-tab
304
308
  [disabled]="
305
309
  i !== 0 && !isValid(field.fieldGroup ? field.fieldGroup[i - 1] : {}) && tab?.props?.['disableTabs'] && this.showSubmitBtn
306
310
  "
311
+ [labelClass]="tab?.props?.['cssClass']"
307
312
  *ngIf="!tab?.props?.['hideTab']"
308
313
  >
309
314
  <ng-template mat-tab-label>
@@ -389,13 +394,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.4", ngImpor
389
394
  ],
390
395
  template: `
391
396
  <div class="mb-4">
392
- <mat-tab-group #tabGroup (selectedTabChange)="onTabChange($event)">
397
+ <mat-tab-group #tabGroup [selectedIndex]="initialTabIndex" (selectedTabChange)="onTabChange($event)">
393
398
  @for(tab of visibleTabs; track tab; let i = $index; let last =
394
399
  $last; let first = $first){
395
400
  <mat-tab
396
401
  [disabled]="
397
402
  i !== 0 && !isValid(field.fieldGroup ? field.fieldGroup[i - 1] : {}) && tab?.props?.['disableTabs'] && this.showSubmitBtn
398
403
  "
404
+ [labelClass]="tab?.props?.['cssClass']"
399
405
  *ngIf="!tab?.props?.['hideTab']"
400
406
  >
401
407
  <ng-template mat-tab-label>
@@ -6377,6 +6383,14 @@ class FormlyFieldDatepickerComponent extends FieldType$1 {
6377
6383
  return this.formControl;
6378
6384
  }
6379
6385
  ngOnInit() {
6386
+ if (this.to.dateFormatType === 'Custom') {
6387
+ const currentValue = this.control.value;
6388
+ if (currentValue instanceof Date && isValid(currentValue)) {
6389
+ const formatted = format(currentValue, 'yyyy-MM-dd');
6390
+ this.control.setValue(formatted, { emitEvent: false });
6391
+ this.field.model[this.field.key] = formatted;
6392
+ }
6393
+ }
6380
6394
  this.control.valueChanges
6381
6395
  .pipe(takeUntilDestroyed(this.destroyRef))
6382
6396
  .subscribe((value) => {
@@ -6626,7 +6640,7 @@ const mnlFormProviders = [
6626
6640
  // NOTE: This is a template file tracked in git
6627
6641
  // The actual version.ts is auto-generated by scripts/replace-version.ts and gitignored
6628
6642
  // Do not edit version.ts manually - edit package.json instead
6629
- const FORM_ENGINE_VERSION = '0.0.2-alpha-eef80c9';
6643
+ const FORM_ENGINE_VERSION = '0.0.2-alpha-b2c48eb';
6630
6644
 
6631
6645
  class ScoringService {
6632
6646
  updateScore(model, fields) {
@@ -7710,6 +7724,7 @@ const tabsSchema = {
7710
7724
  properties: {
7711
7725
  showBtnForPreviousForm: { type: 'boolean' },
7712
7726
  submitButtonName: { type: 'string' },
7727
+ initialTabIndex: { type: 'number' },
7713
7728
  }
7714
7729
  },
7715
7730
  ...containerFieldProps,
@@ -7725,6 +7740,7 @@ const tabFieldSchema = {
7725
7740
  type: 'object',
7726
7741
  properties: {
7727
7742
  label: { type: 'string' },
7743
+ cssClass: { type: 'string' },
7728
7744
  showNextPrevious: { type: 'boolean' },
7729
7745
  disableTabs: { type: 'boolean' },
7730
7746
  hideTab: { type: 'boolean' },