@memberjunction/ng-ui-components 0.0.1 → 5.23.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/dist/lib/accordion/accordion.component.d.ts +58 -0
- package/dist/lib/accordion/accordion.component.d.ts.map +1 -0
- package/dist/lib/accordion/accordion.component.js +163 -0
- package/dist/lib/accordion/accordion.component.js.map +1 -0
- package/dist/lib/accordion/accordion.scss +45 -0
- package/dist/lib/button/button.directive.d.ts +45 -0
- package/dist/lib/button/button.directive.d.ts.map +1 -0
- package/dist/lib/button/button.directive.js +114 -0
- package/dist/lib/button/button.directive.js.map +1 -0
- package/dist/lib/button/button.scss +250 -0
- package/dist/lib/calendar/calendar-utils.d.ts +16 -0
- package/dist/lib/calendar/calendar-utils.d.ts.map +1 -0
- package/dist/lib/calendar/calendar-utils.js +41 -0
- package/dist/lib/calendar/calendar-utils.js.map +1 -0
- package/dist/lib/combobox/combobox.component.d.ts +83 -0
- package/dist/lib/combobox/combobox.component.d.ts.map +1 -0
- package/dist/lib/combobox/combobox.component.js +483 -0
- package/dist/lib/combobox/combobox.component.js.map +1 -0
- package/dist/lib/combobox/combobox.scss +86 -0
- package/dist/lib/datepicker/datepicker.component.d.ts +50 -0
- package/dist/lib/datepicker/datepicker.component.d.ts.map +1 -0
- package/dist/lib/datepicker/datepicker.component.js +279 -0
- package/dist/lib/datepicker/datepicker.component.js.map +1 -0
- package/dist/lib/datepicker/datepicker.scss +60 -0
- package/dist/lib/dialog/dialog.component.d.ts +84 -0
- package/dist/lib/dialog/dialog.component.d.ts.map +1 -0
- package/dist/lib/dialog/dialog.component.js +285 -0
- package/dist/lib/dialog/dialog.component.js.map +1 -0
- package/dist/lib/dialog/dialog.scss +134 -0
- package/dist/lib/dialog/dialog.service.d.ts +114 -0
- package/dist/lib/dialog/dialog.service.d.ts.map +1 -0
- package/dist/lib/dialog/dialog.service.js +282 -0
- package/dist/lib/dialog/dialog.service.js.map +1 -0
- package/dist/lib/dropdown/dropdown.component.d.ts +75 -0
- package/dist/lib/dropdown/dropdown.component.d.ts.map +1 -0
- package/dist/lib/dropdown/dropdown.component.js +445 -0
- package/dist/lib/dropdown/dropdown.component.js.map +1 -0
- package/dist/lib/dropdown/dropdown.scss +68 -0
- package/dist/lib/input/chip.scss +64 -0
- package/dist/lib/input/input-switch-progress.scss +57 -0
- package/dist/lib/input/input.scss +77 -0
- package/dist/lib/numeric-input/numeric-input.component.d.ts +31 -0
- package/dist/lib/numeric-input/numeric-input.component.d.ts.map +1 -0
- package/dist/lib/numeric-input/numeric-input.component.js +103 -0
- package/dist/lib/numeric-input/numeric-input.component.js.map +1 -0
- package/dist/lib/progress-bar/progress-bar.component.d.ts +14 -0
- package/dist/lib/progress-bar/progress-bar.component.d.ts.map +1 -0
- package/dist/lib/progress-bar/progress-bar.component.js +62 -0
- package/dist/lib/progress-bar/progress-bar.component.js.map +1 -0
- package/dist/lib/splitter/splitter.component.d.ts +23 -0
- package/dist/lib/splitter/splitter.component.d.ts.map +1 -0
- package/dist/lib/splitter/splitter.component.js +24 -0
- package/dist/lib/splitter/splitter.component.js.map +1 -0
- package/dist/lib/splitter/splitter.scss +29 -0
- package/dist/lib/switch/switch.component.d.ts +24 -0
- package/dist/lib/switch/switch.component.d.ts.map +1 -0
- package/dist/lib/switch/switch.component.js +82 -0
- package/dist/lib/switch/switch.component.js.map +1 -0
- package/dist/lib/window/window.component.d.ts +115 -0
- package/dist/lib/window/window.component.d.ts.map +1 -0
- package/dist/lib/window/window.component.js +502 -0
- package/dist/lib/window/window.component.js.map +1 -0
- package/dist/lib/window/window.scss +97 -0
- package/dist/public-api.d.ts +14 -0
- package/dist/public-api.d.ts.map +1 -0
- package/dist/public-api.js +16 -0
- package/dist/public-api.js.map +1 -0
- package/package.json +39 -6
- package/README.md +0 -45
|
@@ -0,0 +1,483 @@
|
|
|
1
|
+
import { Component, Input, Output, EventEmitter, forwardRef, HostBinding, ViewChild, ContentChild, inject, ChangeDetectorRef } from '@angular/core';
|
|
2
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
3
|
+
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
4
|
+
import { OverlayModule } from '@angular/cdk/overlay';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
import * as i1 from "@angular/cdk/overlay";
|
|
7
|
+
const _c0 = ["mjComboboxItem"];
|
|
8
|
+
const _c1 = ["trigger"];
|
|
9
|
+
const _c2 = ["comboInput"];
|
|
10
|
+
const _c3 = a0 => ({ $implicit: a0 });
|
|
11
|
+
function MJComboboxComponent_Conditional_5_Template(rf, ctx) { if (rf & 1) {
|
|
12
|
+
const _r2 = i0.ɵɵgetCurrentView();
|
|
13
|
+
i0.ɵɵelementStart(0, "button", 8);
|
|
14
|
+
i0.ɵɵlistener("mousedown", function MJComboboxComponent_Conditional_5_Template_button_mousedown_0_listener($event) { i0.ɵɵrestoreView(_r2); const ctx_r2 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r2.OnClear($event)); });
|
|
15
|
+
i0.ɵɵelement(1, "i", 9);
|
|
16
|
+
i0.ɵɵelementEnd();
|
|
17
|
+
} }
|
|
18
|
+
function MJComboboxComponent_ng_template_8_For_2_Conditional_1_ng_container_0_Template(rf, ctx) { if (rf & 1) {
|
|
19
|
+
i0.ɵɵelementContainer(0);
|
|
20
|
+
} }
|
|
21
|
+
function MJComboboxComponent_ng_template_8_For_2_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
22
|
+
i0.ɵɵtemplate(0, MJComboboxComponent_ng_template_8_For_2_Conditional_1_ng_container_0_Template, 1, 0, "ng-container", 14);
|
|
23
|
+
} if (rf & 2) {
|
|
24
|
+
const item_r5 = i0.ɵɵnextContext().$implicit;
|
|
25
|
+
const ctx_r2 = i0.ɵɵnextContext(2);
|
|
26
|
+
i0.ɵɵproperty("ngTemplateOutlet", ctx_r2.ItemTemplate)("ngTemplateOutletContext", i0.ɵɵpureFunction1(2, _c3, item_r5));
|
|
27
|
+
} }
|
|
28
|
+
function MJComboboxComponent_ng_template_8_For_2_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
29
|
+
i0.ɵɵtext(0);
|
|
30
|
+
} if (rf & 2) {
|
|
31
|
+
const item_r5 = i0.ɵɵnextContext().$implicit;
|
|
32
|
+
const ctx_r2 = i0.ɵɵnextContext(2);
|
|
33
|
+
i0.ɵɵtextInterpolate1(" ", ctx_r2.GetItemText(item_r5), " ");
|
|
34
|
+
} }
|
|
35
|
+
function MJComboboxComponent_ng_template_8_For_2_Template(rf, ctx) { if (rf & 1) {
|
|
36
|
+
const _r4 = i0.ɵɵgetCurrentView();
|
|
37
|
+
i0.ɵɵelementStart(0, "div", 13);
|
|
38
|
+
i0.ɵɵlistener("mousedown", function MJComboboxComponent_ng_template_8_For_2_Template_div_mousedown_0_listener($event) { const item_r5 = i0.ɵɵrestoreView(_r4).$implicit; const ctx_r2 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r2.SelectItem(item_r5, $event)); });
|
|
39
|
+
i0.ɵɵconditionalCreate(1, MJComboboxComponent_ng_template_8_For_2_Conditional_1_Template, 1, 4, "ng-container")(2, MJComboboxComponent_ng_template_8_For_2_Conditional_2_Template, 1, 1);
|
|
40
|
+
i0.ɵɵelementEnd();
|
|
41
|
+
} if (rf & 2) {
|
|
42
|
+
const item_r5 = ctx.$implicit;
|
|
43
|
+
const $index_r6 = ctx.$index;
|
|
44
|
+
const ctx_r2 = i0.ɵɵnextContext(2);
|
|
45
|
+
i0.ɵɵclassProp("mj-dropdown-option--selected", ctx_r2.IsItemSelected(item_r5))("mj-dropdown-option--highlighted", ctx_r2.HighlightedIndex === $index_r6);
|
|
46
|
+
i0.ɵɵattribute("aria-selected", ctx_r2.IsItemSelected(item_r5));
|
|
47
|
+
i0.ɵɵadvance();
|
|
48
|
+
i0.ɵɵconditional(ctx_r2.ItemTemplate ? 1 : 2);
|
|
49
|
+
} }
|
|
50
|
+
function MJComboboxComponent_ng_template_8_Conditional_3_Template(rf, ctx) { if (rf & 1) {
|
|
51
|
+
i0.ɵɵelementStart(0, "div", 12);
|
|
52
|
+
i0.ɵɵtext(1, "No data found");
|
|
53
|
+
i0.ɵɵelementEnd();
|
|
54
|
+
} }
|
|
55
|
+
function MJComboboxComponent_ng_template_8_Template(rf, ctx) { if (rf & 1) {
|
|
56
|
+
i0.ɵɵelementStart(0, "div", 10);
|
|
57
|
+
i0.ɵɵrepeaterCreate(1, MJComboboxComponent_ng_template_8_For_2_Template, 3, 6, "div", 11, i0.ɵɵcomponentInstance().TrackByIndex, true);
|
|
58
|
+
i0.ɵɵconditionalCreate(3, MJComboboxComponent_ng_template_8_Conditional_3_Template, 2, 0, "div", 12);
|
|
59
|
+
i0.ɵɵelementEnd();
|
|
60
|
+
} if (rf & 2) {
|
|
61
|
+
const ctx_r2 = i0.ɵɵnextContext();
|
|
62
|
+
i0.ɵɵadvance();
|
|
63
|
+
i0.ɵɵrepeater(ctx_r2.FilteredItems);
|
|
64
|
+
i0.ɵɵadvance(2);
|
|
65
|
+
i0.ɵɵconditional(ctx_r2.FilteredItems.length === 0 ? 3 : -1);
|
|
66
|
+
} }
|
|
67
|
+
/**
|
|
68
|
+
* mj-combobox — Editable dropdown with filtering and optional custom values.
|
|
69
|
+
*
|
|
70
|
+
* Replaces `<kendo-combobox>`. Unlike mj-dropdown, the trigger is a text input
|
|
71
|
+
* that filters the list as you type. When AllowCustom is true, typed text that
|
|
72
|
+
* doesn't match any item is emitted as the value.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```html
|
|
76
|
+
* <mj-combobox
|
|
77
|
+
* [Data]="categories"
|
|
78
|
+
* TextField="text"
|
|
79
|
+
* ValueField="value"
|
|
80
|
+
* [(ngModel)]="selectedCategory"
|
|
81
|
+
* [ValuePrimitive]="true"
|
|
82
|
+
* [AllowCustom]="true"
|
|
83
|
+
* [Filterable]="true"
|
|
84
|
+
* Placeholder="Select or enter new...">
|
|
85
|
+
* </mj-combobox>
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
export class MJComboboxComponent {
|
|
89
|
+
set Data(value) {
|
|
90
|
+
this._data = value;
|
|
91
|
+
// Re-resolve display text when data arrives after writeValue
|
|
92
|
+
if (this.SelectedValue != null && !this.InputText) {
|
|
93
|
+
this.InputText = this.getDisplayText();
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
get Data() { return this._data; }
|
|
97
|
+
_data = [];
|
|
98
|
+
TextField = '';
|
|
99
|
+
ValueField = '';
|
|
100
|
+
Filterable = true;
|
|
101
|
+
ValuePrimitive = false;
|
|
102
|
+
Disabled = false;
|
|
103
|
+
Placeholder = '';
|
|
104
|
+
AllowCustom = false;
|
|
105
|
+
ValueChange = new EventEmitter();
|
|
106
|
+
FilterChange = new EventEmitter();
|
|
107
|
+
ItemTemplate = null;
|
|
108
|
+
triggerEl;
|
|
109
|
+
ComboInput;
|
|
110
|
+
hostClass = true;
|
|
111
|
+
cdr = inject(ChangeDetectorRef);
|
|
112
|
+
IsOpen = false;
|
|
113
|
+
IsDisabled = false;
|
|
114
|
+
HighlightedIndex = -1;
|
|
115
|
+
SelectedValue = null;
|
|
116
|
+
TriggerWidth = 0;
|
|
117
|
+
InputText = '';
|
|
118
|
+
Positions = [
|
|
119
|
+
{ originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top' },
|
|
120
|
+
{ originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom' }
|
|
121
|
+
];
|
|
122
|
+
onChange = () => { };
|
|
123
|
+
onTouched = () => { };
|
|
124
|
+
isBlurring = false;
|
|
125
|
+
get FilteredItems() {
|
|
126
|
+
const data = (this.Data ?? []);
|
|
127
|
+
if (!this.Filterable || !this.InputText)
|
|
128
|
+
return data;
|
|
129
|
+
const search = this.InputText.toLowerCase();
|
|
130
|
+
return data.filter(item => this.GetItemText(item).toLowerCase().includes(search));
|
|
131
|
+
}
|
|
132
|
+
OnInput(event) {
|
|
133
|
+
this.InputText = event.target.value;
|
|
134
|
+
this.HighlightedIndex = 0;
|
|
135
|
+
this.FilterChange.emit(this.InputText);
|
|
136
|
+
if (!this.IsOpen)
|
|
137
|
+
this.Open();
|
|
138
|
+
this.cdr.detectChanges();
|
|
139
|
+
}
|
|
140
|
+
OnFocus() {
|
|
141
|
+
if (!this.IsOpen)
|
|
142
|
+
this.Open();
|
|
143
|
+
}
|
|
144
|
+
OnToggleMouseDown(event) {
|
|
145
|
+
event.preventDefault(); // Prevent blur on the input
|
|
146
|
+
this.Toggle();
|
|
147
|
+
}
|
|
148
|
+
OnClear(event) {
|
|
149
|
+
event.preventDefault();
|
|
150
|
+
event.stopPropagation();
|
|
151
|
+
this.isBlurring = false;
|
|
152
|
+
this.InputText = '';
|
|
153
|
+
this.SelectedValue = null;
|
|
154
|
+
this.onChange(null);
|
|
155
|
+
this.ValueChange.emit(null);
|
|
156
|
+
this.Close();
|
|
157
|
+
this.cdr.detectChanges();
|
|
158
|
+
}
|
|
159
|
+
OnInputBlur() {
|
|
160
|
+
this.isBlurring = true;
|
|
161
|
+
setTimeout(() => {
|
|
162
|
+
if (!this.isBlurring)
|
|
163
|
+
return;
|
|
164
|
+
this.isBlurring = false;
|
|
165
|
+
this.CommitValue();
|
|
166
|
+
this.Close();
|
|
167
|
+
this.onTouched();
|
|
168
|
+
}, 150);
|
|
169
|
+
}
|
|
170
|
+
Toggle() {
|
|
171
|
+
if (this.IsDisabled)
|
|
172
|
+
return;
|
|
173
|
+
this.IsOpen ? this.Close() : this.Open();
|
|
174
|
+
}
|
|
175
|
+
Open() {
|
|
176
|
+
if (this.IsDisabled || this.IsOpen)
|
|
177
|
+
return;
|
|
178
|
+
this.TriggerWidth = this.triggerEl?.nativeElement.offsetWidth ?? 200;
|
|
179
|
+
this.IsOpen = true;
|
|
180
|
+
this.HighlightedIndex = this.getSelectedIndex();
|
|
181
|
+
this.cdr.detectChanges();
|
|
182
|
+
}
|
|
183
|
+
Close() {
|
|
184
|
+
if (!this.IsOpen)
|
|
185
|
+
return;
|
|
186
|
+
this.IsOpen = false;
|
|
187
|
+
this.HighlightedIndex = -1;
|
|
188
|
+
this.cdr.detectChanges();
|
|
189
|
+
}
|
|
190
|
+
SelectItem(item, event) {
|
|
191
|
+
event?.preventDefault();
|
|
192
|
+
event?.stopPropagation();
|
|
193
|
+
this.isBlurring = false;
|
|
194
|
+
const value = this.ValuePrimitive && this.ValueField ? this.GetItemValue(item) : item;
|
|
195
|
+
this.SelectedValue = value;
|
|
196
|
+
this.InputText = this.GetItemText(item);
|
|
197
|
+
this.onChange(value);
|
|
198
|
+
this.ValueChange.emit(value);
|
|
199
|
+
this.Close();
|
|
200
|
+
this.cdr.detectChanges();
|
|
201
|
+
}
|
|
202
|
+
/** Commit the current input text as a value (for AllowCustom or matching item) */
|
|
203
|
+
CommitValue() {
|
|
204
|
+
if (!this.InputText.trim()) {
|
|
205
|
+
// Empty input — clear the value
|
|
206
|
+
if (this.SelectedValue != null) {
|
|
207
|
+
this.SelectedValue = null;
|
|
208
|
+
this.onChange(null);
|
|
209
|
+
this.ValueChange.emit(null);
|
|
210
|
+
}
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
// Try to find a matching item
|
|
214
|
+
const data = (this.Data ?? []);
|
|
215
|
+
const match = data.find(item => this.GetItemText(item).toLowerCase() === this.InputText.toLowerCase());
|
|
216
|
+
if (match) {
|
|
217
|
+
const value = this.ValuePrimitive && this.ValueField ? this.GetItemValue(match) : match;
|
|
218
|
+
if (value !== this.SelectedValue) {
|
|
219
|
+
this.SelectedValue = value;
|
|
220
|
+
this.InputText = this.GetItemText(match);
|
|
221
|
+
this.onChange(value);
|
|
222
|
+
this.ValueChange.emit(value);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
else if (this.AllowCustom) {
|
|
226
|
+
// No match but custom values allowed — emit the typed text
|
|
227
|
+
this.SelectedValue = this.InputText;
|
|
228
|
+
this.onChange(this.InputText);
|
|
229
|
+
this.ValueChange.emit(this.InputText);
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
// No match and no custom — revert to previous display
|
|
233
|
+
this.InputText = this.getDisplayText();
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
IsItemSelected(item) {
|
|
237
|
+
if (this.SelectedValue == null)
|
|
238
|
+
return false;
|
|
239
|
+
if (this.ValuePrimitive && this.ValueField)
|
|
240
|
+
return this.GetItemValue(item) === this.SelectedValue;
|
|
241
|
+
if (this.ValueField && typeof item === 'object' && typeof this.SelectedValue === 'object')
|
|
242
|
+
return this.GetItemValue(item) === this.GetItemValue(this.SelectedValue);
|
|
243
|
+
return item === this.SelectedValue;
|
|
244
|
+
}
|
|
245
|
+
OnKeyDown(event) {
|
|
246
|
+
const items = this.FilteredItems;
|
|
247
|
+
switch (event.key) {
|
|
248
|
+
case 'ArrowDown':
|
|
249
|
+
event.preventDefault();
|
|
250
|
+
if (!this.IsOpen)
|
|
251
|
+
this.Open();
|
|
252
|
+
else
|
|
253
|
+
this.HighlightedIndex = Math.min(this.HighlightedIndex + 1, items.length - 1);
|
|
254
|
+
break;
|
|
255
|
+
case 'ArrowUp':
|
|
256
|
+
event.preventDefault();
|
|
257
|
+
if (this.IsOpen)
|
|
258
|
+
this.HighlightedIndex = Math.max(this.HighlightedIndex - 1, 0);
|
|
259
|
+
break;
|
|
260
|
+
case 'Enter':
|
|
261
|
+
event.preventDefault();
|
|
262
|
+
if (this.IsOpen && this.HighlightedIndex >= 0 && this.HighlightedIndex < items.length) {
|
|
263
|
+
this.SelectItem(items[this.HighlightedIndex]);
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
266
|
+
this.CommitValue();
|
|
267
|
+
this.Close();
|
|
268
|
+
}
|
|
269
|
+
break;
|
|
270
|
+
case 'Escape':
|
|
271
|
+
event.preventDefault();
|
|
272
|
+
this.InputText = this.getDisplayText();
|
|
273
|
+
this.Close();
|
|
274
|
+
break;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
GetItemText(item) {
|
|
278
|
+
if (item == null)
|
|
279
|
+
return '';
|
|
280
|
+
if (typeof item === 'string')
|
|
281
|
+
return item;
|
|
282
|
+
if (this.TextField && typeof item === 'object')
|
|
283
|
+
return String(item[this.TextField] ?? '');
|
|
284
|
+
return String(item);
|
|
285
|
+
}
|
|
286
|
+
GetItemValue(item) {
|
|
287
|
+
if (typeof item === 'string')
|
|
288
|
+
return item;
|
|
289
|
+
if (this.ValueField && typeof item === 'object' && item != null)
|
|
290
|
+
return item[this.ValueField];
|
|
291
|
+
return item;
|
|
292
|
+
}
|
|
293
|
+
TrackByIndex(index) { return index; }
|
|
294
|
+
writeValue(value) {
|
|
295
|
+
this.SelectedValue = value;
|
|
296
|
+
this.InputText = this.getDisplayText();
|
|
297
|
+
}
|
|
298
|
+
registerOnChange(fn) { this.onChange = fn; }
|
|
299
|
+
registerOnTouched(fn) { this.onTouched = fn; }
|
|
300
|
+
setDisabledState(isDisabled) { this.IsDisabled = isDisabled || this.Disabled; }
|
|
301
|
+
ngOnDestroy() { this.Close(); }
|
|
302
|
+
getDisplayText() {
|
|
303
|
+
if (this.SelectedValue == null)
|
|
304
|
+
return '';
|
|
305
|
+
if (this.ValuePrimitive && this.ValueField) {
|
|
306
|
+
const found = (this.Data ?? []).find(item => this.GetItemValue(item) === this.SelectedValue);
|
|
307
|
+
return found ? this.GetItemText(found) : String(this.SelectedValue);
|
|
308
|
+
}
|
|
309
|
+
if (typeof this.SelectedValue === 'string')
|
|
310
|
+
return this.SelectedValue;
|
|
311
|
+
return this.GetItemText(this.SelectedValue);
|
|
312
|
+
}
|
|
313
|
+
getSelectedIndex() {
|
|
314
|
+
if (this.SelectedValue == null)
|
|
315
|
+
return -1;
|
|
316
|
+
return this.FilteredItems.findIndex(item => this.IsItemSelected(item));
|
|
317
|
+
}
|
|
318
|
+
static ɵfac = function MJComboboxComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MJComboboxComponent)(); };
|
|
319
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: MJComboboxComponent, selectors: [["mj-combobox"]], contentQueries: function MJComboboxComponent_ContentQueries(rf, ctx, dirIndex) { if (rf & 1) {
|
|
320
|
+
i0.ɵɵcontentQuery(dirIndex, _c0, 5);
|
|
321
|
+
} if (rf & 2) {
|
|
322
|
+
let _t;
|
|
323
|
+
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.ItemTemplate = _t.first);
|
|
324
|
+
} }, viewQuery: function MJComboboxComponent_Query(rf, ctx) { if (rf & 1) {
|
|
325
|
+
i0.ɵɵviewQuery(_c1, 5)(_c2, 5);
|
|
326
|
+
} if (rf & 2) {
|
|
327
|
+
let _t;
|
|
328
|
+
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.triggerEl = _t.first);
|
|
329
|
+
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.ComboInput = _t.first);
|
|
330
|
+
} }, hostVars: 2, hostBindings: function MJComboboxComponent_HostBindings(rf, ctx) { if (rf & 2) {
|
|
331
|
+
i0.ɵɵclassProp("mj-combobox-host", ctx.hostClass);
|
|
332
|
+
} }, inputs: { Data: "Data", TextField: "TextField", ValueField: "ValueField", Filterable: "Filterable", ValuePrimitive: "ValuePrimitive", Disabled: "Disabled", Placeholder: "Placeholder", AllowCustom: "AllowCustom" }, outputs: { ValueChange: "ValueChange", FilterChange: "FilterChange" }, features: [i0.ɵɵProvidersFeature([{
|
|
333
|
+
provide: NG_VALUE_ACCESSOR,
|
|
334
|
+
useExisting: forwardRef(() => MJComboboxComponent),
|
|
335
|
+
multi: true
|
|
336
|
+
}])], decls: 9, vars: 15, consts: [["trigger", "", "overlayOrigin", "cdkOverlayOrigin"], ["comboInput", ""], ["cdkOverlayOrigin", "", "role", "combobox", "aria-haspopup", "listbox", 1, "mj-combobox"], ["type", "text", "autocomplete", "off", 1, "mj-input", "mj-combobox-input", 3, "input", "focus", "keydown", "blur", "placeholder", "value", "disabled"], ["type", "button", "tabindex", "-1", "aria-label", "Clear", 1, "mj-combobox-clear"], ["type", "button", "tabindex", "-1", 1, "mj-combobox-toggle", 3, "mousedown", "disabled"], [1, "fa-solid", "fa-chevron-down"], ["cdkConnectedOverlay", "", "cdkConnectedOverlayBackdropClass", "mj-dropdown-backdrop", 3, "backdropClick", "detach", "cdkConnectedOverlayOrigin", "cdkConnectedOverlayOpen", "cdkConnectedOverlayPositions", "cdkConnectedOverlayWidth", "cdkConnectedOverlayHasBackdrop"], ["type", "button", "tabindex", "-1", "aria-label", "Clear", 1, "mj-combobox-clear", 3, "mousedown"], [1, "fa-solid", "fa-times"], ["role", "listbox", 1, "mj-dropdown-panel"], ["role", "option", 1, "mj-dropdown-option", 3, "mj-dropdown-option--selected", "mj-dropdown-option--highlighted"], [1, "mj-dropdown-no-data"], ["role", "option", 1, "mj-dropdown-option", 3, "mousedown"], [4, "ngTemplateOutlet", "ngTemplateOutletContext"]], template: function MJComboboxComponent_Template(rf, ctx) { if (rf & 1) {
|
|
337
|
+
const _r1 = i0.ɵɵgetCurrentView();
|
|
338
|
+
i0.ɵɵelementStart(0, "div", 2, 0)(3, "input", 3, 1);
|
|
339
|
+
i0.ɵɵlistener("input", function MJComboboxComponent_Template_input_input_3_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.OnInput($event)); })("focus", function MJComboboxComponent_Template_input_focus_3_listener() { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.OnFocus()); })("keydown", function MJComboboxComponent_Template_input_keydown_3_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.OnKeyDown($event)); })("blur", function MJComboboxComponent_Template_input_blur_3_listener() { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.OnInputBlur()); });
|
|
340
|
+
i0.ɵɵelementEnd();
|
|
341
|
+
i0.ɵɵconditionalCreate(5, MJComboboxComponent_Conditional_5_Template, 2, 0, "button", 4);
|
|
342
|
+
i0.ɵɵelementStart(6, "button", 5);
|
|
343
|
+
i0.ɵɵlistener("mousedown", function MJComboboxComponent_Template_button_mousedown_6_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.OnToggleMouseDown($event)); });
|
|
344
|
+
i0.ɵɵelement(7, "i", 6);
|
|
345
|
+
i0.ɵɵelementEnd()();
|
|
346
|
+
i0.ɵɵtemplate(8, MJComboboxComponent_ng_template_8_Template, 4, 1, "ng-template", 7);
|
|
347
|
+
i0.ɵɵlistener("backdropClick", function MJComboboxComponent_Template_ng_template_backdropClick_8_listener() { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.Close()); })("detach", function MJComboboxComponent_Template_ng_template_detach_8_listener() { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.Close()); });
|
|
348
|
+
} if (rf & 2) {
|
|
349
|
+
const overlayOrigin_r7 = i0.ɵɵreference(2);
|
|
350
|
+
i0.ɵɵclassProp("mj-combobox--open", ctx.IsOpen)("mj-combobox--disabled", ctx.IsDisabled);
|
|
351
|
+
i0.ɵɵattribute("aria-expanded", ctx.IsOpen);
|
|
352
|
+
i0.ɵɵadvance(3);
|
|
353
|
+
i0.ɵɵproperty("placeholder", ctx.Placeholder)("value", ctx.InputText)("disabled", ctx.IsDisabled);
|
|
354
|
+
i0.ɵɵadvance(2);
|
|
355
|
+
i0.ɵɵconditional(ctx.InputText && !ctx.IsDisabled ? 5 : -1);
|
|
356
|
+
i0.ɵɵadvance();
|
|
357
|
+
i0.ɵɵproperty("disabled", ctx.IsDisabled);
|
|
358
|
+
i0.ɵɵadvance(2);
|
|
359
|
+
i0.ɵɵproperty("cdkConnectedOverlayOrigin", overlayOrigin_r7)("cdkConnectedOverlayOpen", ctx.IsOpen)("cdkConnectedOverlayPositions", ctx.Positions)("cdkConnectedOverlayWidth", ctx.TriggerWidth)("cdkConnectedOverlayHasBackdrop", true);
|
|
360
|
+
} }, dependencies: [NgTemplateOutlet, OverlayModule, i1.CdkConnectedOverlay, i1.CdkOverlayOrigin], encapsulation: 2 });
|
|
361
|
+
}
|
|
362
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MJComboboxComponent, [{
|
|
363
|
+
type: Component,
|
|
364
|
+
args: [{
|
|
365
|
+
selector: 'mj-combobox',
|
|
366
|
+
standalone: true,
|
|
367
|
+
imports: [NgTemplateOutlet, OverlayModule],
|
|
368
|
+
template: `
|
|
369
|
+
<div
|
|
370
|
+
class="mj-combobox"
|
|
371
|
+
#trigger
|
|
372
|
+
cdkOverlayOrigin
|
|
373
|
+
#overlayOrigin="cdkOverlayOrigin"
|
|
374
|
+
[class.mj-combobox--open]="IsOpen"
|
|
375
|
+
[class.mj-combobox--disabled]="IsDisabled"
|
|
376
|
+
role="combobox"
|
|
377
|
+
[attr.aria-expanded]="IsOpen"
|
|
378
|
+
aria-haspopup="listbox">
|
|
379
|
+
<input
|
|
380
|
+
#comboInput
|
|
381
|
+
class="mj-input mj-combobox-input"
|
|
382
|
+
type="text"
|
|
383
|
+
[placeholder]="Placeholder"
|
|
384
|
+
[value]="InputText"
|
|
385
|
+
[disabled]="IsDisabled"
|
|
386
|
+
(input)="OnInput($event)"
|
|
387
|
+
(focus)="OnFocus()"
|
|
388
|
+
(keydown)="OnKeyDown($event)"
|
|
389
|
+
(blur)="OnInputBlur()"
|
|
390
|
+
autocomplete="off" />
|
|
391
|
+
@if (InputText && !IsDisabled) {
|
|
392
|
+
<button
|
|
393
|
+
class="mj-combobox-clear"
|
|
394
|
+
type="button"
|
|
395
|
+
tabindex="-1"
|
|
396
|
+
(mousedown)="OnClear($event)"
|
|
397
|
+
aria-label="Clear">
|
|
398
|
+
<i class="fa-solid fa-times"></i>
|
|
399
|
+
</button>
|
|
400
|
+
}
|
|
401
|
+
<button
|
|
402
|
+
class="mj-combobox-toggle"
|
|
403
|
+
type="button"
|
|
404
|
+
tabindex="-1"
|
|
405
|
+
[disabled]="IsDisabled"
|
|
406
|
+
(mousedown)="OnToggleMouseDown($event)">
|
|
407
|
+
<i class="fa-solid fa-chevron-down"></i>
|
|
408
|
+
</button>
|
|
409
|
+
</div>
|
|
410
|
+
|
|
411
|
+
<ng-template
|
|
412
|
+
cdkConnectedOverlay
|
|
413
|
+
[cdkConnectedOverlayOrigin]="overlayOrigin"
|
|
414
|
+
[cdkConnectedOverlayOpen]="IsOpen"
|
|
415
|
+
[cdkConnectedOverlayPositions]="Positions"
|
|
416
|
+
[cdkConnectedOverlayWidth]="TriggerWidth"
|
|
417
|
+
[cdkConnectedOverlayHasBackdrop]="true"
|
|
418
|
+
cdkConnectedOverlayBackdropClass="mj-dropdown-backdrop"
|
|
419
|
+
(backdropClick)="Close()"
|
|
420
|
+
(detach)="Close()">
|
|
421
|
+
<div class="mj-dropdown-panel" role="listbox">
|
|
422
|
+
@for (item of FilteredItems; track TrackByIndex($index)) {
|
|
423
|
+
<div
|
|
424
|
+
class="mj-dropdown-option"
|
|
425
|
+
[class.mj-dropdown-option--selected]="IsItemSelected(item)"
|
|
426
|
+
[class.mj-dropdown-option--highlighted]="HighlightedIndex === $index"
|
|
427
|
+
role="option"
|
|
428
|
+
[attr.aria-selected]="IsItemSelected(item)"
|
|
429
|
+
(mousedown)="SelectItem(item, $event)">
|
|
430
|
+
@if (ItemTemplate) {
|
|
431
|
+
<ng-container *ngTemplateOutlet="ItemTemplate; context: { $implicit: item }"></ng-container>
|
|
432
|
+
} @else {
|
|
433
|
+
{{ GetItemText(item) }}
|
|
434
|
+
}
|
|
435
|
+
</div>
|
|
436
|
+
}
|
|
437
|
+
@if (FilteredItems.length === 0) {
|
|
438
|
+
<div class="mj-dropdown-no-data">No data found</div>
|
|
439
|
+
}
|
|
440
|
+
</div>
|
|
441
|
+
</ng-template>
|
|
442
|
+
`,
|
|
443
|
+
providers: [{
|
|
444
|
+
provide: NG_VALUE_ACCESSOR,
|
|
445
|
+
useExisting: forwardRef(() => MJComboboxComponent),
|
|
446
|
+
multi: true
|
|
447
|
+
}]
|
|
448
|
+
}]
|
|
449
|
+
}], null, { Data: [{
|
|
450
|
+
type: Input
|
|
451
|
+
}], TextField: [{
|
|
452
|
+
type: Input
|
|
453
|
+
}], ValueField: [{
|
|
454
|
+
type: Input
|
|
455
|
+
}], Filterable: [{
|
|
456
|
+
type: Input
|
|
457
|
+
}], ValuePrimitive: [{
|
|
458
|
+
type: Input
|
|
459
|
+
}], Disabled: [{
|
|
460
|
+
type: Input
|
|
461
|
+
}], Placeholder: [{
|
|
462
|
+
type: Input
|
|
463
|
+
}], AllowCustom: [{
|
|
464
|
+
type: Input
|
|
465
|
+
}], ValueChange: [{
|
|
466
|
+
type: Output
|
|
467
|
+
}], FilterChange: [{
|
|
468
|
+
type: Output
|
|
469
|
+
}], ItemTemplate: [{
|
|
470
|
+
type: ContentChild,
|
|
471
|
+
args: ['mjComboboxItem']
|
|
472
|
+
}], triggerEl: [{
|
|
473
|
+
type: ViewChild,
|
|
474
|
+
args: ['trigger']
|
|
475
|
+
}], ComboInput: [{
|
|
476
|
+
type: ViewChild,
|
|
477
|
+
args: ['comboInput']
|
|
478
|
+
}], hostClass: [{
|
|
479
|
+
type: HostBinding,
|
|
480
|
+
args: ['class.mj-combobox-host']
|
|
481
|
+
}] }); })();
|
|
482
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MJComboboxComponent, { className: "MJComboboxComponent", filePath: "lib/combobox/combobox.component.ts", lineNumber: 126 }); })();
|
|
483
|
+
//# sourceMappingURL=combobox.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"combobox.component.js","sourceRoot":"","sources":["../../../src/lib/combobox/combobox.component.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,KAAK,EACL,MAAM,EACN,YAAY,EACZ,UAAU,EACV,WAAW,EAEX,SAAS,EACT,YAAY,EAGZ,MAAM,EACN,iBAAiB,EAClB,MAAM,eAAe,CAAC;AACvB,O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aAAa;;iFAkF9B,mBAAmB;cArF/B,SAAS;eAAC;gBACT,QAAQ,EAAE,aAAa;gBACvB,UAAU,EAAE,IAAI;gBAChB,OAAO,EAAE,CAAC,gBAAgB,EAAE,aAAa,CAAC;gBAC1C,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0ET;gBACD,SAAS,EAAE,CAAC;wBACV,OAAO,EAAE,iBAAiB;wBAC1B,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,oBAAoB,CAAC;wBAClD,KAAK,EAAE,IAAI;qBACZ,CAAC;aACH;;kBAEE,KAAK;;kBAUL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBAEL,MAAM;;kBACN,MAAM;;kBAEN,YAAY;mBAAC,gBAAgB;;kBAE7B,SAAS;mBAAC,SAAS;;kBACnB,SAAS;mBAAC,YAAY;;kBAEtB,WAAW;mBAAC,wBAAwB;;kFA3B1B,mBAAmB","sourcesContent":["import {\n Component,\n Input,\n Output,\n EventEmitter,\n forwardRef,\n HostBinding,\n ElementRef,\n ViewChild,\n ContentChild,\n TemplateRef,\n OnDestroy,\n inject,\n ChangeDetectorRef\n} from '@angular/core';\nimport { NgTemplateOutlet } from '@angular/common';\nimport { NG_VALUE_ACCESSOR, ControlValueAccessor } from '@angular/forms';\nimport { OverlayModule, ConnectedPosition } from '@angular/cdk/overlay';\n\n/**\n * mj-combobox — Editable dropdown with filtering and optional custom values.\n *\n * Replaces `<kendo-combobox>`. Unlike mj-dropdown, the trigger is a text input\n * that filters the list as you type. When AllowCustom is true, typed text that\n * doesn't match any item is emitted as the value.\n *\n * @example\n * ```html\n * <mj-combobox\n * [Data]=\"categories\"\n * TextField=\"text\"\n * ValueField=\"value\"\n * [(ngModel)]=\"selectedCategory\"\n * [ValuePrimitive]=\"true\"\n * [AllowCustom]=\"true\"\n * [Filterable]=\"true\"\n * Placeholder=\"Select or enter new...\">\n * </mj-combobox>\n * ```\n */\n@Component({\n selector: 'mj-combobox',\n standalone: true,\n imports: [NgTemplateOutlet, OverlayModule],\n template: `\n <div\n class=\"mj-combobox\"\n #trigger\n cdkOverlayOrigin\n #overlayOrigin=\"cdkOverlayOrigin\"\n [class.mj-combobox--open]=\"IsOpen\"\n [class.mj-combobox--disabled]=\"IsDisabled\"\n role=\"combobox\"\n [attr.aria-expanded]=\"IsOpen\"\n aria-haspopup=\"listbox\">\n <input\n #comboInput\n class=\"mj-input mj-combobox-input\"\n type=\"text\"\n [placeholder]=\"Placeholder\"\n [value]=\"InputText\"\n [disabled]=\"IsDisabled\"\n (input)=\"OnInput($event)\"\n (focus)=\"OnFocus()\"\n (keydown)=\"OnKeyDown($event)\"\n (blur)=\"OnInputBlur()\"\n autocomplete=\"off\" />\n @if (InputText && !IsDisabled) {\n <button\n class=\"mj-combobox-clear\"\n type=\"button\"\n tabindex=\"-1\"\n (mousedown)=\"OnClear($event)\"\n aria-label=\"Clear\">\n <i class=\"fa-solid fa-times\"></i>\n </button>\n }\n <button\n class=\"mj-combobox-toggle\"\n type=\"button\"\n tabindex=\"-1\"\n [disabled]=\"IsDisabled\"\n (mousedown)=\"OnToggleMouseDown($event)\">\n <i class=\"fa-solid fa-chevron-down\"></i>\n </button>\n </div>\n\n <ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"overlayOrigin\"\n [cdkConnectedOverlayOpen]=\"IsOpen\"\n [cdkConnectedOverlayPositions]=\"Positions\"\n [cdkConnectedOverlayWidth]=\"TriggerWidth\"\n [cdkConnectedOverlayHasBackdrop]=\"true\"\n cdkConnectedOverlayBackdropClass=\"mj-dropdown-backdrop\"\n (backdropClick)=\"Close()\"\n (detach)=\"Close()\">\n <div class=\"mj-dropdown-panel\" role=\"listbox\">\n @for (item of FilteredItems; track TrackByIndex($index)) {\n <div\n class=\"mj-dropdown-option\"\n [class.mj-dropdown-option--selected]=\"IsItemSelected(item)\"\n [class.mj-dropdown-option--highlighted]=\"HighlightedIndex === $index\"\n role=\"option\"\n [attr.aria-selected]=\"IsItemSelected(item)\"\n (mousedown)=\"SelectItem(item, $event)\">\n @if (ItemTemplate) {\n <ng-container *ngTemplateOutlet=\"ItemTemplate; context: { $implicit: item }\"></ng-container>\n } @else {\n {{ GetItemText(item) }}\n }\n </div>\n }\n @if (FilteredItems.length === 0) {\n <div class=\"mj-dropdown-no-data\">No data found</div>\n }\n </div>\n </ng-template>\n `,\n providers: [{\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => MJComboboxComponent),\n multi: true\n }]\n})\nexport class MJComboboxComponent implements ControlValueAccessor, OnDestroy {\n @Input()\n set Data(value: Record<string, unknown>[] | string[] | readonly unknown[] | null) {\n this._data = value;\n // Re-resolve display text when data arrives after writeValue\n if (this.SelectedValue != null && !this.InputText) {\n this.InputText = this.getDisplayText();\n }\n }\n get Data(): Record<string, unknown>[] | string[] | readonly unknown[] | null { return this._data; }\n private _data: Record<string, unknown>[] | string[] | readonly unknown[] | null = [];\n @Input() TextField = '';\n @Input() ValueField = '';\n @Input() Filterable = true;\n @Input() ValuePrimitive = false;\n @Input() Disabled = false;\n @Input() Placeholder = '';\n @Input() AllowCustom = false;\n\n @Output() ValueChange = new EventEmitter<unknown>();\n @Output() FilterChange = new EventEmitter<string>();\n\n @ContentChild('mjComboboxItem') ItemTemplate: TemplateRef<{ $implicit: unknown }> | null = null;\n\n @ViewChild('trigger') private triggerEl!: ElementRef<HTMLElement>;\n @ViewChild('comboInput') ComboInput!: ElementRef<HTMLInputElement>;\n\n @HostBinding('class.mj-combobox-host') readonly hostClass = true;\n\n private cdr = inject(ChangeDetectorRef);\n\n IsOpen = false;\n IsDisabled = false;\n HighlightedIndex = -1;\n SelectedValue: unknown = null;\n TriggerWidth = 0;\n InputText = '';\n\n Positions: ConnectedPosition[] = [\n { originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top' },\n { originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom' }\n ];\n\n private onChange: (value: unknown) => void = () => {};\n private onTouched: () => void = () => {};\n private isBlurring = false;\n\n get FilteredItems(): unknown[] {\n const data = (this.Data ?? []) as unknown[];\n if (!this.Filterable || !this.InputText) return data;\n const search = this.InputText.toLowerCase();\n return data.filter(item => this.GetItemText(item).toLowerCase().includes(search));\n }\n\n OnInput(event: Event): void {\n this.InputText = (event.target as HTMLInputElement).value;\n this.HighlightedIndex = 0;\n this.FilterChange.emit(this.InputText);\n if (!this.IsOpen) this.Open();\n this.cdr.detectChanges();\n }\n\n OnFocus(): void {\n if (!this.IsOpen) this.Open();\n }\n\n OnToggleMouseDown(event: Event): void {\n event.preventDefault(); // Prevent blur on the input\n this.Toggle();\n }\n\n OnClear(event: Event): void {\n event.preventDefault();\n event.stopPropagation();\n this.isBlurring = false;\n this.InputText = '';\n this.SelectedValue = null;\n this.onChange(null);\n this.ValueChange.emit(null);\n this.Close();\n this.cdr.detectChanges();\n }\n\n OnInputBlur(): void {\n this.isBlurring = true;\n setTimeout(() => {\n if (!this.isBlurring) return;\n this.isBlurring = false;\n this.CommitValue();\n this.Close();\n this.onTouched();\n }, 150);\n }\n\n Toggle(): void {\n if (this.IsDisabled) return;\n this.IsOpen ? this.Close() : this.Open();\n }\n\n Open(): void {\n if (this.IsDisabled || this.IsOpen) return;\n this.TriggerWidth = this.triggerEl?.nativeElement.offsetWidth ?? 200;\n this.IsOpen = true;\n this.HighlightedIndex = this.getSelectedIndex();\n this.cdr.detectChanges();\n }\n\n Close(): void {\n if (!this.IsOpen) return;\n this.IsOpen = false;\n this.HighlightedIndex = -1;\n this.cdr.detectChanges();\n }\n\n SelectItem(item: unknown, event?: Event): void {\n event?.preventDefault();\n event?.stopPropagation();\n this.isBlurring = false;\n\n const value = this.ValuePrimitive && this.ValueField ? this.GetItemValue(item) : item;\n this.SelectedValue = value;\n this.InputText = this.GetItemText(item);\n this.onChange(value);\n this.ValueChange.emit(value);\n this.Close();\n this.cdr.detectChanges();\n }\n\n /** Commit the current input text as a value (for AllowCustom or matching item) */\n private CommitValue(): void {\n if (!this.InputText.trim()) {\n // Empty input — clear the value\n if (this.SelectedValue != null) {\n this.SelectedValue = null;\n this.onChange(null);\n this.ValueChange.emit(null);\n }\n return;\n }\n\n // Try to find a matching item\n const data = (this.Data ?? []) as unknown[];\n const match = data.find(item => this.GetItemText(item).toLowerCase() === this.InputText.toLowerCase());\n if (match) {\n const value = this.ValuePrimitive && this.ValueField ? this.GetItemValue(match) : match;\n if (value !== this.SelectedValue) {\n this.SelectedValue = value;\n this.InputText = this.GetItemText(match);\n this.onChange(value);\n this.ValueChange.emit(value);\n }\n } else if (this.AllowCustom) {\n // No match but custom values allowed — emit the typed text\n this.SelectedValue = this.InputText;\n this.onChange(this.InputText);\n this.ValueChange.emit(this.InputText);\n } else {\n // No match and no custom — revert to previous display\n this.InputText = this.getDisplayText();\n }\n }\n\n IsItemSelected(item: unknown): boolean {\n if (this.SelectedValue == null) return false;\n if (this.ValuePrimitive && this.ValueField) return this.GetItemValue(item) === this.SelectedValue;\n if (this.ValueField && typeof item === 'object' && typeof this.SelectedValue === 'object')\n return this.GetItemValue(item) === this.GetItemValue(this.SelectedValue);\n return item === this.SelectedValue;\n }\n\n OnKeyDown(event: KeyboardEvent): void {\n const items = this.FilteredItems;\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault();\n if (!this.IsOpen) this.Open();\n else this.HighlightedIndex = Math.min(this.HighlightedIndex + 1, items.length - 1);\n break;\n case 'ArrowUp':\n event.preventDefault();\n if (this.IsOpen) this.HighlightedIndex = Math.max(this.HighlightedIndex - 1, 0);\n break;\n case 'Enter':\n event.preventDefault();\n if (this.IsOpen && this.HighlightedIndex >= 0 && this.HighlightedIndex < items.length) {\n this.SelectItem(items[this.HighlightedIndex]);\n } else {\n this.CommitValue();\n this.Close();\n }\n break;\n case 'Escape':\n event.preventDefault();\n this.InputText = this.getDisplayText();\n this.Close();\n break;\n }\n }\n\n GetItemText(item: unknown): string {\n if (item == null) return '';\n if (typeof item === 'string') return item;\n if (this.TextField && typeof item === 'object') return String((item as Record<string, unknown>)[this.TextField] ?? '');\n return String(item);\n }\n\n GetItemValue(item: unknown): unknown {\n if (typeof item === 'string') return item;\n if (this.ValueField && typeof item === 'object' && item != null) return (item as Record<string, unknown>)[this.ValueField];\n return item;\n }\n\n TrackByIndex(index: number): number { return index; }\n\n writeValue(value: unknown): void {\n this.SelectedValue = value;\n this.InputText = this.getDisplayText();\n }\n\n registerOnChange(fn: (value: unknown) => void): void { this.onChange = fn; }\n registerOnTouched(fn: () => void): void { this.onTouched = fn; }\n setDisabledState(isDisabled: boolean): void { this.IsDisabled = isDisabled || this.Disabled; }\n ngOnDestroy(): void { this.Close(); }\n\n private getDisplayText(): string {\n if (this.SelectedValue == null) return '';\n if (this.ValuePrimitive && this.ValueField) {\n const found = ((this.Data ?? []) as unknown[]).find(item => this.GetItemValue(item) === this.SelectedValue);\n return found ? this.GetItemText(found) : String(this.SelectedValue);\n }\n if (typeof this.SelectedValue === 'string') return this.SelectedValue;\n return this.GetItemText(this.SelectedValue as Record<string, unknown>);\n }\n\n private getSelectedIndex(): number {\n if (this.SelectedValue == null) return -1;\n return this.FilteredItems.findIndex(item => this.IsItemSelected(item));\n }\n}\n"]}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MJ Combobox Styles
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
.mj-combobox-host {
|
|
6
|
+
display: inline-block;
|
|
7
|
+
width: 100%;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.mj-combobox {
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
border: 1px solid var(--mj-border-default);
|
|
14
|
+
border-radius: var(--mj-radius-md);
|
|
15
|
+
background: var(--mj-bg-surface);
|
|
16
|
+
transition: var(--mj-transition-colors);
|
|
17
|
+
overflow: hidden;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.mj-combobox:focus-within {
|
|
21
|
+
border-color: var(--mj-brand-primary);
|
|
22
|
+
box-shadow: 0 0 0 2px color-mix(in srgb, var(--mj-brand-primary) 15%, transparent);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.mj-combobox--disabled {
|
|
26
|
+
opacity: 0.6;
|
|
27
|
+
pointer-events: none;
|
|
28
|
+
background: var(--mj-bg-surface-sunken);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.mj-combobox-input {
|
|
32
|
+
flex: 1;
|
|
33
|
+
border: none !important;
|
|
34
|
+
box-shadow: none !important;
|
|
35
|
+
background: transparent !important;
|
|
36
|
+
outline: none;
|
|
37
|
+
padding: 8px 12px;
|
|
38
|
+
font-size: 0.875rem;
|
|
39
|
+
color: var(--mj-text-primary);
|
|
40
|
+
min-width: 0;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.mj-combobox-input::placeholder {
|
|
44
|
+
color: var(--mj-text-disabled);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.mj-combobox-clear {
|
|
48
|
+
display: flex;
|
|
49
|
+
align-items: center;
|
|
50
|
+
justify-content: center;
|
|
51
|
+
width: 24px;
|
|
52
|
+
flex-shrink: 0;
|
|
53
|
+
border: none;
|
|
54
|
+
background: none;
|
|
55
|
+
color: var(--mj-text-disabled);
|
|
56
|
+
cursor: pointer;
|
|
57
|
+
padding: 0;
|
|
58
|
+
transition: var(--mj-transition-colors);
|
|
59
|
+
font-size: 12px;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.mj-combobox-clear:hover {
|
|
63
|
+
color: var(--mj-text-primary);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.mj-combobox-toggle {
|
|
67
|
+
display: flex;
|
|
68
|
+
align-items: center;
|
|
69
|
+
justify-content: center;
|
|
70
|
+
width: 32px;
|
|
71
|
+
flex-shrink: 0;
|
|
72
|
+
border: none;
|
|
73
|
+
background: none;
|
|
74
|
+
color: var(--mj-text-muted);
|
|
75
|
+
cursor: pointer;
|
|
76
|
+
padding: 0;
|
|
77
|
+
transition: var(--mj-transition-colors);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.mj-combobox-toggle:hover {
|
|
81
|
+
color: var(--mj-text-primary);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.mj-combobox--open .mj-combobox-toggle i {
|
|
85
|
+
transform: rotate(180deg);
|
|
86
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { EventEmitter, OnDestroy } from '@angular/core';
|
|
2
|
+
import { ControlValueAccessor } from '@angular/forms';
|
|
3
|
+
import { ConnectedPosition } from '@angular/cdk/overlay';
|
|
4
|
+
import { CalendarDay } from '../calendar/calendar-utils';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
/**
|
|
7
|
+
* mj-datepicker — Date picker with calendar popup. Replaces `<kendo-datepicker>`.
|
|
8
|
+
*/
|
|
9
|
+
export declare class MJDatepickerComponent implements ControlValueAccessor, OnDestroy {
|
|
10
|
+
Min: Date | null;
|
|
11
|
+
Max: Date | null;
|
|
12
|
+
Format: string;
|
|
13
|
+
Placeholder: string;
|
|
14
|
+
Disabled: boolean;
|
|
15
|
+
ValueChange: EventEmitter<Date | null>;
|
|
16
|
+
private triggerEl;
|
|
17
|
+
readonly hostClass = true;
|
|
18
|
+
private cdr;
|
|
19
|
+
IsOpen: boolean;
|
|
20
|
+
IsDisabled: boolean;
|
|
21
|
+
DisplayValue: string;
|
|
22
|
+
Weeks: CalendarDay[][];
|
|
23
|
+
WeekDays: string[];
|
|
24
|
+
Positions: ConnectedPosition[];
|
|
25
|
+
private viewDate;
|
|
26
|
+
private selectedDate;
|
|
27
|
+
private onChange;
|
|
28
|
+
private onTouched;
|
|
29
|
+
get MonthYearLabel(): string;
|
|
30
|
+
Toggle(): void;
|
|
31
|
+
Open(): void;
|
|
32
|
+
Close(): void;
|
|
33
|
+
PreviousMonth(): void;
|
|
34
|
+
NextMonth(): void;
|
|
35
|
+
SelectDate(day: CalendarDay): void;
|
|
36
|
+
SelectToday(): void;
|
|
37
|
+
IsSelectedDay(day: CalendarDay): boolean;
|
|
38
|
+
IsOutOfRange(day: CalendarDay): boolean;
|
|
39
|
+
OnInputChange(event: Event): void;
|
|
40
|
+
OnBlur(): void;
|
|
41
|
+
OnKeyDown(event: KeyboardEvent): void;
|
|
42
|
+
writeValue(value: Date | string | null): void;
|
|
43
|
+
registerOnChange(fn: (value: Date | null) => void): void;
|
|
44
|
+
registerOnTouched(fn: () => void): void;
|
|
45
|
+
setDisabledState(isDisabled: boolean): void;
|
|
46
|
+
ngOnDestroy(): void;
|
|
47
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MJDatepickerComponent, never>;
|
|
48
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<MJDatepickerComponent, "mj-datepicker", never, { "Min": { "alias": "Min"; "required": false; }; "Max": { "alias": "Max"; "required": false; }; "Format": { "alias": "Format"; "required": false; }; "Placeholder": { "alias": "Placeholder"; "required": false; }; "Disabled": { "alias": "Disabled"; "required": false; }; }, { "ValueChange": "ValueChange"; }, never, never, true, never>;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=datepicker.component.d.ts.map
|