@progress/kendo-angular-dropdowns
Version:
A wide variety of native Angular dropdown components including AutoComplete, ComboBox, DropDownList, DropDownTree, MultiColumnComboBox, MultiSelect, and MultiSelectTree
240 lines (239 loc) • 13.3 kB
JavaScript
/**-----------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the project root for more information
*-------------------------------------------------------------------------------------------*/
import { Component, Input, Output, EventEmitter, TemplateRef, ViewChild } from '@angular/core';
import { LocalizationService } from '@progress/kendo-angular-l10n';
import { animationDuration } from './util';
import { IconComponent } from '@progress/kendo-angular-icons';
import { checkIcon } from '@progress/kendo-svg-icons';
import { ActionSheetComponent, ActionSheetTemplateDirective } from '@progress/kendo-angular-navigation';
import { TextBoxComponent, TextBoxPrefixTemplateDirective } from '@progress/kendo-angular-inputs';
import { NgIf, NgTemplateOutlet } from '@angular/common';
import { ButtonComponent } from '@progress/kendo-angular-buttons';
import { AdaptiveService } from '@progress/kendo-angular-utils';
import * as i0 from "@angular/core";
import * as i1 from "@progress/kendo-angular-l10n";
import * as i2 from "@progress/kendo-angular-utils";
/**
* @hidden
*/
export class AdaptiveRendererComponent {
localization;
adaptiveService;
title;
subtitle;
showTextInput;
sharedPopupActionSheetTemplate;
text;
placeholder;
searchBarValue;
filterable;
closePopup = new EventEmitter();
textInputChange = new EventEmitter();
navigate = new EventEmitter();
onExpand = new EventEmitter();
actionSheet;
actionSheetSearchBar;
constructor(localization, adaptiveService) {
this.localization = localization;
this.adaptiveService = adaptiveService;
}
animationDuration = animationDuration;
checkIcon = checkIcon;
expanded = false;
messageFor(key) {
return this.localization.get(key);
}
onValueChange(value) {
this.searchBarValue = value;
this.textInputChange.emit(value);
}
onOverlayClick() {
if (this.expanded) {
this.handleClose();
}
}
handleExpand() {
this.onExpand.emit();
this.expanded = true;
}
handleClose() {
this.closePopup.emit();
this.expanded = false;
}
get windowSize() {
return this.adaptiveService.size;
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdaptiveRendererComponent, deps: [{ token: i1.LocalizationService }, { token: i2.AdaptiveService }], target: i0.ɵɵFactoryTarget.Component });
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: AdaptiveRendererComponent, isStandalone: true, selector: "kendo-adaptive-renderer", inputs: { title: "title", subtitle: "subtitle", showTextInput: "showTextInput", sharedPopupActionSheetTemplate: "sharedPopupActionSheetTemplate", text: "text", placeholder: "placeholder", searchBarValue: "searchBarValue", filterable: "filterable" }, outputs: { closePopup: "closePopup", textInputChange: "textInputChange", navigate: "navigate", onExpand: "onExpand" }, viewQueries: [{ propertyName: "actionSheet", first: true, predicate: ActionSheetComponent, descendants: true }, { propertyName: "actionSheetSearchBar", first: true, predicate: ["actionSheetSearchBar"], descendants: true }], ngImport: i0, template: `
<kendo-actionsheet
#actionSheet
[animation]="{ duration: animationDuration }"
[initialFocus]="false"
[cssClass]="{
'k-adaptive-actionsheet': true,
'k-actionsheet-fullscreen': windowSize === 'small',
'k-actionsheet-bottom': windowSize === 'medium'
}"
[cssStyle]="{
height: windowSize === 'small' ? '100vh' : '60vh'
}"
(overlayClick)="onOverlayClick()"
(keydown)="navigate.emit($event)"
(expand)="handleExpand()"
(collapse)="closePopup.emit()"
>
<ng-template kendoActionSheetTemplate>
<div class="k-text-center k-actionsheet-titlebar">
<div class="k-actionsheet-titlebar-group">
<div class="k-actionsheet-title">
<div class="k-text-center" *ngIf="title">{{ title }}</div>
<div class="k-actionsheet-subtitle k-text-center" *ngIf="subtitle">{{ subtitle }}</div>
</div>
<div class="k-actionsheet-actions">
<button
kendoButton
icon="check"
type="button"
[attr.title]="messageFor('adaptiveCloseButtonTitle')"
[svgIcon]="checkIcon"
fillMode="flat"
themeColor="primary"
size="large"
[tabIndex]="-1"
aria-hidden="true"
innerCssClass="k-button-icon"
(click)="handleClose()"
></button>
</div>
</div>
<div class="k-actionsheet-titlebar-group k-actionsheet-filter" *ngIf="showTextInput">
<kendo-textbox
#actionSheetSearchBar
[value]="searchBarValue || ''"
size="large"
[placeholder]="filterable ? messageFor('filterInputPlaceholder') : placeholder"
class="k-searchbox"
autocomplete="off"
(valueChange)="onValueChange($event)"
>
<ng-template kendoTextBoxPrefixTemplate *ngIf="filterable">
<kendo-icon name="search"></kendo-icon>
</ng-template>
</kendo-textbox>
</div>
</div>
<div class="k-actionsheet-content">
<div class="k-list-container">
<ng-container *ngTemplateOutlet="sharedPopupActionSheetTemplate"></ng-container>
</div>
</div>
</ng-template>
</kendo-actionsheet>
`, isInline: true, dependencies: [{ kind: "component", type: ActionSheetComponent, selector: "kendo-actionsheet", inputs: ["actions", "actionsLayout", "overlayClickClose", "title", "subtitle", "items", "cssClass", "cssStyle", "animation", "expanded", "titleId", "initialFocus"], outputs: ["expandedChange", "action", "expand", "collapse", "itemClick", "overlayClick"], exportAs: ["kendoActionSheet"] }, { kind: "directive", type: ActionSheetTemplateDirective, selector: "[kendoActionSheetTemplate]" }, { kind: "component", type: ButtonComponent, selector: "button[kendoButton]", inputs: ["arrowIcon", "toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: TextBoxComponent, selector: "kendo-textbox", inputs: ["focusableId", "title", "type", "disabled", "readonly", "tabindex", "value", "selectOnFocus", "showSuccessIcon", "showErrorIcon", "clearButton", "successIcon", "successSvgIcon", "errorIcon", "errorSvgIcon", "clearButtonIcon", "clearButtonSvgIcon", "size", "rounded", "fillMode", "tabIndex", "placeholder", "maxlength", "inputAttributes"], outputs: ["valueChange", "inputFocus", "inputBlur", "focus", "blur"], exportAs: ["kendoTextBox"] }, { kind: "directive", type: TextBoxPrefixTemplateDirective, selector: "[kendoTextBoxPrefixTemplate]", inputs: ["showSeparator"] }, { kind: "component", type: IconComponent, selector: "kendo-icon", inputs: ["name"], exportAs: ["kendoIcon"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AdaptiveRendererComponent, decorators: [{
type: Component,
args: [{
selector: 'kendo-adaptive-renderer',
template: `
<kendo-actionsheet
#actionSheet
[animation]="{ duration: animationDuration }"
[initialFocus]="false"
[cssClass]="{
'k-adaptive-actionsheet': true,
'k-actionsheet-fullscreen': windowSize === 'small',
'k-actionsheet-bottom': windowSize === 'medium'
}"
[cssStyle]="{
height: windowSize === 'small' ? '100vh' : '60vh'
}"
(overlayClick)="onOverlayClick()"
(keydown)="navigate.emit($event)"
(expand)="handleExpand()"
(collapse)="closePopup.emit()"
>
<ng-template kendoActionSheetTemplate>
<div class="k-text-center k-actionsheet-titlebar">
<div class="k-actionsheet-titlebar-group">
<div class="k-actionsheet-title">
<div class="k-text-center" *ngIf="title">{{ title }}</div>
<div class="k-actionsheet-subtitle k-text-center" *ngIf="subtitle">{{ subtitle }}</div>
</div>
<div class="k-actionsheet-actions">
<button
kendoButton
icon="check"
type="button"
[attr.title]="messageFor('adaptiveCloseButtonTitle')"
[svgIcon]="checkIcon"
fillMode="flat"
themeColor="primary"
size="large"
[tabIndex]="-1"
aria-hidden="true"
innerCssClass="k-button-icon"
(click)="handleClose()"
></button>
</div>
</div>
<div class="k-actionsheet-titlebar-group k-actionsheet-filter" *ngIf="showTextInput">
<kendo-textbox
#actionSheetSearchBar
[value]="searchBarValue || ''"
size="large"
[placeholder]="filterable ? messageFor('filterInputPlaceholder') : placeholder"
class="k-searchbox"
autocomplete="off"
(valueChange)="onValueChange($event)"
>
<ng-template kendoTextBoxPrefixTemplate *ngIf="filterable">
<kendo-icon name="search"></kendo-icon>
</ng-template>
</kendo-textbox>
</div>
</div>
<div class="k-actionsheet-content">
<div class="k-list-container">
<ng-container *ngTemplateOutlet="sharedPopupActionSheetTemplate"></ng-container>
</div>
</div>
</ng-template>
</kendo-actionsheet>
`,
standalone: true,
imports: [ActionSheetComponent, ActionSheetTemplateDirective, ButtonComponent, NgIf, TextBoxComponent, TextBoxPrefixTemplateDirective, IconComponent, NgTemplateOutlet]
}]
}], ctorParameters: function () { return [{ type: i1.LocalizationService }, { type: i2.AdaptiveService }]; }, propDecorators: { title: [{
type: Input
}], subtitle: [{
type: Input
}], showTextInput: [{
type: Input
}], sharedPopupActionSheetTemplate: [{
type: Input
}], text: [{
type: Input
}], placeholder: [{
type: Input
}], searchBarValue: [{
type: Input
}], filterable: [{
type: Input
}], closePopup: [{
type: Output
}], textInputChange: [{
type: Output
}], navigate: [{
type: Output
}], onExpand: [{
type: Output
}], actionSheet: [{
type: ViewChild,
args: [ActionSheetComponent]
}], actionSheetSearchBar: [{
type: ViewChild,
args: ['actionSheetSearchBar']
}] } });