@acorex/components 6.0.0 → 6.0.5
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/alert/src/alert.component.d.ts +2 -3
- package/badge/src/badge.component.d.ts +1 -2
- package/breadcrumbs/src/breadcrumbs-item.component.d.ts +4 -6
- package/button/src/button-group.component.d.ts +4 -6
- package/button/src/button-item.component.d.ts +4 -6
- package/calendar/src/calendar.component.d.ts +1 -0
- package/color-picker/src/color-picker.component.d.ts +14 -21
- package/common/src/styles.class.d.ts +2 -2
- package/context-menu/index.d.ts +5 -0
- package/context-menu/public-api.d.ts +2 -0
- package/context-menu/src/context-menu.component.d.ts +34 -0
- package/context-menu/src/context-menu.module.d.ts +13 -0
- package/date-picker/src/datepicker.component.d.ts +11 -14
- package/decorators/public-api.d.ts +0 -1
- package/decorators/src/decorators.module.d.ts +5 -6
- package/decorators/src/header.component.d.ts +1 -1
- package/esm2020/alert/src/alert.component.mjs +5 -4
- package/esm2020/button/src/button.component.mjs +1 -1
- package/esm2020/calendar/src/calendar.component.mjs +33 -5
- package/esm2020/checkbox/src/checkbox.component.mjs +3 -3
- package/esm2020/common/src/styles.class.mjs +13 -2
- package/esm2020/context-menu/acorex-components-context-menu.mjs +5 -0
- package/esm2020/context-menu/public-api.mjs +3 -0
- package/esm2020/context-menu/src/context-menu.component.mjs +257 -0
- package/esm2020/context-menu/src/context-menu.module.mjs +36 -0
- package/esm2020/decorators/public-api.mjs +1 -2
- package/esm2020/decorators/src/decorators.module.mjs +1 -5
- package/esm2020/decorators/src/header.component.mjs +3 -3
- package/esm2020/dialog/src/dialog.component.mjs +3 -3
- package/esm2020/form/public-api.mjs +2 -2
- package/esm2020/form/src/form.component.mjs +69 -8
- package/esm2020/form/src/form.module.mjs +68 -0
- package/esm2020/menu/src/menu.component.mjs +261 -117
- package/esm2020/menu/src/menu.module.mjs +16 -8
- package/esm2020/mixin/src/base-components.class.mjs +1 -3
- package/esm2020/mixin/src/base-menu-mixin.class.mjs +11 -11
- package/esm2020/mixin/src/mixin.class.mjs +14 -14
- package/esm2020/mixin/src/selection-component.class.mjs +2 -4
- package/esm2020/mixin/src/textbox-mixin.class.mjs +1 -1
- package/esm2020/mixin/src/value-mixin.class.mjs +6 -6
- package/esm2020/number-box/src/number-box.component.mjs +14 -4
- package/esm2020/popover/src/popover.component.mjs +3 -3
- package/esm2020/popup/src/popup.component.mjs +3 -3
- package/esm2020/public-api.mjs +1 -1
- package/esm2020/radio/src/radio.component.mjs +3 -3
- package/esm2020/result/src/result.component.mjs +3 -3
- package/esm2020/search-box/src/search-box.component.mjs +3 -3
- package/esm2020/selection-list/src/selection-list.component.mjs +3 -3
- package/esm2020/tabs/src/tabs.class.mjs +1 -1
- package/esm2020/tabs/src/tabs.component.mjs +35 -16
- package/esm2020/toast/src/toast.component.mjs +4 -4
- package/esm2020/toast/src/toast.service.mjs +10 -1
- package/fesm2015/acorex-components-alert.mjs +4 -3
- package/fesm2015/acorex-components-alert.mjs.map +1 -1
- package/fesm2015/acorex-components-button.mjs.map +1 -1
- package/fesm2015/acorex-components-calendar.mjs +30 -2
- package/fesm2015/acorex-components-calendar.mjs.map +1 -1
- package/fesm2015/acorex-components-checkbox.mjs +2 -2
- package/fesm2015/acorex-components-checkbox.mjs.map +1 -1
- package/fesm2015/acorex-components-common.mjs +13 -2
- package/fesm2015/acorex-components-common.mjs.map +1 -1
- package/fesm2015/acorex-components-context-menu.mjs +297 -0
- package/fesm2015/acorex-components-context-menu.mjs.map +1 -0
- package/fesm2015/acorex-components-decorators.mjs +4 -25
- package/fesm2015/acorex-components-decorators.mjs.map +1 -1
- package/fesm2015/acorex-components-dialog.mjs +2 -2
- package/fesm2015/acorex-components-dialog.mjs.map +1 -1
- package/fesm2015/acorex-components-form.mjs +76 -14
- package/fesm2015/acorex-components-form.mjs.map +1 -1
- package/fesm2015/acorex-components-menu.mjs +276 -124
- package/fesm2015/acorex-components-menu.mjs.map +1 -1
- package/fesm2015/acorex-components-mixin.mjs +17 -21
- package/fesm2015/acorex-components-mixin.mjs.map +1 -1
- package/fesm2015/acorex-components-number-box.mjs +13 -3
- package/fesm2015/acorex-components-number-box.mjs.map +1 -1
- package/fesm2015/acorex-components-popover.mjs +2 -2
- package/fesm2015/acorex-components-popover.mjs.map +1 -1
- package/fesm2015/acorex-components-popup.mjs +2 -2
- package/fesm2015/acorex-components-popup.mjs.map +1 -1
- package/fesm2015/acorex-components-radio.mjs +2 -2
- package/fesm2015/acorex-components-radio.mjs.map +1 -1
- package/fesm2015/acorex-components-result.mjs +2 -2
- package/fesm2015/acorex-components-result.mjs.map +1 -1
- package/fesm2015/acorex-components-search-box.mjs +2 -2
- package/fesm2015/acorex-components-search-box.mjs.map +1 -1
- package/fesm2015/acorex-components-selection-list.mjs +2 -2
- package/fesm2015/acorex-components-selection-list.mjs.map +1 -1
- package/fesm2015/acorex-components-tabs.mjs +35 -16
- package/fesm2015/acorex-components-tabs.mjs.map +1 -1
- package/fesm2015/acorex-components-toast.mjs +12 -3
- package/fesm2015/acorex-components-toast.mjs.map +1 -1
- package/fesm2015/acorex-components.mjs.map +1 -1
- package/fesm2020/acorex-components-alert.mjs +4 -3
- package/fesm2020/acorex-components-alert.mjs.map +1 -1
- package/fesm2020/acorex-components-button.mjs.map +1 -1
- package/fesm2020/acorex-components-calendar.mjs +30 -2
- package/fesm2020/acorex-components-calendar.mjs.map +1 -1
- package/fesm2020/acorex-components-checkbox.mjs +2 -2
- package/fesm2020/acorex-components-checkbox.mjs.map +1 -1
- package/fesm2020/acorex-components-common.mjs +13 -2
- package/fesm2020/acorex-components-common.mjs.map +1 -1
- package/fesm2020/acorex-components-context-menu.mjs +297 -0
- package/fesm2020/acorex-components-context-menu.mjs.map +1 -0
- package/fesm2020/acorex-components-decorators.mjs +4 -25
- package/fesm2020/acorex-components-decorators.mjs.map +1 -1
- package/fesm2020/acorex-components-dialog.mjs +2 -2
- package/fesm2020/acorex-components-dialog.mjs.map +1 -1
- package/fesm2020/acorex-components-form.mjs +75 -14
- package/fesm2020/acorex-components-form.mjs.map +1 -1
- package/fesm2020/acorex-components-menu.mjs +273 -120
- package/fesm2020/acorex-components-menu.mjs.map +1 -1
- package/fesm2020/acorex-components-mixin.mjs +17 -20
- package/fesm2020/acorex-components-mixin.mjs.map +1 -1
- package/fesm2020/acorex-components-number-box.mjs +13 -3
- package/fesm2020/acorex-components-number-box.mjs.map +1 -1
- package/fesm2020/acorex-components-popover.mjs +2 -2
- package/fesm2020/acorex-components-popover.mjs.map +1 -1
- package/fesm2020/acorex-components-popup.mjs +2 -2
- package/fesm2020/acorex-components-popup.mjs.map +1 -1
- package/fesm2020/acorex-components-radio.mjs +2 -2
- package/fesm2020/acorex-components-radio.mjs.map +1 -1
- package/fesm2020/acorex-components-result.mjs +2 -2
- package/fesm2020/acorex-components-result.mjs.map +1 -1
- package/fesm2020/acorex-components-search-box.mjs +2 -2
- package/fesm2020/acorex-components-search-box.mjs.map +1 -1
- package/fesm2020/acorex-components-selection-list.mjs +2 -2
- package/fesm2020/acorex-components-selection-list.mjs.map +1 -1
- package/fesm2020/acorex-components-tabs.mjs +34 -15
- package/fesm2020/acorex-components-tabs.mjs.map +1 -1
- package/fesm2020/acorex-components-toast.mjs +12 -3
- package/fesm2020/acorex-components-toast.mjs.map +1 -1
- package/fesm2020/acorex-components.mjs.map +1 -1
- package/form/public-api.d.ts +1 -1
- package/form/src/form.component.d.ts +18 -2
- package/form/src/{form-field.module.d.ts → form.module.d.ts} +0 -0
- package/menu/src/menu.component.d.ts +21 -36
- package/menu/src/menu.module.d.ts +2 -2
- package/mixin/src/base-components.class.d.ts +1 -3
- package/mixin/src/base-menu-mixin.class.d.ts +8 -9
- package/mixin/src/button-mixin.class.d.ts +1 -2
- package/mixin/src/clickable-mixin.class.d.ts +1 -2
- package/mixin/src/color-look-mixing.class.d.ts +1 -2
- package/mixin/src/datalist-component.class.d.ts +9 -10
- package/mixin/src/dropdown-mixin.class.d.ts +1 -2
- package/mixin/src/interactive-mixin.class.d.ts +6 -5
- package/mixin/src/loading-mixin.class.d.ts +1 -2
- package/mixin/src/mixin.class.d.ts +47 -100
- package/mixin/src/page-component.class.d.ts +1 -2
- package/mixin/src/selection-component.class.d.ts +1 -2
- package/mixin/src/sizable-mixin.class.d.ts +1 -2
- package/mixin/src/textbox-mixin.class.d.ts +7 -8
- package/mixin/src/value-mixin.class.d.ts +7 -8
- package/package.json +9 -1
- package/tabs/src/tab-item.component.d.ts +1 -2
- package/tabs/src/tabs.class.d.ts +1 -0
- package/tabs/src/tabs.component.d.ts +9 -4
- package/toast/src/toast.service.d.ts +1 -0
- package/decorators/src/addon.component.d.ts +0 -8
- package/esm2020/decorators/src/addon.component.mjs +0 -21
- package/esm2020/form/src/form-field.module.mjs +0 -68
|
@@ -1,15 +1,17 @@
|
|
|
1
|
+
import { ComponentPortal } from '@angular/cdk/portal';
|
|
1
2
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Component, ChangeDetectionStrategy, ViewEncapsulation,
|
|
3
|
-
import { AXPopoverComponent, AXPopoverModule } from '@acorex/components/popover';
|
|
4
|
-
import { AXSearchBoxComponent } from '@acorex/components/search-box';
|
|
3
|
+
import { Component, ChangeDetectionStrategy, ViewEncapsulation, ContentChild, NgModule } from '@angular/core';
|
|
5
4
|
import { AXBaseMenuMixin } from '@acorex/components/mixin';
|
|
6
|
-
import * as i1 from '@angular/
|
|
5
|
+
import * as i1 from '@angular/cdk/overlay';
|
|
6
|
+
import { OverlayModule } from '@angular/cdk/overlay';
|
|
7
|
+
import * as i2 from '@acorex/core/platform';
|
|
8
|
+
import * as i3 from '@angular/common';
|
|
7
9
|
import { CommonModule } from '@angular/common';
|
|
8
|
-
import * as
|
|
10
|
+
import * as i4 from '@acorex/components/decorators';
|
|
9
11
|
import { AXDecoratorModule } from '@acorex/components/decorators';
|
|
10
|
-
import * as
|
|
12
|
+
import * as i5 from '@acorex/components/loading';
|
|
11
13
|
import { AXLoadingModule } from '@acorex/components/loading';
|
|
12
|
-
import * as
|
|
14
|
+
import * as i6 from '@acorex/core/translation';
|
|
13
15
|
import { AXTranslationModule } from '@acorex/core/translation';
|
|
14
16
|
|
|
15
17
|
/**
|
|
@@ -18,23 +20,13 @@ import { AXTranslationModule } from '@acorex/core/translation';
|
|
|
18
20
|
* @category Components
|
|
19
21
|
*/
|
|
20
22
|
class AXMenuComponent extends AXBaseMenuMixin {
|
|
21
|
-
constructor(
|
|
22
|
-
super(
|
|
23
|
-
this.
|
|
23
|
+
constructor(_elementRef, cdr, _overlay, _platform) {
|
|
24
|
+
super(_elementRef, cdr);
|
|
25
|
+
this._elementRef = _elementRef;
|
|
24
26
|
this.cdr = cdr;
|
|
25
|
-
this.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const target = document.querySelector('UL');
|
|
29
|
-
if (e.target != target) {
|
|
30
|
-
this.displayItems.forEach((element) => {
|
|
31
|
-
element.isActive = false;
|
|
32
|
-
element.isOpen = false;
|
|
33
|
-
});
|
|
34
|
-
cdr.detectChanges();
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
});
|
|
27
|
+
this._overlay = _overlay;
|
|
28
|
+
this._platform = _platform;
|
|
29
|
+
this._levelCount = 0;
|
|
38
30
|
}
|
|
39
31
|
get emptyTemplate() {
|
|
40
32
|
return this._contentEmptyTemplate;
|
|
@@ -44,140 +36,295 @@ class AXMenuComponent extends AXBaseMenuMixin {
|
|
|
44
36
|
}
|
|
45
37
|
onInit() {
|
|
46
38
|
super.onInit();
|
|
47
|
-
if (this.hasChildField) {
|
|
48
|
-
this._fetchData();
|
|
49
|
-
}
|
|
50
39
|
}
|
|
51
40
|
ngAfterViewInit() {
|
|
52
41
|
super.onViewInit();
|
|
53
42
|
}
|
|
54
|
-
|
|
55
|
-
var _a, _b;
|
|
43
|
+
_onMenuMouseEnter(e, item) {
|
|
56
44
|
if (this.isLoading) {
|
|
57
45
|
return;
|
|
58
46
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
this.openMode === 'click' &&
|
|
62
|
-
checkSpacing.closest('a')) {
|
|
63
|
-
if (this.openMode === 'click' && this.direction === 'horizontal') {
|
|
64
|
-
this.displayItems.forEach((element) => {
|
|
65
|
-
if (element[this.valueField] != item[this.valueField] &&
|
|
66
|
-
!item.parentId) {
|
|
67
|
-
element.isOpen = false;
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
this._notActive(this.displayItems);
|
|
72
|
-
if (((_a = item.children) === null || _a === void 0 ? void 0 : _a.length) > 0 || item[this.hasChildField]) {
|
|
73
|
-
if (((_b = item.children) === null || _b === void 0 ? void 0 : _b.length) > 0) {
|
|
74
|
-
if (this.openMode === 'click' && this.direction === 'horizontal') {
|
|
75
|
-
this._setParentNode(item.children, item[this.valueField]);
|
|
76
|
-
}
|
|
77
|
-
this._closeChild(item.children);
|
|
78
|
-
}
|
|
79
|
-
item.isOpen = !item.isOpen;
|
|
80
|
-
}
|
|
81
|
-
item.isActive = !item.isActive;
|
|
82
|
-
this.onMenuItemClick.emit({
|
|
83
|
-
component: this,
|
|
84
|
-
item: item,
|
|
85
|
-
nativeEvent: e,
|
|
86
|
-
});
|
|
87
|
-
if (item.isOpen && item[this.hasChildField] && !item.children) {
|
|
88
|
-
item.isLoading = true;
|
|
89
|
-
this._fetchData(item[this.valueField]).then(() => {
|
|
90
|
-
item.isLoading = false;
|
|
91
|
-
});
|
|
92
|
-
}
|
|
47
|
+
if (this.openMode === 'hover') {
|
|
48
|
+
this._handelMenuLogic(e, item);
|
|
93
49
|
}
|
|
94
50
|
e.stopPropagation();
|
|
95
51
|
e.preventDefault();
|
|
96
52
|
}
|
|
97
|
-
|
|
98
|
-
var _a, _b;
|
|
53
|
+
_onMenuClick(e, item) {
|
|
99
54
|
if (this.isLoading) {
|
|
100
55
|
return;
|
|
101
56
|
}
|
|
102
|
-
if (
|
|
103
|
-
|
|
104
|
-
if (((_b = item.children) === null || _b === void 0 ? void 0 : _b.length) > 0) {
|
|
105
|
-
this._closeChild(item.children);
|
|
106
|
-
}
|
|
107
|
-
item.isOpen = true;
|
|
108
|
-
}
|
|
109
|
-
this.onMenuItemClick.emit({
|
|
110
|
-
component: this,
|
|
111
|
-
item: item,
|
|
112
|
-
nativeEvent: e,
|
|
113
|
-
});
|
|
114
|
-
if (item.isOpen && item[this.hasChildField] && !item.children) {
|
|
115
|
-
item.isLoading = true;
|
|
116
|
-
this._fetchData(item[this.valueField]).then(() => {
|
|
117
|
-
item.isLoading = false;
|
|
118
|
-
});
|
|
119
|
-
}
|
|
57
|
+
if (this.openMode === 'click') {
|
|
58
|
+
this._handelMenuLogic(e, item);
|
|
120
59
|
}
|
|
60
|
+
this.onMenuItemClick.emit({
|
|
61
|
+
component: this,
|
|
62
|
+
item: item,
|
|
63
|
+
nativeEvent: e,
|
|
64
|
+
});
|
|
121
65
|
e.stopPropagation();
|
|
122
66
|
e.preventDefault();
|
|
123
67
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
68
|
+
_getDirection() {
|
|
69
|
+
if (this.orientation === 'horizontal' && this._levelCount === 0) {
|
|
70
|
+
return 'ax-horizontal';
|
|
71
|
+
}
|
|
72
|
+
else if (this._levelCount > 0) {
|
|
73
|
+
return 'ax-vertical ax-submenu-ul';
|
|
74
|
+
}
|
|
75
|
+
else if (this.orientation === 'sidemenu') {
|
|
76
|
+
return 'ax-side-menu';
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
return 'ax-vertical';
|
|
133
80
|
}
|
|
134
81
|
}
|
|
135
|
-
|
|
82
|
+
_removeActive(items) {
|
|
136
83
|
items.forEach((element) => {
|
|
137
84
|
var _a;
|
|
138
85
|
element.isActive = false;
|
|
139
|
-
if (((_a = element.children) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
140
|
-
this.
|
|
86
|
+
if (((_a = element === null || element === void 0 ? void 0 : element.children) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
87
|
+
this._removeActive(element.children);
|
|
141
88
|
}
|
|
142
89
|
});
|
|
143
90
|
}
|
|
144
|
-
|
|
91
|
+
_closeOpenChild(items) {
|
|
145
92
|
items.forEach((element) => {
|
|
146
93
|
var _a;
|
|
147
94
|
element.isOpen = false;
|
|
148
|
-
if (((_a = element.children) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
149
|
-
this.
|
|
95
|
+
if (((_a = element === null || element === void 0 ? void 0 : element.children) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
96
|
+
this._closeOpenChild(element.children);
|
|
150
97
|
}
|
|
151
98
|
});
|
|
152
99
|
}
|
|
153
|
-
|
|
154
|
-
|
|
100
|
+
_initParent(items, parentId) {
|
|
101
|
+
items.forEach((element) => {
|
|
155
102
|
element.parentId = parentId;
|
|
156
103
|
});
|
|
157
104
|
}
|
|
158
|
-
|
|
159
|
-
var _a;
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
105
|
+
_handelMenuLogic(e, item) {
|
|
106
|
+
var _a, _b;
|
|
107
|
+
if (!item[this.disableField] || item[this.dividerField] === false) {
|
|
108
|
+
const targetElement = e.target;
|
|
109
|
+
if ((targetElement.closest('li') && this.openMode === 'click') ||
|
|
110
|
+
(targetElement.closest('li') && this.openMode === 'hover')) {
|
|
111
|
+
if (this._overlayRef && this._oldItem !== item) {
|
|
112
|
+
this._overlayRef.detach();
|
|
113
|
+
}
|
|
114
|
+
if (this.orientation === 'horizontal') {
|
|
115
|
+
this.displayItems.forEach((element) => {
|
|
116
|
+
if (!item.parentId &&
|
|
117
|
+
item[this.valueField] !== element[this.valueField]) {
|
|
118
|
+
element.isOpen = false;
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
if (((_a = item === null || item === void 0 ? void 0 : item.children) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
123
|
+
if (this.orientation === 'horizontal') {
|
|
124
|
+
this._initParent(item.children, item[this.valueField]);
|
|
125
|
+
}
|
|
126
|
+
if (this.orientation === 'horizontal' ||
|
|
127
|
+
this.orientation === 'vertical') {
|
|
128
|
+
if (this._oldItem !== item) {
|
|
129
|
+
this._openAsOverlay(targetElement.closest('li'), item.children);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
this._closeOpenChild(item.children);
|
|
133
|
+
if (this.orientation === 'horizontal' ||
|
|
134
|
+
this.orientation === 'vertical') {
|
|
135
|
+
item.isOpen = true;
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
item.isOpen = !item.isOpen;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
this._removeActive(this.displayItems);
|
|
142
|
+
item.isActive = !item.isActive;
|
|
143
|
+
if (this.orientation === 'horizontal' ||
|
|
144
|
+
this.orientation === 'vertical') {
|
|
145
|
+
if (this._oldItem &&
|
|
146
|
+
((_b = this._oldItem) === null || _b === void 0 ? void 0 : _b.isOpen) &&
|
|
147
|
+
item[this.valueField] !== this._oldItem[this.valueField]) {
|
|
148
|
+
this._oldItem.isOpen = false;
|
|
149
|
+
}
|
|
150
|
+
this._oldItem = item;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
163
154
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
155
|
+
_openAsOverlay(targetRef, overlayItems) {
|
|
156
|
+
let positions = [];
|
|
157
|
+
if (this.orientation === 'vertical') {
|
|
158
|
+
if (this._levelCount >= 1) {
|
|
159
|
+
positions = [
|
|
160
|
+
{
|
|
161
|
+
originX: 'end',
|
|
162
|
+
originY: 'center',
|
|
163
|
+
overlayX: 'start',
|
|
164
|
+
overlayY: 'top',
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
originX: 'end',
|
|
168
|
+
originY: 'center',
|
|
169
|
+
overlayX: 'start',
|
|
170
|
+
overlayY: 'bottom',
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
originX: 'center',
|
|
174
|
+
originY: 'center',
|
|
175
|
+
overlayX: 'center',
|
|
176
|
+
overlayY: 'center',
|
|
177
|
+
},
|
|
178
|
+
];
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
positions = [
|
|
182
|
+
{
|
|
183
|
+
originX: 'end',
|
|
184
|
+
originY: 'center',
|
|
185
|
+
overlayX: 'start',
|
|
186
|
+
overlayY: 'top',
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
originX: 'end',
|
|
190
|
+
originY: 'top',
|
|
191
|
+
overlayX: 'start',
|
|
192
|
+
overlayY: 'bottom',
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
originX: 'center',
|
|
196
|
+
originY: 'center',
|
|
197
|
+
overlayX: 'center',
|
|
198
|
+
overlayY: 'center',
|
|
199
|
+
},
|
|
200
|
+
];
|
|
201
|
+
}
|
|
167
202
|
}
|
|
168
203
|
else {
|
|
169
|
-
|
|
204
|
+
if (this._levelCount >= 1) {
|
|
205
|
+
positions = [
|
|
206
|
+
{
|
|
207
|
+
originX: 'end',
|
|
208
|
+
originY: 'center',
|
|
209
|
+
overlayX: 'start',
|
|
210
|
+
overlayY: 'top',
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
originX: 'end',
|
|
214
|
+
originY: 'center',
|
|
215
|
+
overlayX: 'start',
|
|
216
|
+
overlayY: 'bottom',
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
originX: 'end',
|
|
220
|
+
originY: 'top',
|
|
221
|
+
overlayX: 'center',
|
|
222
|
+
overlayY: 'top',
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
originX: 'center',
|
|
226
|
+
originY: 'top',
|
|
227
|
+
overlayX: 'center',
|
|
228
|
+
overlayY: 'top',
|
|
229
|
+
},
|
|
230
|
+
];
|
|
231
|
+
}
|
|
232
|
+
else {
|
|
233
|
+
positions = [
|
|
234
|
+
{
|
|
235
|
+
originX: 'start',
|
|
236
|
+
originY: 'bottom',
|
|
237
|
+
overlayX: 'start',
|
|
238
|
+
overlayY: 'top',
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
originX: 'end',
|
|
242
|
+
originY: 'center',
|
|
243
|
+
overlayX: 'start',
|
|
244
|
+
overlayY: 'bottom',
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
originX: 'end',
|
|
248
|
+
originY: 'top',
|
|
249
|
+
overlayX: 'center',
|
|
250
|
+
overlayY: 'top',
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
originX: 'center',
|
|
254
|
+
originY: 'top',
|
|
255
|
+
overlayX: 'center',
|
|
256
|
+
overlayY: 'top',
|
|
257
|
+
},
|
|
258
|
+
];
|
|
259
|
+
}
|
|
170
260
|
}
|
|
261
|
+
this._overlayRef = this._overlay.create({
|
|
262
|
+
scrollStrategy: this._overlay.scrollStrategies.close(),
|
|
263
|
+
positionStrategy: this._overlay
|
|
264
|
+
.position()
|
|
265
|
+
.flexibleConnectedTo(targetRef)
|
|
266
|
+
.withPositions([...positions])
|
|
267
|
+
.withPush(false),
|
|
268
|
+
disposeOnNavigation: true,
|
|
269
|
+
panelClass: ['ax-animate-fadeIn', 'ax-animate-faster', 'ax-overlay-menu'],
|
|
270
|
+
maxHeight: 'unset',
|
|
271
|
+
hasBackdrop: false,
|
|
272
|
+
backdropClass: ['cdk-overlay-transparent-backdrop'],
|
|
273
|
+
});
|
|
274
|
+
const ref = this._overlayRef.attach(new ComponentPortal(AXMenuComponent));
|
|
275
|
+
ref.instance.items = overlayItems;
|
|
276
|
+
ref.instance.orientation = this.orientation;
|
|
277
|
+
ref.instance.openMode = 'hover';
|
|
278
|
+
ref.instance._levelCount = this._levelCount + 1;
|
|
279
|
+
ref.instance.disableField = this.disableField;
|
|
280
|
+
ref.instance.visibleField = this.visibleField;
|
|
281
|
+
ref.instance.iconField = this.iconField;
|
|
282
|
+
ref.instance.dividerField = this.dividerField;
|
|
283
|
+
ref.onDestroy(() => {
|
|
284
|
+
var _a, _b;
|
|
285
|
+
(_b = (_a = ref.instance) === null || _a === void 0 ? void 0 : _a._overlayRef) === null || _b === void 0 ? void 0 : _b.dispose();
|
|
286
|
+
});
|
|
287
|
+
this._overlayRef.outsidePointerEvents().subscribe((e) => {
|
|
288
|
+
if (this._overlayRef && this.openMode === 'click') {
|
|
289
|
+
this._close();
|
|
290
|
+
e.stopPropagation();
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
this._platform.scroll.subscribe(() => {
|
|
294
|
+
if (this._overlayRef) {
|
|
295
|
+
this._close();
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
this._platform.resize.subscribe(() => {
|
|
299
|
+
if (this._overlayRef) {
|
|
300
|
+
this._close();
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
_close() {
|
|
305
|
+
this._overlayRef.detach();
|
|
306
|
+
this._oldItem = null;
|
|
307
|
+
this.displayItems.forEach((element) => {
|
|
308
|
+
element.isOpen = false;
|
|
309
|
+
element.isActive = false;
|
|
310
|
+
});
|
|
311
|
+
this.cdr.detectChanges();
|
|
312
|
+
}
|
|
313
|
+
onDestroy() {
|
|
314
|
+
var _a;
|
|
315
|
+
(_a = this._overlayRef) === null || _a === void 0 ? void 0 : _a.detach();
|
|
171
316
|
}
|
|
172
317
|
}
|
|
173
|
-
AXMenuComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: AXMenuComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
174
|
-
AXMenuComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.2", type: AXMenuComponent, selector: "ax-menu", inputs: { disabled: "disabled", tabIndex: "tabIndex", textField: "textField", valueField: "valueField", items: "items",
|
|
318
|
+
AXMenuComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: AXMenuComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i1.Overlay }, { token: i2.AXPlatform }], target: i0.ɵɵFactoryTarget.Component });
|
|
319
|
+
AXMenuComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.2", type: AXMenuComponent, selector: "ax-menu", inputs: { disabled: "disabled", tabIndex: "tabIndex", textField: "textField", valueField: "valueField", items: "items", parentId: "parentId", iconField: "iconField", tooltip: "tooltip", isOpen: "isOpen", isActive: "isActive", visibleField: "visibleField", disableField: "disableField", hasChildField: "hasChildField", dividerField: "dividerField", openMode: "openMode", orientation: "orientation", showModal: "showModal" }, outputs: { onBlur: "onBlur", onFocus: "onFocus", onMenuItemClick: "onMenuItemClick" }, host: { classAttribute: "ax-menu" }, queries: [{ propertyName: "_contentEmptyTemplate", first: true, predicate: ["emptyTemplate"], descendants: true }, { propertyName: "_contentItemTemplate", first: true, predicate: ["itemTemplate"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<ng-container *ngIf=\"displayItems.length; else tmpEmpty\">\r\n <ul [ngClass]=\"_getDirection()\">\r\n <ng-container *ngTemplateOutlet=\"recursiveListTmpl; context:{ list: displayItems }\"></ng-container>\r\n </ul>\r\n <ng-template #recursiveListTmpl let-list=\"list\">\r\n <ng-container *ngFor=\"let item of list\">\r\n <li *ngIf=\"item[visibleField] !=false\" [class.ax-state-disabled]=\"item[disableField]\"\r\n (click)=\"_onMenuClick($event,item)\" (mouseenter)=\"_onMenuMouseEnter($event,item)\"\r\n [ngClass]=\"{'ax-state-active ': item.isActive}\">\r\n <div class=\"ax-menu-item\" *ngIf=\"itemTemplate == null else tmpItem\">\r\n <div class=\"ax-menu-item-prefix\">\r\n <ax-icon *ngIf=\"item[iconField]\" [class]=\"item[iconField]\"></ax-icon>\r\n <span>{{_getItemDisplayTextTemplte(item)}}</span>\r\n </div>\r\n <div class=\"ax-menu-item-suffix\">\r\n <ax-icon *ngIf=\"!item.isLoading\"\r\n [ngClass]=\"{'ax-ic-chevron':item?.children?.length > 0,'ax-menu-active-icon': item.isOpen}\">\r\n </ax-icon>\r\n <ax-loading *ngIf=\"item.isLoading\">\r\n </ax-loading>\r\n </div>\r\n </div>\r\n <!--------------- check for custom item template --------------->\r\n <ng-template #tmpItem>\r\n <ng-container *ngIf=\"!isLoading\">\r\n <ng-container *ngTemplateOutlet=\"itemTemplate;context: { $implicit: item }\">\r\n </ng-container>\r\n </ng-container>\r\n </ng-template>\r\n <ul *ngIf=\"item?.children?.length > 0 && item.isOpen &&!_overlayRef\"\r\n [class.ax-state-disabled]=\"item[disableField]\">\r\n <ng-container *ngTemplateOutlet=\"recursiveListTmpl; context:{ list: item.children }\">\r\n </ng-container>\r\n </ul>\r\n </li>\r\n <li class=\"ax-divider\" *ngIf=\"item[this.dividerField]\"></li>\r\n </ng-container>\r\n </ng-template>\r\n</ng-container>\r\n<ng-container *ngIf=\"isLoading\">\r\n <ng-template>\r\n <div class=\"ax-flex ax-items-center ax-justify-center ax-p-4\">\r\n <ax-loading text=\"{{ 'layout.loading.text' | trans }}\"></ax-loading>\r\n </div>\r\n </ng-template>\r\n</ng-container>\r\n\r\n<ng-template #tmpEmpty>\r\n <ng-container *ngIf=\"!isLoading\">\r\n <!--------------- check for custom template --------------->\r\n <ng-container *ngIf=\"emptyTemplate; else elseEmptyTemplate\">\r\n <ng-container *ngTemplateOutlet=\"emptyTemplate\">\r\n </ng-container>\r\n </ng-container>\r\n <ng-template #elseEmptyTemplate>\r\n <div class=\"ax-list-item\">\r\n {{ 'common.no-result-found' | trans }}\r\n </div>\r\n </ng-template>\r\n </ng-container>\r\n</ng-template>", dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i4.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "component", type: i5.AXLoadingComponent, selector: "ax-loading", inputs: ["visible", "type", "text"], outputs: ["visibleChange"] }, { kind: "pipe", type: i6.AXTranslatorPipe, name: "trans" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
175
320
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: AXMenuComponent, decorators: [{
|
|
176
321
|
type: Component,
|
|
177
|
-
args: [{ selector: 'ax-menu', inputs: [
|
|
322
|
+
args: [{ selector: 'ax-menu', inputs: [
|
|
323
|
+
'disabled',
|
|
324
|
+
'tabIndex',
|
|
325
|
+
'textField',
|
|
178
326
|
'valueField',
|
|
179
327
|
'items',
|
|
180
|
-
'id',
|
|
181
328
|
'parentId',
|
|
182
329
|
'iconField',
|
|
183
330
|
'tooltip',
|
|
@@ -186,34 +333,39 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImpor
|
|
|
186
333
|
'visibleField',
|
|
187
334
|
'disableField',
|
|
188
335
|
'hasChildField',
|
|
336
|
+
'dividerField',
|
|
189
337
|
'openMode',
|
|
190
|
-
'
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
}], _contentEmptyTemplate: [{
|
|
338
|
+
'orientation',
|
|
339
|
+
'showModal',
|
|
340
|
+
], outputs: ['onBlur', 'onFocus', 'onMenuItemClick'], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: { class: 'ax-menu' }, template: "<ng-container *ngIf=\"displayItems.length; else tmpEmpty\">\r\n <ul [ngClass]=\"_getDirection()\">\r\n <ng-container *ngTemplateOutlet=\"recursiveListTmpl; context:{ list: displayItems }\"></ng-container>\r\n </ul>\r\n <ng-template #recursiveListTmpl let-list=\"list\">\r\n <ng-container *ngFor=\"let item of list\">\r\n <li *ngIf=\"item[visibleField] !=false\" [class.ax-state-disabled]=\"item[disableField]\"\r\n (click)=\"_onMenuClick($event,item)\" (mouseenter)=\"_onMenuMouseEnter($event,item)\"\r\n [ngClass]=\"{'ax-state-active ': item.isActive}\">\r\n <div class=\"ax-menu-item\" *ngIf=\"itemTemplate == null else tmpItem\">\r\n <div class=\"ax-menu-item-prefix\">\r\n <ax-icon *ngIf=\"item[iconField]\" [class]=\"item[iconField]\"></ax-icon>\r\n <span>{{_getItemDisplayTextTemplte(item)}}</span>\r\n </div>\r\n <div class=\"ax-menu-item-suffix\">\r\n <ax-icon *ngIf=\"!item.isLoading\"\r\n [ngClass]=\"{'ax-ic-chevron':item?.children?.length > 0,'ax-menu-active-icon': item.isOpen}\">\r\n </ax-icon>\r\n <ax-loading *ngIf=\"item.isLoading\">\r\n </ax-loading>\r\n </div>\r\n </div>\r\n <!--------------- check for custom item template --------------->\r\n <ng-template #tmpItem>\r\n <ng-container *ngIf=\"!isLoading\">\r\n <ng-container *ngTemplateOutlet=\"itemTemplate;context: { $implicit: item }\">\r\n </ng-container>\r\n </ng-container>\r\n </ng-template>\r\n <ul *ngIf=\"item?.children?.length > 0 && item.isOpen &&!_overlayRef\"\r\n [class.ax-state-disabled]=\"item[disableField]\">\r\n <ng-container *ngTemplateOutlet=\"recursiveListTmpl; context:{ list: item.children }\">\r\n </ng-container>\r\n </ul>\r\n </li>\r\n <li class=\"ax-divider\" *ngIf=\"item[this.dividerField]\"></li>\r\n </ng-container>\r\n </ng-template>\r\n</ng-container>\r\n<ng-container *ngIf=\"isLoading\">\r\n <ng-template>\r\n <div class=\"ax-flex ax-items-center ax-justify-center ax-p-4\">\r\n <ax-loading text=\"{{ 'layout.loading.text' | trans }}\"></ax-loading>\r\n </div>\r\n </ng-template>\r\n</ng-container>\r\n\r\n<ng-template #tmpEmpty>\r\n <ng-container *ngIf=\"!isLoading\">\r\n <!--------------- check for custom template --------------->\r\n <ng-container *ngIf=\"emptyTemplate; else elseEmptyTemplate\">\r\n <ng-container *ngTemplateOutlet=\"emptyTemplate\">\r\n </ng-container>\r\n </ng-container>\r\n <ng-template #elseEmptyTemplate>\r\n <div class=\"ax-list-item\">\r\n {{ 'common.no-result-found' | trans }}\r\n </div>\r\n </ng-template>\r\n </ng-container>\r\n</ng-template>" }]
|
|
341
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1.Overlay }, { type: i2.AXPlatform }]; }, propDecorators: { _contentEmptyTemplate: [{
|
|
195
342
|
type: ContentChild,
|
|
196
343
|
args: ['emptyTemplate']
|
|
197
344
|
}], _contentItemTemplate: [{
|
|
198
345
|
type: ContentChild,
|
|
199
346
|
args: ['itemTemplate']
|
|
200
|
-
}], _searchBox: [{
|
|
201
|
-
type: ContentChild,
|
|
202
|
-
args: [AXSearchBoxComponent, { static: true }]
|
|
203
347
|
}] } });
|
|
204
348
|
|
|
205
349
|
const COMPONENT = [AXMenuComponent];
|
|
206
|
-
const MODULES = [
|
|
350
|
+
const MODULES = [
|
|
351
|
+
AXDecoratorModule,
|
|
352
|
+
AXLoadingModule,
|
|
353
|
+
AXTranslationModule,
|
|
354
|
+
OverlayModule,
|
|
355
|
+
];
|
|
207
356
|
class AXMenuModule {
|
|
208
357
|
}
|
|
209
358
|
AXMenuModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: AXMenuModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
210
|
-
AXMenuModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.2", ngImport: i0, type: AXMenuModule, declarations: [AXMenuComponent], imports: [CommonModule, AXDecoratorModule,
|
|
211
|
-
|
|
359
|
+
AXMenuModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.2", ngImport: i0, type: AXMenuModule, declarations: [AXMenuComponent], imports: [CommonModule, AXDecoratorModule,
|
|
360
|
+
AXLoadingModule,
|
|
361
|
+
AXTranslationModule,
|
|
362
|
+
OverlayModule], exports: [AXMenuComponent] });
|
|
363
|
+
AXMenuModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: AXMenuModule, imports: [CommonModule, MODULES] });
|
|
212
364
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: AXMenuModule, decorators: [{
|
|
213
365
|
type: NgModule,
|
|
214
366
|
args: [{
|
|
215
367
|
declarations: [...COMPONENT],
|
|
216
|
-
imports: [...MODULES
|
|
368
|
+
imports: [CommonModule, ...MODULES],
|
|
217
369
|
exports: [...COMPONENT],
|
|
218
370
|
providers: [],
|
|
219
371
|
}]
|