@cuby-ui/cdk 0.0.138 → 0.0.140
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/README.md +24 -24
- package/constants/index.d.ts +1 -1
- package/constants/svg-node-filter.d.ts +1 -1
- package/directives/auto-resizing.directive.d.ts +18 -18
- package/directives/click-outside.directive.d.ts +9 -9
- package/directives/content-editable-value-accessor.directive.d.ts +17 -17
- package/directives/dimensions-observer.directive.d.ts +13 -13
- package/directives/element.directive.d.ts +8 -8
- package/directives/focus-trap.directive.d.ts +14 -14
- package/directives/index.d.ts +10 -10
- package/directives/item.directive.d.ts +5 -5
- package/directives/let.context.d.ts +7 -7
- package/directives/let.directive.d.ts +9 -9
- package/directives/target.directive.d.ts +14 -14
- package/esm2020/constants/index.mjs +1 -1
- package/esm2020/constants/svg-node-filter.mjs +8 -8
- package/esm2020/cuby-ui-cdk.mjs +4 -4
- package/esm2020/directives/auto-resizing.directive.mjs +67 -67
- package/esm2020/directives/click-outside.directive.mjs +29 -29
- package/esm2020/directives/content-editable-value-accessor.directive.mjs +44 -44
- package/esm2020/directives/dimensions-observer.directive.mjs +32 -32
- package/esm2020/directives/element.directive.mjs +19 -19
- package/esm2020/directives/focus-trap.directive.mjs +50 -50
- package/esm2020/directives/index.mjs +11 -11
- package/esm2020/directives/item.directive.mjs +14 -14
- package/esm2020/directives/let.context.mjs +12 -12
- package/esm2020/directives/let.directive.mjs +23 -23
- package/esm2020/directives/target.directive.mjs +35 -35
- package/esm2020/index.mjs +8 -8
- package/esm2020/interfaces/dimensions.mjs +2 -2
- package/esm2020/interfaces/index.mjs +4 -4
- package/esm2020/interfaces/on-change.mjs +2 -2
- package/esm2020/interfaces/on-touched.mjs +2 -2
- package/esm2020/pipes/filter.pipe.mjs +17 -17
- package/esm2020/pipes/index.mjs +2 -2
- package/esm2020/services/destroy.service.mjs +15 -15
- package/esm2020/services/id.service.mjs +18 -18
- package/esm2020/services/index.mjs +4 -4
- package/esm2020/services/popover.service.mjs +38 -38
- package/esm2020/tokens/history.mjs +5 -5
- package/esm2020/tokens/index.mjs +5 -5
- package/esm2020/tokens/local-storage.mjs +5 -5
- package/esm2020/tokens/session-storage.mjs +5 -5
- package/esm2020/tokens/window.mjs +11 -11
- package/esm2020/types/index.mjs +6 -6
- package/esm2020/types/input-type.mjs +2 -2
- package/esm2020/types/mapper.mjs +2 -2
- package/esm2020/types/matcher.mjs +2 -2
- package/esm2020/types/nullable.mjs +2 -2
- package/esm2020/types/value-of.mjs +1 -1
- package/esm2020/utils/dom/contains-or-after.mjs +10 -10
- package/esm2020/utils/dom/index.mjs +3 -3
- package/esm2020/utils/dom/is-html-element.mjs +4 -4
- package/esm2020/utils/focus/blur-native-focused.mjs +9 -9
- package/esm2020/utils/focus/get-closest-focusable.mjs +22 -22
- package/esm2020/utils/focus/get-native-focused.mjs +11 -11
- package/esm2020/utils/focus/index.mjs +6 -6
- package/esm2020/utils/focus/is-native-keyboard-focusable.mjs +27 -27
- package/esm2020/utils/focus/is-native-mouse-focusable.mjs +7 -7
- package/esm2020/utils/index.mjs +4 -4
- package/esm2020/utils/token/create-token.mjs +8 -8
- package/esm2020/utils/token/index.mjs +3 -3
- package/esm2020/utils/token/provide.mjs +4 -4
- package/fesm2015/cuby-ui-cdk.mjs +430 -430
- package/fesm2015/cuby-ui-cdk.mjs.map +1 -1
- package/fesm2020/cuby-ui-cdk.mjs +437 -437
- package/fesm2020/cuby-ui-cdk.mjs.map +1 -1
- package/index.d.ts +7 -7
- package/interfaces/dimensions.d.ts +4 -4
- package/interfaces/index.d.ts +3 -3
- package/interfaces/on-change.d.ts +3 -3
- package/interfaces/on-touched.d.ts +3 -3
- package/package.json +1 -1
- package/pipes/filter.pipe.d.ts +8 -8
- package/pipes/index.d.ts +1 -1
- package/services/destroy.service.d.ts +8 -8
- package/services/id.service.d.ts +7 -7
- package/services/index.d.ts +3 -3
- package/services/popover.service.d.ts +22 -22
- package/tokens/history.d.ts +1 -1
- package/tokens/index.d.ts +4 -4
- package/tokens/local-storage.d.ts +1 -1
- package/tokens/session-storage.d.ts +1 -1
- package/tokens/window.d.ts +1 -1
- package/types/index.d.ts +5 -5
- package/types/input-type.d.ts +1 -1
- package/types/mapper.d.ts +1 -1
- package/types/matcher.d.ts +2 -2
- package/types/nullable.d.ts +1 -1
- package/types/value-of.d.ts +1 -1
- package/utils/dom/contains-or-after.d.ts +1 -1
- package/utils/dom/index.d.ts +2 -2
- package/utils/dom/is-html-element.d.ts +1 -1
- package/utils/focus/blur-native-focused.d.ts +1 -1
- package/utils/focus/get-closest-focusable.d.ts +7 -7
- package/utils/focus/get-native-focused.d.ts +1 -1
- package/utils/focus/index.d.ts +5 -5
- package/utils/focus/is-native-keyboard-focusable.d.ts +1 -1
- package/utils/focus/is-native-mouse-focusable.d.ts +1 -1
- package/utils/index.d.ts +3 -3
- package/utils/token/create-token.d.ts +3 -3
- package/utils/token/index.d.ts +2 -2
- package/utils/token/provide.d.ts +3 -3
package/fesm2015/cuby-ui-cdk.mjs
CHANGED
|
@@ -4,23 +4,23 @@ import { NgControl, NgModel, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
|
4
4
|
import { Subject, Observable, takeUntil } from 'rxjs';
|
|
5
5
|
import { DOCUMENT } from '@angular/common';
|
|
6
6
|
|
|
7
|
-
function cuiCreateToken(defaults) {
|
|
8
|
-
return cuiCreateTokenFromFactory(() => defaults);
|
|
9
|
-
}
|
|
10
|
-
function cuiCreateTokenFromFactory(factory) {
|
|
11
|
-
return new InjectionToken('', { factory });
|
|
7
|
+
function cuiCreateToken(defaults) {
|
|
8
|
+
return cuiCreateTokenFromFactory(() => defaults);
|
|
9
|
+
}
|
|
10
|
+
function cuiCreateTokenFromFactory(factory) {
|
|
11
|
+
return new InjectionToken('', { factory });
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
function cuiProvide(provide, useExisting, multi = false) {
|
|
15
|
-
return { provide, useExisting, multi };
|
|
14
|
+
function cuiProvide(provide, useExisting, multi = false) {
|
|
15
|
+
return { provide, useExisting, multi };
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
const CUI_WINDOW = cuiCreateTokenFromFactory(() => {
|
|
19
|
-
const { defaultView } = inject(DOCUMENT);
|
|
20
|
-
if (!defaultView) {
|
|
21
|
-
throw new Error('Window is not available');
|
|
22
|
-
}
|
|
23
|
-
return defaultView;
|
|
18
|
+
const CUI_WINDOW = cuiCreateTokenFromFactory(() => {
|
|
19
|
+
const { defaultView } = inject(DOCUMENT);
|
|
20
|
+
if (!defaultView) {
|
|
21
|
+
throw new Error('Window is not available');
|
|
22
|
+
}
|
|
23
|
+
return defaultView;
|
|
24
24
|
});
|
|
25
25
|
|
|
26
26
|
const CUI_HISTORY = cuiCreateTokenFromFactory(() => inject(CUI_WINDOW).history);
|
|
@@ -29,467 +29,467 @@ const CUI_LOCAL_STORAGE = cuiCreateTokenFromFactory(() => inject(CUI_WINDOW).loc
|
|
|
29
29
|
|
|
30
30
|
const CUI_SESSION_STORAGE = cuiCreateTokenFromFactory(() => inject(CUI_WINDOW).sessionStorage);
|
|
31
31
|
|
|
32
|
-
class CuiDestroyService extends Subject {
|
|
33
|
-
ngOnDestroy() {
|
|
34
|
-
this.next();
|
|
35
|
-
this.complete();
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
CuiDestroyService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiDestroyService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
39
|
-
CuiDestroyService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiDestroyService });
|
|
40
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiDestroyService, decorators: [{
|
|
41
|
-
type: Injectable
|
|
32
|
+
class CuiDestroyService extends Subject {
|
|
33
|
+
ngOnDestroy() {
|
|
34
|
+
this.next();
|
|
35
|
+
this.complete();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
CuiDestroyService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiDestroyService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
39
|
+
CuiDestroyService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiDestroyService });
|
|
40
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiDestroyService, decorators: [{
|
|
41
|
+
type: Injectable
|
|
42
42
|
}] });
|
|
43
43
|
|
|
44
|
-
const CUI = 'cui_';
|
|
45
|
-
class CuiIdService {
|
|
46
|
-
generate() {
|
|
47
|
-
return `${CUI}${CuiIdService.autoId++}${Date.now()}`;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
CuiIdService.autoId = 0;
|
|
51
|
-
CuiIdService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiIdService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
52
|
-
CuiIdService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiIdService, providedIn: 'root' });
|
|
53
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiIdService, decorators: [{
|
|
54
|
-
type: Injectable,
|
|
55
|
-
args: [{
|
|
56
|
-
providedIn: 'root'
|
|
57
|
-
}]
|
|
44
|
+
const CUI = 'cui_';
|
|
45
|
+
class CuiIdService {
|
|
46
|
+
generate() {
|
|
47
|
+
return `${CUI}${CuiIdService.autoId++}${Date.now()}`;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
CuiIdService.autoId = 0;
|
|
51
|
+
CuiIdService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiIdService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
52
|
+
CuiIdService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiIdService, providedIn: 'root' });
|
|
53
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiIdService, decorators: [{
|
|
54
|
+
type: Injectable,
|
|
55
|
+
args: [{
|
|
56
|
+
providedIn: 'root'
|
|
57
|
+
}]
|
|
58
58
|
}] });
|
|
59
59
|
|
|
60
|
-
class CuiPopoverService {
|
|
61
|
-
constructor(items, component, options = {}) {
|
|
62
|
-
this.options = options;
|
|
63
|
-
this.cuiIdService = inject(CuiIdService);
|
|
64
|
-
this.items$ = inject(items);
|
|
65
|
-
this.component = component;
|
|
66
|
-
}
|
|
67
|
-
open(content, options = {}) {
|
|
68
|
-
return new Observable(observer => {
|
|
69
|
-
const item = Object.assign(Object.assign(Object.assign({}, this.options), options), { $implicit: observer, id: this.cuiIdService.generate(), component: this.component, content: content, completeWith: (result) => {
|
|
70
|
-
observer.next(result);
|
|
71
|
-
observer.complete();
|
|
72
|
-
} });
|
|
73
|
-
this.items$.next([...this.items$.value, item]);
|
|
74
|
-
return () => {
|
|
75
|
-
this.items$.next(this.items$.value.filter(value => value !== item));
|
|
76
|
-
};
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
CuiPopoverService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiPopoverService, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
|
|
81
|
-
CuiPopoverService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiPopoverService });
|
|
82
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiPopoverService, decorators: [{
|
|
83
|
-
type: Injectable
|
|
60
|
+
class CuiPopoverService {
|
|
61
|
+
constructor(items, component, options = {}) {
|
|
62
|
+
this.options = options;
|
|
63
|
+
this.cuiIdService = inject(CuiIdService);
|
|
64
|
+
this.items$ = inject(items);
|
|
65
|
+
this.component = component;
|
|
66
|
+
}
|
|
67
|
+
open(content, options = {}) {
|
|
68
|
+
return new Observable(observer => {
|
|
69
|
+
const item = Object.assign(Object.assign(Object.assign({}, this.options), options), { $implicit: observer, id: this.cuiIdService.generate(), component: this.component, content: content, completeWith: (result) => {
|
|
70
|
+
observer.next(result);
|
|
71
|
+
observer.complete();
|
|
72
|
+
} });
|
|
73
|
+
this.items$.next([...this.items$.value, item]);
|
|
74
|
+
return () => {
|
|
75
|
+
this.items$.next(this.items$.value.filter(value => value !== item));
|
|
76
|
+
};
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
CuiPopoverService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiPopoverService, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
|
|
81
|
+
CuiPopoverService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiPopoverService });
|
|
82
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiPopoverService, decorators: [{
|
|
83
|
+
type: Injectable
|
|
84
84
|
}], ctorParameters: function () { return [{ type: undefined }, { type: undefined }, { type: undefined }]; } });
|
|
85
85
|
|
|
86
|
-
class CuiAutoResizingDirective {
|
|
87
|
-
constructor() {
|
|
88
|
-
this.window = inject(CUI_WINDOW);
|
|
89
|
-
this.element = inject(ElementRef).nativeElement;
|
|
90
|
-
this.ngControl = inject(NgControl, { self: true, optional: true });
|
|
91
|
-
this.ngModel = inject(NgModel, { self: true, optional: true });
|
|
92
|
-
this.destroy$ = inject(CuiDestroyService, { self: true });
|
|
93
|
-
this.elementStyles = this.element.style;
|
|
94
|
-
}
|
|
95
|
-
ngOnInit() {
|
|
96
|
-
this.initNgControlValueChangeSubscription();
|
|
97
|
-
this.initNgModelValueChangeSubscription();
|
|
98
|
-
}
|
|
99
|
-
ngAfterViewInit() {
|
|
100
|
-
this.resize();
|
|
101
|
-
}
|
|
102
|
-
onInput() {
|
|
103
|
-
this.resize();
|
|
104
|
-
}
|
|
105
|
-
initNgControlValueChangeSubscription() {
|
|
106
|
-
if (!this.ngControl) {
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
this.ngControl.valueChanges
|
|
110
|
-
.pipe(takeUntil(this.destroy$))
|
|
111
|
-
.subscribe(this.resize.bind(this));
|
|
112
|
-
}
|
|
113
|
-
initNgModelValueChangeSubscription() {
|
|
114
|
-
if (!this.ngModel) {
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
this.ngModel.valueChanges
|
|
118
|
-
.pipe(takeUntil(this.destroy$))
|
|
119
|
-
.subscribe(this.resize.bind(this));
|
|
120
|
-
}
|
|
121
|
-
resize() {
|
|
122
|
-
const computedMaxHeight = this.window.getComputedStyle(this.element).maxHeight;
|
|
123
|
-
this.elementStyles.height = 'auto';
|
|
124
|
-
this.elementStyles.height = this.element.scrollHeight + 'px';
|
|
125
|
-
if (parseFloat(this.element.style.height) < parseFloat(computedMaxHeight)) {
|
|
126
|
-
this.elementStyles.overflow = 'hidden';
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
this.elementStyles.overflowY = 'scroll';
|
|
130
|
-
this.elementStyles.height = computedMaxHeight;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
CuiAutoResizingDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiAutoResizingDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
134
|
-
CuiAutoResizingDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: CuiAutoResizingDirective, isStandalone: true, selector: "textarea[cuiAutoResizing]", host: { listeners: { "input": "onInput()" } }, providers: [CuiDestroyService], ngImport: i0 });
|
|
135
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiAutoResizingDirective, decorators: [{
|
|
136
|
-
type: Directive,
|
|
137
|
-
args: [{
|
|
138
|
-
standalone: true,
|
|
139
|
-
selector: 'textarea[cuiAutoResizing]',
|
|
140
|
-
providers: [CuiDestroyService]
|
|
141
|
-
}]
|
|
142
|
-
}], propDecorators: { onInput: [{
|
|
143
|
-
type: HostListener,
|
|
144
|
-
args: ['input']
|
|
86
|
+
class CuiAutoResizingDirective {
|
|
87
|
+
constructor() {
|
|
88
|
+
this.window = inject(CUI_WINDOW);
|
|
89
|
+
this.element = inject(ElementRef).nativeElement;
|
|
90
|
+
this.ngControl = inject(NgControl, { self: true, optional: true });
|
|
91
|
+
this.ngModel = inject(NgModel, { self: true, optional: true });
|
|
92
|
+
this.destroy$ = inject(CuiDestroyService, { self: true });
|
|
93
|
+
this.elementStyles = this.element.style;
|
|
94
|
+
}
|
|
95
|
+
ngOnInit() {
|
|
96
|
+
this.initNgControlValueChangeSubscription();
|
|
97
|
+
this.initNgModelValueChangeSubscription();
|
|
98
|
+
}
|
|
99
|
+
ngAfterViewInit() {
|
|
100
|
+
this.resize();
|
|
101
|
+
}
|
|
102
|
+
onInput() {
|
|
103
|
+
this.resize();
|
|
104
|
+
}
|
|
105
|
+
initNgControlValueChangeSubscription() {
|
|
106
|
+
if (!this.ngControl) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
this.ngControl.valueChanges
|
|
110
|
+
.pipe(takeUntil(this.destroy$))
|
|
111
|
+
.subscribe(this.resize.bind(this));
|
|
112
|
+
}
|
|
113
|
+
initNgModelValueChangeSubscription() {
|
|
114
|
+
if (!this.ngModel) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
this.ngModel.valueChanges
|
|
118
|
+
.pipe(takeUntil(this.destroy$))
|
|
119
|
+
.subscribe(this.resize.bind(this));
|
|
120
|
+
}
|
|
121
|
+
resize() {
|
|
122
|
+
const computedMaxHeight = this.window.getComputedStyle(this.element).maxHeight;
|
|
123
|
+
this.elementStyles.height = 'auto';
|
|
124
|
+
this.elementStyles.height = this.element.scrollHeight + 'px';
|
|
125
|
+
if (parseFloat(this.element.style.height) < parseFloat(computedMaxHeight)) {
|
|
126
|
+
this.elementStyles.overflow = 'hidden';
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
this.elementStyles.overflowY = 'scroll';
|
|
130
|
+
this.elementStyles.height = computedMaxHeight;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
CuiAutoResizingDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiAutoResizingDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
134
|
+
CuiAutoResizingDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: CuiAutoResizingDirective, isStandalone: true, selector: "textarea[cuiAutoResizing]", host: { listeners: { "input": "onInput()" } }, providers: [CuiDestroyService], ngImport: i0 });
|
|
135
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiAutoResizingDirective, decorators: [{
|
|
136
|
+
type: Directive,
|
|
137
|
+
args: [{
|
|
138
|
+
standalone: true,
|
|
139
|
+
selector: 'textarea[cuiAutoResizing]',
|
|
140
|
+
providers: [CuiDestroyService]
|
|
141
|
+
}]
|
|
142
|
+
}], propDecorators: { onInput: [{
|
|
143
|
+
type: HostListener,
|
|
144
|
+
args: ['input']
|
|
145
145
|
}] } });
|
|
146
146
|
|
|
147
|
-
class CuiClickOutsideDirective {
|
|
148
|
-
constructor() {
|
|
149
|
-
this.element = inject(ElementRef).nativeElement;
|
|
150
|
-
this.cuiClickOutside = new EventEmitter();
|
|
151
|
-
}
|
|
152
|
-
onClickOutside(target) {
|
|
153
|
-
if (this.element.contains(target)) {
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
this.cuiClickOutside.emit(target);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
CuiClickOutsideDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiClickOutsideDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
160
|
-
CuiClickOutsideDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: CuiClickOutsideDirective, isStandalone: true, selector: "(cuiClickOutside)", outputs: { cuiClickOutside: "cuiClickOutside" }, host: { listeners: { "document:click": "onClickOutside($event.target)" } }, ngImport: i0 });
|
|
161
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiClickOutsideDirective, decorators: [{
|
|
162
|
-
type: Directive,
|
|
163
|
-
args: [{
|
|
164
|
-
standalone: true,
|
|
165
|
-
selector: '(cuiClickOutside)'
|
|
166
|
-
}]
|
|
167
|
-
}], propDecorators: { cuiClickOutside: [{
|
|
168
|
-
type: Output
|
|
169
|
-
}], onClickOutside: [{
|
|
170
|
-
type: HostListener,
|
|
171
|
-
args: ['document:click', ['$event.target']]
|
|
147
|
+
class CuiClickOutsideDirective {
|
|
148
|
+
constructor() {
|
|
149
|
+
this.element = inject(ElementRef).nativeElement;
|
|
150
|
+
this.cuiClickOutside = new EventEmitter();
|
|
151
|
+
}
|
|
152
|
+
onClickOutside(target) {
|
|
153
|
+
if (this.element.contains(target)) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
this.cuiClickOutside.emit(target);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
CuiClickOutsideDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiClickOutsideDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
160
|
+
CuiClickOutsideDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: CuiClickOutsideDirective, isStandalone: true, selector: "(cuiClickOutside)", outputs: { cuiClickOutside: "cuiClickOutside" }, host: { listeners: { "document:click": "onClickOutside($event.target)" } }, ngImport: i0 });
|
|
161
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiClickOutsideDirective, decorators: [{
|
|
162
|
+
type: Directive,
|
|
163
|
+
args: [{
|
|
164
|
+
standalone: true,
|
|
165
|
+
selector: '(cuiClickOutside)'
|
|
166
|
+
}]
|
|
167
|
+
}], propDecorators: { cuiClickOutside: [{
|
|
168
|
+
type: Output
|
|
169
|
+
}], onClickOutside: [{
|
|
170
|
+
type: HostListener,
|
|
171
|
+
args: ['document:click', ['$event.target']]
|
|
172
172
|
}] } });
|
|
173
173
|
|
|
174
|
-
class CuiDimensionsObserverDirective {
|
|
175
|
-
constructor() {
|
|
176
|
-
this.element = inject(ElementRef).nativeElement;
|
|
177
|
-
this.observer = new ResizeObserver((entries) => {
|
|
178
|
-
entries.forEach(() => this.cuiResizeObserver.emit({
|
|
179
|
-
width: this.element.offsetWidth,
|
|
180
|
-
height: this.element.offsetHeight
|
|
181
|
-
}));
|
|
182
|
-
});
|
|
183
|
-
this.cuiResizeObserver = new EventEmitter();
|
|
184
|
-
}
|
|
185
|
-
ngOnInit() {
|
|
186
|
-
this.observer.observe(this.element);
|
|
187
|
-
}
|
|
188
|
-
ngOnDestroy() {
|
|
189
|
-
this.observer.disconnect();
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
CuiDimensionsObserverDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiDimensionsObserverDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
193
|
-
CuiDimensionsObserverDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: CuiDimensionsObserverDirective, isStandalone: true, selector: "[cuiResizeObserver]", outputs: { cuiResizeObserver: "cuiResizeObserver" }, ngImport: i0 });
|
|
194
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiDimensionsObserverDirective, decorators: [{
|
|
195
|
-
type: Directive,
|
|
196
|
-
args: [{
|
|
197
|
-
standalone: true,
|
|
198
|
-
selector: '[cuiResizeObserver]'
|
|
199
|
-
}]
|
|
200
|
-
}], propDecorators: { cuiResizeObserver: [{
|
|
201
|
-
type: Output
|
|
174
|
+
class CuiDimensionsObserverDirective {
|
|
175
|
+
constructor() {
|
|
176
|
+
this.element = inject(ElementRef).nativeElement;
|
|
177
|
+
this.observer = new ResizeObserver((entries) => {
|
|
178
|
+
entries.forEach(() => this.cuiResizeObserver.emit({
|
|
179
|
+
width: this.element.offsetWidth,
|
|
180
|
+
height: this.element.offsetHeight
|
|
181
|
+
}));
|
|
182
|
+
});
|
|
183
|
+
this.cuiResizeObserver = new EventEmitter();
|
|
184
|
+
}
|
|
185
|
+
ngOnInit() {
|
|
186
|
+
this.observer.observe(this.element);
|
|
187
|
+
}
|
|
188
|
+
ngOnDestroy() {
|
|
189
|
+
this.observer.disconnect();
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
CuiDimensionsObserverDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiDimensionsObserverDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
193
|
+
CuiDimensionsObserverDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: CuiDimensionsObserverDirective, isStandalone: true, selector: "[cuiResizeObserver]", outputs: { cuiResizeObserver: "cuiResizeObserver" }, ngImport: i0 });
|
|
194
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiDimensionsObserverDirective, decorators: [{
|
|
195
|
+
type: Directive,
|
|
196
|
+
args: [{
|
|
197
|
+
standalone: true,
|
|
198
|
+
selector: '[cuiResizeObserver]'
|
|
199
|
+
}]
|
|
200
|
+
}], propDecorators: { cuiResizeObserver: [{
|
|
201
|
+
type: Output
|
|
202
202
|
}] } });
|
|
203
203
|
|
|
204
|
-
class CuiContentEditableValueAccessorDirective {
|
|
205
|
-
constructor() {
|
|
206
|
-
this.element = inject(ElementRef).nativeElement;
|
|
207
|
-
}
|
|
208
|
-
writeValue(value) {
|
|
209
|
-
this.element.innerText = value !== null && value !== void 0 ? value : '';
|
|
210
|
-
}
|
|
211
|
-
registerOnChange(fn) {
|
|
212
|
-
this.onChange = fn;
|
|
213
|
-
}
|
|
214
|
-
registerOnTouched(fn) {
|
|
215
|
-
this.onTouched = fn;
|
|
216
|
-
}
|
|
217
|
-
setDisabledState(isDisabled) {
|
|
218
|
-
this.element.contentEditable = String(!isDisabled);
|
|
219
|
-
}
|
|
220
|
-
onInput() {
|
|
221
|
-
this.onChange(this.element.innerText);
|
|
222
|
-
}
|
|
223
|
-
onBlur() {
|
|
224
|
-
this.onTouched();
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
CuiContentEditableValueAccessorDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiContentEditableValueAccessorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
228
|
-
CuiContentEditableValueAccessorDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: CuiContentEditableValueAccessorDirective, isStandalone: true, selector: "[contenteditable][formControlName], [contenteditable][formControl], [contenteditable][ngModel]", host: { listeners: { "input": "onInput()", "blur": "onBlur()" } }, providers: [cuiProvide(NG_VALUE_ACCESSOR, CuiContentEditableValueAccessorDirective, true)], ngImport: i0 });
|
|
229
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiContentEditableValueAccessorDirective, decorators: [{
|
|
230
|
-
type: Directive,
|
|
231
|
-
args: [{
|
|
232
|
-
standalone: true,
|
|
233
|
-
selector: '[contenteditable][formControlName], [contenteditable][formControl], [contenteditable][ngModel]',
|
|
234
|
-
providers: [cuiProvide(NG_VALUE_ACCESSOR, CuiContentEditableValueAccessorDirective, true)]
|
|
235
|
-
}]
|
|
236
|
-
}], propDecorators: { onInput: [{
|
|
237
|
-
type: HostListener,
|
|
238
|
-
args: ['input']
|
|
239
|
-
}], onBlur: [{
|
|
240
|
-
type: HostListener,
|
|
241
|
-
args: ['blur']
|
|
204
|
+
class CuiContentEditableValueAccessorDirective {
|
|
205
|
+
constructor() {
|
|
206
|
+
this.element = inject(ElementRef).nativeElement;
|
|
207
|
+
}
|
|
208
|
+
writeValue(value) {
|
|
209
|
+
this.element.innerText = value !== null && value !== void 0 ? value : '';
|
|
210
|
+
}
|
|
211
|
+
registerOnChange(fn) {
|
|
212
|
+
this.onChange = fn;
|
|
213
|
+
}
|
|
214
|
+
registerOnTouched(fn) {
|
|
215
|
+
this.onTouched = fn;
|
|
216
|
+
}
|
|
217
|
+
setDisabledState(isDisabled) {
|
|
218
|
+
this.element.contentEditable = String(!isDisabled);
|
|
219
|
+
}
|
|
220
|
+
onInput() {
|
|
221
|
+
this.onChange(this.element.innerText);
|
|
222
|
+
}
|
|
223
|
+
onBlur() {
|
|
224
|
+
this.onTouched();
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
CuiContentEditableValueAccessorDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiContentEditableValueAccessorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
228
|
+
CuiContentEditableValueAccessorDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: CuiContentEditableValueAccessorDirective, isStandalone: true, selector: "[contenteditable][formControlName], [contenteditable][formControl], [contenteditable][ngModel]", host: { listeners: { "input": "onInput()", "blur": "onBlur()" } }, providers: [cuiProvide(NG_VALUE_ACCESSOR, CuiContentEditableValueAccessorDirective, true)], ngImport: i0 });
|
|
229
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiContentEditableValueAccessorDirective, decorators: [{
|
|
230
|
+
type: Directive,
|
|
231
|
+
args: [{
|
|
232
|
+
standalone: true,
|
|
233
|
+
selector: '[contenteditable][formControlName], [contenteditable][formControl], [contenteditable][ngModel]',
|
|
234
|
+
providers: [cuiProvide(NG_VALUE_ACCESSOR, CuiContentEditableValueAccessorDirective, true)]
|
|
235
|
+
}]
|
|
236
|
+
}], propDecorators: { onInput: [{
|
|
237
|
+
type: HostListener,
|
|
238
|
+
args: ['input']
|
|
239
|
+
}], onBlur: [{
|
|
240
|
+
type: HostListener,
|
|
241
|
+
args: ['blur']
|
|
242
242
|
}] } });
|
|
243
243
|
|
|
244
|
-
class CuiElementDirective {
|
|
245
|
-
constructor() {
|
|
246
|
-
this.nativeElement = inject((ElementRef)).nativeElement;
|
|
247
|
-
return new ElementRef(this.nativeElement);
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
CuiElementDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiElementDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
251
|
-
CuiElementDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: CuiElementDirective, isStandalone: true, selector: "[cuiElement]", exportAs: ["elementRef"], ngImport: i0 });
|
|
252
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiElementDirective, decorators: [{
|
|
253
|
-
type: Directive,
|
|
254
|
-
args: [{
|
|
255
|
-
standalone: true,
|
|
256
|
-
selector: '[cuiElement]',
|
|
257
|
-
exportAs: 'elementRef',
|
|
258
|
-
}]
|
|
244
|
+
class CuiElementDirective {
|
|
245
|
+
constructor() {
|
|
246
|
+
this.nativeElement = inject((ElementRef)).nativeElement;
|
|
247
|
+
return new ElementRef(this.nativeElement);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
CuiElementDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiElementDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
251
|
+
CuiElementDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: CuiElementDirective, isStandalone: true, selector: "[cuiElement]", exportAs: ["elementRef"], ngImport: i0 });
|
|
252
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiElementDirective, decorators: [{
|
|
253
|
+
type: Directive,
|
|
254
|
+
args: [{
|
|
255
|
+
standalone: true,
|
|
256
|
+
selector: '[cuiElement]',
|
|
257
|
+
exportAs: 'elementRef',
|
|
258
|
+
}]
|
|
259
259
|
}], ctorParameters: function () { return []; } });
|
|
260
260
|
|
|
261
|
-
function cuiContainsOrAfter(current, node) {
|
|
262
|
-
try {
|
|
263
|
-
return (current.contains(node) ||
|
|
264
|
-
!!(node.compareDocumentPosition(current) & Node.DOCUMENT_POSITION_PRECEDING));
|
|
265
|
-
}
|
|
266
|
-
catch (_a) {
|
|
267
|
-
return false;
|
|
268
|
-
}
|
|
261
|
+
function cuiContainsOrAfter(current, node) {
|
|
262
|
+
try {
|
|
263
|
+
return (current.contains(node) ||
|
|
264
|
+
!!(node.compareDocumentPosition(current) & Node.DOCUMENT_POSITION_PRECEDING));
|
|
265
|
+
}
|
|
266
|
+
catch (_a) {
|
|
267
|
+
return false;
|
|
268
|
+
}
|
|
269
269
|
}
|
|
270
270
|
|
|
271
|
-
function cuiIsHTMLElement(node) {
|
|
272
|
-
return !!node && node instanceof node.ownerDocument.defaultView.HTMLElement;
|
|
271
|
+
function cuiIsHTMLElement(node) {
|
|
272
|
+
return !!node && node instanceof node.ownerDocument.defaultView.HTMLElement;
|
|
273
273
|
}
|
|
274
274
|
|
|
275
|
-
function cuiGetNativeFocused({ activeElement }) {
|
|
276
|
-
if (!(activeElement === null || activeElement === void 0 ? void 0 : activeElement.shadowRoot)) {
|
|
277
|
-
return activeElement;
|
|
278
|
-
}
|
|
279
|
-
let element = activeElement.shadowRoot.activeElement;
|
|
280
|
-
while (element === null || element === void 0 ? void 0 : element.shadowRoot) {
|
|
281
|
-
element = element.shadowRoot.activeElement;
|
|
282
|
-
}
|
|
283
|
-
return element;
|
|
275
|
+
function cuiGetNativeFocused({ activeElement }) {
|
|
276
|
+
if (!(activeElement === null || activeElement === void 0 ? void 0 : activeElement.shadowRoot)) {
|
|
277
|
+
return activeElement;
|
|
278
|
+
}
|
|
279
|
+
let element = activeElement.shadowRoot.activeElement;
|
|
280
|
+
while (element === null || element === void 0 ? void 0 : element.shadowRoot) {
|
|
281
|
+
element = element.shadowRoot.activeElement;
|
|
282
|
+
}
|
|
283
|
+
return element;
|
|
284
284
|
}
|
|
285
285
|
|
|
286
|
-
function cuiBlurNativeFocused(document) {
|
|
287
|
-
const activeElement = cuiGetNativeFocused(document);
|
|
288
|
-
if (cuiIsHTMLElement(activeElement)) {
|
|
289
|
-
activeElement.blur();
|
|
290
|
-
}
|
|
286
|
+
function cuiBlurNativeFocused(document) {
|
|
287
|
+
const activeElement = cuiGetNativeFocused(document);
|
|
288
|
+
if (cuiIsHTMLElement(activeElement)) {
|
|
289
|
+
activeElement.blur();
|
|
290
|
+
}
|
|
291
291
|
}
|
|
292
292
|
|
|
293
|
-
function cuiIsNativeKeyboardFocusable(element) {
|
|
294
|
-
if (element.hasAttribute('disabled') || element.getAttribute('tabIndex') === '-1') {
|
|
295
|
-
return false;
|
|
296
|
-
}
|
|
297
|
-
if ((cuiIsHTMLElement(element) && element.isContentEditable) ||
|
|
298
|
-
element.getAttribute('tabIndex') === '0') {
|
|
299
|
-
return true;
|
|
300
|
-
}
|
|
301
|
-
switch (element.tagName) {
|
|
302
|
-
case 'BUTTON':
|
|
303
|
-
case 'SELECT':
|
|
304
|
-
case 'TEXTAREA':
|
|
305
|
-
return true;
|
|
306
|
-
case 'VIDEO':
|
|
307
|
-
case 'AUDIO':
|
|
308
|
-
return element.hasAttribute('controls');
|
|
309
|
-
case 'INPUT':
|
|
310
|
-
return element.getAttribute('type') !== 'hidden';
|
|
311
|
-
case 'A':
|
|
312
|
-
case 'LINK':
|
|
313
|
-
return element.hasAttribute('href');
|
|
314
|
-
default:
|
|
315
|
-
return false;
|
|
316
|
-
}
|
|
293
|
+
function cuiIsNativeKeyboardFocusable(element) {
|
|
294
|
+
if (element.hasAttribute('disabled') || element.getAttribute('tabIndex') === '-1') {
|
|
295
|
+
return false;
|
|
296
|
+
}
|
|
297
|
+
if ((cuiIsHTMLElement(element) && element.isContentEditable) ||
|
|
298
|
+
element.getAttribute('tabIndex') === '0') {
|
|
299
|
+
return true;
|
|
300
|
+
}
|
|
301
|
+
switch (element.tagName) {
|
|
302
|
+
case 'BUTTON':
|
|
303
|
+
case 'SELECT':
|
|
304
|
+
case 'TEXTAREA':
|
|
305
|
+
return true;
|
|
306
|
+
case 'VIDEO':
|
|
307
|
+
case 'AUDIO':
|
|
308
|
+
return element.hasAttribute('controls');
|
|
309
|
+
case 'INPUT':
|
|
310
|
+
return element.getAttribute('type') !== 'hidden';
|
|
311
|
+
case 'A':
|
|
312
|
+
case 'LINK':
|
|
313
|
+
return element.hasAttribute('href');
|
|
314
|
+
default:
|
|
315
|
+
return false;
|
|
316
|
+
}
|
|
317
317
|
}
|
|
318
318
|
|
|
319
|
-
function cuiIsNativeMouseFocusable(element) {
|
|
320
|
-
return (!element.hasAttribute('disabled') &&
|
|
321
|
-
(element.getAttribute('tabIndex') === '-1' ||
|
|
322
|
-
cuiIsNativeKeyboardFocusable(element)));
|
|
319
|
+
function cuiIsNativeMouseFocusable(element) {
|
|
320
|
+
return (!element.hasAttribute('disabled') &&
|
|
321
|
+
(element.getAttribute('tabIndex') === '-1' ||
|
|
322
|
+
cuiIsNativeKeyboardFocusable(element)));
|
|
323
323
|
}
|
|
324
324
|
|
|
325
|
-
const svgNodeFilter = {
|
|
326
|
-
acceptNode(node) {
|
|
327
|
-
return 'ownerSVGElement' in node
|
|
328
|
-
? NodeFilter.FILTER_REJECT
|
|
329
|
-
: NodeFilter.FILTER_ACCEPT;
|
|
330
|
-
},
|
|
325
|
+
const svgNodeFilter = {
|
|
326
|
+
acceptNode(node) {
|
|
327
|
+
return 'ownerSVGElement' in node
|
|
328
|
+
? NodeFilter.FILTER_REJECT
|
|
329
|
+
: NodeFilter.FILTER_ACCEPT;
|
|
330
|
+
},
|
|
331
331
|
};
|
|
332
332
|
|
|
333
|
-
function cuiGetClosestFocusable({ initial, root, previous = false, keyboard = true, }) {
|
|
334
|
-
if (!root.ownerDocument) {
|
|
335
|
-
return null;
|
|
336
|
-
}
|
|
337
|
-
const check = keyboard ? cuiIsNativeKeyboardFocusable : cuiIsNativeMouseFocusable;
|
|
338
|
-
const treeWalker = root.ownerDocument.createTreeWalker(root, NodeFilter.SHOW_ELEMENT, svgNodeFilter);
|
|
339
|
-
treeWalker.currentNode = initial;
|
|
340
|
-
while (previous ? treeWalker.previousNode() : treeWalker.nextNode()) {
|
|
341
|
-
if (cuiIsHTMLElement(treeWalker.currentNode)) {
|
|
342
|
-
initial = treeWalker.currentNode;
|
|
343
|
-
}
|
|
344
|
-
if (cuiIsHTMLElement(initial) && check(initial)) {
|
|
345
|
-
return initial;
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
return null;
|
|
333
|
+
function cuiGetClosestFocusable({ initial, root, previous = false, keyboard = true, }) {
|
|
334
|
+
if (!root.ownerDocument) {
|
|
335
|
+
return null;
|
|
336
|
+
}
|
|
337
|
+
const check = keyboard ? cuiIsNativeKeyboardFocusable : cuiIsNativeMouseFocusable;
|
|
338
|
+
const treeWalker = root.ownerDocument.createTreeWalker(root, NodeFilter.SHOW_ELEMENT, svgNodeFilter);
|
|
339
|
+
treeWalker.currentNode = initial;
|
|
340
|
+
while (previous ? treeWalker.previousNode() : treeWalker.nextNode()) {
|
|
341
|
+
if (cuiIsHTMLElement(treeWalker.currentNode)) {
|
|
342
|
+
initial = treeWalker.currentNode;
|
|
343
|
+
}
|
|
344
|
+
if (cuiIsHTMLElement(initial) && check(initial)) {
|
|
345
|
+
return initial;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
return null;
|
|
349
349
|
}
|
|
350
350
|
|
|
351
|
-
class CuiFocusTrapDirective {
|
|
352
|
-
constructor() {
|
|
353
|
-
this.document = inject(DOCUMENT);
|
|
354
|
-
this.element = inject(ElementRef).nativeElement;
|
|
355
|
-
this.activeElement = cuiGetNativeFocused(this.document);
|
|
356
|
-
this.tabIndex = 0;
|
|
357
|
-
this.initElementFocus();
|
|
358
|
-
}
|
|
359
|
-
ngOnDestroy() {
|
|
360
|
-
cuiBlurNativeFocused(this.document);
|
|
361
|
-
Promise.resolve().then(() => {
|
|
362
|
-
if (!cuiIsHTMLElement(this.activeElement)) {
|
|
363
|
-
return;
|
|
364
|
-
}
|
|
365
|
-
this.activeElement.focus();
|
|
366
|
-
});
|
|
367
|
-
}
|
|
368
|
-
onFocusIn(node) {
|
|
369
|
-
var _a;
|
|
370
|
-
if (cuiContainsOrAfter(this.element, node)) {
|
|
371
|
-
return;
|
|
372
|
-
}
|
|
373
|
-
(_a = cuiGetClosestFocusable({
|
|
374
|
-
initial: this.element,
|
|
375
|
-
root: this.element,
|
|
376
|
-
})) === null || _a === void 0 ? void 0 : _a.focus();
|
|
377
|
-
}
|
|
378
|
-
initElementFocus() {
|
|
379
|
-
Promise.resolve().then(() => this.element.focus());
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
CuiFocusTrapDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiFocusTrapDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
383
|
-
CuiFocusTrapDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: CuiFocusTrapDirective, isStandalone: true, selector: "[cuiFocusTrap]", host: { listeners: { "window:focusin": "onFocusIn($event.target)" }, properties: { "tabIndex": "this.tabIndex" } }, ngImport: i0 });
|
|
384
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiFocusTrapDirective, decorators: [{
|
|
385
|
-
type: Directive,
|
|
386
|
-
args: [{
|
|
387
|
-
standalone: true,
|
|
388
|
-
selector: '[cuiFocusTrap]',
|
|
389
|
-
}]
|
|
390
|
-
}], ctorParameters: function () { return []; }, propDecorators: { tabIndex: [{
|
|
391
|
-
type: HostBinding,
|
|
392
|
-
args: ['tabIndex']
|
|
393
|
-
}], onFocusIn: [{
|
|
394
|
-
type: HostListener,
|
|
395
|
-
args: ['window:focusin', ['$event.target']]
|
|
351
|
+
class CuiFocusTrapDirective {
|
|
352
|
+
constructor() {
|
|
353
|
+
this.document = inject(DOCUMENT);
|
|
354
|
+
this.element = inject(ElementRef).nativeElement;
|
|
355
|
+
this.activeElement = cuiGetNativeFocused(this.document);
|
|
356
|
+
this.tabIndex = 0;
|
|
357
|
+
this.initElementFocus();
|
|
358
|
+
}
|
|
359
|
+
ngOnDestroy() {
|
|
360
|
+
cuiBlurNativeFocused(this.document);
|
|
361
|
+
Promise.resolve().then(() => {
|
|
362
|
+
if (!cuiIsHTMLElement(this.activeElement)) {
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
365
|
+
this.activeElement.focus();
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
onFocusIn(node) {
|
|
369
|
+
var _a;
|
|
370
|
+
if (cuiContainsOrAfter(this.element, node)) {
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
(_a = cuiGetClosestFocusable({
|
|
374
|
+
initial: this.element,
|
|
375
|
+
root: this.element,
|
|
376
|
+
})) === null || _a === void 0 ? void 0 : _a.focus();
|
|
377
|
+
}
|
|
378
|
+
initElementFocus() {
|
|
379
|
+
Promise.resolve().then(() => this.element.focus());
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
CuiFocusTrapDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiFocusTrapDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
383
|
+
CuiFocusTrapDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: CuiFocusTrapDirective, isStandalone: true, selector: "[cuiFocusTrap]", host: { listeners: { "window:focusin": "onFocusIn($event.target)" }, properties: { "tabIndex": "this.tabIndex" } }, ngImport: i0 });
|
|
384
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiFocusTrapDirective, decorators: [{
|
|
385
|
+
type: Directive,
|
|
386
|
+
args: [{
|
|
387
|
+
standalone: true,
|
|
388
|
+
selector: '[cuiFocusTrap]',
|
|
389
|
+
}]
|
|
390
|
+
}], ctorParameters: function () { return []; }, propDecorators: { tabIndex: [{
|
|
391
|
+
type: HostBinding,
|
|
392
|
+
args: ['tabIndex']
|
|
393
|
+
}], onFocusIn: [{
|
|
394
|
+
type: HostListener,
|
|
395
|
+
args: ['window:focusin', ['$event.target']]
|
|
396
396
|
}] } });
|
|
397
397
|
|
|
398
|
-
class CuiItemDirective {
|
|
399
|
-
}
|
|
400
|
-
CuiItemDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiItemDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
401
|
-
CuiItemDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: CuiItemDirective, isStandalone: true, selector: "[cuiItem]", ngImport: i0 });
|
|
402
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiItemDirective, decorators: [{
|
|
403
|
-
type: Directive,
|
|
404
|
-
args: [{
|
|
405
|
-
standalone: true,
|
|
406
|
-
selector: '[cuiItem]'
|
|
407
|
-
}]
|
|
398
|
+
class CuiItemDirective {
|
|
399
|
+
}
|
|
400
|
+
CuiItemDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiItemDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
401
|
+
CuiItemDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: CuiItemDirective, isStandalone: true, selector: "[cuiItem]", ngImport: i0 });
|
|
402
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiItemDirective, decorators: [{
|
|
403
|
+
type: Directive,
|
|
404
|
+
args: [{
|
|
405
|
+
standalone: true,
|
|
406
|
+
selector: '[cuiItem]'
|
|
407
|
+
}]
|
|
408
408
|
}] });
|
|
409
409
|
|
|
410
|
-
class CuiLetContext {
|
|
411
|
-
constructor(internalDirectiveInstance) {
|
|
412
|
-
this.internalDirectiveInstance = internalDirectiveInstance;
|
|
413
|
-
}
|
|
414
|
-
get $implicit() {
|
|
415
|
-
return this.internalDirectiveInstance.cuiLet;
|
|
416
|
-
}
|
|
417
|
-
get cuiLet() {
|
|
418
|
-
return this.internalDirectiveInstance.cuiLet;
|
|
419
|
-
}
|
|
410
|
+
class CuiLetContext {
|
|
411
|
+
constructor(internalDirectiveInstance) {
|
|
412
|
+
this.internalDirectiveInstance = internalDirectiveInstance;
|
|
413
|
+
}
|
|
414
|
+
get $implicit() {
|
|
415
|
+
return this.internalDirectiveInstance.cuiLet;
|
|
416
|
+
}
|
|
417
|
+
get cuiLet() {
|
|
418
|
+
return this.internalDirectiveInstance.cuiLet;
|
|
419
|
+
}
|
|
420
420
|
}
|
|
421
421
|
|
|
422
|
-
class CuiLetDirective {
|
|
423
|
-
constructor() {
|
|
424
|
-
inject(ViewContainerRef).createEmbeddedView(inject((TemplateRef)), new CuiLetContext(this));
|
|
425
|
-
}
|
|
426
|
-
static ngTemplateContextGuard(_dir, _ctx) {
|
|
427
|
-
return true;
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
CuiLetDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiLetDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
431
|
-
CuiLetDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: CuiLetDirective, isStandalone: true, selector: "[cuiLet]", inputs: { cuiLet: "cuiLet" }, ngImport: i0 });
|
|
432
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiLetDirective, decorators: [{
|
|
433
|
-
type: Directive,
|
|
434
|
-
args: [{
|
|
435
|
-
standalone: true,
|
|
436
|
-
selector: '[cuiLet]'
|
|
437
|
-
}]
|
|
438
|
-
}], ctorParameters: function () { return []; }, propDecorators: { cuiLet: [{
|
|
439
|
-
type: Input
|
|
422
|
+
class CuiLetDirective {
|
|
423
|
+
constructor() {
|
|
424
|
+
inject(ViewContainerRef).createEmbeddedView(inject((TemplateRef)), new CuiLetContext(this));
|
|
425
|
+
}
|
|
426
|
+
static ngTemplateContextGuard(_dir, _ctx) {
|
|
427
|
+
return true;
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
CuiLetDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiLetDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
431
|
+
CuiLetDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: CuiLetDirective, isStandalone: true, selector: "[cuiLet]", inputs: { cuiLet: "cuiLet" }, ngImport: i0 });
|
|
432
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiLetDirective, decorators: [{
|
|
433
|
+
type: Directive,
|
|
434
|
+
args: [{
|
|
435
|
+
standalone: true,
|
|
436
|
+
selector: '[cuiLet]'
|
|
437
|
+
}]
|
|
438
|
+
}], ctorParameters: function () { return []; }, propDecorators: { cuiLet: [{
|
|
439
|
+
type: Input
|
|
440
440
|
}] } });
|
|
441
441
|
|
|
442
|
-
class CuiTargetDirective {
|
|
443
|
-
constructor() {
|
|
444
|
-
this.clickListener = (event) => {
|
|
445
|
-
this.clicked.emit(event);
|
|
446
|
-
};
|
|
447
|
-
this.clicked = new EventEmitter();
|
|
448
|
-
}
|
|
449
|
-
ngOnInit() {
|
|
450
|
-
this.initClickListener();
|
|
451
|
-
}
|
|
452
|
-
ngOnDestroy() {
|
|
453
|
-
this.destroyClickListener();
|
|
454
|
-
}
|
|
455
|
-
initClickListener() {
|
|
456
|
-
this.ccTarget.addEventListener('click', this.clickListener);
|
|
457
|
-
}
|
|
458
|
-
destroyClickListener() {
|
|
459
|
-
this.ccTarget.removeEventListener('click', this.clickListener);
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
CuiTargetDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiTargetDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
463
|
-
CuiTargetDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: CuiTargetDirective, isStandalone: true, selector: "[ccTarget]", inputs: { ccTarget: "ccTarget" }, outputs: { clicked: "clicked" }, ngImport: i0 });
|
|
464
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiTargetDirective, decorators: [{
|
|
465
|
-
type: Directive,
|
|
466
|
-
args: [{
|
|
467
|
-
standalone: true,
|
|
468
|
-
selector: '[ccTarget]',
|
|
469
|
-
}]
|
|
470
|
-
}], propDecorators: { ccTarget: [{
|
|
471
|
-
type: Input
|
|
472
|
-
}], clicked: [{
|
|
473
|
-
type: Output
|
|
442
|
+
class CuiTargetDirective {
|
|
443
|
+
constructor() {
|
|
444
|
+
this.clickListener = (event) => {
|
|
445
|
+
this.clicked.emit(event);
|
|
446
|
+
};
|
|
447
|
+
this.clicked = new EventEmitter();
|
|
448
|
+
}
|
|
449
|
+
ngOnInit() {
|
|
450
|
+
this.initClickListener();
|
|
451
|
+
}
|
|
452
|
+
ngOnDestroy() {
|
|
453
|
+
this.destroyClickListener();
|
|
454
|
+
}
|
|
455
|
+
initClickListener() {
|
|
456
|
+
this.ccTarget.addEventListener('click', this.clickListener);
|
|
457
|
+
}
|
|
458
|
+
destroyClickListener() {
|
|
459
|
+
this.ccTarget.removeEventListener('click', this.clickListener);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
CuiTargetDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiTargetDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
463
|
+
CuiTargetDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: CuiTargetDirective, isStandalone: true, selector: "[ccTarget]", inputs: { ccTarget: "ccTarget" }, outputs: { clicked: "clicked" }, ngImport: i0 });
|
|
464
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiTargetDirective, decorators: [{
|
|
465
|
+
type: Directive,
|
|
466
|
+
args: [{
|
|
467
|
+
standalone: true,
|
|
468
|
+
selector: '[ccTarget]',
|
|
469
|
+
}]
|
|
470
|
+
}], propDecorators: { ccTarget: [{
|
|
471
|
+
type: Input
|
|
472
|
+
}], clicked: [{
|
|
473
|
+
type: Output
|
|
474
474
|
}] } });
|
|
475
475
|
|
|
476
|
-
class CuiFilterPipe {
|
|
477
|
-
transform(items, matcher, ...args) {
|
|
478
|
-
return items.filter(item => matcher(item, ...args));
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
CuiFilterPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiFilterPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
482
|
-
CuiFilterPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: CuiFilterPipe, isStandalone: true, name: "cuiFilter" });
|
|
483
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiFilterPipe, decorators: [{
|
|
484
|
-
type: Pipe,
|
|
485
|
-
args: [{
|
|
486
|
-
standalone: true,
|
|
487
|
-
name: 'cuiFilter'
|
|
488
|
-
}]
|
|
476
|
+
class CuiFilterPipe {
|
|
477
|
+
transform(items, matcher, ...args) {
|
|
478
|
+
return items.filter(item => matcher(item, ...args));
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
CuiFilterPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiFilterPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
482
|
+
CuiFilterPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: CuiFilterPipe, isStandalone: true, name: "cuiFilter" });
|
|
483
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiFilterPipe, decorators: [{
|
|
484
|
+
type: Pipe,
|
|
485
|
+
args: [{
|
|
486
|
+
standalone: true,
|
|
487
|
+
name: 'cuiFilter'
|
|
488
|
+
}]
|
|
489
489
|
}] });
|
|
490
490
|
|
|
491
|
-
/**
|
|
492
|
-
* Generated bundle index. Do not edit.
|
|
491
|
+
/**
|
|
492
|
+
* Generated bundle index. Do not edit.
|
|
493
493
|
*/
|
|
494
494
|
|
|
495
495
|
export { CUI_HISTORY, CUI_LOCAL_STORAGE, CUI_SESSION_STORAGE, CUI_WINDOW, CuiAutoResizingDirective, CuiClickOutsideDirective, CuiContentEditableValueAccessorDirective, CuiDestroyService, CuiDimensionsObserverDirective, CuiElementDirective, CuiFilterPipe, CuiFocusTrapDirective, CuiIdService, CuiItemDirective, CuiLetContext, CuiLetDirective, CuiPopoverService, CuiTargetDirective, cuiBlurNativeFocused, cuiContainsOrAfter, cuiCreateToken, cuiCreateTokenFromFactory, cuiGetClosestFocusable, cuiGetNativeFocused, cuiIsHTMLElement, cuiIsNativeKeyboardFocusable, cuiIsNativeMouseFocusable, cuiProvide };
|