@wavemaker/app-runtime-wm-build 11.3.6-next.25096 → 11.3.6-next.25098

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.
@@ -26924,22 +26924,24 @@
26924
26924
  configurable: true
26925
26925
  });
26926
26926
  DateTimePickerComponent.prototype.validateSelectedDate = function() {
26927
- var _a, _b, _c, _d, _e, _f, _g;
26927
+ var _a, _b, _c, _d, _e;
26928
26928
  if (!this.changedValue) {
26929
26929
  return true;
26930
26930
  }
26931
26931
  var cd = moment(this.changedValue);
26932
- if (((_a = this._bsDatepickerConfig) === null || _a === void 0 ? void 0 : _a.minDate) && ((_b = this._bsDatepickerConfig) === null || _b === void 0 ? void 0 : _b.minDate) > this.changedValue) {
26932
+ var minDate = (_a = this._bsDatepickerConfig) === null || _a === void 0 ? void 0 : _a.minDate;
26933
+ var maxDate = (_b = this._bsDatepickerConfig) === null || _b === void 0 ? void 0 : _b.maxDate;
26934
+ if (minDate && (this.mode === "DATE" && moment(minDate).startOf("day").toDate() > this.changedValue || this.mode !== "DATE" && minDate > this.changedValue)) {
26933
26935
  return false;
26934
26936
  }
26935
- if (((_c = this._bsDatepickerConfig) === null || _c === void 0 ? void 0 : _c.maxDate) && ((_d = this._bsDatepickerConfig) === null || _d === void 0 ? void 0 : _d.maxDate) < this.changedValue) {
26937
+ if (maxDate && (this.mode === "DATE" && moment(maxDate).endOf("day").toDate() < this.changedValue || this.mode !== "DATE" && maxDate < this.changedValue)) {
26936
26938
  return false;
26937
26939
  }
26938
- if (((_f = (_e = this._bsDatepickerConfig) === null || _e === void 0 ? void 0 : _e.daysDisabled) === null || _f === void 0 ? void 0 : _f.indexOf(cd.day())) >= 0) {
26940
+ if (((_d = (_c = this._bsDatepickerConfig) === null || _c === void 0 ? void 0 : _c.daysDisabled) === null || _d === void 0 ? void 0 : _d.indexOf(cd.day())) >= 0) {
26939
26941
  return false;
26940
26942
  }
26941
26943
  var cdSt = cd.startOf("day").toDate().getTime();
26942
- if ((_g = this.excludedDatesToDisable) === null || _g === void 0 ? void 0 : _g.find((function(d) {
26944
+ if ((_e = this.excludedDatesToDisable) === null || _e === void 0 ? void 0 : _e.find((function(d) {
26943
26945
  return d.getTime() === cdSt;
26944
26946
  }))) {
26945
26947
  return false;
@@ -26988,6 +26990,9 @@
26988
26990
  newVal.setMilliseconds(oldVal.getMilliseconds());
26989
26991
  }
26990
26992
  this.changedValue = newVal;
26993
+ if (this.mode === "DATE" && oldVal !== newVal && this.validateSelectedDate()) {
26994
+ this.onOkClick();
26995
+ }
26991
26996
  };
26992
26997
  DateTimePickerComponent.prototype.onTimeUpdate = function(newVal) {
26993
26998
  this.changedValue = newVal;
@@ -27009,6 +27014,10 @@
27009
27014
  this.triggerChange();
27010
27015
  this.hideModal();
27011
27016
  };
27017
+ DateTimePickerComponent.prototype.setToday = function() {
27018
+ var today = moment().startOf("day").toDate();
27019
+ this.onDateUpdate(today);
27020
+ };
27012
27021
  DateTimePickerComponent.prototype.reset = function() {
27013
27022
  this.changedValue = this._value;
27014
27023
  };
@@ -27043,7 +27052,7 @@
27043
27052
  type: core.Component,
27044
27053
  args: [ {
27045
27054
  selector: "wm-datetimepicker",
27046
- template: ' \n <ng-template #datetimepickerTemplate>\n <div class="app-datetime-picker">\n <div class="modal-body">\n <div class="mobile-datetime-picker-options">\n \n </div>\n <bs-datepicker-inline\n [bsConfig]="bsDatepickerConfig"\n [datesDisabled]="excludedDatesToDisable"\n bsDatepicker\n [bsValue]="changedValue"\n (bsValueChange)="onDateUpdate($event)"\n *ngIf="mode === \'DATE_TIME\' || mode === \'DATE\'">\n </bs-datepicker-inline>\n <wm-timepicker\n [value]="changedValue"\n [min]="minTime"\n [max]="maxTime"\n (change)="onTimeUpdate($event)"\n *ngIf="mode === \'DATE_TIME\' || mode === \'TIME\'"></wm-timepicker>\n <span class="text-primary date-picker-value">\n {{getDateLabel()}}\n </span>\n </div>\n <div class="modal-footer">\n <button\n class="btn btn-secondary clear-btn"\n (click)="clear()">{{appLocale.MESSAGE_DATE_PICKER_CLEAR || "Clear" }}</button>\n <button\n class="btn btn-primary pull-right ok-btn"\n (click)="onOkClick()">{{appLocale.MESSAGE_DATE_PICKER_OK || "Ok" }}</button>\n <button\n class="btn btn-secondary pull-right cancel-btn"\n (click)="hideModal()">{{appLocale.MESSAGE_DATE_PICKER_CANCEL || "Cancel" }}</button>\n \n </div>\n </div>\n </ng-template>\n '
27055
+ template: ' \n <ng-template #datetimepickerTemplate>\n <div class="app-datetime-picker">\n <div class="modal-body">\n <div class="mobile-datetime-picker-options">\n \n </div>\n <bs-datepicker-inline\n [bsConfig]="bsDatepickerConfig"\n [datesDisabled]="excludedDatesToDisable"\n bsDatepicker\n [bsValue]="changedValue"\n (bsValueChange)="onDateUpdate($event)"\n *ngIf="mode === \'DATE_TIME\' || mode === \'DATE\'">\n </bs-datepicker-inline>\n <wm-timepicker\n [value]="changedValue"\n [min]="minTime"\n [max]="maxTime"\n (change)="onTimeUpdate($event)"\n *ngIf="mode === \'DATE_TIME\' || mode === \'TIME\'"></wm-timepicker>\n <span class="text-primary date-picker-value">\n {{getDateLabel()}}\n </span>\n </div>\n <div class="modal-footer">\n <button\n *ngIf="mode === \'DATE_TIME\' || mode === \'DATE\'"\n class="btn btn-secondary today-btn"\n (click)="setToday()">{{appLocale.MESSAGE_DATE_PICKER_TODAY || "Today" }}</button>\n <button\n class="btn btn-primary pull-right ok-btn"\n *ngIf="mode === \'DATE_TIME\' || mode === \'TIME\'"\n (click)="onOkClick()">{{appLocale.MESSAGE_DATE_PICKER_OK || "Ok" }}</button>\n <button\n class="btn btn-secondary pull-right clear-btn"\n (click)="clear()">{{appLocale.MESSAGE_DATE_PICKER_CLEAR || "Clear" }}</button>\n </div>\n </div>\n </ng-template>\n '
27047
27056
  } ]
27048
27057
  } ];
27049
27058
  DateTimePickerComponent.ctorParameters = function() {
@@ -27126,8 +27135,8 @@
27126
27135
  }
27127
27136
  return arr;
27128
27137
  };
27129
- TimePickerComponent.prototype.set = function(_h, unit) {
27130
- var index = _h.index, value = _h.value;
27138
+ TimePickerComponent.prototype.set = function(_f, unit) {
27139
+ var index = _f.index, value = _f.value;
27131
27140
  if (unit === "HOUR") {
27132
27141
  this.value = moment(this.value).hour(parseInt(value)).toDate();
27133
27142
  } else if (unit === "MINUTE") {
@@ -36432,15 +36441,17 @@
36432
36441
  _this.dialogService = inj.get(core.AbstractDialogService);
36433
36442
  _this.bsModal = inj.get(modal.BsModalService);
36434
36443
  var router$1 = inj.get(router.Router);
36435
- var subscriptions = [ _this.bsModal.onShown.subscribe((function() {
36444
+ var subscriptions = [ _this.bsModal.onShown.subscribe((function(_a) {
36445
+ var id = _a.id;
36436
36446
  var ref = _this.dialogService.getLastOpenedDialog();
36437
36447
  if (ref === _this) {
36438
36448
  invokeOpenedCallback(ref);
36449
+ _this.dialogId = id;
36439
36450
  }
36440
36451
  })), _this.bsModal.onShow.subscribe((function() {
36441
36452
  focusTrapObj.activeElement = document.activeElement;
36442
36453
  })), _this.bsModal.onHidden.subscribe((function(closeReason) {
36443
- var ref = closeReason === "esc" || closeReason === "backdrop-click" ? _this.dialogService.getLastOpenedDialog() : _this.dialogService.getDialogRefFromClosedDialogs();
36454
+ var ref = closeReason === "esc" || closeReason === "backdrop-click" || _this.dialogId && (closeReason === null || closeReason === void 0 ? void 0 : closeReason.id) === _this.dialogId ? _this.dialogService.getLastOpenedDialog() : _this.dialogService.getDialogRefFromClosedDialogs();
36444
36455
  if (ref === _this) {
36445
36456
  _this.dialogService.removeFromOpenedDialogs(ref);
36446
36457
  _this.dialogService.removeFromClosedDialogs(ref);
@@ -58402,40 +58413,36 @@
58402
58413
  var TabsAnimator = function(_super) {
58403
58414
  __extends(TabsAnimator, _super);
58404
58415
  function TabsAnimator(tabs) {
58405
- var e_1, _a;
58406
58416
  var _this = _super.call(this) || this;
58407
58417
  _this.tabs = tabs;
58408
58418
  _this._$el = $(_this.tabs.getNativeElement()).find(">.tab-content");
58409
- var childEls = _this._$el.find(">[wmTabPane]");
58410
- _this._noOfTabs = childEls.length;
58411
- var maxWidth = _this._noOfTabs * 100 + "%";
58412
- core.addClass(_this.tabs.getNativeElement(), "has-transition");
58413
- core.setCSSFromObj(_this._$el[0], {
58414
- maxWidth: maxWidth,
58415
- width: maxWidth
58416
- });
58417
- var width = 100 / _this._noOfTabs + "%";
58418
- try {
58419
- for (var _b = __values(Array.from(childEls)), _c = _b.next(); !_c.done; _c = _b.next()) {
58420
- var child = _c.value;
58421
- core.setCSS(child, "width", width);
58422
- }
58423
- } catch (e_1_1) {
58424
- e_1 = {
58425
- error: e_1_1
58426
- };
58427
- } finally {
58428
- try {
58429
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
58430
- } finally {
58431
- if (e_1) throw e_1.error;
58432
- }
58433
- }
58434
58419
  _this.init(_this._$el);
58435
58420
  return _this;
58436
58421
  }
58422
+ TabsAnimator.prototype.calibrate = function() {
58423
+ var activeTabIndex = this.tabs.getActiveTabIndex();
58424
+ var panes = this._$el.find(">.tab-pane");
58425
+ var activeTabVisibleIndex = 0;
58426
+ var noOfVisiblePanes = 0;
58427
+ var visiblePanes = [];
58428
+ panes.each((function(i, p) {
58429
+ if (!$(p).prop("hidden")) {
58430
+ noOfVisiblePanes++;
58431
+ if (i === activeTabIndex) {
58432
+ activeTabVisibleIndex = noOfVisiblePanes - 1;
58433
+ }
58434
+ visiblePanes.push(p);
58435
+ }
58436
+ return true;
58437
+ }));
58438
+ return {
58439
+ activeTabIndex: activeTabVisibleIndex,
58440
+ noOfTabs: noOfVisiblePanes,
58441
+ panes: visiblePanes
58442
+ };
58443
+ };
58437
58444
  TabsAnimator.prototype.bounds = function() {
58438
- var activeTabIndex = this.tabs.getActiveTabIndex(), w = this._$el.find(">.tab-pane").first().width(), noOfTabs = this._$el.find(">.tab-pane:visible").length, centerVal = -1 * activeTabIndex * w;
58445
+ var _a = this.calibrate(), activeTabIndex = _a.activeTabIndex, noOfTabs = _a.noOfTabs, panes = _a.panes, w = $(panes[0]).width(), centerVal = -1 * activeTabIndex * w;
58439
58446
  this.clearContentFocus();
58440
58447
  return {
58441
58448
  strict: false,
@@ -58462,8 +58469,18 @@
58462
58469
  }
58463
58470
  };
58464
58471
  TabsAnimator.prototype.transitionTabIntoView = function() {
58465
- var activeTabIndex = this.tabs.getActiveTabIndex();
58466
- core.setCSS(this._$el[0], "transform", "translate3d(" + -1 * activeTabIndex / this._noOfTabs * 100 + "%, 0, 0)");
58472
+ var _a = this.calibrate(), activeTabIndex = _a.activeTabIndex, noOfTabs = _a.noOfTabs, panes = _a.panes;
58473
+ var maxWidth = noOfTabs * 100 + "%";
58474
+ core.setCSSFromObj(this._$el[0], {
58475
+ maxWidth: maxWidth,
58476
+ width: maxWidth
58477
+ });
58478
+ core.addClass(this.tabs.getNativeElement(), "has-transition");
58479
+ var width = 100 / noOfTabs + "%";
58480
+ panes.forEach((function(p) {
58481
+ core.setCSS(p, "width", width);
58482
+ }));
58483
+ core.setCSS(this._$el[0], "transform", "translate3d(" + -1 * activeTabIndex / noOfTabs * 100 + "%, 0, 0)");
58467
58484
  };
58468
58485
  TabsAnimator.prototype.onUpper = function($event) {
58469
58486
  this.tabs.prev($event);
@@ -58589,6 +58606,7 @@
58589
58606
  };
58590
58607
  TabPaneComponent.prototype.onPropertyChange = function(key, nv, ov) {
58591
58608
  var _this = this;
58609
+ var _a;
58592
58610
  if (key === "content") {
58593
58611
  if (this.isActive) {
58594
58612
  setTimeout((function() {
@@ -58599,6 +58617,10 @@
58599
58617
  this.nativeElement.hidden = !nv;
58600
58618
  if (this._isFirstLoad) {
58601
58619
  this.tabsRef.selectDefaultPaneByIndex(this.tabsRef.defaultpaneindex);
58620
+ } else if (!nv && this.isActive) {
58621
+ this.tabsRef.next();
58622
+ } else if (nv || !this.isActive) {
58623
+ (_a = this.tabsRef.tabsAnimator) === null || _a === void 0 ? void 0 : _a.transitionTabIntoView();
58602
58624
  }
58603
58625
  this._isFirstLoad = false;
58604
58626
  } else {
@@ -67554,10 +67576,10 @@
67554
67576
  }));
67555
67577
 
67556
67578
  (function(global, factory) {
67557
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@angular/core"), require("@wm/core"), require("@wm/components/base"), require("@wm/components/page"), require("@wm/mobile/core"), require("@angular/common")) : typeof define === "function" && define.amd ? define("@wm/mobile/components/page", [ "exports", "@angular/core", "@wm/core", "@wm/components/base", "@wm/components/page", "@wm/mobile/core", "@angular/common" ], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self,
67579
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@angular/core"), require("@wm/core"), require("@wm/components/base"), require("ngx-bootstrap/modal"), require("@wm/components/page"), require("@wm/mobile/core"), require("@angular/common")) : typeof define === "function" && define.amd ? define("@wm/mobile/components/page", [ "exports", "@angular/core", "@wm/core", "@wm/components/base", "ngx-bootstrap/modal", "@wm/components/page", "@wm/mobile/core", "@angular/common" ], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self,
67558
67580
  factory((global.wm = global.wm || {}, global.wm.mobile = global.wm.mobile || {},
67559
- global.wm.mobile.components = global.wm.mobile.components || {}, global.wm.mobile.components.page = {}), global.ng.core, global.wm.core, global.wm.components.base, global.wm.components.page, global.wm.mobile.core, global.ng.common));
67560
- })(this, (function(exports, core$1, core, base, page, core$2, common) {
67581
+ global.wm.mobile.components = global.wm.mobile.components || {}, global.wm.mobile.components.page = {}), global.ng.core, global.wm.core, global.wm.components.base, global.modal, global.wm.components.page, global.wm.mobile.core, global.ng.common));
67582
+ })(this, (function(exports, core$1, core, base, modal, page, core$2, common) {
67561
67583
  "use strict";
67562
67584
  var PageContentLoaderComponent = function() {
67563
67585
  function PageContentLoaderComponent(el) {
@@ -67579,18 +67601,30 @@
67579
67601
  } ];
67580
67602
  };
67581
67603
  var MobilePageDirective = function() {
67582
- function MobilePageDirective(app, elRef, deviceService, page, navigationService) {
67604
+ function MobilePageDirective(app, elRef, modalService, deviceService, page, navigationService) {
67583
67605
  var _this = this;
67606
+ this.modalService = modalService;
67584
67607
  this.deviceService = deviceService;
67585
67608
  this.page = page;
67586
67609
  this.navigationService = navigationService;
67610
+ this.subscriptions = [];
67587
67611
  core.addClass(elRef.nativeElement, "mobile-app-page");
67588
67612
  this._$ele = $(elRef.nativeElement);
67589
67613
  page.subscribe("wmMobileTabbar:ready", (function() {
67590
67614
  return _this._$ele.addClass("has-tabbar");
67591
67615
  }));
67616
+ var modalsOpened = [];
67617
+ this.subscriptions = [ modalService.onShown.subscribe((function(_a) {
67618
+ var id = _a.id;
67619
+ id && modalsOpened.push(id);
67620
+ })), modalService.onHidden.subscribe((function(_a) {
67621
+ var id = _a.id;
67622
+ id && _.remove(modalsOpened, id);
67623
+ })) ];
67592
67624
  this._backBtnListenerDestroyer = deviceService.onBackButtonTap((function($event) {
67593
- if (app.landingPageName === app.activePageName) {
67625
+ if (modalsOpened.length > 0) {
67626
+ modalService.hide(modalsOpened.pop());
67627
+ } else if (app.landingPageName === app.activePageName) {
67594
67628
  window.navigator["app"].exitApp();
67595
67629
  } else {
67596
67630
  _this.navigationService.goToPrevious();
@@ -67599,6 +67633,9 @@
67599
67633
  }));
67600
67634
  }
67601
67635
  MobilePageDirective.prototype.ngOnDestroy = function() {
67636
+ this.subscriptions.map((function(s) {
67637
+ return s.unsubscribe();
67638
+ }));
67602
67639
  this._backBtnListenerDestroyer();
67603
67640
  };
67604
67641
  return MobilePageDirective;
@@ -67614,6 +67651,8 @@
67614
67651
  type: core.App
67615
67652
  }, {
67616
67653
  type: core$1.ElementRef
67654
+ }, {
67655
+ type: modal.BsModalService
67617
67656
  }, {
67618
67657
  type: core$2.DeviceService
67619
67658
  }, {