@wavemaker/app-ng-runtime 11.5.1-rc.5401 → 11.5.1-rc.5402

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.
@@ -2328,6 +2328,23 @@ TextContentDirective.ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: TextCo
2328
2328
  type: Input
2329
2329
  }] }); })();
2330
2330
 
2331
+ class WmPipe {
2332
+ constructor(pipeName, customPipeManager) {
2333
+ this.pipeName = pipeName;
2334
+ this.customPipeManager = customPipeManager;
2335
+ this.pipeRef = this.customPipeManager ? this.customPipeManager.getCustomPipe(pipeName) : null;
2336
+ this.isCustomPipe = this.pipeRef && _.isFunction(this.pipeRef.formatter);
2337
+ }
2338
+ customFormatter(data, args) {
2339
+ try {
2340
+ return this.pipeRef.formatter(...args);
2341
+ }
2342
+ catch (error) {
2343
+ return data;
2344
+ }
2345
+ }
2346
+ }
2347
+
2331
2348
  const getEpochValue = data => {
2332
2349
  let epoch;
2333
2350
  // For data in form of string number ('123'), convert to number (123). And don't parse date objects.
@@ -2356,8 +2373,11 @@ TrailingZeroDecimalPipe.ɵpipe = /*@__PURE__*/ i0.ɵɵdefinePipe({ name: "traili
2356
2373
  name: 'trailingZeroDecimalPipe'
2357
2374
  }]
2358
2375
  }], function () { return [{ type: i1$1.DecimalPipe }]; }, null); })();
2359
- class ToDatePipe {
2376
+ class ToDatePipe extends WmPipe {
2360
2377
  transform(data, format, timezone, compInstance) {
2378
+ if (this.isCustomPipe) {
2379
+ return this.customFormatter(data, arguments);
2380
+ }
2361
2381
  let timestamp;
2362
2382
  // 'null' is to be treated as a special case, If user wants to enter null value, empty string will be passed to the backend
2363
2383
  if (data === 'null' || data === '') {
@@ -2386,19 +2406,21 @@ class ToDatePipe {
2386
2406
  }
2387
2407
  return '';
2388
2408
  }
2389
- constructor(datePipe, i18nService) {
2409
+ constructor(datePipe, i18nService, customPipeManager) {
2410
+ super('toDate', customPipeManager);
2390
2411
  this.datePipe = datePipe;
2391
2412
  this.i18nService = i18nService;
2413
+ this.customPipeManager = customPipeManager;
2392
2414
  }
2393
2415
  }
2394
- ToDatePipe.ɵfac = function ToDatePipe_Factory(t) { return new (t || ToDatePipe)(i0.ɵɵdirectiveInject(i1$1.DatePipe, 16), i0.ɵɵdirectiveInject(i1.AbstractI18nService, 16)); };
2416
+ ToDatePipe.ɵfac = function ToDatePipe_Factory(t) { return new (t || ToDatePipe)(i0.ɵɵdirectiveInject(i1$1.DatePipe, 16), i0.ɵɵdirectiveInject(i1.AbstractI18nService, 16), i0.ɵɵdirectiveInject(i1.CustomPipeManager, 16)); };
2395
2417
  ToDatePipe.ɵpipe = /*@__PURE__*/ i0.ɵɵdefinePipe({ name: "toDate", type: ToDatePipe, pure: true });
2396
2418
  (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ToDatePipe, [{
2397
2419
  type: Pipe,
2398
2420
  args: [{
2399
2421
  name: 'toDate'
2400
2422
  }]
2401
- }], function () { return [{ type: i1$1.DatePipe }, { type: i1.AbstractI18nService }]; }, null); })();
2423
+ }], function () { return [{ type: i1$1.DatePipe }, { type: i1.AbstractI18nService }, { type: i1.CustomPipeManager }]; }, null); })();
2402
2424
  class ToNumberPipe {
2403
2425
  transform(data, fracSize) {
2404
2426
  if (fracSize && !String(fracSize).match(/^(\d+)?\.((\d+)(-(\d+))?)?$/)) {