@wavemaker/app-ng-runtime 11.5.2-next.141121 → 11.5.2-next.141122

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.
@@ -1738,9 +1738,9 @@
1738
1738
  Y: {
1739
1739
  mask: IMask.MaskedRange,
1740
1740
  from: 0,
1741
- to: 9,
1741
+ to: 9999,
1742
1742
  placeholderChar: 'Y',
1743
- maxLength: 1,
1743
+ maxLength: 4,
1744
1744
  },
1745
1745
  M: {
1746
1746
  mask: IMask.MaskedRange,
@@ -1802,7 +1802,8 @@
1802
1802
  };
1803
1803
  }
1804
1804
 
1805
- const _c0$2 = ["wmDate", ""];
1805
+ const _c0$2 = ["dateInput"];
1806
+ const _c1 = ["wmDate", ""];
1806
1807
  function DateComponent_ng_template_8_Template(rf, ctx) { if (rf & 1) {
1807
1808
  const _r4 = i0__namespace.ɵɵgetCurrentView();
1808
1809
  i0__namespace.ɵɵelementStart(0, "wm-datetimepicker", 9);
@@ -1847,7 +1848,7 @@
1847
1848
  return validateTheMaskedDate(this.datepattern);
1848
1849
  }
1849
1850
  else {
1850
- return false;
1851
+ return {};
1851
1852
  }
1852
1853
  }
1853
1854
  // Todo[Shubham]: needs to be redefined
@@ -1882,11 +1883,17 @@
1882
1883
  this._bsDefaultLoadCheck = true;
1883
1884
  this.datepattern = this.appDefaults.dateFormat || i1$1.getDisplayDateTimeFormat(i1$1.FormWidgetType.DATE);
1884
1885
  this.updateFormat('datepattern');
1886
+ if (this.imask) {
1887
+ this.imask.maskRef.updateValue();
1888
+ }
1885
1889
  }
1886
1890
  /**
1887
1891
  * This is an internal method triggered when the date input changes
1888
1892
  */
1889
1893
  onDisplayDateChange($event, isNativePicker = false) {
1894
+ if (this.imask) {
1895
+ this.imask.maskRef.updateValue();
1896
+ }
1890
1897
  if (this.isEnterPressedOnDateInput) {
1891
1898
  this.isEnterPressedOnDateInput = false;
1892
1899
  return;
@@ -1902,6 +1909,9 @@
1902
1909
  if (isNativePicker && this.minDateMaxDateValidationOnInput(newVal, $event, this.displayValue, isNativePicker)) {
1903
1910
  return;
1904
1911
  }
1912
+ if (this.imask) {
1913
+ this.imask.maskRef.value = newVal.toDateString();
1914
+ }
1905
1915
  this.setDataValue(newVal);
1906
1916
  }
1907
1917
  // sets the dataValue and computes the display model values
@@ -1915,6 +1925,7 @@
1915
1925
  }
1916
1926
  if (newVal) {
1917
1927
  this.bsDataValue = newVal;
1928
+ this.imask.maskRef.value = newVal.toDateString();
1918
1929
  }
1919
1930
  else {
1920
1931
  this.bsDataValue = undefined;
@@ -1927,6 +1938,9 @@
1927
1938
  if (!this.bsDataValue) {
1928
1939
  this.hightlightToday(this.activeDate);
1929
1940
  }
1941
+ if (this.imask) {
1942
+ this.imask.maskRef.updateValue();
1943
+ }
1930
1944
  // We are using the two input tags(To maintain the modal and proxy modal) for the date control.
1931
1945
  // So actual bootstrap input target width we made it to 0, so bootstrap calculating the calendar container top position improperly.
1932
1946
  // To fix the container top position set the width 1px;
@@ -1942,11 +1956,19 @@
1942
1956
  i1$1.adjustContainerRightEdges($('bs-datepicker-container'), this.nativeElement, this.bsDatePickerDirective._datepicker);
1943
1957
  }
1944
1958
  onInputBlur($event) {
1959
+ if (this.imask) {
1960
+ this.imask.maskRef.updateValue();
1961
+ }
1945
1962
  if (!$($event.relatedTarget).hasClass('current-date')) {
1946
1963
  this.invokeOnTouched();
1947
1964
  this.invokeEventCallback('blur', { $event });
1948
1965
  }
1949
1966
  }
1967
+ onInputFocus($event) {
1968
+ if (this.imask) {
1969
+ this.imask.maskRef.value = $event.target.value;
1970
+ }
1971
+ }
1950
1972
  hideDatepickerDropdown() {
1951
1973
  this.invokeOnTouched();
1952
1974
  this.isOpen = false;
@@ -2021,6 +2043,9 @@
2021
2043
  this.invalidDateTimeFormat = false;
2022
2044
  this.isEnterPressedOnDateInput = true;
2023
2045
  this.bsDatePickerDirective.bsValue = event.target.value ? newVal : '';
2046
+ if (this.imask) {
2047
+ this.imask.maskRef.value = event.target.value;
2048
+ }
2024
2049
  }
2025
2050
  this.toggleDpDropdown(event);
2026
2051
  }
@@ -2051,16 +2076,18 @@
2051
2076
  static { this.ɵfac = function DateComponent_Factory(t) { return new (t || DateComponent)(i0__namespace.ɵɵdirectiveInject(i0__namespace.Injector), i0__namespace.ɵɵdirectiveInject(i0__namespace.ChangeDetectorRef), i0__namespace.ɵɵdirectiveInject(i1$1__namespace.AppDefaults)); }; }
2052
2077
  static { this.ɵcmp = /*@__PURE__*/ i0__namespace.ɵɵdefineComponent({ type: DateComponent, selectors: [["", "wmDate", ""]], viewQuery: function DateComponent_Query(rf, ctx) { if (rf & 1) {
2053
2078
  i0__namespace.ɵɵviewQuery(i3.BsDatepickerDirective, 5);
2079
+ i0__namespace.ɵɵviewQuery(_c0$2, 5, i4.IMaskDirective);
2054
2080
  } if (rf & 2) {
2055
2081
  let _t;
2056
2082
  i0__namespace.ɵɵqueryRefresh(_t = i0__namespace.ɵɵloadQuery()) && (ctx.bsDatePickerDirective = _t.first);
2083
+ i0__namespace.ɵɵqueryRefresh(_t = i0__namespace.ɵɵloadQuery()) && (ctx.imask = _t.first);
2057
2084
  } }, features: [i0__namespace.ɵɵProvidersFeature([
2058
2085
  base.provideAs(DateComponent, i5.NG_VALUE_ACCESSOR, true),
2059
2086
  base.provideAs(DateComponent, i5.NG_VALIDATORS, true),
2060
2087
  base.provideAsWidgetRef(DateComponent)
2061
- ]), i0__namespace.ɵɵInheritDefinitionFeature], attrs: _c0$2, decls: 9, vars: 27, consts: [["focus-target", "", "type", "text", 1, "form-control", "app-textbox", "app-dateinput", "display-input", 3, "name", "imask", "unmask", "tabindex", "value", "disabled", "autofocus", "required", "readOnly", "click", "focus", "blur", "change", "keydown"], ["dateInput", ""], [1, "input-group-btn"], ["type", "button", "aria-haspopup", "true", "aria-expanded", "false", 1, "btn", "btn-default", "btn-time", 3, "tabindex", "disabled", "click"], ["aria-hidden", "true", 1, "app-icon", "wm-sl-l", "sl-calendar"], [2, "width", "0", "display", "inline-block"], ["aria-label", "datepicker dropdownmenu", "aria-controls", "date", "bsDatepicker", "", "placement", "bottom right", 1, "model-holder", 3, "tabindex", "container", "bsConfig", "isOpen", "daysDisabled", "datesDisabled", "isDisabled", "bsValue", "onShown", "onHidden", "bsValueChange"], ["datepicker", "bsDatepicker"], [3, "ngIf"], ["dateTimePicker", "", "mode", "DATE", 3, "config", "placement", "excludedDaysToDisable", "excludedDatesToDisable", "displayFormat", "value", "change"], ["role", "button", 1, "mobile-input", "mobile-datepicker-container", 3, "tabindex", "click", "focus", "blur"]], template: function DateComponent_Template(rf, ctx) { if (rf & 1) {
2088
+ ]), i0__namespace.ɵɵInheritDefinitionFeature], attrs: _c1, decls: 9, vars: 27, consts: [["focus-target", "", "type", "text", 1, "form-control", "app-textbox", "app-dateinput", "display-input", 3, "name", "imask", "unmask", "tabindex", "value", "disabled", "autofocus", "required", "readOnly", "click", "focus", "blur", "change", "keydown"], ["dateInput", ""], [1, "input-group-btn"], ["type", "button", "aria-haspopup", "true", "aria-expanded", "false", 1, "btn", "btn-default", "btn-time", 3, "tabindex", "disabled", "click"], ["aria-hidden", "true", 1, "app-icon", "wm-sl-l", "sl-calendar"], [2, "width", "0", "display", "inline-block"], ["aria-label", "datepicker dropdownmenu", "aria-controls", "date", "bsDatepicker", "", "placement", "bottom right", 1, "model-holder", 3, "tabindex", "container", "bsConfig", "isOpen", "daysDisabled", "datesDisabled", "isDisabled", "bsValue", "onShown", "onHidden", "bsValueChange"], ["datepicker", "bsDatepicker"], [3, "ngIf"], ["dateTimePicker", "", "mode", "DATE", 3, "config", "placement", "excludedDaysToDisable", "excludedDatesToDisable", "displayFormat", "value", "change"], ["role", "button", 1, "mobile-input", "mobile-datepicker-container", 3, "tabindex", "click", "focus", "blur"]], template: function DateComponent_Template(rf, ctx) { if (rf & 1) {
2062
2089
  i0__namespace.ɵɵelementStart(0, "input", 0, 1);
2063
- i0__namespace.ɵɵlistener("click", function DateComponent_Template_input_click_0_listener($event) { return ctx.toggleDpDropdown($event, true); })("focus", function DateComponent_Template_input_focus_0_listener($event) { ctx.onDateTimeInputFocus(); return ctx.invokeOnFocus($event); })("blur", function DateComponent_Template_input_blur_0_listener($event) { return ctx.onInputBlur($event); })("change", function DateComponent_Template_input_change_0_listener($event) { return ctx.onDisplayDateChange($event); })("keydown", function DateComponent_Template_input_keydown_0_listener($event) { ctx._triggeredByUser = true; return ctx.onDisplayKeydown($event); });
2090
+ i0__namespace.ɵɵlistener("click", function DateComponent_Template_input_click_0_listener($event) { return ctx.toggleDpDropdown($event, true); })("focus", function DateComponent_Template_input_focus_0_listener($event) { ctx.onDateTimeInputFocus(); ctx.invokeOnFocus($event); return ctx.onInputFocus($event); })("blur", function DateComponent_Template_input_blur_0_listener($event) { return ctx.onInputBlur($event); })("change", function DateComponent_Template_input_change_0_listener($event) { return ctx.onDisplayDateChange($event); })("keydown", function DateComponent_Template_input_keydown_0_listener($event) { ctx._triggeredByUser = true; return ctx.onDisplayKeydown($event); });
2064
2091
  i0__namespace.ɵɵelementEnd();
2065
2092
  i0__namespace.ɵɵelementStart(2, "span", 2)(3, "button", 3);
2066
2093
  i0__namespace.ɵɵlistener("click", function DateComponent_Template_button_click_3_listener($event) { return ctx.toggleDpDropdown($event, false); });
@@ -2089,10 +2116,13 @@
2089
2116
  base.provideAs(DateComponent, i5.NG_VALUE_ACCESSOR, true),
2090
2117
  base.provideAs(DateComponent, i5.NG_VALIDATORS, true),
2091
2118
  base.provideAsWidgetRef(DateComponent)
2092
- ], template: " <input class=\"form-control app-textbox app-dateinput display-input\"\n focus-target\n type=\"text\"\n #dateInput\n [name]=\"name\"\n [imask]=\"mask\"\n [unmask]=\"true\"\n [tabindex]=\"loadNativeDateInput ? '-1' : tabindex\"\n [attr.aria-hidden]=\"!!loadNativeDateInput\"\n [value]=\"displayValue\"\n (click)=\"toggleDpDropdown($event, true)\"\n (focus)=\"onDateTimeInputFocus(); invokeOnFocus($event);\"\n (blur)=\"onInputBlur($event)\"\n [disabled]=\"disabled || readonly\"\n [autofocus]=\"autofocus\"\n [required]=\"required\"\n [readOnly]=\"isReadOnly\"\n [attr.placeholder]=\"placeholder\"\n [attr.accesskey]=\"shortcutkey\"\n [attr.aria-label]=\"hint\"\n (change)=\"onDisplayDateChange($event)\"\n (keydown)=\"this._triggeredByUser = true; onDisplayKeydown($event);\">\n\n <span class=\"input-group-btn\">\n <button type=\"button\"\n class=\"btn btn-default btn-time\"\n [tabindex]=\"loadNativeDateInput ? '-1' : tabindex\"\n [attr.aria-hidden]=\"!!loadNativeDateInput\"\n [disabled]=\"disabled || readonly\"\n [attr.aria-label]=\"displayValue ? 'Change Date ' + displayValue : 'Choose date by pressing enter'\"\n aria-haspopup=\"true\"\n aria-expanded=\"false\"\n (click)=\"toggleDpDropdown($event, false)\">\n <i aria-hidden=\"true\"\n class=\"app-icon wm-sl-l sl-calendar\"></i>\n </button>\n </span>\n <div style=\"width: 0;display: inline-block;\">\n <input class=\"model-holder\"\n aria-label=\"datepicker dropdownmenu\"\n aria-controls=\"date\"\n [tabindex]=\"-1\"\n [attr.aria-hidden]=\"!!loadNativeDateInput\"\n [container]=\"containerTarget || 'body'\"\n [bsConfig]=\"_dateOptions\"\n [isOpen]=\"isOpen\"\n #datepicker=\"bsDatepicker\"\n bsDatepicker\n [daysDisabled]=\"excludedDaysToDisable\"\n [datesDisabled]=\"excludedDatesToDisable\"\n placement=\"bottom right\"\n [isDisabled]=\"disabled || readonly\"\n [bsValue]=\"bsDataValue\"\n (onShown)=\"onDatePickerOpen()\"\n (onHidden)=\"hideDatepickerDropdown()\"\n (bsValueChange)=\"onDateChange($event)\">\n</div>\n\n<ng-template [ngIf]=\"loadNativeDateInput\">\n <wm-datetimepicker\n dateTimePicker\n mode=\"DATE\"\n [config]=\"_dateOptions\"\n [placement]=\"modal\"\n [excludedDaysToDisable]=\"excludedDaysToDisable\"\n [excludedDatesToDisable]=\"excludedDatesToDisable\"\n [displayFormat]=\"dateInputFormat\"\n [value]=\"bsDataValue\"\n (change)=\"onDateChange($event)\">\n </wm-datetimepicker>\n <div class=\"mobile-input mobile-datepicker-container\"\n [tabindex]=\"tabindex || 0\"\n (click)=\"!(disabled || readonly || isCurrentDate) && showDatePickerModal(bsDataValue)\"\n (focus)=\"onDateTimeInputFocus(true); invokeOnFocus($event);\"\n (blur)=\"onDateTimeInputBlur(); invokeOnTouched($event)\"\n [attr.aria-label]=\"displayValue ? 'Change Date ' + displayValue : hint || 'Choose Date'\"\n role=\"button\">\n </div>\n</ng-template>\n" }]
2119
+ ], template: " <input class=\"form-control app-textbox app-dateinput display-input\"\n focus-target\n type=\"text\"\n #dateInput\n [name]=\"name\"\n [imask]=\"mask\"\n [unmask]=\"true\"\n [tabindex]=\"loadNativeDateInput ? '-1' : tabindex\"\n [attr.aria-hidden]=\"!!loadNativeDateInput\"\n [value]=\"displayValue\"\n (click)=\"toggleDpDropdown($event, true)\"\n (focus)=\"onDateTimeInputFocus(); invokeOnFocus($event);onInputFocus($event)\"\n (blur)=\"onInputBlur($event)\"\n [disabled]=\"disabled || readonly\"\n [autofocus]=\"autofocus\"\n [required]=\"required\"\n [readOnly]=\"isReadOnly\"\n [attr.placeholder]=\"placeholder\"\n [attr.accesskey]=\"shortcutkey\"\n [attr.aria-label]=\"hint\"\n (change)=\"onDisplayDateChange($event)\"\n (keydown)=\"this._triggeredByUser = true; onDisplayKeydown($event);\">\n\n <span class=\"input-group-btn\">\n <button type=\"button\"\n class=\"btn btn-default btn-time\"\n [tabindex]=\"loadNativeDateInput ? '-1' : tabindex\"\n [attr.aria-hidden]=\"!!loadNativeDateInput\"\n [disabled]=\"disabled || readonly\"\n [attr.aria-label]=\"displayValue ? 'Change Date ' + displayValue : 'Choose date by pressing enter'\"\n aria-haspopup=\"true\"\n aria-expanded=\"false\"\n (click)=\"toggleDpDropdown($event, false)\">\n <i aria-hidden=\"true\"\n class=\"app-icon wm-sl-l sl-calendar\"></i>\n </button>\n </span>\n <div style=\"width: 0;display: inline-block;\">\n <input class=\"model-holder\"\n aria-label=\"datepicker dropdownmenu\"\n aria-controls=\"date\"\n [tabindex]=\"-1\"\n [attr.aria-hidden]=\"!!loadNativeDateInput\"\n [container]=\"containerTarget || 'body'\"\n [bsConfig]=\"_dateOptions\"\n [isOpen]=\"isOpen\"\n #datepicker=\"bsDatepicker\"\n bsDatepicker\n [daysDisabled]=\"excludedDaysToDisable\"\n [datesDisabled]=\"excludedDatesToDisable\"\n placement=\"bottom right\"\n [isDisabled]=\"disabled || readonly\"\n [bsValue]=\"bsDataValue\"\n (onShown)=\"onDatePickerOpen()\"\n (onHidden)=\"hideDatepickerDropdown()\"\n (bsValueChange)=\"onDateChange($event)\">\n</div>\n\n<ng-template [ngIf]=\"loadNativeDateInput\">\n <wm-datetimepicker\n dateTimePicker\n mode=\"DATE\"\n [config]=\"_dateOptions\"\n [placement]=\"modal\"\n [excludedDaysToDisable]=\"excludedDaysToDisable\"\n [excludedDatesToDisable]=\"excludedDatesToDisable\"\n [displayFormat]=\"dateInputFormat\"\n [value]=\"bsDataValue\"\n (change)=\"onDateChange($event)\">\n </wm-datetimepicker>\n <div class=\"mobile-input mobile-datepicker-container\"\n [tabindex]=\"tabindex || 0\"\n (click)=\"!(disabled || readonly || isCurrentDate) && showDatePickerModal(bsDataValue)\"\n (focus)=\"onDateTimeInputFocus(true); invokeOnFocus($event);\"\n (blur)=\"onDateTimeInputBlur(); invokeOnTouched($event)\"\n [attr.aria-label]=\"displayValue ? 'Change Date ' + displayValue : hint || 'Choose Date'\"\n role=\"button\">\n </div>\n</ng-template>\n" }]
2093
2120
  }], function () { return [{ type: i0__namespace.Injector }, { type: i0__namespace.ChangeDetectorRef }, { type: i1$1__namespace.AppDefaults }]; }, { bsDatePickerDirective: [{
2094
2121
  type: i0.ViewChild,
2095
2122
  args: [i3.BsDatepickerDirective]
2123
+ }], imask: [{
2124
+ type: i0.ViewChild,
2125
+ args: ['dateInput', { read: i4.IMaskDirective }]
2096
2126
  }] }); })();
2097
2127
 
2098
2128
  const dateTimeProps = new Map([
@@ -1,6 +1,7 @@
1
1
  import { ChangeDetectorRef, Injector } from '@angular/core';
2
2
  import { AppDefaults } from '@wm/core';
3
3
  import { BaseDateTimeComponent } from './../base-date-time.component';
4
+ import { IMaskDirective } from 'angular-imask';
4
5
  import * as i0 from "@angular/core";
5
6
  export declare class DateComponent extends BaseDateTimeComponent {
6
7
  private cdRef;
@@ -21,7 +22,7 @@ export declare class DateComponent extends BaseDateTimeComponent {
21
22
  get displayValue(): any;
22
23
  get nativeDisplayValue(): any;
23
24
  get datavalue(): any;
24
- get mask(): false | {
25
+ get mask(): {
25
26
  mask?: undefined;
26
27
  pattern?: undefined;
27
28
  format?: undefined;
@@ -126,6 +127,7 @@ export declare class DateComponent extends BaseDateTimeComponent {
126
127
  };
127
128
  set datavalue(newVal: any);
128
129
  protected bsDatePickerDirective: any;
130
+ imask: IMaskDirective<any>;
129
131
  constructor(inj: Injector, cdRef: ChangeDetectorRef, appDefaults: AppDefaults);
130
132
  /**
131
133
  * This is an internal method triggered when the date input changes
@@ -134,6 +136,7 @@ export declare class DateComponent extends BaseDateTimeComponent {
134
136
  private setDataValue;
135
137
  onDatePickerOpen(): void;
136
138
  onInputBlur($event: any): void;
139
+ onInputFocus($event: any): void;
137
140
  hideDatepickerDropdown(): void;
138
141
  protected handleEvent(node: HTMLElement, eventName: string, callback: Function, locals: any): void;
139
142
  /**