@ship-ui/core 0.15.14 → 0.15.16
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/fesm2022/ship-ui-core.mjs +90 -83
- package/fesm2022/ship-ui-core.mjs.map +1 -1
- package/index.d.ts +3 -3
- package/package.json +1 -1
- package/styles/components/ship-datepicker.component.scss +2 -2
- package/styles/components/ship-form-field.component.scss +4 -0
- package/styles/components/ship-menu.component.scss +1 -1
- package/styles/components/ship-popover.component.scss +21 -4
|
@@ -1038,56 +1038,62 @@ class ShipPopoverComponent {
|
|
|
1038
1038
|
...this.options(),
|
|
1039
1039
|
}), ...(ngDevMode ? [{ debugName: "defaultOptionMerge" }] : []));
|
|
1040
1040
|
this.triggerRef = viewChild.required('triggerRef');
|
|
1041
|
-
this.popoverRef = viewChild
|
|
1041
|
+
this.popoverRef = viewChild('popoverRef', ...(ngDevMode ? [{ debugName: "popoverRef" }] : []));
|
|
1042
1042
|
this.id = signal('--' + generateUniqueId(), ...(ngDevMode ? [{ debugName: "id" }] : []));
|
|
1043
1043
|
this.menuStyle = signal(null, ...(ngDevMode ? [{ debugName: "menuStyle" }] : []));
|
|
1044
1044
|
this.openAbort = null;
|
|
1045
1045
|
this.openEffect = effect(() => {
|
|
1046
|
-
const popoverEl = this.popoverRef()?.nativeElement;
|
|
1047
1046
|
const open = this.isOpen();
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
};
|
|
1056
|
-
popoverEl?.showPopover();
|
|
1057
|
-
this.#document.addEventListener('keydown', (e) => {
|
|
1058
|
-
if (e.key === 'Escape' && !this.defaultOptionMerge().closeOnEsc) {
|
|
1059
|
-
e.preventDefault();
|
|
1047
|
+
queueMicrotask(() => {
|
|
1048
|
+
const popoverEl = this.popoverRef()?.nativeElement;
|
|
1049
|
+
if (!popoverEl)
|
|
1050
|
+
return;
|
|
1051
|
+
if (open) {
|
|
1052
|
+
if (this.openAbort) {
|
|
1053
|
+
this.openAbort.abort();
|
|
1060
1054
|
}
|
|
1061
|
-
|
|
1062
|
-
|
|
1055
|
+
this.openAbort = new AbortController();
|
|
1056
|
+
const abortOptions = {
|
|
1057
|
+
signal: this.openAbort?.signal,
|
|
1058
|
+
};
|
|
1059
|
+
this.#document.addEventListener('keydown', (e) => {
|
|
1060
|
+
if (e.key === 'Escape' && !this.defaultOptionMerge().closeOnEsc) {
|
|
1061
|
+
e.preventDefault();
|
|
1062
|
+
}
|
|
1063
|
+
if (e.key === 'Escape' && this.defaultOptionMerge().closeOnEsc) {
|
|
1064
|
+
this.isOpen.set(false);
|
|
1065
|
+
}
|
|
1066
|
+
}, abortOptions);
|
|
1067
|
+
popoverEl.showPopover();
|
|
1068
|
+
if (!this.SUPPORTS_ANCHOR) {
|
|
1069
|
+
setTimeout(() => {
|
|
1070
|
+
const scrollableParent = this.#findScrollableParent(popoverEl);
|
|
1071
|
+
scrollableParent.addEventListener('scroll', () => this.#calculateMenuPosition(), abortOptions);
|
|
1072
|
+
window?.addEventListener('resize', () => this.#calculateMenuPosition(), abortOptions);
|
|
1073
|
+
this.#calculateMenuPosition();
|
|
1074
|
+
});
|
|
1063
1075
|
}
|
|
1064
|
-
}
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
}
|
|
1072
|
-
else {
|
|
1073
|
-
popoverEl.hidePopover && popoverEl.hidePopover();
|
|
1074
|
-
this.openAbort?.abort();
|
|
1075
|
-
this.closed.emit();
|
|
1076
|
-
}
|
|
1076
|
+
}
|
|
1077
|
+
else {
|
|
1078
|
+
this.closed.emit();
|
|
1079
|
+
this.openAbort?.abort();
|
|
1080
|
+
this.openAbort = null;
|
|
1081
|
+
}
|
|
1082
|
+
});
|
|
1077
1083
|
}, ...(ngDevMode ? [{ debugName: "openEffect" }] : []));
|
|
1078
1084
|
}
|
|
1079
1085
|
#document;
|
|
1080
1086
|
#BASE_SPACE;
|
|
1081
1087
|
toggleIsOpen(event) {
|
|
1082
|
-
event.preventDefault();
|
|
1083
|
-
event.stopPropagation();
|
|
1084
1088
|
if (!this.disableOpenByClick()) {
|
|
1089
|
+
event.preventDefault();
|
|
1090
|
+
event.stopPropagation();
|
|
1085
1091
|
this.isOpen.set(!this.isOpen());
|
|
1086
1092
|
}
|
|
1087
1093
|
}
|
|
1088
1094
|
eventClose($event) {
|
|
1089
|
-
|
|
1090
|
-
|
|
1095
|
+
if (!this.isOpen())
|
|
1096
|
+
return;
|
|
1091
1097
|
this.isOpen.set(false);
|
|
1092
1098
|
}
|
|
1093
1099
|
#findScrollableParent(element) {
|
|
@@ -1104,6 +1110,8 @@ class ShipPopoverComponent {
|
|
|
1104
1110
|
#calculateMenuPosition() {
|
|
1105
1111
|
const triggerRect = this.triggerRef()?.nativeElement.getBoundingClientRect();
|
|
1106
1112
|
const menuRect = this.popoverRef()?.nativeElement.getBoundingClientRect();
|
|
1113
|
+
if (!menuRect)
|
|
1114
|
+
return;
|
|
1107
1115
|
const actionLeftInViewport = triggerRect.left;
|
|
1108
1116
|
const actionBottomInViewport = triggerRect.bottom;
|
|
1109
1117
|
let newLeft = actionLeftInViewport;
|
|
@@ -1132,9 +1140,13 @@ class ShipPopoverComponent {
|
|
|
1132
1140
|
this.menuStyle.set(style);
|
|
1133
1141
|
}
|
|
1134
1142
|
}
|
|
1143
|
+
ngOnDestroy() {
|
|
1144
|
+
this.openAbort?.abort();
|
|
1145
|
+
this.openAbort = null;
|
|
1146
|
+
}
|
|
1135
1147
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: ShipPopoverComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1136
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.
|
|
1137
|
-
<div class="trigger" #triggerRef (click)="toggleIsOpen($event)">
|
|
1148
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.0", type: ShipPopoverComponent, isStandalone: true, selector: "sh-popover", inputs: { asMultiLayer: { classPropertyName: "asMultiLayer", publicName: "asMultiLayer", isSignal: true, isRequired: false, transformFunction: null }, disableOpenByClick: { classPropertyName: "disableOpenByClick", publicName: "disableOpenByClick", isSignal: true, isRequired: false, transformFunction: null }, isOpen: { classPropertyName: "isOpen", publicName: "isOpen", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { isOpen: "isOpenChange", closed: "closed" }, host: { properties: { "class.multi-layer": "asMultiLayer()" } }, viewQueries: [{ propertyName: "triggerRef", first: true, predicate: ["triggerRef"], descendants: true, isSignal: true }, { propertyName: "popoverRef", first: true, predicate: ["popoverRef"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
1149
|
+
<div class="trigger" #triggerRef [attr.popovertarget]="id() + 'hello'" (click)="toggleIsOpen($event)">
|
|
1138
1150
|
<div class="trigger-wrapper">
|
|
1139
1151
|
<ng-content select="[trigger]" />
|
|
1140
1152
|
<ng-content select="button" />
|
|
@@ -1143,10 +1155,14 @@ class ShipPopoverComponent {
|
|
|
1143
1155
|
<div class="trigger-anchor" [style.anchor-name]="id()"></div>
|
|
1144
1156
|
</div>
|
|
1145
1157
|
|
|
1146
|
-
|
|
1147
|
-
<div
|
|
1148
|
-
|
|
1149
|
-
|
|
1158
|
+
@if (isOpen()) {
|
|
1159
|
+
<div [attr.id]="id() + 'hello'" popover="manual" #popoverRef class="popover">
|
|
1160
|
+
<div class="overlay" (click)="eventClose($event)"></div>
|
|
1161
|
+
<div class="popover-content" [style.position-anchor]="id()" [style]="menuStyle()">
|
|
1162
|
+
<ng-content />
|
|
1163
|
+
</div>
|
|
1164
|
+
</div>
|
|
1165
|
+
}
|
|
1150
1166
|
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1151
1167
|
}
|
|
1152
1168
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: ShipPopoverComponent, decorators: [{
|
|
@@ -1155,7 +1171,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImpor
|
|
|
1155
1171
|
selector: 'sh-popover',
|
|
1156
1172
|
imports: [],
|
|
1157
1173
|
template: `
|
|
1158
|
-
<div class="trigger" #triggerRef (click)="toggleIsOpen($event)">
|
|
1174
|
+
<div class="trigger" #triggerRef [attr.popovertarget]="id() + 'hello'" (click)="toggleIsOpen($event)">
|
|
1159
1175
|
<div class="trigger-wrapper">
|
|
1160
1176
|
<ng-content select="[trigger]" />
|
|
1161
1177
|
<ng-content select="button" />
|
|
@@ -1164,10 +1180,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImpor
|
|
|
1164
1180
|
<div class="trigger-anchor" [style.anchor-name]="id()"></div>
|
|
1165
1181
|
</div>
|
|
1166
1182
|
|
|
1167
|
-
|
|
1168
|
-
<div
|
|
1169
|
-
|
|
1170
|
-
|
|
1183
|
+
@if (isOpen()) {
|
|
1184
|
+
<div [attr.id]="id() + 'hello'" popover="manual" #popoverRef class="popover">
|
|
1185
|
+
<div class="overlay" (click)="eventClose($event)"></div>
|
|
1186
|
+
<div class="popover-content" [style.position-anchor]="id()" [style]="menuStyle()">
|
|
1187
|
+
<ng-content />
|
|
1188
|
+
</div>
|
|
1189
|
+
</div>
|
|
1190
|
+
}
|
|
1171
1191
|
`,
|
|
1172
1192
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1173
1193
|
host: {
|
|
@@ -1233,7 +1253,6 @@ class ShipFormFieldPopoverComponent {
|
|
|
1233
1253
|
|
|
1234
1254
|
<sh-popover
|
|
1235
1255
|
[(isOpen)]="isOpen"
|
|
1236
|
-
[disableOpenByClick]="true"
|
|
1237
1256
|
(closed)="close()"
|
|
1238
1257
|
[options]="{
|
|
1239
1258
|
closeOnButton: false,
|
|
@@ -1280,7 +1299,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImpor
|
|
|
1280
1299
|
|
|
1281
1300
|
<sh-popover
|
|
1282
1301
|
[(isOpen)]="isOpen"
|
|
1283
|
-
[disableOpenByClick]="true"
|
|
1284
1302
|
(closed)="close()"
|
|
1285
1303
|
[options]="{
|
|
1286
1304
|
closeOnButton: false,
|
|
@@ -1667,7 +1685,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImpor
|
|
|
1667
1685
|
|
|
1668
1686
|
class ShipDatepickerInputComponent {
|
|
1669
1687
|
constructor() {
|
|
1670
|
-
|
|
1688
|
+
// #INIT_DATE = this.#getUTCDate(new Date());
|
|
1671
1689
|
this.ngModels = contentChild(NgModel, ...(ngDevMode ? [{ debugName: "ngModels" }] : []));
|
|
1672
1690
|
this.#datePipe = inject(DatePipe);
|
|
1673
1691
|
this.#inputRef = signal(null, ...(ngDevMode ? [{ debugName: "#inputRef" }] : []));
|
|
@@ -1682,7 +1700,7 @@ class ShipDatepickerInputComponent {
|
|
|
1682
1700
|
return null;
|
|
1683
1701
|
return this.#datePipe.transform(date, mask);
|
|
1684
1702
|
}, ...(ngDevMode ? [{ debugName: "_maskedDate" }] : []));
|
|
1685
|
-
this.internalDate = signal(
|
|
1703
|
+
this.internalDate = signal(null, ...(ngDevMode ? [{ debugName: "internalDate" }] : []));
|
|
1686
1704
|
this.isOpen = model(false, ...(ngDevMode ? [{ debugName: "isOpen" }] : []));
|
|
1687
1705
|
this.currentClass = classMutationSignal();
|
|
1688
1706
|
this.#inputObserver = contentProjectionSignal('#input-wrap input');
|
|
@@ -1708,7 +1726,6 @@ class ShipDatepickerInputComponent {
|
|
|
1708
1726
|
}
|
|
1709
1727
|
}, ...(ngDevMode ? [{ debugName: "#inputRefEffect" }] : []));
|
|
1710
1728
|
}
|
|
1711
|
-
#INIT_DATE;
|
|
1712
1729
|
#datePipe;
|
|
1713
1730
|
#inputRef;
|
|
1714
1731
|
#inputObserver;
|
|
@@ -1720,10 +1737,6 @@ class ShipDatepickerInputComponent {
|
|
|
1720
1737
|
input.dispatchEvent(new Event('input'));
|
|
1721
1738
|
}
|
|
1722
1739
|
}
|
|
1723
|
-
open($event) {
|
|
1724
|
-
$event.stopPropagation();
|
|
1725
|
-
this.isOpen.set(true);
|
|
1726
|
-
}
|
|
1727
1740
|
close() {
|
|
1728
1741
|
this.closed.emit(this.internalDate());
|
|
1729
1742
|
}
|
|
@@ -1758,7 +1771,7 @@ class ShipDatepickerInputComponent {
|
|
|
1758
1771
|
}
|
|
1759
1772
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: ShipDatepickerInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1760
1773
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.0", type: ShipDatepickerInputComponent, isStandalone: true, selector: "sh-datepicker-input", inputs: { masking: { classPropertyName: "masking", publicName: "masking", isSignal: true, isRequired: false, transformFunction: null }, isOpen: { classPropertyName: "isOpen", publicName: "isOpen", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { closed: "closed", isOpen: "isOpenChange" }, providers: [DatePipe], queries: [{ propertyName: "ngModels", first: true, predicate: NgModel, descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
1761
|
-
<sh-form-field-popover (
|
|
1774
|
+
<sh-form-field-popover (closed)="close()" [(isOpen)]="isOpen">
|
|
1762
1775
|
<ng-content select="label" ngProjectAs="label" />
|
|
1763
1776
|
|
|
1764
1777
|
<ng-content select="[prefix]" ngProjectAs="[prefix]" />
|
|
@@ -1766,7 +1779,7 @@ class ShipDatepickerInputComponent {
|
|
|
1766
1779
|
|
|
1767
1780
|
<div id="input-wrap" class="input" ngProjectAs="input">
|
|
1768
1781
|
@if (this.masking()) {
|
|
1769
|
-
<div class="masked-value"
|
|
1782
|
+
<div class="masked-value">
|
|
1770
1783
|
{{ _maskedDate() }}
|
|
1771
1784
|
</div>
|
|
1772
1785
|
}
|
|
@@ -1794,7 +1807,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImpor
|
|
|
1794
1807
|
imports: [ShipDatepickerComponent, ShipFormFieldPopoverComponent, ShipIconComponent],
|
|
1795
1808
|
providers: [DatePipe],
|
|
1796
1809
|
template: `
|
|
1797
|
-
<sh-form-field-popover (
|
|
1810
|
+
<sh-form-field-popover (closed)="close()" [(isOpen)]="isOpen">
|
|
1798
1811
|
<ng-content select="label" ngProjectAs="label" />
|
|
1799
1812
|
|
|
1800
1813
|
<ng-content select="[prefix]" ngProjectAs="[prefix]" />
|
|
@@ -1802,7 +1815,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImpor
|
|
|
1802
1815
|
|
|
1803
1816
|
<div id="input-wrap" class="input" ngProjectAs="input">
|
|
1804
1817
|
@if (this.masking()) {
|
|
1805
|
-
<div class="masked-value"
|
|
1818
|
+
<div class="masked-value">
|
|
1806
1819
|
{{ _maskedDate() }}
|
|
1807
1820
|
</div>
|
|
1808
1821
|
}
|
|
@@ -1919,10 +1932,6 @@ class ShipDaterangeInputComponent {
|
|
|
1919
1932
|
input.dispatchEvent(new Event('input', { bubbles: true }));
|
|
1920
1933
|
input.dispatchEvent(new Event('change', { bubbles: true }));
|
|
1921
1934
|
}
|
|
1922
|
-
open($event) {
|
|
1923
|
-
$event.stopPropagation();
|
|
1924
|
-
this.isOpen.set(true);
|
|
1925
|
-
}
|
|
1926
1935
|
close() {
|
|
1927
1936
|
this.closed.emit({
|
|
1928
1937
|
start: this.startDate(),
|
|
@@ -1931,11 +1940,7 @@ class ShipDaterangeInputComponent {
|
|
|
1931
1940
|
}
|
|
1932
1941
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: ShipDaterangeInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1933
1942
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.0", type: ShipDaterangeInputComponent, isStandalone: true, selector: "sh-daterange-input", inputs: { monthsToShow: { classPropertyName: "monthsToShow", publicName: "monthsToShow", isSignal: true, isRequired: false, transformFunction: null }, masking: { classPropertyName: "masking", publicName: "masking", isSignal: true, isRequired: false, transformFunction: null }, isOpen: { classPropertyName: "isOpen", publicName: "isOpen", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { closed: "closed", isOpen: "isOpenChange" }, providers: [DatePipe], queries: [{ propertyName: "startDateInputs", predicate: ["startDate"], isSignal: true }, { propertyName: "endDateInputs", predicate: ["endDate"], isSignal: true }], ngImport: i0, template: `
|
|
1934
|
-
<sh-form-field-popover
|
|
1935
|
-
[class]="'columns-' + monthsToShow()"
|
|
1936
|
-
(click)="open($event)"
|
|
1937
|
-
(closed)="close()"
|
|
1938
|
-
[(isOpen)]="isOpen">
|
|
1943
|
+
<sh-form-field-popover [class]="'columns-' + monthsToShow()" (closed)="close()" [(isOpen)]="isOpen">
|
|
1939
1944
|
<ng-content select="label" ngProjectAs="label" />
|
|
1940
1945
|
|
|
1941
1946
|
<ng-content select="[prefix]" ngProjectAs="[prefix]" />
|
|
@@ -1943,9 +1948,7 @@ class ShipDaterangeInputComponent {
|
|
|
1943
1948
|
|
|
1944
1949
|
<div class="input" ngProjectAs="input" #inputWrap>
|
|
1945
1950
|
@if (this.masking()) {
|
|
1946
|
-
<div class="masked-value" (
|
|
1947
|
-
{{ _maskedStartDate() ?? 'N/A' }} - {{ _maskedEndDate() ?? 'N/A' }}
|
|
1948
|
-
</div>
|
|
1951
|
+
<div class="masked-value">{{ _maskedStartDate() ?? 'N/A' }} - {{ _maskedEndDate() ?? 'N/A' }}</div>
|
|
1949
1952
|
}
|
|
1950
1953
|
<ng-content select="input" />
|
|
1951
1954
|
</div>
|
|
@@ -1976,11 +1979,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImpor
|
|
|
1976
1979
|
imports: [ShipDatepickerComponent, ShipFormFieldPopoverComponent, ShipIconComponent],
|
|
1977
1980
|
providers: [DatePipe],
|
|
1978
1981
|
template: `
|
|
1979
|
-
<sh-form-field-popover
|
|
1980
|
-
[class]="'columns-' + monthsToShow()"
|
|
1981
|
-
(click)="open($event)"
|
|
1982
|
-
(closed)="close()"
|
|
1983
|
-
[(isOpen)]="isOpen">
|
|
1982
|
+
<sh-form-field-popover [class]="'columns-' + monthsToShow()" (closed)="close()" [(isOpen)]="isOpen">
|
|
1984
1983
|
<ng-content select="label" ngProjectAs="label" />
|
|
1985
1984
|
|
|
1986
1985
|
<ng-content select="[prefix]" ngProjectAs="[prefix]" />
|
|
@@ -1988,9 +1987,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImpor
|
|
|
1988
1987
|
|
|
1989
1988
|
<div class="input" ngProjectAs="input" #inputWrap>
|
|
1990
1989
|
@if (this.masking()) {
|
|
1991
|
-
<div class="masked-value" (
|
|
1992
|
-
{{ _maskedStartDate() ?? 'N/A' }} - {{ _maskedEndDate() ?? 'N/A' }}
|
|
1993
|
-
</div>
|
|
1990
|
+
<div class="masked-value">{{ _maskedStartDate() ?? 'N/A' }} - {{ _maskedEndDate() ?? 'N/A' }}</div>
|
|
1994
1991
|
}
|
|
1995
1992
|
<ng-content select="input" />
|
|
1996
1993
|
</div>
|
|
@@ -2513,7 +2510,7 @@ class ShipMenuComponent {
|
|
|
2513
2510
|
this.closed = output();
|
|
2514
2511
|
this.searchable = input(false, ...(ngDevMode ? [{ debugName: "searchable" }] : []));
|
|
2515
2512
|
this.activeOptionIndex = signal(-1, ...(ngDevMode ? [{ debugName: "activeOptionIndex" }] : []));
|
|
2516
|
-
this.inputRef = viewChild('
|
|
2513
|
+
this.inputRef = viewChild('inputRef', ...(ngDevMode ? [{ debugName: "inputRef" }] : []));
|
|
2517
2514
|
this.optionsRef = viewChild('optionsRef', ...(ngDevMode ? [{ debugName: "optionsRef" }] : []));
|
|
2518
2515
|
this.options = observeChildren(this.optionsRef, this.customOptionElementSelectors);
|
|
2519
2516
|
this.optionsEl = computed(() => this.options.signal().filter((x) => !x.disabled), ...(ngDevMode ? [{ debugName: "optionsEl" }] : []));
|
|
@@ -2616,6 +2613,16 @@ class ShipMenuComponent {
|
|
|
2616
2613
|
}, ...(ngDevMode ? [{ debugName: "activeOptionIndexEffect" }] : []));
|
|
2617
2614
|
}
|
|
2618
2615
|
#renderer;
|
|
2616
|
+
toggleIsOpen(event) {
|
|
2617
|
+
event.preventDefault();
|
|
2618
|
+
event.stopPropagation();
|
|
2619
|
+
if (this.disabled())
|
|
2620
|
+
return;
|
|
2621
|
+
this.isOpen.set(!this.isOpen());
|
|
2622
|
+
if (this.searchable() && this.isOpen()) {
|
|
2623
|
+
setTimeout(() => this.inputRef()?.nativeElement.focus());
|
|
2624
|
+
}
|
|
2625
|
+
}
|
|
2619
2626
|
#calculateMatchScore(option, input) {
|
|
2620
2627
|
if (!input)
|
|
2621
2628
|
return 0;
|
|
@@ -2709,7 +2716,7 @@ class ShipMenuComponent {
|
|
|
2709
2716
|
}
|
|
2710
2717
|
}
|
|
2711
2718
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: ShipMenuComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2712
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.0", type: ShipMenuComponent, isStandalone: true, selector: "sh-menu", inputs: { asMultiLayer: { classPropertyName: "asMultiLayer", publicName: "asMultiLayer", isSignal: true, isRequired: false, transformFunction: null }, openIndicator: { classPropertyName: "openIndicator", publicName: "openIndicator", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, customOptionElementSelectors: { classPropertyName: "customOptionElementSelectors", publicName: "customOptionElementSelectors", isSignal: true, isRequired: false, transformFunction: null }, keepClickedOptionActive: { classPropertyName: "keepClickedOptionActive", publicName: "keepClickedOptionActive", isSignal: true, isRequired: false, transformFunction: null }, closeOnClick: { classPropertyName: "closeOnClick", publicName: "closeOnClick", isSignal: true, isRequired: false, transformFunction: null }, isOpen: { classPropertyName: "isOpen", publicName: "isOpen", isSignal: true, isRequired: false, transformFunction: null }, searchable: { classPropertyName: "searchable", publicName: "searchable", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { isOpen: "isOpenChange", closed: "closed" }, host: { properties: { "class.disabled": "disabled()", "class.has-search": "searchable()", "class.multi-layer": "asMultiLayer()" } }, viewQueries: [{ propertyName: "inputRef", first: true, predicate: ["
|
|
2719
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.0", type: ShipMenuComponent, isStandalone: true, selector: "sh-menu", inputs: { asMultiLayer: { classPropertyName: "asMultiLayer", publicName: "asMultiLayer", isSignal: true, isRequired: false, transformFunction: null }, openIndicator: { classPropertyName: "openIndicator", publicName: "openIndicator", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, customOptionElementSelectors: { classPropertyName: "customOptionElementSelectors", publicName: "customOptionElementSelectors", isSignal: true, isRequired: false, transformFunction: null }, keepClickedOptionActive: { classPropertyName: "keepClickedOptionActive", publicName: "keepClickedOptionActive", isSignal: true, isRequired: false, transformFunction: null }, closeOnClick: { classPropertyName: "closeOnClick", publicName: "closeOnClick", isSignal: true, isRequired: false, transformFunction: null }, isOpen: { classPropertyName: "isOpen", publicName: "isOpen", isSignal: true, isRequired: false, transformFunction: null }, searchable: { classPropertyName: "searchable", publicName: "searchable", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { isOpen: "isOpenChange", closed: "closed" }, host: { properties: { "class.disabled": "disabled()", "class.has-search": "searchable()", "class.multi-layer": "asMultiLayer()" } }, viewQueries: [{ propertyName: "inputRef", first: true, predicate: ["inputRef"], descendants: true, isSignal: true }, { propertyName: "optionsRef", first: true, predicate: ["optionsRef"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
2713
2720
|
<sh-popover
|
|
2714
2721
|
#formFieldWrapper
|
|
2715
2722
|
[(isOpen)]="isOpen"
|
|
@@ -2720,7 +2727,7 @@ class ShipMenuComponent {
|
|
|
2720
2727
|
closeOnButton: false,
|
|
2721
2728
|
closeOnEsc: true,
|
|
2722
2729
|
}">
|
|
2723
|
-
<div trigger [class.is-open]="isOpen()" (click)="
|
|
2730
|
+
<div trigger [class.is-open]="isOpen()" (click)="toggleIsOpen($event)">
|
|
2724
2731
|
<ng-content />
|
|
2725
2732
|
|
|
2726
2733
|
@if (openIndicator()) {
|
|
@@ -2730,7 +2737,7 @@ class ShipMenuComponent {
|
|
|
2730
2737
|
|
|
2731
2738
|
<div class="form-field-wrap">
|
|
2732
2739
|
<sh-form-field class="small stretch" [class.hidden]="searchable() === false">
|
|
2733
|
-
<input type="text" #
|
|
2740
|
+
<input type="text" #inputRef placeholder="Search" />
|
|
2734
2741
|
</sh-form-field>
|
|
2735
2742
|
</div>
|
|
2736
2743
|
|
|
@@ -2760,7 +2767,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImpor
|
|
|
2760
2767
|
closeOnButton: false,
|
|
2761
2768
|
closeOnEsc: true,
|
|
2762
2769
|
}">
|
|
2763
|
-
<div trigger [class.is-open]="isOpen()" (click)="
|
|
2770
|
+
<div trigger [class.is-open]="isOpen()" (click)="toggleIsOpen($event)">
|
|
2764
2771
|
<ng-content />
|
|
2765
2772
|
|
|
2766
2773
|
@if (openIndicator()) {
|
|
@@ -2770,7 +2777,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImpor
|
|
|
2770
2777
|
|
|
2771
2778
|
<div class="form-field-wrap">
|
|
2772
2779
|
<sh-form-field class="small stretch" [class.hidden]="searchable() === false">
|
|
2773
|
-
<input type="text" #
|
|
2780
|
+
<input type="text" #inputRef placeholder="Search" />
|
|
2774
2781
|
</sh-form-field>
|
|
2775
2782
|
</div>
|
|
2776
2783
|
|