@bravura/ui 1.23.2 → 1.24.1

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.
Files changed (73) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/behavior/await.directive.d.ts +5 -1
  3. package/behavior/behavior.module.d.ts +6 -4
  4. package/behavior/observe-content-class.directive.d.ts +29 -0
  5. package/behavior/public-api.d.ts +1 -0
  6. package/behavior/sizing.directive.d.ts +2 -0
  7. package/bundles/bravura-ui-alert.umd.js +1 -1
  8. package/bundles/bravura-ui-behavior.umd.js +117 -17
  9. package/bundles/bravura-ui-behavior.umd.js.map +1 -1
  10. package/bundles/bravura-ui-currency-input.umd.js +0 -3
  11. package/bundles/bravura-ui-currency-input.umd.js.map +1 -1
  12. package/bundles/bravura-ui-decimal-input.umd.js +1 -5
  13. package/bundles/bravura-ui-decimal-input.umd.js.map +1 -1
  14. package/bundles/bravura-ui-file-upload.umd.js +47 -3
  15. package/bundles/bravura-ui-file-upload.umd.js.map +1 -1
  16. package/bundles/bravura-ui-panel.umd.js +266 -0
  17. package/bundles/bravura-ui-panel.umd.js.map +1 -0
  18. package/bundles/bravura-ui-radio-panel.umd.js +2 -2
  19. package/bundles/bravura-ui-radio-panel.umd.js.map +1 -1
  20. package/bundles/bravura-ui-stepper.umd.js +6 -2
  21. package/bundles/bravura-ui-stepper.umd.js.map +1 -1
  22. package/bundles/bravura-ui-tooltip.umd.js +34 -6
  23. package/bundles/bravura-ui-tooltip.umd.js.map +1 -1
  24. package/decimal-input/decimal-input.directive.d.ts +0 -1
  25. package/esm2015/alert/alert-message.component.js +1 -1
  26. package/esm2015/behavior/await.directive.js +15 -6
  27. package/esm2015/behavior/behavior.module.js +18 -6
  28. package/esm2015/behavior/observe-content-class.directive.js +63 -0
  29. package/esm2015/behavior/public-api.js +2 -1
  30. package/esm2015/behavior/sizing.directive.js +13 -4
  31. package/esm2015/currency-input/currency-input.directive.js +1 -4
  32. package/esm2015/decimal-input/decimal-input.directive.js +2 -6
  33. package/esm2015/file-upload/file-upload.component.js +48 -4
  34. package/esm2015/panel/bravura-ui-panel.js +5 -0
  35. package/esm2015/panel/panel-section.component.js +47 -0
  36. package/esm2015/panel/panel.component.js +93 -0
  37. package/esm2015/panel/panel.module.js +23 -0
  38. package/esm2015/panel/public-api.js +2 -0
  39. package/esm2015/panel/tinted.directive.js +60 -0
  40. package/esm2015/radio-panel/radio-panel-item.component.js +2 -2
  41. package/esm2015/radio-panel/radio-panel.component.js +1 -1
  42. package/esm2015/stepper/stepper.component.js +7 -3
  43. package/esm2015/tooltip/public-api.js +2 -1
  44. package/esm2015/tooltip/tooltip.directive.js +30 -4
  45. package/fesm2015/bravura-ui-alert.js +1 -1
  46. package/fesm2015/bravura-ui-behavior.js +104 -14
  47. package/fesm2015/bravura-ui-behavior.js.map +1 -1
  48. package/fesm2015/bravura-ui-currency-input.js +0 -3
  49. package/fesm2015/bravura-ui-currency-input.js.map +1 -1
  50. package/fesm2015/bravura-ui-decimal-input.js +1 -5
  51. package/fesm2015/bravura-ui-decimal-input.js.map +1 -1
  52. package/fesm2015/bravura-ui-file-upload.js +47 -3
  53. package/fesm2015/bravura-ui-file-upload.js.map +1 -1
  54. package/fesm2015/bravura-ui-panel.js +218 -0
  55. package/fesm2015/bravura-ui-panel.js.map +1 -0
  56. package/fesm2015/bravura-ui-radio-panel.js +2 -2
  57. package/fesm2015/bravura-ui-radio-panel.js.map +1 -1
  58. package/fesm2015/bravura-ui-stepper.js +6 -2
  59. package/fesm2015/bravura-ui-stepper.js.map +1 -1
  60. package/fesm2015/bravura-ui-tooltip.js +30 -4
  61. package/fesm2015/bravura-ui-tooltip.js.map +1 -1
  62. package/file-upload/file-upload.component.d.ts +11 -1
  63. package/package.json +1 -1
  64. package/panel/bravura-ui-panel.d.ts +5 -0
  65. package/panel/package.json +10 -0
  66. package/panel/panel-section.component.d.ts +15 -0
  67. package/panel/panel.component.d.ts +60 -0
  68. package/panel/panel.module.d.ts +16 -0
  69. package/panel/public-api.d.ts +1 -0
  70. package/panel/tinted.directive.d.ts +26 -0
  71. package/stepper/stepper.component.d.ts +1 -0
  72. package/tooltip/public-api.d.ts +1 -0
  73. package/tooltip/tooltip.directive.d.ts +8 -2
@@ -1,11 +1,13 @@
1
1
  import { coerceBooleanProperty } from '@angular/cdk/coercion';
2
2
  import { DOCUMENT, CommonModule } from '@angular/common';
3
3
  import * as i0 from '@angular/core';
4
- import { Directive, EventEmitter, Inject, Optional, Input, Output, NgModule } from '@angular/core';
4
+ import { Directive, EventEmitter, Inject, Optional, Input, Output, ɵmarkDirty, NgModule } from '@angular/core';
5
5
  import { debounceTime, take } from 'rxjs/operators';
6
6
  import { MatProgressSpinner, MatProgressSpinnerModule } from '@angular/material/progress-spinner';
7
7
  import * as i1 from '@angular/material/button';
8
8
  import { MatButtonModule } from '@angular/material/button';
9
+ import * as i1$1 from '@angular/cdk/observers';
10
+ import { ObserversModule } from '@angular/cdk/observers';
9
11
 
10
12
  /**
11
13
  * Use this directive to designate a target HTML element, based on which the child elements'
@@ -93,6 +95,7 @@ class SizingDirective {
93
95
  this._width = 0;
94
96
  this._height = 0;
95
97
  this._reflowFrameCount = 0;
98
+ this._frameHandlerId = 0;
96
99
  this._element = elemRef.nativeElement;
97
100
  this._monitorTarget = this._element;
98
101
  }
@@ -166,15 +169,22 @@ class SizingDirective {
166
169
  _setUpNodeMonitor() {
167
170
  this._tearDownNodeMonitor();
168
171
  if (this._monitorTarget) {
169
- this._observer = new ResizeObserver(() => this._calculateSize());
172
+ this._observer = new ResizeObserver(() => this._runWithObserver(this._calculateSize.bind(this)));
170
173
  this._observer.observe(this._monitorTarget, { box: 'border-box' });
171
174
  }
172
175
  }
173
176
  _tearDownNodeMonitor() {
174
- if (this._observer) {
177
+ cancelAnimationFrame(this._frameHandlerId);
178
+ this._runWithObserver(() => {
175
179
  this._observer.disconnect();
176
180
  this._observer = undefined;
181
+ });
182
+ }
183
+ _runWithObserver(func) {
184
+ if (this._observer) {
185
+ return func();
177
186
  }
187
+ return undefined;
178
188
  }
179
189
  _calculateSize() {
180
190
  const widthChanged = this._width !== this._monitorTarget.clientWidth;
@@ -233,7 +243,8 @@ class SizingDirective {
233
243
  _reflowHeight() {
234
244
  const cnt = this._reflowFrameCount;
235
245
  if (cnt < 15) {
236
- requestAnimationFrame(this._reflowHeight.bind(this));
246
+ cancelAnimationFrame(this._frameHandlerId);
247
+ this._frameHandlerId = requestAnimationFrame(this._reflowHeight.bind(this));
237
248
  if (cnt === 0) {
238
249
  this._element.style.height = '0';
239
250
  }
@@ -330,20 +341,28 @@ class AwaitDirective {
330
341
  }
331
342
  /** @ignore */
332
343
  ngDoCheck() {
333
- const inProgress = this.buiAwait === true || (typeof this.buiAwait === 'object' && !this.buiAwait.closed);
344
+ const inProgress = this.buiAwait === true || (typeof this.buiAwait === 'object' && !this.buiAwait.closed) || this._isDeterminate;
334
345
  if (inProgress !== this._processing) {
335
346
  this._processing = inProgress;
336
- this._statusChanged();
347
+ this._statusChanged(this._isDeterminate ? 'determinate' : 'indeterminate');
337
348
  }
349
+ if (this._isDeterminate && this._spinnerRef && this._spinnerRef.instance.value !== this.buiAwait) {
350
+ this._spinnerRef.instance.value = this.buiAwait;
351
+ ɵmarkDirty(this._spinnerRef.instance);
352
+ }
353
+ }
354
+ /** @ignore */
355
+ get _isDeterminate() {
356
+ return typeof this.buiAwait === 'number' && this.buiAwait >= 0 && this.buiAwait < 100;
338
357
  }
339
- _statusChanged() {
358
+ _statusChanged(mode) {
340
359
  if (this.button) {
341
360
  this.button.disabled = this._processing;
342
361
  if (this._processing) {
343
362
  this._spinnerRef = this._viewCont.createComponent(this._factory);
344
363
  const c = this._spinnerRef.instance;
345
364
  c.diameter = this.buiAwaitDiameter;
346
- c.mode = 'indeterminate';
365
+ c.mode = mode;
347
366
  c.color = this.button.color;
348
367
  const e = this._spinnerRef.location.nativeElement;
349
368
  e.setAttribute('aria-label', this.buiAwaitAriaLabel);
@@ -353,6 +372,7 @@ class AwaitDirective {
353
372
  else {
354
373
  this._captionWrapper.style.visibility = '';
355
374
  this._spinnerRef.destroy();
375
+ this._spinnerRef = undefined;
356
376
  this._overlayEl.innerHTML = '';
357
377
  }
358
378
  }
@@ -378,20 +398,90 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
378
398
  type: Input
379
399
  }] } });
380
400
 
401
+ /**
402
+ * Use `[bui-class.not-empty]` to specify a style class activated only when the host element has DOM children;
403
+ *
404
+ * use `[bui-class.empty]` for a style class activated when it has no DOM children.
405
+ *
406
+ * Use `[bui-class.no-text]` to specify a style class activated only when the host element has text content;
407
+ *
408
+ * use `[bui-class.has-text]` for a style class activated when it has no text content.
409
+ */
410
+ class ObserveContentClassDirective {
411
+ constructor(observer, elementRef) {
412
+ this.classToRemove = [];
413
+ this.element = elementRef.nativeElement;
414
+ this.subscription = observer.observe(elementRef).subscribe(() => this.checkClass());
415
+ }
416
+ ngOnInit() {
417
+ this.checkClass.bind(this);
418
+ }
419
+ ngOnDestroy() {
420
+ this.subscription.unsubscribe();
421
+ }
422
+ checkClass() {
423
+ this.element.classList.remove(...this.classToRemove);
424
+ this.classToRemove = [];
425
+ this.checkClassWith(this.classEmpty, this.classNotEmpty, () => { var _a; return this.element.childElementCount === 0 && !((_a = this.element.textContent) === null || _a === void 0 ? void 0 : _a.trim()); });
426
+ this.checkClassWith(this.classNoText, this.classHasText, () => { var _a; return !((_a = this.element.textContent) === null || _a === void 0 ? void 0 : _a.trim()); });
427
+ }
428
+ checkClassWith(withoutClass, withClass, isWithout) {
429
+ const without = isWithout();
430
+ this.addClass(without ? withoutClass : withClass);
431
+ }
432
+ addClass(cls) {
433
+ if (cls === null || cls === void 0 ? void 0 : cls.trim()) {
434
+ const classes = cls.trim().split(/\s+/);
435
+ this.element.classList.add(...classes);
436
+ this.classToRemove.push(...classes);
437
+ }
438
+ }
439
+ }
440
+ ObserveContentClassDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ObserveContentClassDirective, deps: [{ token: i1$1.ContentObserver }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
441
+ ObserveContentClassDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: ObserveContentClassDirective, selector: "[bui-class.empty],[bui-class.not-empty],[bui-class.no-text],[bui-class.has-text]", inputs: { classEmpty: ["bui-class.empty", "classEmpty"], classNotEmpty: ["bui-class.not-empty", "classNotEmpty"], classNoText: ["bui-class.no-text", "classNoText"], classHasText: ["bui-class.has-text", "classHasText"] }, ngImport: i0 });
442
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ObserveContentClassDirective, decorators: [{
443
+ type: Directive,
444
+ args: [{
445
+ selector: '[bui-class.empty],[bui-class.not-empty],[bui-class.no-text],[bui-class.has-text]'
446
+ }]
447
+ }], ctorParameters: function () { return [{ type: i1$1.ContentObserver }, { type: i0.ElementRef }]; }, propDecorators: { classEmpty: [{
448
+ type: Input,
449
+ args: ['bui-class.empty']
450
+ }], classNotEmpty: [{
451
+ type: Input,
452
+ args: ['bui-class.not-empty']
453
+ }], classNoText: [{
454
+ type: Input,
455
+ args: ['bui-class.no-text']
456
+ }], classHasText: [{
457
+ type: Input,
458
+ args: ['bui-class.has-text']
459
+ }] } });
460
+
381
461
  /**
382
462
  * For functionality that cannot be easily achieved via CSS.
383
463
  */
384
464
  class BehaviorModule {
385
465
  }
386
466
  BehaviorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: BehaviorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
387
- BehaviorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: BehaviorModule, declarations: [SizingDirective, SizingMonitorDirective, AwaitDirective], imports: [CommonModule, MatButtonModule, MatProgressSpinnerModule], exports: [SizingDirective, SizingMonitorDirective, AwaitDirective, MatProgressSpinnerModule] });
388
- BehaviorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: BehaviorModule, imports: [[CommonModule, MatButtonModule, MatProgressSpinnerModule], MatProgressSpinnerModule] });
467
+ BehaviorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: BehaviorModule, declarations: [SizingDirective, SizingMonitorDirective, AwaitDirective, ObserveContentClassDirective], imports: [CommonModule, MatButtonModule, MatProgressSpinnerModule, ObserversModule], exports: [SizingDirective,
468
+ SizingMonitorDirective,
469
+ AwaitDirective,
470
+ MatProgressSpinnerModule,
471
+ ObserveContentClassDirective] });
472
+ BehaviorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: BehaviorModule, imports: [[CommonModule, MatButtonModule, MatProgressSpinnerModule, ObserversModule], MatProgressSpinnerModule] });
389
473
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: BehaviorModule, decorators: [{
390
474
  type: NgModule,
391
475
  args: [{
392
- declarations: [SizingDirective, SizingMonitorDirective, AwaitDirective],
393
- imports: [CommonModule, MatButtonModule, MatProgressSpinnerModule],
394
- exports: [SizingDirective, SizingMonitorDirective, AwaitDirective, MatProgressSpinnerModule]
476
+ declarations: [SizingDirective, SizingMonitorDirective, AwaitDirective, ObserveContentClassDirective],
477
+ imports: [CommonModule, MatButtonModule, MatProgressSpinnerModule, ObserversModule],
478
+ exports: [
479
+ SizingDirective,
480
+ SizingMonitorDirective,
481
+ AwaitDirective,
482
+ MatProgressSpinnerModule,
483
+ ObserveContentClassDirective
484
+ ]
395
485
  }]
396
486
  }] });
397
487
 
@@ -399,5 +489,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
399
489
  * Generated bundle index. Do not edit.
400
490
  */
401
491
 
402
- export { AwaitDirective, BehaviorModule, SizingDirective, SizingMonitorDirective };
492
+ export { AwaitDirective, BehaviorModule, ObserveContentClassDirective, SizingDirective, SizingMonitorDirective };
403
493
  //# sourceMappingURL=bravura-ui-behavior.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"bravura-ui-behavior.js","sources":["../../../projects/ui/behavior/sizing-monitor.directive.ts","../../../projects/ui/behavior/sizing.directive.ts","../../../projects/ui/behavior/await.directive.ts","../../../projects/ui/behavior/behavior.module.ts","../../../projects/ui/behavior/bravura-ui-behavior.ts"],"sourcesContent":["import { Directive, ElementRef } from '@angular/core';\n\n/**\n * Use this directive to designate a target HTML element, based on which the child elements'\n * `[buiSizing]` directives will calculate the sizes.\n *\n * ```html\n * <div [buiSizingMonitor]>\n * <div [buiSizing]=\"...\">\n * </div>\n * <div>\n * <div [buiSizing]=\"...\">\n * </div>\n * </div>\n * <div>\n * ```\n */\n@Directive({\n\tselector: '[buiSizingMonitor]'\n})\nexport class SizingMonitorDirective {\n\tconstructor(public readonly element: ElementRef<HTMLElement>) {}\n}\n","import { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { DOCUMENT } from '@angular/common';\nimport {\n\tDirective,\n\tElementRef,\n\tEventEmitter,\n\tInject,\n\tInput,\n\tNgZone,\n\tOnChanges,\n\tOnDestroy,\n\tOptional,\n\tOutput,\n\tSimpleChanges\n} from '@angular/core';\nimport { debounceTime, take } from 'rxjs/operators';\nimport { SizingMonitorDirective } from './sizing-monitor.directive';\n\n/**\n * This directive monitors the changes in the width of the `sizingBy` target, and apply specified style\n * classes and/or inline styles to the current element dynamically.\n *\n * In order for the layout engine to efficiently calculate and stabilize the dimensions, the effective style property\n * `box-sizing` of the `sizingBy` target element must be set to `border-box`.\n *\n * The directive uses [ResizeObserver API](https://developer.mozilla.org/en-US/docs/Web/API/Resize_Observer_API)\n * to capture the events of element resizing. Please use a polyfill if you want to support older browsers\n * that do not implement ResizeObserver API.\n *\n * Examples:\n *\n * ```html\n * <div #parentElement>\n * <div [buiSizing]=\"{'400': 'small', '800': 'medium', '~': 'large'}\" [buiSizingBy]=\"parentElement\"></div>\n * <div [buiSizing]=\"['small', 'medium', 'large']\" [buiSizingBy]=\"'root'\"></div>\n * <div [buiSizing]=\"{'650': 'border-color: #28569', '~': 'bg-muted; border-style: dotted'}\" [buiSizingBy]=\"parentElement\"></div>\n * </div>\n * ```\n */\n@Directive({\n\tselector: '[buiSizing],[buiResized],[buiSizingBy],[buiFixedHeight]'\n})\nexport class SizingDirective implements OnChanges, OnDestroy {\n\t/**\n\t * @ignore\n\t */\n\tstatic defaultSizingBreakpoints = ['400', '800', '~'];\n\n\t/**\n\t * Specifies the breakpoint widths and the style classes.\n\t *\n\t * The sizing spec `{\"400\": \"small\", \"800\": \"medium\", \"~\": \"large\"}` tells the directive to apply\n\t * a style class `small` when the width of the monitored target is smaller than 400 pixels,\n\t * `medium` when the width is between 400 and 800 pixels, and `large` when above.\n\t *\n\t * @example {'400': 'small', '800': 'medium', '~': 'large'}\n\t */\n\t@Input()\n\tbuiSizing: string | Array<string> | { [key: string]: string } = {};\n\n\t/**\n\t * The alias of `buiSizingBy`.\n\t * @default 'root'\n\t * @deprecated\n\t * @ignore\n\t */\n\t@Input()\n\tsizingBy: 'root' | 'parent' | HTMLElement = 'root';\n\n\t/**\n\t * Designate an element to be monitored for recalculating the style classes of the current element.\n\t *\n\t * - `root` specifies the document root or the enclosing shadow host. This is the default value.\n\t * - `parent` specifies the parent element.\n\t *\n\t * @default 'root'\n\t * @alias sizingBy\n\t */\n\t@Input()\n\tget buiSizingBy(): 'root' | 'parent' | HTMLElement {\n\t\treturn this.sizingBy;\n\t}\n\tset buiSizingBy(target: 'root' | 'parent' | HTMLElement) {\n\t\tthis.sizingBy = target;\n\t}\n\n\t/**\n\t * Emits `{width, height}` when the monitor target element resizes.\n\t *\n\t * Note that the dimensions emitted are of the [sizingBy] target, but not the current element.\n\t */\n\t@Output()\n\tbuiResized = new EventEmitter<{ width: number; height: number }>();\n\n\t/**\n\t * Recalculate the height of this element according to the height of the monitored target.\n\t */\n\t@Input()\n\tbuiFixedHeight = false;\n\n\tprivate _monitorTarget: HTMLElement;\n\tprivate _observer: ResizeObserver | undefined;\n\tprivate _sizingSpec: { [key: string]: string } = {};\n\tprivate _width = 0;\n\tprivate _height = 0;\n\tprivate _reflowFrameCount = 0;\n\tprivate _element: HTMLElement;\n\n\tconstructor(\n\t\t@Inject(DOCUMENT) private _doc: Document,\n\t\t@Optional() private _defaultTarget: SizingMonitorDirective,\n\t\telemRef: ElementRef<HTMLElement>,\n\t\tprivate _zone: NgZone\n\t) {\n\t\tthis._element = elemRef.nativeElement;\n\t\tthis._monitorTarget = this._element;\n\t}\n\n\tngOnChanges(_: SimpleChanges): void {\n\t\tconst disconnected = this._element.getRootNode() instanceof HTMLElement;\n\t\tif (disconnected) {\n\t\t\t// defer shadow detection till dom connection event\n\t\t\tthis._zone.onStable.pipe(debounceTime(10), take(1)).subscribe(() => this._initOrReset());\n\t\t} else {\n\t\t\tthis._initOrReset();\n\t\t}\n\t}\n\n\tngOnDestroy(): void {\n\t\tthis._tearDownNodeMonitor();\n\t}\n\n\tprivate _initOrReset() {\n\t\tconst originalTarget = this._monitorTarget;\n\t\tif (this.buiSizingBy instanceof HTMLElement) {\n\t\t\tthis._monitorTarget = this.buiSizingBy;\n\t\t} else if (this._defaultTarget) {\n\t\t\tthis._monitorTarget = this._defaultTarget.element.nativeElement;\n\t\t} else if (this.buiSizingBy === 'root') {\n\t\t\tconst root = this._element.getRootNode();\n\t\t\tif (root instanceof ShadowRoot) {\n\t\t\t\tthis._monitorTarget = root.host as HTMLElement;\n\t\t\t} else {\n\t\t\t\tthis._monitorTarget = this._doc.documentElement;\n\t\t\t}\n\t\t} else {\n\t\t\tthis._monitorTarget = this._element.parentElement as any;\n\t\t}\n\n\t\tif (this._monitorTarget != originalTarget) {\n\t\t\tthis._setUpNodeMonitor();\n\t\t}\n\n\t\tthis._sizingSpec = {};\n\t\tlet spec = this.buiSizing;\n\t\tif (typeof spec === 'string') {\n\t\t\tspec = spec.split(',').map(k => k.trim());\n\t\t}\n\n\t\tif (Array.isArray(spec)) {\n\t\t\tspec.forEach((c, i) => {\n\t\t\t\tthis._sizingSpec[SizingDirective.defaultSizingBreakpoints[i] || '~'] = c;\n\t\t\t});\n\t\t} else if (spec) {\n\t\t\tthis._sizingSpec = spec;\n\t\t}\n\n\t\tthis.buiFixedHeight = coerceBooleanProperty(this.buiFixedHeight);\n\n\t\tthis._calculateSize();\n\t}\n\n\tprivate _setUpNodeMonitor() {\n\t\tthis._tearDownNodeMonitor();\n\t\tif (this._monitorTarget) {\n\t\t\tthis._observer = new ResizeObserver(() => this._calculateSize());\n\n\t\t\tthis._observer.observe(this._monitorTarget, { box: 'border-box' });\n\t\t}\n\t}\n\n\tprivate _tearDownNodeMonitor() {\n\t\tif (this._observer) {\n\t\t\tthis._observer.disconnect();\n\t\t\tthis._observer = undefined;\n\t\t}\n\t}\n\n\tprivate _calculateSize() {\n\t\tconst widthChanged = this._width !== this._monitorTarget.clientWidth;\n\t\tconst heightChanged = this._height !== this._monitorTarget.clientHeight;\n\t\tif (widthChanged) {\n\t\t\tthis._width = this._monitorTarget.clientWidth;\n\n\t\t\tconst bks = Object.keys(this._sizingSpec).sort((a, b) => this._toNumber(a) - this._toNumber(b));\n\t\t\tlet found = false;\n\t\t\tfor (const key of bks) {\n\t\t\t\tconst classesOrStyles = this._sizingSpec[key].split(/;+/).filter(c => c);\n\t\t\t\tthis._removeClassesOrStyles(classesOrStyles);\n\t\t\t\tconst expectedWidth = this._toNumber(key);\n\t\t\t\tif (this._width <= expectedWidth && !found) {\n\t\t\t\t\tthis._applyClassesOrStyles(classesOrStyles);\n\t\t\t\t\tfound = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (widthChanged || heightChanged) {\n\t\t\tthis._height = this._monitorTarget.clientHeight;\n\t\t\tif (this.buiFixedHeight) {\n\t\t\t\tthis._reflowFrameCount = 0;\n\t\t\t\tthis._reflowHeight();\n\t\t\t}\n\t\t\tsetTimeout(() => this._zone.run(() => this.buiResized.emit({ width: this._width, height: this._height })));\n\t\t}\n\t}\n\n\tprivate _applyClassesOrStyles(clsOrStyles: string[]) {\n\t\tclsOrStyles.forEach(s => {\n\t\t\tif (s.includes(':')) {\n\t\t\t\tconst [prop, val] = s.split(':');\n\t\t\t\tthis._element.style.setProperty(prop.trim(), val.trim());\n\t\t\t} else {\n\t\t\t\tconst classes = s.split(/\\s+/).filter(c => c);\n\t\t\t\tif (classes.length) {\n\t\t\t\t\tthis._element.classList.add(...classes);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate _removeClassesOrStyles(clsOrStyles: string[]) {\n\t\tclsOrStyles.forEach(s => {\n\t\t\tif (s.includes(':')) {\n\t\t\t\tconst [prop] = s.split(':');\n\t\t\t\tthis._element.style.removeProperty(prop);\n\t\t\t} else {\n\t\t\t\tconst classes = s.split(/\\s+/).filter(c => c);\n\t\t\t\tif (classes.length) {\n\t\t\t\t\tthis._element.classList.remove(...classes);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate _reflowHeight() {\n\t\tconst cnt = this._reflowFrameCount;\n\t\tif (cnt < 15) {\n\t\t\trequestAnimationFrame(this._reflowHeight.bind(this));\n\n\t\t\tif (cnt === 0) {\n\t\t\t\tthis._element.style.height = '0';\n\t\t\t} else if (cnt === 14) {\n\t\t\t\tconst gt = parseInt(\n\t\t\t\t\tgetComputedStyle(this._monitorTarget).getPropertyValue('padding-top').replace(/px$/, '') || '0',\n\t\t\t\t\t10\n\t\t\t\t);\n\t\t\t\tconst gb = parseInt(\n\t\t\t\t\tgetComputedStyle(this._monitorTarget).getPropertyValue('padding-bottom').replace(/px$/, '') || '0',\n\t\t\t\t\t10\n\t\t\t\t);\n\t\t\t\tthis._element.style.height = `${this._height - gt - gb - 5}px`;\n\t\t\t}\n\t\t}\n\t\tthis._reflowFrameCount++;\n\t}\n\n\tprivate _toNumber(s: string) {\n\t\treturn (s === '~' ? Infinity : Number(s)) || -Infinity;\n\t}\n}\n","import { DOCUMENT } from '@angular/common';\nimport {\n\tAfterViewInit,\n\tComponentFactory,\n\tComponentFactoryResolver,\n\tComponentRef,\n\tDirective,\n\tDoCheck,\n\tElementRef,\n\tInject,\n\tInput,\n\tOptional,\n\tViewContainerRef\n} from '@angular/core';\nimport { MatButton } from '@angular/material/button';\nimport { MatProgressSpinner } from '@angular/material/progress-spinner';\nimport { Subscription } from 'rxjs';\n\n/**\n * Use this directive on a `MatButton` element to provide an alternative view when an sync operation is in progress.\n *\n * For example:\n *\n * ```\n * <button (click)=\"submit();\" [buiAwait]=\"submitSubscription\" buiAwaitAriaLabel=\"submitting\">Submit</button>\n * ```\n *\n * Please refer to [Material Design](https://material.io/components/progress-indicators#circular-progress-indicators)\n * for more details of integrating circular spinner component with action buttons.\n *\n * The operation is considered 'in progress' when the bound property `buiAwait` evaluates to\n *\n * - `true`; or\n * - an instance of `rxjs/Subscription` and `buiAwait.closed` is falsy\n *\n * When in progress\n *\n * - the button's caption will be hidden;\n * - a `<mat-progress-spinner>` will be displayed in place of the caption;\n * - the button will be disabled by setting the property `disabled` of the `MatButton` instance.\n */\n@Directive({\n\tselector: '[buiAwait]'\n})\nexport class AwaitDirective implements AfterViewInit, DoCheck {\n\t/**\n\t * Indicates the `in progress` status of an async operation.\n\t *\n\t * The operation is considered 'in progress' when the property evaluates to\n\t *\n\t * - `true`; or\n\t * - an instance of `rxjs/Subscription` and `buiAwait.closed` is falsy\n\t *\n\t */\n\t@Input()\n\tbuiAwait: null | undefined | boolean | Subscription;\n\n\t/** The ARIA label to be put on the spinner. The default value is `\"In progress\"`. */\n\t@Input()\n\tbuiAwaitAriaLabel = 'In progress';\n\n\t/** The diameter of the in-progress spinner. The default value is `20`. */\n\t@Input()\n\tbuiAwaitDiameter = 20;\n\n\tprivate _overlayEl: HTMLDivElement | undefined;\n\tprivate _processing = false;\n\tprivate _factory: ComponentFactory<MatProgressSpinner> | undefined;\n\tprivate _spinnerRef: ComponentRef<MatProgressSpinner> | undefined;\n\tprivate _captionWrapper: HTMLElement | undefined;\n\n\tconstructor(\n\t\tprivate readonly _eRef: ElementRef<HTMLElement>,\n\t\t@Optional() private readonly button: MatButton,\n\t\t@Inject(DOCUMENT) private readonly doc: Document,\n\t\tfactoryResolver: ComponentFactoryResolver,\n\t\tprivate _viewCont: ViewContainerRef\n\t) {\n\t\tif (!button) {\n\t\t\tconsole.error('[buiAwait] can only be used on a MatButton');\n\t\t\treturn;\n\t\t}\n\t\tthis._factory = factoryResolver.resolveComponentFactory(MatProgressSpinner);\n\t}\n\n\t/** @ignore */\n\tngAfterViewInit(): void {\n\t\tif (this.button) {\n\t\t\tthis._overlayEl = this.doc.createElement('div');\n\t\t\tthis._eRef.nativeElement.appendChild(this._overlayEl);\n\t\t\tthis._overlayEl.classList.add('bui-await-overlay');\n\t\t\tthis._overlayEl.style.cssText =\n\t\t\t\t'display:flex; position:absolute; top:0; right:0; bottom:0; left:0; align-items: center; justify-content: center';\n\t\t\tthis._captionWrapper = this._eRef.nativeElement.querySelector('.mat-button-wrapper') as HTMLElement;\n\t\t}\n\t}\n\n\t/** @ignore */\n\tngDoCheck(): void {\n\t\tconst inProgress = this.buiAwait === true || (typeof this.buiAwait === 'object' && !this.buiAwait!.closed);\n\t\tif (inProgress !== this._processing) {\n\t\t\tthis._processing = inProgress;\n\t\t\tthis._statusChanged();\n\t\t}\n\t}\n\n\tprivate _statusChanged() {\n\t\tif (this.button) {\n\t\t\tthis.button.disabled = this._processing;\n\n\t\t\tif (this._processing) {\n\t\t\t\tthis._spinnerRef = this._viewCont.createComponent(this._factory!);\n\t\t\t\tconst c = this._spinnerRef.instance;\n\t\t\t\tc.diameter = this.buiAwaitDiameter;\n\t\t\t\tc.mode = 'indeterminate';\n\t\t\t\tc.color = this.button.color;\n\t\t\t\tconst e: HTMLElement = this._spinnerRef.location.nativeElement;\n\t\t\t\te.setAttribute('aria-label', this.buiAwaitAriaLabel);\n\t\t\t\tthis._overlayEl!.appendChild(e);\n\t\t\t\tthis._captionWrapper!.style.visibility = 'hidden';\n\t\t\t} else {\n\t\t\t\tthis._captionWrapper!.style.visibility = '';\n\t\t\t\tthis._spinnerRef!.destroy();\n\t\t\t\tthis._overlayEl!.innerHTML = '';\n\t\t\t}\n\t\t}\n\t}\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { SizingDirective } from './sizing.directive';\nimport { SizingMonitorDirective } from './sizing-monitor.directive';\nimport { AwaitDirective } from './await.directive';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatProgressSpinnerModule } from '@angular/material/progress-spinner';\n\n/**\n * For functionality that cannot be easily achieved via CSS.\n */\n@NgModule({\n\tdeclarations: [SizingDirective, SizingMonitorDirective, AwaitDirective],\n\timports: [CommonModule, MatButtonModule, MatProgressSpinnerModule],\n\texports: [SizingDirective, SizingMonitorDirective, AwaitDirective, MatProgressSpinnerModule]\n})\nexport class BehaviorModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;AAEA;;;;;;;;;;;;;;;MAkBa,sBAAsB;IAClC,YAA4B,OAAgC;QAAhC,YAAO,GAAP,OAAO,CAAyB;KAAI;;oHADpD,sBAAsB;wGAAtB,sBAAsB;4FAAtB,sBAAsB;kBAHlC,SAAS;mBAAC;oBACV,QAAQ,EAAE,oBAAoB;iBAC9B;;;ACDD;;;;;;;;;;;;;;;;;;;;;MAwBa,eAAe;IAkE3B,YAC2B,IAAc,EACpB,cAAsC,EAC1D,OAAgC,EACxB,KAAa;QAHK,SAAI,GAAJ,IAAI,CAAU;QACpB,mBAAc,GAAd,cAAc,CAAwB;QAElD,UAAK,GAAL,KAAK,CAAQ;;;;;;;;;;QAtDtB,cAAS,GAAuD,EAAE,CAAC;;;;;;;QASnE,aAAQ,GAAo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B,CAAC;iBAC5F;;;ACfD;;;;;;"}
1
+ {"version":3,"file":"bravura-ui-behavior.js","sources":["../../../projects/ui/behavior/sizing-monitor.directive.ts","../../../projects/ui/behavior/sizing.directive.ts","../../../projects/ui/behavior/await.directive.ts","../../../projects/ui/behavior/observe-content-class.directive.ts","../../../projects/ui/behavior/behavior.module.ts","../../../projects/ui/behavior/bravura-ui-behavior.ts"],"sourcesContent":["import { Directive, ElementRef } from '@angular/core';\n\n/**\n * Use this directive to designate a target HTML element, based on which the child elements'\n * `[buiSizing]` directives will calculate the sizes.\n *\n * ```html\n * <div [buiSizingMonitor]>\n * <div [buiSizing]=\"...\">\n * </div>\n * <div>\n * <div [buiSizing]=\"...\">\n * </div>\n * </div>\n * <div>\n * ```\n */\n@Directive({\n\tselector: '[buiSizingMonitor]'\n})\nexport class SizingMonitorDirective {\n\tconstructor(public readonly element: ElementRef<HTMLElement>) {}\n}\n","import { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { DOCUMENT } from '@angular/common';\nimport {\n\tDirective,\n\tElementRef,\n\tEventEmitter,\n\tInject,\n\tInput,\n\tNgZone,\n\tOnChanges,\n\tOnDestroy,\n\tOptional,\n\tOutput,\n\tSimpleChanges\n} from '@angular/core';\nimport { debounceTime, take } from 'rxjs/operators';\nimport { SizingMonitorDirective } from './sizing-monitor.directive';\n\n/**\n * This directive monitors the changes in the width of the `sizingBy` target, and apply specified style\n * classes and/or inline styles to the current element dynamically.\n *\n * In order for the layout engine to efficiently calculate and stabilize the dimensions, the effective style property\n * `box-sizing` of the `sizingBy` target element must be set to `border-box`.\n *\n * The directive uses [ResizeObserver API](https://developer.mozilla.org/en-US/docs/Web/API/Resize_Observer_API)\n * to capture the events of element resizing. Please use a polyfill if you want to support older browsers\n * that do not implement ResizeObserver API.\n *\n * Examples:\n *\n * ```html\n * <div #parentElement>\n * <div [buiSizing]=\"{'400': 'small', '800': 'medium', '~': 'large'}\" [buiSizingBy]=\"parentElement\"></div>\n * <div [buiSizing]=\"['small', 'medium', 'large']\" [buiSizingBy]=\"'root'\"></div>\n * <div [buiSizing]=\"{'650': 'border-color: #28569', '~': 'bg-muted; border-style: dotted'}\" [buiSizingBy]=\"parentElement\"></div>\n * </div>\n * ```\n */\n@Directive({\n\tselector: '[buiSizing],[buiResized],[buiSizingBy],[buiFixedHeight]'\n})\nexport class SizingDirective implements OnChanges, OnDestroy {\n\t/**\n\t * @ignore\n\t */\n\tstatic defaultSizingBreakpoints = ['400', '800', '~'];\n\n\t/**\n\t * Specifies the breakpoint widths and the style classes.\n\t *\n\t * The sizing spec `{\"400\": \"small\", \"800\": \"medium\", \"~\": \"large\"}` tells the directive to apply\n\t * a style class `small` when the width of the monitored target is smaller than 400 pixels,\n\t * `medium` when the width is between 400 and 800 pixels, and `large` when above.\n\t *\n\t * @example {'400': 'small', '800': 'medium', '~': 'large'}\n\t */\n\t@Input()\n\tbuiSizing: string | Array<string> | { [key: string]: string } = {};\n\n\t/**\n\t * The alias of `buiSizingBy`.\n\t * @default 'root'\n\t * @deprecated\n\t * @ignore\n\t */\n\t@Input()\n\tsizingBy: 'root' | 'parent' | HTMLElement = 'root';\n\n\t/**\n\t * Designate an element to be monitored for recalculating the style classes of the current element.\n\t *\n\t * - `root` specifies the document root or the enclosing shadow host. This is the default value.\n\t * - `parent` specifies the parent element.\n\t *\n\t * @default 'root'\n\t * @alias sizingBy\n\t */\n\t@Input()\n\tget buiSizingBy(): 'root' | 'parent' | HTMLElement {\n\t\treturn this.sizingBy;\n\t}\n\tset buiSizingBy(target: 'root' | 'parent' | HTMLElement) {\n\t\tthis.sizingBy = target;\n\t}\n\n\t/**\n\t * Emits `{width, height}` when the monitor target element resizes.\n\t *\n\t * Note that the dimensions emitted are of the [sizingBy] target, but not the current element.\n\t */\n\t@Output()\n\tbuiResized = new EventEmitter<{ width: number; height: number }>();\n\n\t/**\n\t * Recalculate the height of this element according to the height of the monitored target.\n\t */\n\t@Input()\n\tbuiFixedHeight = false;\n\n\tprivate _monitorTarget: HTMLElement;\n\tprivate _observer: ResizeObserver | undefined;\n\tprivate _sizingSpec: { [key: string]: string } = {};\n\tprivate _width = 0;\n\tprivate _height = 0;\n\tprivate _reflowFrameCount = 0;\n\tprivate _element: HTMLElement;\n\tprivate _frameHandlerId = 0;\n\n\tconstructor(\n\t\t@Inject(DOCUMENT) private _doc: Document,\n\t\t@Optional() private _defaultTarget: SizingMonitorDirective,\n\t\telemRef: ElementRef<HTMLElement>,\n\t\tprivate _zone: NgZone\n\t) {\n\t\tthis._element = elemRef.nativeElement;\n\t\tthis._monitorTarget = this._element;\n\t}\n\n\tngOnChanges(_: SimpleChanges): void {\n\t\tconst disconnected = this._element.getRootNode() instanceof HTMLElement;\n\t\tif (disconnected) {\n\t\t\t// defer shadow detection till dom connection event\n\t\t\tthis._zone.onStable.pipe(debounceTime(10), take(1)).subscribe(() => this._initOrReset());\n\t\t} else {\n\t\t\tthis._initOrReset();\n\t\t}\n\t}\n\n\tngOnDestroy(): void {\n\t\tthis._tearDownNodeMonitor();\n\t}\n\n\tprivate _initOrReset() {\n\t\tconst originalTarget = this._monitorTarget;\n\t\tif (this.buiSizingBy instanceof HTMLElement) {\n\t\t\tthis._monitorTarget = this.buiSizingBy;\n\t\t} else if (this._defaultTarget) {\n\t\t\tthis._monitorTarget = this._defaultTarget.element.nativeElement;\n\t\t} else if (this.buiSizingBy === 'root') {\n\t\t\tconst root = this._element.getRootNode();\n\t\t\tif (root instanceof ShadowRoot) {\n\t\t\t\tthis._monitorTarget = root.host as HTMLElement;\n\t\t\t} else {\n\t\t\t\tthis._monitorTarget = this._doc.documentElement;\n\t\t\t}\n\t\t} else {\n\t\t\tthis._monitorTarget = this._element.parentElement as any;\n\t\t}\n\n\t\tif (this._monitorTarget != originalTarget) {\n\t\t\tthis._setUpNodeMonitor();\n\t\t}\n\n\t\tthis._sizingSpec = {};\n\t\tlet spec = this.buiSizing;\n\t\tif (typeof spec === 'string') {\n\t\t\tspec = spec.split(',').map(k => k.trim());\n\t\t}\n\n\t\tif (Array.isArray(spec)) {\n\t\t\tspec.forEach((c, i) => {\n\t\t\t\tthis._sizingSpec[SizingDirective.defaultSizingBreakpoints[i] || '~'] = c;\n\t\t\t});\n\t\t} else if (spec) {\n\t\t\tthis._sizingSpec = spec;\n\t\t}\n\n\t\tthis.buiFixedHeight = coerceBooleanProperty(this.buiFixedHeight);\n\n\t\tthis._calculateSize();\n\t}\n\n\tprivate _setUpNodeMonitor() {\n\t\tthis._tearDownNodeMonitor();\n\t\tif (this._monitorTarget) {\n\t\t\tthis._observer = new ResizeObserver(() => this._runWithObserver(this._calculateSize.bind(this)));\n\n\t\t\tthis._observer.observe(this._monitorTarget, { box: 'border-box' });\n\t\t}\n\t}\n\n\tprivate _tearDownNodeMonitor() {\n\t\tcancelAnimationFrame(this._frameHandlerId);\n\t\tthis._runWithObserver(() => {\n\t\t\tthis._observer!.disconnect();\n\t\t\tthis._observer = undefined;\n\t\t});\n\t}\n\n\tprivate _runWithObserver<T>(func: () => T): T | undefined {\n\t\tif (this._observer) {\n\t\t\treturn func();\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tprivate _calculateSize() {\n\t\tconst widthChanged = this._width !== this._monitorTarget.clientWidth;\n\t\tconst heightChanged = this._height !== this._monitorTarget.clientHeight;\n\t\tif (widthChanged) {\n\t\t\tthis._width = this._monitorTarget.clientWidth;\n\n\t\t\tconst bks = Object.keys(this._sizingSpec).sort((a, b) => this._toNumber(a) - this._toNumber(b));\n\t\t\tlet found = false;\n\t\t\tfor (const key of bks) {\n\t\t\t\tconst classesOrStyles = this._sizingSpec[key].split(/;+/).filter(c => c);\n\t\t\t\tthis._removeClassesOrStyles(classesOrStyles);\n\t\t\t\tconst expectedWidth = this._toNumber(key);\n\t\t\t\tif (this._width <= expectedWidth && !found) {\n\t\t\t\t\tthis._applyClassesOrStyles(classesOrStyles);\n\t\t\t\t\tfound = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (widthChanged || heightChanged) {\n\t\t\tthis._height = this._monitorTarget.clientHeight;\n\t\t\tif (this.buiFixedHeight) {\n\t\t\t\tthis._reflowFrameCount = 0;\n\t\t\t\tthis._reflowHeight();\n\t\t\t}\n\t\t\tsetTimeout(() => this._zone.run(() => this.buiResized.emit({ width: this._width, height: this._height })));\n\t\t}\n\t}\n\n\tprivate _applyClassesOrStyles(clsOrStyles: string[]) {\n\t\tclsOrStyles.forEach(s => {\n\t\t\tif (s.includes(':')) {\n\t\t\t\tconst [prop, val] = s.split(':');\n\t\t\t\tthis._element.style.setProperty(prop.trim(), val.trim());\n\t\t\t} else {\n\t\t\t\tconst classes = s.split(/\\s+/).filter(c => c);\n\t\t\t\tif (classes.length) {\n\t\t\t\t\tthis._element.classList.add(...classes);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate _removeClassesOrStyles(clsOrStyles: string[]) {\n\t\tclsOrStyles.forEach(s => {\n\t\t\tif (s.includes(':')) {\n\t\t\t\tconst [prop] = s.split(':');\n\t\t\t\tthis._element.style.removeProperty(prop);\n\t\t\t} else {\n\t\t\t\tconst classes = s.split(/\\s+/).filter(c => c);\n\t\t\t\tif (classes.length) {\n\t\t\t\t\tthis._element.classList.remove(...classes);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate _reflowHeight() {\n\t\tconst cnt = this._reflowFrameCount;\n\t\tif (cnt < 15) {\n\t\t\tcancelAnimationFrame(this._frameHandlerId);\n\t\t\tthis._frameHandlerId = requestAnimationFrame(this._reflowHeight.bind(this));\n\n\t\t\tif (cnt === 0) {\n\t\t\t\tthis._element.style.height = '0';\n\t\t\t} else if (cnt === 14) {\n\t\t\t\tconst gt = parseInt(\n\t\t\t\t\tgetComputedStyle(this._monitorTarget).getPropertyValue('padding-top').replace(/px$/, '') || '0',\n\t\t\t\t\t10\n\t\t\t\t);\n\t\t\t\tconst gb = parseInt(\n\t\t\t\t\tgetComputedStyle(this._monitorTarget).getPropertyValue('padding-bottom').replace(/px$/, '') || '0',\n\t\t\t\t\t10\n\t\t\t\t);\n\t\t\t\tthis._element.style.height = `${this._height - gt - gb - 5}px`;\n\t\t\t}\n\t\t}\n\t\tthis._reflowFrameCount++;\n\t}\n\n\tprivate _toNumber(s: string) {\n\t\treturn (s === '~' ? Infinity : Number(s)) || -Infinity;\n\t}\n}\n","import { DOCUMENT } from '@angular/common';\nimport {\n\tAfterViewInit,\n\tComponentFactory,\n\tComponentFactoryResolver,\n\tComponentRef,\n\tDirective,\n\tDoCheck,\n\tElementRef,\n\tInject,\n\tInput,\n\tOptional,\n\tViewContainerRef,\n\tɵmarkDirty as markDirty\n} from '@angular/core';\nimport { MatButton } from '@angular/material/button';\nimport { MatProgressSpinner, ProgressSpinnerMode } from '@angular/material/progress-spinner';\nimport { Subscription } from 'rxjs';\n\n/**\n * Use this directive on a `MatButton` element to provide an alternative view when an sync operation is in progress.\n *\n * For example:\n *\n * ```\n * <button (click)=\"submit();\" [buiAwait]=\"submitSubscription\" buiAwaitAriaLabel=\"submitting\">Submit</button>\n * ```\n *\n * Please refer to [Material Design](https://material.io/components/progress-indicators#circular-progress-indicators)\n * for more details of integrating circular spinner component with action buttons.\n *\n * The operation is considered 'in progress' when the bound property `buiAwait` evaluates to\n *\n * - `true`; or\n * - an instance of `rxjs/Subscription` and `buiAwait.closed` is falsy\n *\n * When in progress\n *\n * - the button's caption will be hidden;\n * - a `<mat-progress-spinner>` will be displayed in place of the caption;\n * - the button will be disabled by setting the property `disabled` of the `MatButton` instance.\n */\n@Directive({\n\tselector: '[buiAwait]'\n})\nexport class AwaitDirective implements AfterViewInit, DoCheck {\n\t/**\n\t * Indicates the `in progress` status of an async operation.\n\t *\n\t * The operation is considered 'in progress' when the property evaluates to\n\t *\n\t * - `true`; or\n\t * - a `number` within 0 - 100; or\n\t * - an instance of `rxjs/Subscription` and `buiAwait.closed` is falsy\n\t *\n\t * When it is a number, it represets the progress in percentage term.\n\t */\n\t@Input()\n\tbuiAwait: null | undefined | boolean | Subscription | number;\n\n\t/** The ARIA label to be put on the spinner. The default value is `\"In progress\"`. */\n\t@Input()\n\tbuiAwaitAriaLabel = 'In progress';\n\n\t/** The diameter of the in-progress spinner. The default value is `20`. */\n\t@Input()\n\tbuiAwaitDiameter = 20;\n\n\tprivate _overlayEl: HTMLDivElement | undefined;\n\tprivate _processing = false;\n\tprivate _factory: ComponentFactory<MatProgressSpinner> | undefined;\n\tprivate _spinnerRef: ComponentRef<MatProgressSpinner> | undefined;\n\tprivate _captionWrapper: HTMLElement | undefined;\n\n\tconstructor(\n\t\tprivate readonly _eRef: ElementRef<HTMLElement>,\n\t\t@Optional() private readonly button: MatButton,\n\t\t@Inject(DOCUMENT) private readonly doc: Document,\n\t\tfactoryResolver: ComponentFactoryResolver,\n\t\tprivate _viewCont: ViewContainerRef\n\t) {\n\t\tif (!button) {\n\t\t\tconsole.error('[buiAwait] can only be used on a MatButton');\n\t\t\treturn;\n\t\t}\n\t\tthis._factory = factoryResolver.resolveComponentFactory(MatProgressSpinner);\n\t}\n\n\t/** @ignore */\n\tngAfterViewInit(): void {\n\t\tif (this.button) {\n\t\t\tthis._overlayEl = this.doc.createElement('div');\n\t\t\tthis._eRef.nativeElement.appendChild(this._overlayEl);\n\t\t\tthis._overlayEl.classList.add('bui-await-overlay');\n\t\t\tthis._overlayEl.style.cssText =\n\t\t\t\t'display:flex; position:absolute; top:0; right:0; bottom:0; left:0; align-items: center; justify-content: center';\n\t\t\tthis._captionWrapper = this._eRef.nativeElement.querySelector('.mat-button-wrapper') as HTMLElement;\n\t\t}\n\t}\n\n\t/** @ignore */\n\tngDoCheck(): void {\n\t\tconst inProgress =\n\t\t\tthis.buiAwait === true || (typeof this.buiAwait === 'object' && !this.buiAwait!.closed) || this._isDeterminate;\n\t\tif (inProgress !== this._processing) {\n\t\t\tthis._processing = inProgress;\n\t\t\tthis._statusChanged(this._isDeterminate ? 'determinate' : 'indeterminate');\n\t\t}\n\n\t\tif (this._isDeterminate && this._spinnerRef && this._spinnerRef.instance.value !== this.buiAwait) {\n\t\t\tthis._spinnerRef.instance.value = this.buiAwait as number;\n\t\t\tmarkDirty(this._spinnerRef.instance);\n\t\t}\n\t}\n\n\t/** @ignore */\n\tprivate get _isDeterminate(): boolean {\n\t\treturn typeof this.buiAwait === 'number' && this.buiAwait >= 0 && this.buiAwait < 100;\n\t}\n\n\tprivate _statusChanged(mode: ProgressSpinnerMode) {\n\t\tif (this.button) {\n\t\t\tthis.button.disabled = this._processing;\n\n\t\t\tif (this._processing) {\n\t\t\t\tthis._spinnerRef = this._viewCont.createComponent(this._factory!);\n\t\t\t\tconst c = this._spinnerRef.instance;\n\t\t\t\tc.diameter = this.buiAwaitDiameter;\n\t\t\t\tc.mode = mode;\n\t\t\t\tc.color = this.button.color;\n\t\t\t\tconst e: HTMLElement = this._spinnerRef.location.nativeElement;\n\t\t\t\te.setAttribute('aria-label', this.buiAwaitAriaLabel);\n\t\t\t\tthis._overlayEl!.appendChild(e);\n\t\t\t\tthis._captionWrapper!.style.visibility = 'hidden';\n\t\t\t} else {\n\t\t\t\tthis._captionWrapper!.style.visibility = '';\n\t\t\t\tthis._spinnerRef!.destroy();\n\t\t\t\tthis._spinnerRef = undefined;\n\t\t\t\tthis._overlayEl!.innerHTML = '';\n\t\t\t}\n\t\t}\n\t}\n}\n","import { ContentObserver } from '@angular/cdk/observers';\nimport { Directive, ElementRef, Input, OnDestroy, OnInit } from '@angular/core';\nimport { Subscription } from 'rxjs';\n\n/**\n * Use `[bui-class.not-empty]` to specify a style class activated only when the host element has DOM children;\n *\n * use `[bui-class.empty]` for a style class activated when it has no DOM children.\n *\n * Use `[bui-class.no-text]` to specify a style class activated only when the host element has text content;\n *\n * use `[bui-class.has-text]` for a style class activated when it has no text content.\n */\n@Directive({\n\tselector: '[bui-class.empty],[bui-class.not-empty],[bui-class.no-text],[bui-class.has-text]'\n})\nexport class ObserveContentClassDirective implements OnDestroy, OnInit {\n\tprivate readonly subscription: Subscription;\n\tprivate readonly element: HTMLElement;\n\tprivate classToRemove: string[] = [];\n\n\t@Input('bui-class.empty')\n\tprivate classEmpty?: string;\n\n\t@Input('bui-class.not-empty')\n\tprivate classNotEmpty?: string;\n\n\t@Input('bui-class.no-text')\n\tprivate classNoText?: string;\n\n\t@Input('bui-class.has-text')\n\tprivate classHasText?: string;\n\n\tconstructor(observer: ContentObserver, elementRef: ElementRef<HTMLElement>) {\n\t\tthis.element = elementRef.nativeElement;\n\t\tthis.subscription = observer.observe(elementRef).subscribe(() => this.checkClass());\n\t}\n\n\tngOnInit(): void {\n\t\tthis.checkClass.bind(this);\n\t}\n\n\tngOnDestroy(): void {\n\t\tthis.subscription.unsubscribe();\n\t}\n\n\tprivate checkClass(): void {\n\t\tthis.element.classList.remove(...this.classToRemove);\n\t\tthis.classToRemove = [];\n\t\tthis.checkClassWith(\n\t\t\tthis.classEmpty,\n\t\t\tthis.classNotEmpty,\n\t\t\t() => this.element.childElementCount === 0 && !this.element.textContent?.trim()\n\t\t);\n\t\tthis.checkClassWith(this.classNoText, this.classHasText, () => !this.element.textContent?.trim());\n\t}\n\n\tprivate checkClassWith(\n\t\twithoutClass: string | null | undefined,\n\t\twithClass: string | null | undefined,\n\t\tisWithout: () => boolean\n\t): void {\n\t\tconst without = isWithout();\n\t\tthis.addClass(without ? withoutClass : (withClass as any));\n\t}\n\n\tprivate addClass(cls: string | null) {\n\t\tif (cls?.trim()) {\n\t\t\tconst classes = cls.trim().split(/\\s+/);\n\t\t\tthis.element.classList.add(...classes);\n\t\t\tthis.classToRemove.push(...classes);\n\t\t}\n\t}\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { SizingDirective } from './sizing.directive';\nimport { SizingMonitorDirective } from './sizing-monitor.directive';\nimport { AwaitDirective } from './await.directive';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatProgressSpinnerModule } from '@angular/material/progress-spinner';\nimport { ObserveContentClassDirective } from './observe-content-class.directive';\nimport { ObserversModule } from '@angular/cdk/observers';\n\n/**\n * For functionality that cannot be easily achieved via CSS.\n */\n@NgModule({\n\tdeclarations: [SizingDirective, SizingMonitorDirective, AwaitDirective, ObserveContentClassDirective],\n\timports: [CommonModule, MatButtonModule, MatProgressSpinnerModule, ObserversModule],\n\texports: [\n\t\tSizingDirective,\n\t\tSizingMonitorDirective,\n\t\tAwaitDirective,\n\t\tMatProgressSpinnerModule,\n\t\tObserveContentClassDirective\n\t]\n})\nexport class BehaviorModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["markDirty"],"mappings":";;;;;;;;;;;AAEA;;;;;;;;;;;;;;;MAkBa,sBAAsB;IAClC,YAA4B,OAAgC;QAAhC,YAAO,GAAP,OAAO,CAAyB;KAAI;;oHADpD,sBAAsB;wGAAtB,sBAAsB;4FAAtB,sBAAsB;kBAHlC,SAAS;mBAAC;oBACV,QAAQ,EAAE,oBAAoB;iBAC9B;;;ACDD;;;;;;;;;;;;;;;;;;;;;MAwBa,eAAe;IAmE3B,YAC2B,IAAc,EACpB,cAAsC,EAC1D,OAAgC,EACxB,KAAa;QAHK,SAAI,GAAJ,IAAI,CAAU;QACpB,mBAAc,GAAd,cAAc,CAAwB;QAElD,UAAK,GAAL,KAAK,CAAQ;;;;;;;;;;QAvDtB,cAAS,GAAuD,EAAE,CAAC;;;;;;;QASnE,aAAQ,GAAoC,MAAM,CAAC;;;;;;QAyBnD,eAAU,GAAG,IAAI,YAAY,EAAqC,CAAC;;;;QAMnE,mBAAc,GAAG,KAAK,CAAC;QAIf,gBAAW,GAA8B,EAAE,CAAC;QAC5C,WAAM,GAAG,CAAC,CAAC;QACX,YAAO,GAAG,CAAC,CAAC;QACZ,sBAAiB,GAAG,CAAC,CAAC;QAEtB,oBAAe,GAAG,CAAC,CAAC;QAQ3B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,aAAa,CAAC;QACtC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,QAAQ,CAAC;KACpC;;;;;;;;;;I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6 @@ class CurrencyInputDirective {
213
213
  return this._decimalPipe.transform(n, '1.0-0');
214
214
  }
215
215
  _convert(input) {
216
- if (!input) {
217
- return NaN;
218
- }
219
216
  const val = input
220
217
  .replace(this._ds, 'd')
221
218
  .replace(/[^0-9d-]/g, '')
@@ -1 +1 @@
1
- {"version":3,"file":"bravura-ui-currency-input.js","sources":["../../../projects/ui/currency-input/currency-input.directive.ts","../../../projects/ui/currency-input/currency-input.module.ts","../../../projects/ui/currency-input/bravura-ui-currency-input.ts"],"sourcesContent":["import { DecimalPipe, getCurrencySymbol } from '@angular/common';\nimport {\n\tDEFAULT_CURRENCY_CODE,\n\tDirective,\n\tElementRef,\n\tforwardRef,\n\tHostBinding,\n\tHostListener,\n\tInject,\n\tInput,\n\tLOCALE_ID,\n\tOnChanges,\n\tOnInit,\n\tOptional,\n\tRenderer2,\n\tSelf,\n\tɵfindLocaleData\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { MatFormField, MAT_FORM_FIELD } from '@angular/material/form-field';\nimport { MatInput } from '@angular/material/input';\nimport { noop } from 'rxjs';\n\n/* tslint:disable:no-empty */\nexport const noop_consumer = (_: any) => {};\n\n/**\n * This directive will enhance an input element to format the numbers entered to a currency amount.\n */\n@Directive({\n\tselector: 'input[buiCurrencyInput],input[currencyCode],input[data-type=currency]',\n\tproviders: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => CurrencyInputDirective), multi: true }]\n})\nexport class CurrencyInputDirective implements OnInit, OnChanges, ControlValueAccessor {\n\t/**\n\t * true to allow negative input, otherwise false\n\t * Default to false.\n\t */\n\t@Input()\n\tallowNegative: boolean = false;\n\n\t/**\n\t * Provide the currency code to format the entered amount.\n\t * Uses angular token DEFAULT_CURRENCY_CODE by default.\n\t */\n\t@Input()\n\tcurrencyCode: string = '';\n\n\t/**\n\t * true if no decimal digits allowed, otherwise false.\n\t * Default to false.\n\t */\n\t@Input()\n\tbaseUnitOnly = false;\n\n\t/**\n\t * The format the of the amount either in wide or narrow.\n\t */\n\t@Input()\n\tformat: 'narrow' | 'wide' = 'wide';\n\n\t@HostBinding('placeholder')\n\tprivate placeholder: string = '';\n\n\t@HostBinding('autocomplete')\n\tprivate autocomplete = 'off';\n\n\t@HostBinding('type')\n\tprivate type = 'text';\n\n\t@HostBinding('attr.inputmode')\n\tprivate inputMode = 'decimal';\n\n\tprivate change = noop_consumer;\n\tprivate onTouch = noop;\n\tprivate _safari: boolean;\n\tprivate _symbol: string = '$';\n\tprivate _decimalPipe!: DecimalPipe;\n\n\tprivate _ds = '.'; // decimal separator\n\tprivate _trailing = false;\n\n\tconstructor(\n\t\t@Self() private _el: ElementRef<HTMLInputElement>,\n\t\tprivate _renderer: Renderer2,\n\t\t@Inject(LOCALE_ID) private _locale: string,\n\t\t@Inject(DEFAULT_CURRENCY_CODE) private _defaultCurrencyCode: string,\n\t\t@Optional() @Inject(MAT_FORM_FIELD) private _field?: MatFormField\n\t) {\n\t\tconst userAgent = navigator.userAgent;\n\t\tthis._safari = !userAgent.match(/Firefox/i) && !userAgent.match(/Chrome/i) && !!userAgent.match(/safari/i);\n\t\tthis._currencyUpdated();\n\t}\n\n\tngOnInit() {}\n\n\tngOnChanges(): void {\n\t\tthis._currencyUpdated();\n\t\tthis.onInput();\n\t}\n\n\t@HostListener('input')\n\tonInput() {\n\t\tthis._formatCurrency(this._el, false, true);\n\t}\n\n\t@HostListener('focus')\n\tonFocus() {\n\t\tthis._formatCurrency(this._el, false, true);\n\t}\n\n\t@HostListener('blur')\n\tonblur() {\n\t\tthis.onTouch();\n\t\tthis._formatCurrency(this._el, true, false);\n\t}\n\n\twriteValue(value: any) {\n\t\tvalue = this._decimalPipe.transform(value);\n\t\tthis._renderer.setProperty(this._el.nativeElement, 'value', value);\n\t\tthis._formatCurrency(this._el, true, false);\n\t}\n\n\tregisterOnChange(fn: any) {\n\t\tthis.change = fn;\n\t}\n\n\tregisterOnTouched(fn: any) {\n\t\tthis.onTouch = fn;\n\t}\n\n\tprivate _updatePlaceholder() {\n\t\tthis.placeholder = this.placeholder || this._0Text;\n\t\tif (this._field?._control instanceof MatInput) {\n\t\t\tthis._field._control.placeholder = this.placeholder;\n\t\t}\n\t}\n\n\tprivate _currencyUpdated() {\n\t\tthis.currencyCode = this.currencyCode || this._defaultCurrencyCode;\n\t\tthis._symbol = getCurrencySymbol(this.currencyCode, this.format, this._locale) || '$';\n\t\tconst localeData = ɵfindLocaleData(this._locale);\n\t\tthis._ds = localeData[13][0];\n\t\tthis._decimalPipe = new DecimalPipe(this._locale);\n\t\tconst curFormat: string = localeData[14][2];\n\t\tthis._trailing = curFormat.indexOf('¤') > 0;\n\t\tthis._updatePlaceholder();\n\t}\n\n\tprivate _formatCurrency(input: ElementRef<HTMLInputElement>, blur: boolean, focus: boolean) {\n\t\t// appends $ to value, validates decimal side\n\t\t// and puts cursor back in right position.\n\t\t// get input value\n\t\tlet input_val = input.nativeElement.value;\n\n\t\t// don't validate empty input\n\t\tif (input_val === '') {\n\t\t\tthis.change(null);\n\t\t\treturn;\n\t\t}\n\n\t\tconst minus = this.allowNegative ? '-' : '';\n\n\t\t// remove non digit values except currency symbol, decimal separator and hypen\n\t\tconst reg = new RegExp(`[^0-9${minus}${this._symbol}${this._ds}]`, 'g');\n\n\t\tlet sanitiseValue = input_val.replace(reg, '');\n\n\t\tif (sanitiseValue === '' || sanitiseValue === this._symbol) {\n\t\t\tthis.change(null);\n\t\t\tthis._renderer.setProperty(input.nativeElement, 'value', '');\n\t\t\treturn;\n\t\t} else if (\n\t\t\t(this.allowNegative && sanitiseValue === `-${this._symbol}`) ||\n\t\t\tsanitiseValue === '-' ||\n\t\t\tsanitiseValue === '--'\n\t\t) {\n\t\t\tthis.change(null);\n\t\t\tthis._renderer.setProperty(input.nativeElement, 'value', '-');\n\t\t\treturn;\n\t\t}\n\n\t\tconst negative = this.allowNegative && input_val.indexOf('-') >= 0;\n\n\t\t// original length\n\t\tconst original_len = input_val.length;\n\n\t\t// initial caret position\n\t\tlet caret_pos = input.nativeElement.selectionStart;\n\n\t\tinput_val = input_val.replace(RegExp(`[^0-9${minus}${this._ds}]`, 'g'), '').replace(/^\\.\\./, '');\n\t\t// check for decimal\n\t\tif (input_val.indexOf(this._ds) >= 0) {\n\t\t\t// get position of first decimal\n\t\t\t// this prevents multiple decimals from\n\t\t\t// being entered\n\t\t\tlet decimal_pos = input_val.indexOf(this._ds);\n\n\t\t\t// split number by decimal point\n\t\t\tlet left_side = input_val.substring(0, decimal_pos);\n\t\t\tlet right_side = input_val.substring(decimal_pos);\n\n\t\t\t// add commas to left side of number\n\t\t\tleft_side = this._formatNumber(left_side, blur) || '';\n\n\t\t\t// no value append a zero for decimal values\n\t\t\tif (!left_side.length) {\n\t\t\t\tleft_side = '0';\n\t\t\t}\n\n\t\t\tif (!this.baseUnitOnly) {\n\t\t\t\t// validate right side\n\t\t\t\tright_side = right_side.replace(/\\D/g, '');\n\n\t\t\t\t// Limit decimal to only 2 digits\n\t\t\t\tlet v = Number(`0.${right_side}`);\n\t\t\t\tif (v) {\n\t\t\t\t\tconst length = right_side.length > 1 ? 2 : 1;\n\t\t\t\t\tright_side = v.toFixed(length).substring(2, 4);\n\t\t\t\t}\n\n\t\t\t\t// On blur make sure 2 numbers after decimal\n\t\t\t\tif (blur) {\n\t\t\t\t\tright_side += '00';\n\t\t\t\t}\n\n\t\t\t\tright_side = right_side.substring(0, 2);\n\n\t\t\t\t// join number by .\n\t\t\t\tinput_val = left_side + this._ds + right_side;\n\t\t\t} else {\n\t\t\t\tinput_val = left_side;\n\t\t\t}\n\t\t} else {\n\t\t\tinput_val = this._formatNumber(input_val, blur);\n\n\t\t\t// final formatting\n\t\t\tif (blur && !this.baseUnitOnly) {\n\t\t\t\tinput_val += `${this._ds}00`;\n\t\t\t}\n\t\t}\n\n\t\tconst numStr = input_val;\n\t\t// append the currency symbol\n\t\tif (!this._safari || !focus) {\n\t\t\tif (this._trailing) {\n\t\t\t\tinput_val = input_val + ' ' + this._symbol;\n\t\t\t} else {\n\t\t\t\tinput_val = this._symbol + input_val;\n\t\t\t}\n\t\t}\n\n\t\tif (negative) {\n\t\t\t// append the hypen back to the value if a negative value was entered\n\t\t\tinput_val = `-${input_val}`;\n\t\t}\n\n\t\tconst num = this._convert((negative ? '-' : '') + numStr);\n\n\t\t// update control value first with the number\n\t\tthis.change(Number(num));\n\n\t\tif (blur && num === 0) {\n\t\t\tinput_val = this._0Text;\n\t\t}\n\n\t\t// update dom with the formatted value\n\t\tthis._renderer.setProperty(input.nativeElement, 'value', input_val);\n\t\t// put caret back in the right position\n\t\tlet updated_len = input_val.length;\n\t\tif (caret_pos) {\n\t\t\tcaret_pos = updated_len - original_len + caret_pos;\n\t\t\tif (input_val.substring(caret_pos - this._symbol.length) === this._symbol && this._trailing) {\n\t\t\t\tcaret_pos -= this._symbol.length + 1;\n\t\t\t}\n\t\t}\n\t\tif (!this._safari) {\n\t\t\tinput.nativeElement.setSelectionRange(caret_pos, caret_pos);\n\t\t}\n\t}\n\n\t// format the number into currency format\n\tprivate _formatNumber(n: string, blur: boolean = false) {\n\t\t// format number 1000000 to 1,234,567\n\t\tn = n.replace(/\\D/g, '');\n\t\tif (blur) {\n\t\t\tn = n.replace(/^0+/, '');\n\t\t}\n\t\treturn this._decimalPipe.transform(n, '1.0-0') as string;\n\t}\n\n\tprivate _convert(input: string): number {\n\t\tif (!input) {\n\t\t\treturn NaN;\n\t\t}\n\t\tconst val = input\n\t\t\t.replace(this._ds, 'd')\n\t\t\t.replace(/[^0-9d-]/g, '')\n\t\t\t.replace('d', '.');\n\t\treturn parseFloat(val);\n\t}\n\n\tprivate get _0Text(): string {\n\t\tconst decimalStr = this.baseUnitOnly ? '' : `${this._ds}00`;\n\t\treturn this._trailing ? `0${decimalStr} ${this._symbol}` : `${this._symbol}0${decimalStr}`;\n\t}\n}\n","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { CurrencyInputDirective } from './currency-input.directive';\n\n@NgModule({\n\tdeclarations: [CurrencyInputDirective],\n\timports: [CommonModule],\n\texports: [CurrencyInputDirective]\n})\nexport class CurrencyInputModule {}\n\nexport { CurrencyInputDirective };\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;AAuBA;AACO,MAAM,aAAa,GAAG,CAAC,CAAM,QAAO,CAAC;AAE5C;;;MAOa,sBAAsB;IAiDlC,YACiB,GAAiC,EACzC,SAAoB,EACD,OAAe,EACH,oBAA4B,EACvB,MAAqB;QAJjD,QAAG,GAAH,GAAG,CAA8B;QACzC,cAAS,GAAT,SAAS,CAAW;QACD,YAAO,GAAP,OAAO,CAAQ;QACH,yBAAoB,GAApB,oBAAoB,CAAQ;QACvB,WAAM,GAAN,MAAM,CAAe;;;;;QAhDlE,kBAAa,GAAY,KAAK,CAAC;;;;;QAO/B,iBAAY,GAAW,EAAE,CAAC;;;;;QAO1B,iBAAY,GAAG,KAAK,CAAC;;;;QAMrB,WAAM,GAAsB,MAAM,CAAC;QAG3B,gBAAW,GAAW,EAAE,CAAC;QAGzB,iBAAY,GAAG,KAAK,CAAC;QAGrB,SAAI,GAAG,MAAM,CAAC;QAGd,cAAS,GAAG,SAAS,CAAC;QAEtB,WAAM,GAAG,aAAa,CAAC;QACvB,YAAO,GAAG,IAAI,CAAC;QAEf,YAAO,GAAW,GAAG,CAAC;QAGtB,QAAG,GAAG,GAAG,CAAC;QACV,cAAS,GAAG,KAAK,CAAC;QASzB,MAAM,SAAS,GAAG,SAAS,CAAC,SAAS,CAAC;QACtC,IAAI,CAAC,OAAO,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QAC3G,IAAI,CAAC,gBAAgB,EAAE,CAAC;KACxB;IAED,QAAQ,MAAK;IAEb,WAAW;QACV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S;sBADhB,WAAW;uBAAC,gBAAgB;gBAgC7B,OAAO;sBADN,YAAY;uBAAC,OAAO;gBAMrB,OAAO;sBADN,YAAY;uBAAC,OAAO;gBAMrB,MAAM;sBADL,YAAY;uBAAC,MAAM;;;MCtGR,mBAAmB;;iHAAnB,mBAAmB;kHAAnB,mBAAmB,iBAJhB,sBAAsB,aAC3B,YAAY,aACZ,sBAAsB;kHAEpB,mBAAmB,YAHtB,CAAC,YAAY,CAAC;4FAGX,mBAAmB;kBAL/B,QAAQ;mBAAC;oBACT,YAAY,EAAE,CAAC,sBAAsB,CAAC;oBACtC,OAAO,EAAE,CAAC,YAAY,CAAC;oBACvB,OAAO,EAAE,CAAC,sBAAsB,CAAC;iBACjC;;;ACRD;;;;;;"}
1
+ {"version":3,"file":"bravura-ui-currency-input.js","sources":["../../../projects/ui/currency-input/currency-input.directive.ts","../../../projects/ui/currency-input/currency-input.module.ts","../../../projects/ui/currency-input/bravura-ui-currency-input.ts"],"sourcesContent":["import { DecimalPipe, getCurrencySymbol } from '@angular/common';\nimport {\n\tDEFAULT_CURRENCY_CODE,\n\tDirective,\n\tElementRef,\n\tforwardRef,\n\tHostBinding,\n\tHostListener,\n\tInject,\n\tInput,\n\tLOCALE_ID,\n\tOnChanges,\n\tOnInit,\n\tOptional,\n\tRenderer2,\n\tSelf,\n\tɵfindLocaleData\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { MatFormField, MAT_FORM_FIELD } from '@angular/material/form-field';\nimport { MatInput } from '@angular/material/input';\nimport { noop } from 'rxjs';\n\n/* tslint:disable:no-empty */\nexport const noop_consumer = (_: any) => {};\n\n/**\n * This directive will enhance an input element to format the numbers entered to a currency amount.\n */\n@Directive({\n\tselector: 'input[buiCurrencyInput],input[currencyCode],input[data-type=currency]',\n\tproviders: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => CurrencyInputDirective), multi: true }]\n})\nexport class CurrencyInputDirective implements OnInit, OnChanges, ControlValueAccessor {\n\t/**\n\t * true to allow negative input, otherwise false\n\t * Default to false.\n\t */\n\t@Input()\n\tallowNegative: boolean = false;\n\n\t/**\n\t * Provide the currency code to format the entered amount.\n\t * Uses angular token DEFAULT_CURRENCY_CODE by default.\n\t */\n\t@Input()\n\tcurrencyCode: string = '';\n\n\t/**\n\t * true if no decimal digits allowed, otherwise false.\n\t * Default to false.\n\t */\n\t@Input()\n\tbaseUnitOnly = false;\n\n\t/**\n\t * The format the of the amount either in wide or narrow.\n\t */\n\t@Input()\n\tformat: 'narrow' | 'wide' = 'wide';\n\n\t@HostBinding('placeholder')\n\tprivate placeholder: string = '';\n\n\t@HostBinding('autocomplete')\n\tprivate autocomplete = 'off';\n\n\t@HostBinding('type')\n\tprivate type = 'text';\n\n\t@HostBinding('attr.inputmode')\n\tprivate inputMode = 'decimal';\n\n\tprivate change = noop_consumer;\n\tprivate onTouch = noop;\n\tprivate _safari: boolean;\n\tprivate _symbol: string = '$';\n\tprivate _decimalPipe!: DecimalPipe;\n\n\tprivate _ds = '.'; // decimal separator\n\tprivate _trailing = false;\n\n\tconstructor(\n\t\t@Self() private _el: ElementRef<HTMLInputElement>,\n\t\tprivate _renderer: Renderer2,\n\t\t@Inject(LOCALE_ID) private _locale: string,\n\t\t@Inject(DEFAULT_CURRENCY_CODE) private _defaultCurrencyCode: string,\n\t\t@Optional() @Inject(MAT_FORM_FIELD) private _field?: MatFormField\n\t) {\n\t\tconst userAgent = navigator.userAgent;\n\t\tthis._safari = !userAgent.match(/Firefox/i) && !userAgent.match(/Chrome/i) && !!userAgent.match(/safari/i);\n\t\tthis._currencyUpdated();\n\t}\n\n\tngOnInit() {}\n\n\tngOnChanges(): void {\n\t\tthis._currencyUpdated();\n\t\tthis.onInput();\n\t}\n\n\t@HostListener('input')\n\tonInput() {\n\t\tthis._formatCurrency(this._el, false, true);\n\t}\n\n\t@HostListener('focus')\n\tonFocus() {\n\t\tthis._formatCurrency(this._el, false, true);\n\t}\n\n\t@HostListener('blur')\n\tonblur() {\n\t\tthis.onTouch();\n\t\tthis._formatCurrency(this._el, true, false);\n\t}\n\n\twriteValue(value: any) {\n\t\tvalue = this._decimalPipe.transform(value);\n\t\tthis._renderer.setProperty(this._el.nativeElement, 'value', value);\n\t\tthis._formatCurrency(this._el, true, false);\n\t}\n\n\tregisterOnChange(fn: any) {\n\t\tthis.change = fn;\n\t}\n\n\tregisterOnTouched(fn: any) {\n\t\tthis.onTouch = fn;\n\t}\n\n\tprivate _updatePlaceholder() {\n\t\tthis.placeholder = this.placeholder || this._0Text;\n\t\tif (this._field?._control instanceof MatInput) {\n\t\t\tthis._field._control.placeholder = this.placeholder;\n\t\t}\n\t}\n\n\tprivate _currencyUpdated() {\n\t\tthis.currencyCode = this.currencyCode || this._defaultCurrencyCode;\n\t\tthis._symbol = getCurrencySymbol(this.currencyCode, this.format, this._locale) || '$';\n\t\tconst localeData = ɵfindLocaleData(this._locale);\n\t\tthis._ds = localeData[13][0];\n\t\tthis._decimalPipe = new DecimalPipe(this._locale);\n\t\tconst curFormat: string = localeData[14][2];\n\t\tthis._trailing = curFormat.indexOf('¤') > 0;\n\t\tthis._updatePlaceholder();\n\t}\n\n\tprivate _formatCurrency(input: ElementRef<HTMLInputElement>, blur: boolean, focus: boolean) {\n\t\t// appends $ to value, validates decimal side\n\t\t// and puts cursor back in right position.\n\t\t// get input value\n\t\tlet input_val = input.nativeElement.value;\n\n\t\t// don't validate empty input\n\t\tif (input_val === '') {\n\t\t\tthis.change(null);\n\t\t\treturn;\n\t\t}\n\n\t\tconst minus = this.allowNegative ? '-' : '';\n\n\t\t// remove non digit values except currency symbol, decimal separator and hypen\n\t\tconst reg = new RegExp(`[^0-9${minus}${this._symbol}${this._ds}]`, 'g');\n\n\t\tlet sanitiseValue = input_val.replace(reg, '');\n\n\t\tif (sanitiseValue === '' || sanitiseValue === this._symbol) {\n\t\t\tthis.change(null);\n\t\t\tthis._renderer.setProperty(input.nativeElement, 'value', '');\n\t\t\treturn;\n\t\t} else if (\n\t\t\t(this.allowNegative && sanitiseValue === `-${this._symbol}`) ||\n\t\t\tsanitiseValue === '-' ||\n\t\t\tsanitiseValue === '--'\n\t\t) {\n\t\t\tthis.change(null);\n\t\t\tthis._renderer.setProperty(input.nativeElement, 'value', '-');\n\t\t\treturn;\n\t\t}\n\n\t\tconst negative = this.allowNegative && input_val.indexOf('-') >= 0;\n\n\t\t// original length\n\t\tconst original_len = input_val.length;\n\n\t\t// initial caret position\n\t\tlet caret_pos = input.nativeElement.selectionStart;\n\n\t\tinput_val = input_val.replace(RegExp(`[^0-9${minus}${this._ds}]`, 'g'), '').replace(/^\\.\\./, '');\n\t\t// check for decimal\n\t\tif (input_val.indexOf(this._ds) >= 0) {\n\t\t\t// get position of first decimal\n\t\t\t// this prevents multiple decimals from\n\t\t\t// being entered\n\t\t\tlet decimal_pos = input_val.indexOf(this._ds);\n\n\t\t\t// split number by decimal point\n\t\t\tlet left_side = input_val.substring(0, decimal_pos);\n\t\t\tlet right_side = input_val.substring(decimal_pos);\n\n\t\t\t// add commas to left side of number\n\t\t\tleft_side = this._formatNumber(left_side, blur) || '';\n\n\t\t\t// no value append a zero for decimal values\n\t\t\tif (!left_side.length) {\n\t\t\t\tleft_side = '0';\n\t\t\t}\n\n\t\t\tif (!this.baseUnitOnly) {\n\t\t\t\t// validate right side\n\t\t\t\tright_side = right_side.replace(/\\D/g, '');\n\n\t\t\t\t// Limit decimal to only 2 digits\n\t\t\t\tlet v = Number(`0.${right_side}`);\n\t\t\t\tif (v) {\n\t\t\t\t\tconst length = right_side.length > 1 ? 2 : 1;\n\t\t\t\t\tright_side = v.toFixed(length).substring(2, 4);\n\t\t\t\t}\n\n\t\t\t\t// On blur make sure 2 numbers after decimal\n\t\t\t\tif (blur) {\n\t\t\t\t\tright_side += '00';\n\t\t\t\t}\n\n\t\t\t\tright_side = right_side.substring(0, 2);\n\n\t\t\t\t// join number by .\n\t\t\t\tinput_val = left_side + this._ds + right_side;\n\t\t\t} else {\n\t\t\t\tinput_val = left_side;\n\t\t\t}\n\t\t} else {\n\t\t\tinput_val = this._formatNumber(input_val, blur);\n\n\t\t\t// final formatting\n\t\t\tif (blur && !this.baseUnitOnly) {\n\t\t\t\tinput_val += `${this._ds}00`;\n\t\t\t}\n\t\t}\n\n\t\tconst numStr = input_val;\n\t\t// append the currency symbol\n\t\tif (!this._safari || !focus) {\n\t\t\tif (this._trailing) {\n\t\t\t\tinput_val = input_val + ' ' + this._symbol;\n\t\t\t} else {\n\t\t\t\tinput_val = this._symbol + input_val;\n\t\t\t}\n\t\t}\n\n\t\tif (negative) {\n\t\t\t// append the hypen back to the value if a negative value was entered\n\t\t\tinput_val = `-${input_val}`;\n\t\t}\n\n\t\tconst num = this._convert((negative ? '-' : '') + numStr);\n\n\t\t// update control value first with the number\n\t\tthis.change(Number(num));\n\n\t\tif (blur && num === 0) {\n\t\t\tinput_val = this._0Text;\n\t\t}\n\n\t\t// update dom with the formatted value\n\t\tthis._renderer.setProperty(input.nativeElement, 'value', input_val);\n\t\t// put caret back in the right position\n\t\tlet updated_len = input_val.length;\n\t\tif (caret_pos) {\n\t\t\tcaret_pos = updated_len - original_len + caret_pos;\n\t\t\tif (input_val.substring(caret_pos - this._symbol.length) === this._symbol && this._trailing) {\n\t\t\t\tcaret_pos -= this._symbol.length + 1;\n\t\t\t}\n\t\t}\n\t\tif (!this._safari) {\n\t\t\tinput.nativeElement.setSelectionRange(caret_pos, caret_pos);\n\t\t}\n\t}\n\n\t// format the number into currency format\n\tprivate _formatNumber(n: string, blur: boolean = false) {\n\t\t// format number 1000000 to 1,234,567\n\t\tn = n.replace(/\\D/g, '');\n\t\tif (blur) {\n\t\t\tn = n.replace(/^0+/, '');\n\t\t}\n\t\treturn this._decimalPipe.transform(n, '1.0-0') as string;\n\t}\n\n\tprivate _convert(input: string): number {\n\t\tconst val = input\n\t\t\t.replace(this._ds, 'd')\n\t\t\t.replace(/[^0-9d-]/g, '')\n\t\t\t.replace('d', '.');\n\t\treturn parseFloat(val);\n\t}\n\n\tprivate get _0Text(): string {\n\t\tconst decimalStr = this.baseUnitOnly ? '' : `${this._ds}00`;\n\t\treturn this._trailing ? `0${decimalStr} ${this._symbol}` : `${this._symbol}0${decimalStr}`;\n\t}\n}\n","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { CurrencyInputDirective } from './currency-input.directive';\n\n@NgModule({\n\tdeclarations: [CurrencyInputDirective],\n\timports: [CommonModule],\n\texports: [CurrencyInputDirective]\n})\nexport class CurrencyInputModule {}\n\nexport { CurrencyInputDirective };\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;AAuBA;AACO,MAAM,aAAa,GAAG,CAAC,CAAM,QAAO,CAAC;AAE5C;;;MAOa,sBAAsB;IAiDlC,YACiB,GAAiC,EACzC,SAAoB,EACD,OAAe,EACH,oBAA4B,EACvB,MAAqB;QAJjD,QAAG,GAAH,GAAG,CAA8B;QACzC,cAAS,GAAT,SAAS,CAAW;QACD,YAAO,GAAP,OAAO,CAAQ;QACH,yBAAoB,GAApB,oBAAoB,CAAQ;QACvB,WAAM,GAAN,MAAM,CAAe;;;;;QAhDlE,kBAAa,GAAY,KAAK,CAAC;;;;;QAO/B,iBAAY,GAAW,EAAE,CAAC;;;;;QAO1B,iBAAY,GAAG,KAAK,CAAC;;;;QAMrB,WAAM,GAAsB,MAAM,CAAC;QAG3B,gBAAW,GAAW,EAAE,CAAC;QAGzB,iBAAY,GAAG,KAAK,CAAC;QAGrB,SAAI,GAAG,MAAM,CAAC;QAGd,cAAS,GAAG,SAAS,CAAC;QAEtB,WAAM,GAAG,aAAa,CAAC;QACvB,YAAO,GAAG,IAAI,CAAC;QAEf,YAAO,GAAW,GAAG,CAAC;QAGtB,QAAG,GAAG,GAAG,CAAC;QACV,cAAS,GAAG,KAAK,CAAC;QASzB,MAAM,SAAS,GAAG,SAAS,CAAC,SAAS,CAAC;QACtC,IAAI,CA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ADX,KAAK;gBAQN,YAAY;sBADX,KAAK;gBAON,MAAM;sBADL,KAAK;gBAIE,WAAW;sBADlB,WAAW;uBAAC,aAAa;gBAIlB,YAAY;sBADnB,WAAW;uBAAC,cAAc;gBAInB,IAAI;sBADX,WAAW;uBAAC,MAAM;gBAIX,SAAS;sBADhB,WAAW;uBAAC,gBAAgB;gBAgC7B,OAAO;sBADN,YAAY;uBAAC,OAAO;gBAMrB,OAAO;sBADN,YAAY;uBAAC,OAAO;gBAMrB,MAAM;sBADL,YAAY;uBAAC,MAAM;;;MCtGR,mBAAmB;;iHAAnB,mBAAmB;kHAAnB,mBAAmB,iBAJhB,sBAAsB,aAC3B,YAAY,aACZ,sBAAsB;kHAEpB,mBAAmB,YAHtB,CAAC,YAAY,CAAC;4FAGX,mBAAmB;kBAL/B,QAAQ;mBAAC;oBACT,YAAY,EAAE,CAAC,sBAAsB,CAAC;oBACtC,OAAO,EAAE,CAAC,YAAY,CAAC;oBACvB,OAAO,EAAE,CAAC,sBAAsB,CAAC;iBACjC;;;ACRD;;;;;;"}
@@ -49,7 +49,6 @@ class DecimalInputDirective {
49
49
  evt.preventDefault();
50
50
  }
51
51
  }
52
- onFocus() { }
53
52
  onblur() {
54
53
  this.onTouch();
55
54
  this._resetDecimalPlaces();
@@ -82,7 +81,7 @@ class DecimalInputDirective {
82
81
  }
83
82
  }
84
83
  DecimalInputDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DecimalInputDirective, deps: [{ token: i0.ElementRef, self: true }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
85
- DecimalInputDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: DecimalInputDirective, selector: "input[buiDecimalInput]", inputs: { buiDecimalInput: "buiDecimalInput" }, host: { listeners: { "input": "onInput()", "keypress": "onKeypress($event)", "focus": "onFocus()", "blur": "onblur()" }, properties: { "placeholder": "this.placeholder", "autocomplete": "this.autocomplete", "type": "this.type", "attr.inputmode": "this.inputMode" } }, providers: [
84
+ DecimalInputDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: DecimalInputDirective, selector: "input[buiDecimalInput]", inputs: { buiDecimalInput: "buiDecimalInput" }, host: { listeners: { "input": "onInput()", "keypress": "onKeypress($event)", "blur": "onblur()" }, properties: { "placeholder": "this.placeholder", "autocomplete": "this.autocomplete", "type": "this.type", "attr.inputmode": "this.inputMode" } }, providers: [
86
85
  DecimalPipe,
87
86
  { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => DecimalInputDirective), multi: true }
88
87
  ], usesOnChanges: true, ngImport: i0 });
@@ -117,9 +116,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
117
116
  }], onKeypress: [{
118
117
  type: HostListener,
119
118
  args: ['keypress', ['$event']]
120
- }], onFocus: [{
121
- type: HostListener,
122
- args: ['focus']
123
119
  }], onblur: [{
124
120
  type: HostListener,
125
121
  args: ['blur']
@@ -1 +1 @@
1
- {"version":3,"file":"bravura-ui-decimal-input.js","sources":["../../../projects/ui/decimal-input/decimal-input.directive.ts","../../../projects/ui/decimal-input/decimal-input.module.ts","../../../projects/ui/decimal-input/bravura-ui-decimal-input.ts"],"sourcesContent":["import { DecimalPipe } from '@angular/common';\nimport {\n\tDirective,\n\tElementRef,\n\tforwardRef,\n\tHostBinding,\n\tHostListener,\n\tInput,\n\tOnChanges,\n\tRenderer2,\n\tSelf\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { noop } from 'rxjs';\n\n/* tslint:disable:no-empty */\nexport const noop_consumer = (_: any) => {};\n\n/**\n * This directive will enhance an input element to format the numbers entered to a decimal amount.\n */\n@Directive({\n\tselector: 'input[buiDecimalInput]',\n\tproviders: [\n\t\tDecimalPipe,\n\t\t{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => DecimalInputDirective), multi: true }\n\t]\n})\nexport class DecimalInputDirective implements OnChanges, ControlValueAccessor {\n\t/**\n\t * number of decimal places allowed\n\t */\n\t@Input()\n\tbuiDecimalInput: number = 2;\n\n\t@HostBinding('placeholder')\n\tprivate placeholder: string = '';\n\n\t@HostBinding('autocomplete')\n\tprivate autocomplete = 'off';\n\n\t@HostBinding('type')\n\tprivate type = 'number';\n\n\t@HostBinding('attr.inputmode')\n\tprivate inputMode = 'decimal';\n\n\tprivate change = noop_consumer;\n\tprivate onTouch = noop;\n\n\tconstructor(@Self() private _el: ElementRef<HTMLInputElement>, private _renderer: Renderer2) {}\n\n\tngOnChanges(): void {\n\t\tthis.buiDecimalInput = this.buiDecimalInput || 2;\n\t\tthis.onInput();\n\t}\n\n\t@HostListener('input')\n\tonInput() {\n\t\tconst value = this._el.nativeElement.value;\n\n\t\tconst decimalPart = value.split('.')[1];\n\n\t\tif (decimalPart && decimalPart.length > this.buiDecimalInput) {\n\t\t\tconst indexOfPeriod = value.indexOf('.');\n\t\t\tconst newValue = value.substring(0, indexOfPeriod + this.buiDecimalInput + 1);\n\t\t\tthis._renderer.setProperty(this._el.nativeElement, 'value', newValue);\n\t\t}\n\t\tconst resolvedValue = this._el.nativeElement.value;\n\t\tthis.change(\n\t\t\tresolvedValue === '' || resolvedValue === null || resolvedValue === undefined ? null : Number(resolvedValue)\n\t\t);\n\t}\n\n\t@HostListener('keypress', ['$event'])\n\tonKeypress(evt: KeyboardEvent) {\n\t\tconst target = evt.target as HTMLInputElement;\n\t\tconst value = target.value;\n\t\tconst isSpace = evt.key === ' ';\n\n\t\tif (\n\t\t\tisSpace ||\n\t\t\t(!['.', '-'].includes(evt.key) && isNaN(Number(evt.key))) ||\n\t\t\t(evt.key === '.' && value.indexOf('.') > 0)\n\t\t) {\n\t\t\tevt.preventDefault();\n\t\t}\n\t}\n\n\t@HostListener('focus')\n\tonFocus() {}\n\n\t@HostListener('blur')\n\tonblur() {\n\t\tthis.onTouch();\n\t\tthis._resetDecimalPlaces();\n\t}\n\n\twriteValue(value: any) {\n\t\tthis._renderer.setProperty(this._el.nativeElement, 'value', value);\n\t\tthis._resetDecimalPlaces();\n\t}\n\n\tregisterOnChange(fn: any) {\n\t\tthis.change = fn;\n\t}\n\n\tregisterOnTouched(fn: any) {\n\t\tthis.onTouch = fn;\n\t}\n\n\tprivate _resetDecimalPlaces() {\n\t\tconst value = this._el.nativeElement.value;\n\t\tif (value === '' || value === null || value === undefined) {\n\t\t\treturn;\n\t\t}\n\t\tconst splitValues = value.split('.');\n\t\tlet newValue = '';\n\t\tif (splitValues[1] && splitValues[1].length > this.buiDecimalInput) {\n\t\t\tnewValue = value.substring(0, splitValues[0].length + 1 + this.buiDecimalInput);\n\t\t} else {\n\t\t\tthis.buiDecimalInput = this.buiDecimalInput < 0 ? 0 : this.buiDecimalInput;\n\t\t\tnewValue = Number(value).toFixed(this.buiDecimalInput);\n\t\t}\n\t\tthis._renderer.setProperty(this._el.nativeElement, 'value', newValue);\n\t}\n}\n","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { DecimalInputDirective } from './decimal-input.directive';\n\n@NgModule({\n\tdeclarations: [DecimalInputDirective],\n\timports: [CommonModule],\n\texports: [DecimalInputDirective]\n})\nexport class DecimalInputModule {}\nexport { DecimalInputDirective };\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;AAeA;AACO,MAAM,aAAa,GAAG,CAAC,CAAM,QAAO,CAAC;AAE5C;;;MAUa,qBAAqB;IAsBjC,YAA4B,GAAiC,EAAU,SAAoB;QAA/D,QAAG,GAAH,GAAG,CAA8B;QAAU,cAAS,GAAT,SAAS,CAAW;;;;QAjB3F,oBAAe,GAAW,CAAC,CAAC;QAGpB,gBAAW,GAAW,EAAE,CAAC;QAGzB,iBAAY,GAAG,KAAK,CAAC;QAGrB,SAAI,GAAG,QAAQ,CAAC;QAGhB,cAAS,GAAG,SAAS,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;kBAL9B,QAAQ;mBAAC;oBACT,YAAY,EAAE,CAAC,qBAAqB,CAAC;oBACrC,OAAO,EAAE,CAAC,YAAY,CAAC;oBACvB,OAAO,EAAE,CAAC,qBAAqB,CAAC;iBAChC;;;ACRD;;;;;;"}
1
+ {"version":3,"file":"bravura-ui-decimal-input.js","sources":["../../../projects/ui/decimal-input/decimal-input.directive.ts","../../../projects/ui/decimal-input/decimal-input.module.ts","../../../projects/ui/decimal-input/bravura-ui-decimal-input.ts"],"sourcesContent":["import { DecimalPipe } from '@angular/common';\nimport {\n\tDirective,\n\tElementRef,\n\tforwardRef,\n\tHostBinding,\n\tHostListener,\n\tInput,\n\tOnChanges,\n\tRenderer2,\n\tSelf\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { noop } from 'rxjs';\n\n/* tslint:disable:no-empty */\nexport const noop_consumer = (_: any) => {};\n\n/**\n * This directive will enhance an input element to format the numbers entered to a decimal amount.\n */\n@Directive({\n\tselector: 'input[buiDecimalInput]',\n\tproviders: [\n\t\tDecimalPipe,\n\t\t{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => DecimalInputDirective), multi: true }\n\t]\n})\nexport class DecimalInputDirective implements OnChanges, ControlValueAccessor {\n\t/**\n\t * number of decimal places allowed\n\t */\n\t@Input()\n\tbuiDecimalInput: number = 2;\n\n\t@HostBinding('placeholder')\n\tprivate placeholder: string = '';\n\n\t@HostBinding('autocomplete')\n\tprivate autocomplete = 'off';\n\n\t@HostBinding('type')\n\tprivate type = 'number';\n\n\t@HostBinding('attr.inputmode')\n\tprivate inputMode = 'decimal';\n\n\tprivate change = noop_consumer;\n\tprivate onTouch = noop;\n\n\tconstructor(@Self() private _el: ElementRef<HTMLInputElement>, private _renderer: Renderer2) {}\n\n\tngOnChanges(): void {\n\t\tthis.buiDecimalInput = this.buiDecimalInput || 2;\n\t\tthis.onInput();\n\t}\n\n\t@HostListener('input')\n\tonInput() {\n\t\tconst value = this._el.nativeElement.value;\n\n\t\tconst decimalPart = value.split('.')[1];\n\n\t\tif (decimalPart && decimalPart.length > this.buiDecimalInput) {\n\t\t\tconst indexOfPeriod = value.indexOf('.');\n\t\t\tconst newValue = value.substring(0, indexOfPeriod + this.buiDecimalInput + 1);\n\t\t\tthis._renderer.setProperty(this._el.nativeElement, 'value', newValue);\n\t\t}\n\t\tconst resolvedValue = this._el.nativeElement.value;\n\t\tthis.change(\n\t\t\tresolvedValue === '' || resolvedValue === null || resolvedValue === undefined ? null : Number(resolvedValue)\n\t\t);\n\t}\n\n\t@HostListener('keypress', ['$event'])\n\tonKeypress(evt: KeyboardEvent) {\n\t\tconst target = evt.target as HTMLInputElement;\n\t\tconst value = target.value;\n\t\tconst isSpace = evt.key === ' ';\n\n\t\tif (\n\t\t\tisSpace ||\n\t\t\t(!['.', '-'].includes(evt.key) && isNaN(Number(evt.key))) ||\n\t\t\t(evt.key === '.' && value.indexOf('.') > 0)\n\t\t) {\n\t\t\tevt.preventDefault();\n\t\t}\n\t}\n\n\t@HostListener('blur')\n\tonblur() {\n\t\tthis.onTouch();\n\t\tthis._resetDecimalPlaces();\n\t}\n\n\twriteValue(value: any) {\n\t\tthis._renderer.setProperty(this._el.nativeElement, 'value', value);\n\t\tthis._resetDecimalPlaces();\n\t}\n\n\tregisterOnChange(fn: any) {\n\t\tthis.change = fn;\n\t}\n\n\tregisterOnTouched(fn: any) {\n\t\tthis.onTouch = fn;\n\t}\n\n\tprivate _resetDecimalPlaces() {\n\t\tconst value = this._el.nativeElement.value;\n\t\tif (value === '' || value === null || value === undefined) {\n\t\t\treturn;\n\t\t}\n\t\tconst splitValues = value.split('.');\n\t\tlet newValue = '';\n\t\tif (splitValues[1] && splitValues[1].length > this.buiDecimalInput) {\n\t\t\tnewValue = value.substring(0, splitValues[0].length + 1 + this.buiDecimalInput);\n\t\t} else {\n\t\t\tthis.buiDecimalInput = this.buiDecimalInput < 0 ? 0 : this.buiDecimalInput;\n\t\t\tnewValue = Number(value).toFixed(this.buiDecimalInput);\n\t\t}\n\t\tthis._renderer.setProperty(this._el.nativeElement, 'value', newValue);\n\t}\n}\n","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { DecimalInputDirective } from './decimal-input.directive';\n\n@NgModule({\n\tdeclarations: [DecimalInputDirective],\n\timports: [CommonModule],\n\texports: [DecimalInputDirective]\n})\nexport class DecimalInputModule {}\nexport { DecimalInputDirective };\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;AAeA;AACO,MAAM,aAAa,GAAG,CAAC,CAAM,QAAO,CAAC;AAE5C;;;MAUa,qBAAqB;IAsBjC,YAA4B,GAAiC,EAAU,SAAoB;QAA/D,QAAG,GAAH,GAAG,CAA8B;QAAU,cAAS,GAAT,SAAS,CAAW;;;;QAjB3F,oBAAe,GAAW,CAAC,CAAC;QAGpB,gBAAW,GAAW,EAAE,CAAC;QAGzB,iBAAY,GAAG,KAAK,CAAC;QAGrB,SAAI,GAAG,QAAQ,CAAC;QAGhB,cAAS,GAAG,SAAS,CAAC;QAEtB,WAAM,GAAG,aAAa,CAAC;QACvB,YAAO,GAAG,IAAI,CAAC;KAEwE;IAE/F,WAAW;QACV,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,IAAI,CAAC,CAAC;QACjD,IAAI,CAAC,OAAO,EAAE,CAAC;KACf;IAGD,OAAO;QACN,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,KAAK,CAAC;QAE3C,MAAM,WAAW,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAExC,IAAI,WAAW,IAAI,WAAW,CAAC,MAAM,GAAG,IAAI,CAAC,eAAe,EAAE;YAC7D,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YACzC,MAAM,QAAQ,GAAG,KAAK,CAAC,SAAS,CAAC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