@bravura/ui 1.7.2 → 1.10.0
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.
- package/CHANGELOG.md +17 -0
- package/behavior/await.directive.d.ts +60 -0
- package/behavior/behavior.module.d.ts +5 -2
- package/behavior/public-api.d.ts +1 -0
- package/behavior/sizing.directive.d.ts +12 -6
- package/bundles/bravura-ui-behavior.umd.js +161 -23
- package/bundles/bravura-ui-behavior.umd.js.map +1 -1
- package/bundles/bravura-ui-discrete-input.umd.js +2 -2
- package/bundles/bravura-ui-discrete-input.umd.js.map +1 -1
- package/bundles/bravura-ui-form-field.umd.js +2 -2
- package/bundles/bravura-ui-form-field.umd.js.map +1 -1
- package/bundles/bravura-ui-radio-panel.umd.js +2 -2
- package/bundles/bravura-ui-radio-panel.umd.js.map +1 -1
- package/bundles/bravura-ui-selection-panel.umd.js +7 -5
- package/bundles/bravura-ui-selection-panel.umd.js.map +1 -1
- package/bundles/bravura-ui-tooltip.umd.js +2 -1
- package/bundles/bravura-ui-tooltip.umd.js.map +1 -1
- package/esm2015/behavior/await.directive.js +106 -0
- package/esm2015/behavior/behavior.module.js +9 -6
- package/esm2015/behavior/public-api.js +2 -1
- package/esm2015/behavior/sizing.directive.js +42 -14
- package/esm2015/discrete-input/discrete-input.component.js +3 -3
- package/esm2015/form-field/form-field.component.js +3 -3
- package/esm2015/radio-panel/radio-panel.directive.js +3 -3
- package/esm2015/selection-panel/selection-panel-item.component.js +2 -2
- package/esm2015/selection-panel/selection-panel.directive.js +4 -3
- package/esm2015/selection-panel/selection-panel.module.js +4 -3
- package/esm2015/tooltip/tooltip.component.js +3 -2
- package/fesm2015/bravura-ui-behavior.js +151 -19
- package/fesm2015/bravura-ui-behavior.js.map +1 -1
- package/fesm2015/bravura-ui-discrete-input.js +2 -2
- package/fesm2015/bravura-ui-discrete-input.js.map +1 -1
- package/fesm2015/bravura-ui-form-field.js +2 -2
- package/fesm2015/bravura-ui-form-field.js.map +1 -1
- package/fesm2015/bravura-ui-radio-panel.js +2 -2
- package/fesm2015/bravura-ui-radio-panel.js.map +1 -1
- package/fesm2015/bravura-ui-selection-panel.js +7 -5
- package/fesm2015/bravura-ui-selection-panel.js.map +1 -1
- package/fesm2015/bravura-ui-tooltip.js +2 -1
- package/fesm2015/bravura-ui-tooltip.js.map +1 -1
- package/package.json +1 -1
- package/selection-panel/selection-panel-item.component.d.ts +1 -1
- package/selection-panel/selection-panel.module.d.ts +1 -1
- package/theme/_ui-theme.scss +39 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Change history
|
|
2
2
|
|
|
3
|
+
## 1.10.0 (2021-12-15)
|
|
4
|
+
|
|
5
|
+
* feat(selection-panel): add content projection at end of heading ([b41a17a](https://scm.bravurasolutions.net/projects/DIGI/repos/ui-components/commits/b41a17a))
|
|
6
|
+
|
|
7
|
+
## <small>1.9.1 (2021-12-15)</small>
|
|
8
|
+
|
|
9
|
+
* fix(selection-panel): add missing NgModule exports ([ea0370d](https://scm.bravurasolutions.net/projects/DIGI/repos/ui-components/commits/ea0370d))
|
|
10
|
+
* refactor(theming): standardise theme attribute naming - part 1 ([2878570](https://scm.bravurasolutions.net/projects/DIGI/repos/ui-components/commits/2878570))
|
|
11
|
+
|
|
12
|
+
## 1.9.0 (2021-12-12)
|
|
13
|
+
|
|
14
|
+
* feat(behavior): add await directive ([20a276a](https://scm.bravurasolutions.net/projects/DIGI/repos/ui-components/commits/20a276a))
|
|
15
|
+
|
|
16
|
+
## 1.8.0 (2021-12-09)
|
|
17
|
+
|
|
18
|
+
* feat(behavior): enhance sizing directive to support inline styles ([3a27a84](https://scm.bravurasolutions.net/projects/DIGI/repos/ui-components/commits/3a27a84))
|
|
19
|
+
|
|
3
20
|
## <small>1.7.2 (2021-11-17)</small>
|
|
4
21
|
|
|
5
22
|
* fix(tooltip): fix tooltip content not being reset when given falsy ([b17da82](https://scm.bravurasolutions.net/projects/DIGI/repos/ui-components/commits/b17da82))
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { AfterViewInit, ComponentFactoryResolver, DoCheck, ElementRef, ViewContainerRef } from '@angular/core';
|
|
2
|
+
import { MatButton } from '@angular/material/button';
|
|
3
|
+
import { Subscription } from 'rxjs';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
/**
|
|
6
|
+
* Use this directive on a `MatButton` element to provide an alternative view when an sync operation is in progress.
|
|
7
|
+
*
|
|
8
|
+
* For example:
|
|
9
|
+
*
|
|
10
|
+
* ```
|
|
11
|
+
* <button (click)="submit();" [buiAwait]="submitSubscription" buiAwaitAriaLabel="submitting">Submit</button>
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* Please refer to [Material Design](https://material.io/components/progress-indicators#circular-progress-indicators)
|
|
15
|
+
* for more details of integrating circular spinner component with action buttons.
|
|
16
|
+
*
|
|
17
|
+
* The operation is considered 'in progress' when the bound property `buiAwait` evaluates to
|
|
18
|
+
*
|
|
19
|
+
* - `true`; or
|
|
20
|
+
* - an instance of `rxjs/Subscription` and `buiAwait.closed` is falsy
|
|
21
|
+
*
|
|
22
|
+
* When in progress
|
|
23
|
+
*
|
|
24
|
+
* - the button's caption will be hidden;
|
|
25
|
+
* - a `<mat-progress-spinner>` will be displayed in place of the caption;
|
|
26
|
+
* - the button will be disabled by setting the property `disabled` of the `MatButton` instance.
|
|
27
|
+
*/
|
|
28
|
+
export declare class AwaitDirective implements AfterViewInit, DoCheck {
|
|
29
|
+
private readonly _eRef;
|
|
30
|
+
private readonly button;
|
|
31
|
+
private readonly doc;
|
|
32
|
+
private _viewCont;
|
|
33
|
+
/**
|
|
34
|
+
* Indicates the `in progress` status of an async operation.
|
|
35
|
+
*
|
|
36
|
+
* The operation is considered 'in progress' when the property evaluates to
|
|
37
|
+
*
|
|
38
|
+
* - `true`; or
|
|
39
|
+
* - an instance of `rxjs/Subscription` and `buiAwait.closed` is falsy
|
|
40
|
+
*
|
|
41
|
+
*/
|
|
42
|
+
buiAwait: null | undefined | boolean | Subscription;
|
|
43
|
+
/** The ARIA label to be put on the spinner. The default value is `"In progress"`. */
|
|
44
|
+
buiAwaitAriaLabel: string;
|
|
45
|
+
/** The diameter of the in-progress spinner. The default value is `20`. */
|
|
46
|
+
buiAwaitDiameter: number;
|
|
47
|
+
private _overlayEl;
|
|
48
|
+
private _processing;
|
|
49
|
+
private _factory;
|
|
50
|
+
private _spinnerRef;
|
|
51
|
+
private _captionWrapper;
|
|
52
|
+
constructor(_eRef: ElementRef<HTMLElement>, button: MatButton, doc: Document, factoryResolver: ComponentFactoryResolver, _viewCont: ViewContainerRef);
|
|
53
|
+
/** @ignore */
|
|
54
|
+
ngAfterViewInit(): void;
|
|
55
|
+
/** @ignore */
|
|
56
|
+
ngDoCheck(): void;
|
|
57
|
+
private _statusChanged;
|
|
58
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AwaitDirective, [null, { optional: true; }, null, null, null]>;
|
|
59
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<AwaitDirective, "[buiAwait]", never, { "buiAwait": "buiAwait"; "buiAwaitAriaLabel": "buiAwaitAriaLabel"; "buiAwaitDiameter": "buiAwaitDiameter"; }, {}, never>;
|
|
60
|
+
}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
2
|
import * as i1 from "./sizing.directive";
|
|
3
3
|
import * as i2 from "./sizing-monitor.directive";
|
|
4
|
-
import * as i3 from "
|
|
4
|
+
import * as i3 from "./await.directive";
|
|
5
|
+
import * as i4 from "@angular/common";
|
|
6
|
+
import * as i5 from "@angular/material/button";
|
|
7
|
+
import * as i6 from "@angular/material/progress-spinner";
|
|
5
8
|
/**
|
|
6
9
|
* For functionality that cannot be easily achieved via CSS.
|
|
7
10
|
*/
|
|
8
11
|
export declare class BehaviorModule {
|
|
9
12
|
static ɵfac: i0.ɵɵFactoryDeclaration<BehaviorModule, never>;
|
|
10
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<BehaviorModule, [typeof i1.SizingDirective, typeof i2.SizingMonitorDirective], [typeof
|
|
13
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<BehaviorModule, [typeof i1.SizingDirective, typeof i2.SizingMonitorDirective, typeof i3.AwaitDirective], [typeof i4.CommonModule, typeof i5.MatButtonModule, typeof i6.MatProgressSpinnerModule], [typeof i1.SizingDirective, typeof i2.SizingMonitorDirective, typeof i3.AwaitDirective, typeof i6.MatProgressSpinnerModule]>;
|
|
11
14
|
static ɵinj: i0.ɵɵInjectorDeclaration<BehaviorModule>;
|
|
12
15
|
}
|
package/behavior/public-api.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { ElementRef, EventEmitter, NgZone, OnChanges, OnDestroy, SimpleChanges }
|
|
|
2
2
|
import { SizingMonitorDirective } from './sizing-monitor.directive';
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
4
|
/**
|
|
5
|
-
* This directive monitors the changes in width of the `sizingBy` target, and apply specified style
|
|
6
|
-
* classes to the current element dynamically.
|
|
5
|
+
* This directive monitors the changes in the width of the `sizingBy` target, and apply specified style
|
|
6
|
+
* classes and/or inline styles to the current element dynamically.
|
|
7
7
|
*
|
|
8
8
|
* In order for the layout engine to efficiently calculate and stabilize the dimensions, the effective style property
|
|
9
9
|
* `box-sizing` of the `sizingBy` target element must be set to `border-box`.
|
|
@@ -16,8 +16,9 @@ import * as i0 from "@angular/core";
|
|
|
16
16
|
*
|
|
17
17
|
* ```html
|
|
18
18
|
* <div #parentElement>
|
|
19
|
-
* <div [buiSizing]="{'400': 'small', '800': 'medium', '~': 'large'}" [
|
|
20
|
-
* <div [buiSizing]="['small', 'medium', 'large']" [
|
|
19
|
+
* <div [buiSizing]="{'400': 'small', '800': 'medium', '~': 'large'}" [buiSizingBy]="parentElement"></div>
|
|
20
|
+
* <div [buiSizing]="['small', 'medium', 'large']" [buiSizingBy]="'root'"></div>
|
|
21
|
+
* <div [buiSizing]="{'650': 'border-color: #28569', '~': 'bg-muted; border-style: dotted'}" [buiSizingBy]="parentElement"></div>
|
|
21
22
|
* </div>
|
|
22
23
|
* ```
|
|
23
24
|
*/
|
|
@@ -43,13 +44,16 @@ export declare class SizingDirective implements OnChanges, OnDestroy {
|
|
|
43
44
|
};
|
|
44
45
|
/**
|
|
45
46
|
* The alias of `buiSizingBy`.
|
|
47
|
+
* @default 'root'
|
|
46
48
|
*/
|
|
47
49
|
sizingBy: 'root' | 'parent' | HTMLElement;
|
|
48
50
|
/**
|
|
49
51
|
* Designate an element to be monitored for recalculating the style classes of the current element.
|
|
50
52
|
*
|
|
51
|
-
* `root` specifies the document root or the enclosing shadow host.
|
|
52
|
-
* `parent` specifies the parent element.
|
|
53
|
+
* - `root` specifies the document root or the enclosing shadow host. This is the default value.
|
|
54
|
+
* - `parent` specifies the parent element.
|
|
55
|
+
*
|
|
56
|
+
* @default 'root'
|
|
53
57
|
* @alias sizingBy
|
|
54
58
|
*/
|
|
55
59
|
get buiSizingBy(): 'root' | 'parent' | HTMLElement;
|
|
@@ -81,6 +85,8 @@ export declare class SizingDirective implements OnChanges, OnDestroy {
|
|
|
81
85
|
private _setUpNodeMonitor;
|
|
82
86
|
private _tearDownNodeMonitor;
|
|
83
87
|
private _calculateSize;
|
|
88
|
+
private _applyClassesOrStyles;
|
|
89
|
+
private _removeClassesOrStyles;
|
|
84
90
|
private _reflowHeight;
|
|
85
91
|
private _toNumber;
|
|
86
92
|
static ɵfac: i0.ɵɵFactoryDeclaration<SizingDirective, [null, { optional: true; }, null, null]>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/cdk/coercion'), require('@angular/common'), require('@angular/core'), require('rxjs/operators')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@bravura/ui/behavior', ['exports', '@angular/cdk/coercion', '@angular/common', '@angular/core', 'rxjs/operators'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.bravura = global.bravura || {}, global.bravura.ui = global.bravura.ui || {}, global.bravura.ui.behavior = {}), global.ng.cdk.coercion, global.ng.common, global.ng.core, global.rxjs.operators));
|
|
5
|
-
})(this, (function (exports, coercion, common, i0, operators) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/cdk/coercion'), require('@angular/common'), require('@angular/core'), require('rxjs/operators'), require('@angular/material/progress-spinner'), require('@angular/material/button')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@bravura/ui/behavior', ['exports', '@angular/cdk/coercion', '@angular/common', '@angular/core', 'rxjs/operators', '@angular/material/progress-spinner', '@angular/material/button'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.bravura = global.bravura || {}, global.bravura.ui = global.bravura.ui || {}, global.bravura.ui.behavior = {}), global.ng.cdk.coercion, global.ng.common, global.ng.core, global.rxjs.operators, global.ng.material.progressSpinner, global.ng.material.button));
|
|
5
|
+
})(this, (function (exports, coercion, common, i0, operators, progressSpinner, i1) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopNamespace(e) {
|
|
8
8
|
if (e && e.__esModule) return e;
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
|
|
26
|
+
var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
|
|
26
27
|
|
|
27
28
|
/*! *****************************************************************************
|
|
28
29
|
Copyright (c) Microsoft Corporation.
|
|
@@ -373,8 +374,8 @@
|
|
|
373
374
|
}], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }]; } });
|
|
374
375
|
|
|
375
376
|
/**
|
|
376
|
-
* This directive monitors the changes in width of the `sizingBy` target, and apply specified style
|
|
377
|
-
* classes to the current element dynamically.
|
|
377
|
+
* This directive monitors the changes in the width of the `sizingBy` target, and apply specified style
|
|
378
|
+
* classes and/or inline styles to the current element dynamically.
|
|
378
379
|
*
|
|
379
380
|
* In order for the layout engine to efficiently calculate and stabilize the dimensions, the effective style property
|
|
380
381
|
* `box-sizing` of the `sizingBy` target element must be set to `border-box`.
|
|
@@ -387,8 +388,9 @@
|
|
|
387
388
|
*
|
|
388
389
|
* ```html
|
|
389
390
|
* <div #parentElement>
|
|
390
|
-
* <div [buiSizing]="{'400': 'small', '800': 'medium', '~': 'large'}" [
|
|
391
|
-
* <div [buiSizing]="['small', 'medium', 'large']" [
|
|
391
|
+
* <div [buiSizing]="{'400': 'small', '800': 'medium', '~': 'large'}" [buiSizingBy]="parentElement"></div>
|
|
392
|
+
* <div [buiSizing]="['small', 'medium', 'large']" [buiSizingBy]="'root'"></div>
|
|
393
|
+
* <div [buiSizing]="{'650': 'border-color: #28569', '~': 'bg-muted; border-style: dotted'}" [buiSizingBy]="parentElement"></div>
|
|
392
394
|
* </div>
|
|
393
395
|
* ```
|
|
394
396
|
*/
|
|
@@ -409,6 +411,7 @@
|
|
|
409
411
|
this.buiSizing = {};
|
|
410
412
|
/**
|
|
411
413
|
* The alias of `buiSizingBy`.
|
|
414
|
+
* @default 'root'
|
|
412
415
|
*/
|
|
413
416
|
this.sizingBy = 'root';
|
|
414
417
|
/**
|
|
@@ -432,8 +435,10 @@
|
|
|
432
435
|
/**
|
|
433
436
|
* Designate an element to be monitored for recalculating the style classes of the current element.
|
|
434
437
|
*
|
|
435
|
-
* `root` specifies the document root or the enclosing shadow host.
|
|
436
|
-
* `parent` specifies the parent element.
|
|
438
|
+
* - `root` specifies the document root or the enclosing shadow host. This is the default value.
|
|
439
|
+
* - `parent` specifies the parent element.
|
|
440
|
+
*
|
|
441
|
+
* @default 'root'
|
|
437
442
|
* @alias sizingBy
|
|
438
443
|
*/
|
|
439
444
|
get: function () {
|
|
@@ -514,7 +519,7 @@
|
|
|
514
519
|
}
|
|
515
520
|
};
|
|
516
521
|
SizingDirective.prototype._calculateSize = function () {
|
|
517
|
-
var e_1, _a
|
|
522
|
+
var e_1, _a;
|
|
518
523
|
var _this = this;
|
|
519
524
|
var widthChanged = this._width !== this._monitorTarget.clientWidth;
|
|
520
525
|
var heightChanged = this._height !== this._monitorTarget.clientHeight;
|
|
@@ -525,15 +530,11 @@
|
|
|
525
530
|
try {
|
|
526
531
|
for (var bks_1 = __values(bks), bks_1_1 = bks_1.next(); !bks_1_1.done; bks_1_1 = bks_1.next()) {
|
|
527
532
|
var key = bks_1_1.value;
|
|
528
|
-
var
|
|
529
|
-
|
|
530
|
-
(_b = this._element.classList).remove.apply(_b, __spreadArray([], __read(classes)));
|
|
531
|
-
}
|
|
533
|
+
var classesOrStyles = this._sizingSpec[key].split(/;+/).filter(function (c) { return c; });
|
|
534
|
+
this._removeClassesOrStyles(classesOrStyles);
|
|
532
535
|
var expectedWidth = this._toNumber(key);
|
|
533
536
|
if (this._width <= expectedWidth && !found) {
|
|
534
|
-
|
|
535
|
-
(_c = this._element.classList).add.apply(_c, __spreadArray([], __read(classes)));
|
|
536
|
-
}
|
|
537
|
+
this._applyClassesOrStyles(classesOrStyles);
|
|
537
538
|
found = true;
|
|
538
539
|
}
|
|
539
540
|
}
|
|
@@ -555,6 +556,38 @@
|
|
|
555
556
|
this.buiResized.emit({ width: this._width, height: this._height });
|
|
556
557
|
}
|
|
557
558
|
};
|
|
559
|
+
SizingDirective.prototype._applyClassesOrStyles = function (clsOrStyles) {
|
|
560
|
+
var _this = this;
|
|
561
|
+
clsOrStyles.forEach(function (s) {
|
|
562
|
+
var _a;
|
|
563
|
+
if (s.includes(':')) {
|
|
564
|
+
var _b = __read(s.split(':'), 2), prop = _b[0], val = _b[1];
|
|
565
|
+
_this._element.style.setProperty(prop.trim(), val.trim());
|
|
566
|
+
}
|
|
567
|
+
else {
|
|
568
|
+
var classes = s.split(/\s+/).filter(function (c) { return c; });
|
|
569
|
+
if (classes.length) {
|
|
570
|
+
(_a = _this._element.classList).add.apply(_a, __spreadArray([], __read(classes)));
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
});
|
|
574
|
+
};
|
|
575
|
+
SizingDirective.prototype._removeClassesOrStyles = function (clsOrStyles) {
|
|
576
|
+
var _this = this;
|
|
577
|
+
clsOrStyles.forEach(function (s) {
|
|
578
|
+
var _a;
|
|
579
|
+
if (s.includes(':')) {
|
|
580
|
+
var _b = __read(s.split(':'), 1), prop = _b[0];
|
|
581
|
+
_this._element.style.removeProperty(prop);
|
|
582
|
+
}
|
|
583
|
+
else {
|
|
584
|
+
var classes = s.split(/\s+/).filter(function (c) { return c; });
|
|
585
|
+
if (classes.length) {
|
|
586
|
+
(_a = _this._element.classList).remove.apply(_a, __spreadArray([], __read(classes)));
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
});
|
|
590
|
+
};
|
|
558
591
|
SizingDirective.prototype._reflowHeight = function () {
|
|
559
592
|
var cnt = this._reflowFrameCount;
|
|
560
593
|
if (cnt < 15) {
|
|
@@ -605,6 +638,110 @@
|
|
|
605
638
|
type: i0.Input
|
|
606
639
|
}] } });
|
|
607
640
|
|
|
641
|
+
/**
|
|
642
|
+
* Use this directive on a `MatButton` element to provide an alternative view when an sync operation is in progress.
|
|
643
|
+
*
|
|
644
|
+
* For example:
|
|
645
|
+
*
|
|
646
|
+
* ```
|
|
647
|
+
* <button (click)="submit();" [buiAwait]="submitSubscription" buiAwaitAriaLabel="submitting">Submit</button>
|
|
648
|
+
* ```
|
|
649
|
+
*
|
|
650
|
+
* Please refer to [Material Design](https://material.io/components/progress-indicators#circular-progress-indicators)
|
|
651
|
+
* for more details of integrating circular spinner component with action buttons.
|
|
652
|
+
*
|
|
653
|
+
* The operation is considered 'in progress' when the bound property `buiAwait` evaluates to
|
|
654
|
+
*
|
|
655
|
+
* - `true`; or
|
|
656
|
+
* - an instance of `rxjs/Subscription` and `buiAwait.closed` is falsy
|
|
657
|
+
*
|
|
658
|
+
* When in progress
|
|
659
|
+
*
|
|
660
|
+
* - the button's caption will be hidden;
|
|
661
|
+
* - a `<mat-progress-spinner>` will be displayed in place of the caption;
|
|
662
|
+
* - the button will be disabled by setting the property `disabled` of the `MatButton` instance.
|
|
663
|
+
*/
|
|
664
|
+
var AwaitDirective = /** @class */ (function () {
|
|
665
|
+
function AwaitDirective(_eRef, button, doc, factoryResolver, _viewCont) {
|
|
666
|
+
this._eRef = _eRef;
|
|
667
|
+
this.button = button;
|
|
668
|
+
this.doc = doc;
|
|
669
|
+
this._viewCont = _viewCont;
|
|
670
|
+
/** The ARIA label to be put on the spinner. The default value is `"In progress"`. */
|
|
671
|
+
this.buiAwaitAriaLabel = 'In progress';
|
|
672
|
+
/** The diameter of the in-progress spinner. The default value is `20`. */
|
|
673
|
+
this.buiAwaitDiameter = 20;
|
|
674
|
+
this._processing = false;
|
|
675
|
+
if (!button) {
|
|
676
|
+
console.error('[buiAwait] can only be used on a MatButton');
|
|
677
|
+
return;
|
|
678
|
+
}
|
|
679
|
+
this._factory = factoryResolver.resolveComponentFactory(progressSpinner.MatProgressSpinner);
|
|
680
|
+
}
|
|
681
|
+
/** @ignore */
|
|
682
|
+
AwaitDirective.prototype.ngAfterViewInit = function () {
|
|
683
|
+
if (this.button) {
|
|
684
|
+
this._overlayEl = this.doc.createElement('div');
|
|
685
|
+
this._eRef.nativeElement.appendChild(this._overlayEl);
|
|
686
|
+
this._overlayEl.classList.add('bui-await-overlay');
|
|
687
|
+
this._overlayEl.style.cssText =
|
|
688
|
+
'display:flex; position:absolute; top:0; right:0; bottom:0; left:0; align-items: center; justify-content: center';
|
|
689
|
+
this._captionWrapper = this._eRef.nativeElement.querySelector('.mat-button-wrapper');
|
|
690
|
+
}
|
|
691
|
+
};
|
|
692
|
+
/** @ignore */
|
|
693
|
+
AwaitDirective.prototype.ngDoCheck = function () {
|
|
694
|
+
var inProgress = this.buiAwait === true || (typeof this.buiAwait === 'object' && !this.buiAwait.closed);
|
|
695
|
+
if (inProgress !== this._processing) {
|
|
696
|
+
this._processing = inProgress;
|
|
697
|
+
this._statusChanged();
|
|
698
|
+
}
|
|
699
|
+
};
|
|
700
|
+
AwaitDirective.prototype._statusChanged = function () {
|
|
701
|
+
if (this.button) {
|
|
702
|
+
this.button.disabled = this._processing;
|
|
703
|
+
if (this._processing) {
|
|
704
|
+
this._spinnerRef = this._viewCont.createComponent(this._factory);
|
|
705
|
+
var c = this._spinnerRef.instance;
|
|
706
|
+
c.diameter = this.buiAwaitDiameter;
|
|
707
|
+
c.mode = 'indeterminate';
|
|
708
|
+
c.color = this.button.color;
|
|
709
|
+
var e = this._spinnerRef.location.nativeElement;
|
|
710
|
+
e.setAttribute('aria-label', this.buiAwaitAriaLabel);
|
|
711
|
+
this._overlayEl.appendChild(e);
|
|
712
|
+
this._captionWrapper.style.visibility = 'hidden';
|
|
713
|
+
}
|
|
714
|
+
else {
|
|
715
|
+
this._captionWrapper.style.visibility = '';
|
|
716
|
+
this._spinnerRef.destroy();
|
|
717
|
+
this._overlayEl.innerHTML = '';
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
};
|
|
721
|
+
return AwaitDirective;
|
|
722
|
+
}());
|
|
723
|
+
AwaitDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: AwaitDirective, deps: [{ token: i0__namespace.ElementRef }, { token: i1__namespace.MatButton, optional: true }, { token: common.DOCUMENT }, { token: i0__namespace.ComponentFactoryResolver }, { token: i0__namespace.ViewContainerRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
724
|
+
AwaitDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.7", type: AwaitDirective, selector: "[buiAwait]", inputs: { buiAwait: "buiAwait", buiAwaitAriaLabel: "buiAwaitAriaLabel", buiAwaitDiameter: "buiAwaitDiameter" }, ngImport: i0__namespace });
|
|
725
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: AwaitDirective, decorators: [{
|
|
726
|
+
type: i0.Directive,
|
|
727
|
+
args: [{
|
|
728
|
+
selector: '[buiAwait]'
|
|
729
|
+
}]
|
|
730
|
+
}], ctorParameters: function () {
|
|
731
|
+
return [{ type: i0__namespace.ElementRef }, { type: i1__namespace.MatButton, decorators: [{
|
|
732
|
+
type: i0.Optional
|
|
733
|
+
}] }, { type: Document, decorators: [{
|
|
734
|
+
type: i0.Inject,
|
|
735
|
+
args: [common.DOCUMENT]
|
|
736
|
+
}] }, { type: i0__namespace.ComponentFactoryResolver }, { type: i0__namespace.ViewContainerRef }];
|
|
737
|
+
}, propDecorators: { buiAwait: [{
|
|
738
|
+
type: i0.Input
|
|
739
|
+
}], buiAwaitAriaLabel: [{
|
|
740
|
+
type: i0.Input
|
|
741
|
+
}], buiAwaitDiameter: [{
|
|
742
|
+
type: i0.Input
|
|
743
|
+
}] } });
|
|
744
|
+
|
|
608
745
|
/**
|
|
609
746
|
* For functionality that cannot be easily achieved via CSS.
|
|
610
747
|
*/
|
|
@@ -614,14 +751,14 @@
|
|
|
614
751
|
return BehaviorModule;
|
|
615
752
|
}());
|
|
616
753
|
BehaviorModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: BehaviorModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
617
|
-
BehaviorModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: BehaviorModule, declarations: [SizingDirective, SizingMonitorDirective], imports: [common.CommonModule], exports: [SizingDirective, SizingMonitorDirective] });
|
|
618
|
-
BehaviorModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: BehaviorModule, imports: [[common.CommonModule]] });
|
|
754
|
+
BehaviorModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: BehaviorModule, declarations: [SizingDirective, SizingMonitorDirective, AwaitDirective], imports: [common.CommonModule, i1.MatButtonModule, progressSpinner.MatProgressSpinnerModule], exports: [SizingDirective, SizingMonitorDirective, AwaitDirective, progressSpinner.MatProgressSpinnerModule] });
|
|
755
|
+
BehaviorModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: BehaviorModule, imports: [[common.CommonModule, i1.MatButtonModule, progressSpinner.MatProgressSpinnerModule], progressSpinner.MatProgressSpinnerModule] });
|
|
619
756
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: BehaviorModule, decorators: [{
|
|
620
757
|
type: i0.NgModule,
|
|
621
758
|
args: [{
|
|
622
|
-
declarations: [SizingDirective, SizingMonitorDirective],
|
|
623
|
-
imports: [common.CommonModule],
|
|
624
|
-
exports: [SizingDirective, SizingMonitorDirective]
|
|
759
|
+
declarations: [SizingDirective, SizingMonitorDirective, AwaitDirective],
|
|
760
|
+
imports: [common.CommonModule, i1.MatButtonModule, progressSpinner.MatProgressSpinnerModule],
|
|
761
|
+
exports: [SizingDirective, SizingMonitorDirective, AwaitDirective, progressSpinner.MatProgressSpinnerModule]
|
|
625
762
|
}]
|
|
626
763
|
}] });
|
|
627
764
|
|
|
@@ -629,6 +766,7 @@
|
|
|
629
766
|
* Generated bundle index. Do not edit.
|
|
630
767
|
*/
|
|
631
768
|
|
|
769
|
+
exports.AwaitDirective = AwaitDirective;
|
|
632
770
|
exports.BehaviorModule = BehaviorModule;
|
|
633
771
|
exports.SizingDirective = SizingDirective;
|
|
634
772
|
exports.SizingMonitorDirective = SizingMonitorDirective;
|