@eui/components 19.0.3 → 19.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/directives/eui-has-permission.directive.d.ts +70 -2
- package/directives/eui-has-permission.directive.d.ts.map +1 -1
- package/directives/eui-maxlength.directive.d.ts +94 -10
- package/directives/eui-maxlength.directive.d.ts.map +1 -1
- package/docs/components/EuiAlertComponent.html +129 -0
- package/docs/components/EuiAlertTitleComponent.html +12 -0
- package/docs/components/EuiChipComponent.html +108 -1
- package/docs/components/EuiInputCheckboxComponent.html +169 -10
- package/docs/components/EuiInputGroupAddOnComponent.html +22 -0
- package/docs/components/EuiInputGroupAddOnItemComponent.html +30 -0
- package/docs/components/EuiInputGroupComponent.html +35 -0
- package/docs/components/EuiInputNumberComponent.html +83 -4
- package/docs/components/EuiInputRadioComponent.html +228 -0
- package/docs/components/EuiInputTextComponent.html +50 -0
- package/docs/components/EuiPaginatorComponent.html +204 -0
- package/docs/components/EuiTextareaComponent.html +207 -1
- package/docs/dependencies.html +2 -2
- package/docs/directives/AutoResizeDirective.html +49 -1
- package/docs/directives/EuiHasPermissionDirective.html +34 -0
- package/docs/directives/EuiInputNumberDirective.html +17 -0
- package/docs/directives/EuiMaxLengthDirective.html +35 -7
- package/docs/js/menu-wc.js +65 -119
- package/docs/js/menu-wc_es5.js +1 -1
- package/docs/js/search/search_index.js +2 -2
- package/docs/miscellaneous/functions.html +14 -0
- package/docs/modules/EuiAlertModule.html +11 -0
- package/docs/modules/EuiChipModule.html +11 -0
- package/docs/modules/EuiHasPermissionDirectiveModule.html +17 -3
- package/docs/modules/EuiInputCheckboxModule.html +25 -4
- package/docs/modules/EuiInputGroupModule.html +20 -5
- package/docs/modules/EuiInputNumberModule.html +26 -5
- package/docs/modules/EuiInputRadioModule.html +27 -4
- package/docs/modules/EuiInputTextModule.html +25 -4
- package/docs/modules/EuiMaxLengthDirectiveModule.html +25 -4
- package/docs/modules/EuiPaginatorModule.html +11 -0
- package/docs/modules/EuiTextAreaModule.html +20 -4
- package/eui-alert/components/eui-alert-title.component.d.ts +1 -0
- package/eui-alert/components/eui-alert-title.component.d.ts.map +1 -1
- package/eui-alert/eui-alert.component.d.ts +74 -0
- package/eui-alert/eui-alert.component.d.ts.map +1 -1
- package/eui-alert/eui-alert.module.d.ts +12 -0
- package/eui-alert/eui-alert.module.d.ts.map +1 -1
- package/eui-chip/eui-chip.component.d.ts +71 -0
- package/eui-chip/eui-chip.component.d.ts.map +1 -1
- package/eui-chip/eui-chip.module.d.ts +12 -0
- package/eui-chip/eui-chip.module.d.ts.map +1 -1
- package/eui-input-checkbox/eui-input-checkbox.component.d.ts +88 -11
- package/eui-input-checkbox/eui-input-checkbox.component.d.ts.map +1 -1
- package/eui-input-checkbox/eui-input-checkbox.module.d.ts +17 -3
- package/eui-input-checkbox/eui-input-checkbox.module.d.ts.map +1 -1
- package/eui-input-group/eui-input-group-addon-item.component.d.ts +33 -1
- package/eui-input-group/eui-input-group-addon-item.component.d.ts.map +1 -1
- package/eui-input-group/eui-input-group-addon.component.d.ts +40 -2
- package/eui-input-group/eui-input-group-addon.component.d.ts.map +1 -1
- package/eui-input-group/eui-input-group.component.d.ts +44 -1
- package/eui-input-group/eui-input-group.component.d.ts.map +1 -1
- package/eui-input-group/eui-input-group.module.d.ts +21 -5
- package/eui-input-group/eui-input-group.module.d.ts.map +1 -1
- package/eui-input-number/eui-input-number.component.d.ts +73 -9
- package/eui-input-number/eui-input-number.component.d.ts.map +1 -1
- package/eui-input-number/eui-input-number.module.d.ts +19 -4
- package/eui-input-number/eui-input-number.module.d.ts.map +1 -1
- package/eui-input-number/eui-number-control.directive.d.ts +27 -2
- package/eui-input-number/eui-number-control.directive.d.ts.map +1 -1
- package/eui-input-radio/eui-input-radio.component.d.ts +96 -1
- package/eui-input-radio/eui-input-radio.component.d.ts.map +1 -1
- package/eui-input-radio/eui-input-radio.module.d.ts +20 -3
- package/eui-input-radio/eui-input-radio.module.d.ts.map +1 -1
- package/eui-input-text/eui-input-text.component.d.ts +54 -1
- package/eui-input-text/eui-input-text.component.d.ts.map +1 -1
- package/eui-input-text/eui-input-text.module.d.ts +19 -3
- package/eui-input-text/eui-input-text.module.d.ts.map +1 -1
- package/eui-paginator/eui-paginator.component.d.ts +148 -4
- package/eui-paginator/eui-paginator.component.d.ts.map +1 -1
- package/eui-paginator/eui-paginator.module.d.ts +12 -0
- package/eui-paginator/eui-paginator.module.d.ts.map +1 -1
- package/eui-textarea/auto-resize.directive.d.ts +90 -3
- package/eui-textarea/auto-resize.directive.d.ts.map +1 -1
- package/eui-textarea/eui-textarea.component.d.ts +111 -5
- package/eui-textarea/eui-textarea.component.d.ts.map +1 -1
- package/eui-textarea/eui-textarea.module.d.ts +23 -4
- package/eui-textarea/eui-textarea.module.d.ts.map +1 -1
- package/eui-timepicker/eui-timepicker.component.d.ts.map +1 -1
- package/fesm2022/eui-components-directives.mjs +180 -34
- package/fesm2022/eui-components-directives.mjs.map +1 -1
- package/fesm2022/eui-components-eui-accordion.mjs +1 -1
- package/fesm2022/eui-components-eui-alert.mjs +85 -3
- package/fesm2022/eui-components-eui-alert.mjs.map +1 -1
- package/fesm2022/eui-components-eui-autocomplete.mjs +2 -2
- package/fesm2022/eui-components-eui-avatar.mjs +1 -1
- package/fesm2022/eui-components-eui-badge.mjs +1 -1
- package/fesm2022/eui-components-eui-block-content.mjs +1 -1
- package/fesm2022/eui-components-eui-block-document.mjs +1 -1
- package/fesm2022/eui-components-eui-breadcrumb.mjs +1 -1
- package/fesm2022/eui-components-eui-button-group.mjs +1 -1
- package/fesm2022/eui-components-eui-button-v2.mjs +1 -1
- package/fesm2022/eui-components-eui-button.mjs +1 -1
- package/fesm2022/eui-components-eui-card.mjs +3 -3
- package/fesm2022/eui-components-eui-card.mjs.map +1 -1
- package/fesm2022/eui-components-eui-chip-group.mjs +1 -1
- package/fesm2022/eui-components-eui-chip-list.mjs +1 -1
- package/fesm2022/eui-components-eui-chip.mjs +75 -1
- package/fesm2022/eui-components-eui-chip.mjs.map +1 -1
- package/fesm2022/eui-components-eui-dashboard-button.mjs +1 -1
- package/fesm2022/eui-components-eui-dashboard-card.mjs +1 -1
- package/fesm2022/eui-components-eui-date-range-selector.mjs +5 -5
- package/fesm2022/eui-components-eui-date-range-selector.mjs.map +1 -1
- package/fesm2022/eui-components-eui-datepicker.mjs +1 -1
- package/fesm2022/eui-components-eui-dialog.mjs +1 -1
- package/fesm2022/eui-components-eui-dimmer.mjs +1 -1
- package/fesm2022/eui-components-eui-disable-content.mjs +1 -1
- package/fesm2022/eui-components-eui-discussion-thread.mjs +1 -1
- package/fesm2022/eui-components-eui-dropdown.mjs +2 -2
- package/fesm2022/eui-components-eui-feedback-message.mjs +1 -1
- package/fesm2022/eui-components-eui-fieldset.mjs +1 -1
- package/fesm2022/eui-components-eui-file-upload.mjs +1 -1
- package/fesm2022/eui-components-eui-growl.mjs +1 -1
- package/fesm2022/eui-components-eui-icon-button-expander.mjs +1 -1
- package/fesm2022/eui-components-eui-icon-button.mjs +1 -1
- package/fesm2022/eui-components-eui-icon-color.mjs +1 -1
- package/fesm2022/eui-components-eui-icon-input.mjs +1 -1
- package/fesm2022/eui-components-eui-icon-state.mjs +1 -1
- package/fesm2022/eui-components-eui-icon-toggle.mjs +1 -1
- package/fesm2022/eui-components-eui-icon.mjs +1 -1
- package/fesm2022/eui-components-eui-input-checkbox.mjs +104 -14
- package/fesm2022/eui-components-eui-input-checkbox.mjs.map +1 -1
- package/fesm2022/eui-components-eui-input-group.mjs +142 -12
- package/fesm2022/eui-components-eui-input-group.mjs.map +1 -1
- package/fesm2022/eui-components-eui-input-number.mjs +109 -13
- package/fesm2022/eui-components-eui-input-number.mjs.map +1 -1
- package/fesm2022/eui-components-eui-input-radio.mjs +117 -6
- package/fesm2022/eui-components-eui-input-radio.mjs.map +1 -1
- package/fesm2022/eui-components-eui-input-text.mjs +73 -6
- package/fesm2022/eui-components-eui-input-text.mjs.map +1 -1
- package/fesm2022/eui-components-eui-label.mjs +1 -1
- package/fesm2022/eui-components-eui-language-selector.mjs +1 -1
- package/fesm2022/eui-components-eui-list.mjs +1 -1
- package/fesm2022/eui-components-eui-menu.mjs +1 -1
- package/fesm2022/eui-components-eui-message-box.mjs +1 -1
- package/fesm2022/eui-components-eui-navbar.mjs +1 -1
- package/fesm2022/eui-components-eui-overlay.mjs +1 -1
- package/fesm2022/eui-components-eui-page.mjs +1 -1
- package/fesm2022/eui-components-eui-paginator.mjs +153 -6
- package/fesm2022/eui-components-eui-paginator.mjs.map +1 -1
- package/fesm2022/eui-components-eui-popover.mjs +1 -1
- package/fesm2022/eui-components-eui-progress-bar.mjs +1 -1
- package/fesm2022/eui-components-eui-progress-circle.mjs +1 -1
- package/fesm2022/eui-components-eui-select.mjs +1 -1
- package/fesm2022/eui-components-eui-sidebar-menu.mjs +1 -1
- package/fesm2022/eui-components-eui-skeleton.mjs +1 -1
- package/fesm2022/eui-components-eui-slide-toggle.mjs +2 -2
- package/fesm2022/eui-components-eui-split-button.mjs +1 -1
- package/fesm2022/eui-components-eui-table-v2.mjs +1 -1
- package/fesm2022/eui-components-eui-table.mjs +1 -1
- package/fesm2022/eui-components-eui-tabs.mjs +1 -1
- package/fesm2022/eui-components-eui-textarea.mjs +221 -15
- package/fesm2022/eui-components-eui-textarea.mjs.map +1 -1
- package/fesm2022/eui-components-eui-timebar.mjs +1 -1
- package/fesm2022/eui-components-eui-timeline.mjs +1 -1
- package/fesm2022/eui-components-eui-timepicker.mjs +36 -29
- package/fesm2022/eui-components-eui-timepicker.mjs.map +1 -1
- package/fesm2022/eui-components-eui-tree-list.mjs +1 -1
- package/fesm2022/eui-components-eui-tree.mjs +1 -1
- package/fesm2022/eui-components-eui-user-profile.mjs +1 -1
- package/fesm2022/eui-components-eui-wizard.mjs +1 -1
- package/fesm2022/eui-components-externals-eui-editor.mjs +1 -1
- package/fesm2022/eui-components-externals-quill.mjs +1 -1
- package/fesm2022/eui-components-layout.mjs +2 -2
- package/fesm2022/eui-components-shared.mjs +2 -2
- package/package.json +3 -3
@@ -1,11 +1,11 @@
|
|
1
1
|
import * as i0 from '@angular/core';
|
2
|
-
import {
|
2
|
+
import { Input, Directive, NgModule, HostBinding, ViewEncapsulation, ChangeDetectionStrategy, Component, booleanAttribute, numberAttribute, HostListener, EventEmitter, Output, Self, Optional, Inject, PLATFORM_ID } from '@angular/core';
|
3
3
|
import { CommonModule, DOCUMENT, isPlatformBrowser } from '@angular/common';
|
4
4
|
import * as i1 from '@angular/cdk/overlay';
|
5
5
|
import { ConnectionPositionPair } from '@angular/cdk/overlay';
|
6
6
|
import { Subject, BehaviorSubject, Subscription, timer, fromEvent, take } from 'rxjs';
|
7
7
|
import { ComponentPortal } from '@angular/cdk/portal';
|
8
|
-
import { trigger, state,
|
8
|
+
import { trigger, state, transition, style, animate, keyframes } from '@angular/animations';
|
9
9
|
import * as i1$1 from '@angular/forms';
|
10
10
|
import { NgControl, NgModel } from '@angular/forms';
|
11
11
|
import * as i1$2 from '@eui/core';
|
@@ -361,13 +361,48 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
|
|
361
361
|
}]
|
362
362
|
}] });
|
363
363
|
|
364
|
-
|
364
|
+
/**
|
365
|
+
* @description
|
366
|
+
* A directive that adds maxLength functionality to input and textarea elements with visual feedback.
|
367
|
+
* It shows the remaining characters count and provides visual indication when the limit is reached.
|
368
|
+
*
|
369
|
+
* @selector input[euiMaxlength], textarea[euiMaxlength], [ngModel][euiMaxlength], [formControlName][euiMaxlength]
|
370
|
+
*
|
371
|
+
* @example
|
372
|
+
* ```html
|
373
|
+
* <!-- Basic usage -->
|
374
|
+
* <input [euiMaxlength]="50">
|
375
|
+
*
|
376
|
+
* <!-- With form control -->
|
377
|
+
* <input [formControlName]="'name'" [euiMaxlength]="100">
|
378
|
+
*
|
379
|
+
* <!-- Hide maxlength indicator -->
|
380
|
+
* <textarea [euiMaxlength]="200" [isShowMaxlength]="false"></textarea>
|
381
|
+
* ```
|
382
|
+
*
|
383
|
+
* @publicApi
|
384
|
+
*/
|
365
385
|
class EuiMaxLengthDirective {
|
366
386
|
constructor(el, renderer, control) {
|
367
387
|
this.el = el;
|
368
388
|
this.renderer = renderer;
|
369
389
|
this.control = control;
|
390
|
+
/**
|
391
|
+
* @description
|
392
|
+
* Controls the visibility of the maxLength indicator.
|
393
|
+
* When true, shows a counter with remaining characters.
|
394
|
+
* When false, hides the counter but maintains the maxLength restriction.
|
395
|
+
*
|
396
|
+
* @default true
|
397
|
+
*/
|
370
398
|
this.isShowMaxlength = true;
|
399
|
+
/**
|
400
|
+
* @description
|
401
|
+
* Emits when the input value length reaches or exceeds the maxLength limit.
|
402
|
+
* Emits true when limit is reached, false when below limit.
|
403
|
+
*
|
404
|
+
* @emits {boolean} True when max length is reached, false otherwise
|
405
|
+
*/
|
371
406
|
this.maxLengthReached = new EventEmitter();
|
372
407
|
// set default length calculation behavior
|
373
408
|
this.setLengthCalcFactory((value) => value?.length || 0);
|
@@ -432,13 +467,25 @@ class EuiMaxLengthDirective {
|
|
432
467
|
}
|
433
468
|
onPaste(event) {
|
434
469
|
// get the value from clipboard
|
435
|
-
|
470
|
+
const value = (event.clipboardData || window['clipboardData']).getData('text');
|
436
471
|
// calculate and set the maxLength based on the clipboard value
|
437
|
-
|
472
|
+
const input = this.el.nativeElement;
|
438
473
|
if (this.maxLength) {
|
439
474
|
this.renderer.setProperty(input, 'maxLength', this.calculateMaxLength(value));
|
440
475
|
}
|
441
476
|
}
|
477
|
+
/**
|
478
|
+
* Sets a custom function to calculate the length of the input value.
|
479
|
+
* Useful for implementing custom length calculation logic (e.g., counting characters differently).
|
480
|
+
*
|
481
|
+
* @param fn Function that takes a string input and returns its calculated length
|
482
|
+
*
|
483
|
+
* @example
|
484
|
+
* ```typescript
|
485
|
+
* // Custom length calculation excluding spaces
|
486
|
+
* directive.setLengthCalcFactory((value: string) => value.replace(/\s/g, '').length);
|
487
|
+
* ```
|
488
|
+
*/
|
442
489
|
setLengthCalcFactory(fn) {
|
443
490
|
this.lengthCalcFn = () => {
|
444
491
|
const value = this.getValue();
|
@@ -446,22 +493,33 @@ class EuiMaxLengthDirective {
|
|
446
493
|
};
|
447
494
|
}
|
448
495
|
/**
|
449
|
-
*
|
450
|
-
*
|
451
|
-
* @param value Optional
|
496
|
+
* Calculates the maximum length for the input element based on current value or provided value.
|
497
|
+
*
|
498
|
+
* @param value Optional value to calculate max length against (overrides the current input value)
|
499
|
+
* @returns {number} Calculated maximum length
|
452
500
|
* @private
|
453
501
|
*/
|
454
502
|
calculateMaxLength(value) {
|
455
503
|
const inputValue = this.getValue();
|
456
504
|
return (value?.length || (inputValue?.length || 0) - this.lengthCalcFn()) + this.maxLength;
|
457
505
|
}
|
506
|
+
/**
|
507
|
+
* @description
|
508
|
+
* Refreshes the visual state of the maxLength indicator and updates input restrictions.
|
509
|
+
* - Updates the remaining characters count
|
510
|
+
* - Applies/removes error styling
|
511
|
+
* - Emits maxLengthReached event
|
512
|
+
* - Truncates value if it exceeds maxLength
|
513
|
+
*
|
514
|
+
* @private
|
515
|
+
*/
|
458
516
|
_refreshValue() {
|
459
517
|
if (isNaN(this.maxLength)) {
|
460
518
|
return;
|
461
519
|
}
|
462
|
-
|
463
|
-
|
464
|
-
|
520
|
+
const input = this.el.nativeElement;
|
521
|
+
const valueLength = this.lengthCalcFn();
|
522
|
+
const remainingLength = this.maxLength - valueLength;
|
465
523
|
this.renderer.setProperty(input, 'maxLength', this.calculateMaxLength());
|
466
524
|
if (this.maxLengthSpan) {
|
467
525
|
// based on the remaining length add/remove the error class
|
@@ -491,8 +549,10 @@ class EuiMaxLengthDirective {
|
|
491
549
|
}
|
492
550
|
}
|
493
551
|
/**
|
494
|
-
*
|
495
|
-
*
|
552
|
+
* @description
|
553
|
+
* Creates the maxLength indicator box in the DOM.
|
554
|
+
* Wraps the input element and adds the counter span with appropriate styling.
|
555
|
+
*
|
496
556
|
* @private
|
497
557
|
*/
|
498
558
|
createMaxLengthBox() {
|
@@ -504,11 +564,11 @@ class EuiMaxLengthDirective {
|
|
504
564
|
this.renderer.addClass(this.maxLengthSpan, 'eui-input-maxlength');
|
505
565
|
this.renderer.setAttribute(this.maxLengthSpan, 'innerHTML', this.maxLength.toString());
|
506
566
|
// create wrapper element
|
507
|
-
|
567
|
+
const nativeElement = this.el.nativeElement;
|
508
568
|
if (nativeElement != null) {
|
509
569
|
// set width to 100%
|
510
570
|
this.renderer.setStyle(nativeElement, 'width', '100%');
|
511
|
-
|
571
|
+
const parent = nativeElement.parentNode;
|
512
572
|
if (parent != null && this.isShowMaxlength) {
|
513
573
|
// creates wrapper div of input and maxLength span
|
514
574
|
this.wrapper = this.renderer.createElement('div');
|
@@ -521,7 +581,10 @@ class EuiMaxLengthDirective {
|
|
521
581
|
}
|
522
582
|
}
|
523
583
|
/**
|
524
|
-
*
|
584
|
+
* @description
|
585
|
+
* Removes the maxLength indicator box from the DOM.
|
586
|
+
* Restores the original DOM structure by unwrapping the input element.
|
587
|
+
*
|
525
588
|
* @private
|
526
589
|
*/
|
527
590
|
destroyMaxLengthBox() {
|
@@ -533,8 +596,8 @@ class EuiMaxLengthDirective {
|
|
533
596
|
// remove wrapper from DOM
|
534
597
|
if (this.wrapper) {
|
535
598
|
// get parent node of wrapper
|
536
|
-
|
537
|
-
|
599
|
+
const parent = this.wrapper.parentNode;
|
600
|
+
const nativeElement = this.el.nativeElement;
|
538
601
|
// swap wrapper and nativeElement
|
539
602
|
parent?.replaceChild(nativeElement, this.wrapper);
|
540
603
|
// removes wrapper element from DOM
|
@@ -543,16 +606,19 @@ class EuiMaxLengthDirective {
|
|
543
606
|
}
|
544
607
|
}
|
545
608
|
/**
|
546
|
-
*
|
547
|
-
*
|
609
|
+
* @description
|
610
|
+
* Returns the current value of the input element.
|
611
|
+
* Handles different update strategies when used with forms.
|
612
|
+
*
|
613
|
+
* @returns {string} Current input value
|
548
614
|
* @private
|
549
615
|
*/
|
550
616
|
getValue() {
|
551
|
-
|
617
|
+
const input = this.el.nativeElement;
|
552
618
|
return this.control && this.control.control.updateOn === 'change' ? this.control.value : input.value;
|
553
619
|
}
|
554
620
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: EuiMaxLengthDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i1$1.NgControl, optional: true, self: true }], target: i0.ɵɵFactoryTarget.Directive }); }
|
555
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "19.0.5", type: EuiMaxLengthDirective, isStandalone:
|
621
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "19.0.5", type: EuiMaxLengthDirective, isStandalone: true, selector: "\n input[euiMaxlength],\n textarea[euiMaxlength],\n [ngModel][euiMaxlength],\n [formControlName][euiMaxlength]", inputs: { maxLength: ["euiMaxlength", "maxLength", numberAttribute], isShowMaxlength: ["isShowMaxlength", "isShowMaxlength", booleanAttribute] }, outputs: { maxLengthReached: "maxLengthReached" }, host: { listeners: { "change": "onChange($event)", "input": "onInput($event)", "paste": "onPaste($event)" } }, usesOnChanges: true, ngImport: i0 }); }
|
556
622
|
}
|
557
623
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: EuiMaxLengthDirective, decorators: [{
|
558
624
|
type: Directive,
|
@@ -562,7 +628,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
|
|
562
628
|
textarea[euiMaxlength],
|
563
629
|
[ngModel][euiMaxlength],
|
564
630
|
[formControlName][euiMaxlength]`,
|
565
|
-
standalone:
|
631
|
+
standalone: true,
|
566
632
|
}]
|
567
633
|
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i1$1.NgControl, decorators: [{
|
568
634
|
type: Self
|
@@ -573,7 +639,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
|
|
573
639
|
args: [{ alias: 'euiMaxlength', transform: numberAttribute }]
|
574
640
|
}], isShowMaxlength: [{
|
575
641
|
type: Input,
|
576
|
-
args: [{
|
642
|
+
args: [{ transform: booleanAttribute }]
|
577
643
|
}], maxLengthReached: [{
|
578
644
|
type: Output
|
579
645
|
}], onChange: [{
|
@@ -586,34 +652,92 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
|
|
586
652
|
type: HostListener,
|
587
653
|
args: ['paste', ['$event']]
|
588
654
|
}] } });
|
655
|
+
/**
|
656
|
+
* @description
|
657
|
+
* Module that provides the EuiMaxLengthDirective.
|
658
|
+
* Import this module to use the directive in your application.
|
659
|
+
*
|
660
|
+
* @example
|
661
|
+
* ```typescript
|
662
|
+
* @NgModule({
|
663
|
+
* imports: [EuiMaxLengthDirectiveModule]
|
664
|
+
* })
|
665
|
+
* export class MyModule { }
|
666
|
+
* ```
|
667
|
+
*
|
668
|
+
* @deprecated Use {@link `EuiMaxLengthDirective`} instead.
|
669
|
+
* @publicApi
|
670
|
+
*/
|
589
671
|
class EuiMaxLengthDirectiveModule {
|
590
672
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: EuiMaxLengthDirectiveModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
591
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.5", ngImport: i0, type: EuiMaxLengthDirectiveModule,
|
673
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.5", ngImport: i0, type: EuiMaxLengthDirectiveModule, imports: [CommonModule, EuiMaxLengthDirective], exports: [EuiMaxLengthDirective] }); }
|
592
674
|
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: EuiMaxLengthDirectiveModule, imports: [CommonModule] }); }
|
593
675
|
}
|
594
676
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: EuiMaxLengthDirectiveModule, decorators: [{
|
595
677
|
type: NgModule,
|
596
678
|
args: [{
|
597
|
-
imports: [CommonModule],
|
679
|
+
imports: [CommonModule, EuiMaxLengthDirective],
|
598
680
|
exports: [EuiMaxLengthDirective],
|
599
|
-
declarations: [EuiMaxLengthDirective]
|
600
681
|
}]
|
601
682
|
}] });
|
602
683
|
|
603
|
-
|
604
|
-
|
684
|
+
/**
|
685
|
+
* @description
|
686
|
+
* A structural directive that conditionally renders content based on user permissions.
|
687
|
+
* Similar to *ngIf, but checks against a permission service to determine visibility.
|
688
|
+
*
|
689
|
+
* @example
|
690
|
+
* ```html
|
691
|
+
* <!-- Single permission check -->
|
692
|
+
* <div *euiHasPermission="['READ_USERS']">
|
693
|
+
* Content only visible to users with READ_USERS permission
|
694
|
+
* </div>
|
695
|
+
*
|
696
|
+
* <!-- Multiple permission check (AND operation) -->
|
697
|
+
* <div *euiHasPermission="['READ_USERS', 'WRITE_USERS']">
|
698
|
+
* Content only visible to users with both permissions
|
699
|
+
* </div>
|
700
|
+
* ```
|
701
|
+
*
|
702
|
+
* @usageNotes
|
703
|
+
* The directive performs an AND operation when multiple permissions are provided,
|
704
|
+
* meaning all permissions must be granted for the content to be displayed.
|
705
|
+
*/
|
605
706
|
class EuiHasPermissionDirective {
|
606
707
|
constructor(templateRef, viewContainer, permissionService) {
|
607
708
|
this.templateRef = templateRef;
|
608
709
|
this.viewContainer = viewContainer;
|
609
710
|
this.permissionService = permissionService;
|
711
|
+
/**
|
712
|
+
* @internal
|
713
|
+
* Array storing the current permission requirements
|
714
|
+
*/
|
610
715
|
this.permissions = [];
|
716
|
+
/**
|
717
|
+
* @internal
|
718
|
+
* Flag tracking whether the content is currently hidden
|
719
|
+
*/
|
611
720
|
this.isHidden = true;
|
612
721
|
}
|
722
|
+
/**
|
723
|
+
* @input
|
724
|
+
* @description
|
725
|
+
* Sets the permissions required to display the content. Can be a single permission
|
726
|
+
* string or an array of permission strings.
|
727
|
+
*
|
728
|
+
* @param val - Permission or array of permissions to check
|
729
|
+
*/
|
613
730
|
set euiHasPermission(val) {
|
614
731
|
this.permissions = val;
|
615
732
|
this.updateView();
|
616
733
|
}
|
734
|
+
/**
|
735
|
+
* @internal
|
736
|
+
* @description
|
737
|
+
* Updates the view based on the current permission check results.
|
738
|
+
* If permissions are granted, displays the content.
|
739
|
+
* If permissions are not granted, hides the content.
|
740
|
+
*/
|
617
741
|
updateView() {
|
618
742
|
if (this.checkPermission()) {
|
619
743
|
if (this.isHidden) {
|
@@ -626,6 +750,14 @@ class EuiHasPermissionDirective {
|
|
626
750
|
this.viewContainer.clear();
|
627
751
|
}
|
628
752
|
}
|
753
|
+
/**
|
754
|
+
* @internal
|
755
|
+
* @description
|
756
|
+
* Checks if all required permissions are granted.
|
757
|
+
* Uses AND logic - all permissions must be granted for the method to return true.
|
758
|
+
*
|
759
|
+
* @returns {boolean} True if all permissions are granted, false otherwise
|
760
|
+
*/
|
629
761
|
checkPermission() {
|
630
762
|
let hasPermission = true;
|
631
763
|
// for start, it checks with and operator
|
@@ -635,28 +767,42 @@ class EuiHasPermissionDirective {
|
|
635
767
|
return hasPermission;
|
636
768
|
}
|
637
769
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: EuiHasPermissionDirective, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }, { token: i1$2.EuiPermissionService }], target: i0.ɵɵFactoryTarget.Directive }); }
|
638
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.5", type: EuiHasPermissionDirective, isStandalone:
|
770
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.5", type: EuiHasPermissionDirective, isStandalone: true, selector: "[euiHasPermission]", inputs: { euiHasPermission: "euiHasPermission" }, ngImport: i0 }); }
|
639
771
|
}
|
640
772
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: EuiHasPermissionDirective, decorators: [{
|
641
773
|
type: Directive,
|
642
774
|
args: [{
|
643
775
|
selector: '[euiHasPermission]',
|
644
|
-
standalone:
|
776
|
+
standalone: true,
|
645
777
|
}]
|
646
778
|
}], ctorParameters: () => [{ type: i0.TemplateRef }, { type: i0.ViewContainerRef }, { type: i1$2.EuiPermissionService }], propDecorators: { euiHasPermission: [{
|
647
779
|
type: Input
|
648
780
|
}] } });
|
781
|
+
/**
|
782
|
+
* @description
|
783
|
+
* Angular module that declares and exports the EuiHasPermissionDirective.
|
784
|
+
* Import this module to use the euiHasPermission directive in your components.
|
785
|
+
*
|
786
|
+
* @example
|
787
|
+
* ```typescript
|
788
|
+
* import { EuiHasPermissionDirectiveModule } from '@eui/components';
|
789
|
+
*
|
790
|
+
* @NgModule({
|
791
|
+
* imports: [EuiHasPermissionDirectiveModule],
|
792
|
+
* })
|
793
|
+
* export class MyModule {}
|
794
|
+
* ```
|
795
|
+
*/
|
649
796
|
class EuiHasPermissionDirectiveModule {
|
650
797
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: EuiHasPermissionDirectiveModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
651
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.5", ngImport: i0, type: EuiHasPermissionDirectiveModule,
|
798
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.5", ngImport: i0, type: EuiHasPermissionDirectiveModule, imports: [CommonModule, EuiHasPermissionDirective], exports: [EuiHasPermissionDirective] }); }
|
652
799
|
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: EuiHasPermissionDirectiveModule, imports: [CommonModule] }); }
|
653
800
|
}
|
654
801
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: EuiHasPermissionDirectiveModule, decorators: [{
|
655
802
|
type: NgModule,
|
656
803
|
args: [{
|
657
|
-
imports: [CommonModule],
|
804
|
+
imports: [CommonModule, EuiHasPermissionDirective],
|
658
805
|
exports: [EuiHasPermissionDirective],
|
659
|
-
declarations: [EuiHasPermissionDirective],
|
660
806
|
}]
|
661
807
|
}] });
|
662
808
|
|