@wavemaker/angular-codegen 11.2.0-next.24366 → 11.2.0-next.24367

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.
@@ -14483,6 +14483,15 @@
14483
14483
  "integrity": "sha512-z6IJ5HXYiuxvFTI6eiQ9dm77uE0gyy1yXNApVHqTcnIKfY9tIwEjlzsZ6u1LQXvVgKeTnv9Xm7NDvJ7lso3MtA==",
14484
14484
  "dev": true
14485
14485
  },
14486
+ "moment-timezone": {
14487
+ "version": "0.5.37",
14488
+ "resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.37.tgz",
14489
+ "integrity": "sha512-uEDzDNFhfaywRl+vwXxffjjq1q0Vzr+fcQpQ1bU0kbzorfS7zVtZnCnGc8mhWmF39d4g4YriF6kwA75mJKE/Zg==",
14490
+ "dev": true,
14491
+ "requires": {
14492
+ "moment": ">= 2.9.0"
14493
+ }
14494
+ },
14486
14495
  "morgan": {
14487
14496
  "version": "1.10.0",
14488
14497
  "resolved": "https://registry.npmjs.org/morgan/-/morgan-1.10.0.tgz",
@@ -68,7 +68,7 @@
68
68
  "tslib": "^2.0.0",
69
69
  "x2js": "3.2.6",
70
70
  "zone.js": "~0.11.4",
71
- "@wavemaker/app-ng-runtime": "11.2.0-next.24366"
71
+ "@wavemaker/app-ng-runtime": "11.2.0-next.24367"
72
72
  },
73
73
  "devDependencies": {
74
74
  "@ampproject/rollup-plugin-closure-compiler": "0.8.5",
@@ -103,6 +103,7 @@
103
103
  "karma-jasmine-html-reporter": "^1.5.0",
104
104
  "karma-mocha-reporter": "2.2.5",
105
105
  "moment": "2.29.0",
106
+ "moment-timezone": "^0.5.34",
106
107
  "ng-packagr": "12.2.7",
107
108
  "npm-run-all": "4.1.5",
108
109
  "rimraf": "2.6.3",
@@ -45619,6 +45619,8 @@ var Operation;
45619
45619
  const DataSource = {
45620
45620
  Operation
45621
45621
  };
45622
+ class AbstractI18nService {
45623
+ }
45622
45624
 
45623
45625
  const userAgent = window.navigator.userAgent;
45624
45626
  const REGEX = {
@@ -45651,7 +45653,8 @@ const REGEX = {
45651
45653
  SPECIAL_CHARACTERS: /[^A-Z0-9a-z_]+/i,
45652
45654
  APP_SERVER_URL_FORMAT: /^(http[s]?:\/\/)(www\.){0,1}[a-zA-Z0-9\.\-]+([:]?[0-9]{2,5}|\.[a-zA-Z]{2,5}[\.]{0,1})\/+[^?#&=]+$/,
45653
45655
  JSON_DATE_FORMAT: /\d{4}-[0-1]\d-[0-3]\d(T[0-2]\d:[0-5]\d:[0-5]\d.\d{1,3}Z$)?/,
45654
- DATA_URL: /^\s*data:([a-z]+\/[a-z0-9-+.]+(;[a-z-]+=[a-z0-9-]+)?)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s]*)\s*$/i
45656
+ DATA_URL: /^\s*data:([a-z]+\/[a-z0-9-+.]+(;[a-z-]+=[a-z0-9-]+)?)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s]*)\s*$/i,
45657
+ ISO_DATE_FORMAT: /(\d{4}-\d{2}-\d{2})T(\d{2}:\d{2}:\d{2})(\.\d+)?([+-]\d{2}:?\d{2}|Z)$/
45655
45658
  }, compareBySeparator = ':';
45656
45659
  const NUMBER_TYPES = ['int', DataType.INTEGER, DataType.FLOAT, DataType.DOUBLE, DataType.LONG, DataType.SHORT, DataType.BYTE, DataType.BIG_INTEGER, DataType.BIG_DECIMAL];
45657
45660
  const now = new Date();
@@ -45877,19 +45880,43 @@ function triggerFn(fn, ...argmnts) {
45877
45880
  /**
45878
45881
  * This method is used to get the formatted date
45879
45882
  */
45880
- const getFormattedDate = (datePipe, dateObj, format) => {
45883
+ const getFormattedDate = (datePipe, dateObj, format, timeZone, isTimeStampType, isIntervalDateTime, compInstance) => {
45881
45884
  if (!dateObj) {
45882
45885
  return undefined;
45883
45886
  }
45884
45887
  if (format === 'timestamp') {
45885
45888
  return moment(dateObj).valueOf();
45886
45889
  }
45887
- return datePipe.transform(dateObj, format);
45890
+ if (format === 'UTC') {
45891
+ return new Date(dateObj).toISOString();
45892
+ }
45893
+ if (timeZone) {
45894
+ const momentFormat = format.replaceAll('y', 'Y').replaceAll('d', 'D').replace('a', 'A');
45895
+ if (isIntervalDateTime) { // dates which are of type time widget (value is hh:mm:ss) but returned as date string from time comp
45896
+ return moment(dateObj).format(momentFormat);
45897
+ }
45898
+ if (isTimeStampType === 'datetimestamp') {
45899
+ dateObj = getMomentLocaleObject(timeZone, dateObj);
45900
+ return moment(dateObj).format(momentFormat);
45901
+ }
45902
+ }
45903
+ return datePipe.transform(dateObj, format, timeZone, compInstance);
45904
+ };
45905
+ /**
45906
+ * This method is used to check if the date has timezone information or not
45907
+ */
45908
+ const hasOffsetStr = (dateStr) => {
45909
+ if (typeof dateStr !== 'string')
45910
+ return;
45911
+ const matches = dateStr.match(REGEX.ISO_DATE_FORMAT);
45912
+ if (matches && matches[4]) {
45913
+ return true;
45914
+ }
45888
45915
  };
45889
45916
  /**
45890
45917
  * method to get the date object from the input received
45891
45918
  */
45892
- const getDateObj = (value, options) => {
45919
+ const getDateObj = (value, options, timezone) => {
45893
45920
  // Handling localization
45894
45921
  if (options && options.pattern && options.pattern !== 'timestamp') {
45895
45922
  // Fix for WMS-19601, invalid date is returned on date selection.
@@ -45921,7 +45948,7 @@ const getDateObj = (value, options) => {
45921
45948
  * (Ex: If date value is "1990-11-23" and moment(value).format() is "١٩٩٠-١١-٢٣T٠٠:٠٠:٠٠+٠٥:٣٠")
45922
45949
  * and new Date(moment(value).format()) is giving Invalid Date. So frst converting it to timestamp value.
45923
45950
  */
45924
- dateObj = new Date(moment(moment(value).format()).valueOf());
45951
+ dateObj = !timezone ? new Date(moment(moment(value).format()).valueOf()) : getMomentLocaleObject(timezone, value);
45925
45952
  }
45926
45953
  if (value === CURRENT_DATE || isNaN(dateObj.getDay())) {
45927
45954
  return now;
@@ -46313,6 +46340,14 @@ const loadStyleSheets = (urls = []) => {
46313
46340
  // function to check if the script is already loaded
46314
46341
  const isScriptLoaded = src => !!getNode(`script[src="${src}"], script[data-src="${src}"]`);
46315
46342
  const ɵ4$3 = isScriptLoaded;
46343
+ const getMomentLocaleObject = (timeZone, dateObj) => {
46344
+ if (dateObj) {
46345
+ return new Date(new Date(moment(dateObj).tz(timeZone).format()).toLocaleString("en-US", { timeZone: timeZone }));
46346
+ }
46347
+ else {
46348
+ return new Date(new Date(moment().tz(timeZone).format()).toLocaleString("en-US", { timeZone: timeZone }));
46349
+ }
46350
+ };
46316
46351
  const loadScript = (url, loadViaScriptTag, cacheable = false) => __awaiter$1(void 0, void 0, void 0, function* () {
46317
46352
  const _url = url.trim();
46318
46353
  if (!_url.length || isScriptLoaded(_url)) {
@@ -47032,6 +47067,7 @@ var Utils = /*#__PURE__*/Object.freeze({
47032
47067
  getResourceURL: getResourceURL,
47033
47068
  triggerFn: triggerFn,
47034
47069
  getFormattedDate: getFormattedDate,
47070
+ hasOffsetStr: hasOffsetStr,
47035
47071
  getDateObj: getDateObj,
47036
47072
  addEventListenerOnElement: addEventListenerOnElement,
47037
47073
  getClonedObject: getClonedObject,
@@ -47055,6 +47091,7 @@ var Utils = /*#__PURE__*/Object.freeze({
47055
47091
  isEqualWithFields: isEqualWithFields,
47056
47092
  loadStyleSheet: loadStyleSheet,
47057
47093
  loadStyleSheets: loadStyleSheets,
47094
+ getMomentLocaleObject: getMomentLocaleObject,
47058
47095
  loadScript: loadScript,
47059
47096
  loadScripts: loadScripts,
47060
47097
  _WM_APP_PROJECT: _WM_APP_PROJECT,
@@ -69437,10 +69474,11 @@ const getEpochValue = data => {
69437
69474
  return epoch;
69438
69475
  };
69439
69476
  class ToDatePipe {
69440
- constructor(datePipe) {
69477
+ constructor(datePipe, i18nService) {
69441
69478
  this.datePipe = datePipe;
69479
+ this.i18nService = i18nService;
69442
69480
  }
69443
- transform(data, format) {
69481
+ transform(data, format, timezone, compInstance) {
69444
69482
  let timestamp;
69445
69483
  // 'null' is to be treated as a special case, If user wants to enter null value, empty string will be passed to the backend
69446
69484
  if (data === 'null' || data === '') {
@@ -69454,7 +69492,18 @@ class ToDatePipe {
69454
69492
  if (format === 'timestamp') {
69455
69493
  return timestamp;
69456
69494
  }
69457
- return this.datePipe.transform(timestamp, format);
69495
+ if (format === 'UTC') {
69496
+ return new Date(timestamp).toISOString();
69497
+ }
69498
+ let formattedVal;
69499
+ const timeZone = this.i18nService ? this.i18nService.getTimezone(compInstance) : timezone;
69500
+ if (timeZone && (data === timestamp || hasOffsetStr(data))) {
69501
+ formattedVal = moment(timestamp).tz(timeZone).format(format.replaceAll('y', 'Y').replaceAll('d', 'D').replace('a', 'A'));
69502
+ }
69503
+ else {
69504
+ formattedVal = this.datePipe.transform(timestamp, format);
69505
+ }
69506
+ return formattedVal;
69458
69507
  }
69459
69508
  return '';
69460
69509
  }
@@ -69465,18 +69514,21 @@ ToDatePipe.decorators = [
69465
69514
  },] }
69466
69515
  ];
69467
69516
  ToDatePipe.ctorParameters = () => [
69468
- { type: DatePipe$1 }
69517
+ { type: DatePipe$1 },
69518
+ { type: AbstractI18nService }
69469
69519
  ];
69470
69520
  class ToNumberPipe {
69471
- constructor(decimalPipe) {
69521
+ constructor(decimalPipe, locale) {
69472
69522
  this.decimalPipe = decimalPipe;
69523
+ this.locale = locale;
69473
69524
  }
69474
69525
  transform(data, fracSize) {
69475
69526
  if (fracSize && !String(fracSize).match(/^(\d+)?\.((\d+)(-(\d+))?)?$/)) {
69476
69527
  fracSize = '1.' + fracSize + '-' + fracSize;
69477
69528
  }
69478
69529
  if (!_.isNaN(+data)) {
69479
- return this.decimalPipe.transform(data, fracSize);
69530
+ const formattedLocale = this.locale ? this.locale['number'] : undefined;
69531
+ return this.decimalPipe.transform(data, fracSize, formattedLocale);
69480
69532
  }
69481
69533
  }
69482
69534
  }
@@ -69486,15 +69538,17 @@ ToNumberPipe.decorators = [
69486
69538
  },] }
69487
69539
  ];
69488
69540
  ToNumberPipe.ctorParameters = () => [
69489
- { type: DecimalPipe$1 }
69541
+ { type: DecimalPipe$1 },
69542
+ { type: undefined, decorators: [{ type: Inject$1, args: ["",] }] }
69490
69543
  ];
69491
69544
  class ToCurrencyPipe {
69492
- constructor(decimalPipe) {
69545
+ constructor(decimalPipe, locale) {
69493
69546
  this.decimalPipe = decimalPipe;
69547
+ this.locale = locale;
69494
69548
  }
69495
69549
  transform(data, currencySymbol, fracSize) {
69496
69550
  const _currencySymbol = (CURRENCY_INFO[currencySymbol] || {}).symbol || currencySymbol || '';
69497
- let _val = new ToNumberPipe(this.decimalPipe).transform(data, fracSize);
69551
+ let _val = new ToNumberPipe(this.decimalPipe, this.locale).transform(data, fracSize);
69498
69552
  const isNegativeNumber = _.startsWith(_val, '-');
69499
69553
  if (isNegativeNumber) {
69500
69554
  _val = _val.replace('-', '');
@@ -69508,7 +69562,8 @@ ToCurrencyPipe.decorators = [
69508
69562
  },] }
69509
69563
  ];
69510
69564
  ToCurrencyPipe.ctorParameters = () => [
69511
- { type: DecimalPipe$1 }
69565
+ { type: DecimalPipe$1 },
69566
+ { type: undefined, decorators: [{ type: Inject$1, args: ["",] }] }
69512
69567
  ];
69513
69568
  class PrefixPipe {
69514
69569
  transform(data, padding) {
@@ -71632,11 +71687,13 @@ Title$1.ctorParameters = () => [
71632
71687
  const VERSION$4 = new Version('12.2.16');
71633
71688
 
71634
71689
  class PipeProvider {
71635
- constructor(compiler, injector, domSanitizer) {
71690
+ constructor(compiler, injector, domSanitizer, i18service) {
71636
71691
  this.compiler = compiler;
71637
71692
  this.injector = injector;
71638
71693
  this.domSanitizer = domSanitizer;
71694
+ this.i18service = i18service;
71639
71695
  this._locale = getSessionStorageItem('selectedLocale') || 'en';
71696
+ this.formatsByLocale = this.i18service.getwidgetLocale();
71640
71697
  this.preparePipeMeta = (reference, name, pure, diDeps = []) => ({
71641
71698
  type: { reference, diDeps },
71642
71699
  name,
@@ -71671,10 +71728,12 @@ class PipeProvider {
71671
71728
  new DatePipe(this._locale)
71672
71729
  ]),
71673
71730
  this.preparePipeMeta(ToNumberPipe, 'toNumber', true, [
71674
- new DecimalPipe(this._locale)
71731
+ new DecimalPipe(this._locale),
71732
+ this.formatsByLocale
71675
71733
  ]),
71676
71734
  this.preparePipeMeta(ToCurrencyPipe, 'toCurrency', true, [
71677
- new DecimalPipe(this._locale)
71735
+ new DecimalPipe(this._locale),
71736
+ this.formatsByLocale
71678
71737
  ]),
71679
71738
  this.preparePipeMeta(PrefixPipe, 'prefix', true),
71680
71739
  this.preparePipeMeta(SuffixPipe, 'suffix', true),
@@ -71729,7 +71788,7 @@ class PipeProvider {
71729
71788
  }
71730
71789
  }
71731
71790
  }
71732
- PipeProvider.ɵprov = ɵɵdefineInjectable({ factory: function PipeProvider_Factory() { return new PipeProvider(ɵɵinject(Compiler), ɵɵinject(INJECTOR$1), ɵɵinject(DomSanitizer$1)); }, token: PipeProvider, providedIn: "root" });
71791
+ PipeProvider.ɵprov = ɵɵdefineInjectable({ factory: function PipeProvider_Factory() { return new PipeProvider(ɵɵinject(Compiler), ɵɵinject(INJECTOR$1), ɵɵinject(DomSanitizer$1), ɵɵinject(AbstractI18nService)); }, token: PipeProvider, providedIn: "root" });
71733
71792
  PipeProvider.decorators = [
71734
71793
  { type: Injectable, args: [{
71735
71794
  providedIn: 'root'
@@ -71738,7 +71797,8 @@ PipeProvider.decorators = [
71738
71797
  PipeProvider.ctorParameters = () => [
71739
71798
  { type: Compiler },
71740
71799
  { type: Injector },
71741
- { type: DomSanitizer$1 }
71800
+ { type: DomSanitizer$1 },
71801
+ { type: AbstractI18nService }
71742
71802
  ];
71743
71803
 
71744
71804
  exports.PipeProvider = PipeProvider;
@@ -41731,7 +41731,8 @@ const REGEX = {
41731
41731
  SPECIAL_CHARACTERS: /[^A-Z0-9a-z_]+/i,
41732
41732
  APP_SERVER_URL_FORMAT: /^(http[s]?:\/\/)(www\.){0,1}[a-zA-Z0-9\.\-]+([:]?[0-9]{2,5}|\.[a-zA-Z]{2,5}[\.]{0,1})\/+[^?#&=]+$/,
41733
41733
  JSON_DATE_FORMAT: /\d{4}-[0-1]\d-[0-3]\d(T[0-2]\d:[0-5]\d:[0-5]\d.\d{1,3}Z$)?/,
41734
- DATA_URL: /^\s*data:([a-z]+\/[a-z0-9-+.]+(;[a-z-]+=[a-z0-9-]+)?)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s]*)\s*$/i
41734
+ DATA_URL: /^\s*data:([a-z]+\/[a-z0-9-+.]+(;[a-z-]+=[a-z0-9-]+)?)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s]*)\s*$/i,
41735
+ ISO_DATE_FORMAT: /(\d{4}-\d{2}-\d{2})T(\d{2}:\d{2}:\d{2})(\.\d+)?([+-]\d{2}:?\d{2}|Z)$/
41735
41736
  }, compareBySeparator = ':';
41736
41737
  const NUMBER_TYPES = ['int', DataType.INTEGER, DataType.FLOAT, DataType.DOUBLE, DataType.LONG, DataType.SHORT, DataType.BYTE, DataType.BIG_INTEGER, DataType.BIG_DECIMAL];
41737
41738
  const now = new Date();
@@ -41957,19 +41958,43 @@ function triggerFn(fn, ...argmnts) {
41957
41958
  /**
41958
41959
  * This method is used to get the formatted date
41959
41960
  */
41960
- const getFormattedDate = (datePipe, dateObj, format) => {
41961
+ const getFormattedDate = (datePipe, dateObj, format, timeZone, isTimeStampType, isIntervalDateTime, compInstance) => {
41961
41962
  if (!dateObj) {
41962
41963
  return undefined;
41963
41964
  }
41964
41965
  if (format === 'timestamp') {
41965
41966
  return moment(dateObj).valueOf();
41966
41967
  }
41967
- return datePipe.transform(dateObj, format);
41968
+ if (format === 'UTC') {
41969
+ return new Date(dateObj).toISOString();
41970
+ }
41971
+ if (timeZone) {
41972
+ const momentFormat = format.replaceAll('y', 'Y').replaceAll('d', 'D').replace('a', 'A');
41973
+ if (isIntervalDateTime) { // dates which are of type time widget (value is hh:mm:ss) but returned as date string from time comp
41974
+ return moment(dateObj).format(momentFormat);
41975
+ }
41976
+ if (isTimeStampType === 'datetimestamp') {
41977
+ dateObj = getMomentLocaleObject(timeZone, dateObj);
41978
+ return moment(dateObj).format(momentFormat);
41979
+ }
41980
+ }
41981
+ return datePipe.transform(dateObj, format, timeZone, compInstance);
41982
+ };
41983
+ /**
41984
+ * This method is used to check if the date has timezone information or not
41985
+ */
41986
+ const hasOffsetStr = (dateStr) => {
41987
+ if (typeof dateStr !== 'string')
41988
+ return;
41989
+ const matches = dateStr.match(REGEX.ISO_DATE_FORMAT);
41990
+ if (matches && matches[4]) {
41991
+ return true;
41992
+ }
41968
41993
  };
41969
41994
  /**
41970
41995
  * method to get the date object from the input received
41971
41996
  */
41972
- const getDateObj = (value, options) => {
41997
+ const getDateObj = (value, options, timezone) => {
41973
41998
  // Handling localization
41974
41999
  if (options && options.pattern && options.pattern !== 'timestamp') {
41975
42000
  // Fix for WMS-19601, invalid date is returned on date selection.
@@ -42001,7 +42026,7 @@ const getDateObj = (value, options) => {
42001
42026
  * (Ex: If date value is "1990-11-23" and moment(value).format() is "١٩٩٠-١١-٢٣T٠٠:٠٠:٠٠+٠٥:٣٠")
42002
42027
  * and new Date(moment(value).format()) is giving Invalid Date. So frst converting it to timestamp value.
42003
42028
  */
42004
- dateObj = new Date(moment(moment(value).format()).valueOf());
42029
+ dateObj = !timezone ? new Date(moment(moment(value).format()).valueOf()) : getMomentLocaleObject(timezone, value);
42005
42030
  }
42006
42031
  if (value === CURRENT_DATE || isNaN(dateObj.getDay())) {
42007
42032
  return now;
@@ -42393,6 +42418,14 @@ const loadStyleSheets = (urls = []) => {
42393
42418
  // function to check if the script is already loaded
42394
42419
  const isScriptLoaded = src => !!getNode(`script[src="${src}"], script[data-src="${src}"]`);
42395
42420
  const ɵ4$3 = isScriptLoaded;
42421
+ const getMomentLocaleObject = (timeZone, dateObj) => {
42422
+ if (dateObj) {
42423
+ return new Date(new Date(moment(dateObj).tz(timeZone).format()).toLocaleString("en-US", { timeZone: timeZone }));
42424
+ }
42425
+ else {
42426
+ return new Date(new Date(moment().tz(timeZone).format()).toLocaleString("en-US", { timeZone: timeZone }));
42427
+ }
42428
+ };
42396
42429
  const loadScript = (url, loadViaScriptTag, cacheable = false) => __awaiter$1(void 0, void 0, void 0, function* () {
42397
42430
  const _url = url.trim();
42398
42431
  if (!_url.length || isScriptLoaded(_url)) {
@@ -43112,6 +43145,7 @@ var Utils = /*#__PURE__*/Object.freeze({
43112
43145
  getResourceURL: getResourceURL,
43113
43146
  triggerFn: triggerFn,
43114
43147
  getFormattedDate: getFormattedDate,
43148
+ hasOffsetStr: hasOffsetStr,
43115
43149
  getDateObj: getDateObj,
43116
43150
  addEventListenerOnElement: addEventListenerOnElement,
43117
43151
  getClonedObject: getClonedObject,
@@ -43135,6 +43169,7 @@ var Utils = /*#__PURE__*/Object.freeze({
43135
43169
  isEqualWithFields: isEqualWithFields,
43136
43170
  loadStyleSheet: loadStyleSheet,
43137
43171
  loadStyleSheets: loadStyleSheets,
43172
+ getMomentLocaleObject: getMomentLocaleObject,
43138
43173
  loadScript: loadScript,
43139
43174
  loadScripts: loadScripts,
43140
43175
  _WM_APP_PROJECT: _WM_APP_PROJECT,
@@ -41731,7 +41731,8 @@ const REGEX = {
41731
41731
  SPECIAL_CHARACTERS: /[^A-Z0-9a-z_]+/i,
41732
41732
  APP_SERVER_URL_FORMAT: /^(http[s]?:\/\/)(www\.){0,1}[a-zA-Z0-9\.\-]+([:]?[0-9]{2,5}|\.[a-zA-Z]{2,5}[\.]{0,1})\/+[^?#&=]+$/,
41733
41733
  JSON_DATE_FORMAT: /\d{4}-[0-1]\d-[0-3]\d(T[0-2]\d:[0-5]\d:[0-5]\d.\d{1,3}Z$)?/,
41734
- DATA_URL: /^\s*data:([a-z]+\/[a-z0-9-+.]+(;[a-z-]+=[a-z0-9-]+)?)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s]*)\s*$/i
41734
+ DATA_URL: /^\s*data:([a-z]+\/[a-z0-9-+.]+(;[a-z-]+=[a-z0-9-]+)?)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s]*)\s*$/i,
41735
+ ISO_DATE_FORMAT: /(\d{4}-\d{2}-\d{2})T(\d{2}:\d{2}:\d{2})(\.\d+)?([+-]\d{2}:?\d{2}|Z)$/
41735
41736
  }, compareBySeparator = ':';
41736
41737
  const NUMBER_TYPES = ['int', DataType.INTEGER, DataType.FLOAT, DataType.DOUBLE, DataType.LONG, DataType.SHORT, DataType.BYTE, DataType.BIG_INTEGER, DataType.BIG_DECIMAL];
41737
41738
  const now = new Date();
@@ -41957,19 +41958,43 @@ function triggerFn(fn, ...argmnts) {
41957
41958
  /**
41958
41959
  * This method is used to get the formatted date
41959
41960
  */
41960
- const getFormattedDate = (datePipe, dateObj, format) => {
41961
+ const getFormattedDate = (datePipe, dateObj, format, timeZone, isTimeStampType, isIntervalDateTime, compInstance) => {
41961
41962
  if (!dateObj) {
41962
41963
  return undefined;
41963
41964
  }
41964
41965
  if (format === 'timestamp') {
41965
41966
  return moment(dateObj).valueOf();
41966
41967
  }
41967
- return datePipe.transform(dateObj, format);
41968
+ if (format === 'UTC') {
41969
+ return new Date(dateObj).toISOString();
41970
+ }
41971
+ if (timeZone) {
41972
+ const momentFormat = format.replaceAll('y', 'Y').replaceAll('d', 'D').replace('a', 'A');
41973
+ if (isIntervalDateTime) { // dates which are of type time widget (value is hh:mm:ss) but returned as date string from time comp
41974
+ return moment(dateObj).format(momentFormat);
41975
+ }
41976
+ if (isTimeStampType === 'datetimestamp') {
41977
+ dateObj = getMomentLocaleObject(timeZone, dateObj);
41978
+ return moment(dateObj).format(momentFormat);
41979
+ }
41980
+ }
41981
+ return datePipe.transform(dateObj, format, timeZone, compInstance);
41982
+ };
41983
+ /**
41984
+ * This method is used to check if the date has timezone information or not
41985
+ */
41986
+ const hasOffsetStr = (dateStr) => {
41987
+ if (typeof dateStr !== 'string')
41988
+ return;
41989
+ const matches = dateStr.match(REGEX.ISO_DATE_FORMAT);
41990
+ if (matches && matches[4]) {
41991
+ return true;
41992
+ }
41968
41993
  };
41969
41994
  /**
41970
41995
  * method to get the date object from the input received
41971
41996
  */
41972
- const getDateObj = (value, options) => {
41997
+ const getDateObj = (value, options, timezone) => {
41973
41998
  // Handling localization
41974
41999
  if (options && options.pattern && options.pattern !== 'timestamp') {
41975
42000
  // Fix for WMS-19601, invalid date is returned on date selection.
@@ -42001,7 +42026,7 @@ const getDateObj = (value, options) => {
42001
42026
  * (Ex: If date value is "1990-11-23" and moment(value).format() is "١٩٩٠-١١-٢٣T٠٠:٠٠:٠٠+٠٥:٣٠")
42002
42027
  * and new Date(moment(value).format()) is giving Invalid Date. So frst converting it to timestamp value.
42003
42028
  */
42004
- dateObj = new Date(moment(moment(value).format()).valueOf());
42029
+ dateObj = !timezone ? new Date(moment(moment(value).format()).valueOf()) : getMomentLocaleObject(timezone, value);
42005
42030
  }
42006
42031
  if (value === CURRENT_DATE || isNaN(dateObj.getDay())) {
42007
42032
  return now;
@@ -42393,6 +42418,14 @@ const loadStyleSheets = (urls = []) => {
42393
42418
  // function to check if the script is already loaded
42394
42419
  const isScriptLoaded = src => !!getNode(`script[src="${src}"], script[data-src="${src}"]`);
42395
42420
  const ɵ4$3 = isScriptLoaded;
42421
+ const getMomentLocaleObject = (timeZone, dateObj) => {
42422
+ if (dateObj) {
42423
+ return new Date(new Date(moment(dateObj).tz(timeZone).format()).toLocaleString("en-US", { timeZone: timeZone }));
42424
+ }
42425
+ else {
42426
+ return new Date(new Date(moment().tz(timeZone).format()).toLocaleString("en-US", { timeZone: timeZone }));
42427
+ }
42428
+ };
42396
42429
  const loadScript = (url, loadViaScriptTag, cacheable = false) => __awaiter$1(void 0, void 0, void 0, function* () {
42397
42430
  const _url = url.trim();
42398
42431
  if (!_url.length || isScriptLoaded(_url)) {
@@ -43112,6 +43145,7 @@ var Utils = /*#__PURE__*/Object.freeze({
43112
43145
  getResourceURL: getResourceURL,
43113
43146
  triggerFn: triggerFn,
43114
43147
  getFormattedDate: getFormattedDate,
43148
+ hasOffsetStr: hasOffsetStr,
43115
43149
  getDateObj: getDateObj,
43116
43150
  addEventListenerOnElement: addEventListenerOnElement,
43117
43151
  getClonedObject: getClonedObject,
@@ -43135,6 +43169,7 @@ var Utils = /*#__PURE__*/Object.freeze({
43135
43169
  isEqualWithFields: isEqualWithFields,
43136
43170
  loadStyleSheet: loadStyleSheet,
43137
43171
  loadStyleSheets: loadStyleSheets,
43172
+ getMomentLocaleObject: getMomentLocaleObject,
43138
43173
  loadScript: loadScript,
43139
43174
  loadScripts: loadScripts,
43140
43175
  _WM_APP_PROJECT: _WM_APP_PROJECT,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wavemaker/angular-codegen",
3
- "version": "11.2.0-next.24366",
3
+ "version": "11.2.0-next.24367",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {