@bootkit/ng0 0.0.0-alpha.4 → 0.0.0-alpha.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/common/index.d.ts +263 -7
- package/components/accordion/index.d.ts +13 -3
- package/components/backdrop/index.d.ts +12 -0
- package/components/dropdown/index.d.ts +156 -0
- package/components/form-field/index.d.ts +24 -41
- package/components/list/index.d.ts +260 -0
- package/components/modal/index.d.ts +21 -3
- package/components/nav/index.d.ts +23 -19
- package/components/offcanvas/index.d.ts +13 -5
- package/components/pagination/index.d.ts +34 -8
- package/components/select/index.d.ts +160 -0
- package/components/sidenav/index.d.ts +125 -0
- package/components/table/index.d.ts +191 -59
- package/components/tooltip/index.d.ts +20 -11
- package/components/vertical-menu/index.d.ts +57 -0
- package/data/index.d.ts +103 -38
- package/date/index.d.ts +34 -0
- package/fesm2022/bootkit-ng0-common.mjs +289 -12
- package/fesm2022/bootkit-ng0-common.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-accordion.mjs +34 -27
- package/fesm2022/bootkit-ng0-components-accordion.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-backdrop.mjs +46 -0
- package/fesm2022/bootkit-ng0-components-backdrop.mjs.map +1 -0
- package/fesm2022/bootkit-ng0-components-button.mjs +12 -12
- package/fesm2022/bootkit-ng0-components-button.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-card.mjs +13 -13
- package/fesm2022/bootkit-ng0-components-card.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-code.mjs +10 -10
- package/fesm2022/bootkit-ng0-components-code.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-collapse.mjs +16 -16
- package/fesm2022/bootkit-ng0-components-collapse.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-confirmation.mjs +14 -14
- package/fesm2022/bootkit-ng0-components-confirmation.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-dropdown.mjs +308 -0
- package/fesm2022/bootkit-ng0-components-dropdown.mjs.map +1 -0
- package/fesm2022/bootkit-ng0-components-form-field.mjs +62 -84
- package/fesm2022/bootkit-ng0-components-form-field.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-list.mjs +564 -0
- package/fesm2022/bootkit-ng0-components-list.mjs.map +1 -0
- package/fesm2022/bootkit-ng0-components-modal.mjs +41 -24
- package/fesm2022/bootkit-ng0-components-modal.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-nav.mjs +59 -60
- package/fesm2022/bootkit-ng0-components-nav.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-offcanvas.mjs +20 -13
- package/fesm2022/bootkit-ng0-components-offcanvas.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-overlay.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-pagination.mjs +59 -24
- package/fesm2022/bootkit-ng0-components-pagination.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-popover.mjs +12 -12
- package/fesm2022/bootkit-ng0-components-popover.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-select.mjs +448 -0
- package/fesm2022/bootkit-ng0-components-select.mjs.map +1 -0
- package/fesm2022/bootkit-ng0-components-sidenav.mjs +290 -0
- package/fesm2022/bootkit-ng0-components-sidenav.mjs.map +1 -0
- package/fesm2022/bootkit-ng0-components-stepper.mjs +15 -15
- package/fesm2022/bootkit-ng0-components-stepper.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-table.mjs +303 -159
- package/fesm2022/bootkit-ng0-components-table.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-toast.mjs +7 -7
- package/fesm2022/bootkit-ng0-components-toast.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-tooltip.mjs +41 -22
- package/fesm2022/bootkit-ng0-components-tooltip.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-components-vertical-menu.mjs +148 -0
- package/fesm2022/bootkit-ng0-components-vertical-menu.mjs.map +1 -0
- package/fesm2022/bootkit-ng0-data.mjs +152 -39
- package/fesm2022/bootkit-ng0-data.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-date.mjs +50 -0
- package/fesm2022/bootkit-ng0-date.mjs.map +1 -0
- package/fesm2022/bootkit-ng0-file.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-form.mjs +336 -264
- package/fesm2022/bootkit-ng0-form.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-http.mjs +40 -5
- package/fesm2022/bootkit-ng0-http.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-layouts-layout1.mjs +317 -0
- package/fesm2022/bootkit-ng0-layouts-layout1.mjs.map +1 -0
- package/fesm2022/bootkit-ng0-localization-locales.mjs +101 -0
- package/fesm2022/bootkit-ng0-localization-locales.mjs.map +1 -0
- package/fesm2022/bootkit-ng0-localization.mjs +431 -105
- package/fesm2022/bootkit-ng0-localization.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-platform-browser.mjs +179 -0
- package/fesm2022/bootkit-ng0-platform-browser.mjs.map +1 -0
- package/fesm2022/bootkit-ng0-routing.mjs +80 -0
- package/fesm2022/bootkit-ng0-routing.mjs.map +1 -0
- package/fesm2022/bootkit-ng0-script.mjs +3 -3
- package/fesm2022/bootkit-ng0-script.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-security.mjs +16 -16
- package/fesm2022/bootkit-ng0-security.mjs.map +1 -1
- package/fesm2022/bootkit-ng0-utils.mjs +75 -0
- package/fesm2022/bootkit-ng0-utils.mjs.map +1 -0
- package/fesm2022/bootkit-ng0.mjs +2 -2
- package/fesm2022/bootkit-ng0.mjs.map +1 -1
- package/form/index.d.ts +94 -62
- package/http/index.d.ts +35 -4
- package/index.d.ts +2 -2
- package/layouts/layout1/index.d.ts +201 -0
- package/localization/index.d.ts +231 -42
- package/localization/locales/index.d.ts +7 -0
- package/package.json +63 -15
- package/platform/browser/index.d.ts +88 -0
- package/routing/index.d.ts +124 -0
- package/utils/index.d.ts +42 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootkit-ng0-components-form-field.mjs","sources":["../../../projects/ng0/components/form-field/form-field.component.ts","../../../projects/ng0/components/form-field/form-field.component.html","../../../projects/ng0/components/form-field/form-field.module.ts","../../../projects/ng0/components/form-field/bootkit-ng0-components-form-field.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\r\nimport { DestroyRef, HostListener, input, signal } from '@angular/core';\r\nimport { Component, Input, ContentChild, AfterContentInit, Optional, HostBinding, OnInit, OnDestroy, ElementRef, Renderer2 } from '@angular/core';\r\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\r\nimport { FormControl, NgControl, NgForm } from '@angular/forms';\r\nimport { Locale, LocalizationService } from '@bootkit/ng0/localization';\r\n\r\n@Component({\r\n selector: 'ng0-form-field, ng0-field',\r\n exportAs: 'ng0FormField',\r\n templateUrl: './form-field.component.html',\r\n styleUrls: ['./form-field.component.scss'],\r\n standalone: true,\r\n imports: [\r\n CommonModule\r\n ],\r\n})\r\nexport class FormFieldComponent implements OnInit, AfterContentInit, OnDestroy {\r\n\r\n /**\r\n * The label text for the form field.\r\n */\r\n public label = input<string>();\r\n\r\n /**\r\n * The hint text to display below the form field.\r\n * This is typically used to provide additional information or instructions to the user.\r\n */\r\n public hint = input<string>();\r\n\r\n /**\r\n * If true, the form-field will show validation errors.\r\n * This is useful for displaying validation messages when the form control is invalid.\r\n */\r\n public showErrors = input(true);\r\n\r\n /**\r\n * If true, the form-field will show a red asterisk for required fields.\r\n * This is only a visual indicator and does not enforce validation.\r\n */\r\n public showRequiredIndicator = input(true);\r\n\r\n /**\r\n * If true, the form-field will show subscripts (e.g. hints, errors) for the field label.\r\n * This is useful for displaying additional information or validation messages.\r\n */\r\n public showSubscripts = input(true);\r\n\r\n /**\r\n * If true, the form-field will be rendered inside a \".input-group\" element.\r\n */\r\n public inputGroup = input(true);\r\n\r\n /**\r\n * Returns the first localized error of the control \r\n */\r\n public get errorText() { return this._errorText; }\r\n\r\n /** Reports whether the control is touched. */\r\n public get touched(): boolean | null | undefined { return this._ngControl?.touched; }\r\n\r\n /** Reports whether the control is dirty. */\r\n public get dirty(): boolean | null | undefined { return this._ngControl?.dirty; }\r\n\r\n /** Returns true if this form-field is required, otherwise returns false. */\r\n @HostBinding('class.required-form-field')\r\n public get isRequired(): boolean { return this._isRequired; }\r\n\r\n @HostListener('focusout')\r\n private _onFocusOut() { this._validate(); }\r\n\r\n @ContentChild(NgControl, { static: true })\r\n private _ngControl?: NgControl;\r\n\r\n @ContentChild(NgControl, { static: true, read: ElementRef })\r\n private _ngControlElement?: ElementRef;\r\n\r\n private _isRequired = false;\r\n private _locale?: Locale;\r\n private _errorText?: string;\r\n\r\n constructor(\r\n private _renderer: Renderer2,\r\n private _destroyRef: DestroyRef,\r\n @Optional() private _form: NgForm,\r\n private _ls: LocalizationService,\r\n ) {\r\n this._locale = this._ls.get();\r\n this._ls.change.pipe(takeUntilDestroyed()).subscribe(e => this._locale = e.new);\r\n }\r\n\r\n ngOnInit(): void {\r\n }\r\n\r\n ngAfterContentInit(): void {\r\n this._isRequired = this._isRequiredField();\r\n\r\n if (this._ngControl) {\r\n this._ngControl?.statusChanges?.pipe(takeUntilDestroyed(this._destroyRef)).subscribe(change => {\r\n this._validate();\r\n });\r\n }\r\n }\r\n\r\n private _validate() {\r\n if (!this._ngControl || !this.dirty || !this.touched) {\r\n return;\r\n }\r\n\r\n const invalid = this._ngControl.status === 'INVALID';\r\n if (invalid) {\r\n this._errorText = this._locale?.translateFirstError(this._ngControl.errors, 'Invalid')?.text;\r\n } else {\r\n this._errorText = undefined;\r\n }\r\n this._renderer.addClass(this._ngControlElement!.nativeElement, invalid ? 'is-invalid' : 'is-valid');\r\n this._renderer.removeClass(this._ngControlElement!.nativeElement, invalid ? 'is-valid' : 'is-invalid');\r\n }\r\n\r\n private _isRequiredField(): boolean {\r\n const validator = this._ngControl?.validator;\r\n const errors = validator && validator(new FormControl(null));\r\n return errors != null && errors['required'] === true;\r\n }\r\n\r\n ngOnDestroy(): void {\r\n }\r\n}\r\n","@if(label()) {\r\n<label class=\"form-field-label\">\r\n {{label()}}\r\n <span *ngIf=\"isRequired && showRequiredIndicator()\" class=\"isc-form-field-required-marker\">*</span>\r\n</label>\r\n}\r\n\r\n@if(inputGroup()) {\r\n<div class=\"input-group\">\r\n <ng-container *ngTemplateOutlet=\"contentTemplate\"></ng-container>\r\n</div>\r\n}@else {\r\n<ng-container *ngTemplateOutlet=\"contentTemplate\"></ng-container>\r\n}\r\n\r\n<ng-template #contentTemplate>\r\n <ng-content></ng-content>\r\n</ng-template>\r\n\r\n@if(showSubscripts()) {\r\n<div class=\"form-field-subscript-wrapper\">\r\n @if(showErrors() && errorText && (touched || dirty)) {\r\n <span class=\"form-field-error text-danger\">\r\n {{errorText}}\r\n </span>\r\n }@if(hint()) {\r\n <span class=\"form-field-hint\">\r\n {{hint()}}\r\n </span>\r\n }\r\n</div>\r\n}","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { FormFieldComponent } from './form-field.component';\r\n\r\n@NgModule({\r\n imports: [\r\n CommonModule,\r\n FormFieldComponent,\r\n ],\r\n exports: [\r\n FormFieldComponent,\r\n ]\r\n})\r\nexport class FormFieldModule { }\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;MAiBa,kBAAkB,CAAA;AAiEnB,IAAA,SAAA;AACA,IAAA,WAAA;AACY,IAAA,KAAA;AACZ,IAAA,GAAA;AAlEV;;AAEG;IACI,KAAK,GAAG,KAAK,EAAU;AAE9B;;;AAGG;IACI,IAAI,GAAG,KAAK,EAAU;AAE7B;;;AAGG;AACI,IAAA,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC;AAE/B;;;AAGG;AACI,IAAA,qBAAqB,GAAG,KAAK,CAAC,IAAI,CAAC;AAE1C;;;AAGG;AACI,IAAA,cAAc,GAAG,KAAK,CAAC,IAAI,CAAC;AAEnC;;AAE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CAAA;sBADxB,YAAY;uBAAC,SAAS,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE;;;ME7DhD,eAAe,CAAA;uGAAf,eAAe,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA;AAAf,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,eAAe,YAPxB,YAAY;AACZ,YAAA,kBAAkB,aAGlB,kBAAkB,CAAA,EAAA,CAAA;AAGT,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,eAAe,YAPxB,YAAY;YACZ,kBAAkB,CAAA,EAAA,CAAA;;2FAMT,eAAe,EAAA,UAAA,EAAA,CAAA;kBAT3B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE;wBACP,YAAY;wBACZ,kBAAkB;AACnB,qBAAA;AACD,oBAAA,OAAO,EAAE;wBACP,kBAAkB;AACnB;AACF,iBAAA;;;ACZD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"bootkit-ng0-components-form-field.mjs","sources":["../../../projects/ng0/components/form-field/form-field.component.ts","../../../projects/ng0/components/form-field/form-field.component.html","../../../projects/ng0/components/form-field/form-field.module.ts","../../../projects/ng0/components/form-field/bootkit-ng0-components-form-field.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport { booleanAttribute, ChangeDetectionStrategy, DestroyRef, ElementRef, HostListener, inject, input, Renderer2, signal, ViewEncapsulation } from '@angular/core';\nimport { Component, ContentChild, AfterContentInit } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { FormControl, NgControl } from '@angular/forms';\nimport { LocalizationService } from '@bootkit/ng0/localization';\n\n@Component({\n selector: 'ng0-form-field, ng0-field',\n exportAs: 'ng0FormField',\n templateUrl: './form-field.component.html',\n styleUrls: ['./form-field.component.scss'],\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n imports: [CommonModule],\n host: {\n '[class.ng0-form-field-required]': '_hasRequiredControl()',\n }\n})\nexport class FormFieldComponent implements AfterContentInit {\n @ContentChild(NgControl, { static: true, read: ElementRef }) private _ngControlElement?: ElementRef;\n private _destroyRef = inject(DestroyRef);\n private _renderer = inject(Renderer2);\n private _localizationService = inject(LocalizationService);\n // private _form = inject(NgForm, { optional: true });\n @ContentChild(NgControl) protected _ngControl?: NgControl;\n protected _status = signal<string | null>('');\n protected _hasRequiredControl = signal(false);\n protected _errorText = signal<string | undefined>(undefined);\n\n /**\n * The label text for the form field.\n */\n public readonly label = input<string>();\n\n /**\n * The hint text to display below the form field.\n */\n public readonly hint = input<string>();\n\n /**\n * If true, the form-field will show validation errors.\n */\n public readonly showErrors = input(true, { transform: booleanAttribute });\n\n /**\n * If undefined, the indicator will be shown based on the control's required state.\n * If true, the form-field will show a required indicator (*) next to the label (regardless of the control's required state).\n * If false, the required indicator will not be shown (regardless of the control's required state).\n */\n public readonly showRequired = input<boolean | undefined>(undefined);\n\n /**\n * If true, the form-field will show subscripts (e.g. hints, errors) for the field label.\n */\n public readonly showSubscripts = input(true, { transform: booleanAttribute });\n\n /**\n * If true, the form-field will be rendered inside a \".input-group\" element.\n */\n public readonly inputGroup = input(true, { transform: booleanAttribute });\n\n ngAfterContentInit(): void {\n this._hasRequiredControl.set(this._isControlRequired());\n\n if (this._ngControl) {\n this._status.set(this._ngControl.status);\n\n this._ngControl.statusChanges?.pipe(takeUntilDestroyed(this._destroyRef)).subscribe(change => {\n this._status.set(change);\n this._checkValidation();\n });\n\n this._ngControl.valueChanges?.pipe(takeUntilDestroyed(this._destroyRef)).subscribe(value => {\n if (this._status() === 'INVALID' && this._ngControl!.errors) {\n this._checkValidation(); // Recheck validation errors\n }\n });\n }\n }\n\n private _checkValidation() {\n if (!this._ngControl || !this._ngControl.touched) {\n return;\n }\n\n let elm = this._ngControlElement!.nativeElement;\n let invalid = this._status() === 'INVALID';\n let errorText = invalid ?\n this._localizationService.get()?.translateFirstError(this._ngControl!.errors, 'Invalid')?.text :\n undefined;\n\n this._errorText.set(errorText);\n this._renderer.addClass(elm, invalid ? 'is-invalid' : 'is-valid');\n this._renderer.removeClass(elm, invalid ? 'is-valid' : 'is-invalid');\n }\n\n private _isControlRequired(): boolean {\n const validator = this._ngControl?.validator || this._ngControl?.control?.validator;\n const errors = validator && validator(new FormControl(null));\n return errors != null && errors['required'] === true;\n }\n\n @HostListener('focusout')\n private _onFocusOut() {\n this._checkValidation();\n }\n}\n","@let errorText = _errorText();\n@let showRequiredIndicator = showRequired();\n\n@if(label()) {\n<label class=\"ng0-form-field-label\">\n {{label()}}\n @if((showRequiredIndicator === true || (showRequiredIndicator == undefined && _hasRequiredControl()))) {\n <span class=\"ng0-form-field-required-indicator\">*</span>\n }\n</label>\n}\n\n@if(inputGroup()) {\n<div class=\"input-group\">\n <ng-container *ngTemplateOutlet=\"contentTemplate\"></ng-container>\n</div>\n}@else {\n<ng-container *ngTemplateOutlet=\"contentTemplate\"></ng-container>\n}\n\n<ng-template #contentTemplate>\n <ng-content></ng-content>\n</ng-template>\n\n@if(showSubscripts()) {\n<div class=\"ng0-form-field-subscript\">\n @if(showErrors() && errorText && _ngControl?.touched) {\n <small class=\"ng0-form-field-error text-danger\" animate.enter=\"ng0-form-field-fadein\">\n {{errorText}}\n </small>\n }@else if(hint()) {\n <small class=\"ng0-form-field-hint\">\n {{hint()}}\n </small>\n }\n</div>\n}","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { FormFieldComponent } from './form-field.component';\n\n@NgModule({\n imports: [\n CommonModule,\n FormFieldComponent,\n ],\n exports: [\n FormFieldComponent,\n ]\n})\nexport class FormFieldModule { }\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;MAoBa,kBAAkB,CAAA;AACwC,IAAA,iBAAiB;AAC9E,IAAA,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC;AAChC,IAAA,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;AAC7B,IAAA,oBAAoB,GAAG,MAAM,CAAC,mBAAmB,CAAC;;AAEvB,IAAA,UAAU;AACnC,IAAA,OAAO,GAAG,MAAM,CAAgB,EAAE,mDAAC;AACnC,IAAA,mBAAmB,GAAG,MAAM,CAAC,KAAK,+DAAC;AACnC,IAAA,UAAU,GAAG,MAAM,CAAqB,SAAS,sDAAC;AAE5D;;AAEG;IACa,KAAK,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,OAAA,EAAA,CAAA,GAAA,EAAA,CAAA,CAAU;AAEvC;;AAEG;IACa,IAAI,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,MAAA,EAAA,CAAA,GAAA,EAAA,CAAA,CAAU;AAEtC;;AAEG;AACa,IAAA,UAAU,GAAG,KAAK,CAAC,IAAI,8CAAI,SAAS,EAAE,gBAAgB,EAAA,CAAA,GAAA,CAA7B,EAAE,SAAS,EAAE,gBAAgB,EAAE,GAAC;AAEzE;;;;AAIG;AACa,IAAA,YAAY,GAAG,KAAK,CAAsB,SAAS,wDAAC;AAEpE;;AAEG;AACa,IAAA,cAAc,GAAG,KAAK,CAAC,IAAI,kDAAI,SAAS,EAAE,gBAAgB,EAAA,CAAA,GAAA,CAA7B,EAAE,SAAS,EAAE,gBAAgB,EAAE,GAAC;AAE7E;;AAEG;AACa,IAAA,UAAU,GAAG,KAAK,CAAC,IAAI,8CAAI,SAAS,EAAE,gBAAgB,EAAA,CAAA,GAA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A;AACR,oBAAA,OAAO,EAAE;wBACP,YAAY;wBACZ,kBAAkB;AACnB,qBAAA;AACD,oBAAA,OAAO,EAAE;wBACP,kBAAkB;AACnB;AACF,iBAAA;;;ACZD;;AAEG;;;;"}
|
|
@@ -0,0 +1,564 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, inject, ElementRef, Directive, ChangeDetectorRef, EnvironmentInjector, signal, Renderer2, booleanAttribute, EventEmitter, effect, untracked, computed, TemplateRef, forwardRef, HostListener, Output, ViewChildren, ContentChild, ViewEncapsulation, ChangeDetectionStrategy, Component, NgModule } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/common';
|
|
4
|
+
import { CommonModule } from '@angular/common';
|
|
5
|
+
import { dataSourceAttribute, DataRequest } from '@bootkit/ng0/data';
|
|
6
|
+
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
7
|
+
import { LocalizationService, defaultFormatter, objectFormatterAttribute } from '@bootkit/ng0/localization';
|
|
8
|
+
import { defaultEqualityComparer, equalityComparerAttribute, defaultValueWriter, valueWriterAttribute, noopFilter, filterPredicateAttribute, trackByIndex, TrackByAttribute, CssClassAttribute, IdGeneratorAttribute, IfDirective } from '@bootkit/ng0/common';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* ListItem represents an individual item within a ListComponent.
|
|
12
|
+
*/
|
|
13
|
+
class ListItem {
|
|
14
|
+
/**
|
|
15
|
+
* The value associated with the item. This can be of any type.
|
|
16
|
+
*/
|
|
17
|
+
value = input(...(ngDevMode ? [undefined, { debugName: "value" }] : []));
|
|
18
|
+
/**
|
|
19
|
+
* The id of the item.
|
|
20
|
+
*/
|
|
21
|
+
id = input(...(ngDevMode ? [undefined, { debugName: "id" }] : []));
|
|
22
|
+
/**
|
|
23
|
+
* Reference to the parent list component
|
|
24
|
+
*/
|
|
25
|
+
list = inject(ListComponent);
|
|
26
|
+
/**
|
|
27
|
+
* Reference to the host element
|
|
28
|
+
*/
|
|
29
|
+
elementRef = inject(ElementRef);
|
|
30
|
+
/**
|
|
31
|
+
* Indicates whether the item is active.
|
|
32
|
+
* @returns True if the item is active, false otherwise.
|
|
33
|
+
*/
|
|
34
|
+
isActive() {
|
|
35
|
+
return this.list.isActive(this);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Indicates whether the item is selected.
|
|
39
|
+
* @returns True if the item is selected, false otherwise.
|
|
40
|
+
*/
|
|
41
|
+
isSelected() {
|
|
42
|
+
return this.list.isSelected(this.value());
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Selects the item.
|
|
46
|
+
* @returns
|
|
47
|
+
*/
|
|
48
|
+
select() {
|
|
49
|
+
return this.list.select(this.value());
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Deselects the item.
|
|
53
|
+
* @returns
|
|
54
|
+
*/
|
|
55
|
+
deselect() {
|
|
56
|
+
this.list.deselect(this);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Toggles the selection state of the item.
|
|
60
|
+
* @returns void
|
|
61
|
+
*/
|
|
62
|
+
toggle() {
|
|
63
|
+
this.list.toggle(this.value());
|
|
64
|
+
}
|
|
65
|
+
// /**
|
|
66
|
+
// * Indicates whether the item is disabled. Default is false.
|
|
67
|
+
// */
|
|
68
|
+
// public readonly disabled = input(false, { transform: booleanAttribute });
|
|
69
|
+
/**
|
|
70
|
+
* Scrolls the item into view within its parent container.
|
|
71
|
+
* @param position The vertical alignment of the item after scrolling.
|
|
72
|
+
* Can be 'start', 'center', 'end', or 'nearest'.
|
|
73
|
+
* Default is 'nearest'.
|
|
74
|
+
* @param behavior The scrolling behavior.
|
|
75
|
+
*/
|
|
76
|
+
scrollIntoView(position, behavior) {
|
|
77
|
+
this.elementRef.nativeElement.scrollIntoView({ block: position, behavior: behavior });
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Sets focus on the item.
|
|
81
|
+
*/
|
|
82
|
+
focus() {
|
|
83
|
+
this.elementRef.nativeElement.focus();
|
|
84
|
+
}
|
|
85
|
+
_getTabIndex() {
|
|
86
|
+
let focus = this.list.focusMode();
|
|
87
|
+
// if (this.list.isDisabled()) {
|
|
88
|
+
// return undefined;
|
|
89
|
+
// }
|
|
90
|
+
if (focus == 'none' || focus == 'activeDescendant') {
|
|
91
|
+
return undefined;
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
// focus: roving
|
|
95
|
+
return this.isActive() ? 0 : -1;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: ListItem, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
99
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.11", type: ListItem, isStandalone: true, selector: "ng0-list-item", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.id": "id()", "attr.tabIndex": "_getTabIndex()" } }, exportAs: ["ng0ListItem"], ngImport: i0 });
|
|
100
|
+
}
|
|
101
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: ListItem, decorators: [{
|
|
102
|
+
type: Directive,
|
|
103
|
+
args: [{
|
|
104
|
+
selector: 'ng0-list-item',
|
|
105
|
+
exportAs: 'ng0ListItem',
|
|
106
|
+
standalone: true,
|
|
107
|
+
host: {
|
|
108
|
+
'[attr.id]': 'id()',
|
|
109
|
+
'[attr.tabIndex]': '_getTabIndex()'
|
|
110
|
+
}
|
|
111
|
+
}]
|
|
112
|
+
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }] } });
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* ListComponent is a versatile component that displays a list of items with support for single or multiple selection,
|
|
116
|
+
* custom item templates, filtering, and keyboard navigation.
|
|
117
|
+
*/
|
|
118
|
+
class ListComponent {
|
|
119
|
+
_localizationService = inject(LocalizationService);
|
|
120
|
+
_changeDetector = inject(ChangeDetectorRef);
|
|
121
|
+
_injector = inject(EnvironmentInjector);
|
|
122
|
+
_changeCallback;
|
|
123
|
+
_touchCallback;
|
|
124
|
+
_selectedItems = new Set();
|
|
125
|
+
_sourceItems = signal([], ...(ngDevMode ? [{ debugName: "_sourceItems" }] : []));
|
|
126
|
+
_itemTemplate;
|
|
127
|
+
_activeItem = signal(undefined, ...(ngDevMode ? [{ debugName: "_activeItem" }] : []));
|
|
128
|
+
_isDisabled = signal(false, ...(ngDevMode ? [{ debugName: "_isDisabled" }] : []));
|
|
129
|
+
_value = signal(undefined, ...(ngDevMode ? [{ debugName: "_value" }] : []));
|
|
130
|
+
_renderer = inject(Renderer2);
|
|
131
|
+
/**
|
|
132
|
+
* A list of all visible list items.
|
|
133
|
+
*/
|
|
134
|
+
listItems;
|
|
135
|
+
/**
|
|
136
|
+
* Reference to the host element
|
|
137
|
+
*/
|
|
138
|
+
elementRef = inject((ElementRef));
|
|
139
|
+
/**
|
|
140
|
+
* The data source for the select component.
|
|
141
|
+
* This can be an array of data, a function that returns an observable of data,
|
|
142
|
+
* or an instance of DataSource.
|
|
143
|
+
*/
|
|
144
|
+
source = input.required(...(ngDevMode ? [{ debugName: "source", transform: v => dataSourceAttribute(v) }] : [{
|
|
145
|
+
transform: v => dataSourceAttribute(v)
|
|
146
|
+
}]));
|
|
147
|
+
/**
|
|
148
|
+
* Indicates whether multi selection is enabled or not.
|
|
149
|
+
*/
|
|
150
|
+
multiple = input(false, ...(ngDevMode ? [{ debugName: "multiple", transform: booleanAttribute }] : [{
|
|
151
|
+
transform: booleanAttribute
|
|
152
|
+
}]));
|
|
153
|
+
/**
|
|
154
|
+
* Indicates whether to show selection indicator (checkbox/radio) next to each item.
|
|
155
|
+
* Default is false.
|
|
156
|
+
*/
|
|
157
|
+
showSelectionIndicator = input(false, ...(ngDevMode ? [{ debugName: "showSelectionIndicator", transform: booleanAttribute }] : [{
|
|
158
|
+
transform: booleanAttribute
|
|
159
|
+
}]));
|
|
160
|
+
/**
|
|
161
|
+
* A comparer to compare items for selection.
|
|
162
|
+
* Default uses strict equality (===).
|
|
163
|
+
*/
|
|
164
|
+
compareBy = input(defaultEqualityComparer, ...(ngDevMode ? [{ debugName: "compareBy", transform: equalityComparerAttribute }] : [{
|
|
165
|
+
transform: equalityComparerAttribute
|
|
166
|
+
}]));
|
|
167
|
+
/**
|
|
168
|
+
* A fromatter to convert each item to a string for display.
|
|
169
|
+
* Default converts the item to a string using its toString method.
|
|
170
|
+
*/
|
|
171
|
+
formatBy = input(defaultFormatter, ...(ngDevMode ? [{ debugName: "formatBy", transform: objectFormatterAttribute(this._injector) }] : [{
|
|
172
|
+
transform: objectFormatterAttribute(this._injector)
|
|
173
|
+
}]));
|
|
174
|
+
/**
|
|
175
|
+
* Custom value writer to extract the value of any object while writing values.
|
|
176
|
+
*/
|
|
177
|
+
writeBy = input(defaultValueWriter, ...(ngDevMode ? [{ debugName: "writeBy", transform: valueWriterAttribute }] : [{
|
|
178
|
+
transform: valueWriterAttribute
|
|
179
|
+
}]));
|
|
180
|
+
/**
|
|
181
|
+
* Custom filter function to filter items.
|
|
182
|
+
* Default is a noop filter that does not filter any items.
|
|
183
|
+
*/
|
|
184
|
+
filterBy = input(noopFilter, ...(ngDevMode ? [{ debugName: "filterBy", transform: filterPredicateAttribute }] : [{
|
|
185
|
+
transform: filterPredicateAttribute
|
|
186
|
+
}]));
|
|
187
|
+
/**
|
|
188
|
+
* A function that uniquely identifies each item in the list.
|
|
189
|
+
* If set to a function, it will be called with the index and item as arguments to generate the unique id.
|
|
190
|
+
* If set to a string, it will be used as the property name to extract the unique id from each item.
|
|
191
|
+
* Two predifined trackBy options are available:
|
|
192
|
+
* - '@index': uses the index of the item as its unique id.
|
|
193
|
+
* - '@item': uses the item itself as its unique id.
|
|
194
|
+
* @example
|
|
195
|
+
* trackBy="@index"
|
|
196
|
+
* trackBy="@item"
|
|
197
|
+
* trackBy="objectFieldName"
|
|
198
|
+
* [trackBy]="customTrackByFunction"
|
|
199
|
+
* @default trackByIndex
|
|
200
|
+
*/
|
|
201
|
+
trackBy = input(trackByIndex, ...(ngDevMode ? [{ debugName: "trackBy", transform: TrackByAttribute }] : [{
|
|
202
|
+
transform: TrackByAttribute
|
|
203
|
+
}]));
|
|
204
|
+
/**
|
|
205
|
+
* CSS class or classes to apply to the list container.
|
|
206
|
+
* Default is undefined.
|
|
207
|
+
*/
|
|
208
|
+
itemClass = input(undefined, ...(ngDevMode ? [{ debugName: "itemClass", transform: CssClassAttribute }] : [{
|
|
209
|
+
transform: CssClassAttribute
|
|
210
|
+
}]));
|
|
211
|
+
/**
|
|
212
|
+
* Defines the focus behavior of the list component.
|
|
213
|
+
* - 'none': No keyboard interaction is possible. The list cannot be focused.
|
|
214
|
+
* - 'roving': Roving tabindex is enabled. The list can be focused and the active item is tabbable.
|
|
215
|
+
* - 'activeDescendant': The list can be focused, but no item is tabbable. The active item is indicated using aria-activedescendant.
|
|
216
|
+
* @default 'activeDescendant'.
|
|
217
|
+
*/
|
|
218
|
+
focusMode = input('activeDescendant', ...(ngDevMode ? [{ debugName: "focusMode" }] : []));
|
|
219
|
+
/**
|
|
220
|
+
* A function that generates unique ids for each item in the list.
|
|
221
|
+
* If set to a function, it will be called with the item as an argument to generate the id.
|
|
222
|
+
* If set to undefined, no ids will be generated for the items.
|
|
223
|
+
* @default undefined
|
|
224
|
+
*/
|
|
225
|
+
idGenerator = input(undefined, ...(ngDevMode ? [{ debugName: "idGenerator", transform: IdGeneratorAttribute }] : [{
|
|
226
|
+
transform: IdGeneratorAttribute
|
|
227
|
+
}]));
|
|
228
|
+
/**
|
|
229
|
+
* Event emitted when the selection state of an item changes by user interaction.
|
|
230
|
+
*/
|
|
231
|
+
itemSelect = new EventEmitter();
|
|
232
|
+
/**
|
|
233
|
+
* The template to use for each item in the list.
|
|
234
|
+
*/
|
|
235
|
+
itemTemplate = input(undefined, ...(ngDevMode ? [{ debugName: "itemTemplate" }] : []));
|
|
236
|
+
constructor() {
|
|
237
|
+
effect(() => {
|
|
238
|
+
this.source().load(new DataRequest()).subscribe(res => {
|
|
239
|
+
untracked(() => {
|
|
240
|
+
this._activeItem.set(undefined);
|
|
241
|
+
this._sourceItems.set(res.data);
|
|
242
|
+
this._updateSelectedItems();
|
|
243
|
+
this._activateFirstSelectedItem();
|
|
244
|
+
});
|
|
245
|
+
});
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Indicates whether an item is active.
|
|
250
|
+
* @param item
|
|
251
|
+
* @returns
|
|
252
|
+
*/
|
|
253
|
+
isActive(item) {
|
|
254
|
+
return item === this._activeItem();
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Indicates whether the given value is selected.
|
|
258
|
+
* @param item
|
|
259
|
+
* @returns
|
|
260
|
+
*/
|
|
261
|
+
isSelected(value) {
|
|
262
|
+
return this._selectedItems.has(value);
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Selects the given value.
|
|
266
|
+
* @param item
|
|
267
|
+
*/
|
|
268
|
+
select(value) {
|
|
269
|
+
if (this.multiple()) {
|
|
270
|
+
if (!this._selectedItems.has(value)) {
|
|
271
|
+
this._selectedItems.add(value);
|
|
272
|
+
this._updateValue();
|
|
273
|
+
this._changeCallback?.(this._value());
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
else {
|
|
277
|
+
this._selectedItems.clear();
|
|
278
|
+
this._selectedItems.add(value);
|
|
279
|
+
this._updateValue();
|
|
280
|
+
this._changeCallback?.(this._value());
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Deselects the given value.
|
|
285
|
+
* @param item
|
|
286
|
+
*/
|
|
287
|
+
deselect(value) {
|
|
288
|
+
this._selectedItems.delete(value);
|
|
289
|
+
this._updateValue();
|
|
290
|
+
this._changeCallback?.(this._value());
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Toggles the selection state of the given value.
|
|
294
|
+
* @param item
|
|
295
|
+
*/
|
|
296
|
+
toggle(value) {
|
|
297
|
+
if (this.isSelected(value)) {
|
|
298
|
+
this.deselect(value);
|
|
299
|
+
}
|
|
300
|
+
else {
|
|
301
|
+
this.select(value);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Deselects all items in the list.
|
|
306
|
+
*/
|
|
307
|
+
deselectAll() {
|
|
308
|
+
this._selectedItems.clear();
|
|
309
|
+
this._updateValue();
|
|
310
|
+
this._changeCallback?.(this._value());
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Selects all items in the list. Only applicable in multiple selection mode.
|
|
314
|
+
*/
|
|
315
|
+
selectAll() {
|
|
316
|
+
if (this.multiple()) {
|
|
317
|
+
this._selectedItems.clear();
|
|
318
|
+
this._sourceItems().forEach(i => this._selectedItems.add(i));
|
|
319
|
+
this._updateValue();
|
|
320
|
+
this._changeCallback?.(this._value());
|
|
321
|
+
}
|
|
322
|
+
else {
|
|
323
|
+
throw new Error('selectAll is only available in multiple selection mode.');
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Gets the current value(s) of the list.
|
|
328
|
+
*/
|
|
329
|
+
get value() {
|
|
330
|
+
return this._value();
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Gets the current items in the list.
|
|
334
|
+
*/
|
|
335
|
+
get items() {
|
|
336
|
+
return this._sourceItems();
|
|
337
|
+
}
|
|
338
|
+
writeValue(value) {
|
|
339
|
+
if (this.multiple()) {
|
|
340
|
+
if (value === null || value === undefined) {
|
|
341
|
+
value = [];
|
|
342
|
+
}
|
|
343
|
+
else if (!Array.isArray(value)) {
|
|
344
|
+
throw Error('invalid value. Expected an array in multiple selection mode.');
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
this._value.set(value);
|
|
348
|
+
this._updateSelectedItems();
|
|
349
|
+
this._activateFirstSelectedItem();
|
|
350
|
+
this._changeDetector.markForCheck();
|
|
351
|
+
}
|
|
352
|
+
registerOnChange(fn) {
|
|
353
|
+
this._changeCallback = fn;
|
|
354
|
+
}
|
|
355
|
+
registerOnTouched(fn) {
|
|
356
|
+
this._touchCallback = fn;
|
|
357
|
+
}
|
|
358
|
+
setDisabledState(isDisabled) {
|
|
359
|
+
this._isDisabled.set(isDisabled);
|
|
360
|
+
}
|
|
361
|
+
_handleUserSelection(item, index) {
|
|
362
|
+
let value = item.value();
|
|
363
|
+
if (this.multiple()) {
|
|
364
|
+
this.toggle(value);
|
|
365
|
+
}
|
|
366
|
+
else {
|
|
367
|
+
this.select(value);
|
|
368
|
+
}
|
|
369
|
+
this._activeItem.set(item);
|
|
370
|
+
this.itemSelect.emit({ value: item.value(), item: item, list: this });
|
|
371
|
+
this._changeDetector.detectChanges();
|
|
372
|
+
}
|
|
373
|
+
_showLoadingSppiner = computed(() => {
|
|
374
|
+
let source = this.source();
|
|
375
|
+
return source.isLoading() && source.type == 'remote';
|
|
376
|
+
}, ...(ngDevMode ? [{ debugName: "_showLoadingSppiner" }] : []));
|
|
377
|
+
_updateSelectedItems() {
|
|
378
|
+
let value = this._value();
|
|
379
|
+
let compareBy = this.compareBy();
|
|
380
|
+
let findAndSelect = (v) => {
|
|
381
|
+
let index = this._sourceItems().findIndex(i => compareBy(i, v));
|
|
382
|
+
if (index > -1) {
|
|
383
|
+
let item = this._sourceItems().at(index);
|
|
384
|
+
this._selectedItems.add(item);
|
|
385
|
+
}
|
|
386
|
+
return index;
|
|
387
|
+
};
|
|
388
|
+
this._selectedItems.clear();
|
|
389
|
+
if (this.multiple()) {
|
|
390
|
+
if (Array.isArray(value)) {
|
|
391
|
+
value.forEach(v => findAndSelect(v));
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
else {
|
|
395
|
+
findAndSelect(value);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
_activateFirstSelectedItem() {
|
|
399
|
+
if (this._selectedItems.size > 0) {
|
|
400
|
+
let value = this._selectedItems.values().next().value;
|
|
401
|
+
let item = this.listItems?.find(i => i.value() === value);
|
|
402
|
+
if (item) {
|
|
403
|
+
this._activeItem.set(item);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
_updateValue() {
|
|
408
|
+
let value;
|
|
409
|
+
if (this.multiple()) {
|
|
410
|
+
let values = [];
|
|
411
|
+
this._selectedItems.forEach(v => {
|
|
412
|
+
values.push(this.writeBy()(v));
|
|
413
|
+
});
|
|
414
|
+
value = values;
|
|
415
|
+
}
|
|
416
|
+
else {
|
|
417
|
+
if (this._selectedItems.size > 0) {
|
|
418
|
+
let first = this._selectedItems.values().next().value;
|
|
419
|
+
value = this.writeBy()(first);
|
|
420
|
+
}
|
|
421
|
+
else {
|
|
422
|
+
value = undefined;
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
this._value.set(value);
|
|
426
|
+
}
|
|
427
|
+
_hostAriaActiveDescendant = computed(() => {
|
|
428
|
+
if (this._activeItem() && !this._isDisabled() && this.focusMode() == 'activeDescendant') {
|
|
429
|
+
return this._activeItem().id();
|
|
430
|
+
}
|
|
431
|
+
return undefined;
|
|
432
|
+
}, ...(ngDevMode ? [{ debugName: "_hostAriaActiveDescendant" }] : []));
|
|
433
|
+
_hostTabIndex = computed(() => {
|
|
434
|
+
let isDisabled = this._isDisabled(); // track the value
|
|
435
|
+
let activeItem = this._activeItem(); // track the value
|
|
436
|
+
if (isDisabled) {
|
|
437
|
+
return undefined;
|
|
438
|
+
}
|
|
439
|
+
switch (this.focusMode()) {
|
|
440
|
+
case 'none':
|
|
441
|
+
return undefined;
|
|
442
|
+
case 'activeDescendant':
|
|
443
|
+
return 0;
|
|
444
|
+
case 'roving':
|
|
445
|
+
return activeItem ? undefined : 0;
|
|
446
|
+
}
|
|
447
|
+
}, ...(ngDevMode ? [{ debugName: "_hostTabIndex" }] : []));
|
|
448
|
+
_onHostBlur() {
|
|
449
|
+
this._touchCallback?.();
|
|
450
|
+
}
|
|
451
|
+
_onKeydown(e) {
|
|
452
|
+
if (this._isDisabled())
|
|
453
|
+
return;
|
|
454
|
+
let listLength = this.listItems.length;
|
|
455
|
+
if (listLength == 0) {
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
let activeItem = this._activeItem();
|
|
459
|
+
let activeItemindex = activeItem ? this.listItems.toArray().findIndex(i => i === activeItem) : -1;
|
|
460
|
+
switch (e.key) {
|
|
461
|
+
case 'ArrowDown':
|
|
462
|
+
if (activeItemindex < listLength - 1) {
|
|
463
|
+
const next = this.listItems.get(activeItemindex + 1);
|
|
464
|
+
this._activeItem.set(next);
|
|
465
|
+
}
|
|
466
|
+
e.preventDefault();
|
|
467
|
+
break;
|
|
468
|
+
case 'ArrowUp':
|
|
469
|
+
if (activeItemindex == -1) {
|
|
470
|
+
const last = this.listItems.get(listLength - 1);
|
|
471
|
+
this._activeItem.set(last);
|
|
472
|
+
}
|
|
473
|
+
else if (activeItemindex > 0) {
|
|
474
|
+
const previous = this.listItems.get(activeItemindex - 1);
|
|
475
|
+
this._activeItem.set(previous);
|
|
476
|
+
}
|
|
477
|
+
e.preventDefault();
|
|
478
|
+
break;
|
|
479
|
+
case 'Enter':
|
|
480
|
+
if (activeItem) {
|
|
481
|
+
this._handleUserSelection(activeItem, activeItemindex);
|
|
482
|
+
}
|
|
483
|
+
break;
|
|
484
|
+
case 'Home':
|
|
485
|
+
const first = this.listItems.get(0);
|
|
486
|
+
this._activeItem.set(first);
|
|
487
|
+
e.preventDefault();
|
|
488
|
+
break;
|
|
489
|
+
case 'End':
|
|
490
|
+
const last = this.listItems.get(listLength - 1);
|
|
491
|
+
this._activeItem.set(last);
|
|
492
|
+
e.preventDefault();
|
|
493
|
+
break;
|
|
494
|
+
}
|
|
495
|
+
this._activeItem()?.scrollIntoView('nearest', listLength > 100 ? 'instant' : 'smooth');
|
|
496
|
+
if (this.focusMode() === 'roving') {
|
|
497
|
+
this._activeItem()?.focus();
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: ListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
501
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.11", type: ListComponent, isStandalone: true, selector: "ng0-list, ng0-select-list", inputs: { source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: true, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, showSelectionIndicator: { classPropertyName: "showSelectionIndicator", publicName: "showSelectionIndicator", isSignal: true, isRequired: false, transformFunction: null }, compareBy: { classPropertyName: "compareBy", publicName: "compareBy", isSignal: true, isRequired: false, transformFunction: null }, formatBy: { classPropertyName: "formatBy", publicName: "formatBy", isSignal: true, isRequired: false, transformFunction: null }, writeBy: { classPropertyName: "writeBy", publicName: "writeBy", isSignal: true, isRequired: false, transformFunction: null }, filterBy: { classPropertyName: "filterBy", publicName: "filterBy", isSignal: true, isRequired: false, transformFunction: null }, trackBy: { classPropertyName: "trackBy", publicName: "trackBy", isSignal: true, isRequired: false, transformFunction: null }, itemClass: { classPropertyName: "itemClass", publicName: "itemClass", isSignal: true, isRequired: false, transformFunction: null }, focusMode: { classPropertyName: "focusMode", publicName: "focusMode", isSignal: true, isRequired: false, transformFunction: null }, idGenerator: { classPropertyName: "idGenerator", publicName: "idGenerator", isSignal: true, isRequired: false, transformFunction: null }, itemTemplate: { classPropertyName: "itemTemplate", publicName: "itemTemplate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { itemSelect: "itemSelect" }, host: { listeners: { "blur": "_onHostBlur()", "keydown": "_onKeydown($event)" }, properties: { "class.ng0-list-loading": "source().isLoading()", "attr.aria-activedescendant": "_hostAriaActiveDescendant()", "attr.disabled": "_isDisabled() ? \"\" : undefined", "attr.aria-disabled": "_isDisabled() ? \"\" : undefined", "attr.tabindex": "_hostTabIndex()" } }, providers: [{
|
|
502
|
+
provide: NG_VALUE_ACCESSOR,
|
|
503
|
+
useExisting: forwardRef(() => ListComponent),
|
|
504
|
+
multi: true
|
|
505
|
+
}], queries: [{ propertyName: "_itemTemplate", first: true, predicate: TemplateRef, descendants: true }], viewQueries: [{ propertyName: "listItems", predicate: ListItem, descendants: true }], exportAs: ["ng0List"], ngImport: i0, template: "@let filter = filterBy();\n@let formatter = formatBy();\n\n@for (item of _sourceItems(); track trackBy()($index, item)) {\n\n<ng0-list-item #listItem=\"ng0ListItem\"\n *ng0If=\"!filter || filter(item)\"\n [value]=\"item\"\n [id]=\"idGenerator()?.(item)\"\n [class.active]=\"isActive(listItem)\"\n [class.selected]=\"isSelected(item)\"\n [ngClass]=\"itemClass()?.(item)\"\n (click)=\"_handleUserSelection(listItem, $index);\">\n\n @if(itemTemplate() || _itemTemplate) {\n @let template = itemTemplate() || _itemTemplate;\n <ng-container *ngTemplateOutlet=\"template; context: { $implicit: {item: listItem, value: item}}\" />\n } @else {\n @if(showSelectionIndicator()) {\n <input class=\"form-check-input ng0-selection-indicator\"\n tabindex=\"-1\"\n [checked]=\"isSelected(item)\"\n [attr.type]=\"multiple() ? 'checkbox' : 'radio'\">\n }\n\n {{formatter(item)}}\n }\n</ng0-list-item>\n}\n\n@if(_showLoadingSppiner()) {\n@if(_sourceItems().length == 0) {\n<div style=\"text-align: center; padding: 0.5rem 0;\">\n <ng-container *ngTemplateOutlet=\"spinner\"></ng-container>\n</div>\n}@else {\n<div class=\"ng0-list-loading-cover\">\n <ng-container *ngTemplateOutlet=\"spinner\"></ng-container>\n</div>\n}\n}\n\n<ng-template #spinner>\n <div class=\"spinner-border spinner-sm text-primary ng0-list-loading-indicator\" role=\"status\">\n <span class=\"visually-hidden\">Loading...</span>\n </div>\n</ng-template>", styles: ["ng0-list:not(.ng0-list-unstyled){display:block;position:relative;-webkit-user-select:none;user-select:none;border:1px solid var(--bs-border-color);border-radius:var(--bs-border-radius)}ng0-list:not(.ng0-list-unstyled):focus,ng0-list:not(.ng0-list-unstyled):focus-visible{outline:0;box-shadow:var(--bs-focus-ring-x, 0) var(--bs-focus-ring-y, 0) var(--bs-focus-ring-blur, 0) var(--bs-focus-ring-width) var(--bs-focus-ring-color)}ng0-list:not(.ng0-list-unstyled)[disabled],ng0-list:not(.ng0-list-unstyled).disabled{opacity:.5;pointer-events:none}ng0-list:not(.ng0-list-unstyled) .ng0-list-loading-cover{position:absolute;top:0;left:0;width:100%;height:100%;background-color:#ffffffb3;display:flex;align-items:center;justify-content:center}ng0-list:not(.ng0-list-unstyled) ng0-list-item{display:flex}ng0-list:not(.ng0-list-unstyled) ng0-list-item .ng0-selection-indicator{margin-inline-end:.5rem}ng0-list:not(.ng0-list-unstyled) ng0-list-item:focus,ng0-list:not(.ng0-list-unstyled) ng0-list-item:focus-visible{outline:0;box-shadow:var(--bs-focus-ring-x, 0) var(--bs-focus-ring-y, 0) var(--bs-focus-ring-blur, 0) var(--bs-focus-ring-width) var(--bs-focus-ring-color)}ng0-list:not(.ng0-list-unstyled) ng0-list-item{padding:.5rem}ng0-list:not(.ng0-list-unstyled) ng0-list-item.selected{background-color:var(--bs-primary);color:var(--bs-light)}ng0-list:not(.ng0-list-unstyled) ng0-list-item.active:not(.selected){background-color:color-mix(in srgb,var(--bs-primary),white 85%)}ng0-list:not(.ng0-list-unstyled) ng0-list-item:hover:not(.selected):not(.disabled):not(.active){background-color:color-mix(in srgb,var(--bs-primary),white 95%)}ng0-list:not(.ng0-list-unstyled) ng0-list-item:first-child{border-top-left-radius:inherit;border-top-right-radius:inherit}ng0-list:not(.ng0-list-unstyled) ng0-list-item:last-child{border-bottom-left-radius:inherit;border-bottom-right-radius:inherit}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: IfDirective, selector: "[ng0If]", inputs: ["ng0If"], exportAs: ["ng0If"] }, { kind: "directive", type: ListItem, selector: "ng0-list-item", inputs: ["value", "id"], exportAs: ["ng0ListItem"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
506
|
+
}
|
|
507
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: ListComponent, decorators: [{
|
|
508
|
+
type: Component,
|
|
509
|
+
args: [{ selector: 'ng0-list, ng0-select-list', exportAs: 'ng0List', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [
|
|
510
|
+
CommonModule,
|
|
511
|
+
IfDirective,
|
|
512
|
+
ListItem
|
|
513
|
+
], providers: [{
|
|
514
|
+
provide: NG_VALUE_ACCESSOR,
|
|
515
|
+
useExisting: forwardRef(() => ListComponent),
|
|
516
|
+
multi: true
|
|
517
|
+
}], host: {
|
|
518
|
+
'[class.ng0-list-loading]': 'source().isLoading()',
|
|
519
|
+
'[attr.aria-activedescendant]': '_hostAriaActiveDescendant()',
|
|
520
|
+
'[attr.disabled]': '_isDisabled() ? "" : undefined',
|
|
521
|
+
'[attr.aria-disabled]': '_isDisabled() ? "" : undefined',
|
|
522
|
+
'[attr.tabindex]': '_hostTabIndex()',
|
|
523
|
+
}, template: "@let filter = filterBy();\n@let formatter = formatBy();\n\n@for (item of _sourceItems(); track trackBy()($index, item)) {\n\n<ng0-list-item #listItem=\"ng0ListItem\"\n *ng0If=\"!filter || filter(item)\"\n [value]=\"item\"\n [id]=\"idGenerator()?.(item)\"\n [class.active]=\"isActive(listItem)\"\n [class.selected]=\"isSelected(item)\"\n [ngClass]=\"itemClass()?.(item)\"\n (click)=\"_handleUserSelection(listItem, $index);\">\n\n @if(itemTemplate() || _itemTemplate) {\n @let template = itemTemplate() || _itemTemplate;\n <ng-container *ngTemplateOutlet=\"template; context: { $implicit: {item: listItem, value: item}}\" />\n } @else {\n @if(showSelectionIndicator()) {\n <input class=\"form-check-input ng0-selection-indicator\"\n tabindex=\"-1\"\n [checked]=\"isSelected(item)\"\n [attr.type]=\"multiple() ? 'checkbox' : 'radio'\">\n }\n\n {{formatter(item)}}\n }\n</ng0-list-item>\n}\n\n@if(_showLoadingSppiner()) {\n@if(_sourceItems().length == 0) {\n<div style=\"text-align: center; padding: 0.5rem 0;\">\n <ng-container *ngTemplateOutlet=\"spinner\"></ng-container>\n</div>\n}@else {\n<div class=\"ng0-list-loading-cover\">\n <ng-container *ngTemplateOutlet=\"spinner\"></ng-container>\n</div>\n}\n}\n\n<ng-template #spinner>\n <div class=\"spinner-border spinner-sm text-primary ng0-list-loading-indicator\" role=\"status\">\n <span class=\"visually-hidden\">Loading...</span>\n </div>\n</ng-template>", styles: ["ng0-list:not(.ng0-list-unstyled){display:block;position:relative;-webkit-user-select:none;user-select:none;border:1px solid var(--bs-border-color);border-radius:var(--bs-border-radius)}ng0-list:not(.ng0-list-unstyled):focus,ng0-list:not(.ng0-list-unstyled):focus-visible{outline:0;box-shadow:var(--bs-focus-ring-x, 0) var(--bs-focus-ring-y, 0) var(--bs-focus-ring-blur, 0) var(--bs-focus-ring-width) var(--bs-focus-ring-color)}ng0-list:not(.ng0-list-unstyled)[disabled],ng0-list:not(.ng0-list-unstyled).disabled{opacity:.5;pointer-events:none}ng0-list:not(.ng0-list-unstyled) .ng0-list-loading-cover{position:absolute;top:0;left:0;width:100%;height:100%;background-color:#ffffffb3;display:flex;align-items:center;justify-content:center}ng0-list:not(.ng0-list-unstyled) ng0-list-item{display:flex}ng0-list:not(.ng0-list-unstyled) ng0-list-item .ng0-selection-indicator{margin-inline-end:.5rem}ng0-list:not(.ng0-list-unstyled) ng0-list-item:focus,ng0-list:not(.ng0-list-unstyled) ng0-list-item:focus-visible{outline:0;box-shadow:var(--bs-focus-ring-x, 0) var(--bs-focus-ring-y, 0) var(--bs-focus-ring-blur, 0) var(--bs-focus-ring-width) var(--bs-focus-ring-color)}ng0-list:not(.ng0-list-unstyled) ng0-list-item{padding:.5rem}ng0-list:not(.ng0-list-unstyled) ng0-list-item.selected{background-color:var(--bs-primary);color:var(--bs-light)}ng0-list:not(.ng0-list-unstyled) ng0-list-item.active:not(.selected){background-color:color-mix(in srgb,var(--bs-primary),white 85%)}ng0-list:not(.ng0-list-unstyled) ng0-list-item:hover:not(.selected):not(.disabled):not(.active){background-color:color-mix(in srgb,var(--bs-primary),white 95%)}ng0-list:not(.ng0-list-unstyled) ng0-list-item:first-child{border-top-left-radius:inherit;border-top-right-radius:inherit}ng0-list:not(.ng0-list-unstyled) ng0-list-item:last-child{border-bottom-left-radius:inherit;border-bottom-right-radius:inherit}\n"] }]
|
|
524
|
+
}], ctorParameters: () => [], propDecorators: { _itemTemplate: [{
|
|
525
|
+
type: ContentChild,
|
|
526
|
+
args: [TemplateRef]
|
|
527
|
+
}], listItems: [{
|
|
528
|
+
type: ViewChildren,
|
|
529
|
+
args: [ListItem]
|
|
530
|
+
}], source: [{ type: i0.Input, args: [{ isSignal: true, alias: "source", required: true }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], showSelectionIndicator: [{ type: i0.Input, args: [{ isSignal: true, alias: "showSelectionIndicator", required: false }] }], compareBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "compareBy", required: false }] }], formatBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "formatBy", required: false }] }], writeBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "writeBy", required: false }] }], filterBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterBy", required: false }] }], trackBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "trackBy", required: false }] }], itemClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemClass", required: false }] }], focusMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "focusMode", required: false }] }], idGenerator: [{ type: i0.Input, args: [{ isSignal: true, alias: "idGenerator", required: false }] }], itemSelect: [{
|
|
531
|
+
type: Output
|
|
532
|
+
}], itemTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemTemplate", required: false }] }], _onHostBlur: [{
|
|
533
|
+
type: HostListener,
|
|
534
|
+
args: ['blur']
|
|
535
|
+
}], _onKeydown: [{
|
|
536
|
+
type: HostListener,
|
|
537
|
+
args: ['keydown', ['$event']]
|
|
538
|
+
}] } });
|
|
539
|
+
|
|
540
|
+
const Items = [ListComponent];
|
|
541
|
+
/**
|
|
542
|
+
* List module.
|
|
543
|
+
*/
|
|
544
|
+
class ListModule {
|
|
545
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: ListModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
546
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.11", ngImport: i0, type: ListModule, imports: [ListComponent], exports: [ListComponent] });
|
|
547
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: ListModule, imports: [Items] });
|
|
548
|
+
}
|
|
549
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.11", ngImport: i0, type: ListModule, decorators: [{
|
|
550
|
+
type: NgModule,
|
|
551
|
+
args: [{
|
|
552
|
+
imports: Items,
|
|
553
|
+
exports: Items
|
|
554
|
+
}]
|
|
555
|
+
}] });
|
|
556
|
+
|
|
557
|
+
// export * from './types';
|
|
558
|
+
|
|
559
|
+
/**
|
|
560
|
+
* Generated bundle index. Do not edit.
|
|
561
|
+
*/
|
|
562
|
+
|
|
563
|
+
export { ListComponent, ListModule };
|
|
564
|
+
//# sourceMappingURL=bootkit-ng0-components-list.mjs.map
|