@ng-nest/ui 20.1.6 → 20.2.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/attachments/index.d.ts +277 -0
- package/auto-complete/index.d.ts +11 -2
- package/card/index.d.ts +12 -2
- package/cascade/index.d.ts +2 -1
- package/collapse/index.d.ts +0 -3
- package/color-picker/index.d.ts +2 -1
- package/core/index.d.ts +41 -43
- package/date-picker/index.d.ts +20 -4
- package/dialog/index.d.ts +8 -10
- package/drawer/index.d.ts +10 -12
- package/dropdown/index.d.ts +32 -9
- package/fesm2022/ng-nest-ui-affix.mjs +11 -11
- package/fesm2022/ng-nest-ui-alert.mjs +13 -13
- package/fesm2022/ng-nest-ui-alert.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-anchor.mjs +18 -18
- package/fesm2022/ng-nest-ui-anchor.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-api.mjs +7 -7
- package/fesm2022/ng-nest-ui-api.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-attachments.mjs +331 -0
- package/fesm2022/ng-nest-ui-attachments.mjs.map +1 -0
- package/fesm2022/ng-nest-ui-auto-complete.mjs +36 -26
- package/fesm2022/ng-nest-ui-auto-complete.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-avatar.mjs +18 -18
- package/fesm2022/ng-nest-ui-avatar.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-back-top.mjs +12 -12
- package/fesm2022/ng-nest-ui-back-top.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-badge.mjs +13 -13
- package/fesm2022/ng-nest-ui-badge.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-base-form.mjs +8 -8
- package/fesm2022/ng-nest-ui-bubble.mjs +20 -20
- package/fesm2022/ng-nest-ui-bubble.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-button.mjs +19 -19
- package/fesm2022/ng-nest-ui-button.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-calendar.mjs +11 -11
- package/fesm2022/ng-nest-ui-card.mjs +20 -14
- package/fesm2022/ng-nest-ui-card.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-carousel.mjs +21 -21
- package/fesm2022/ng-nest-ui-carousel.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-cascade.mjs +27 -25
- package/fesm2022/ng-nest-ui-cascade.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-checkbox.mjs +12 -12
- package/fesm2022/ng-nest-ui-checkbox.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-collapse.mjs +20 -28
- package/fesm2022/ng-nest-ui-collapse.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-color-picker.mjs +31 -29
- package/fesm2022/ng-nest-ui-color-picker.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-color.mjs +11 -11
- package/fesm2022/ng-nest-ui-color.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-comment.mjs +18 -18
- package/fesm2022/ng-nest-ui-container.mjs +35 -35
- package/fesm2022/ng-nest-ui-container.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-core.mjs +48 -148
- package/fesm2022/ng-nest-ui-core.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-coversations.mjs +11 -11
- package/fesm2022/ng-nest-ui-crumb.mjs +11 -11
- package/fesm2022/ng-nest-ui-date-picker.mjs +92 -78
- package/fesm2022/ng-nest-ui-date-picker.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-description.mjs +20 -20
- package/fesm2022/ng-nest-ui-description.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-dialog.mjs +68 -67
- package/fesm2022/ng-nest-ui-dialog.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-doc.mjs +7 -7
- package/fesm2022/ng-nest-ui-doc.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-drag.mjs +11 -11
- package/fesm2022/ng-nest-ui-drawer.mjs +67 -84
- package/fesm2022/ng-nest-ui-drawer.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-dropdown.mjs +182 -58
- package/fesm2022/ng-nest-ui-dropdown.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-empty.mjs +11 -11
- package/fesm2022/ng-nest-ui-examples.mjs +7 -7
- package/fesm2022/ng-nest-ui-examples.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-find.mjs +12 -12
- package/fesm2022/ng-nest-ui-find.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-form.mjs +19 -19
- package/fesm2022/ng-nest-ui-form.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-highlight.mjs +15 -15
- package/fesm2022/ng-nest-ui-highlight.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-i18n.mjs +14 -14
- package/fesm2022/ng-nest-ui-icon.mjs +14 -14
- package/fesm2022/ng-nest-ui-icon.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-image.mjs +22 -22
- package/fesm2022/ng-nest-ui-image.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-inner.mjs +11 -11
- package/fesm2022/ng-nest-ui-inner.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-input-number.mjs +12 -12
- package/fesm2022/ng-nest-ui-input-number.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-input.mjs +19 -19
- package/fesm2022/ng-nest-ui-input.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-keyword.mjs +11 -11
- package/fesm2022/ng-nest-ui-keyword.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-layout.mjs +18 -18
- package/fesm2022/ng-nest-ui-layout.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-link.mjs +12 -12
- package/fesm2022/ng-nest-ui-link.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-list.mjs +52 -28
- package/fesm2022/ng-nest-ui-list.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-loading.mjs +12 -12
- package/fesm2022/ng-nest-ui-loading.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-menu.mjs +18 -18
- package/fesm2022/ng-nest-ui-message-box.mjs +10 -10
- package/fesm2022/ng-nest-ui-message.mjs +10 -10
- package/fesm2022/ng-nest-ui-notification.mjs +10 -10
- package/fesm2022/ng-nest-ui-outlet.mjs +8 -8
- package/fesm2022/ng-nest-ui-page-header.mjs +11 -11
- package/fesm2022/ng-nest-ui-pagination.mjs +11 -11
- package/fesm2022/ng-nest-ui-pagination.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-pattern.mjs +7 -7
- package/fesm2022/ng-nest-ui-pattern.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-popconfirm.mjs +11 -11
- package/fesm2022/ng-nest-ui-popover.mjs +25 -21
- package/fesm2022/ng-nest-ui-popover.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-portal.mjs +7 -7
- package/fesm2022/ng-nest-ui-progress.mjs +11 -11
- package/fesm2022/ng-nest-ui-prompts.mjs +17 -12
- package/fesm2022/ng-nest-ui-prompts.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-radio.mjs +12 -12
- package/fesm2022/ng-nest-ui-radio.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-rate.mjs +12 -12
- package/fesm2022/ng-nest-ui-rate.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-resizable.mjs +11 -11
- package/fesm2022/ng-nest-ui-resizable.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-result.mjs +11 -11
- package/fesm2022/ng-nest-ui-ripple.mjs +11 -11
- package/fesm2022/ng-nest-ui-ripple.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-scrollable.mjs +8 -8
- package/fesm2022/ng-nest-ui-scrollable.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-select.mjs +37 -26
- package/fesm2022/ng-nest-ui-select.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-sender.mjs +19 -18
- package/fesm2022/ng-nest-ui-sender.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-skeleton.mjs +11 -11
- package/fesm2022/ng-nest-ui-slider-select.mjs +13 -13
- package/fesm2022/ng-nest-ui-slider-select.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-slider.mjs +12 -12
- package/fesm2022/ng-nest-ui-slider.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-statistic.mjs +18 -18
- package/fesm2022/ng-nest-ui-steps.mjs +11 -11
- package/fesm2022/ng-nest-ui-suggestion.mjs +110 -0
- package/fesm2022/ng-nest-ui-suggestion.mjs.map +1 -0
- package/fesm2022/ng-nest-ui-switch.mjs +12 -12
- package/fesm2022/ng-nest-ui-switch.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-table-view.mjs +60 -60
- package/fesm2022/ng-nest-ui-table-view.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-table.mjs +58 -47
- package/fesm2022/ng-nest-ui-table.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-tabs.mjs +30 -30
- package/fesm2022/ng-nest-ui-tabs.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-tag.mjs +22 -18
- package/fesm2022/ng-nest-ui-tag.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-text-retract.mjs +11 -11
- package/fesm2022/ng-nest-ui-textarea.mjs +12 -12
- package/fesm2022/ng-nest-ui-textarea.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-theme.mjs +11 -11
- package/fesm2022/ng-nest-ui-thought-chain.mjs +121 -0
- package/fesm2022/ng-nest-ui-thought-chain.mjs.map +1 -0
- package/fesm2022/ng-nest-ui-time-ago.mjs +7 -7
- package/fesm2022/ng-nest-ui-time-picker.mjs +31 -29
- package/fesm2022/ng-nest-ui-time-picker.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-time-range.mjs +7 -7
- package/fesm2022/ng-nest-ui-timeline.mjs +36 -14
- package/fesm2022/ng-nest-ui-timeline.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-tooltip.mjs +27 -74
- package/fesm2022/ng-nest-ui-tooltip.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-transfer.mjs +12 -12
- package/fesm2022/ng-nest-ui-transfer.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-tree-file.mjs +11 -11
- package/fesm2022/ng-nest-ui-tree-select.mjs +27 -25
- package/fesm2022/ng-nest-ui-tree-select.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-tree.mjs +23 -23
- package/fesm2022/ng-nest-ui-tree.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-typography.mjs +11 -11
- package/fesm2022/ng-nest-ui-upload.mjs +221 -24
- package/fesm2022/ng-nest-ui-upload.mjs.map +1 -1
- package/fesm2022/ng-nest-ui-welcome.mjs +11 -11
- package/fesm2022/ng-nest-ui.mjs +4 -0
- package/fesm2022/ng-nest-ui.mjs.map +1 -1
- package/index.d.ts +4 -0
- package/list/index.d.ts +30 -18
- package/package.json +44 -32
- package/popover/index.d.ts +2 -1
- package/prompts/index.d.ts +17 -2
- package/select/index.d.ts +12 -2
- package/sender/index.d.ts +1 -0
- package/style/animates/base.scss +32 -0
- package/style/animates/conect.scss +32 -0
- package/style/animates/fade.scss +32 -0
- package/style/animates/index.scss +11 -0
- package/style/animates/move.scss +129 -0
- package/style/animates/opacity.scss +26 -0
- package/style/animates/slide.scss +113 -0
- package/style/core/index.css +353 -0
- package/style/core/index.css.map +1 -1
- package/style/core/index.scss +1 -6
- package/suggestion/index.d.ts +96 -0
- package/table/index.d.ts +15 -4
- package/table-view/index.d.ts +1 -1
- package/tag/index.d.ts +2 -1
- package/thought-chain/index.d.ts +107 -0
- package/time-picker/index.d.ts +2 -1
- package/timeline/index.d.ts +35 -19
- package/tooltip/index.d.ts +2 -12
- package/tree-select/index.d.ts +2 -1
- package/upload/index.d.ts +39 -2
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { input, model, output, Component, signal, inject, DestroyRef, ViewContainerRef, effect, ElementRef, HostListener, HostBinding, ChangeDetectionStrategy, ViewEncapsulation,
|
|
3
|
-
import { XPropertyFunction, XToDataArray, XToBoolean, XToCssPixelValue, XToNumber,
|
|
2
|
+
import { input, model, output, Component, signal, viewChild, inject, DestroyRef, computed, ViewContainerRef, effect, ElementRef, HostListener, HostBinding, ChangeDetectionStrategy, ViewEncapsulation, NgModule } from '@angular/core';
|
|
3
|
+
import { XPropertyFunction, XToDataArray, XToBoolean, XToCssPixelValue, XToNumber, XIsEmpty, XGetChildren, XHasChildren, XIsNull, XIsChange } from '@ng-nest/ui/core';
|
|
4
4
|
import { Subject, of } from 'rxjs';
|
|
5
5
|
import { XPortalService, XPortalConnectedPosition } from '@ng-nest/ui/portal';
|
|
6
|
-
import { takeUntil, delay, debounceTime } from 'rxjs/operators';
|
|
6
|
+
import { takeUntil, throttleTime, delay, debounceTime } from 'rxjs/operators';
|
|
7
7
|
import { Overlay } from '@angular/cdk/overlay';
|
|
8
8
|
import { XListComponent } from '@ng-nest/ui/list';
|
|
9
9
|
import * as i1 from '@angular/forms';
|
|
10
10
|
import { FormsModule } from '@angular/forms';
|
|
11
|
+
import { RIGHT_ARROW, LEFT_ARROW, ESCAPE, DOWN_ARROW } from '@angular/cdk/keycodes';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Dropdown
|
|
@@ -72,6 +73,11 @@ class XDropdownProperty extends XPropertyFunction(X_DROPDOWN_CONFIG_NAME) {
|
|
|
72
73
|
* @en_US Hover delay trigger time, only trigger is the 'hover'
|
|
73
74
|
*/
|
|
74
75
|
this.hoverDelay = input(200, ...(ngDevMode ? [{ debugName: "hoverDelay", transform: XToNumber }] : [{ transform: XToNumber }]));
|
|
76
|
+
/**
|
|
77
|
+
* @zh_CN visible 参数控制显示/隐藏
|
|
78
|
+
* @en_US visible parameter controls display/hide
|
|
79
|
+
*/
|
|
80
|
+
this.visible = model(null, ...(ngDevMode ? [{ debugName: "visible" }] : []));
|
|
75
81
|
/**
|
|
76
82
|
* @zh_CN 当前激活的菜单
|
|
77
83
|
* @en_US The currently activated menu
|
|
@@ -88,13 +94,13 @@ class XDropdownProperty extends XPropertyFunction(X_DROPDOWN_CONFIG_NAME) {
|
|
|
88
94
|
*/
|
|
89
95
|
this.nodeClick = output();
|
|
90
96
|
}
|
|
91
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
92
|
-
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.3.
|
|
97
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XDropdownProperty, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
98
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.3.5", type: XDropdownProperty, isStandalone: true, selector: "x-dropdown-property", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, trigger: { classPropertyName: "trigger", publicName: "trigger", isSignal: true, isRequired: false, transformFunction: null }, placement: { classPropertyName: "placement", publicName: "placement", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, children: { classPropertyName: "children", publicName: "children", isSignal: true, isRequired: false, transformFunction: null }, portalMinWidth: { classPropertyName: "portalMinWidth", publicName: "portalMinWidth", isSignal: true, isRequired: false, transformFunction: null }, portalMaxWidth: { classPropertyName: "portalMaxWidth", publicName: "portalMaxWidth", isSignal: true, isRequired: false, transformFunction: null }, portalMinHeight: { classPropertyName: "portalMinHeight", publicName: "portalMinHeight", isSignal: true, isRequired: false, transformFunction: null }, portalMaxHeight: { classPropertyName: "portalMaxHeight", publicName: "portalMaxHeight", isSignal: true, isRequired: false, transformFunction: null }, hoverDelay: { classPropertyName: "hoverDelay", publicName: "hoverDelay", isSignal: true, isRequired: false, transformFunction: null }, visible: { classPropertyName: "visible", publicName: "visible", isSignal: true, isRequired: false, transformFunction: null }, activatedId: { classPropertyName: "activatedId", publicName: "activatedId", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { visible: "visibleChange", activatedId: "activatedIdChange", nodeClick: "nodeClick" }, usesInheritance: true, ngImport: i0, template: '', isInline: true }); }
|
|
93
99
|
}
|
|
94
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
100
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XDropdownProperty, decorators: [{
|
|
95
101
|
type: Component,
|
|
96
102
|
args: [{ selector: `${XDropdownPrefix}-property`, template: '' }]
|
|
97
|
-
}] });
|
|
103
|
+
}], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], trigger: [{ type: i0.Input, args: [{ isSignal: true, alias: "trigger", required: false }] }], placement: [{ type: i0.Input, args: [{ isSignal: true, alias: "placement", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], children: [{ type: i0.Input, args: [{ isSignal: true, alias: "children", required: false }] }], portalMinWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "portalMinWidth", required: false }] }], portalMaxWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "portalMaxWidth", required: false }] }], portalMinHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "portalMinHeight", required: false }] }], portalMaxHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "portalMaxHeight", required: false }] }], hoverDelay: [{ type: i0.Input, args: [{ isSignal: true, alias: "hoverDelay", required: false }] }], visible: [{ type: i0.Input, args: [{ isSignal: true, alias: "visible", required: false }] }, { type: i0.Output, args: ["visibleChange"] }], activatedId: [{ type: i0.Input, args: [{ isSignal: true, alias: "activatedId", required: false }] }, { type: i0.Output, args: ["activatedIdChange"] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], nodeClick: [{ type: i0.Output, args: ["nodeClick"] }] } });
|
|
98
104
|
/**
|
|
99
105
|
* Dropdown Portal
|
|
100
106
|
* @selector x-dropdown-portal
|
|
@@ -103,9 +109,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImpor
|
|
|
103
109
|
const XDropdownPortalPrefix = 'x-dropdown-portal';
|
|
104
110
|
|
|
105
111
|
class XDropdownPortalComponent {
|
|
106
|
-
get getPlacement() {
|
|
107
|
-
return this.placement();
|
|
108
|
-
}
|
|
109
112
|
done() {
|
|
110
113
|
if (this.destroy())
|
|
111
114
|
return;
|
|
@@ -123,6 +126,8 @@ class XDropdownPortalComponent {
|
|
|
123
126
|
!this.portalAttached() && this.portalHover.emit(false);
|
|
124
127
|
}
|
|
125
128
|
constructor() {
|
|
129
|
+
this.animateEnter = 'x-connect-enter';
|
|
130
|
+
this.animateLeave = 'x-connect-leave';
|
|
126
131
|
this.data = input([], ...(ngDevMode ? [{ debugName: "data" }] : []));
|
|
127
132
|
this.trigger = input('hover', ...(ngDevMode ? [{ debugName: "trigger" }] : []));
|
|
128
133
|
this.placement = input(...(ngDevMode ? [undefined, { debugName: "placement" }] : []));
|
|
@@ -131,24 +136,41 @@ class XDropdownPortalComponent {
|
|
|
131
136
|
this.maxWidth = input(...(ngDevMode ? [undefined, { debugName: "maxWidth" }] : []));
|
|
132
137
|
this.minHeight = input(...(ngDevMode ? [undefined, { debugName: "minHeight" }] : []));
|
|
133
138
|
this.maxHeight = input(...(ngDevMode ? [undefined, { debugName: "maxHeight" }] : []));
|
|
139
|
+
this.level = input(0, ...(ngDevMode ? [{ debugName: "level" }] : []));
|
|
140
|
+
this.parentPortalComponent = input(...(ngDevMode ? [undefined, { debugName: "parentPortalComponent" }] : []));
|
|
141
|
+
this.isKeyboardControlled = model(true, ...(ngDevMode ? [{ debugName: "isKeyboardControlled" }] : []));
|
|
134
142
|
this.closed = output();
|
|
135
143
|
this.animating = output();
|
|
136
144
|
this.nodeClick = output();
|
|
137
145
|
this.portalHover = output();
|
|
138
146
|
this.node = signal(null, ...(ngDevMode ? [{ debugName: "node" }] : []));
|
|
139
|
-
this.
|
|
147
|
+
this.list = viewChild.required('list');
|
|
140
148
|
this.portalPlacement = signal(null, ...(ngDevMode ? [{ debugName: "portalPlacement" }] : []));
|
|
141
149
|
this.childAnimating = signal(false, ...(ngDevMode ? [{ debugName: "childAnimating" }] : []));
|
|
142
150
|
this.activatedId = model(...(ngDevMode ? [undefined, { debugName: "activatedId" }] : []));
|
|
143
151
|
this.destroy = signal(false, ...(ngDevMode ? [{ debugName: "destroy" }] : []));
|
|
152
|
+
this.active = signal(0, ...(ngDevMode ? [{ debugName: "active" }] : []));
|
|
144
153
|
this.unSubject = new Subject();
|
|
145
154
|
this.destroyRef = inject(DestroyRef);
|
|
155
|
+
this.activatedIdComputed = computed(() => {
|
|
156
|
+
const path = this.findPathById(this.data(), this.activatedId());
|
|
157
|
+
if (path) {
|
|
158
|
+
for (let node of path) {
|
|
159
|
+
const nd = this.data().find((x) => x.id === node.id);
|
|
160
|
+
if (nd)
|
|
161
|
+
return nd.id;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
return null;
|
|
165
|
+
}, ...(ngDevMode ? [{ debugName: "activatedIdComputed" }] : []));
|
|
146
166
|
this.portalService = inject(XPortalService);
|
|
147
167
|
this.overlay = inject(Overlay);
|
|
148
168
|
this.viewContainerRef = inject(ViewContainerRef);
|
|
149
169
|
this.portalComponent = signal(null, ...(ngDevMode ? [{ debugName: "portalComponent" }] : []));
|
|
150
170
|
this.portalOverlayRef = signal(null, ...(ngDevMode ? [{ debugName: "portalOverlayRef" }] : []));
|
|
151
171
|
effect(() => this.portalComponent()?.setInput('data', this.node()?.children));
|
|
172
|
+
effect(() => this.portalComponent()?.setInput('trigger', this.trigger()));
|
|
173
|
+
effect(() => this.portalComponent()?.setInput('level', this.level() + 1));
|
|
152
174
|
effect(() => this.portalComponent()?.setInput('minWidth', this.minWidth()));
|
|
153
175
|
effect(() => this.portalComponent()?.setInput('maxWidth', this.maxWidth()));
|
|
154
176
|
effect(() => this.portalComponent()?.setInput('minHeight', this.minHeight()));
|
|
@@ -156,19 +178,53 @@ class XDropdownPortalComponent {
|
|
|
156
178
|
effect(() => this.portalComponent()?.setInput('size', this.size()));
|
|
157
179
|
effect(() => this.portalComponent()?.setInput('placement', this.portalPlacement()));
|
|
158
180
|
effect(() => this.portalComponent()?.setInput('activatedId', this.activatedId()));
|
|
181
|
+
effect(() => this.portalComponent()?.setInput('parentPortalComponent', this));
|
|
159
182
|
}
|
|
160
183
|
ngOnInit() {
|
|
184
|
+
this.closeSubject.subscribe(() => {
|
|
185
|
+
this.data() && this.data().length > 0 && this.list().setUnActive(this.active());
|
|
186
|
+
});
|
|
187
|
+
this.keydownSubject.pipe(takeUntil(this.unSubject)).subscribe((x) => {
|
|
188
|
+
if (!this.isKeyboardControlled())
|
|
189
|
+
return;
|
|
190
|
+
const keyCode = x.keyCode;
|
|
191
|
+
const isRightArrow = [RIGHT_ARROW].includes(keyCode);
|
|
192
|
+
const isLeftArrow = [LEFT_ARROW].includes(keyCode);
|
|
193
|
+
if (isRightArrow) {
|
|
194
|
+
const item = this.list().keyManager.activeItem;
|
|
195
|
+
if (item?.leaf()) {
|
|
196
|
+
const node = item.node();
|
|
197
|
+
node.event = x;
|
|
198
|
+
node.component = item;
|
|
199
|
+
this.isKeyboardControlled.set(false);
|
|
200
|
+
this.onNodeClick(node);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
if (isLeftArrow && this.level() > 0) {
|
|
204
|
+
this.parentPortalComponent()?.isKeyboardControlled.set(true);
|
|
205
|
+
this.parentPortalComponent()?.closePortal();
|
|
206
|
+
}
|
|
207
|
+
this.data() && this.data().length > 0 && this.list().keydown(x);
|
|
208
|
+
});
|
|
161
209
|
this.destroyRef.onDestroy(() => {
|
|
162
210
|
this.destroy.set(true);
|
|
163
211
|
this.unSubject.next();
|
|
164
212
|
this.unSubject.complete();
|
|
165
213
|
});
|
|
166
214
|
}
|
|
215
|
+
ngAfterViewInit() {
|
|
216
|
+
this.list().keyManager.setFirstItemActive();
|
|
217
|
+
}
|
|
167
218
|
onNodeClick(node) {
|
|
168
219
|
this.nodeClick.emit(node);
|
|
169
220
|
if (!node.leaf) {
|
|
170
221
|
this.activatedId.set(node.id);
|
|
171
|
-
this.
|
|
222
|
+
this.closeSubject.next();
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
if (node.disabled || this.childAnimating())
|
|
226
|
+
return;
|
|
227
|
+
this.showPortal(node);
|
|
172
228
|
}
|
|
173
229
|
}
|
|
174
230
|
portalAttached() {
|
|
@@ -213,6 +269,11 @@ class XDropdownPortalComponent {
|
|
|
213
269
|
return;
|
|
214
270
|
this.portalComponent.set(componentRef);
|
|
215
271
|
this.portalOverlayRef.set(overlayRef);
|
|
272
|
+
Object.assign(componentRef.instance, {
|
|
273
|
+
closeSubject: this.closeSubject,
|
|
274
|
+
keydownSubject: this.keydownSubject,
|
|
275
|
+
parantPortal: this
|
|
276
|
+
});
|
|
216
277
|
const { closed, animating, nodeClick, portalHover, activatedId } = componentRef.instance;
|
|
217
278
|
closed.subscribe(() => this.closePortal());
|
|
218
279
|
animating.subscribe((ing) => this.childAnimating.set(ing));
|
|
@@ -231,63 +292,76 @@ class XDropdownPortalComponent {
|
|
|
231
292
|
}
|
|
232
293
|
setPlacement() {
|
|
233
294
|
return this.portalService.setPlacement({
|
|
234
|
-
elementRef: new ElementRef(this.node()?.
|
|
295
|
+
elementRef: new ElementRef(this.node()?.component?.elementRef?.nativeElement),
|
|
235
296
|
placement: ['right-start', 'right-end', 'left-start', 'left-end'],
|
|
236
297
|
transformOriginOn: 'x-dropdown-portal'
|
|
237
298
|
});
|
|
238
299
|
}
|
|
239
|
-
|
|
240
|
-
if (!node.leaf || node.disabled || this.childAnimating())
|
|
241
|
-
return;
|
|
242
|
-
if (this.timeoutHide)
|
|
243
|
-
clearTimeout(this.timeoutHide);
|
|
300
|
+
showPortal(node) {
|
|
244
301
|
if (this.portalAttached() && this.node()?.id !== node.id) {
|
|
245
|
-
this.changeOpenNode(false);
|
|
246
302
|
this.portalOverlayRef()?.dispose();
|
|
247
303
|
}
|
|
248
304
|
this.node.set(node);
|
|
249
305
|
if (!this.portalAttached()) {
|
|
250
|
-
this.openNode.set(node);
|
|
251
|
-
this.changeOpenNode(true);
|
|
252
306
|
this.createPortal();
|
|
253
307
|
}
|
|
254
308
|
}
|
|
309
|
+
onEnter(node) {
|
|
310
|
+
if (!node.leaf || node.disabled || this.trigger() === 'click' || this.childAnimating())
|
|
311
|
+
return;
|
|
312
|
+
if (this.timeoutHide)
|
|
313
|
+
clearTimeout(this.timeoutHide);
|
|
314
|
+
this.showPortal(node);
|
|
315
|
+
}
|
|
255
316
|
onLeave() {
|
|
317
|
+
if (this.trigger() !== 'hover')
|
|
318
|
+
return;
|
|
256
319
|
if (this.portalAttached()) {
|
|
257
320
|
this.timeoutHide = setTimeout(() => {
|
|
258
|
-
this.
|
|
259
|
-
this.portal?.overlayRef?.dispose();
|
|
321
|
+
this.closePortal();
|
|
260
322
|
});
|
|
261
323
|
}
|
|
262
|
-
else {
|
|
263
|
-
this.changeOpenNode(false);
|
|
264
|
-
}
|
|
265
324
|
}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
325
|
+
onActive(num) {
|
|
326
|
+
this.active.set(num);
|
|
327
|
+
}
|
|
328
|
+
onTabOut() {
|
|
329
|
+
this.closeSubject.next();
|
|
330
|
+
}
|
|
331
|
+
findPathById(nodes, id, currentPath = []) {
|
|
332
|
+
for (const node of nodes) {
|
|
333
|
+
const newPath = [...currentPath, node];
|
|
334
|
+
if (node.id === id) {
|
|
335
|
+
return newPath;
|
|
336
|
+
}
|
|
337
|
+
if (node.children && node.children.length > 0) {
|
|
338
|
+
const result = this.findPathById(node.children, id, newPath);
|
|
339
|
+
if (result) {
|
|
340
|
+
return result;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
273
343
|
}
|
|
344
|
+
return null;
|
|
274
345
|
}
|
|
275
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
276
|
-
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.
|
|
346
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XDropdownPortalComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
347
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "20.3.5", type: XDropdownPortalComponent, isStandalone: true, selector: "x-dropdown-portal", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, trigger: { classPropertyName: "trigger", publicName: "trigger", isSignal: true, isRequired: false, transformFunction: null }, placement: { classPropertyName: "placement", publicName: "placement", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, minWidth: { classPropertyName: "minWidth", publicName: "minWidth", isSignal: true, isRequired: false, transformFunction: null }, maxWidth: { classPropertyName: "maxWidth", publicName: "maxWidth", isSignal: true, isRequired: false, transformFunction: null }, minHeight: { classPropertyName: "minHeight", publicName: "minHeight", isSignal: true, isRequired: false, transformFunction: null }, maxHeight: { classPropertyName: "maxHeight", publicName: "maxHeight", isSignal: true, isRequired: false, transformFunction: null }, level: { classPropertyName: "level", publicName: "level", isSignal: true, isRequired: false, transformFunction: null }, parentPortalComponent: { classPropertyName: "parentPortalComponent", publicName: "parentPortalComponent", isSignal: true, isRequired: false, transformFunction: null }, isKeyboardControlled: { classPropertyName: "isKeyboardControlled", publicName: "isKeyboardControlled", isSignal: true, isRequired: false, transformFunction: null }, activatedId: { classPropertyName: "activatedId", publicName: "activatedId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { isKeyboardControlled: "isKeyboardControlledChange", closed: "closed", animating: "animating", nodeClick: "nodeClick", portalHover: "portalHover", activatedId: "activatedIdChange" }, host: { listeners: { "animationend": "done($event)", "animationstart": "start($event)", "mouseenter": "mouseenter()", "mouseleave": "mouseleave()" }, properties: { "animate.enter": "this.animateEnter", "animate.leave": "this.animateLeave" } }, viewQueries: [{ propertyName: "list", first: true, predicate: ["list"], descendants: true, isSignal: true }], ngImport: i0, template: "<div\r\n #dropdownPortal\r\n class=\"x-dropdown-portal\"\r\n [style.minWidth]=\"minWidth()\"\r\n [style.maxWidth]=\"maxWidth()\"\r\n [style.minHeight]=\"minHeight()\"\r\n [style.maxHeight]=\"maxHeight()\"\r\n>\r\n <x-list\r\n #list\r\n [data]=\"data()\"\r\n [ngModel]=\"activatedIdComputed()\"\r\n (nodeClick)=\"onNodeClick($event)\"\r\n (keyManagerChange)=\"onActive($event)\"\r\n (keyManagerTabOut)=\"onTabOut()\"\r\n (nodeMouseenter)=\"onEnter($event)\"\r\n (nodeMouseleave)=\"onLeave()\"\r\n [isKeyboardControlled]=\"isKeyboardControlled()\"\r\n [inPortal]=\"true\"\r\n [size]=\"size()\"\r\n ></x-list>\r\n</div>\r\n", styles: ["x-dropdown-portal{width:100%}.x-dropdown-portal{margin:.0625rem 0;color:var(--x-text);width:100%;background-color:var(--x-background-100);border-radius:var(--x-border-small-radius);box-shadow:var(--x-box-shadow);position:relative;display:flex;overflow:auto}.x-dropdown-portal .x-open-portal{background-color:var(--x-background-a200)}.x-dropdown-portal-child{margin-top:-.3125rem}.x-dropdown-portal-child>x-dropdown-portal{padding:0 .3125rem}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: XListComponent, selector: "x-list" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
277
348
|
}
|
|
278
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
349
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XDropdownPortalComponent, decorators: [{
|
|
279
350
|
type: Component,
|
|
280
|
-
args: [{ selector: `${XDropdownPortalPrefix}`, imports: [FormsModule, XListComponent], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush,
|
|
281
|
-
}], ctorParameters: () => [], propDecorators: {
|
|
351
|
+
args: [{ selector: `${XDropdownPortalPrefix}`, imports: [FormsModule, XListComponent], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\r\n #dropdownPortal\r\n class=\"x-dropdown-portal\"\r\n [style.minWidth]=\"minWidth()\"\r\n [style.maxWidth]=\"maxWidth()\"\r\n [style.minHeight]=\"minHeight()\"\r\n [style.maxHeight]=\"maxHeight()\"\r\n>\r\n <x-list\r\n #list\r\n [data]=\"data()\"\r\n [ngModel]=\"activatedIdComputed()\"\r\n (nodeClick)=\"onNodeClick($event)\"\r\n (keyManagerChange)=\"onActive($event)\"\r\n (keyManagerTabOut)=\"onTabOut()\"\r\n (nodeMouseenter)=\"onEnter($event)\"\r\n (nodeMouseleave)=\"onLeave()\"\r\n [isKeyboardControlled]=\"isKeyboardControlled()\"\r\n [inPortal]=\"true\"\r\n [size]=\"size()\"\r\n ></x-list>\r\n</div>\r\n", styles: ["x-dropdown-portal{width:100%}.x-dropdown-portal{margin:.0625rem 0;color:var(--x-text);width:100%;background-color:var(--x-background-100);border-radius:var(--x-border-small-radius);box-shadow:var(--x-box-shadow);position:relative;display:flex;overflow:auto}.x-dropdown-portal .x-open-portal{background-color:var(--x-background-a200)}.x-dropdown-portal-child{margin-top:-.3125rem}.x-dropdown-portal-child>x-dropdown-portal{padding:0 .3125rem}\n"] }]
|
|
352
|
+
}], ctorParameters: () => [], propDecorators: { animateEnter: [{
|
|
353
|
+
type: HostBinding,
|
|
354
|
+
args: ['animate.enter']
|
|
355
|
+
}], animateLeave: [{
|
|
282
356
|
type: HostBinding,
|
|
283
|
-
args: ['
|
|
357
|
+
args: ['animate.leave']
|
|
284
358
|
}], done: [{
|
|
285
359
|
type: HostListener,
|
|
286
|
-
args: ['
|
|
360
|
+
args: ['animationend', ['$event']]
|
|
287
361
|
}], start: [{
|
|
288
362
|
type: HostListener,
|
|
289
|
-
args: ['
|
|
290
|
-
}], mouseenter: [{
|
|
363
|
+
args: ['animationstart', ['$event']]
|
|
364
|
+
}], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], trigger: [{ type: i0.Input, args: [{ isSignal: true, alias: "trigger", required: false }] }], placement: [{ type: i0.Input, args: [{ isSignal: true, alias: "placement", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], minWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "minWidth", required: false }] }], maxWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxWidth", required: false }] }], minHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "minHeight", required: false }] }], maxHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxHeight", required: false }] }], level: [{ type: i0.Input, args: [{ isSignal: true, alias: "level", required: false }] }], parentPortalComponent: [{ type: i0.Input, args: [{ isSignal: true, alias: "parentPortalComponent", required: false }] }], isKeyboardControlled: [{ type: i0.Input, args: [{ isSignal: true, alias: "isKeyboardControlled", required: false }] }, { type: i0.Output, args: ["isKeyboardControlledChange"] }], closed: [{ type: i0.Output, args: ["closed"] }], animating: [{ type: i0.Output, args: ["animating"] }], nodeClick: [{ type: i0.Output, args: ["nodeClick"] }], portalHover: [{ type: i0.Output, args: ["portalHover"] }], list: [{ type: i0.ViewChild, args: ['list', { isSignal: true }] }], activatedId: [{ type: i0.Input, args: [{ isSignal: true, alias: "activatedId", required: false }] }, { type: i0.Output, args: ["activatedIdChange"] }], mouseenter: [{
|
|
291
365
|
type: HostListener,
|
|
292
366
|
args: ['mouseenter']
|
|
293
367
|
}], mouseleave: [{
|
|
@@ -310,12 +384,15 @@ class XDropdownComponent extends XDropdownProperty {
|
|
|
310
384
|
}
|
|
311
385
|
return XHasChildren(data, 0);
|
|
312
386
|
}, ...(ngDevMode ? [{ debugName: "nodes" }] : []));
|
|
313
|
-
this.visible = signal(false, ...(ngDevMode ? [{ debugName: "visible" }] : []));
|
|
314
387
|
this.animating = signal(false, ...(ngDevMode ? [{ debugName: "animating" }] : []));
|
|
388
|
+
this.visibleClass = signal(false, ...(ngDevMode ? [{ debugName: "visibleClass" }] : []));
|
|
315
389
|
this.outsideClick = signal(false, ...(ngDevMode ? [{ debugName: "outsideClick" }] : []));
|
|
390
|
+
this.isClickNodeLeaf = signal(false, ...(ngDevMode ? [{ debugName: "isClickNodeLeaf" }] : []));
|
|
316
391
|
this.minWidth = signal('0px', ...(ngDevMode ? [{ debugName: "minWidth" }] : []));
|
|
317
392
|
this.hoverDelayUnsub = new Subject();
|
|
318
393
|
this.closeSubject = new Subject();
|
|
394
|
+
this.keydownSubject = new Subject();
|
|
395
|
+
this.isNullVisible = signal(false, ...(ngDevMode ? [{ debugName: "isNullVisible" }] : []));
|
|
319
396
|
this.realPlacement = signal(null, ...(ngDevMode ? [{ debugName: "realPlacement" }] : []));
|
|
320
397
|
this.portalComponent = signal(null, ...(ngDevMode ? [{ debugName: "portalComponent" }] : []));
|
|
321
398
|
this.portalOverlayRef = signal(null, ...(ngDevMode ? [{ debugName: "portalOverlayRef" }] : []));
|
|
@@ -330,6 +407,11 @@ class XDropdownComponent extends XDropdownProperty {
|
|
|
330
407
|
}
|
|
331
408
|
ngOnInit() {
|
|
332
409
|
this.setSubject();
|
|
410
|
+
this.isNullVisible.set(XIsNull(this.visible()));
|
|
411
|
+
}
|
|
412
|
+
ngOnChanges(changes) {
|
|
413
|
+
const { visible } = changes;
|
|
414
|
+
XIsChange(visible) && this.setVisible();
|
|
333
415
|
}
|
|
334
416
|
ngOnDestroy() {
|
|
335
417
|
this.unSubject.next();
|
|
@@ -337,12 +419,40 @@ class XDropdownComponent extends XDropdownProperty {
|
|
|
337
419
|
this.hoverDelayUnsub.next();
|
|
338
420
|
this.hoverDelayUnsub.complete();
|
|
339
421
|
}
|
|
422
|
+
setVisible() {
|
|
423
|
+
if (this.disabled() || this.animating())
|
|
424
|
+
return;
|
|
425
|
+
if (this.visible()) {
|
|
426
|
+
if (this.portalAttached()) {
|
|
427
|
+
this.closeSubject.next();
|
|
428
|
+
return;
|
|
429
|
+
}
|
|
430
|
+
this.createPortal();
|
|
431
|
+
}
|
|
432
|
+
else {
|
|
433
|
+
this.closePortal();
|
|
434
|
+
}
|
|
435
|
+
}
|
|
340
436
|
setSubject() {
|
|
341
437
|
this.closeSubject.pipe(takeUntil(this.unSubject)).subscribe(() => {
|
|
342
438
|
this.closePortal();
|
|
343
439
|
});
|
|
440
|
+
this.keydownSubject.pipe(throttleTime(10), takeUntil(this.unSubject)).subscribe((x) => {
|
|
441
|
+
const keyCode = x.keyCode;
|
|
442
|
+
if (this.portalAttached() && [ESCAPE].includes(keyCode)) {
|
|
443
|
+
this.closeSubject.next();
|
|
444
|
+
}
|
|
445
|
+
if (!this.portalAttached() && [DOWN_ARROW].includes(keyCode)) {
|
|
446
|
+
if (this.disabled())
|
|
447
|
+
return;
|
|
448
|
+
this.visibleClass.set(true);
|
|
449
|
+
this.createPortal();
|
|
450
|
+
}
|
|
451
|
+
});
|
|
344
452
|
}
|
|
345
453
|
onEnter() {
|
|
454
|
+
if (!this.isNullVisible())
|
|
455
|
+
return;
|
|
346
456
|
of(true)
|
|
347
457
|
.pipe(delay(this.hoverDelay()), takeUntil(this.hoverDelayUnsub))
|
|
348
458
|
.subscribe(() => {
|
|
@@ -353,23 +463,25 @@ class XDropdownComponent extends XDropdownProperty {
|
|
|
353
463
|
this.timeoutHide = null;
|
|
354
464
|
}
|
|
355
465
|
if (!this.portal || (this.portal && !this.portalOverlayRef()?.hasAttached())) {
|
|
356
|
-
this.
|
|
466
|
+
this.visibleClass.set(true);
|
|
357
467
|
this.createPortal();
|
|
358
468
|
}
|
|
359
469
|
});
|
|
360
470
|
}
|
|
361
471
|
onLeave() {
|
|
472
|
+
if (!this.isNullVisible())
|
|
473
|
+
return;
|
|
362
474
|
this.hoverDelayUnsub.next();
|
|
363
475
|
if (this.disabled() || this.trigger() === 'click')
|
|
364
476
|
return;
|
|
365
477
|
if (this.portalOverlayRef()?.hasAttached()) {
|
|
366
478
|
this.timeoutHide = setTimeout(() => {
|
|
367
479
|
this.portalOverlayRef()?.dispose();
|
|
368
|
-
this.
|
|
480
|
+
this.visibleClass.set(false);
|
|
369
481
|
});
|
|
370
482
|
}
|
|
371
483
|
}
|
|
372
|
-
|
|
484
|
+
onClickShow() {
|
|
373
485
|
if (this.disabled() || this.trigger() === 'hover' || this.animating())
|
|
374
486
|
return;
|
|
375
487
|
if (this.trigger() === 'click' && this.portalAttached()) {
|
|
@@ -384,7 +496,7 @@ class XDropdownComponent extends XDropdownProperty {
|
|
|
384
496
|
closePortal() {
|
|
385
497
|
if (this.portalAttached()) {
|
|
386
498
|
this.portalOverlayRef()?.dispose();
|
|
387
|
-
this.
|
|
499
|
+
this.visibleClass.set(false);
|
|
388
500
|
return true;
|
|
389
501
|
}
|
|
390
502
|
return false;
|
|
@@ -409,7 +521,9 @@ class XDropdownComponent extends XDropdownProperty {
|
|
|
409
521
|
?.outsidePointerEvents()
|
|
410
522
|
.pipe(debounceTime(30), takeUntil(this.unSubject))
|
|
411
523
|
.subscribe(() => {
|
|
412
|
-
this.
|
|
524
|
+
if (!this.isClickNodeLeaf()) {
|
|
525
|
+
this.closeSubject.next();
|
|
526
|
+
}
|
|
413
527
|
});
|
|
414
528
|
}
|
|
415
529
|
this.setInstance();
|
|
@@ -431,10 +545,17 @@ class XDropdownComponent extends XDropdownProperty {
|
|
|
431
545
|
this.portalComponent.set(componentRef);
|
|
432
546
|
this.portalOverlayRef.set(overlayRef);
|
|
433
547
|
this.realPlacement.set(this.placement());
|
|
548
|
+
Object.assign(componentRef.instance, {
|
|
549
|
+
closeSubject: this.closeSubject,
|
|
550
|
+
keydownSubject: this.keydownSubject
|
|
551
|
+
});
|
|
434
552
|
const { closed, animating, nodeClick, portalHover, activatedId } = componentRef.instance;
|
|
435
553
|
closed.subscribe(() => this.closeSubject.next());
|
|
436
554
|
animating.subscribe((ing) => this.animating.set(ing));
|
|
437
|
-
nodeClick.subscribe((node) =>
|
|
555
|
+
nodeClick.subscribe((node) => {
|
|
556
|
+
this.isClickNodeLeaf.set(node.leaf);
|
|
557
|
+
this.nodeClick.emit(node);
|
|
558
|
+
});
|
|
438
559
|
activatedId.subscribe((id) => this.activatedId.set(id));
|
|
439
560
|
portalHover.subscribe((hover) => this.portalHover(hover));
|
|
440
561
|
}
|
|
@@ -446,6 +567,9 @@ class XDropdownComponent extends XDropdownProperty {
|
|
|
446
567
|
this.onLeave();
|
|
447
568
|
}
|
|
448
569
|
}
|
|
570
|
+
onKeydown($event) {
|
|
571
|
+
this.keydownSubject.next($event);
|
|
572
|
+
}
|
|
449
573
|
setPlacement() {
|
|
450
574
|
return this.portalService.setPlacement({
|
|
451
575
|
elementRef: this.dropdown(),
|
|
@@ -453,20 +577,20 @@ class XDropdownComponent extends XDropdownProperty {
|
|
|
453
577
|
transformOriginOn: 'x-dropdown-portal'
|
|
454
578
|
});
|
|
455
579
|
}
|
|
456
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
457
|
-
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "20.3.
|
|
580
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XDropdownComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
581
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "20.3.5", type: XDropdownComponent, isStandalone: true, selector: "x-dropdown", viewQueries: [{ propertyName: "dropdown", first: true, predicate: ["dropdown"], descendants: true, isSignal: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<div\r\n #dropdown\r\n class=\"x-dropdown\"\r\n [class.x-visible]=\"visibleClass()\"\r\n (mouseenter)=\"onEnter()\"\r\n (mouseleave)=\"onLeave()\"\r\n (click)=\"onClickShow()\"\r\n (keydown)=\"onKeydown($event)\"\r\n tabindex=\"-1\"\r\n>\r\n <ng-content></ng-content>\r\n</div>\r\n", styles: [".x-dropdown{margin:0;padding:0}.x-dropdown{display:inline-block}.x-dropdown.x-visible{color:var(--x-primary)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
458
582
|
}
|
|
459
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
583
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XDropdownComponent, decorators: [{
|
|
460
584
|
type: Component,
|
|
461
|
-
args: [{ selector: `${XDropdownPrefix}`, imports: [], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\r\n #dropdown\r\n class=\"x-dropdown\"\r\n [class.x-visible]=\"
|
|
462
|
-
}], ctorParameters: () => [] });
|
|
585
|
+
args: [{ selector: `${XDropdownPrefix}`, imports: [], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\r\n #dropdown\r\n class=\"x-dropdown\"\r\n [class.x-visible]=\"visibleClass()\"\r\n (mouseenter)=\"onEnter()\"\r\n (mouseleave)=\"onLeave()\"\r\n (click)=\"onClickShow()\"\r\n (keydown)=\"onKeydown($event)\"\r\n tabindex=\"-1\"\r\n>\r\n <ng-content></ng-content>\r\n</div>\r\n", styles: [".x-dropdown{margin:0;padding:0}.x-dropdown{display:inline-block}.x-dropdown.x-visible{color:var(--x-primary)}\n"] }]
|
|
586
|
+
}], ctorParameters: () => [], propDecorators: { dropdown: [{ type: i0.ViewChild, args: ['dropdown', { isSignal: true }] }] } });
|
|
463
587
|
|
|
464
588
|
class XDropdownModule {
|
|
465
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
466
|
-
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.
|
|
467
|
-
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.
|
|
589
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XDropdownModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
590
|
+
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.5", ngImport: i0, type: XDropdownModule, imports: [XDropdownComponent], exports: [XDropdownComponent] }); }
|
|
591
|
+
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XDropdownModule }); }
|
|
468
592
|
}
|
|
469
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
593
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.5", ngImport: i0, type: XDropdownModule, decorators: [{
|
|
470
594
|
type: NgModule,
|
|
471
595
|
args: [{
|
|
472
596
|
imports: [XDropdownComponent],
|