@memberjunction/ng-ui-components 6.2.1 → 6.3.0-edge.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/README.md +28 -4
- package/dist/lib/accordion/accordion-sections.component.d.ts +51 -0
- package/dist/lib/accordion/accordion-sections.component.d.ts.map +1 -0
- package/dist/lib/accordion/accordion-sections.component.js +138 -0
- package/dist/lib/accordion/accordion-sections.component.js.map +1 -0
- package/dist/lib/accordion/accordion.component.d.ts +53 -4
- package/dist/lib/accordion/accordion.component.d.ts.map +1 -1
- package/dist/lib/accordion/accordion.component.js +233 -68
- package/dist/lib/accordion/accordion.component.js.map +1 -1
- package/dist/lib/accordion/accordion.scss +76 -0
- package/dist/lib/combobox/combobox.component.d.ts +1 -1
- package/dist/lib/combobox/combobox.component.js +1 -1
- package/dist/lib/combobox/combobox.component.js.map +1 -1
- package/dist/lib/confirm-dialog/confirm-dialog.component.d.ts.map +1 -1
- package/dist/lib/confirm-dialog/confirm-dialog.component.js +6 -2
- package/dist/lib/confirm-dialog/confirm-dialog.component.js.map +1 -1
- package/dist/lib/datepicker/datepicker.component.d.ts +1 -1
- package/dist/lib/datepicker/datepicker.component.js +1 -1
- package/dist/lib/datepicker/datepicker.component.js.map +1 -1
- package/dist/lib/dialog/dialog.component.d.ts +15 -6
- package/dist/lib/dialog/dialog.component.d.ts.map +1 -1
- package/dist/lib/dialog/dialog.component.js +34 -13
- package/dist/lib/dialog/dialog.component.js.map +1 -1
- package/dist/lib/dialog/dialog.scss +82 -6
- package/dist/lib/dialog/dialog.service.d.ts +3 -3
- package/dist/lib/dialog/dialog.service.js +3 -3
- package/dist/lib/dialog/dialog.service.js.map +1 -1
- package/dist/lib/dropdown/dropdown.component.d.ts +0 -1
- package/dist/lib/dropdown/dropdown.component.d.ts.map +1 -1
- package/dist/lib/dropdown/dropdown.component.js +1 -2
- package/dist/lib/dropdown/dropdown.component.js.map +1 -1
- package/dist/lib/filter-panel/filter-panel.component.d.ts.map +1 -1
- package/dist/lib/filter-panel/filter-panel.component.js +5 -4
- package/dist/lib/filter-panel/filter-panel.component.js.map +1 -1
- package/dist/lib/input/chip.scss +1 -1
- package/dist/lib/input/input.scss +4 -4
- package/dist/lib/numeric-input/numeric-input.component.d.ts +1 -1
- package/dist/lib/numeric-input/numeric-input.component.js +1 -1
- package/dist/lib/numeric-input/numeric-input.component.js.map +1 -1
- package/dist/lib/progress-bar/progress-bar.component.d.ts +1 -1
- package/dist/lib/progress-bar/progress-bar.component.js +1 -1
- package/dist/lib/progress-bar/progress-bar.component.js.map +1 -1
- package/dist/lib/section-picker/section-picker.component.d.ts +108 -0
- package/dist/lib/section-picker/section-picker.component.d.ts.map +1 -0
- package/dist/lib/section-picker/section-picker.component.js +429 -0
- package/dist/lib/section-picker/section-picker.component.js.map +1 -0
- package/dist/lib/splitter/splitter.component.d.ts +2 -5
- package/dist/lib/splitter/splitter.component.d.ts.map +1 -1
- package/dist/lib/splitter/splitter.component.js +2 -5
- package/dist/lib/splitter/splitter.component.js.map +1 -1
- package/dist/lib/switch/switch.component.d.ts +1 -1
- package/dist/lib/switch/switch.component.js +1 -1
- package/dist/lib/switch/switch.component.js.map +1 -1
- package/dist/lib/viewport/phone-viewport.d.ts +15 -0
- package/dist/lib/viewport/phone-viewport.d.ts.map +1 -0
- package/dist/lib/viewport/phone-viewport.js +29 -0
- package/dist/lib/viewport/phone-viewport.js.map +1 -0
- package/dist/lib/window/window.component.d.ts +3 -3
- package/dist/lib/window/window.component.js +3 -3
- package/dist/lib/window/window.component.js.map +1 -1
- package/dist/lib/window/window.scss +43 -4
- package/dist/public-api.d.ts +3 -0
- package/dist/public-api.d.ts.map +1 -1
- package/dist/public-api.js +3 -0
- package/dist/public-api.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,429 @@
|
|
|
1
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
2
|
+
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Input, Output, ViewChild, inject } from '@angular/core';
|
|
3
|
+
import { MJBottomSheetComponent } from '../bottom-sheet/bottom-sheet.component';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
const _c0 = ["searchInput"];
|
|
6
|
+
const _c1 = a0 => ({ $implicit: a0 });
|
|
7
|
+
const _forTrack0 = ($index, $item) => $item.Key;
|
|
8
|
+
const _forTrack1 = ($index, $item) => $item.Title;
|
|
9
|
+
function MJSectionPickerComponent_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
10
|
+
i0.ɵɵelement(0, "i", 10);
|
|
11
|
+
} if (rf & 2) {
|
|
12
|
+
i0.ɵɵnextContext();
|
|
13
|
+
const active_r1 = i0.ɵɵreadContextLet(0);
|
|
14
|
+
i0.ɵɵclassMap(active_r1.Icon);
|
|
15
|
+
} }
|
|
16
|
+
function MJSectionPickerComponent_Conditional_5_Conditional_0_Template(rf, ctx) { if (rf & 1) {
|
|
17
|
+
i0.ɵɵelement(0, "span", 11);
|
|
18
|
+
} if (rf & 2) {
|
|
19
|
+
const ctx_r1 = i0.ɵɵnextContext(2);
|
|
20
|
+
const active_r1 = i0.ɵɵreadContextLet(0);
|
|
21
|
+
i0.ɵɵproperty("title", ctx_r1.DirtyLabel(active_r1));
|
|
22
|
+
i0.ɵɵattribute("aria-label", ctx_r1.DirtyLabel(active_r1));
|
|
23
|
+
} }
|
|
24
|
+
function MJSectionPickerComponent_Conditional_5_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
25
|
+
i0.ɵɵelementStart(0, "span", 12);
|
|
26
|
+
i0.ɵɵtext(1);
|
|
27
|
+
i0.ɵɵelementEnd();
|
|
28
|
+
} if (rf & 2) {
|
|
29
|
+
const ctx_r1 = i0.ɵɵnextContext(2);
|
|
30
|
+
const active_r1 = i0.ɵɵreadContextLet(0);
|
|
31
|
+
i0.ɵɵproperty("title", ctx_r1.ErrorLabel(active_r1));
|
|
32
|
+
i0.ɵɵattribute("aria-label", ctx_r1.ErrorLabel(active_r1));
|
|
33
|
+
i0.ɵɵadvance();
|
|
34
|
+
i0.ɵɵtextInterpolate(active_r1.ErrorCount);
|
|
35
|
+
} }
|
|
36
|
+
function MJSectionPickerComponent_Conditional_5_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
37
|
+
i0.ɵɵelementStart(0, "span", 13);
|
|
38
|
+
i0.ɵɵtext(1);
|
|
39
|
+
i0.ɵɵelementEnd();
|
|
40
|
+
} if (rf & 2) {
|
|
41
|
+
const ctx_r1 = i0.ɵɵnextContext(2);
|
|
42
|
+
const active_r1 = i0.ɵɵreadContextLet(0);
|
|
43
|
+
i0.ɵɵproperty("title", ctx_r1.WarningLabel(active_r1));
|
|
44
|
+
i0.ɵɵattribute("aria-label", ctx_r1.WarningLabel(active_r1));
|
|
45
|
+
i0.ɵɵadvance();
|
|
46
|
+
i0.ɵɵtextInterpolate(active_r1.WarningCount);
|
|
47
|
+
} }
|
|
48
|
+
function MJSectionPickerComponent_Conditional_5_Conditional_3_Template(rf, ctx) { if (rf & 1) {
|
|
49
|
+
i0.ɵɵelementStart(0, "span", 14);
|
|
50
|
+
i0.ɵɵtext(1);
|
|
51
|
+
i0.ɵɵelementEnd();
|
|
52
|
+
} if (rf & 2) {
|
|
53
|
+
i0.ɵɵnextContext(2);
|
|
54
|
+
const active_r1 = i0.ɵɵreadContextLet(0);
|
|
55
|
+
i0.ɵɵadvance();
|
|
56
|
+
i0.ɵɵtextInterpolate(active_r1.Count);
|
|
57
|
+
} }
|
|
58
|
+
function MJSectionPickerComponent_Conditional_5_Template(rf, ctx) { if (rf & 1) {
|
|
59
|
+
i0.ɵɵconditionalCreate(0, MJSectionPickerComponent_Conditional_5_Conditional_0_Template, 1, 2, "span", 11);
|
|
60
|
+
i0.ɵɵconditionalCreate(1, MJSectionPickerComponent_Conditional_5_Conditional_1_Template, 2, 3, "span", 12)(2, MJSectionPickerComponent_Conditional_5_Conditional_2_Template, 2, 3, "span", 13);
|
|
61
|
+
i0.ɵɵconditionalCreate(3, MJSectionPickerComponent_Conditional_5_Conditional_3_Template, 2, 1, "span", 14);
|
|
62
|
+
} if (rf & 2) {
|
|
63
|
+
i0.ɵɵnextContext();
|
|
64
|
+
const active_r1 = i0.ɵɵreadContextLet(0);
|
|
65
|
+
i0.ɵɵconditional((active_r1.DirtyCount ?? 0) > 0 ? 0 : -1);
|
|
66
|
+
i0.ɵɵadvance();
|
|
67
|
+
i0.ɵɵconditional((active_r1.ErrorCount ?? 0) > 0 ? 1 : (active_r1.WarningCount ?? 0) > 0 ? 2 : -1);
|
|
68
|
+
i0.ɵɵadvance(2);
|
|
69
|
+
i0.ɵɵconditional(active_r1.Count != null && active_r1.Count > 0 ? 3 : -1);
|
|
70
|
+
} }
|
|
71
|
+
function MJSectionPickerComponent_Conditional_9_Template(rf, ctx) { if (rf & 1) {
|
|
72
|
+
const _r3 = i0.ɵɵgetCurrentView();
|
|
73
|
+
i0.ɵɵelementStart(0, "input", 15, 1);
|
|
74
|
+
i0.ɵɵlistener("input", function MJSectionPickerComponent_Conditional_9_Template_input_input_0_listener($event) { i0.ɵɵrestoreView(_r3); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.OnSearchInput($event)); })("keydown", function MJSectionPickerComponent_Conditional_9_Template_input_keydown_0_listener($event) { i0.ɵɵrestoreView(_r3); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.OnSearchKeydown($event)); });
|
|
75
|
+
i0.ɵɵelementEnd();
|
|
76
|
+
i0.ɵɵelementStart(2, "span", 16);
|
|
77
|
+
i0.ɵɵtext(3, "Enter opens the first match.");
|
|
78
|
+
i0.ɵɵelementEnd();
|
|
79
|
+
} if (rf & 2) {
|
|
80
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
81
|
+
i0.ɵɵproperty("value", ctx_r1.Query)("placeholder", ctx_r1.SearchPlaceholder);
|
|
82
|
+
i0.ɵɵattribute("aria-describedby", ctx_r1.SearchHintId);
|
|
83
|
+
i0.ɵɵadvance(2);
|
|
84
|
+
i0.ɵɵattribute("id", ctx_r1.SearchHintId);
|
|
85
|
+
} }
|
|
86
|
+
function MJSectionPickerComponent_For_12_ng_container_0_Template(rf, ctx) { if (rf & 1) {
|
|
87
|
+
i0.ɵɵelementContainer(0);
|
|
88
|
+
} }
|
|
89
|
+
function MJSectionPickerComponent_For_12_Template(rf, ctx) { if (rf & 1) {
|
|
90
|
+
i0.ɵɵtemplate(0, MJSectionPickerComponent_For_12_ng_container_0_Template, 1, 0, "ng-container", 17);
|
|
91
|
+
} if (rf & 2) {
|
|
92
|
+
const item_r4 = ctx.$implicit;
|
|
93
|
+
i0.ɵɵnextContext();
|
|
94
|
+
const row_r5 = i0.ɵɵreference(17);
|
|
95
|
+
i0.ɵɵproperty("ngTemplateOutlet", row_r5)("ngTemplateOutletContext", i0.ɵɵpureFunction1(2, _c1, item_r4));
|
|
96
|
+
} }
|
|
97
|
+
function MJSectionPickerComponent_For_14_For_3_ng_container_0_Template(rf, ctx) { if (rf & 1) {
|
|
98
|
+
i0.ɵɵelementContainer(0);
|
|
99
|
+
} }
|
|
100
|
+
function MJSectionPickerComponent_For_14_For_3_Template(rf, ctx) { if (rf & 1) {
|
|
101
|
+
i0.ɵɵtemplate(0, MJSectionPickerComponent_For_14_For_3_ng_container_0_Template, 1, 0, "ng-container", 17);
|
|
102
|
+
} if (rf & 2) {
|
|
103
|
+
const item_r6 = ctx.$implicit;
|
|
104
|
+
i0.ɵɵnextContext(2);
|
|
105
|
+
const row_r5 = i0.ɵɵreference(17);
|
|
106
|
+
i0.ɵɵproperty("ngTemplateOutlet", row_r5)("ngTemplateOutletContext", i0.ɵɵpureFunction1(2, _c1, item_r6));
|
|
107
|
+
} }
|
|
108
|
+
function MJSectionPickerComponent_For_14_Template(rf, ctx) { if (rf & 1) {
|
|
109
|
+
i0.ɵɵelementStart(0, "div", 18);
|
|
110
|
+
i0.ɵɵtext(1);
|
|
111
|
+
i0.ɵɵelementEnd();
|
|
112
|
+
i0.ɵɵrepeaterCreate(2, MJSectionPickerComponent_For_14_For_3_Template, 1, 4, "ng-container", null, _forTrack0);
|
|
113
|
+
} if (rf & 2) {
|
|
114
|
+
const group_r7 = ctx.$implicit;
|
|
115
|
+
i0.ɵɵadvance();
|
|
116
|
+
i0.ɵɵtextInterpolate(group_r7.Title);
|
|
117
|
+
i0.ɵɵadvance();
|
|
118
|
+
i0.ɵɵrepeater(group_r7.Items);
|
|
119
|
+
} }
|
|
120
|
+
function MJSectionPickerComponent_Conditional_15_Template(rf, ctx) { if (rf & 1) {
|
|
121
|
+
i0.ɵɵelementStart(0, "div", 9);
|
|
122
|
+
i0.ɵɵtext(1, "No sections match.");
|
|
123
|
+
i0.ɵɵelementEnd();
|
|
124
|
+
} }
|
|
125
|
+
function MJSectionPickerComponent_ng_template_16_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
126
|
+
i0.ɵɵelement(0, "i", 10);
|
|
127
|
+
} if (rf & 2) {
|
|
128
|
+
const item_r9 = i0.ɵɵnextContext().$implicit;
|
|
129
|
+
i0.ɵɵclassMap(item_r9.Icon);
|
|
130
|
+
} }
|
|
131
|
+
function MJSectionPickerComponent_ng_template_16_Conditional_4_Template(rf, ctx) { if (rf & 1) {
|
|
132
|
+
i0.ɵɵelement(0, "span", 21);
|
|
133
|
+
} if (rf & 2) {
|
|
134
|
+
const item_r9 = i0.ɵɵnextContext().$implicit;
|
|
135
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
136
|
+
i0.ɵɵattribute("aria-label", ctx_r1.DirtyLabel(item_r9));
|
|
137
|
+
} }
|
|
138
|
+
function MJSectionPickerComponent_ng_template_16_Conditional_5_Template(rf, ctx) { if (rf & 1) {
|
|
139
|
+
i0.ɵɵelementStart(0, "span", 22);
|
|
140
|
+
i0.ɵɵtext(1);
|
|
141
|
+
i0.ɵɵelementEnd();
|
|
142
|
+
} if (rf & 2) {
|
|
143
|
+
const item_r9 = i0.ɵɵnextContext().$implicit;
|
|
144
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
145
|
+
i0.ɵɵattribute("aria-label", ctx_r1.ErrorLabel(item_r9));
|
|
146
|
+
i0.ɵɵadvance();
|
|
147
|
+
i0.ɵɵtextInterpolate(item_r9.ErrorCount);
|
|
148
|
+
} }
|
|
149
|
+
function MJSectionPickerComponent_ng_template_16_Conditional_6_Template(rf, ctx) { if (rf & 1) {
|
|
150
|
+
i0.ɵɵelementStart(0, "span", 23);
|
|
151
|
+
i0.ɵɵtext(1);
|
|
152
|
+
i0.ɵɵelementEnd();
|
|
153
|
+
} if (rf & 2) {
|
|
154
|
+
const item_r9 = i0.ɵɵnextContext().$implicit;
|
|
155
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
156
|
+
i0.ɵɵattribute("aria-label", ctx_r1.WarningLabel(item_r9));
|
|
157
|
+
i0.ɵɵadvance();
|
|
158
|
+
i0.ɵɵtextInterpolate(item_r9.WarningCount);
|
|
159
|
+
} }
|
|
160
|
+
function MJSectionPickerComponent_ng_template_16_Conditional_7_Template(rf, ctx) { if (rf & 1) {
|
|
161
|
+
i0.ɵɵelementStart(0, "span", 14);
|
|
162
|
+
i0.ɵɵtext(1);
|
|
163
|
+
i0.ɵɵelementEnd();
|
|
164
|
+
} if (rf & 2) {
|
|
165
|
+
const item_r9 = i0.ɵɵnextContext().$implicit;
|
|
166
|
+
i0.ɵɵadvance();
|
|
167
|
+
i0.ɵɵtextInterpolate(item_r9.Count);
|
|
168
|
+
} }
|
|
169
|
+
function MJSectionPickerComponent_ng_template_16_Template(rf, ctx) { if (rf & 1) {
|
|
170
|
+
const _r8 = i0.ɵɵgetCurrentView();
|
|
171
|
+
i0.ɵɵelementStart(0, "button", 19);
|
|
172
|
+
i0.ɵɵlistener("click", function MJSectionPickerComponent_ng_template_16_Template_button_click_0_listener() { const item_r9 = i0.ɵɵrestoreView(_r8).$implicit; const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.Select(item_r9.Key)); });
|
|
173
|
+
i0.ɵɵconditionalCreate(1, MJSectionPickerComponent_ng_template_16_Conditional_1_Template, 1, 2, "i", 3);
|
|
174
|
+
i0.ɵɵelementStart(2, "span", 20);
|
|
175
|
+
i0.ɵɵtext(3);
|
|
176
|
+
i0.ɵɵelementEnd();
|
|
177
|
+
i0.ɵɵconditionalCreate(4, MJSectionPickerComponent_ng_template_16_Conditional_4_Template, 1, 1, "span", 21);
|
|
178
|
+
i0.ɵɵconditionalCreate(5, MJSectionPickerComponent_ng_template_16_Conditional_5_Template, 2, 2, "span", 22)(6, MJSectionPickerComponent_ng_template_16_Conditional_6_Template, 2, 2, "span", 23);
|
|
179
|
+
i0.ɵɵconditionalCreate(7, MJSectionPickerComponent_ng_template_16_Conditional_7_Template, 2, 1, "span", 14);
|
|
180
|
+
i0.ɵɵelementEnd();
|
|
181
|
+
} if (rf & 2) {
|
|
182
|
+
const item_r9 = ctx.$implicit;
|
|
183
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
184
|
+
i0.ɵɵclassProp("is-active", ctx_r1.IsActive(item_r9))("is-first-match", ctx_r1.IsFirstMatch(item_r9));
|
|
185
|
+
i0.ɵɵattribute("data-key", item_r9.Key)("aria-current", ctx_r1.IsActive(item_r9) ? "page" : null);
|
|
186
|
+
i0.ɵɵadvance();
|
|
187
|
+
i0.ɵɵconditional(item_r9.Icon ? 1 : -1);
|
|
188
|
+
i0.ɵɵadvance(2);
|
|
189
|
+
i0.ɵɵtextInterpolate(item_r9.Title);
|
|
190
|
+
i0.ɵɵadvance();
|
|
191
|
+
i0.ɵɵconditional((item_r9.DirtyCount ?? 0) > 0 ? 4 : -1);
|
|
192
|
+
i0.ɵɵadvance();
|
|
193
|
+
i0.ɵɵconditional((item_r9.ErrorCount ?? 0) > 0 ? 5 : (item_r9.WarningCount ?? 0) > 0 ? 6 : -1);
|
|
194
|
+
i0.ɵɵadvance(2);
|
|
195
|
+
i0.ɵɵconditional(item_r9.Count != null && item_r9.Count > 0 ? 7 : -1);
|
|
196
|
+
} }
|
|
197
|
+
/**
|
|
198
|
+
* The phone replacement for a section rail, tab strip or icon rail: one full-width button that
|
|
199
|
+
* names the current section and opens a searchable "Sections" bottom sheet listing every
|
|
200
|
+
* section, first-class items first, then each {@link SectionPickerGroup} under its heading.
|
|
201
|
+
*
|
|
202
|
+
* Pure chrome with no breakpoint logic: the caller decides when a picker is the right
|
|
203
|
+
* presentation (`@if (IsPhone) { <mj-section-picker …> } @else { <the rail> }`). Selection is
|
|
204
|
+
* emitted, never applied; the caller sets `ActiveKey` back.
|
|
205
|
+
*
|
|
206
|
+
* ```html
|
|
207
|
+
* <mj-section-picker [Items]="sections" [Groups]="[{ Title: 'More', Items: more }]"
|
|
208
|
+
* [ActiveKey]="active" (ActiveKeyChange)="activate($event)">
|
|
209
|
+
* </mj-section-picker>
|
|
210
|
+
* ```
|
|
211
|
+
*/
|
|
212
|
+
export class MJSectionPickerComponent {
|
|
213
|
+
static nextInstance = 0;
|
|
214
|
+
cdr = inject(ChangeDetectorRef);
|
|
215
|
+
searchInput;
|
|
216
|
+
/** Id of the search box's hidden description, which says what Enter does. */
|
|
217
|
+
SearchHintId = `mj-section-picker-hint-${++MJSectionPickerComponent.nextInstance}`;
|
|
218
|
+
/** First-class sections, in display order. */
|
|
219
|
+
Items = [];
|
|
220
|
+
/** Headed groups listed after {@link Items}. */
|
|
221
|
+
Groups = [];
|
|
222
|
+
/** Key of the current section. Falls back to the first item when it matches nothing. */
|
|
223
|
+
ActiveKey = '';
|
|
224
|
+
/** Sheet header. */
|
|
225
|
+
SheetTitle = 'Sections';
|
|
226
|
+
/** Whether the sheet shows a search box. */
|
|
227
|
+
Searchable = true;
|
|
228
|
+
SearchPlaceholder = 'Search sections...';
|
|
229
|
+
/** Emitted with the chosen section's key; the sheet closes and the search clears. */
|
|
230
|
+
ActiveKeyChange = new EventEmitter();
|
|
231
|
+
/** Whether the sheet is open. */
|
|
232
|
+
SheetOpen = false;
|
|
233
|
+
/** The current search text; a way to find a row, cleared on every selection. */
|
|
234
|
+
Query = '';
|
|
235
|
+
/** The section the button names. */
|
|
236
|
+
get ActiveItem() {
|
|
237
|
+
const all = this.allItems();
|
|
238
|
+
return all.find((i) => i.Key === this.ActiveKey) ?? all[0] ?? null;
|
|
239
|
+
}
|
|
240
|
+
get FilteredItems() {
|
|
241
|
+
return this.Items.filter((i) => this.matches(i));
|
|
242
|
+
}
|
|
243
|
+
/** Groups with their matching items; a group whose items all drop out is left out. */
|
|
244
|
+
get FilteredGroups() {
|
|
245
|
+
return this.Groups
|
|
246
|
+
.map((g) => ({ Title: g.Title, Items: g.Items.filter((i) => this.matches(i)) }))
|
|
247
|
+
.filter((g) => g.Items.length > 0);
|
|
248
|
+
}
|
|
249
|
+
get HasMatches() {
|
|
250
|
+
return this.FilteredItems.length > 0 || this.FilteredGroups.length > 0;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* The row Enter opens: the first match in display order, once a search is typed. Null with an
|
|
254
|
+
* empty search (the list is not narrowed, so the first row is not a choice) or no matches.
|
|
255
|
+
*/
|
|
256
|
+
get FirstMatch() {
|
|
257
|
+
if (this.Query.trim() === '')
|
|
258
|
+
return null;
|
|
259
|
+
return this.FilteredItems[0] ?? this.FilteredGroups[0]?.Items[0] ?? null;
|
|
260
|
+
}
|
|
261
|
+
IsFirstMatch(item) {
|
|
262
|
+
return this.FirstMatch?.Key === item.Key;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Enter in the search box opens the first match. Its default is always blocked: the sheet renders
|
|
266
|
+
* in place, so inside a host `<form>` Enter would click the form's first submit button (implicit
|
|
267
|
+
* submission), even a hidden one such as Run or Regenerate.
|
|
268
|
+
*/
|
|
269
|
+
OnSearchKeydown(event) {
|
|
270
|
+
if (event.key !== 'Enter')
|
|
271
|
+
return;
|
|
272
|
+
event.preventDefault();
|
|
273
|
+
if (event.isComposing)
|
|
274
|
+
return; // Enter confirming an IME composition, not a pick
|
|
275
|
+
const match = this.FirstMatch;
|
|
276
|
+
if (match)
|
|
277
|
+
this.Select(match.Key);
|
|
278
|
+
}
|
|
279
|
+
OpenSheet() {
|
|
280
|
+
this.SheetOpen = true;
|
|
281
|
+
this.cdr.markForCheck();
|
|
282
|
+
}
|
|
283
|
+
OnSheetVisibleChange(visible) {
|
|
284
|
+
this.SheetOpen = visible;
|
|
285
|
+
if (!visible)
|
|
286
|
+
this.clearSearch();
|
|
287
|
+
this.cdr.markForCheck();
|
|
288
|
+
}
|
|
289
|
+
OnSearch(value) {
|
|
290
|
+
this.Query = value;
|
|
291
|
+
this.cdr.markForCheck();
|
|
292
|
+
}
|
|
293
|
+
OnSearchInput(event) {
|
|
294
|
+
const input = event.target;
|
|
295
|
+
this.OnSearch(input?.value ?? '');
|
|
296
|
+
}
|
|
297
|
+
Select(key) {
|
|
298
|
+
this.SheetOpen = false;
|
|
299
|
+
this.clearSearch();
|
|
300
|
+
this.ActiveKeyChange.emit(key);
|
|
301
|
+
this.cdr.markForCheck();
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Empties the search, in the box as well as in Query. The box's [value] binding only writes when
|
|
305
|
+
* Query differs from what it last rendered, and Enter can land before the typed query was ever
|
|
306
|
+
* rendered (a fast typist, a paste, a hardware keyboard): Query goes '' to '' and the old text
|
|
307
|
+
* would stay in the box for the next open.
|
|
308
|
+
*/
|
|
309
|
+
clearSearch() {
|
|
310
|
+
this.Query = '';
|
|
311
|
+
if (this.searchInput)
|
|
312
|
+
this.searchInput.nativeElement.value = '';
|
|
313
|
+
}
|
|
314
|
+
IsActive(item) {
|
|
315
|
+
return item.Key === this.ActiveKey;
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* The button's accessible name. An aria-label replaces the button's content for screen readers,
|
|
319
|
+
* so the indicator spans inside it are never announced: the name has to carry their status itself,
|
|
320
|
+
* in the order they appear (unsaved, then error or warning).
|
|
321
|
+
*/
|
|
322
|
+
get TriggerLabel() {
|
|
323
|
+
const active = this.ActiveItem;
|
|
324
|
+
if (!active)
|
|
325
|
+
return 'Change section';
|
|
326
|
+
const parts = [active.Title];
|
|
327
|
+
const dirty = active.DirtyCount ?? 0;
|
|
328
|
+
const errors = active.ErrorCount ?? 0;
|
|
329
|
+
const warnings = active.WarningCount ?? 0;
|
|
330
|
+
if (dirty > 0)
|
|
331
|
+
parts.push(`${dirty} unsaved ${dirty === 1 ? 'change' : 'changes'}`);
|
|
332
|
+
if (errors > 0)
|
|
333
|
+
parts.push(`${errors} ${errors === 1 ? 'error' : 'errors'}`);
|
|
334
|
+
else if (warnings > 0)
|
|
335
|
+
parts.push(`${warnings} ${warnings === 1 ? 'warning' : 'warnings'}`);
|
|
336
|
+
return 'Change section — ' + parts.join(', ');
|
|
337
|
+
}
|
|
338
|
+
ErrorLabel(item) {
|
|
339
|
+
const n = item.ErrorCount ?? 0;
|
|
340
|
+
return `${n} ${n === 1 ? 'error' : 'errors'} in ${item.Title}`;
|
|
341
|
+
}
|
|
342
|
+
WarningLabel(item) {
|
|
343
|
+
const n = item.WarningCount ?? 0;
|
|
344
|
+
return `${n} ${n === 1 ? 'warning' : 'warnings'} in ${item.Title}`;
|
|
345
|
+
}
|
|
346
|
+
DirtyLabel(item) {
|
|
347
|
+
const n = item.DirtyCount ?? 0;
|
|
348
|
+
return `${n} unsaved ${n === 1 ? 'change' : 'changes'} in ${item.Title}`;
|
|
349
|
+
}
|
|
350
|
+
allItems() {
|
|
351
|
+
return [...this.Items, ...this.Groups.flatMap((g) => g.Items)];
|
|
352
|
+
}
|
|
353
|
+
matches(item) {
|
|
354
|
+
const q = this.Query.trim().toLowerCase();
|
|
355
|
+
return q === '' || item.Title.toLowerCase().includes(q);
|
|
356
|
+
}
|
|
357
|
+
static ɵfac = function MJSectionPickerComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MJSectionPickerComponent)(); };
|
|
358
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: MJSectionPickerComponent, selectors: [["mj-section-picker"]], viewQuery: function MJSectionPickerComponent_Query(rf, ctx) { if (rf & 1) {
|
|
359
|
+
i0.ɵɵviewQuery(_c0, 5);
|
|
360
|
+
} if (rf & 2) {
|
|
361
|
+
let _t;
|
|
362
|
+
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.searchInput = _t.first);
|
|
363
|
+
} }, inputs: { Items: "Items", Groups: "Groups", ActiveKey: "ActiveKey", SheetTitle: "SheetTitle", Searchable: "Searchable", SearchPlaceholder: "SearchPlaceholder" }, outputs: { ActiveKeyChange: "ActiveKeyChange" }, decls: 18, vars: 10, consts: [["row", ""], ["searchInput", ""], ["type", "button", "aria-haspopup", "dialog", 1, "mj-section-picker", 3, "click"], ["aria-hidden", "true", 3, "class"], [1, "mj-section-picker-title"], ["aria-hidden", "true", 1, "fa-solid", "fa-chevron-down", "mj-section-picker-chevron"], [3, "VisibleChange", "Visible", "Title"], [1, "mj-section-sheet"], ["role", "list", 1, "mj-section-sheet-list"], [1, "mj-section-sheet-empty"], ["aria-hidden", "true"], ["role", "img", 1, "mj-section-picker-dirty", 3, "title"], ["role", "img", 1, "mj-section-picker-error", 3, "title"], ["role", "img", 1, "mj-section-picker-warning", 3, "title"], [1, "mj-section-picker-count"], ["type", "text", "aria-label", "Search sections", 1, "mj-input", "mj-section-sheet-search", 3, "input", "keydown", "value", "placeholder"], [1, "mj-section-sheet-sr-only"], [4, "ngTemplateOutlet", "ngTemplateOutletContext"], [1, "mj-section-sheet-heading"], ["type", "button", "role", "listitem", 1, "mj-section-sheet-item", 3, "click"], [1, "mj-section-sheet-label"], ["role", "img", 1, "mj-section-picker-dirty"], ["role", "img", 1, "mj-section-picker-error"], ["role", "img", 1, "mj-section-picker-warning"]], template: function MJSectionPickerComponent_Template(rf, ctx) { if (rf & 1) {
|
|
364
|
+
i0.ɵɵdeclareLet(0);
|
|
365
|
+
i0.ɵɵelementStart(1, "button", 2);
|
|
366
|
+
i0.ɵɵlistener("click", function MJSectionPickerComponent_Template_button_click_1_listener() { return ctx.OpenSheet(); });
|
|
367
|
+
i0.ɵɵconditionalCreate(2, MJSectionPickerComponent_Conditional_2_Template, 1, 2, "i", 3);
|
|
368
|
+
i0.ɵɵelementStart(3, "span", 4);
|
|
369
|
+
i0.ɵɵtext(4);
|
|
370
|
+
i0.ɵɵelementEnd();
|
|
371
|
+
i0.ɵɵconditionalCreate(5, MJSectionPickerComponent_Conditional_5_Template, 4, 3);
|
|
372
|
+
i0.ɵɵelement(6, "i", 5);
|
|
373
|
+
i0.ɵɵelementEnd();
|
|
374
|
+
i0.ɵɵelementStart(7, "mj-bottom-sheet", 6);
|
|
375
|
+
i0.ɵɵlistener("VisibleChange", function MJSectionPickerComponent_Template_mj_bottom_sheet_VisibleChange_7_listener($event) { return ctx.OnSheetVisibleChange($event); });
|
|
376
|
+
i0.ɵɵelementStart(8, "div", 7);
|
|
377
|
+
i0.ɵɵconditionalCreate(9, MJSectionPickerComponent_Conditional_9_Template, 4, 4);
|
|
378
|
+
i0.ɵɵelementStart(10, "div", 8);
|
|
379
|
+
i0.ɵɵrepeaterCreate(11, MJSectionPickerComponent_For_12_Template, 1, 4, "ng-container", null, _forTrack0);
|
|
380
|
+
i0.ɵɵrepeaterCreate(13, MJSectionPickerComponent_For_14_Template, 4, 1, null, null, _forTrack1);
|
|
381
|
+
i0.ɵɵconditionalCreate(15, MJSectionPickerComponent_Conditional_15_Template, 2, 0, "div", 9);
|
|
382
|
+
i0.ɵɵelementEnd()();
|
|
383
|
+
i0.ɵɵtemplate(16, MJSectionPickerComponent_ng_template_16_Template, 8, 11, "ng-template", null, 0, i0.ɵɵtemplateRefExtractor);
|
|
384
|
+
i0.ɵɵelementEnd();
|
|
385
|
+
} if (rf & 2) {
|
|
386
|
+
const active_r10 = i0.ɵɵstoreLet(ctx.ActiveItem);
|
|
387
|
+
i0.ɵɵadvance();
|
|
388
|
+
i0.ɵɵattribute("aria-expanded", ctx.SheetOpen)("aria-label", ctx.TriggerLabel);
|
|
389
|
+
i0.ɵɵadvance();
|
|
390
|
+
i0.ɵɵconditional((active_r10 == null ? null : active_r10.Icon) ? 2 : -1);
|
|
391
|
+
i0.ɵɵadvance(2);
|
|
392
|
+
i0.ɵɵtextInterpolate((active_r10 == null ? null : active_r10.Title) ?? "");
|
|
393
|
+
i0.ɵɵadvance();
|
|
394
|
+
i0.ɵɵconditional(active_r10 ? 5 : -1);
|
|
395
|
+
i0.ɵɵadvance(2);
|
|
396
|
+
i0.ɵɵproperty("Visible", ctx.SheetOpen)("Title", ctx.SheetTitle);
|
|
397
|
+
i0.ɵɵadvance(2);
|
|
398
|
+
i0.ɵɵconditional(ctx.Searchable ? 9 : -1);
|
|
399
|
+
i0.ɵɵadvance(2);
|
|
400
|
+
i0.ɵɵrepeater(ctx.FilteredItems);
|
|
401
|
+
i0.ɵɵadvance(2);
|
|
402
|
+
i0.ɵɵrepeater(ctx.FilteredGroups);
|
|
403
|
+
i0.ɵɵadvance(2);
|
|
404
|
+
i0.ɵɵconditional(!ctx.HasMatches ? 15 : -1);
|
|
405
|
+
} }, dependencies: [NgTemplateOutlet, MJBottomSheetComponent], styles: ["\n\n\n[_nghost-%COMP%] {\n display: block;\n min-width: 0;\n}\n\n.mj-section-picker[_ngcontent-%COMP%] {\n display: flex;\n align-items: center;\n gap: var(--mj-space-2, 8px);\n width: 100%;\n min-width: 0;\n min-height: 44px;\n padding: 0 var(--mj-space-3, 12px);\n border: 0;\n border-radius: var(--mj-radius-md);\n background: transparent;\n color: var(--mj-text-primary);\n font: inherit;\n font-size: var(--mj-text-sm);\n font-weight: var(--mj-font-semibold);\n text-align: left;\n cursor: pointer;\n}\n\n.mj-section-picker[_ngcontent-%COMP%]:hover {\n background: var(--mj-bg-surface-hover);\n}\n\n.mj-section-picker[_ngcontent-%COMP%]:focus-visible {\n outline: none;\n box-shadow: var(--mj-focus-ring);\n}\n\n.mj-section-picker[_ngcontent-%COMP%] > i[_ngcontent-%COMP%]:first-child {\n width: 1.15em;\n flex-shrink: 0;\n text-align: center;\n color: var(--mj-brand-primary);\n}\n\n.mj-section-picker-title[_ngcontent-%COMP%] {\n flex: 1 1 auto;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.mj-section-picker-chevron[_ngcontent-%COMP%] {\n margin-left: auto;\n flex-shrink: 0;\n font-size: var(--mj-text-xs);\n color: var(--mj-text-muted);\n}\n\n\n.mj-section-picker-count[_ngcontent-%COMP%] {\n flex-shrink: 0;\n min-width: 1.6em;\n padding: 1px 6px;\n border-radius: var(--mj-radius-full, 999px);\n background: var(--mj-bg-surface-sunken);\n color: var(--mj-text-secondary);\n font-size: var(--mj-text-xs);\n font-weight: var(--mj-font-semibold);\n text-align: center;\n}\n\n.mj-section-picker-error[_ngcontent-%COMP%], \n.mj-section-picker-warning[_ngcontent-%COMP%] {\n flex-shrink: 0;\n min-width: 1.6em;\n padding: 1px 6px;\n border-radius: var(--mj-radius-full, 999px);\n font-size: var(--mj-text-xs);\n font-weight: var(--mj-font-semibold);\n text-align: center;\n}\n\n.mj-section-picker-error[_ngcontent-%COMP%] {\n background: color-mix(in srgb, var(--mj-status-error) 18%, transparent);\n color: var(--mj-status-error);\n}\n\n.mj-section-picker-warning[_ngcontent-%COMP%] {\n background: color-mix(in srgb, var(--mj-status-warning) 18%, transparent);\n color: var(--mj-status-warning);\n}\n\n.mj-section-picker-dirty[_ngcontent-%COMP%] {\n flex-shrink: 0;\n width: var(--mj-space-1-5);\n height: var(--mj-space-1-5);\n border-radius: var(--mj-radius-full, 999px);\n background: var(--mj-status-warning);\n}\n\n\n\n\n.mj-section-sheet[_ngcontent-%COMP%] {\n display: flex;\n flex-direction: column;\n gap: var(--mj-space-3, 12px);\n padding: 0 var(--mj-space-4, 16px) var(--mj-space-4, 16px);\n}\n\n.mj-section-sheet-search[_ngcontent-%COMP%] {\n width: 100%;\n min-height: 44px;\n box-sizing: border-box;\n}\n\n.mj-section-sheet-list[_ngcontent-%COMP%] {\n display: flex;\n flex-direction: column;\n gap: 2px;\n max-height: 60vh;\n overflow-y: auto;\n}\n\n.mj-section-sheet-heading[_ngcontent-%COMP%] {\n padding: var(--mj-space-2, 8px) var(--mj-space-3, 12px) var(--mj-space-1, 4px);\n margin-top: var(--mj-space-2, 8px);\n border-top: 1px solid var(--mj-border-subtle);\n color: var(--mj-text-muted);\n font-size: var(--mj-text-xs);\n font-weight: var(--mj-font-semibold);\n text-transform: uppercase;\n letter-spacing: 0.04em;\n}\n\n.mj-section-sheet-item[_ngcontent-%COMP%] {\n display: flex;\n align-items: center;\n gap: 10px;\n width: 100%;\n min-height: 44px;\n padding: 10px 12px;\n border: 0;\n border-radius: var(--mj-radius-sm);\n background: transparent;\n color: var(--mj-text-primary);\n font: inherit;\n font-size: var(--mj-text-sm);\n text-align: left;\n cursor: pointer;\n}\n\n.mj-section-sheet-item[_ngcontent-%COMP%] > i[_ngcontent-%COMP%] {\n width: 1.15em;\n flex-shrink: 0;\n text-align: center;\n color: var(--mj-text-muted);\n}\n\n.mj-section-sheet-item[_ngcontent-%COMP%]:hover {\n background: var(--mj-bg-surface-hover);\n}\n\n.mj-section-sheet-item[_ngcontent-%COMP%]:focus-visible {\n outline: none;\n box-shadow: var(--mj-focus-ring);\n}\n\n.mj-section-sheet-item.is-active[_ngcontent-%COMP%] {\n background: color-mix(in srgb, var(--mj-brand-primary) 16%, var(--mj-bg-surface));\n color: var(--mj-brand-primary);\n font-weight: var(--mj-font-semibold);\n}\n\n\n\n.mj-section-sheet-item.is-first-match[_ngcontent-%COMP%] {\n outline: 1px solid color-mix(in srgb, var(--mj-brand-primary) 55%, transparent);\n outline-offset: -1px;\n}\n\n.mj-section-sheet-item.is-active[_ngcontent-%COMP%] > i[_ngcontent-%COMP%] {\n color: inherit;\n}\n\n.mj-section-sheet-label[_ngcontent-%COMP%] {\n flex: 1 1 auto;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.mj-section-sheet-empty[_ngcontent-%COMP%] {\n padding: var(--mj-space-4, 16px);\n color: var(--mj-text-muted);\n font-size: var(--mj-text-sm);\n text-align: center;\n}\n\n\n.mj-section-sheet-sr-only[_ngcontent-%COMP%] {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border: 0;\n}"], changeDetection: 0 });
|
|
406
|
+
}
|
|
407
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MJSectionPickerComponent, [{
|
|
408
|
+
type: Component,
|
|
409
|
+
args: [{ standalone: true, selector: 'mj-section-picker', imports: [NgTemplateOutlet, MJBottomSheetComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "@let active = ActiveItem;\n<button type=\"button\"\n class=\"mj-section-picker\"\n aria-haspopup=\"dialog\"\n [attr.aria-expanded]=\"SheetOpen\"\n [attr.aria-label]=\"TriggerLabel\"\n (click)=\"OpenSheet()\">\n @if (active?.Icon) {\n <i [class]=\"active!.Icon\" aria-hidden=\"true\"></i>\n }\n <span class=\"mj-section-picker-title\">{{ active?.Title ?? '' }}</span>\n @if (active) {\n @if ((active.DirtyCount ?? 0) > 0) {\n <span class=\"mj-section-picker-dirty\" role=\"img\" [title]=\"DirtyLabel(active)\" [attr.aria-label]=\"DirtyLabel(active)\"></span>\n }\n @if ((active.ErrorCount ?? 0) > 0) {\n <span class=\"mj-section-picker-error\" role=\"img\" [title]=\"ErrorLabel(active)\" [attr.aria-label]=\"ErrorLabel(active)\">{{ active.ErrorCount }}</span>\n } @else if ((active.WarningCount ?? 0) > 0) {\n <span class=\"mj-section-picker-warning\" role=\"img\" [title]=\"WarningLabel(active)\" [attr.aria-label]=\"WarningLabel(active)\">{{ active.WarningCount }}</span>\n }\n @if (active.Count != null && active.Count > 0) {\n <span class=\"mj-section-picker-count\">{{ active.Count }}</span>\n }\n }\n <i class=\"fa-solid fa-chevron-down mj-section-picker-chevron\" aria-hidden=\"true\"></i>\n</button>\n\n<mj-bottom-sheet [Visible]=\"SheetOpen\" (VisibleChange)=\"OnSheetVisibleChange($event)\" [Title]=\"SheetTitle\">\n <div class=\"mj-section-sheet\">\n @if (Searchable) {\n <input #searchInput type=\"text\"\n class=\"mj-input mj-section-sheet-search\"\n [value]=\"Query\"\n (input)=\"OnSearchInput($event)\"\n (keydown)=\"OnSearchKeydown($event)\"\n [placeholder]=\"SearchPlaceholder\"\n aria-label=\"Search sections\"\n [attr.aria-describedby]=\"SearchHintId\">\n <span class=\"mj-section-sheet-sr-only\" [attr.id]=\"SearchHintId\">Enter opens the first match.</span>\n }\n <div class=\"mj-section-sheet-list\" role=\"list\">\n @for (item of FilteredItems; track item.Key) {\n <ng-container *ngTemplateOutlet=\"row; context: { $implicit: item }\"></ng-container>\n }\n @for (group of FilteredGroups; track group.Title) {\n <div class=\"mj-section-sheet-heading\">{{ group.Title }}</div>\n @for (item of group.Items; track item.Key) {\n <ng-container *ngTemplateOutlet=\"row; context: { $implicit: item }\"></ng-container>\n }\n }\n @if (!HasMatches) {\n <div class=\"mj-section-sheet-empty\">No sections match.</div>\n }\n </div>\n </div>\n <ng-template #row let-item>\n <button type=\"button\"\n class=\"mj-section-sheet-item\"\n role=\"listitem\"\n [attr.data-key]=\"item.Key\"\n [class.is-active]=\"IsActive(item)\"\n [class.is-first-match]=\"IsFirstMatch(item)\"\n [attr.aria-current]=\"IsActive(item) ? 'page' : null\"\n (click)=\"Select(item.Key)\">\n @if (item.Icon) {\n <i [class]=\"item.Icon\" aria-hidden=\"true\"></i>\n }\n <span class=\"mj-section-sheet-label\">{{ item.Title }}</span>\n @if ((item.DirtyCount ?? 0) > 0) {\n <span class=\"mj-section-picker-dirty\" role=\"img\" [attr.aria-label]=\"DirtyLabel(item)\"></span>\n }\n @if ((item.ErrorCount ?? 0) > 0) {\n <span class=\"mj-section-picker-error\" role=\"img\" [attr.aria-label]=\"ErrorLabel(item)\">{{ item.ErrorCount }}</span>\n } @else if ((item.WarningCount ?? 0) > 0) {\n <span class=\"mj-section-picker-warning\" role=\"img\" [attr.aria-label]=\"WarningLabel(item)\">{{ item.WarningCount }}</span>\n }\n @if (item.Count != null && item.Count > 0) {\n <span class=\"mj-section-picker-count\">{{ item.Count }}</span>\n }\n </button>\n </ng-template>\n</mj-bottom-sheet>\n", styles: ["/* ============================================\n SECTION PICKER \u2014 one full-width button naming the current section\n ============================================ */\n:host {\n display: block;\n min-width: 0;\n}\n\n.mj-section-picker {\n display: flex;\n align-items: center;\n gap: var(--mj-space-2, 8px);\n width: 100%;\n min-width: 0;\n min-height: 44px;\n padding: 0 var(--mj-space-3, 12px);\n border: 0;\n border-radius: var(--mj-radius-md);\n background: transparent;\n color: var(--mj-text-primary);\n font: inherit;\n font-size: var(--mj-text-sm);\n font-weight: var(--mj-font-semibold);\n text-align: left;\n cursor: pointer;\n}\n\n.mj-section-picker:hover {\n background: var(--mj-bg-surface-hover);\n}\n\n.mj-section-picker:focus-visible {\n outline: none;\n box-shadow: var(--mj-focus-ring);\n}\n\n.mj-section-picker > i:first-child {\n width: 1.15em;\n flex-shrink: 0;\n text-align: center;\n color: var(--mj-brand-primary);\n}\n\n.mj-section-picker-title {\n flex: 1 1 auto;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.mj-section-picker-chevron {\n margin-left: auto;\n flex-shrink: 0;\n font-size: var(--mj-text-xs);\n color: var(--mj-text-muted);\n}\n\n/* Indicators shared by the button and the sheet rows */\n.mj-section-picker-count {\n flex-shrink: 0;\n min-width: 1.6em;\n padding: 1px 6px;\n border-radius: var(--mj-radius-full, 999px);\n background: var(--mj-bg-surface-sunken);\n color: var(--mj-text-secondary);\n font-size: var(--mj-text-xs);\n font-weight: var(--mj-font-semibold);\n text-align: center;\n}\n\n.mj-section-picker-error,\n.mj-section-picker-warning {\n flex-shrink: 0;\n min-width: 1.6em;\n padding: 1px 6px;\n border-radius: var(--mj-radius-full, 999px);\n font-size: var(--mj-text-xs);\n font-weight: var(--mj-font-semibold);\n text-align: center;\n}\n\n.mj-section-picker-error {\n background: color-mix(in srgb, var(--mj-status-error) 18%, transparent);\n color: var(--mj-status-error);\n}\n\n.mj-section-picker-warning {\n background: color-mix(in srgb, var(--mj-status-warning) 18%, transparent);\n color: var(--mj-status-warning);\n}\n\n.mj-section-picker-dirty {\n flex-shrink: 0;\n width: var(--mj-space-1-5);\n height: var(--mj-space-1-5);\n border-radius: var(--mj-radius-full, 999px);\n background: var(--mj-status-warning);\n}\n\n/* ============================================\n SECTIONS SHEET \u2014 every section as a vertical, searchable list\n ============================================ */\n.mj-section-sheet {\n display: flex;\n flex-direction: column;\n gap: var(--mj-space-3, 12px);\n padding: 0 var(--mj-space-4, 16px) var(--mj-space-4, 16px);\n}\n\n.mj-section-sheet-search {\n width: 100%;\n min-height: 44px;\n box-sizing: border-box;\n}\n\n.mj-section-sheet-list {\n display: flex;\n flex-direction: column;\n gap: 2px;\n max-height: 60vh;\n overflow-y: auto;\n}\n\n.mj-section-sheet-heading {\n padding: var(--mj-space-2, 8px) var(--mj-space-3, 12px) var(--mj-space-1, 4px);\n margin-top: var(--mj-space-2, 8px);\n border-top: 1px solid var(--mj-border-subtle);\n color: var(--mj-text-muted);\n font-size: var(--mj-text-xs);\n font-weight: var(--mj-font-semibold);\n text-transform: uppercase;\n letter-spacing: 0.04em;\n}\n\n.mj-section-sheet-item {\n display: flex;\n align-items: center;\n gap: 10px;\n width: 100%;\n min-height: 44px;\n padding: 10px 12px;\n border: 0;\n border-radius: var(--mj-radius-sm);\n background: transparent;\n color: var(--mj-text-primary);\n font: inherit;\n font-size: var(--mj-text-sm);\n text-align: left;\n cursor: pointer;\n}\n\n.mj-section-sheet-item > i {\n width: 1.15em;\n flex-shrink: 0;\n text-align: center;\n color: var(--mj-text-muted);\n}\n\n.mj-section-sheet-item:hover {\n background: var(--mj-bg-surface-hover);\n}\n\n.mj-section-sheet-item:focus-visible {\n outline: none;\n box-shadow: var(--mj-focus-ring);\n}\n\n.mj-section-sheet-item.is-active {\n background: color-mix(in srgb, var(--mj-brand-primary) 16%, var(--mj-bg-surface));\n color: var(--mj-brand-primary);\n font-weight: var(--mj-font-semibold);\n}\n\n/* The row Enter opens while a search is typed, so the Go key's target is visible. An outline, not a\n box-shadow, so it never replaces the focus ring; a focused row drops it (focus-visible sets none). */\n.mj-section-sheet-item.is-first-match {\n outline: 1px solid color-mix(in srgb, var(--mj-brand-primary) 55%, transparent);\n outline-offset: -1px;\n}\n\n.mj-section-sheet-item.is-active > i {\n color: inherit;\n}\n\n.mj-section-sheet-label {\n flex: 1 1 auto;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.mj-section-sheet-empty {\n padding: var(--mj-space-4, 16px);\n color: var(--mj-text-muted);\n font-size: var(--mj-text-sm);\n text-align: center;\n}\n\n/* The search box's description; read by screen readers, never shown. */\n.mj-section-sheet-sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border: 0;\n}\n"] }]
|
|
410
|
+
}], null, { searchInput: [{
|
|
411
|
+
type: ViewChild,
|
|
412
|
+
args: ['searchInput']
|
|
413
|
+
}], Items: [{
|
|
414
|
+
type: Input
|
|
415
|
+
}], Groups: [{
|
|
416
|
+
type: Input
|
|
417
|
+
}], ActiveKey: [{
|
|
418
|
+
type: Input
|
|
419
|
+
}], SheetTitle: [{
|
|
420
|
+
type: Input
|
|
421
|
+
}], Searchable: [{
|
|
422
|
+
type: Input
|
|
423
|
+
}], SearchPlaceholder: [{
|
|
424
|
+
type: Input
|
|
425
|
+
}], ActiveKeyChange: [{
|
|
426
|
+
type: Output
|
|
427
|
+
}] }); })();
|
|
428
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MJSectionPickerComponent, { className: "MJSectionPickerComponent", filePath: "lib/section-picker/section-picker.component.ts", lineNumber: 52 }); })();
|
|
429
|
+
//# sourceMappingURL=section-picker.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"section-picker.component.js","sourceRoot":"","sources":["../../../src/lib/section-picker/section-picker.component.ts","../../../src/lib/section-picker/section-picker.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,SAAS,EAAc,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAClJ,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;;;;;;;ICM5E,wBAAiD;;;;IAA9C,6BAAsB;;;IAKvB,2BAA4H;;;;IAA3E,oDAA4B;;;;IAG7E,gCAAqH;IAAA,YAAuB;IAAA,iBAAO;;;;IAAlG,oDAA4B;;IAAwC,cAAuB;IAAvB,0CAAuB;;;IAE5I,gCAA2H;IAAA,YAAyB;IAAA,iBAAO;;;;IAAxG,sDAA8B;;IAA0C,cAAyB;IAAzB,4CAAyB;;;IAGpJ,gCAAsC;IAAA,YAAkB;IAAA,iBAAO;;;;IAAzB,cAAkB;IAAlB,qCAAkB;;;IAT1D,0GAAoC;IAKlC,AAFF,0GAAoC,oFAES;IAG7C,0GAAgD;;;;IARhD,0DAEC;IACD,cAIC;IAJD,kGAIC;IACD,eAEC;IAFD,yEAEC;;;;IAQC,oCAO8C;IAHvC,AADA,iMAAS,4BAAqB,KAAC,wLACpB,8BAAuB,KAAC;IAJ1C,iBAO8C;IAC9C,gCAAgE;IAAA,4CAA4B;IAAA,iBAAO;;;IAH5F,AAHA,oCAAe,yCAGkB;;IAGD,eAAwB;;;;IAI7D,wBAAmF;;;IAAnF,mGAAoE;;;;;IAA9B,AAAvB,yCAAuB,gEAA4B;;;IAKhE,wBAAmF;;;IAAnF,yGAAoE;;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AE,CAAC,WAAW,EAAE,CAAC;QAC1C,OAAO,CAAC,KAAK,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC1D,CAAC;kHA9JU,wBAAwB;6DAAxB,wBAAwB;;;;;;YCnDrC,kBAAyB;YACzB,iCAK8B;YAAtB,qGAAS,eAAW,IAAC;YAC3B,wFAAoB;YAGpB,+BAAsC;YAAA,YAAyB;YAAA,iBAAO;YACtE,gFAAc;YAad,uBAAqF;YACvF,iBAAS;YAET,0CAA2G;YAApE,oIAAiB,gCAA4B,IAAC;YACnF,8BAA8B;YAC5B,gFAAkB;YAWlB,+BAA+C;YAC7C,yGAEC;YACD,+FAKC;YACD,4FAAmB;YAIvB,AADE,iBAAM,EACF;YACN,6HAA2B;YA0B7B,iBAAkB;;+BAjFlB,6BAAyB;YAIjB,cAAgC;;YAGtC,cAEC;YAFD,wEAEC;YACqC,eAAyB;YAAzB,0EAAyB;YAC/D,cAYC;YAZD,qCAYC;YAIc,eAAqB;YAAgD,AAArE,uCAAqB,yBAAoE;YAEtG,eAUC;YAVD,yCAUC;YAEC,eAEC;YAFD,gCAEC;YACD,eAKC;YALD,iCAKC;YACD,eAEC;YAFD,2CAEC;4BDNK,gBAAgB,EAAE,sBAAsB;;iFAKvC,wBAAwB;cARpC,SAAS;6BACI,IAAI,YACN,mBAAmB,WACpB,CAAC,gBAAgB,EAAE,sBAAsB,CAAC,mBAGlC,uBAAuB,CAAC,MAAM;;kBAK9C,SAAS;mBAAC,aAAa;;kBAMvB,KAAK;;kBAEL,KAAK;;kBAEL,KAAK;;kBAEL,KAAK;;kBAEL,KAAK;;kBACL,KAAK;;kBAGL,MAAM;;kFArBI,wBAAwB","sourcesContent":["import { NgTemplateOutlet } from '@angular/common';\nimport { ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, EventEmitter, Input, Output, ViewChild, inject } from '@angular/core';\nimport { MJBottomSheetComponent } from '../bottom-sheet/bottom-sheet.component';\n\n/** One selectable section in an {@link MJSectionPickerComponent}. */\nexport interface SectionPickerItem {\n /** Stable identity, emitted on selection. */\n Key: string;\n /** Visible label on the button and in the sheet. */\n Title: string;\n /** Font Awesome class string, e.g. `fa-solid fa-table-columns`. */\n Icon?: string;\n /** Row count shown as a trailing pill when positive. */\n Count?: number | null;\n /** Validation errors in this section; shown as a red pill when positive. */\n ErrorCount?: number;\n /** Warnings in this section; shown as an amber pill when positive and there are no errors. */\n WarningCount?: number;\n /** Unsaved edits in this section; shown as a dot when positive. */\n DirtyCount?: number;\n}\n\n/** A headed group of sections listed after the first-class items (a form's \"More\" folder, say). */\nexport interface SectionPickerGroup {\n Title: string;\n Items: SectionPickerItem[];\n}\n\n/**\n * The phone replacement for a section rail, tab strip or icon rail: one full-width button that\n * names the current section and opens a searchable \"Sections\" bottom sheet listing every\n * section, first-class items first, then each {@link SectionPickerGroup} under its heading.\n *\n * Pure chrome with no breakpoint logic: the caller decides when a picker is the right\n * presentation (`@if (IsPhone) { <mj-section-picker …> } @else { <the rail> }`). Selection is\n * emitted, never applied; the caller sets `ActiveKey` back.\n *\n * ```html\n * <mj-section-picker [Items]=\"sections\" [Groups]=\"[{ Title: 'More', Items: more }]\"\n * [ActiveKey]=\"active\" (ActiveKeyChange)=\"activate($event)\">\n * </mj-section-picker>\n * ```\n */\n@Component({\n standalone: true,\n selector: 'mj-section-picker',\n imports: [NgTemplateOutlet, MJBottomSheetComponent],\n templateUrl: './section-picker.component.html',\n styleUrls: ['./section-picker.component.css'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class MJSectionPickerComponent {\n private static nextInstance = 0;\n private readonly cdr = inject(ChangeDetectorRef);\n @ViewChild('searchInput') private searchInput?: ElementRef<HTMLInputElement>;\n\n /** Id of the search box's hidden description, which says what Enter does. */\n public readonly SearchHintId = `mj-section-picker-hint-${++MJSectionPickerComponent.nextInstance}`;\n\n /** First-class sections, in display order. */\n @Input() Items: SectionPickerItem[] = [];\n /** Headed groups listed after {@link Items}. */\n @Input() Groups: SectionPickerGroup[] = [];\n /** Key of the current section. Falls back to the first item when it matches nothing. */\n @Input() ActiveKey = '';\n /** Sheet header. */\n @Input() SheetTitle = 'Sections';\n /** Whether the sheet shows a search box. */\n @Input() Searchable = true;\n @Input() SearchPlaceholder = 'Search sections...';\n\n /** Emitted with the chosen section's key; the sheet closes and the search clears. */\n @Output() ActiveKeyChange = new EventEmitter<string>();\n\n /** Whether the sheet is open. */\n public SheetOpen = false;\n /** The current search text; a way to find a row, cleared on every selection. */\n public Query = '';\n\n /** The section the button names. */\n public get ActiveItem(): SectionPickerItem | null {\n const all = this.allItems();\n return all.find((i) => i.Key === this.ActiveKey) ?? all[0] ?? null;\n }\n\n public get FilteredItems(): SectionPickerItem[] {\n return this.Items.filter((i) => this.matches(i));\n }\n\n /** Groups with their matching items; a group whose items all drop out is left out. */\n public get FilteredGroups(): SectionPickerGroup[] {\n return this.Groups\n .map((g) => ({ Title: g.Title, Items: g.Items.filter((i) => this.matches(i)) }))\n .filter((g) => g.Items.length > 0);\n }\n\n public get HasMatches(): boolean {\n return this.FilteredItems.length > 0 || this.FilteredGroups.length > 0;\n }\n\n /**\n * The row Enter opens: the first match in display order, once a search is typed. Null with an\n * empty search (the list is not narrowed, so the first row is not a choice) or no matches.\n */\n public get FirstMatch(): SectionPickerItem | null {\n if (this.Query.trim() === '') return null;\n return this.FilteredItems[0] ?? this.FilteredGroups[0]?.Items[0] ?? null;\n }\n\n public IsFirstMatch(item: SectionPickerItem): boolean {\n return this.FirstMatch?.Key === item.Key;\n }\n\n /**\n * Enter in the search box opens the first match. Its default is always blocked: the sheet renders\n * in place, so inside a host `<form>` Enter would click the form's first submit button (implicit\n * submission), even a hidden one such as Run or Regenerate.\n */\n public OnSearchKeydown(event: KeyboardEvent): void {\n if (event.key !== 'Enter') return;\n event.preventDefault();\n if (event.isComposing) return; // Enter confirming an IME composition, not a pick\n const match = this.FirstMatch;\n if (match) this.Select(match.Key);\n }\n\n public OpenSheet(): void {\n this.SheetOpen = true;\n this.cdr.markForCheck();\n }\n\n public OnSheetVisibleChange(visible: boolean): void {\n this.SheetOpen = visible;\n if (!visible) this.clearSearch();\n this.cdr.markForCheck();\n }\n\n public OnSearch(value: string): void {\n this.Query = value;\n this.cdr.markForCheck();\n }\n\n public OnSearchInput(event: Event): void {\n const input = event.target as HTMLInputElement | null;\n this.OnSearch(input?.value ?? '');\n }\n\n public Select(key: string): void {\n this.SheetOpen = false;\n this.clearSearch();\n this.ActiveKeyChange.emit(key);\n this.cdr.markForCheck();\n }\n\n /**\n * Empties the search, in the box as well as in Query. The box's [value] binding only writes when\n * Query differs from what it last rendered, and Enter can land before the typed query was ever\n * rendered (a fast typist, a paste, a hardware keyboard): Query goes '' to '' and the old text\n * would stay in the box for the next open.\n */\n private clearSearch(): void {\n this.Query = '';\n if (this.searchInput) this.searchInput.nativeElement.value = '';\n }\n\n public IsActive(item: SectionPickerItem): boolean {\n return item.Key === this.ActiveKey;\n }\n\n /**\n * The button's accessible name. An aria-label replaces the button's content for screen readers,\n * so the indicator spans inside it are never announced: the name has to carry their status itself,\n * in the order they appear (unsaved, then error or warning).\n */\n public get TriggerLabel(): string {\n const active = this.ActiveItem;\n if (!active) return 'Change section';\n const parts = [active.Title];\n const dirty = active.DirtyCount ?? 0;\n const errors = active.ErrorCount ?? 0;\n const warnings = active.WarningCount ?? 0;\n if (dirty > 0) parts.push(`${dirty} unsaved ${dirty === 1 ? 'change' : 'changes'}`);\n if (errors > 0) parts.push(`${errors} ${errors === 1 ? 'error' : 'errors'}`);\n else if (warnings > 0) parts.push(`${warnings} ${warnings === 1 ? 'warning' : 'warnings'}`);\n return 'Change section — ' + parts.join(', ');\n }\n\n public ErrorLabel(item: SectionPickerItem): string {\n const n = item.ErrorCount ?? 0;\n return `${n} ${n === 1 ? 'error' : 'errors'} in ${item.Title}`;\n }\n\n public WarningLabel(item: SectionPickerItem): string {\n const n = item.WarningCount ?? 0;\n return `${n} ${n === 1 ? 'warning' : 'warnings'} in ${item.Title}`;\n }\n\n public DirtyLabel(item: SectionPickerItem): string {\n const n = item.DirtyCount ?? 0;\n return `${n} unsaved ${n === 1 ? 'change' : 'changes'} in ${item.Title}`;\n }\n\n private allItems(): SectionPickerItem[] {\n return [...this.Items, ...this.Groups.flatMap((g) => g.Items)];\n }\n\n private matches(item: SectionPickerItem): boolean {\n const q = this.Query.trim().toLowerCase();\n return q === '' || item.Title.toLowerCase().includes(q);\n }\n}\n","@let active = ActiveItem;\n<button type=\"button\"\n class=\"mj-section-picker\"\n aria-haspopup=\"dialog\"\n [attr.aria-expanded]=\"SheetOpen\"\n [attr.aria-label]=\"TriggerLabel\"\n (click)=\"OpenSheet()\">\n @if (active?.Icon) {\n <i [class]=\"active!.Icon\" aria-hidden=\"true\"></i>\n }\n <span class=\"mj-section-picker-title\">{{ active?.Title ?? '' }}</span>\n @if (active) {\n @if ((active.DirtyCount ?? 0) > 0) {\n <span class=\"mj-section-picker-dirty\" role=\"img\" [title]=\"DirtyLabel(active)\" [attr.aria-label]=\"DirtyLabel(active)\"></span>\n }\n @if ((active.ErrorCount ?? 0) > 0) {\n <span class=\"mj-section-picker-error\" role=\"img\" [title]=\"ErrorLabel(active)\" [attr.aria-label]=\"ErrorLabel(active)\">{{ active.ErrorCount }}</span>\n } @else if ((active.WarningCount ?? 0) > 0) {\n <span class=\"mj-section-picker-warning\" role=\"img\" [title]=\"WarningLabel(active)\" [attr.aria-label]=\"WarningLabel(active)\">{{ active.WarningCount }}</span>\n }\n @if (active.Count != null && active.Count > 0) {\n <span class=\"mj-section-picker-count\">{{ active.Count }}</span>\n }\n }\n <i class=\"fa-solid fa-chevron-down mj-section-picker-chevron\" aria-hidden=\"true\"></i>\n</button>\n\n<mj-bottom-sheet [Visible]=\"SheetOpen\" (VisibleChange)=\"OnSheetVisibleChange($event)\" [Title]=\"SheetTitle\">\n <div class=\"mj-section-sheet\">\n @if (Searchable) {\n <input #searchInput type=\"text\"\n class=\"mj-input mj-section-sheet-search\"\n [value]=\"Query\"\n (input)=\"OnSearchInput($event)\"\n (keydown)=\"OnSearchKeydown($event)\"\n [placeholder]=\"SearchPlaceholder\"\n aria-label=\"Search sections\"\n [attr.aria-describedby]=\"SearchHintId\">\n <span class=\"mj-section-sheet-sr-only\" [attr.id]=\"SearchHintId\">Enter opens the first match.</span>\n }\n <div class=\"mj-section-sheet-list\" role=\"list\">\n @for (item of FilteredItems; track item.Key) {\n <ng-container *ngTemplateOutlet=\"row; context: { $implicit: item }\"></ng-container>\n }\n @for (group of FilteredGroups; track group.Title) {\n <div class=\"mj-section-sheet-heading\">{{ group.Title }}</div>\n @for (item of group.Items; track item.Key) {\n <ng-container *ngTemplateOutlet=\"row; context: { $implicit: item }\"></ng-container>\n }\n }\n @if (!HasMatches) {\n <div class=\"mj-section-sheet-empty\">No sections match.</div>\n }\n </div>\n </div>\n <ng-template #row let-item>\n <button type=\"button\"\n class=\"mj-section-sheet-item\"\n role=\"listitem\"\n [attr.data-key]=\"item.Key\"\n [class.is-active]=\"IsActive(item)\"\n [class.is-first-match]=\"IsFirstMatch(item)\"\n [attr.aria-current]=\"IsActive(item) ? 'page' : null\"\n (click)=\"Select(item.Key)\">\n @if (item.Icon) {\n <i [class]=\"item.Icon\" aria-hidden=\"true\"></i>\n }\n <span class=\"mj-section-sheet-label\">{{ item.Title }}</span>\n @if ((item.DirtyCount ?? 0) > 0) {\n <span class=\"mj-section-picker-dirty\" role=\"img\" [attr.aria-label]=\"DirtyLabel(item)\"></span>\n }\n @if ((item.ErrorCount ?? 0) > 0) {\n <span class=\"mj-section-picker-error\" role=\"img\" [attr.aria-label]=\"ErrorLabel(item)\">{{ item.ErrorCount }}</span>\n } @else if ((item.WarningCount ?? 0) > 0) {\n <span class=\"mj-section-picker-warning\" role=\"img\" [attr.aria-label]=\"WarningLabel(item)\">{{ item.WarningCount }}</span>\n }\n @if (item.Count != null && item.Count > 0) {\n <span class=\"mj-section-picker-count\">{{ item.Count }}</span>\n }\n </button>\n </ng-template>\n</mj-bottom-sheet>\n"]}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* MJ Splitter — wraps angular-split for resizable split layouts.
|
|
3
|
-
* Replaces `<kendo-splitter>` and `<kendo-splitter-pane>`.
|
|
4
3
|
*
|
|
5
4
|
* Re-exports angular-split's AngularSplitModule so consumers only
|
|
6
5
|
* need to import from @memberjunction/ng-ui-components.
|
|
@@ -13,10 +12,8 @@
|
|
|
13
12
|
* </as-split>
|
|
14
13
|
* ```
|
|
15
14
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* - `<kendo-splitter-pane [size]="'30%'">` → `<as-split-area [size]="30">`
|
|
19
|
-
* - `<kendo-splitter-pane>` (no size = fill) → `<as-split-area [size]="*">`
|
|
15
|
+
* Sizing: `<as-split direction="horizontal">` with `<as-split-area [size]="30">` for a
|
|
16
|
+
* percentage pane, or `[size]="*"` for a pane that fills the remaining space.
|
|
20
17
|
* - size values are numbers (percentages), not strings
|
|
21
18
|
*/
|
|
22
19
|
export { AngularSplitModule } from 'angular-split';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"splitter.component.d.ts","sourceRoot":"","sources":["../../../src/lib/splitter/splitter.component.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"splitter.component.d.ts","sourceRoot":"","sources":["../../../src/lib/splitter/splitter.component.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* MJ Splitter — wraps angular-split for resizable split layouts.
|
|
3
|
-
* Replaces `<kendo-splitter>` and `<kendo-splitter-pane>`.
|
|
4
3
|
*
|
|
5
4
|
* Re-exports angular-split's AngularSplitModule so consumers only
|
|
6
5
|
* need to import from @memberjunction/ng-ui-components.
|
|
@@ -13,10 +12,8 @@
|
|
|
13
12
|
* </as-split>
|
|
14
13
|
* ```
|
|
15
14
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* - `<kendo-splitter-pane [size]="'30%'">` → `<as-split-area [size]="30">`
|
|
19
|
-
* - `<kendo-splitter-pane>` (no size = fill) → `<as-split-area [size]="*">`
|
|
15
|
+
* Sizing: `<as-split direction="horizontal">` with `<as-split-area [size]="30">` for a
|
|
16
|
+
* percentage pane, or `[size]="*"` for a pane that fills the remaining space.
|
|
20
17
|
* - size values are numbers (percentages), not strings
|
|
21
18
|
*/
|
|
22
19
|
// Re-export angular-split module for consumers
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"splitter.component.js","sourceRoot":"","sources":["../../../src/lib/splitter/splitter.component.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"splitter.component.js","sourceRoot":"","sources":["../../../src/lib/splitter/splitter.component.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,+CAA+C;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC","sourcesContent":["/**\n * MJ Splitter — wraps angular-split for resizable split layouts.\n *\n * Re-exports angular-split's AngularSplitModule so consumers only\n * need to import from @memberjunction/ng-ui-components.\n *\n * Usage:\n * ```html\n * <as-split direction=\"horizontal\">\n * <as-split-area [size]=\"30\">Left</as-split-area>\n * <as-split-area [size]=\"70\">Right</as-split-area>\n * </as-split>\n * ```\n *\n * Sizing: `<as-split direction=\"horizontal\">` with `<as-split-area [size]=\"30\">` for a\n * percentage pane, or `[size]=\"*\"` for a pane that fills the remaining space.\n * - size values are numbers (percentages), not strings\n */\n\n// Re-export angular-split module for consumers\nexport { AngularSplitModule } from 'angular-split';\n"]}
|
|
@@ -3,7 +3,7 @@ import { ControlValueAccessor } from '@angular/forms';
|
|
|
3
3
|
import { MJNamedControlBase } from '../a11y/named-control.base';
|
|
4
4
|
import * as i0 from "@angular/core";
|
|
5
5
|
/**
|
|
6
|
-
* mj-switch — Toggle switch.
|
|
6
|
+
* mj-switch — Toggle switch.
|
|
7
7
|
*
|
|
8
8
|
* Every switch needs an ACCESSIBLE NAME. Without one it announces as "switch, on" — or, worse, as
|
|
9
9
|
* its own STATE, because `OnLabel`/`OffLabel` render inside the button and a `role=switch` takes
|
|
@@ -14,7 +14,7 @@ function MJSwitchComponent_Conditional_4_Template(rf, ctx) { if (rf & 1) {
|
|
|
14
14
|
i0.ɵɵtextInterpolate(ctx_r0.Value ? ctx_r0.OnLabel : ctx_r0.OffLabel);
|
|
15
15
|
} }
|
|
16
16
|
/**
|
|
17
|
-
* mj-switch — Toggle switch.
|
|
17
|
+
* mj-switch — Toggle switch.
|
|
18
18
|
*
|
|
19
19
|
* Every switch needs an ACCESSIBLE NAME. Without one it announces as "switch, on" — or, worse, as
|
|
20
20
|
* its own STATE, because `OnLabel`/`OffLabel` render inside the button and a `role=switch` takes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switch.component.js","sourceRoot":"","sources":["../../../src/lib/switch/switch.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EACjB,SAAS,EAET,WAAW,EACX,KAAK,EACL,SAAS,EACT,UAAU,EACV,MAAM,EACP,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,iBAAiB,EAAwB,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;;;;IAoCtD,kCAA8B;IAAA,YAAgC;IAAA,oBAAO;;;IAAvC,cAAgC;IAAhC,qEAAgC;;AAlCtE;;;;;;;;;;;;;;;;;;;GAmBG;AAqBH,MAAM,OAAO,iBAAkB,SAAQ,kBAAkB;IAC9C,OAAO,GAAG,EAAE,CAAC;IACb,QAAQ,GAAG,EAAE,CAAC;IACvB;;;;;OAKG;IACH,IACI,QAAQ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SOR, ControlValueAccessor } from '@angular/forms';\nimport { MJNamedControlBase } from '../a11y/named-control.base';\nimport { WarnIfUnnamed } from '../a11y/unnamed-control-guard';\n\n/**\n * mj-switch — Toggle switch
|
|
1
|
+
{"version":3,"file":"switch.component.js","sourceRoot":"","sources":["../../../src/lib/switch/switch.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EACjB,SAAS,EAET,WAAW,EACX,KAAK,EACL,SAAS,EACT,UAAU,EACV,MAAM,EACP,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,iBAAiB,EAAwB,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;;;;IAoCtD,kCAA8B;IAAA,YAAgC;IAAA,oBAAO;;;IAAvC,cAAgC;IAAhC,qEAAgC;;AAlCtE;;;;;;;;;;;;;;;;;;;GAmBG;AAqBH,MAAM,OAAO,iBAAkB,SAAQ,kBAAkB;IAC9C,OAAO,GAAG,EAAE,CAAC;IACb,QAAQ,GAAG,EAAE,CAAC;IACvB;;;;;OAKG;IACH,IACI,QAAQ,CAAC,KAAc,IAAI,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;IACjF,IAAI,QAAQ,KAAc,OAAO,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;IACR,SAAS,GAAG,IAAI,CAAC;IAC5B,cAAc,CAA4C;IAE7F,KAAK,GAAG,KAAK,CAAC;IACd,kGAAkG;IAClG,UAAU,GAAG,KAAK,CAAC;IACX,aAAa,GAAG,KAAK,CAAC;IACtB,YAAY,GAAG,KAAK,CAAC;IACrB,GAAG,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC;IAChC,QAAQ,GAA6B,GAAG,EAAE,GAAE,CAAC,CAAC;IAC9C,SAAS,GAAe,GAAG,EAAE,GAAE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dxG,uCAO0C;YAArB,AAAnB,iGAAS,YAAQ,IAAC,+EAAS,eAAW,IAAC;YACvC,kCAA8B;YAAA,6BAAqC;YAAA,oBAAO;YAC1E,oFAA2B;YAG7B,oBAAS;;YAXuB,AAA9B,0CAA6B,uCAAyC;YAK1C,4CAAuB;;YAGnD,eAEC;YAFD,sDAEC;;;iFAKM,iBAAiB;cApB7B,SAAS;eAAC;gBACT,QAAQ,EAAE,WAAW;gBACrB,UAAU,EAAE,IAAI;gBAChB,QAAQ,EAAE;;;;;;;;;;;;;;GAcT;gBACD,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,kBAAkB,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;aAC3G;;kBAEE,KAAK;;kBACL,KAAK;;kBAOL,KAAK;;kBAGL,WAAW;mBAAC,sBAAsB;;kBAClC,SAAS;mBAAC,cAAc;;kFAbd,iBAAiB","sourcesContent":["import {\n AfterViewInit,\n ChangeDetectorRef,\n Component,\n ElementRef,\n HostBinding,\n Input,\n ViewChild,\n forwardRef,\n inject\n} from '@angular/core';\nimport { NG_VALUE_ACCESSOR, ControlValueAccessor } from '@angular/forms';\nimport { MJNamedControlBase } from '../a11y/named-control.base';\nimport { WarnIfUnnamed } from '../a11y/unnamed-control-guard';\n\n/**\n * mj-switch — Toggle switch.\n *\n * Every switch needs an ACCESSIBLE NAME. Without one it announces as \"switch, on\" — or, worse, as\n * its own STATE, because `OnLabel`/`OffLabel` render inside the button and a `role=switch` takes\n * its name from its contents when nothing else names it: a toggle labelled \"On\" that announces\n * \"On, switch, on\" says nothing about what it toggles (WCAG 2.1 4.1.2). Use\n * {@link MJNamedControlBase.AriaLabelledBy} when a visible label exists,\n * {@link MJNamedControlBase.AriaLabel} when none does; either one overrides that state text.\n *\n * The switch is a `<button>`, which IS a labelable element, so\n * {@link MJNamedControlBase.InputId} doubles as a `<label for>` target: the label names the switch\n * — overriding the On/Off text, since an associated label outranks an element's own contents — and\n * clicking it focuses and toggles the switch, which `AriaLabelledBy` alone does not give you.\n *\n * @example\n * ```html\n * <mj-switch AriaLabel=\"Email notifications\" [(ngModel)]=\"isEnabled\" OnLabel=\"On\" OffLabel=\"Off\" />\n * ```\n */\n@Component({\n selector: 'mj-switch',\n standalone: true,\n template: `\n <button #switchButton type=\"button\" role=\"switch\" class=\"mj-switch\"\n [class.mj-switch--on]=\"Value\" [class.mj-switch--disabled]=\"IsDisabled\"\n [attr.id]=\"InputId || null\"\n [attr.aria-label]=\"AriaLabel || null\"\n [attr.aria-labelledby]=\"AriaLabelledBy || null\"\n [attr.aria-describedby]=\"AriaDescribedBy || null\"\n [attr.aria-checked]=\"Value\" [disabled]=\"IsDisabled\"\n (click)=\"Toggle()\" (blur)=\"OnTouched()\">\n <span class=\"mj-switch-track\"><span class=\"mj-switch-thumb\"></span></span>\n @if (OnLabel || OffLabel) {\n <span class=\"mj-switch-label\">{{ Value ? OnLabel : OffLabel }}</span>\n }\n </button>\n `,\n providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => MJSwitchComponent), multi: true }]\n})\nexport class MJSwitchComponent extends MJNamedControlBase implements ControlValueAccessor, AfterViewInit {\n @Input() OnLabel = '';\n @Input() OffLabel = '';\n /**\n * Host-driven disable. Composed with Angular Forms' `setDisabledState()` into `IsDisabled`\n * (the actual gate) — see `syncDisabled`. A setter, not a bare field, because this input is\n * routinely bound to an expression that changes over the control's lifetime, and the gate has\n * to follow it every time.\n */\n @Input()\n set Disabled(value: boolean) { this.disabledInput = value; this.syncDisabled(); }\n get Disabled(): boolean { return this.disabledInput; }\n @HostBinding('class.mj-switch-host') readonly hostClass = true;\n @ViewChild('switchButton') private switchButtonEl: ElementRef<HTMLButtonElement> | undefined;\n\n Value = false;\n /** The gate on `Toggle()` — true when EITHER source says so. Assign only via `syncDisabled()`. */\n IsDisabled = false;\n private disabledInput = false;\n private formDisabled = false;\n private cdr = inject(ChangeDetectorRef);\n private onChange: (value: boolean) => void = () => {};\n private onTouched: () => void = () => {};\n\n /**\n * Recompute the gate from both of its sources. Called whenever either one changes.\n *\n * `IsDisabled` is derived state, and the only thing that assigned it was `setDisabledState()`.\n * The forms-driven half was in fact fine — `setUpControl` also wires `registerOnDisabledChange`,\n * so that hook fires on every `control.disable()`/`enable()`, not just at registration. What had\n * no recompute path at all was the `Disabled` @Input: a plain field, so the gate froze at\n * whatever the first compose produced and every later change to the input was dropped.\n */\n private syncDisabled(): void {\n const disabled = this.disabledInput || this.formDisabled;\n if (disabled === this.IsDisabled) return;\n this.IsDisabled = disabled;\n this.cdr.markForCheck();\n }\n\n ngAfterViewInit(): void { WarnIfUnnamed(this.switchButtonEl?.nativeElement, 'mj-switch'); }\n\n Toggle(): void { if (!this.IsDisabled) { this.Value = !this.Value; this.onChange(this.Value); } }\n OnTouched(): void { this.onTouched(); }\n writeValue(value: boolean): void { this.Value = !!value; }\n registerOnChange(fn: (value: boolean) => void): void { this.onChange = fn; }\n registerOnTouched(fn: () => void): void { this.onTouched = fn; }\n setDisabledState(isDisabled: boolean): void { this.formDisabled = isDisabled; this.syncDisabled(); }\n}\n"]}
|