@d4k-ui/nbx-inputs 21.0.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.
@@ -0,0 +1,1342 @@
1
+ import * as i0 from '@angular/core';
2
+ import { inject, ElementRef, Injector, DestroyRef, input, signal, computed, effect, Directive, Component, HostListener, ChangeDetectionStrategy, viewChild, viewChildren, output, importProvidersFrom } from '@angular/core';
3
+ import { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';
4
+ import * as i1$2 from '@angular/forms';
5
+ import { FormControl, FormArray, FormGroup, FormControlName, FormArrayName, NgControl, Validators, ValueChangeEvent, StatusChangeEvent, PristineChangeEvent, ReactiveFormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
6
+ import { Observable, finalize, throttleTime, startWith, map } from 'rxjs';
7
+ import { Clipboard } from '@angular/cdk/clipboard';
8
+ import * as i1$1 from '@angular/cdk/overlay';
9
+ import { Overlay, OverlayConfig, OverlayModule } from '@angular/cdk/overlay';
10
+ import { ComponentPortal } from '@angular/cdk/portal';
11
+ import { trigger, transition, style, animate } from '@angular/animations';
12
+ import { NbIconComponent, NbTooltipDirective, NbOptionComponent, NbOptionListComponent, NbCheckboxComponent, NbInputDirective, NbButtonComponent, NbFormFieldComponent, NbSuffixDirective, NbDatepickerDirective, NbDatepickerComponent, NbDateService, NbRangepickerComponent, NbDateTimePickerComponent, NbSelectComponent } from '@d4k-ui/theme';
13
+ import { KeyValuePipe } from '@angular/common';
14
+ import * as i1 from '@angular/cdk/scrolling';
15
+ import { CdkVirtualScrollViewport, ScrollingModule } from '@angular/cdk/scrolling';
16
+
17
+ /**
18
+ *
19
+ * @param formGroup
20
+ * @param onlyActive if true, only not disabled controls will be marked as dirty
21
+ */
22
+ function markAllControlsAsDirty(abstractControl) {
23
+ if (abstractControl instanceof FormControl) {
24
+ abstractControl.markAsDirty();
25
+ return;
26
+ }
27
+ if (abstractControl instanceof FormArray) {
28
+ abstractControl.controls.forEach((control) => {
29
+ markAllControlsAsDirty(control);
30
+ });
31
+ return;
32
+ }
33
+ if (abstractControl instanceof FormGroup) {
34
+ Object.values(abstractControl.controls).forEach((control) => {
35
+ markAllControlsAsDirty(control);
36
+ });
37
+ }
38
+ }
39
+ function isQueryIncludesInObject(obj, query) {
40
+ return Object.keys(obj).some((key) => {
41
+ if (!obj[key]) {
42
+ return false;
43
+ }
44
+ if (Array.isArray(obj[key])) {
45
+ return obj[key].some((item) => isQueryIncludesInObject(item, query));
46
+ }
47
+ if (typeof obj[key] === 'object') {
48
+ return isQueryIncludesInObject(obj[key], query);
49
+ }
50
+ if (typeof obj[key] === 'string' || typeof obj[key] === 'number') {
51
+ return obj[key].toString().toLowerCase().includes(query.toLowerCase());
52
+ }
53
+ return false;
54
+ });
55
+ }
56
+ function getFilteredBySearchArray(arr, query) {
57
+ return arr.filter((item) => isQueryIncludesInObject(item, query));
58
+ }
59
+ function filterAndSortOptionsBySearch(list, query) {
60
+ const filtered = filterOptionsBySearch(list, query);
61
+ return sortOptionsBySearchIndex(filtered, query.toString(), 'title');
62
+ }
63
+ /** Returned filtered array of options witch includes query */
64
+ function filterOptionsBySearch(list, query) {
65
+ if (!query)
66
+ return [];
67
+ const queryInLowerCase = query.toString().toLowerCase();
68
+ return list.filter((item) => item.title?.toString()?.toLowerCase()?.includes(queryInLowerCase));
69
+ }
70
+ /** Returned array of options sorted by query includes index */
71
+ function sortOptionsBySearchIndex(list, query, keySortBy) {
72
+ const queryInLowerCase = query.toLowerCase();
73
+ return list.sort((a, b) => a[keySortBy].toLowerCase().indexOf(queryInLowerCase) - b[keySortBy].toLowerCase().indexOf(queryInLowerCase));
74
+ }
75
+ /**
76
+ * @returns Object { [controlKey]: control value if value not undefined } value of any control will be included if control is dirty
77
+ */
78
+ function getOnlyDirtyControlsValuesRecursive(form, excludeKeys) {
79
+ const data = {};
80
+ Object.entries(form.controls).forEach(([key, control]) => {
81
+ if (excludeKeys && excludeKeys.includes(key)) {
82
+ return;
83
+ }
84
+ if (control instanceof FormControl && control.dirty && typeof control.value !== 'undefined') {
85
+ data[key] = control.value;
86
+ return;
87
+ }
88
+ if (control instanceof FormArray && form.dirty) {
89
+ const valuesArray = control.getRawValue();
90
+ if (valuesArray?.length) {
91
+ data[key] = valuesArray;
92
+ }
93
+ return;
94
+ }
95
+ if (control instanceof FormGroup) {
96
+ const valuesObject = getOnlyDirtyControlsValuesRecursive(control);
97
+ if (Object.keys(valuesObject)?.length) {
98
+ data[key] = valuesObject;
99
+ }
100
+ }
101
+ });
102
+ return data;
103
+ }
104
+ function getRandomId(prefix = '', suffix = '') {
105
+ return `${prefix ? `${prefix}-` : ''}${Math.random().toString(16).slice(2)}${suffix ? `-${suffix}` : ''}`;
106
+ }
107
+ function resizeObservable(elem, throttleDelay = 100) {
108
+ let notifier;
109
+ const resizeObserver = new ResizeObserver(([entry]) => {
110
+ notifier?.next(entry);
111
+ });
112
+ resizeObserver.observe(elem);
113
+ return new Observable((observer) => {
114
+ notifier = observer;
115
+ }).pipe(finalize(() => {
116
+ resizeObserver.unobserve(elem);
117
+ resizeObserver.disconnect();
118
+ }), throttleTime(throttleDelay));
119
+ }
120
+
121
+ function isValueExist(value) {
122
+ if (typeof value === 'undefined') {
123
+ return false;
124
+ }
125
+ if (typeof value === 'boolean') {
126
+ return value ? 'string' : false;
127
+ }
128
+ if (!value.length) {
129
+ return 'string';
130
+ }
131
+ return value === 'json' ? 'json' : 'string';
132
+ }
133
+ class NbxControlValueAccessorBaseDirective {
134
+ elementRef = inject(ElementRef);
135
+ injector = inject(Injector);
136
+ destroyRef = inject(DestroyRef);
137
+ id = input(...(ngDevMode ? [undefined, { debugName: "id" }] : /* istanbul ignore next */ []));
138
+ placeholder = input('', ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
139
+ labelInfo = input(...(ngDevMode ? [undefined, { debugName: "labelInfo" }] : /* istanbul ignore next */ []));
140
+ status = input('basic', ...(ngDevMode ? [{ debugName: "status" }] : /* istanbul ignore next */ []));
141
+ withCopyButton = input(false, { ...(ngDevMode ? { debugName: "withCopyButton" } : /* istanbul ignore next */ {}), transform: isValueExist });
142
+ size = input('medium', ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
143
+ customErrorsMessages = input({}, ...(ngDevMode ? [{ debugName: "customErrorsMessages" }] : /* istanbul ignore next */ []));
144
+ labelPosition = input(...(ngDevMode ? [undefined, { debugName: "labelPosition" }] : /* istanbul ignore next */ []));
145
+ styleVars = {};
146
+ value = signal(null, ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
147
+ touched = signal(false, ...(ngDevMode ? [{ debugName: "touched" }] : /* istanbul ignore next */ []));
148
+ disabled = signal(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
149
+ dirty = signal(false, ...(ngDevMode ? [{ debugName: "dirty" }] : /* istanbul ignore next */ []));
150
+ invalid = signal(false, ...(ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []));
151
+ errors = signal(null, ...(ngDevMode ? [{ debugName: "errors" }] : /* istanbul ignore next */ []));
152
+ initId = getRandomId();
153
+ withoutControl = false;
154
+ control;
155
+ errorDisplayedState = computed(() => {
156
+ return this.invalid() && this.dirty();
157
+ }, ...(ngDevMode ? [{ debugName: "errorDisplayedState" }] : /* istanbul ignore next */ []));
158
+ getContext() {
159
+ return {
160
+ value: this.value,
161
+ hasRequiredValidator: this.hasRequiredValidator,
162
+ errorDisplayedState: this.errorDisplayedState,
163
+ errors: this.errors,
164
+ disabled: this.disabled,
165
+ labelInfo: this.labelInfo,
166
+ withCopyButton: this.withCopyButton,
167
+ labelPosition: this.labelPosition,
168
+ customErrorsMessages: this.customErrorsMessages,
169
+ };
170
+ }
171
+ constructor() {
172
+ effect(() => {
173
+ this.elementRef.nativeElement.setAttribute('style', this.getStylesString(this.size(), this.status()));
174
+ });
175
+ }
176
+ ngAfterContentInit() {
177
+ try {
178
+ this.control = this.injector.get(FormControlName).control;
179
+ this.subscribeToStateChange(this.control);
180
+ }
181
+ catch {
182
+ try {
183
+ this.control = this.injector.get(FormArrayName).control;
184
+ this.subscribeToStateChange(this.control);
185
+ }
186
+ catch {
187
+ try {
188
+ const ngControl = this.injector.get(NgControl);
189
+ if (ngControl) {
190
+ this.control = ngControl.control;
191
+ this.subscribeToStateChange(this.control);
192
+ }
193
+ }
194
+ catch {
195
+ this.withoutControl = true;
196
+ this.control = new FormControl();
197
+ this.subscribeToStateChange(this.control);
198
+ }
199
+ }
200
+ }
201
+ }
202
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
203
+ writeValue(value) {
204
+ // this.value.set(value);
205
+ }
206
+ getInputId(prefix) {
207
+ return this.id() || prefix + '-' + this.initId;
208
+ }
209
+ valueChanged(value) {
210
+ this.onTouched();
211
+ this.onChange(value);
212
+ if (this.withoutControl) {
213
+ this.control?.setValue(value);
214
+ this.control?.markAsDirty();
215
+ }
216
+ }
217
+ onChange(value) {
218
+ return value;
219
+ }
220
+ onTouched() {
221
+ if (!this.touched()) {
222
+ this.touched.set(true);
223
+ }
224
+ }
225
+ registerOnChange(fn) {
226
+ this.onChange = fn;
227
+ }
228
+ registerOnTouched(fn) {
229
+ this.onTouched = fn;
230
+ }
231
+ setDisabledState(isDisabled) {
232
+ this.disabled.set(isDisabled);
233
+ }
234
+ get hasRequiredValidator() {
235
+ return !!this.control?.hasValidator(Validators.required);
236
+ }
237
+ getStylesString(size, status) {
238
+ return `--nbx-input-background-color: var(--input-${status}-background-color); --nbx-input-font-size: var(--input-${size}-text-font-size, 1rem); --nbx-input-font-weight: var(--input-${size}-text-font-weight); --nbx-input-line-height: var(--input-${size}-text-line-height); --nbx-input-text-color: var(--input-${status}-text-color)`;
239
+ }
240
+ subscribeToStateChange(control) {
241
+ if (!control) {
242
+ return;
243
+ }
244
+ this.value.set(control.value);
245
+ this.invalid.set(control.invalid);
246
+ this.errors.set(control.errors);
247
+ control.events.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((event) => {
248
+ if (event instanceof ValueChangeEvent) {
249
+ this.value.set(event.value);
250
+ this.errors.set(control.errors);
251
+ }
252
+ if (event instanceof StatusChangeEvent) {
253
+ this.invalid.set(event.status === 'INVALID');
254
+ }
255
+ if (event instanceof PristineChangeEvent) {
256
+ this.dirty.set(!event.pristine);
257
+ }
258
+ });
259
+ }
260
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: NbxControlValueAccessorBaseDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
261
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.15", type: NbxControlValueAccessorBaseDirective, isStandalone: true, inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, labelInfo: { classPropertyName: "labelInfo", publicName: "labelInfo", isSignal: true, isRequired: false, transformFunction: null }, status: { classPropertyName: "status", publicName: "status", isSignal: true, isRequired: false, transformFunction: null }, withCopyButton: { classPropertyName: "withCopyButton", publicName: "withCopyButton", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, customErrorsMessages: { classPropertyName: "customErrorsMessages", publicName: "customErrorsMessages", isSignal: true, isRequired: false, transformFunction: null }, labelPosition: { classPropertyName: "labelPosition", publicName: "labelPosition", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
262
+ }
263
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: NbxControlValueAccessorBaseDirective, decorators: [{
264
+ type: Directive
265
+ }], ctorParameters: () => [], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], labelInfo: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelInfo", required: false }] }], status: [{ type: i0.Input, args: [{ isSignal: true, alias: "status", required: false }] }], withCopyButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "withCopyButton", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], customErrorsMessages: [{ type: i0.Input, args: [{ isSignal: true, alias: "customErrorsMessages", required: false }] }], labelPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelPosition", required: false }] }] } });
266
+
267
+ class NbxCustomTooltipComponent {
268
+ text = input('', ...(ngDevMode ? [{ debugName: "text" }] : /* istanbul ignore next */ []));
269
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: NbxCustomTooltipComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
270
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.15", type: NbxCustomTooltipComponent, isStandalone: true, selector: "nbx-custom-tooltip", inputs: { text: { classPropertyName: "text", publicName: "text", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "@tooltip": "true" } }, ngImport: i0, template: `<div class="tooltip-wrap">
271
+ {{ text() }}
272
+ <div class="triangle"></div>
273
+ </div>`, isInline: true, styles: [".tooltip-wrap{background-color:#000000e6;color:#fff;padding:5px;border-radius:5px;position:relative}div.triangle{position:absolute;top:100%;left:50%;transform:translate(-50%);width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;border-top:5px solid rgba(0,0,0,.9)}\n"], animations: [
274
+ trigger('tooltip', [
275
+ transition(':enter', [style({ opacity: 0 }), animate(200, style({ opacity: 1 }))]),
276
+ transition(':leave', [animate(200, style({ opacity: 0 }))]),
277
+ ]),
278
+ ] });
279
+ }
280
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: NbxCustomTooltipComponent, decorators: [{
281
+ type: Component,
282
+ args: [{ standalone: true, selector: 'nbx-custom-tooltip', template: `<div class="tooltip-wrap">
283
+ {{ text() }}
284
+ <div class="triangle"></div>
285
+ </div>`, host: {
286
+ '[@tooltip]': 'true',
287
+ }, animations: [
288
+ trigger('tooltip', [
289
+ transition(':enter', [style({ opacity: 0 }), animate(200, style({ opacity: 1 }))]),
290
+ transition(':leave', [animate(200, style({ opacity: 0 }))]),
291
+ ]),
292
+ ], styles: [".tooltip-wrap{background-color:#000000e6;color:#fff;padding:5px;border-radius:5px;position:relative}div.triangle{position:absolute;top:100%;left:50%;transform:translate(-50%);width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;border-top:5px solid rgba(0,0,0,.9)}\n"] }]
293
+ }], propDecorators: { text: [{ type: i0.Input, args: [{ isSignal: true, alias: "text", required: false }] }] } });
294
+
295
+ function getPreparedCopyText(value, asJson = false) {
296
+ if (asJson) {
297
+ return JSON.stringify(value);
298
+ }
299
+ if (!value) {
300
+ return '';
301
+ }
302
+ if (Array.isArray(value)) {
303
+ return value.reduce((acc, curr) => {
304
+ if (acc.length) {
305
+ acc += `, ${curr}`;
306
+ }
307
+ else {
308
+ acc = `${curr}`;
309
+ }
310
+ return acc;
311
+ }, '');
312
+ }
313
+ const newString = value.toString().replace(/\\./g, ' ').replace(/\s\s+/g, ' ').trim();
314
+ return newString;
315
+ }
316
+ class NbxClipboardDirective {
317
+ clipboard = inject(Clipboard);
318
+ overlay = inject(Overlay);
319
+ elementRef = inject(ElementRef);
320
+ value = input('', { ...(ngDevMode ? { debugName: "value" } : /* istanbul ignore next */ {}), alias: 'nbxClipboard' });
321
+ nbxClipboardCopyType = input('string', ...(ngDevMode ? [{ debugName: "nbxClipboardCopyType" }] : /* istanbul ignore next */ []));
322
+ onClick() {
323
+ this.copyToClipboard();
324
+ this.showAnimation();
325
+ this.showPopover();
326
+ return false;
327
+ }
328
+ ngOnDestroy() {
329
+ this.overlayRef?.dispose();
330
+ }
331
+ showAnimation() {
332
+ this.elementRef.nativeElement
333
+ .animate([
334
+ { transform: 'scale(1.1)' },
335
+ { transform: 'scale(1.2)' },
336
+ { transform: 'scale(1.4)' },
337
+ { transform: 'scale(1)' },
338
+ ], {
339
+ duration: 500,
340
+ easing: 'ease',
341
+ trigger: 'enter',
342
+ })
343
+ .play();
344
+ }
345
+ overlayRef;
346
+ copyToClipboard() {
347
+ this.clipboard.copy(getPreparedCopyText(this.value(), this.nbxClipboardCopyType() === 'json'));
348
+ }
349
+ showPopover() {
350
+ if (!this.elementRef.nativeElement)
351
+ return;
352
+ this.show();
353
+ setTimeout(() => {
354
+ this.hide();
355
+ }, 700);
356
+ }
357
+ show() {
358
+ if (this.overlayRef) {
359
+ this.overlayRef.dispose();
360
+ }
361
+ this.overlayRef = this.overlay.create(this.getOverlayConfig());
362
+ const tooltipPortal = new ComponentPortal(NbxCustomTooltipComponent);
363
+ const tooltipRef = this.overlayRef.attach(tooltipPortal);
364
+ tooltipRef.setInput('text', 'Copied');
365
+ }
366
+ hide() {
367
+ this.overlayRef.detach();
368
+ this.overlayRef.dispose();
369
+ }
370
+ getOverlayConfig() {
371
+ const positionStrategy = this.overlay
372
+ .position()
373
+ .flexibleConnectedTo(this.elementRef)
374
+ .withPush(false)
375
+ .withPositions([
376
+ {
377
+ originX: 'center',
378
+ originY: 'top',
379
+ overlayX: 'center',
380
+ overlayY: 'bottom',
381
+ offsetY: -5,
382
+ },
383
+ {
384
+ originX: 'center',
385
+ originY: 'bottom',
386
+ overlayX: 'center',
387
+ overlayY: 'top',
388
+ offsetY: 5,
389
+ },
390
+ ]);
391
+ return new OverlayConfig({
392
+ positionStrategy: positionStrategy,
393
+ hasBackdrop: true,
394
+ backdropClass: 'cdk-overlay-transparent-backdrop',
395
+ });
396
+ }
397
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: NbxClipboardDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
398
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.15", type: NbxClipboardDirective, isStandalone: true, selector: "[nbxClipboard]", inputs: { value: { classPropertyName: "value", publicName: "nbxClipboard", isSignal: true, isRequired: false, transformFunction: null }, nbxClipboardCopyType: { classPropertyName: "nbxClipboardCopyType", publicName: "nbxClipboardCopyType", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "onClick()" }, properties: { "attr.disabled": "!this.value() || null" } }, ngImport: i0 });
399
+ }
400
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: NbxClipboardDirective, decorators: [{
401
+ type: Directive,
402
+ args: [{
403
+ selector: '[nbxClipboard]',
404
+ standalone: true,
405
+ host: {
406
+ '[attr.disabled]': '!this.value() || null',
407
+ },
408
+ }]
409
+ }], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "nbxClipboard", required: false }] }], nbxClipboardCopyType: [{ type: i0.Input, args: [{ isSignal: true, alias: "nbxClipboardCopyType", required: false }] }], onClick: [{
410
+ type: HostListener,
411
+ args: ['click']
412
+ }] } });
413
+
414
+ class IntOrFloatDirective {
415
+ nbxIntOrFloat = input.required(...(ngDevMode ? [{ debugName: "nbxIntOrFloat" }] : /* istanbul ignore next */ []));
416
+ elRef = inject(ElementRef);
417
+ onKeyPress(event) {
418
+ const type = this.nbxIntOrFloat();
419
+ const key = event.key;
420
+ if (type === 'int') {
421
+ // Allow only digits
422
+ if (!/^\d$/.test(key)) {
423
+ event.preventDefault();
424
+ }
425
+ }
426
+ else if (type === 'float') {
427
+ // Allow digits and one dot
428
+ const input = event.target;
429
+ if (!/^\d$/.test(key) && !(key === '.' && !input.value.includes('.'))) {
430
+ event.preventDefault();
431
+ }
432
+ }
433
+ }
434
+ constructor() {
435
+ effect(() => {
436
+ if (this.nbxIntOrFloat() === 'int') {
437
+ try {
438
+ const value = this.elRef.nativeElement.value;
439
+ if (value.includes('.')) {
440
+ this.elRef.nativeElement.value = value.split('.')[0];
441
+ }
442
+ }
443
+ catch {
444
+ //do nothing
445
+ }
446
+ }
447
+ });
448
+ }
449
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: IntOrFloatDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
450
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.15", type: IntOrFloatDirective, isStandalone: true, selector: "[nbxIntOrFloat]", inputs: { nbxIntOrFloat: { classPropertyName: "nbxIntOrFloat", publicName: "nbxIntOrFloat", isSignal: true, isRequired: true, transformFunction: null } }, host: { listeners: { "keypress": "onKeyPress($event)" } }, ngImport: i0 });
451
+ }
452
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: IntOrFloatDirective, decorators: [{
453
+ type: Directive,
454
+ args: [{
455
+ selector: '[nbxIntOrFloat]',
456
+ }]
457
+ }], ctorParameters: () => [], propDecorators: { nbxIntOrFloat: [{ type: i0.Input, args: [{ isSignal: true, alias: "nbxIntOrFloat", required: true }] }], onKeyPress: [{
458
+ type: HostListener,
459
+ args: ['keypress', ['$event']]
460
+ }] } });
461
+
462
+ const NbxValidatorsErrorsMessage = {
463
+ min: {
464
+ dataKey: 'min',
465
+ messageFunction: (length = '0') => `Min value ${length}`,
466
+ },
467
+ max: {
468
+ dataKey: 'max',
469
+ messageFunction: (length = '100') => `Max value ${length}`,
470
+ },
471
+ maxlength: {
472
+ dataKey: 'requiredLength',
473
+ messageFunction: (length = '0') => `Maximum length must be ${length}`,
474
+ },
475
+ url: 'Invalid URL. Valid example: http://example.com',
476
+ required: 'Required field',
477
+ minlength: {
478
+ dataKey: 'requiredLength',
479
+ messageFunction: (length = '0') => `Minimum length must be ${length}`,
480
+ },
481
+ email: 'Invalid email',
482
+ nbDatepickerMax: 'Date is later the possible',
483
+ nbDatepickerMin: 'Date is less then possible',
484
+ unknownError: 'Not acceptable value',
485
+ };
486
+
487
+ class NbxInputErrorsComponent {
488
+ /**
489
+ * @description you need to provide key as error key like 'required' and translateKey as value
490
+ */
491
+ customErrorsMessages = input({}, ...(ngDevMode ? [{ debugName: "customErrorsMessages" }] : /* istanbul ignore next */ []));
492
+ errors = input.required(...(ngDevMode ? [{ debugName: "errors" }] : /* istanbul ignore next */ []));
493
+ errorMessages = computed(() => {
494
+ const custom = this.customErrorsMessages();
495
+ return {
496
+ ...NbxValidatorsErrorsMessage,
497
+ ...custom,
498
+ };
499
+ }, ...(ngDevMode ? [{ debugName: "errorMessages" }] : /* istanbul ignore next */ []));
500
+ getErrorMessage(key, errorValue) {
501
+ try {
502
+ if (!this.errorMessages()[key]) {
503
+ if (typeof errorValue === 'string') {
504
+ return errorValue;
505
+ }
506
+ }
507
+ const message = this.errorMessages()[key];
508
+ if (typeof message === 'string') {
509
+ return message;
510
+ }
511
+ if (typeof errorValue !== 'string') {
512
+ return message.messageFunction(errorValue[message.dataKey]);
513
+ }
514
+ return 'Not acceptable value';
515
+ }
516
+ catch {
517
+ return 'Not acceptable value';
518
+ }
519
+ }
520
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: NbxInputErrorsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
521
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.15", type: NbxInputErrorsComponent, isStandalone: true, selector: "nbx-input-errors", inputs: { customErrorsMessages: { classPropertyName: "customErrorsMessages", publicName: "customErrorsMessages", isSignal: true, isRequired: false, transformFunction: null }, errors: { classPropertyName: "errors", publicName: "errors", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "<div class=\"input-errors\">\n @for(err of errors() | keyvalue; track err.key ){\n <div class=\"error\">{{ getErrorMessage(err.key, err.value) }}</div>\n }\n</div>\n", styles: [""], dependencies: [{ kind: "pipe", type: KeyValuePipe, name: "keyvalue" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
522
+ }
523
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: NbxInputErrorsComponent, decorators: [{
524
+ type: Component,
525
+ args: [{ selector: 'nbx-input-errors', imports: [KeyValuePipe], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"input-errors\">\n @for(err of errors() | keyvalue; track err.key ){\n <div class=\"error\">{{ getErrorMessage(err.key, err.value) }}</div>\n }\n</div>\n" }]
526
+ }], propDecorators: { customErrorsMessages: [{ type: i0.Input, args: [{ isSignal: true, alias: "customErrorsMessages", required: false }] }], errors: [{ type: i0.Input, args: [{ isSignal: true, alias: "errors", required: true }] }] } });
527
+
528
+ class NbxInputLabelComponent {
529
+ labelInfo = input(...(ngDevMode ? [undefined, { debugName: "labelInfo" }] : /* istanbul ignore next */ []));
530
+ isRequired = input(false, ...(ngDevMode ? [{ debugName: "isRequired" }] : /* istanbul ignore next */ []));
531
+ disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
532
+ inputId = input(...(ngDevMode ? [undefined, { debugName: "inputId" }] : /* istanbul ignore next */ []));
533
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: NbxInputLabelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
534
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.15", type: NbxInputLabelComponent, isStandalone: true, selector: "nbx-input-label", inputs: { labelInfo: { classPropertyName: "labelInfo", publicName: "labelInfo", isSignal: true, isRequired: false, transformFunction: null }, isRequired: { classPropertyName: "isRequired", publicName: "isRequired", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, inputId: { classPropertyName: "inputId", publicName: "inputId", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<div class=\"label-wrap\">\n <label [class]=\"{ required: isRequired(), disabled: disabled() }\" class=\"input-label\" [for]=\"inputId()\">\n <ng-content></ng-content>\n </label>\n @if (labelInfo()?.type === 'icon') {\n <nb-icon\n nbTooltip=\"{{ labelInfo()?.text }}\"\n [nbTooltipStatus]=\"labelInfo()?.status || 'primary'\"\n icon=\"alert-circle-outline\"\n class=\"label-info\"></nb-icon>\n }\n @if (labelInfo()?.type === 'text') {\n <span [title]=\"labelInfo()?.text\" class=\"label-info\">{{ labelInfo()?.text }}</span>\n }\n</div>\n", styles: [":host{transition:all .3s ease}.label-wrap{display:flex;gap:.2rem;font-size:var(--nbx-input-font-size)}.input-label:empty+.label-info{display:none}.input-label{font-weight:600;font-size:inherit;transition:font-size .3s ease}label:not(:empty).required:after{content:\"*\";position:relative;font-size:inherit;color:red;padding-left:.25rem;font-weight:600}label.input-label.disabled{color:var(--input-primary-disabled-text-color)}nb-icon{font-size:inherit}\n"], dependencies: [{ kind: "component", type: NbIconComponent, selector: "nb-icon", inputs: ["icon", "pack", "options", "status", "config"], outputs: ["iconChange", "packChange", "optionsChange", "statusChange"] }, { kind: "directive", type: NbTooltipDirective, selector: "[nbTooltip]", inputs: ["nbTooltip", "nbTooltipPlacement", "nbTooltipAdjustment", "nbTooltipClass", "nbTooltipIcon", "nbTooltipStatus", "nbTooltipTrigger", "nbTooltipOffset", "nbTooltipDisabled"], outputs: ["nbTooltipShowStateChange"], exportAs: ["nbTooltip"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
535
+ }
536
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: NbxInputLabelComponent, decorators: [{
537
+ type: Component,
538
+ args: [{ selector: 'nbx-input-label', imports: [NbIconComponent, NbTooltipDirective], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"label-wrap\">\n <label [class]=\"{ required: isRequired(), disabled: disabled() }\" class=\"input-label\" [for]=\"inputId()\">\n <ng-content></ng-content>\n </label>\n @if (labelInfo()?.type === 'icon') {\n <nb-icon\n nbTooltip=\"{{ labelInfo()?.text }}\"\n [nbTooltipStatus]=\"labelInfo()?.status || 'primary'\"\n icon=\"alert-circle-outline\"\n class=\"label-info\"></nb-icon>\n }\n @if (labelInfo()?.type === 'text') {\n <span [title]=\"labelInfo()?.text\" class=\"label-info\">{{ labelInfo()?.text }}</span>\n }\n</div>\n", styles: [":host{transition:all .3s ease}.label-wrap{display:flex;gap:.2rem;font-size:var(--nbx-input-font-size)}.input-label:empty+.label-info{display:none}.input-label{font-weight:600;font-size:inherit;transition:font-size .3s ease}label:not(:empty).required:after{content:\"*\";position:relative;font-size:inherit;color:red;padding-left:.25rem;font-weight:600}label.input-label.disabled{color:var(--input-primary-disabled-text-color)}nb-icon{font-size:inherit}\n"] }]
539
+ }], propDecorators: { labelInfo: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelInfo", required: false }] }], isRequired: [{ type: i0.Input, args: [{ isSignal: true, alias: "isRequired", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], inputId: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputId", required: false }] }] } });
540
+
541
+ class NbxInputWrapperComponent {
542
+ labelContent = viewChild('labelContent', { ...(ngDevMode ? { debugName: "labelContent" } : /* istanbul ignore next */ {}), read: ElementRef });
543
+ context = input.required(...(ngDevMode ? [{ debugName: "context" }] : /* istanbul ignore next */ []));
544
+ /**
545
+ * @description set to true if the input has fieldset with button in the end
546
+ * need to move copy button more to the left
547
+ */
548
+ isInputHasButton = input(false, ...(ngDevMode ? [{ debugName: "isInputHasButton" }] : /* istanbul ignore next */ []));
549
+ inputId = input(...(ngDevMode ? [undefined, { debugName: "inputId" }] : /* istanbul ignore next */ []));
550
+ copyAsJson = input(false, ...(ngDevMode ? [{ debugName: "copyAsJson" }] : /* istanbul ignore next */ []));
551
+ /**
552
+ * @description It's only needed to correctly display the "float" label type.
553
+ * It's used for inputs like chips and similar ones that don't use input to display the value.
554
+ * For correct operation, you also need to set searchHasValue.
555
+ */
556
+ floatLabelOnlyBySearch = input(false, ...(ngDevMode ? [{ debugName: "floatLabelOnlyBySearch" }] : /* istanbul ignore next */ []));
557
+ /**
558
+ * @description It's only needed to correctly display the "float" label type.
559
+ * set this input if you use different controls for search and value
560
+ */
561
+ searchHasValue = input(false, ...(ngDevMode ? [{ debugName: "searchHasValue" }] : /* istanbul ignore next */ []));
562
+ isLabelHasContent = computed(() => {
563
+ return this.labelContent()?.nativeElement.querySelector('label')?.hasChildNodes();
564
+ }, ...(ngDevMode ? [{ debugName: "isLabelHasContent" }] : /* istanbul ignore next */ []));
565
+ isControlHasValue = computed(() => {
566
+ if (this.searchHasValue())
567
+ return true;
568
+ const value = this.context().value();
569
+ if (this.floatLabelOnlyBySearch() || typeof value === 'undefined' || value === null || value === '')
570
+ return false;
571
+ if (Array.isArray(value)) {
572
+ return value?.length;
573
+ }
574
+ return true;
575
+ }, ...(ngDevMode ? [{ debugName: "isControlHasValue" }] : /* istanbul ignore next */ []));
576
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: NbxInputWrapperComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
577
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.15", type: NbxInputWrapperComponent, isStandalone: true, selector: "nbx-input-wrapper", inputs: { context: { classPropertyName: "context", publicName: "context", isSignal: true, isRequired: true, transformFunction: null }, isInputHasButton: { classPropertyName: "isInputHasButton", publicName: "isInputHasButton", isSignal: true, isRequired: false, transformFunction: null }, inputId: { classPropertyName: "inputId", publicName: "inputId", isSignal: true, isRequired: false, transformFunction: null }, copyAsJson: { classPropertyName: "copyAsJson", publicName: "copyAsJson", isSignal: true, isRequired: false, transformFunction: null }, floatLabelOnlyBySearch: { classPropertyName: "floatLabelOnlyBySearch", publicName: "floatLabelOnlyBySearch", isSignal: true, isRequired: false, transformFunction: null }, searchHasValue: { classPropertyName: "searchHasValue", publicName: "searchHasValue", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "labelContent", first: true, predicate: ["labelContent"], descendants: true, read: ElementRef, isSignal: true }], ngImport: i0, template: "<div class=\"nbx-input-wrap\" [class.invalid]=\"context().errorDisplayedState()\">\n <div\n class=\"input-fieldset\"\n [class]=\"context().labelPosition()\"\n [class.has-value]=\"isControlHasValue()\"\n [class.no-label]=\"!isLabelHasContent()\">\n @if (context().labelPosition() !== 'none') {\n <nbx-input-label\n [labelInfo]=\"context().labelInfo()\"\n [isRequired]=\"context().hasRequiredValidator\"\n [disabled]=\"context().disabled()\"\n [inputId]=\"inputId()\"\n #labelContent>\n <ng-content #labelContent select=\"[label-content]\"></ng-content>\n </nbx-input-label>\n }\n <div class=\"input-content-wrap\">\n <ng-content></ng-content>\n @if (context().withCopyButton(); as copyType) {\n <button\n type=\"button\"\n [class.move-left]=\"isInputHasButton()\"\n [id]=\"inputId() + '-copy-button'\"\n class=\"copy-button\"\n [nbxClipboard]=\"context().value()\"\n [nbxClipboardCopyType]=\"copyType\">\n <nb-icon icon=\"copy-outline\"></nb-icon>\n </button>\n }\n </div>\n </div>\n <nbx-input-errors\n [customErrorsMessages]=\"context().customErrorsMessages()\"\n [errors]=\"context().errors()\"></nbx-input-errors>\n</div>\n", styles: [".nbx-input-wrap .input-fieldset{position:relative;display:flex;flex-direction:column;gap:.313rem}.nbx-input-wrap .input-fieldset.inline,.nbx-input-wrap .input-fieldset.inline-reverse{align-items:center}.nbx-input-wrap .input-fieldset.inline{flex-direction:row}.nbx-input-wrap .input-fieldset.inline-reverse{flex-direction:row-reverse}.nbx-input-wrap .input-fieldset.block-center{align-items:center}.nbx-input-wrap .input-fieldset.float nbx-input-label{pointer-events:none}.nbx-input-wrap .input-fieldset.float nbx-input-label::ng-deep .label-info{pointer-events:all}.nbx-input-wrap .input-fieldset.float ::ng-deep input::placeholder,.nbx-input-wrap .input-fieldset.float ::ng-deep textarea::placeholder,.nbx-input-wrap .input-fieldset.float ::ng-deep .select-button::placeholder,.nbx-input-wrap .input-fieldset.float ::ng-deep div.textarea-container::placeholder{opacity:0}.nbx-input-wrap .input-fieldset.float ::ng-deep div.textarea-container:before{opacity:0}.nbx-input-wrap .input-fieldset.float:focus-within ::ng-deep input::placeholder,.nbx-input-wrap .input-fieldset.float:focus-within ::ng-deep textarea::placeholder,.nbx-input-wrap .input-fieldset.float:focus-within ::ng-deep .select-button::placeholder,.nbx-input-wrap .input-fieldset.float:focus-within ::ng-deep div.textarea-container::placeholder{opacity:1}.nbx-input-wrap .input-fieldset.float:focus-within ::ng-deep div.textarea-container:before{opacity:1}.nbx-input-wrap .input-fieldset.float nbx-input-label ::ng-deep nb-icon{font-size:inherit}.nbx-input-wrap .input-fieldset.float nbx-input-label{background-color:var(--nbx-input-background-color);z-index:1;line-height:1;top:min(50%,1.3rem);transform:translateY(-50%);left:1rem;position:absolute}.nbx-input-wrap .input-fieldset.float:focus-within nbx-input-label ::ng-deep .label-wrap label,.nbx-input-wrap .input-fieldset.float.has-value nbx-input-label ::ng-deep .label-wrap label{font-size:calc(1em - 20%)}.nbx-input-wrap .input-fieldset.float:focus-within nbx-input-label,.nbx-input-wrap .input-fieldset.float.has-value nbx-input-label{left:.625rem;padding:0 .375rem;top:0}.nbx-input-wrap .input-fieldset.no-label{gap:0}.nbx-input-wrap ::ng-deep .input-errors{opacity:0;overflow:hidden;max-height:0;max-width:unset;transition:max-height .5s ease}.nbx-input-wrap.invalid::ng-deep input,.nbx-input-wrap.invalid::ng-deep textarea,.nbx-input-wrap.invalid::ng-deep .select-button,.nbx-input-wrap.invalid::ng-deep div.textarea-container{border-color:#ff0606!important}.nbx-input-wrap.invalid::ng-deep .input-errors{opacity:1;margin-top:.2rem;max-height:6rem;max-width:unset;color:#ff0606}.nbx-input-wrap .input-content-wrap{position:relative}.nbx-input-wrap .copy-button{border:none;outline:none;background:none;border-radius:5px;position:absolute;z-index:2;right:0;top:0;padding:.2rem}.nbx-input-wrap .copy-button.move-left{right:2.5rem}@media(hover:hover){.nbx-input-wrap .copy-button:hover{background-color:var(--option-hover-background-color)}}\n"], dependencies: [{ kind: "component", type: NbxInputErrorsComponent, selector: "nbx-input-errors", inputs: ["customErrorsMessages", "errors"] }, { kind: "component", type: NbxInputLabelComponent, selector: "nbx-input-label", inputs: ["labelInfo", "isRequired", "disabled", "inputId"] }, { kind: "directive", type: NbxClipboardDirective, selector: "[nbxClipboard]", inputs: ["nbxClipboard", "nbxClipboardCopyType"] }, { kind: "component", type: NbIconComponent, selector: "nb-icon", inputs: ["icon", "pack", "options", "status", "config"], outputs: ["iconChange", "packChange", "optionsChange", "statusChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
578
+ }
579
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: NbxInputWrapperComponent, decorators: [{
580
+ type: Component,
581
+ args: [{ selector: 'nbx-input-wrapper', imports: [NbxInputErrorsComponent, NbxInputLabelComponent, NbxClipboardDirective, NbIconComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"nbx-input-wrap\" [class.invalid]=\"context().errorDisplayedState()\">\n <div\n class=\"input-fieldset\"\n [class]=\"context().labelPosition()\"\n [class.has-value]=\"isControlHasValue()\"\n [class.no-label]=\"!isLabelHasContent()\">\n @if (context().labelPosition() !== 'none') {\n <nbx-input-label\n [labelInfo]=\"context().labelInfo()\"\n [isRequired]=\"context().hasRequiredValidator\"\n [disabled]=\"context().disabled()\"\n [inputId]=\"inputId()\"\n #labelContent>\n <ng-content #labelContent select=\"[label-content]\"></ng-content>\n </nbx-input-label>\n }\n <div class=\"input-content-wrap\">\n <ng-content></ng-content>\n @if (context().withCopyButton(); as copyType) {\n <button\n type=\"button\"\n [class.move-left]=\"isInputHasButton()\"\n [id]=\"inputId() + '-copy-button'\"\n class=\"copy-button\"\n [nbxClipboard]=\"context().value()\"\n [nbxClipboardCopyType]=\"copyType\">\n <nb-icon icon=\"copy-outline\"></nb-icon>\n </button>\n }\n </div>\n </div>\n <nbx-input-errors\n [customErrorsMessages]=\"context().customErrorsMessages()\"\n [errors]=\"context().errors()\"></nbx-input-errors>\n</div>\n", styles: [".nbx-input-wrap .input-fieldset{position:relative;display:flex;flex-direction:column;gap:.313rem}.nbx-input-wrap .input-fieldset.inline,.nbx-input-wrap .input-fieldset.inline-reverse{align-items:center}.nbx-input-wrap .input-fieldset.inline{flex-direction:row}.nbx-input-wrap .input-fieldset.inline-reverse{flex-direction:row-reverse}.nbx-input-wrap .input-fieldset.block-center{align-items:center}.nbx-input-wrap .input-fieldset.float nbx-input-label{pointer-events:none}.nbx-input-wrap .input-fieldset.float nbx-input-label::ng-deep .label-info{pointer-events:all}.nbx-input-wrap .input-fieldset.float ::ng-deep input::placeholder,.nbx-input-wrap .input-fieldset.float ::ng-deep textarea::placeholder,.nbx-input-wrap .input-fieldset.float ::ng-deep .select-button::placeholder,.nbx-input-wrap .input-fieldset.float ::ng-deep div.textarea-container::placeholder{opacity:0}.nbx-input-wrap .input-fieldset.float ::ng-deep div.textarea-container:before{opacity:0}.nbx-input-wrap .input-fieldset.float:focus-within ::ng-deep input::placeholder,.nbx-input-wrap .input-fieldset.float:focus-within ::ng-deep textarea::placeholder,.nbx-input-wrap .input-fieldset.float:focus-within ::ng-deep .select-button::placeholder,.nbx-input-wrap .input-fieldset.float:focus-within ::ng-deep div.textarea-container::placeholder{opacity:1}.nbx-input-wrap .input-fieldset.float:focus-within ::ng-deep div.textarea-container:before{opacity:1}.nbx-input-wrap .input-fieldset.float nbx-input-label ::ng-deep nb-icon{font-size:inherit}.nbx-input-wrap .input-fieldset.float nbx-input-label{background-color:var(--nbx-input-background-color);z-index:1;line-height:1;top:min(50%,1.3rem);transform:translateY(-50%);left:1rem;position:absolute}.nbx-input-wrap .input-fieldset.float:focus-within nbx-input-label ::ng-deep .label-wrap label,.nbx-input-wrap .input-fieldset.float.has-value nbx-input-label ::ng-deep .label-wrap label{font-size:calc(1em - 20%)}.nbx-input-wrap .input-fieldset.float:focus-within nbx-input-label,.nbx-input-wrap .input-fieldset.float.has-value nbx-input-label{left:.625rem;padding:0 .375rem;top:0}.nbx-input-wrap .input-fieldset.no-label{gap:0}.nbx-input-wrap ::ng-deep .input-errors{opacity:0;overflow:hidden;max-height:0;max-width:unset;transition:max-height .5s ease}.nbx-input-wrap.invalid::ng-deep input,.nbx-input-wrap.invalid::ng-deep textarea,.nbx-input-wrap.invalid::ng-deep .select-button,.nbx-input-wrap.invalid::ng-deep div.textarea-container{border-color:#ff0606!important}.nbx-input-wrap.invalid::ng-deep .input-errors{opacity:1;margin-top:.2rem;max-height:6rem;max-width:unset;color:#ff0606}.nbx-input-wrap .input-content-wrap{position:relative}.nbx-input-wrap .copy-button{border:none;outline:none;background:none;border-radius:5px;position:absolute;z-index:2;right:0;top:0;padding:.2rem}.nbx-input-wrap .copy-button.move-left{right:2.5rem}@media(hover:hover){.nbx-input-wrap .copy-button:hover{background-color:var(--option-hover-background-color)}}\n"] }]
582
+ }], propDecorators: { labelContent: [{ type: i0.ViewChild, args: ['labelContent', { ...{ read: ElementRef }, isSignal: true }] }], context: [{ type: i0.Input, args: [{ isSignal: true, alias: "context", required: true }] }], isInputHasButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "isInputHasButton", required: false }] }], inputId: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputId", required: false }] }], copyAsJson: [{ type: i0.Input, args: [{ isSignal: true, alias: "copyAsJson", required: false }] }], floatLabelOnlyBySearch: [{ type: i0.Input, args: [{ isSignal: true, alias: "floatLabelOnlyBySearch", required: false }] }], searchHasValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "searchHasValue", required: false }] }] } });
583
+
584
+ class NbxSelectOptionsListComponent {
585
+ optionsList = viewChildren('optionItem', { ...(ngDevMode ? { debugName: "optionsList" } : /* istanbul ignore next */ {}), read: ElementRef });
586
+ virtualScrollContainer = viewChild(CdkVirtualScrollViewport, ...(ngDevMode ? [{ debugName: "virtualScrollContainer" }] : /* istanbul ignore next */ []));
587
+ options = input([], ...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
588
+ optionsListClass = input('', ...(ngDevMode ? [{ debugName: "optionsListClass" }] : /* istanbul ignore next */ []));
589
+ enableVirtualScroll = input(false, ...(ngDevMode ? [{ debugName: "enableVirtualScroll" }] : /* istanbul ignore next */ []));
590
+ /**
591
+ * you can correct height of option if you have change it style for correct work of virtual scroll
592
+ */
593
+ virtualScrollItemSizePX = input(38, ...(ngDevMode ? [{ debugName: "virtualScrollItemSizePX" }] : /* istanbul ignore next */ []));
594
+ optionClicked = output();
595
+ selectAll = output();
596
+ tabClicked = output();
597
+ multi = input(false, ...(ngDevMode ? [{ debugName: "multi" }] : /* istanbul ignore next */ []));
598
+ selectedValues = input([], ...(ngDevMode ? [{ debugName: "selectedValues" }] : /* istanbul ignore next */ []));
599
+ focusedOptionIndex = 0;
600
+ isAllSelected = computed(() => this.options()?.every((option) => this.selectedValues().includes(option.value)), ...(ngDevMode ? [{ debugName: "isAllSelected" }] : /* istanbul ignore next */ []));
601
+ ngOnChanges({ options }) {
602
+ if (options) {
603
+ this.focusedOptionIndex = 0;
604
+ this.virtualScrollContainer()?.scrollTo({ top: 0 });
605
+ }
606
+ }
607
+ selectAllOptions() {
608
+ this.selectAll.emit(this.options());
609
+ }
610
+ optionClickedHandler(option, index) {
611
+ this.focusedOptionIndex = index;
612
+ this.optionClicked.emit(option);
613
+ }
614
+ keydown(event) {
615
+ if (event.code === 'Tab') {
616
+ event.preventDefault();
617
+ this.tabClicked.emit();
618
+ return;
619
+ }
620
+ if (event.code === 'ArrowDown') {
621
+ event.preventDefault();
622
+ if (this.focusedOptionIndex >= this.options().length - 1) {
623
+ return;
624
+ }
625
+ this.focusedOptionIndex++;
626
+ this.setFocusedOptionByIndex(this.focusedOptionIndex);
627
+ }
628
+ if (event.code === 'ArrowUp') {
629
+ event.preventDefault();
630
+ if (this.focusedOptionIndex <= 0) {
631
+ return;
632
+ }
633
+ this.focusedOptionIndex--;
634
+ this.setFocusedOptionByIndex(this.focusedOptionIndex);
635
+ }
636
+ }
637
+ setFocusedOptionByIndex(index) {
638
+ const optionsList = this.optionsList();
639
+ if (optionsList) {
640
+ optionsList[index]?.nativeElement.focus();
641
+ }
642
+ }
643
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: NbxSelectOptionsListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
644
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.15", type: NbxSelectOptionsListComponent, isStandalone: true, selector: "nbx-select-options-list", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, optionsListClass: { classPropertyName: "optionsListClass", publicName: "optionsListClass", isSignal: true, isRequired: false, transformFunction: null }, enableVirtualScroll: { classPropertyName: "enableVirtualScroll", publicName: "enableVirtualScroll", isSignal: true, isRequired: false, transformFunction: null }, virtualScrollItemSizePX: { classPropertyName: "virtualScrollItemSizePX", publicName: "virtualScrollItemSizePX", isSignal: true, isRequired: false, transformFunction: null }, multi: { classPropertyName: "multi", publicName: "multi", isSignal: true, isRequired: false, transformFunction: null }, selectedValues: { classPropertyName: "selectedValues", publicName: "selectedValues", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { optionClicked: "optionClicked", selectAll: "selectAll", tabClicked: "tabClicked" }, viewQueries: [{ propertyName: "optionsList", predicate: ["optionItem"], descendants: true, read: ElementRef, isSignal: true }, { propertyName: "virtualScrollContainer", first: true, predicate: CdkVirtualScrollViewport, descendants: true, isSignal: true }], usesOnChanges: true, ngImport: i0, template: "<nb-option-list\n #optionsListContainer\n [style.--all-elements-height]=\"options().length * virtualScrollItemSizePX() + 'px'\"\n [style.--element-height]=\"virtualScrollItemSizePX() + 'px'\"\n (keydown)=\"keydown($event)\"\n [class.multi]=\"multi()\"\n [class.with-virtual-scroll]=\"enableVirtualScroll()\"\n [class]=\"optionsListClass()\">\n @if (multi()) {\n <nb-option\n [disabled]=\"isAllSelected()\"\n (click)=\"$event.preventDefault(); $event.stopPropagation(); selectAllOptions()\"\n >Select all</nb-option\n >\n }\n @if (enableVirtualScroll()) {\n <cdk-virtual-scroll-viewport\n [itemSize]=\"virtualScrollItemSizePX()\"\n maxBufferPx=\"600\"\n minBufferPx=\"600\"\n class=\"virtual-scroll-viewport\">\n <nb-option\n #optionItem\n *cdkVirtualFor=\"let option of options(); let i = index\"\n class=\"virtual-scroll-item\"\n [disabled]=\"option.disabled\"\n [id]=\"'nb-option-' + option.value\"\n [tabindex]=\"i\"\n [value]=\"option.value\"\n (keyup.enter)=\"optionClickedHandler(option, i)\"\n (click)=\"optionClickedHandler(option, i)\">\n @if (multi()) {\n <nb-checkbox\n class=\"multiselect-autocomplete-checkbox\"\n status=\"primary\"\n [disabled]=\"option.disabled\"\n [checked]=\"selectedValues().includes(option.value)\"\n >{{ option.title }}</nb-checkbox\n >\n } @else {\n {{ option.title }}\n }\n </nb-option>\n </cdk-virtual-scroll-viewport>\n } @else {\n @for (option of options(); track $index) {\n @if (option) {\n <nb-option\n #optionItem\n [disabled]=\"option.disabled\"\n [id]=\"'nb-option-' + option.value\"\n [tabindex]=\"$index\"\n [value]=\"option.value\"\n (keyup.enter)=\"optionClickedHandler(option, $index)\"\n (click)=\"optionClickedHandler(option, $index)\">\n @if (multi()) {\n <nb-checkbox\n class=\"multiselect-autocomplete-checkbox\"\n status=\"primary\"\n [disabled]=\"option.disabled\"\n [checked]=\"selectedValues().includes(option.value)\"\n >{{ option.title }}</nb-checkbox\n >\n } @else {\n {{ option.title }}\n }\n </nb-option>\n }\n }\n }\n</nb-option-list>\n", styles: [":host{width:100%;position:relative;z-index:9999;background-color:var(--option-list-background-color);box-shadow:var(--shadow)}nb-option-list{width:100%;display:block}nb-option-list.with-virtual-scroll ::ng-deep .option-list{overflow:hidden}nb-option-list.multi.with-virtual-scroll ::ng-deep .option-list{overflow:hidden}nb-option-list.multi.with-virtual-scroll ::ng-deep .option-list .virtual-scroll-viewport{max-height:calc(var(--option-list-max-height) - var(--element-height))}.virtual-scroll-viewport{height:var(--all-elements-height);max-height:var(--option-list-max-height)}.virtual-scroll-item{height:38px}\n"], dependencies: [{ kind: "component", type: NbOptionComponent, selector: "nb-option", inputs: ["value", "disabled"], outputs: ["selectionChange"] }, { kind: "component", type: NbOptionListComponent, selector: "nb-option-list", inputs: ["size", "position"] }, { kind: "component", type: NbCheckboxComponent, selector: "nb-checkbox", inputs: ["checked", "disabled", "status", "indeterminate"], outputs: ["checkedChange"] }, { kind: "ngmodule", type: ScrollingModule }, { kind: "directive", type: i1.CdkFixedSizeVirtualScroll, selector: "cdk-virtual-scroll-viewport[itemSize]", inputs: ["itemSize", "minBufferPx", "maxBufferPx"] }, { kind: "directive", type: i1.CdkVirtualForOf, selector: "[cdkVirtualFor][cdkVirtualForOf]", inputs: ["cdkVirtualForOf", "cdkVirtualForTrackBy", "cdkVirtualForTemplate", "cdkVirtualForTemplateCacheSize"] }, { kind: "component", type: i1.CdkVirtualScrollViewport, selector: "cdk-virtual-scroll-viewport", inputs: ["orientation", "appendOnly"], outputs: ["scrolledIndexChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
645
+ }
646
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: NbxSelectOptionsListComponent, decorators: [{
647
+ type: Component,
648
+ args: [{ selector: 'nbx-select-options-list', imports: [NbOptionComponent, NbOptionListComponent, NbCheckboxComponent, ScrollingModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<nb-option-list\n #optionsListContainer\n [style.--all-elements-height]=\"options().length * virtualScrollItemSizePX() + 'px'\"\n [style.--element-height]=\"virtualScrollItemSizePX() + 'px'\"\n (keydown)=\"keydown($event)\"\n [class.multi]=\"multi()\"\n [class.with-virtual-scroll]=\"enableVirtualScroll()\"\n [class]=\"optionsListClass()\">\n @if (multi()) {\n <nb-option\n [disabled]=\"isAllSelected()\"\n (click)=\"$event.preventDefault(); $event.stopPropagation(); selectAllOptions()\"\n >Select all</nb-option\n >\n }\n @if (enableVirtualScroll()) {\n <cdk-virtual-scroll-viewport\n [itemSize]=\"virtualScrollItemSizePX()\"\n maxBufferPx=\"600\"\n minBufferPx=\"600\"\n class=\"virtual-scroll-viewport\">\n <nb-option\n #optionItem\n *cdkVirtualFor=\"let option of options(); let i = index\"\n class=\"virtual-scroll-item\"\n [disabled]=\"option.disabled\"\n [id]=\"'nb-option-' + option.value\"\n [tabindex]=\"i\"\n [value]=\"option.value\"\n (keyup.enter)=\"optionClickedHandler(option, i)\"\n (click)=\"optionClickedHandler(option, i)\">\n @if (multi()) {\n <nb-checkbox\n class=\"multiselect-autocomplete-checkbox\"\n status=\"primary\"\n [disabled]=\"option.disabled\"\n [checked]=\"selectedValues().includes(option.value)\"\n >{{ option.title }}</nb-checkbox\n >\n } @else {\n {{ option.title }}\n }\n </nb-option>\n </cdk-virtual-scroll-viewport>\n } @else {\n @for (option of options(); track $index) {\n @if (option) {\n <nb-option\n #optionItem\n [disabled]=\"option.disabled\"\n [id]=\"'nb-option-' + option.value\"\n [tabindex]=\"$index\"\n [value]=\"option.value\"\n (keyup.enter)=\"optionClickedHandler(option, $index)\"\n (click)=\"optionClickedHandler(option, $index)\">\n @if (multi()) {\n <nb-checkbox\n class=\"multiselect-autocomplete-checkbox\"\n status=\"primary\"\n [disabled]=\"option.disabled\"\n [checked]=\"selectedValues().includes(option.value)\"\n >{{ option.title }}</nb-checkbox\n >\n } @else {\n {{ option.title }}\n }\n </nb-option>\n }\n }\n }\n</nb-option-list>\n", styles: [":host{width:100%;position:relative;z-index:9999;background-color:var(--option-list-background-color);box-shadow:var(--shadow)}nb-option-list{width:100%;display:block}nb-option-list.with-virtual-scroll ::ng-deep .option-list{overflow:hidden}nb-option-list.multi.with-virtual-scroll ::ng-deep .option-list{overflow:hidden}nb-option-list.multi.with-virtual-scroll ::ng-deep .option-list .virtual-scroll-viewport{max-height:calc(var(--option-list-max-height) - var(--element-height))}.virtual-scroll-viewport{height:var(--all-elements-height);max-height:var(--option-list-max-height)}.virtual-scroll-item{height:38px}\n"] }]
649
+ }], propDecorators: { optionsList: [{ type: i0.ViewChildren, args: ['optionItem', { ...{ read: ElementRef }, isSignal: true }] }], virtualScrollContainer: [{ type: i0.ViewChild, args: [i0.forwardRef(() => CdkVirtualScrollViewport), { isSignal: true }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], optionsListClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionsListClass", required: false }] }], enableVirtualScroll: [{ type: i0.Input, args: [{ isSignal: true, alias: "enableVirtualScroll", required: false }] }], virtualScrollItemSizePX: [{ type: i0.Input, args: [{ isSignal: true, alias: "virtualScrollItemSizePX", required: false }] }], optionClicked: [{ type: i0.Output, args: ["optionClicked"] }], selectAll: [{ type: i0.Output, args: ["selectAll"] }], tabClicked: [{ type: i0.Output, args: ["tabClicked"] }], multi: [{ type: i0.Input, args: [{ isSignal: true, alias: "multi", required: false }] }], selectedValues: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedValues", required: false }] }] } });
650
+
651
+ class NbxInputAutocompleteComponent extends NbxControlValueAccessorBaseDirective {
652
+ clientWidth = signal('100%', ...(ngDevMode ? [{ debugName: "clientWidth" }] : /* istanbul ignore next */ []));
653
+ optionsListContainer = viewChild('optionsListContainer', { ...(ngDevMode ? { debugName: "optionsListContainer" } : /* istanbul ignore next */ {}), read: (ElementRef) });
654
+ inputElement = viewChild('inputElement', { ...(ngDevMode ? { debugName: "inputElement" } : /* istanbul ignore next */ {}), read: ElementRef });
655
+ searchControl = new FormControl('');
656
+ searchValueSignal = toSignal(this.searchControl.valueChanges);
657
+ optionsListClass = input('', ...(ngDevMode ? [{ debugName: "optionsListClass" }] : /* istanbul ignore next */ []));
658
+ options = input.required(...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
659
+ /**
660
+ * you can correct height of option if you have change it style for correct work of virtual scroll
661
+ */
662
+ virtualScrollItemSizePX = input(38, ...(ngDevMode ? [{ debugName: "virtualScrollItemSizePX" }] : /* istanbul ignore next */ []));
663
+ enableVirtualScroll = input(false, ...(ngDevMode ? [{ debugName: "enableVirtualScroll" }] : /* istanbul ignore next */ []));
664
+ anyStringInput = input(false, ...(ngDevMode ? [{ debugName: "anyStringInput" }] : /* istanbul ignore next */ []));
665
+ selectChanged = output();
666
+ overlayVisible = signal(false, ...(ngDevMode ? [{ debugName: "overlayVisible" }] : /* istanbul ignore next */ []));
667
+ filteredOptions = computed(() => {
668
+ const value = this.searchValueSignal();
669
+ if (!value) {
670
+ return this.options();
671
+ }
672
+ return filterAndSortOptionsBySearch(this.options(), value);
673
+ }, ...(ngDevMode ? [{ debugName: "filteredOptions" }] : /* istanbul ignore next */ []));
674
+ ngOnInit() {
675
+ this.searchControl.valueChanges
676
+ .pipe(startWith(''), map((value) => value || ''), takeUntilDestroyed(this.destroyRef))
677
+ .subscribe((str) => {
678
+ if (!str) {
679
+ if (this.control?.value) {
680
+ this.control?.reset();
681
+ }
682
+ return;
683
+ }
684
+ const equalValueOption = this.getEqualValue(str, this.options());
685
+ if (equalValueOption) {
686
+ this.setValue(equalValueOption.value);
687
+ this.toggleOverlay(false);
688
+ }
689
+ else if (this.anyStringInput()) {
690
+ this.setValue(str);
691
+ }
692
+ });
693
+ }
694
+ ngOnChanges({ options }) {
695
+ if (options) {
696
+ this.updateInputTitle(this.value());
697
+ }
698
+ }
699
+ ngAfterViewInit() {
700
+ setTimeout(() => {
701
+ const element = this.inputElement()?.nativeElement;
702
+ if (element) {
703
+ this.clientWidth.set(element.clientWidth || '100%');
704
+ resizeObservable(element)
705
+ .pipe(takeUntilDestroyed(this.destroyRef))
706
+ .subscribe(() => {
707
+ this.clientWidth.set(this.inputElement()?.nativeElement.clientWidth || '100%');
708
+ });
709
+ }
710
+ }, 200);
711
+ }
712
+ moveFocusToNextElement() {
713
+ this.inputElement()?.nativeElement.focus();
714
+ }
715
+ switchFocusToOptions() {
716
+ const optionsListContainer = this.optionsListContainer();
717
+ if (optionsListContainer) {
718
+ const firstOption = optionsListContainer.nativeElement.querySelector('nb-option');
719
+ firstOption?.focus();
720
+ }
721
+ }
722
+ getEqualValue(str, options) {
723
+ if (!options || !str) {
724
+ return;
725
+ }
726
+ return options.find((el) => el?.value === str || el?.title === str);
727
+ }
728
+ optionSelected(option) {
729
+ this.selectChanged.emit(option.value);
730
+ this.setValue(option.value);
731
+ this.inputElement()?.nativeElement.focus();
732
+ this.toggleOverlay(false);
733
+ }
734
+ toggleOverlay(state) {
735
+ if (state !== this.overlayVisible()) {
736
+ this.onTouched();
737
+ this.overlayVisible.set(state ?? !this.overlayVisible);
738
+ }
739
+ }
740
+ updateInputTitle(value) {
741
+ const options = this.options();
742
+ if (!options) {
743
+ return;
744
+ }
745
+ const option = options.find((option) => option?.value === value);
746
+ if (!option) {
747
+ this.searchControl.setValue(value, { emitEvent: false });
748
+ return;
749
+ }
750
+ this.searchControl.setValue(option?.title, { emitEvent: false });
751
+ }
752
+ setValue(value) {
753
+ super.valueChanged(value);
754
+ this.updateInputTitle(value);
755
+ }
756
+ writeValue(value) {
757
+ super.writeValue(value);
758
+ this.updateInputTitle(value);
759
+ }
760
+ setDisabledState(isDisabled) {
761
+ super.setDisabledState(isDisabled);
762
+ if (isDisabled) {
763
+ this.searchControl.disable({ emitEvent: false });
764
+ }
765
+ else {
766
+ this.searchControl.enable({ emitEvent: false });
767
+ }
768
+ }
769
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: NbxInputAutocompleteComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
770
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.2.15", type: NbxInputAutocompleteComponent, isStandalone: true, selector: "nbx-input-autocomplete", inputs: { optionsListClass: { classPropertyName: "optionsListClass", publicName: "optionsListClass", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: true, transformFunction: null }, virtualScrollItemSizePX: { classPropertyName: "virtualScrollItemSizePX", publicName: "virtualScrollItemSizePX", isSignal: true, isRequired: false, transformFunction: null }, enableVirtualScroll: { classPropertyName: "enableVirtualScroll", publicName: "enableVirtualScroll", isSignal: true, isRequired: false, transformFunction: null }, anyStringInput: { classPropertyName: "anyStringInput", publicName: "anyStringInput", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectChanged: "selectChanged" }, providers: [
771
+ {
772
+ provide: NG_VALUE_ACCESSOR,
773
+ useExisting: NbxInputAutocompleteComponent,
774
+ multi: true,
775
+ },
776
+ ], viewQueries: [{ propertyName: "optionsListContainer", first: true, predicate: ["optionsListContainer"], descendants: true, read: ElementRef, isSignal: true }, { propertyName: "inputElement", first: true, predicate: ["inputElement"], descendants: true, read: ElementRef, isSignal: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<nbx-input-wrapper\n (keydown.tab)=\"toggleOverlay(false)\"\n [context]=\"getContext()\"\n [inputId]=\"getInputId('input-autocomplete')\"\n [searchHasValue]=\"!!searchControl.value\">\n <ng-content label-content></ng-content>\n <input\n #inputElement\n #trigger=\"cdkOverlayOrigin\"\n type=\"text\"\n [status]=\"status()\"\n [size]=\"size()\"\n (click)=\"toggleOverlay(true)\"\n (focus)=\"toggleOverlay(true)\"\n (input)=\"toggleOverlay(true)\"\n (keydown.arrowdown)=\"$event.preventDefault(); switchFocusToOptions()\"\n autocomplete=\"off\"\n [id]=\"getInputId('input-autocomplete')\"\n [formControl]=\"searchControl\"\n [placeholder]=\"placeholder()\"\n nbInput\n cdkOverlayOrigin\n fullWidth />\n\n <ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"trigger\"\n [cdkConnectedOverlayOpen]=\"overlayVisible()\"\n [cdkConnectedOverlayWidth]=\"clientWidth()\"\n (overlayOutsideClick)=\"toggleOverlay(false)\"\n (detach)=\"toggleOverlay(false)\">\n <nbx-select-options-list\n #optionsListContainer\n [optionsListClass]=\"optionsListClass()\"\n [virtualScrollItemSizePX]=\"virtualScrollItemSizePX()\"\n [enableVirtualScroll]=\"enableVirtualScroll()\"\n (optionClicked)=\"optionSelected($any($event))\"\n (tabClicked)=\"moveFocusToNextElement()\"\n [options]=\"filteredOptions()\"></nbx-select-options-list>\n </ng-template>\n</nbx-input-wrapper>\n", dependencies: [{ kind: "component", type: NbxInputWrapperComponent, selector: "nbx-input-wrapper", inputs: ["context", "isInputHasButton", "inputId", "copyAsJson", "floatLabelOnlyBySearch", "searchHasValue"] }, { kind: "component", type: NbxSelectOptionsListComponent, selector: "nbx-select-options-list", inputs: ["options", "optionsListClass", "enableVirtualScroll", "virtualScrollItemSizePX", "multi", "selectedValues"], outputs: ["optionClicked", "selectAll", "tabClicked"] }, { kind: "ngmodule", type: OverlayModule }, { kind: "directive", type: i1$1.CdkConnectedOverlay, selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]", inputs: ["cdkConnectedOverlayOrigin", "cdkConnectedOverlayPositions", "cdkConnectedOverlayPositionStrategy", "cdkConnectedOverlayOffsetX", "cdkConnectedOverlayOffsetY", "cdkConnectedOverlayWidth", "cdkConnectedOverlayHeight", "cdkConnectedOverlayMinWidth", "cdkConnectedOverlayMinHeight", "cdkConnectedOverlayBackdropClass", "cdkConnectedOverlayPanelClass", "cdkConnectedOverlayViewportMargin", "cdkConnectedOverlayScrollStrategy", "cdkConnectedOverlayOpen", "cdkConnectedOverlayDisableClose", "cdkConnectedOverlayTransformOriginOn", "cdkConnectedOverlayHasBackdrop", "cdkConnectedOverlayLockPosition", "cdkConnectedOverlayFlexibleDimensions", "cdkConnectedOverlayGrowAfterOpen", "cdkConnectedOverlayPush", "cdkConnectedOverlayDisposeOnNavigation", "cdkConnectedOverlayUsePopover", "cdkConnectedOverlayMatchWidth", "cdkConnectedOverlay"], outputs: ["backdropClick", "positionChange", "attach", "detach", "overlayKeydown", "overlayOutsideClick"], exportAs: ["cdkConnectedOverlay"] }, { kind: "directive", type: i1$1.CdkOverlayOrigin, selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]", exportAs: ["cdkOverlayOrigin"] }, { kind: "directive", type: NbInputDirective, selector: "input[nbInput],textarea[nbInput]", inputs: ["fieldSize", "size", "status", "shape", "fullWidth"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
777
+ }
778
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: NbxInputAutocompleteComponent, decorators: [{
779
+ type: Component,
780
+ args: [{ selector: 'nbx-input-autocomplete', imports: [
781
+ NbxInputWrapperComponent,
782
+ NbxSelectOptionsListComponent,
783
+ OverlayModule,
784
+ NbInputDirective,
785
+ ReactiveFormsModule,
786
+ ], providers: [
787
+ {
788
+ provide: NG_VALUE_ACCESSOR,
789
+ useExisting: NbxInputAutocompleteComponent,
790
+ multi: true,
791
+ },
792
+ ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<nbx-input-wrapper\n (keydown.tab)=\"toggleOverlay(false)\"\n [context]=\"getContext()\"\n [inputId]=\"getInputId('input-autocomplete')\"\n [searchHasValue]=\"!!searchControl.value\">\n <ng-content label-content></ng-content>\n <input\n #inputElement\n #trigger=\"cdkOverlayOrigin\"\n type=\"text\"\n [status]=\"status()\"\n [size]=\"size()\"\n (click)=\"toggleOverlay(true)\"\n (focus)=\"toggleOverlay(true)\"\n (input)=\"toggleOverlay(true)\"\n (keydown.arrowdown)=\"$event.preventDefault(); switchFocusToOptions()\"\n autocomplete=\"off\"\n [id]=\"getInputId('input-autocomplete')\"\n [formControl]=\"searchControl\"\n [placeholder]=\"placeholder()\"\n nbInput\n cdkOverlayOrigin\n fullWidth />\n\n <ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"trigger\"\n [cdkConnectedOverlayOpen]=\"overlayVisible()\"\n [cdkConnectedOverlayWidth]=\"clientWidth()\"\n (overlayOutsideClick)=\"toggleOverlay(false)\"\n (detach)=\"toggleOverlay(false)\">\n <nbx-select-options-list\n #optionsListContainer\n [optionsListClass]=\"optionsListClass()\"\n [virtualScrollItemSizePX]=\"virtualScrollItemSizePX()\"\n [enableVirtualScroll]=\"enableVirtualScroll()\"\n (optionClicked)=\"optionSelected($any($event))\"\n (tabClicked)=\"moveFocusToNextElement()\"\n [options]=\"filteredOptions()\"></nbx-select-options-list>\n </ng-template>\n</nbx-input-wrapper>\n" }]
793
+ }], propDecorators: { optionsListContainer: [{ type: i0.ViewChild, args: ['optionsListContainer', { ...{
794
+ read: (ElementRef),
795
+ }, isSignal: true }] }], inputElement: [{ type: i0.ViewChild, args: ['inputElement', { ...{ read: ElementRef }, isSignal: true }] }], optionsListClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionsListClass", required: false }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: true }] }], virtualScrollItemSizePX: [{ type: i0.Input, args: [{ isSignal: true, alias: "virtualScrollItemSizePX", required: false }] }], enableVirtualScroll: [{ type: i0.Input, args: [{ isSignal: true, alias: "enableVirtualScroll", required: false }] }], anyStringInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "anyStringInput", required: false }] }], selectChanged: [{ type: i0.Output, args: ["selectChanged"] }] } });
796
+
797
+ class NbxInputColorSelectComponent extends NbxControlValueAccessorBaseDirective {
798
+ overlayVisible = signal(false, ...(ngDevMode ? [{ debugName: "overlayVisible" }] : /* istanbul ignore next */ []));
799
+ colorSelected = output();
800
+ /**
801
+ * @description if you want show select options as color you need to provide customData: string in option otherwise will be shown as regular select string
802
+ * @example {value: 'green', title: 'green',customData: '#000000' }
803
+ */
804
+ options = input.required(...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
805
+ /**
806
+ * @description Display title in list
807
+ * @default true
808
+ */
809
+ withTitle = input(true, ...(ngDevMode ? [{ debugName: "withTitle" }] : /* istanbul ignore next */ []));
810
+ selectedOption() {
811
+ return this.options().find((option) => option.value === this.value());
812
+ }
813
+ toggleOverlay(state) {
814
+ this.overlayVisible.update((old) => state ?? !old);
815
+ }
816
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: NbxInputColorSelectComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
817
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.15", type: NbxInputColorSelectComponent, isStandalone: true, selector: "nbx-input-color-select", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: true, transformFunction: null }, withTitle: { classPropertyName: "withTitle", publicName: "withTitle", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { colorSelected: "colorSelected" }, host: { properties: { "style": "{\n '--nbx-color-input-disabled-text-color': 'var(--input-' + status() + '-disabled-text-color)',\n '--nbx-color-input-hover-background-color': 'var(--select-outline-' + status() + '-hover-background-color)',\n '--nbx-color-input-border-color': 'var(--select-outline-' + status() + '-border-color)',\n '--nbx-color-input-disabled-border-color': 'var(--select-outline-' + status() + '-disabled-border-color)',\n '--nbx-color-input-padding': 'var(--select-outline-' + size() + '-padding)',\n }" }, classAttribute: "input-control" }, providers: [
818
+ {
819
+ provide: NG_VALUE_ACCESSOR,
820
+ useExisting: NbxInputColorSelectComponent,
821
+ multi: true,
822
+ },
823
+ ], usesInheritance: true, ngImport: i0, template: "<nbx-input-wrapper [context]=\"getContext()\" [inputId]=\"getInputId('color-select-input')\">\n <ng-content label-content></ng-content>\n <div class=\"input-color-wrap\">\n <div class=\"nb-form-control-container nb-form-field-control-with-suffix\">\n <button\n type=\"button\"\n [disabled]=\"disabled()\"\n (click)=\"!disabled() ? toggleOverlay() : false\"\n cdkOverlayOrigin\n #trigger=\"cdkOverlayOrigin\"\n [id]=\"getInputId('color-select-input')\"\n class=\"select-button\">\n @if (selectedOption(); as selected) {\n @if (!selected.customData || withTitle()) {\n {{ selected.title }}\n }\n @if (selected.customData) {\n <div class=\"color-round\" [style.backgroundColor]=\"selected.customData\"></div>\n }\n } @else {\n @if (withTitle()) {\n <span> none </span>\n }\n <nb-icon icon=\"slash-outline\"></nb-icon>\n }\n\n <nb-icon icon=\"chevron-down-outline\" [class.active]=\"overlayVisible()\"></nb-icon>\n </button>\n\n <ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"trigger\"\n [cdkConnectedOverlayOpen]=\"overlayVisible()\"\n (overlayOutsideClick)=\"toggleOverlay(false)\">\n <div class=\"color-options-list\" [class.with-title]=\"withTitle()\">\n <button\n type=\"button\"\n class=\"color-option\"\n id=\"color-option-reset\"\n (click)=\"valueChanged($any(null)); toggleOverlay(false); colorSelected.emit(null)\">\n @if (withTitle()) {\n <div class=\"option-with-title\">\n none\n <nb-icon icon=\"slash-outline\"></nb-icon>\n </div>\n } @else {\n <nb-icon icon=\"slash-outline\"></nb-icon>\n }\n </button>\n @for (option of options(); track $index) {\n <button\n type=\"button\"\n class=\"color-option\"\n id=\"color-option-{{ $index }}\"\n [class.selected]=\"option.value === value()\"\n (click)=\"valueChanged(option.value); toggleOverlay(false); colorSelected.emit(option.value)\">\n @if (option.customData) {\n @if (withTitle()) {\n <div class=\"option-with-title\">\n {{ option.title }}\n <div class=\"color-round\" [style.backgroundColor]=\"option.customData\"></div>\n </div>\n } @else {\n <div class=\"color-round\" [style.backgroundColor]=\"option.customData\"></div>\n }\n } @else {\n {{ option.title }}\n }\n </button>\n }\n </div>\n </ng-template>\n </div>\n </div>\n</nbx-input-wrapper>\n", styles: ["@charset \"UTF-8\";button{padding:0;border:none;outline:none;background:none}.input-color-wrap{display:flex;align-items:center;width:100%;max-width:100%}.input-color-wrap .nb-form-control-container{width:100%}.select-button{background-color:var(--nbx-input-background-color);border-color:var(--nbx-color-input-border-color);color:var(--nbx-input-text-color);font-size:var(--nbx-input-font-size);font-weight:var(--nbx-input-font-weight);line-height:var(--nbx-input-line-height, 1);border-style:var(--select-outline-border-style);border-width:var(--select-outline-border-width);border-radius:var(--select-rectangle-border-radius);padding:var(--nbx-color-input-padding);display:flex;align-items:center;gap:.5rem}.select-button:disabled{border-color:var(--nbx-color-input-disabled-border-color);color:var(--nbx-color-input-disabled-text-color)}.select-button:hover{background-color:var(--nbx-color-input-hover-background-color)}.select-button nb-icon.active{transform:rotate(180deg)}.select-button nb-icon{font-size:inherit}.select-button .color-round{width:var(--nbx-input-line-height, 1.2em);height:var(--nbx-input-line-height, 1.2em)}.color-options-list{display:grid;grid-template-columns:repeat(2,1fr);gap:.5rem;padding:.5rem;background-color:var(--option-list-background-color);border-color:var(--option-list-border-color);border-style:var(--option-list-border-style);border-width:var(--option-list-border-width);border-radius:var(--option-list-border-radius);box-shadow:var(--option-list-shadow);overflow:hidden}.color-options-list .color-option{padding:.1rem;color:var(--option-text-color);font-weight:600;position:relative}@media(hover:hover){.color-options-list .color-option:hover{background-color:var(--option-hover-background-color)}}.color-options-list .color-option.selected{z-index:1}.color-options-list .color-option.selected .color-round:after{z-index:2;content:\"\\2713\";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);font-size:1rem;color:#fff}.color-options-list.with-title{grid-template-columns:1fr;padding:.5rem 0}.color-options-list.with-title .color-option{padding:.5rem 1rem}.color-options-list.with-title .color-option.selected{background-color:var(--option-hover-background-color)}.color-options-list .option-with-title{display:flex;gap:.2rem;justify-content:space-between}.color-round{position:relative;width:1.2em;height:1.2em;border-radius:50%}\n"], dependencies: [{ kind: "component", type: NbIconComponent, selector: "nb-icon", inputs: ["icon", "pack", "options", "status", "config"], outputs: ["iconChange", "packChange", "optionsChange", "statusChange"] }, { kind: "component", type: NbxInputWrapperComponent, selector: "nbx-input-wrapper", inputs: ["context", "isInputHasButton", "inputId", "copyAsJson", "floatLabelOnlyBySearch", "searchHasValue"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "ngmodule", type: OverlayModule }, { kind: "directive", type: i1$1.CdkConnectedOverlay, selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]", inputs: ["cdkConnectedOverlayOrigin", "cdkConnectedOverlayPositions", "cdkConnectedOverlayPositionStrategy", "cdkConnectedOverlayOffsetX", "cdkConnectedOverlayOffsetY", "cdkConnectedOverlayWidth", "cdkConnectedOverlayHeight", "cdkConnectedOverlayMinWidth", "cdkConnectedOverlayMinHeight", "cdkConnectedOverlayBackdropClass", "cdkConnectedOverlayPanelClass", "cdkConnectedOverlayViewportMargin", "cdkConnectedOverlayScrollStrategy", "cdkConnectedOverlayOpen", "cdkConnectedOverlayDisableClose", "cdkConnectedOverlayTransformOriginOn", "cdkConnectedOverlayHasBackdrop", "cdkConnectedOverlayLockPosition", "cdkConnectedOverlayFlexibleDimensions", "cdkConnectedOverlayGrowAfterOpen", "cdkConnectedOverlayPush", "cdkConnectedOverlayDisposeOnNavigation", "cdkConnectedOverlayUsePopover", "cdkConnectedOverlayMatchWidth", "cdkConnectedOverlay"], outputs: ["backdropClick", "positionChange", "attach", "detach", "overlayKeydown", "overlayOutsideClick"], exportAs: ["cdkConnectedOverlay"] }, { kind: "directive", type: i1$1.CdkOverlayOrigin, selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]", exportAs: ["cdkOverlayOrigin"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
824
+ }
825
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: NbxInputColorSelectComponent, decorators: [{
826
+ type: Component,
827
+ args: [{ selector: 'nbx-input-color-select', imports: [NbIconComponent, NbxInputWrapperComponent, ReactiveFormsModule, OverlayModule], host: {
828
+ class: 'input-control',
829
+ '[style]': `{
830
+ '--nbx-color-input-disabled-text-color': 'var(--input-' + status() + '-disabled-text-color)',
831
+ '--nbx-color-input-hover-background-color': 'var(--select-outline-' + status() + '-hover-background-color)',
832
+ '--nbx-color-input-border-color': 'var(--select-outline-' + status() + '-border-color)',
833
+ '--nbx-color-input-disabled-border-color': 'var(--select-outline-' + status() + '-disabled-border-color)',
834
+ '--nbx-color-input-padding': 'var(--select-outline-' + size() + '-padding)',
835
+ }`,
836
+ }, providers: [
837
+ {
838
+ provide: NG_VALUE_ACCESSOR,
839
+ useExisting: NbxInputColorSelectComponent,
840
+ multi: true,
841
+ },
842
+ ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<nbx-input-wrapper [context]=\"getContext()\" [inputId]=\"getInputId('color-select-input')\">\n <ng-content label-content></ng-content>\n <div class=\"input-color-wrap\">\n <div class=\"nb-form-control-container nb-form-field-control-with-suffix\">\n <button\n type=\"button\"\n [disabled]=\"disabled()\"\n (click)=\"!disabled() ? toggleOverlay() : false\"\n cdkOverlayOrigin\n #trigger=\"cdkOverlayOrigin\"\n [id]=\"getInputId('color-select-input')\"\n class=\"select-button\">\n @if (selectedOption(); as selected) {\n @if (!selected.customData || withTitle()) {\n {{ selected.title }}\n }\n @if (selected.customData) {\n <div class=\"color-round\" [style.backgroundColor]=\"selected.customData\"></div>\n }\n } @else {\n @if (withTitle()) {\n <span> none </span>\n }\n <nb-icon icon=\"slash-outline\"></nb-icon>\n }\n\n <nb-icon icon=\"chevron-down-outline\" [class.active]=\"overlayVisible()\"></nb-icon>\n </button>\n\n <ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"trigger\"\n [cdkConnectedOverlayOpen]=\"overlayVisible()\"\n (overlayOutsideClick)=\"toggleOverlay(false)\">\n <div class=\"color-options-list\" [class.with-title]=\"withTitle()\">\n <button\n type=\"button\"\n class=\"color-option\"\n id=\"color-option-reset\"\n (click)=\"valueChanged($any(null)); toggleOverlay(false); colorSelected.emit(null)\">\n @if (withTitle()) {\n <div class=\"option-with-title\">\n none\n <nb-icon icon=\"slash-outline\"></nb-icon>\n </div>\n } @else {\n <nb-icon icon=\"slash-outline\"></nb-icon>\n }\n </button>\n @for (option of options(); track $index) {\n <button\n type=\"button\"\n class=\"color-option\"\n id=\"color-option-{{ $index }}\"\n [class.selected]=\"option.value === value()\"\n (click)=\"valueChanged(option.value); toggleOverlay(false); colorSelected.emit(option.value)\">\n @if (option.customData) {\n @if (withTitle()) {\n <div class=\"option-with-title\">\n {{ option.title }}\n <div class=\"color-round\" [style.backgroundColor]=\"option.customData\"></div>\n </div>\n } @else {\n <div class=\"color-round\" [style.backgroundColor]=\"option.customData\"></div>\n }\n } @else {\n {{ option.title }}\n }\n </button>\n }\n </div>\n </ng-template>\n </div>\n </div>\n</nbx-input-wrapper>\n", styles: ["@charset \"UTF-8\";button{padding:0;border:none;outline:none;background:none}.input-color-wrap{display:flex;align-items:center;width:100%;max-width:100%}.input-color-wrap .nb-form-control-container{width:100%}.select-button{background-color:var(--nbx-input-background-color);border-color:var(--nbx-color-input-border-color);color:var(--nbx-input-text-color);font-size:var(--nbx-input-font-size);font-weight:var(--nbx-input-font-weight);line-height:var(--nbx-input-line-height, 1);border-style:var(--select-outline-border-style);border-width:var(--select-outline-border-width);border-radius:var(--select-rectangle-border-radius);padding:var(--nbx-color-input-padding);display:flex;align-items:center;gap:.5rem}.select-button:disabled{border-color:var(--nbx-color-input-disabled-border-color);color:var(--nbx-color-input-disabled-text-color)}.select-button:hover{background-color:var(--nbx-color-input-hover-background-color)}.select-button nb-icon.active{transform:rotate(180deg)}.select-button nb-icon{font-size:inherit}.select-button .color-round{width:var(--nbx-input-line-height, 1.2em);height:var(--nbx-input-line-height, 1.2em)}.color-options-list{display:grid;grid-template-columns:repeat(2,1fr);gap:.5rem;padding:.5rem;background-color:var(--option-list-background-color);border-color:var(--option-list-border-color);border-style:var(--option-list-border-style);border-width:var(--option-list-border-width);border-radius:var(--option-list-border-radius);box-shadow:var(--option-list-shadow);overflow:hidden}.color-options-list .color-option{padding:.1rem;color:var(--option-text-color);font-weight:600;position:relative}@media(hover:hover){.color-options-list .color-option:hover{background-color:var(--option-hover-background-color)}}.color-options-list .color-option.selected{z-index:1}.color-options-list .color-option.selected .color-round:after{z-index:2;content:\"\\2713\";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);font-size:1rem;color:#fff}.color-options-list.with-title{grid-template-columns:1fr;padding:.5rem 0}.color-options-list.with-title .color-option{padding:.5rem 1rem}.color-options-list.with-title .color-option.selected{background-color:var(--option-hover-background-color)}.color-options-list .option-with-title{display:flex;gap:.2rem;justify-content:space-between}.color-round{position:relative;width:1.2em;height:1.2em;border-radius:50%}\n"] }]
843
+ }], propDecorators: { colorSelected: [{ type: i0.Output, args: ["colorSelected"] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: true }] }], withTitle: [{ type: i0.Input, args: [{ isSignal: true, alias: "withTitle", required: false }] }] } });
844
+
845
+ /**
846
+ * @description for correct work you need to provide NbDatepickerModule.forRoot() in you root providers list
847
+ */
848
+ class NbxInputDatePickerComponent extends NbxControlValueAccessorBaseDirective {
849
+ minDate = input(null, ...(ngDevMode ? [{ debugName: "minDate" }] : /* istanbul ignore next */ []));
850
+ maxDate = input(null, ...(ngDevMode ? [{ debugName: "maxDate" }] : /* istanbul ignore next */ []));
851
+ dateChanged = output();
852
+ constructor() {
853
+ super();
854
+ }
855
+ dateSelected(event) {
856
+ this.dateChanged.emit(event);
857
+ }
858
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: NbxInputDatePickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
859
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.15", type: NbxInputDatePickerComponent, isStandalone: true, selector: "nbx-input-date-picker", inputs: { minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dateChanged: "dateChanged" }, providers: [
860
+ {
861
+ provide: NG_VALUE_ACCESSOR,
862
+ useExisting: NbxInputDatePickerComponent,
863
+ multi: true,
864
+ },
865
+ ], usesInheritance: true, ngImport: i0, template: "<nbx-input-wrapper [context]=\"getContext()\" [isInputHasButton]=\"true\" [inputId]=\"getInputId('date-picker')\">\n <ng-content label-content></ng-content>\n <nb-form-field>\n <input\n fullWidth\n nbInput\n [status]=\"status()\"\n [size]=\"size()\"\n [id]=\"getInputId('date-picker')\"\n [placeholder]=\"placeholder()\"\n [nbDatepicker]=\"datePicker\"\n [formControl]=\"control\" />\n <button\n type=\"button\"\n [id]=\"getInputId('date-picker') + '-reset-button'\"\n [disabled]=\"disabled()\"\n title=\"Clear\"\n nbSuffix\n nbButton\n appearance=\"ghost\"\n (click)=\"control.reset()\">\n <nb-icon icon=\"backspace-outline\" pack=\"eva\"> </nb-icon>\n </button>\n </nb-form-field>\n <nb-datepicker\n #datePicker\n style=\"display: none\"\n (dateChange)=\"dateSelected($event)\"\n [min]=\"minDate()\"\n [max]=\"maxDate()\"></nb-datepicker>\n</nbx-input-wrapper>\n", dependencies: [{ kind: "component", type: NbxInputWrapperComponent, selector: "nbx-input-wrapper", inputs: ["context", "isInputHasButton", "inputId", "copyAsJson", "floatLabelOnlyBySearch", "searchHasValue"] }, { kind: "directive", type: NbInputDirective, selector: "input[nbInput],textarea[nbInput]", inputs: ["fieldSize", "size", "status", "shape", "fullWidth"] }, { kind: "component", type: NbButtonComponent, selector: "button[nbButton],a[nbButton],input[type=\"button\"][nbButton],input[type=\"submit\"][nbButton]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: NbIconComponent, selector: "nb-icon", inputs: ["icon", "pack", "options", "status", "config"], outputs: ["iconChange", "packChange", "optionsChange", "statusChange"] }, { kind: "component", type: NbFormFieldComponent, selector: "nb-form-field" }, { kind: "directive", type: NbSuffixDirective, selector: "[nbSuffix]" }, { kind: "directive", type: NbDatepickerDirective, selector: "input[nbDatepicker]", inputs: ["nbDatepicker"] }, { kind: "component", type: NbDatepickerComponent, selector: "nb-datepicker", inputs: ["date"], outputs: ["dateChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
866
+ }
867
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: NbxInputDatePickerComponent, decorators: [{
868
+ type: Component,
869
+ args: [{ standalone: true, selector: 'nbx-input-date-picker', providers: [
870
+ {
871
+ provide: NG_VALUE_ACCESSOR,
872
+ useExisting: NbxInputDatePickerComponent,
873
+ multi: true,
874
+ },
875
+ ], imports: [
876
+ NbxInputWrapperComponent,
877
+ NbInputDirective,
878
+ NbButtonComponent,
879
+ ReactiveFormsModule,
880
+ NbIconComponent,
881
+ NbFormFieldComponent,
882
+ NbSuffixDirective,
883
+ NbDatepickerDirective,
884
+ NbDatepickerComponent,
885
+ ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<nbx-input-wrapper [context]=\"getContext()\" [isInputHasButton]=\"true\" [inputId]=\"getInputId('date-picker')\">\n <ng-content label-content></ng-content>\n <nb-form-field>\n <input\n fullWidth\n nbInput\n [status]=\"status()\"\n [size]=\"size()\"\n [id]=\"getInputId('date-picker')\"\n [placeholder]=\"placeholder()\"\n [nbDatepicker]=\"datePicker\"\n [formControl]=\"control\" />\n <button\n type=\"button\"\n [id]=\"getInputId('date-picker') + '-reset-button'\"\n [disabled]=\"disabled()\"\n title=\"Clear\"\n nbSuffix\n nbButton\n appearance=\"ghost\"\n (click)=\"control.reset()\">\n <nb-icon icon=\"backspace-outline\" pack=\"eva\"> </nb-icon>\n </button>\n </nb-form-field>\n <nb-datepicker\n #datePicker\n style=\"display: none\"\n (dateChange)=\"dateSelected($event)\"\n [min]=\"minDate()\"\n [max]=\"maxDate()\"></nb-datepicker>\n</nbx-input-wrapper>\n" }]
886
+ }], ctorParameters: () => [], propDecorators: { minDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "minDate", required: false }] }], maxDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxDate", required: false }] }], dateChanged: [{ type: i0.Output, args: ["dateChanged"] }] } });
887
+
888
+ /**
889
+ * @description for correct work you need to provide NbDatepickerModule.forRoot() in you root providers list
890
+ */
891
+ class NbxInputDateRangePickerComponent extends NbxControlValueAccessorBaseDirective {
892
+ dateService = inject(NbDateService);
893
+ minDate = input(null, ...(ngDevMode ? [{ debugName: "minDate" }] : /* istanbul ignore next */ []));
894
+ maxDate = input(null, ...(ngDevMode ? [{ debugName: "maxDate" }] : /* istanbul ignore next */ []));
895
+ dateRangeChanged = output();
896
+ inputControl = new FormControl();
897
+ constructor() {
898
+ super();
899
+ this.dateService.compareDates = (date1, date2) => {
900
+ const date1Time = date1.getTime();
901
+ if (date2 instanceof Date) {
902
+ return date1Time - date2.getTime();
903
+ }
904
+ if (date2?.start && date2?.end) {
905
+ const start = new Date(date2?.start).getTime();
906
+ const end = new Date(date2?.end).getTime();
907
+ return date1Time === start ? 0 : date1Time > start && date1Time < end ? 1 : -1;
908
+ }
909
+ if (date2?.start) {
910
+ const start = new Date(date2.start).getTime();
911
+ return date1Time === start ? 0 : date1Time > start ? 1 : -1;
912
+ }
913
+ if (date2?.end) {
914
+ const end = new Date(date2.end).getTime();
915
+ return date1Time === end ? 0 : date1Time < end ? 1 : -1;
916
+ }
917
+ return 0;
918
+ };
919
+ }
920
+ dateChanged(event) {
921
+ this.dateRangeChanged.emit(event);
922
+ return;
923
+ }
924
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: NbxInputDateRangePickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
925
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.15", type: NbxInputDateRangePickerComponent, isStandalone: true, selector: "nbx-input-date-range-picker", inputs: { minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dateRangeChanged: "dateRangeChanged" }, providers: [
926
+ {
927
+ provide: NG_VALUE_ACCESSOR,
928
+ useExisting: NbxInputDateRangePickerComponent,
929
+ multi: true,
930
+ },
931
+ ], usesInheritance: true, ngImport: i0, template: "<nbx-input-wrapper [context]=\"getContext()\" [isInputHasButton]=\"true\" [inputId]=\"getInputId('date-range-picker')\">\n <ng-content label-content></ng-content>\n <nb-form-field>\n <input\n fullWidth\n nbInput\n [status]=\"status()\"\n [size]=\"size()\"\n [placeholder]=\"placeholder()\"\n [nbDatepicker]=\"dateRangePicker\"\n [formControl]=\"control\"\n [id]=\"getInputId('date-range-picker')\" />\n <button\n type=\"button\"\n [disabled]=\"disabled()\"\n [id]=\"getInputId('date-range-picker') + '-reset-button'\"\n title=\"Clear\"\n nbSuffix\n nbButton\n appearance=\"ghost\"\n (click)=\"control.reset()\">\n <nb-icon icon=\"backspace-outline\" pack=\"eva\"> </nb-icon>\n </button>\n </nb-form-field>\n <nb-rangepicker\n #dateRangePicker\n style=\"display: none\"\n (rangeChange)=\"dateChanged($event)\"\n [min]=\"minDate()\"\n [max]=\"maxDate()\"></nb-rangepicker>\n</nbx-input-wrapper>\n", dependencies: [{ kind: "component", type: NbxInputWrapperComponent, selector: "nbx-input-wrapper", inputs: ["context", "isInputHasButton", "inputId", "copyAsJson", "floatLabelOnlyBySearch", "searchHasValue"] }, { kind: "directive", type: NbInputDirective, selector: "input[nbInput],textarea[nbInput]", inputs: ["fieldSize", "size", "status", "shape", "fullWidth"] }, { kind: "component", type: NbButtonComponent, selector: "button[nbButton],a[nbButton],input[type=\"button\"][nbButton],input[type=\"submit\"][nbButton]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: NbIconComponent, selector: "nb-icon", inputs: ["icon", "pack", "options", "status", "config"], outputs: ["iconChange", "packChange", "optionsChange", "statusChange"] }, { kind: "component", type: NbFormFieldComponent, selector: "nb-form-field" }, { kind: "directive", type: NbSuffixDirective, selector: "[nbSuffix]" }, { kind: "directive", type: NbDatepickerDirective, selector: "input[nbDatepicker]", inputs: ["nbDatepicker"] }, { kind: "component", type: NbRangepickerComponent, selector: "nb-rangepicker", inputs: ["range"], outputs: ["rangeChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
932
+ }
933
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: NbxInputDateRangePickerComponent, decorators: [{
934
+ type: Component,
935
+ args: [{ standalone: true, selector: 'nbx-input-date-range-picker', providers: [
936
+ {
937
+ provide: NG_VALUE_ACCESSOR,
938
+ useExisting: NbxInputDateRangePickerComponent,
939
+ multi: true,
940
+ },
941
+ ], imports: [
942
+ NbxInputWrapperComponent,
943
+ NbInputDirective,
944
+ NbButtonComponent,
945
+ ReactiveFormsModule,
946
+ NbIconComponent,
947
+ NbFormFieldComponent,
948
+ NbSuffixDirective,
949
+ NbDatepickerDirective,
950
+ NbRangepickerComponent,
951
+ ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<nbx-input-wrapper [context]=\"getContext()\" [isInputHasButton]=\"true\" [inputId]=\"getInputId('date-range-picker')\">\n <ng-content label-content></ng-content>\n <nb-form-field>\n <input\n fullWidth\n nbInput\n [status]=\"status()\"\n [size]=\"size()\"\n [placeholder]=\"placeholder()\"\n [nbDatepicker]=\"dateRangePicker\"\n [formControl]=\"control\"\n [id]=\"getInputId('date-range-picker')\" />\n <button\n type=\"button\"\n [disabled]=\"disabled()\"\n [id]=\"getInputId('date-range-picker') + '-reset-button'\"\n title=\"Clear\"\n nbSuffix\n nbButton\n appearance=\"ghost\"\n (click)=\"control.reset()\">\n <nb-icon icon=\"backspace-outline\" pack=\"eva\"> </nb-icon>\n </button>\n </nb-form-field>\n <nb-rangepicker\n #dateRangePicker\n style=\"display: none\"\n (rangeChange)=\"dateChanged($event)\"\n [min]=\"minDate()\"\n [max]=\"maxDate()\"></nb-rangepicker>\n</nbx-input-wrapper>\n" }]
952
+ }], ctorParameters: () => [], propDecorators: { minDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "minDate", required: false }] }], maxDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxDate", required: false }] }], dateRangeChanged: [{ type: i0.Output, args: ["dateRangeChanged"] }] } });
953
+
954
+ /**
955
+ * @description for correct work you need to provide NbDatepickerModule.forRoot() and NbTimepickerModule.forRoot() in you root providers list
956
+ */
957
+ class NbxInputDateTimePickerComponent extends NbxControlValueAccessorBaseDirective {
958
+ minDate = input(null, ...(ngDevMode ? [{ debugName: "minDate" }] : /* istanbul ignore next */ []));
959
+ maxDate = input(null, ...(ngDevMode ? [{ debugName: "maxDate" }] : /* istanbul ignore next */ []));
960
+ dateChanged = output();
961
+ constructor() {
962
+ super();
963
+ }
964
+ dateSelected(event) {
965
+ this.dateChanged.emit(event);
966
+ }
967
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: NbxInputDateTimePickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
968
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.15", type: NbxInputDateTimePickerComponent, isStandalone: true, selector: "nbx-input-date-time-picker", inputs: { minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dateChanged: "dateChanged" }, providers: [
969
+ {
970
+ provide: NG_VALUE_ACCESSOR,
971
+ useExisting: NbxInputDateTimePickerComponent,
972
+ multi: true,
973
+ },
974
+ ], usesInheritance: true, ngImport: i0, template: "<nbx-input-wrapper [context]=\"getContext()\" [isInputHasButton]=\"true\" [inputId]=\"getInputId('date-time-picker')\">\n <ng-content label-content></ng-content>\n <nb-form-field>\n <input\n fullWidth\n nbInput\n [status]=\"status()\"\n [size]=\"size()\"\n [placeholder]=\"placeholder()\"\n [id]=\"getInputId('date-time-picker')\"\n [nbDatepicker]=\"dateTimePicker\"\n [formControl]=\"control\" />\n <button\n type=\"button\"\n [id]=\"getInputId('date-picker') + '-reset-button'\"\n [disabled]=\"disabled()\"\n title=\"Clear\"\n nbSuffix\n nbButton\n appearance=\"ghost\"\n (click)=\"control.reset()\">\n <nb-icon icon=\"backspace-outline\" pack=\"eva\"> </nb-icon>\n </button>\n </nb-form-field>\n <nb-date-timepicker\n #dateTimePicker\n style=\"display: none\"\n (dateTimeChange)=\"dateSelected($event)\"\n singleColumn\n [step]=\"10\"\n [min]=\"minDate()\"\n [max]=\"maxDate()\"></nb-date-timepicker>\n</nbx-input-wrapper>\n", dependencies: [{ kind: "component", type: NbxInputWrapperComponent, selector: "nbx-input-wrapper", inputs: ["context", "isInputHasButton", "inputId", "copyAsJson", "floatLabelOnlyBySearch", "searchHasValue"] }, { kind: "directive", type: NbInputDirective, selector: "input[nbInput],textarea[nbInput]", inputs: ["fieldSize", "size", "status", "shape", "fullWidth"] }, { kind: "component", type: NbButtonComponent, selector: "button[nbButton],a[nbButton],input[type=\"button\"][nbButton],input[type=\"submit\"][nbButton]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: NbIconComponent, selector: "nb-icon", inputs: ["icon", "pack", "options", "status", "config"], outputs: ["iconChange", "packChange", "optionsChange", "statusChange"] }, { kind: "component", type: NbFormFieldComponent, selector: "nb-form-field" }, { kind: "directive", type: NbSuffixDirective, selector: "[nbSuffix]" }, { kind: "directive", type: NbDatepickerDirective, selector: "input[nbDatepicker]", inputs: ["nbDatepicker"] }, { kind: "component", type: NbDateTimePickerComponent, selector: "nb-date-timepicker", inputs: ["step", "title", "applyButtonText", "currentTimeButtonText", "showCurrentTimeButton", "twelveHoursFormat", "showAmPmLabel", "withSeconds", "singleColumn"], outputs: ["dateTimeChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
975
+ }
976
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: NbxInputDateTimePickerComponent, decorators: [{
977
+ type: Component,
978
+ args: [{ selector: 'nbx-input-date-time-picker', providers: [
979
+ {
980
+ provide: NG_VALUE_ACCESSOR,
981
+ useExisting: NbxInputDateTimePickerComponent,
982
+ multi: true,
983
+ },
984
+ ], imports: [
985
+ NbxInputWrapperComponent,
986
+ NbInputDirective,
987
+ NbButtonComponent,
988
+ ReactiveFormsModule,
989
+ NbIconComponent,
990
+ NbFormFieldComponent,
991
+ NbSuffixDirective,
992
+ NbDatepickerDirective,
993
+ NbDateTimePickerComponent,
994
+ ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<nbx-input-wrapper [context]=\"getContext()\" [isInputHasButton]=\"true\" [inputId]=\"getInputId('date-time-picker')\">\n <ng-content label-content></ng-content>\n <nb-form-field>\n <input\n fullWidth\n nbInput\n [status]=\"status()\"\n [size]=\"size()\"\n [placeholder]=\"placeholder()\"\n [id]=\"getInputId('date-time-picker')\"\n [nbDatepicker]=\"dateTimePicker\"\n [formControl]=\"control\" />\n <button\n type=\"button\"\n [id]=\"getInputId('date-picker') + '-reset-button'\"\n [disabled]=\"disabled()\"\n title=\"Clear\"\n nbSuffix\n nbButton\n appearance=\"ghost\"\n (click)=\"control.reset()\">\n <nb-icon icon=\"backspace-outline\" pack=\"eva\"> </nb-icon>\n </button>\n </nb-form-field>\n <nb-date-timepicker\n #dateTimePicker\n style=\"display: none\"\n (dateTimeChange)=\"dateSelected($event)\"\n singleColumn\n [step]=\"10\"\n [min]=\"minDate()\"\n [max]=\"maxDate()\"></nb-date-timepicker>\n</nbx-input-wrapper>\n" }]
995
+ }], ctorParameters: () => [], propDecorators: { minDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "minDate", required: false }] }], maxDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxDate", required: false }] }], dateChanged: [{ type: i0.Output, args: ["dateChanged"] }] } });
996
+
997
+ class NbxInputMultiselectAutocompleteComponent extends NbxControlValueAccessorBaseDirective {
998
+ inputElement = viewChild('inputElement', { ...(ngDevMode ? { debugName: "inputElement" } : /* istanbul ignore next */ {}), read: ElementRef });
999
+ optionsListContainer = viewChild('optionsListContainer', { ...(ngDevMode ? { debugName: "optionsListContainer" } : /* istanbul ignore next */ {}), read: (ElementRef) });
1000
+ searchControl = new FormControl('');
1001
+ clientWidth = signal('100%', ...(ngDevMode ? [{ debugName: "clientWidth" }] : /* istanbul ignore next */ []));
1002
+ optionsListClass = input('', ...(ngDevMode ? [{ debugName: "optionsListClass" }] : /* istanbul ignore next */ []));
1003
+ selectedOnTop = input(false, ...(ngDevMode ? [{ debugName: "selectedOnTop" }] : /* istanbul ignore next */ []));
1004
+ /**
1005
+ * you can correct height of option if you have change it style for correct work of virtual scroll
1006
+ */
1007
+ virtualScrollItemSizePX = input(38, ...(ngDevMode ? [{ debugName: "virtualScrollItemSizePX" }] : /* istanbul ignore next */ []));
1008
+ enableVirtualScroll = input(false, ...(ngDevMode ? [{ debugName: "enableVirtualScroll" }] : /* istanbul ignore next */ []));
1009
+ options = input.required(...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
1010
+ selectedChange = output();
1011
+ searchValue = toSignal(this.searchControl.valueChanges.pipe(map((value) => value || '')));
1012
+ selectedValues = signal([], ...(ngDevMode ? [{ debugName: "selectedValues" }] : /* istanbul ignore next */ []));
1013
+ selectedTitlesString = computed(() => {
1014
+ return this.selectedValues().reduce((prev, current) => {
1015
+ const option = this.options().find((option) => option.value === current);
1016
+ if (!option)
1017
+ return prev;
1018
+ return (prev += `${prev ? ', ' : ''}${option.title}`);
1019
+ }, '');
1020
+ }, ...(ngDevMode ? [{ debugName: "selectedTitlesString" }] : /* istanbul ignore next */ []));
1021
+ overlayVisible = signal(false, ...(ngDevMode ? [{ debugName: "overlayVisible" }] : /* istanbul ignore next */ []));
1022
+ filteredOptions = computed(() => {
1023
+ const list = !this.searchValue()
1024
+ ? this.options()
1025
+ : filterAndSortOptionsBySearch(this.options(), this.searchValue());
1026
+ if (!this.selectedOnTop()) {
1027
+ return list;
1028
+ }
1029
+ const options = [];
1030
+ list.forEach((option) => {
1031
+ if (this.selectedValues().includes(option.value)) {
1032
+ options.unshift(option);
1033
+ }
1034
+ else {
1035
+ options.push(option);
1036
+ }
1037
+ });
1038
+ return options;
1039
+ }, ...(ngDevMode ? [{ debugName: "filteredOptions" }] : /* istanbul ignore next */ []));
1040
+ ngAfterViewInit() {
1041
+ setTimeout(() => {
1042
+ const element = this.inputElement()?.nativeElement;
1043
+ if (element) {
1044
+ this.clientWidth.set(element.clientWidth || '100%');
1045
+ resizeObservable(element)
1046
+ .pipe(takeUntilDestroyed(this.destroyRef))
1047
+ .subscribe(() => {
1048
+ this.clientWidth.set(this.inputElement()?.nativeElement.clientWidth || '100%');
1049
+ });
1050
+ }
1051
+ }, 200);
1052
+ }
1053
+ writeValue(value) {
1054
+ this.value.set(value || []);
1055
+ this.setSelected(value || [], true);
1056
+ }
1057
+ optionClicked(value) {
1058
+ let newValue = [];
1059
+ if (!this.selectedValues().includes(value)) {
1060
+ newValue = [...this.selectedValues(), value];
1061
+ }
1062
+ else {
1063
+ newValue = this.selectedValues().filter((insideValue) => insideValue !== value);
1064
+ }
1065
+ this.setSelected(newValue);
1066
+ }
1067
+ moveFocusToNextElement() {
1068
+ this.inputElement()?.nativeElement.focus();
1069
+ }
1070
+ switchFocusToOptions() {
1071
+ const optionsListContainer = this.optionsListContainer();
1072
+ if (optionsListContainer) {
1073
+ const firstOption = optionsListContainer.nativeElement.querySelector('nb-option');
1074
+ firstOption?.focus();
1075
+ }
1076
+ }
1077
+ resetSelection() {
1078
+ this.setSelected([]);
1079
+ this.searchControl.reset();
1080
+ }
1081
+ selectAllOptions() {
1082
+ const allValues = this.options().map((option) => option.value);
1083
+ this.setSelected(allValues);
1084
+ }
1085
+ setDisabledState(isDisabled) {
1086
+ super.setDisabledState(isDisabled);
1087
+ if (isDisabled) {
1088
+ this.searchControl.disable({ emitEvent: false });
1089
+ }
1090
+ else {
1091
+ this.searchControl.enable({ emitEvent: false });
1092
+ }
1093
+ }
1094
+ setSelected(valuesArray, onlySelf = false) {
1095
+ this.selectedValues.set(valuesArray);
1096
+ if (!onlySelf) {
1097
+ this.valueChanged(valuesArray);
1098
+ setTimeout(() => {
1099
+ this.selectedChange.emit(this.value());
1100
+ }, 50);
1101
+ }
1102
+ }
1103
+ toggleOverlay(state) {
1104
+ if (state !== this.overlayVisible()) {
1105
+ this.onTouched();
1106
+ this.overlayVisible.set(state ?? !this.overlayVisible);
1107
+ if (!this.overlayVisible()) {
1108
+ this.searchControl.reset('');
1109
+ }
1110
+ }
1111
+ }
1112
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: NbxInputMultiselectAutocompleteComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1113
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.2.15", type: NbxInputMultiselectAutocompleteComponent, isStandalone: true, selector: "nbx-input-multiselect-autocomplete", inputs: { optionsListClass: { classPropertyName: "optionsListClass", publicName: "optionsListClass", isSignal: true, isRequired: false, transformFunction: null }, selectedOnTop: { classPropertyName: "selectedOnTop", publicName: "selectedOnTop", isSignal: true, isRequired: false, transformFunction: null }, virtualScrollItemSizePX: { classPropertyName: "virtualScrollItemSizePX", publicName: "virtualScrollItemSizePX", isSignal: true, isRequired: false, transformFunction: null }, enableVirtualScroll: { classPropertyName: "enableVirtualScroll", publicName: "enableVirtualScroll", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { selectedChange: "selectedChange" }, providers: [
1114
+ {
1115
+ provide: NG_VALUE_ACCESSOR,
1116
+ useExisting: NbxInputMultiselectAutocompleteComponent,
1117
+ multi: true,
1118
+ },
1119
+ ], viewQueries: [{ propertyName: "inputElement", first: true, predicate: ["inputElement"], descendants: true, read: ElementRef, isSignal: true }, { propertyName: "optionsListContainer", first: true, predicate: ["optionsListContainer"], descendants: true, read: ElementRef, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<nbx-input-wrapper\n [context]=\"getContext()\"\n [searchHasValue]=\"!!searchControl.value\"\n (keydown.tab)=\"toggleOverlay(false)\"\n [isInputHasButton]=\"true\"\n [inputId]=\"getInputId('multiselect-autocomplete-input')\">\n <ng-content label-content></ng-content>\n <nb-form-field>\n <input\n nbInput\n cdkOverlayOrigin\n #inputElement\n #trigger=\"cdkOverlayOrigin\"\n [status]=\"status()\"\n [size]=\"size()\"\n (click)=\"toggleOverlay(true)\"\n (focus)=\"toggleOverlay(true)\"\n (input)=\"toggleOverlay(true)\"\n (keydown.arrowdown)=\"$event.preventDefault(); switchFocusToOptions()\"\n [class.has-value]=\"selectedTitlesString()\"\n [formControl]=\"searchControl\"\n [id]=\"getInputId('multiselect-autocomplete-input')\"\n fullWidth\n [placeholder]=\"selectedTitlesString() || placeholder()\"\n type=\"text\" />\n\n <button\n title=\"Clear\"\n type=\"button\"\n [disabled]=\"disabled()\"\n [size]=\"size()\"\n [status]=\"status()\"\n nbSuffix\n nbButton\n [id]=\"getInputId('multi-autocomplete-input') + '-clear-button'\"\n appearance=\"ghost\"\n (click)=\"resetSelection()\">\n <nb-icon icon=\"backspace-outline\" pack=\"eva\"> </nb-icon>\n </button>\n <ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"trigger\"\n [cdkConnectedOverlayOpen]=\"overlayVisible()\"\n [cdkConnectedOverlayWidth]=\"clientWidth()\"\n (overlayOutsideClick)=\"toggleOverlay(false)\"\n (detach)=\"toggleOverlay(false)\">\n <nbx-select-options-list\n #optionsListContainer\n [multi]=\"true\"\n [optionsListClass]=\"optionsListClass()\"\n [virtualScrollItemSizePX]=\"virtualScrollItemSizePX()\"\n [enableVirtualScroll]=\"enableVirtualScroll()\"\n [selectedValues]=\"selectedValues()\"\n (selectAll)=\"selectAllOptions()\"\n (optionClicked)=\"optionClicked($event.value)\"\n (tabClicked)=\"moveFocusToNextElement()\"\n [options]=\"filteredOptions()\"></nbx-select-options-list>\n </ng-template>\n </nb-form-field>\n</nbx-input-wrapper>\n", styles: [".options{padding:0}.options nb-checkbox{display:inline-flex;height:100%;width:100%}input::placeholder{font-size:var(--nbx-input-font-size)!important;line-height:var(--nbx-input-line-height);opacity:1!important}input.has-value::placeholder{font-weight:var(--nbx-input-font-weight);color:var(--nbx-input-text-color)}.d-inline-flex{display:inline-flex}.w-100{width:100%}.multiselect-autocomplete-checkbox ::ng-deep label{padding:var(--option-medium-padding, .5rem);width:100%}.input-container{position:relative}.input-container input:focus~.selected-text-container{left:5rem;max-width:80%;background-color:var(--input-basic-focus-background-color)}.input-container input:focus:hover~.selected-text-container{background-color:var(--input-basic-focus-and-hover-background-color)}.input-container input:hover~.selected-text-container{background-color:var(--input-basic-hover-background-color)}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: OverlayModule }, { kind: "directive", type: i1$1.CdkConnectedOverlay, selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]", inputs: ["cdkConnectedOverlayOrigin", "cdkConnectedOverlayPositions", "cdkConnectedOverlayPositionStrategy", "cdkConnectedOverlayOffsetX", "cdkConnectedOverlayOffsetY", "cdkConnectedOverlayWidth", "cdkConnectedOverlayHeight", "cdkConnectedOverlayMinWidth", "cdkConnectedOverlayMinHeight", "cdkConnectedOverlayBackdropClass", "cdkConnectedOverlayPanelClass", "cdkConnectedOverlayViewportMargin", "cdkConnectedOverlayScrollStrategy", "cdkConnectedOverlayOpen", "cdkConnectedOverlayDisableClose", "cdkConnectedOverlayTransformOriginOn", "cdkConnectedOverlayHasBackdrop", "cdkConnectedOverlayLockPosition", "cdkConnectedOverlayFlexibleDimensions", "cdkConnectedOverlayGrowAfterOpen", "cdkConnectedOverlayPush", "cdkConnectedOverlayDisposeOnNavigation", "cdkConnectedOverlayUsePopover", "cdkConnectedOverlayMatchWidth", "cdkConnectedOverlay"], outputs: ["backdropClick", "positionChange", "attach", "detach", "overlayKeydown", "overlayOutsideClick"], exportAs: ["cdkConnectedOverlay"] }, { kind: "directive", type: i1$1.CdkOverlayOrigin, selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]", exportAs: ["cdkOverlayOrigin"] }, { kind: "directive", type: NbInputDirective, selector: "input[nbInput],textarea[nbInput]", inputs: ["fieldSize", "size", "status", "shape", "fullWidth"] }, { kind: "component", type: NbButtonComponent, selector: "button[nbButton],a[nbButton],input[type=\"button\"][nbButton],input[type=\"submit\"][nbButton]" }, { kind: "component", type: NbIconComponent, selector: "nb-icon", inputs: ["icon", "pack", "options", "status", "config"], outputs: ["iconChange", "packChange", "optionsChange", "statusChange"] }, { kind: "component", type: NbFormFieldComponent, selector: "nb-form-field" }, { kind: "directive", type: NbSuffixDirective, selector: "[nbSuffix]" }, { kind: "component", type: NbxInputWrapperComponent, selector: "nbx-input-wrapper", inputs: ["context", "isInputHasButton", "inputId", "copyAsJson", "floatLabelOnlyBySearch", "searchHasValue"] }, { kind: "component", type: NbxSelectOptionsListComponent, selector: "nbx-select-options-list", inputs: ["options", "optionsListClass", "enableVirtualScroll", "virtualScrollItemSizePX", "multi", "selectedValues"], outputs: ["optionClicked", "selectAll", "tabClicked"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1120
+ }
1121
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: NbxInputMultiselectAutocompleteComponent, decorators: [{
1122
+ type: Component,
1123
+ args: [{ selector: 'nbx-input-multiselect-autocomplete', imports: [
1124
+ ReactiveFormsModule,
1125
+ OverlayModule,
1126
+ NbInputDirective,
1127
+ NbButtonComponent,
1128
+ NbIconComponent,
1129
+ NbFormFieldComponent,
1130
+ NbSuffixDirective,
1131
+ NbxInputWrapperComponent,
1132
+ NbxSelectOptionsListComponent,
1133
+ ], providers: [
1134
+ {
1135
+ provide: NG_VALUE_ACCESSOR,
1136
+ useExisting: NbxInputMultiselectAutocompleteComponent,
1137
+ multi: true,
1138
+ },
1139
+ ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<nbx-input-wrapper\n [context]=\"getContext()\"\n [searchHasValue]=\"!!searchControl.value\"\n (keydown.tab)=\"toggleOverlay(false)\"\n [isInputHasButton]=\"true\"\n [inputId]=\"getInputId('multiselect-autocomplete-input')\">\n <ng-content label-content></ng-content>\n <nb-form-field>\n <input\n nbInput\n cdkOverlayOrigin\n #inputElement\n #trigger=\"cdkOverlayOrigin\"\n [status]=\"status()\"\n [size]=\"size()\"\n (click)=\"toggleOverlay(true)\"\n (focus)=\"toggleOverlay(true)\"\n (input)=\"toggleOverlay(true)\"\n (keydown.arrowdown)=\"$event.preventDefault(); switchFocusToOptions()\"\n [class.has-value]=\"selectedTitlesString()\"\n [formControl]=\"searchControl\"\n [id]=\"getInputId('multiselect-autocomplete-input')\"\n fullWidth\n [placeholder]=\"selectedTitlesString() || placeholder()\"\n type=\"text\" />\n\n <button\n title=\"Clear\"\n type=\"button\"\n [disabled]=\"disabled()\"\n [size]=\"size()\"\n [status]=\"status()\"\n nbSuffix\n nbButton\n [id]=\"getInputId('multi-autocomplete-input') + '-clear-button'\"\n appearance=\"ghost\"\n (click)=\"resetSelection()\">\n <nb-icon icon=\"backspace-outline\" pack=\"eva\"> </nb-icon>\n </button>\n <ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"trigger\"\n [cdkConnectedOverlayOpen]=\"overlayVisible()\"\n [cdkConnectedOverlayWidth]=\"clientWidth()\"\n (overlayOutsideClick)=\"toggleOverlay(false)\"\n (detach)=\"toggleOverlay(false)\">\n <nbx-select-options-list\n #optionsListContainer\n [multi]=\"true\"\n [optionsListClass]=\"optionsListClass()\"\n [virtualScrollItemSizePX]=\"virtualScrollItemSizePX()\"\n [enableVirtualScroll]=\"enableVirtualScroll()\"\n [selectedValues]=\"selectedValues()\"\n (selectAll)=\"selectAllOptions()\"\n (optionClicked)=\"optionClicked($event.value)\"\n (tabClicked)=\"moveFocusToNextElement()\"\n [options]=\"filteredOptions()\"></nbx-select-options-list>\n </ng-template>\n </nb-form-field>\n</nbx-input-wrapper>\n", styles: [".options{padding:0}.options nb-checkbox{display:inline-flex;height:100%;width:100%}input::placeholder{font-size:var(--nbx-input-font-size)!important;line-height:var(--nbx-input-line-height);opacity:1!important}input.has-value::placeholder{font-weight:var(--nbx-input-font-weight);color:var(--nbx-input-text-color)}.d-inline-flex{display:inline-flex}.w-100{width:100%}.multiselect-autocomplete-checkbox ::ng-deep label{padding:var(--option-medium-padding, .5rem);width:100%}.input-container{position:relative}.input-container input:focus~.selected-text-container{left:5rem;max-width:80%;background-color:var(--input-basic-focus-background-color)}.input-container input:focus:hover~.selected-text-container{background-color:var(--input-basic-focus-and-hover-background-color)}.input-container input:hover~.selected-text-container{background-color:var(--input-basic-hover-background-color)}\n"] }]
1140
+ }], propDecorators: { inputElement: [{ type: i0.ViewChild, args: ['inputElement', { ...{ read: ElementRef }, isSignal: true }] }], optionsListContainer: [{ type: i0.ViewChild, args: ['optionsListContainer', { ...{
1141
+ read: (ElementRef),
1142
+ }, isSignal: true }] }], optionsListClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionsListClass", required: false }] }], selectedOnTop: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedOnTop", required: false }] }], virtualScrollItemSizePX: [{ type: i0.Input, args: [{ isSignal: true, alias: "virtualScrollItemSizePX", required: false }] }], enableVirtualScroll: [{ type: i0.Input, args: [{ isSignal: true, alias: "enableVirtualScroll", required: false }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: true }] }], selectedChange: [{ type: i0.Output, args: ["selectedChange"] }] } });
1143
+
1144
+ class NbxInputNumberComponent extends NbxControlValueAccessorBaseDirective {
1145
+ min = input(null, ...(ngDevMode ? [{ debugName: "min" }] : /* istanbul ignore next */ []));
1146
+ max = input(null, ...(ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []));
1147
+ onlyInt = input(false, ...(ngDevMode ? [{ debugName: "onlyInt" }] : /* istanbul ignore next */ []));
1148
+ inputKeyup = output();
1149
+ inputKeyUp(target) {
1150
+ this.inputKeyup.emit(target.value);
1151
+ }
1152
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: NbxInputNumberComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1153
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.15", type: NbxInputNumberComponent, isStandalone: true, selector: "nbx-input-number", inputs: { min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, onlyInt: { classPropertyName: "onlyInt", publicName: "onlyInt", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { inputKeyup: "inputKeyup" }, providers: [
1154
+ {
1155
+ provide: NG_VALUE_ACCESSOR,
1156
+ useExisting: NbxInputNumberComponent,
1157
+ multi: true,
1158
+ },
1159
+ ], usesInheritance: true, ngImport: i0, template: "<nbx-input-wrapper [context]=\"getContext()\" [inputId]=\"getInputId('input-number')\">\n <ng-content label-content></ng-content>\n\n <input\n (keydown.arrowDown)=\"$event.preventDefault()\"\n (keydown.arrowUp)=\"$event.preventDefault()\"\n (wheel)=\"$event.preventDefault()\"\n [formControl]=\"control\"\n (input)=\"inputKeyUp($any($event.target))\"\n fullWidth\n [nbxIntOrFloat]=\"onlyInt() ? 'int' : 'float'\"\n [status]=\"status()\"\n [size]=\"size()\"\n nbInput\n [id]=\"getInputId('input-number')\"\n [min]=\"min()\"\n [max]=\"max()\"\n [placeholder]=\"placeholder()\"\n type=\"number\" />\n</nbx-input-wrapper>\n", styles: ["input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}input[type=number]{-moz-appearance:textfield}\n"], dependencies: [{ kind: "directive", type: NbInputDirective, selector: "input[nbInput],textarea[nbInput]", inputs: ["fieldSize", "size", "status", "shape", "fullWidth"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$2.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.MinValidator, selector: "input[type=number][min][formControlName],input[type=number][min][formControl],input[type=number][min][ngModel]", inputs: ["min"] }, { kind: "directive", type: i1$2.MaxValidator, selector: "input[type=number][max][formControlName],input[type=number][max][formControl],input[type=number][max][ngModel]", inputs: ["max"] }, { kind: "directive", type: i1$2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: NbxInputWrapperComponent, selector: "nbx-input-wrapper", inputs: ["context", "isInputHasButton", "inputId", "copyAsJson", "floatLabelOnlyBySearch", "searchHasValue"] }, { kind: "directive", type: IntOrFloatDirective, selector: "[nbxIntOrFloat]", inputs: ["nbxIntOrFloat"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1160
+ }
1161
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: NbxInputNumberComponent, decorators: [{
1162
+ type: Component,
1163
+ args: [{ selector: 'nbx-input-number', providers: [
1164
+ {
1165
+ provide: NG_VALUE_ACCESSOR,
1166
+ useExisting: NbxInputNumberComponent,
1167
+ multi: true,
1168
+ },
1169
+ ], imports: [NbInputDirective, ReactiveFormsModule, NbxInputWrapperComponent, IntOrFloatDirective], changeDetection: ChangeDetectionStrategy.OnPush, template: "<nbx-input-wrapper [context]=\"getContext()\" [inputId]=\"getInputId('input-number')\">\n <ng-content label-content></ng-content>\n\n <input\n (keydown.arrowDown)=\"$event.preventDefault()\"\n (keydown.arrowUp)=\"$event.preventDefault()\"\n (wheel)=\"$event.preventDefault()\"\n [formControl]=\"control\"\n (input)=\"inputKeyUp($any($event.target))\"\n fullWidth\n [nbxIntOrFloat]=\"onlyInt() ? 'int' : 'float'\"\n [status]=\"status()\"\n [size]=\"size()\"\n nbInput\n [id]=\"getInputId('input-number')\"\n [min]=\"min()\"\n [max]=\"max()\"\n [placeholder]=\"placeholder()\"\n type=\"number\" />\n</nbx-input-wrapper>\n", styles: ["input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}input[type=number]{-moz-appearance:textfield}\n"] }]
1170
+ }], propDecorators: { min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], onlyInt: [{ type: i0.Input, args: [{ isSignal: true, alias: "onlyInt", required: false }] }], inputKeyup: [{ type: i0.Output, args: ["inputKeyup"] }] } });
1171
+
1172
+ class NbxInputSelectComponent extends NbxControlValueAccessorBaseDirective {
1173
+ multiple = input(false, ...(ngDevMode ? [{ debugName: "multiple" }] : /* istanbul ignore next */ []));
1174
+ optionsListClass = input('', ...(ngDevMode ? [{ debugName: "optionsListClass" }] : /* istanbul ignore next */ []));
1175
+ options = input.required(...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
1176
+ selectedChange = output();
1177
+ isAllSelected = computed(() => this.value()?.length === this.options()?.length, ...(ngDevMode ? [{ debugName: "isAllSelected" }] : /* istanbul ignore next */ []));
1178
+ constructor() {
1179
+ super();
1180
+ }
1181
+ selectAll() {
1182
+ const allValues = this.options().map((item) => item.value);
1183
+ this.control.setValue(allValues);
1184
+ }
1185
+ resetForm() {
1186
+ this.control?.reset();
1187
+ if (this.multiple()) {
1188
+ this.valueChanged([]);
1189
+ this.selectedChangeEvent();
1190
+ }
1191
+ }
1192
+ selectedChangeEvent() {
1193
+ setTimeout(() => {
1194
+ this.selectedChange.emit(this.control.value);
1195
+ });
1196
+ }
1197
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: NbxInputSelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1198
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.15", type: NbxInputSelectComponent, isStandalone: true, selector: "nbx-input-select", inputs: { multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, optionsListClass: { classPropertyName: "optionsListClass", publicName: "optionsListClass", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { selectedChange: "selectedChange" }, providers: [
1199
+ {
1200
+ provide: NG_VALUE_ACCESSOR,
1201
+ useExisting: NbxInputSelectComponent,
1202
+ multi: true,
1203
+ },
1204
+ ], usesInheritance: true, ngImport: i0, template: "<nbx-input-wrapper [context]=\"getContext()\" [isInputHasButton]=\"true\" [inputId]=\"getInputId('select-input')\">\n <ng-content label-content></ng-content>\n <div class=\"select-wrapper\">\n <div class=\"nb-form-control-container nb-form-field-control-with-suffix\">\n <nb-select\n [multiple]=\"multiple()\"\n [optionsListClass]=\"optionsListClass()\"\n [class.multiple]=\"multiple()\"\n [status]=\"status()\"\n [size]=\"size()\"\n [id]=\"getInputId('select-input')\"\n fullWidth\n [formControl]=\"control\"\n [placeholder]=\"placeholder()\"\n (selectedChange)=\"selectedChangeEvent()\">\n @if (multiple()) {\n <nb-option\n [disabled]=\"isAllSelected()\"\n (click)=\"$event.preventDefault(); $event.stopPropagation(); selectAll()\"\n [value]=\"null\">\n Select all\n </nb-option>\n }\n @for (option of options(); track $index) {\n <nb-option [value]=\"option.value\" [disabled]=\"option?.disabled\">\n {{ option.title }}\n </nb-option>\n }\n </nb-select>\n </div>\n @if (multiple()) {\n <div\n [class]=\"['nb-form-field-suffix-' + size(), 'nb-form-field-addon-' + status()]\"\n class=\"nb-form-field-addon ng-star-inserted\">\n <button\n type=\"button\"\n title=\"Clear\"\n [id]=\"getInputId('select-input') + '-clear-button'\"\n nbButton\n appearance=\"ghost\"\n (click)=\"resetForm()\">\n <nb-icon icon=\"backspace-outline\" pack=\"eva\"> </nb-icon>\n </button>\n </div>\n }\n </div>\n</nbx-input-wrapper>\n", styles: [".select-wrapper{display:flex;align-items:center;width:100%;max-width:100%}.select-wrapper .nb-form-control-container{width:100%}nb-select.multiple::ng-deep .select-button nb-icon{display:none}\n"], dependencies: [{ kind: "component", type: NbIconComponent, selector: "nb-icon", inputs: ["icon", "pack", "options", "status", "config"], outputs: ["iconChange", "packChange", "optionsChange", "statusChange"] }, { kind: "component", type: NbSelectComponent, selector: "nb-select", inputs: ["size", "status", "shape", "appearance", "optionsListClass", "optionsPanelClass", "optionsWidth", "disabled", "fullWidth", "placeholder", "compareWith", "selected", "multiple", "optionsOverlayOffset", "scrollStrategy", "outline", "filled", "hero"], outputs: ["selectedChange"] }, { kind: "component", type: NbOptionComponent, selector: "nb-option", inputs: ["value", "disabled"], outputs: ["selectionChange"] }, { kind: "component", type: NbxInputWrapperComponent, selector: "nbx-input-wrapper", inputs: ["context", "isInputHasButton", "inputId", "copyAsJson", "floatLabelOnlyBySearch", "searchHasValue"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: NbButtonComponent, selector: "button[nbButton],a[nbButton],input[type=\"button\"][nbButton],input[type=\"submit\"][nbButton]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1205
+ }
1206
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: NbxInputSelectComponent, decorators: [{
1207
+ type: Component,
1208
+ args: [{ selector: 'nbx-input-select', imports: [
1209
+ NbIconComponent,
1210
+ NbSelectComponent,
1211
+ NbOptionComponent,
1212
+ NbxInputWrapperComponent,
1213
+ ReactiveFormsModule,
1214
+ NbButtonComponent,
1215
+ ], providers: [
1216
+ {
1217
+ provide: NG_VALUE_ACCESSOR,
1218
+ useExisting: NbxInputSelectComponent,
1219
+ multi: true,
1220
+ },
1221
+ ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<nbx-input-wrapper [context]=\"getContext()\" [isInputHasButton]=\"true\" [inputId]=\"getInputId('select-input')\">\n <ng-content label-content></ng-content>\n <div class=\"select-wrapper\">\n <div class=\"nb-form-control-container nb-form-field-control-with-suffix\">\n <nb-select\n [multiple]=\"multiple()\"\n [optionsListClass]=\"optionsListClass()\"\n [class.multiple]=\"multiple()\"\n [status]=\"status()\"\n [size]=\"size()\"\n [id]=\"getInputId('select-input')\"\n fullWidth\n [formControl]=\"control\"\n [placeholder]=\"placeholder()\"\n (selectedChange)=\"selectedChangeEvent()\">\n @if (multiple()) {\n <nb-option\n [disabled]=\"isAllSelected()\"\n (click)=\"$event.preventDefault(); $event.stopPropagation(); selectAll()\"\n [value]=\"null\">\n Select all\n </nb-option>\n }\n @for (option of options(); track $index) {\n <nb-option [value]=\"option.value\" [disabled]=\"option?.disabled\">\n {{ option.title }}\n </nb-option>\n }\n </nb-select>\n </div>\n @if (multiple()) {\n <div\n [class]=\"['nb-form-field-suffix-' + size(), 'nb-form-field-addon-' + status()]\"\n class=\"nb-form-field-addon ng-star-inserted\">\n <button\n type=\"button\"\n title=\"Clear\"\n [id]=\"getInputId('select-input') + '-clear-button'\"\n nbButton\n appearance=\"ghost\"\n (click)=\"resetForm()\">\n <nb-icon icon=\"backspace-outline\" pack=\"eva\"> </nb-icon>\n </button>\n </div>\n }\n </div>\n</nbx-input-wrapper>\n", styles: [".select-wrapper{display:flex;align-items:center;width:100%;max-width:100%}.select-wrapper .nb-form-control-container{width:100%}nb-select.multiple::ng-deep .select-button nb-icon{display:none}\n"] }]
1222
+ }], ctorParameters: () => [], propDecorators: { multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], optionsListClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionsListClass", required: false }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: true }] }], selectedChange: [{ type: i0.Output, args: ["selectedChange"] }] } });
1223
+
1224
+ class NbxInputTextComponent extends NbxControlValueAccessorBaseDirective {
1225
+ type = input('text', ...(ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []));
1226
+ min = input(null, ...(ngDevMode ? [{ debugName: "min" }] : /* istanbul ignore next */ []));
1227
+ max = input(null, ...(ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []));
1228
+ inputKeyup = output();
1229
+ inputKeyUp(target) {
1230
+ this.inputKeyup.emit(target.value);
1231
+ }
1232
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: NbxInputTextComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1233
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.15", type: NbxInputTextComponent, isStandalone: true, selector: "nbx-input-text", inputs: { type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { inputKeyup: "inputKeyup" }, providers: [
1234
+ {
1235
+ provide: NG_VALUE_ACCESSOR,
1236
+ useExisting: NbxInputTextComponent,
1237
+ multi: true,
1238
+ },
1239
+ ], usesInheritance: true, ngImport: i0, template: "<nbx-input-wrapper [context]=\"getContext()\" [inputId]=\"getInputId('input-' + type())\">\n <ng-content label-content></ng-content>\n\n <input\n [formControl]=\"control\"\n (input)=\"inputKeyUp($any($event.target))\"\n fullWidth\n [id]=\"getInputId('input-' + type())\"\n nbInput\n [status]=\"status()\"\n [size]=\"size()\"\n [placeholder]=\"placeholder()\"\n type=\"string\" />\n</nbx-input-wrapper>\n", styles: ["input[type=search]::-webkit-search-decoration,input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-results-button,input[type=search]::-webkit-search-results-decoration{-webkit-appearance:none}\n"], dependencies: [{ kind: "directive", type: NbInputDirective, selector: "input[nbInput],textarea[nbInput]", inputs: ["fieldSize", "size", "status", "shape", "fullWidth"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: NbxInputWrapperComponent, selector: "nbx-input-wrapper", inputs: ["context", "isInputHasButton", "inputId", "copyAsJson", "floatLabelOnlyBySearch", "searchHasValue"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1240
+ }
1241
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: NbxInputTextComponent, decorators: [{
1242
+ type: Component,
1243
+ args: [{ standalone: true, selector: 'nbx-input-text', providers: [
1244
+ {
1245
+ provide: NG_VALUE_ACCESSOR,
1246
+ useExisting: NbxInputTextComponent,
1247
+ multi: true,
1248
+ },
1249
+ ], imports: [NbInputDirective, ReactiveFormsModule, NbxInputWrapperComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "<nbx-input-wrapper [context]=\"getContext()\" [inputId]=\"getInputId('input-' + type())\">\n <ng-content label-content></ng-content>\n\n <input\n [formControl]=\"control\"\n (input)=\"inputKeyUp($any($event.target))\"\n fullWidth\n [id]=\"getInputId('input-' + type())\"\n nbInput\n [status]=\"status()\"\n [size]=\"size()\"\n [placeholder]=\"placeholder()\"\n type=\"string\" />\n</nbx-input-wrapper>\n", styles: ["input[type=search]::-webkit-search-decoration,input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-results-button,input[type=search]::-webkit-search-results-decoration{-webkit-appearance:none}\n"] }]
1250
+ }], propDecorators: { type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], inputKeyup: [{ type: i0.Output, args: ["inputKeyup"] }] } });
1251
+
1252
+ class NbxInputTextareaComponent extends NbxControlValueAccessorBaseDirective {
1253
+ textareaInput = viewChild('textareaInput', ...(ngDevMode ? [{ debugName: "textareaInput" }] : /* istanbul ignore next */ []));
1254
+ inputKeyup = output();
1255
+ rows = input(null, ...(ngDevMode ? [{ debugName: "rows" }] : /* istanbul ignore next */ []));
1256
+ constructor() {
1257
+ super();
1258
+ effect(() => {
1259
+ const valueData = this.value();
1260
+ if (valueData !== this.innerHTMLValue) {
1261
+ this.setTextAreaValue(valueData || '');
1262
+ }
1263
+ });
1264
+ }
1265
+ onPaste(e) {
1266
+ e.preventDefault();
1267
+ const pasteData = e.clipboardData?.getData('text/plain');
1268
+ const selection = window.getSelection();
1269
+ if (selection && selection.rangeCount > 0) {
1270
+ const range = selection.getRangeAt(0);
1271
+ range.deleteContents();
1272
+ range.insertNode(document.createTextNode(pasteData || ''));
1273
+ range.collapse(false);
1274
+ this.valueChanged(this.innerHTMLValue || '');
1275
+ }
1276
+ }
1277
+ keyup() {
1278
+ this.valueChanged(this.innerHTMLValue);
1279
+ this.inputKeyup.emit(this.innerHTMLValue);
1280
+ }
1281
+ get innerHTMLValue() {
1282
+ return this.textareaInput()?.nativeElement.innerHTML || '';
1283
+ }
1284
+ setTextAreaValue(value) {
1285
+ const nativeElement = this.textareaInput()?.nativeElement;
1286
+ if (nativeElement) {
1287
+ nativeElement.innerHTML = value;
1288
+ }
1289
+ }
1290
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: NbxInputTextareaComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1291
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.2.15", type: NbxInputTextareaComponent, isStandalone: true, selector: "nbx-input-textarea", inputs: { rows: { classPropertyName: "rows", publicName: "rows", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { inputKeyup: "inputKeyup" }, host: { properties: { "style": "{\n '--nbx-input-disabled-text-color': 'var(--input-' + status() + '-disabled-text-color)',\n '--nbx-input-disabled-border-color': 'var(--input-' + status() + '-disabled-border-color)',\n }" }, classAttribute: "input-control" }, providers: [
1292
+ {
1293
+ provide: NG_VALUE_ACCESSOR,
1294
+ useExisting: NbxInputTextareaComponent,
1295
+ multi: true,
1296
+ },
1297
+ ], viewQueries: [{ propertyName: "textareaInput", first: true, predicate: ["textareaInput"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<nbx-input-wrapper [context]=\"getContext()\" [inputId]=\"getInputId('input-textarea')\">\n <ng-content label-content></ng-content>\n <div\n #textareaInput\n role=\"none\"\n [id]=\"getInputId('input-textarea')\"\n [attr.placeholder]=\"placeholder()\"\n [class.disabled]=\"disabled()\"\n [class]=\"['size-' + size(), 'status-' + status()]\"\n [style]=\"{ 'min-height': 'calc(1.2rem * ' + (rows() || 0) + ' + 1rem)' }\"\n class=\"textarea-container input-full-width shape-rectangle nb-transition\"\n [attr.contenteditable]=\"!disabled()\"\n nbInput\n fullWidth\n (paste)=\"onPaste($event)\"\n (input)=\"keyup()\"></div>\n</nbx-input-wrapper>\n", styles: [".textarea-container{white-space:pre-wrap}.textarea-container *{background-color:inherit!important}.textarea-container.disabled{color:var(--nbx-input-disabled-text-color);border-color:var(--nbx-input-disabled-border-color);line-break:anywhere}.input-fieldset .has-value [placeholder]:before{content:\"\"}[placeholder]:empty:before{content:attr(placeholder);color:var(--input-primary-placeholder-text-color);font-weight:400}[placeholder]:not(:empty):focus:before{content:\"\"}\n"], dependencies: [{ kind: "component", type: NbxInputWrapperComponent, selector: "nbx-input-wrapper", inputs: ["context", "isInputHasButton", "inputId", "copyAsJson", "floatLabelOnlyBySearch", "searchHasValue"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1298
+ }
1299
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: NbxInputTextareaComponent, decorators: [{
1300
+ type: Component,
1301
+ args: [{ selector: 'nbx-input-textarea', host: {
1302
+ class: 'input-control',
1303
+ '[style]': `{
1304
+ '--nbx-input-disabled-text-color': 'var(--input-' + status() + '-disabled-text-color)',
1305
+ '--nbx-input-disabled-border-color': 'var(--input-' + status() + '-disabled-border-color)',
1306
+ }`,
1307
+ }, providers: [
1308
+ {
1309
+ provide: NG_VALUE_ACCESSOR,
1310
+ useExisting: NbxInputTextareaComponent,
1311
+ multi: true,
1312
+ },
1313
+ ], imports: [NbxInputWrapperComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "<nbx-input-wrapper [context]=\"getContext()\" [inputId]=\"getInputId('input-textarea')\">\n <ng-content label-content></ng-content>\n <div\n #textareaInput\n role=\"none\"\n [id]=\"getInputId('input-textarea')\"\n [attr.placeholder]=\"placeholder()\"\n [class.disabled]=\"disabled()\"\n [class]=\"['size-' + size(), 'status-' + status()]\"\n [style]=\"{ 'min-height': 'calc(1.2rem * ' + (rows() || 0) + ' + 1rem)' }\"\n class=\"textarea-container input-full-width shape-rectangle nb-transition\"\n [attr.contenteditable]=\"!disabled()\"\n nbInput\n fullWidth\n (paste)=\"onPaste($event)\"\n (input)=\"keyup()\"></div>\n</nbx-input-wrapper>\n", styles: [".textarea-container{white-space:pre-wrap}.textarea-container *{background-color:inherit!important}.textarea-container.disabled{color:var(--nbx-input-disabled-text-color);border-color:var(--nbx-input-disabled-border-color);line-break:anywhere}.input-fieldset .has-value [placeholder]:before{content:\"\"}[placeholder]:empty:before{content:attr(placeholder);color:var(--input-primary-placeholder-text-color);font-weight:400}[placeholder]:not(:empty):focus:before{content:\"\"}\n"] }]
1314
+ }], ctorParameters: () => [], propDecorators: { textareaInput: [{ type: i0.ViewChild, args: ['textareaInput', { isSignal: true }] }], inputKeyup: [{ type: i0.Output, args: ["inputKeyup"] }], rows: [{ type: i0.Input, args: [{ isSignal: true, alias: "rows", required: false }] }] } });
1315
+
1316
+ const urlRegExp = new RegExp(/^https?:\/\/(www\.)?[a-zA-Z0-9-]{1,63}(\.[a-zA-Z0-9-]{1,63})*\.[a-zA-Z]{2,6}(\/[-a-zA-Z0-9@:%._+~#?&//=]*)?$/);
1317
+ const emailPattern = /(^$|(^([^<>()\[\]\\,;:\s@"]+(\.[^<>()\[\]\\,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$)/;
1318
+ const NbxValidators = {
1319
+ url: (control) => {
1320
+ const pattern = urlRegExp.test(control.value);
1321
+ return pattern || !control.value ? null : { url: 'Invalid URL. Valid example: http://example.com' };
1322
+ },
1323
+ email: (control) => {
1324
+ const pattern = new RegExp(emailPattern).test(control.value);
1325
+ return pattern || !control.value ? null : { email: true };
1326
+ },
1327
+ };
1328
+
1329
+ /**
1330
+ * @deprecated not need to use it! All providers already provided in theme
1331
+ * @returns null
1332
+ */
1333
+ function provideNbxInputs() {
1334
+ return importProvidersFrom();
1335
+ }
1336
+
1337
+ /**
1338
+ * Generated bundle index. Do not edit.
1339
+ */
1340
+
1341
+ export { IntOrFloatDirective, NbxClipboardDirective, NbxControlValueAccessorBaseDirective, NbxCustomTooltipComponent, NbxInputAutocompleteComponent, NbxInputColorSelectComponent, NbxInputDatePickerComponent, NbxInputDateRangePickerComponent, NbxInputDateTimePickerComponent, NbxInputErrorsComponent, NbxInputLabelComponent, NbxInputMultiselectAutocompleteComponent, NbxInputNumberComponent, NbxInputSelectComponent, NbxInputTextComponent, NbxInputTextareaComponent, NbxInputWrapperComponent, NbxValidators, NbxValidatorsErrorsMessage, filterAndSortOptionsBySearch, filterOptionsBySearch, getFilteredBySearchArray, getOnlyDirtyControlsValuesRecursive, getRandomId, isQueryIncludesInObject, markAllControlsAsDirty, provideNbxInputs, resizeObservable, sortOptionsBySearchIndex };
1342
+ //# sourceMappingURL=d4k-ui-nbx-inputs.mjs.map