@wavemaker/angular-codegen 11.0.0-next.139101 → 11.0.0-next.139102

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.
@@ -62,7 +62,7 @@ const buildAngularApp = (args) => {
62
62
  let ngBuildParams = updateDeployUrl(args.ngBuildParams);
63
63
  const NG_BUILD_MSG = 'NG BUILD MIGHT HAVE FAILED WITH HEAP OUT OF MEMORY, RE-EXECUTE THE BUILD BY INCREASING THE MAX-OLD-SPACE-SIZE ARGUMENT VALUE FOR BUILD.UI.NODE.ARGS PROPERTY IN DEPLOYMENT PROFILE';
64
64
  // Generating the angular build and post build process.
65
- executeSyncCmd('cd ' + args.appTarget + ' && node ' + args.nodeVMArgs + ' `which npm`' + ' run build -- ' + ngBuildParams, null, MSG_NG_RUNTIME_LOG, false, NG_BUILD_MSG);
65
+ executeSyncCmd('cd ' + args.appTarget + ' && node ' + args.nodeVMArgs + ' ./node_modules/@angular/cli/bin/ng build ' + ngBuildParams + ' && node build-scripts/post-build.js', null, MSG_NG_RUNTIME_LOG, false, NG_BUILD_MSG);
66
66
  }
67
67
 
68
68
 
@@ -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,22 @@ 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, i18Service) {
69472
69522
  this.decimalPipe = decimalPipe;
69523
+ this.i18Service = i18Service;
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 locale = this.i18Service.getwidgetLocale() ? this.i18Service.getwidgetLocale() : undefined;
69531
+ const formattedLocale = locale ? locale['number'] : undefined;
69532
+ return this.decimalPipe.transform(data, fracSize, formattedLocale);
69480
69533
  }
69481
69534
  }
69482
69535
  }
@@ -69486,15 +69539,17 @@ ToNumberPipe.decorators = [
69486
69539
  },] }
69487
69540
  ];
69488
69541
  ToNumberPipe.ctorParameters = () => [
69489
- { type: DecimalPipe$1 }
69542
+ { type: DecimalPipe$1 },
69543
+ { type: AbstractI18nService, decorators: [{ type: Inject$1, args: [AbstractI18nService,] }] }
69490
69544
  ];
69491
69545
  class ToCurrencyPipe {
69492
- constructor(decimalPipe) {
69546
+ constructor(decimalPipe, i18Service) {
69493
69547
  this.decimalPipe = decimalPipe;
69548
+ this.i18Service = i18Service;
69494
69549
  }
69495
69550
  transform(data, currencySymbol, fracSize) {
69496
69551
  const _currencySymbol = (CURRENCY_INFO[currencySymbol] || {}).symbol || currencySymbol || '';
69497
- let _val = new ToNumberPipe(this.decimalPipe).transform(data, fracSize);
69552
+ let _val = new ToNumberPipe(this.decimalPipe, this.i18Service).transform(data, fracSize);
69498
69553
  const isNegativeNumber = _.startsWith(_val, '-');
69499
69554
  if (isNegativeNumber) {
69500
69555
  _val = _val.replace('-', '');
@@ -69508,7 +69563,8 @@ ToCurrencyPipe.decorators = [
69508
69563
  },] }
69509
69564
  ];
69510
69565
  ToCurrencyPipe.ctorParameters = () => [
69511
- { type: DecimalPipe$1 }
69566
+ { type: DecimalPipe$1 },
69567
+ { type: AbstractI18nService, decorators: [{ type: Inject$1, args: [AbstractI18nService,] }] }
69512
69568
  ];
69513
69569
  class PrefixPipe {
69514
69570
  transform(data, padding) {
@@ -71632,11 +71688,14 @@ Title$1.ctorParameters = () => [
71632
71688
  const VERSION$4 = new Version('12.2.16');
71633
71689
 
71634
71690
  class PipeProvider {
71635
- constructor(compiler, injector, domSanitizer) {
71691
+ constructor(compiler, injector, domSanitizer, i18service) {
71692
+ var _a;
71636
71693
  this.compiler = compiler;
71637
71694
  this.injector = injector;
71638
71695
  this.domSanitizer = domSanitizer;
71696
+ this.i18service = i18service;
71639
71697
  this._locale = getSessionStorageItem('selectedLocale') || 'en';
71698
+ this.formatsByLocale = (_a = this.i18service) === null || _a === void 0 ? void 0 : _a.getwidgetLocale();
71640
71699
  this.preparePipeMeta = (reference, name, pure, diDeps = []) => ({
71641
71700
  type: { reference, diDeps },
71642
71701
  name,
@@ -71671,10 +71730,12 @@ class PipeProvider {
71671
71730
  new DatePipe(this._locale)
71672
71731
  ]),
71673
71732
  this.preparePipeMeta(ToNumberPipe, 'toNumber', true, [
71674
- new DecimalPipe(this._locale)
71733
+ new DecimalPipe(this._locale),
71734
+ this.i18service
71675
71735
  ]),
71676
71736
  this.preparePipeMeta(ToCurrencyPipe, 'toCurrency', true, [
71677
- new DecimalPipe(this._locale)
71737
+ new DecimalPipe(this._locale),
71738
+ this.i18service
71678
71739
  ]),
71679
71740
  this.preparePipeMeta(PrefixPipe, 'prefix', true),
71680
71741
  this.preparePipeMeta(SuffixPipe, 'suffix', true),
@@ -71729,7 +71790,7 @@ class PipeProvider {
71729
71790
  }
71730
71791
  }
71731
71792
  }
71732
- PipeProvider.ɵprov = ɵɵdefineInjectable({ factory: function PipeProvider_Factory() { return new PipeProvider(ɵɵinject(Compiler), ɵɵinject(INJECTOR$1), ɵɵinject(DomSanitizer$1)); }, token: PipeProvider, providedIn: "root" });
71793
+ 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
71794
  PipeProvider.decorators = [
71734
71795
  { type: Injectable, args: [{
71735
71796
  providedIn: 'root'
@@ -71738,7 +71799,8 @@ PipeProvider.decorators = [
71738
71799
  PipeProvider.ctorParameters = () => [
71739
71800
  { type: Compiler },
71740
71801
  { type: Injector },
71741
- { type: DomSanitizer$1 }
71802
+ { type: DomSanitizer$1 },
71803
+ { type: AbstractI18nService }
71742
71804
  ];
71743
71805
 
71744
71806
  exports.PipeProvider = PipeProvider;