@progress/kendo-angular-editor
Version:
Kendo UI Editor for Angular
166 lines (151 loc) • 8.75 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, ViewChild, Input, ElementRef, Output, EventEmitter } from '@angular/core';
import { NgSwitch, NgSwitchCase, NgSwitchDefault } from '@angular/common';
import { DropDownListComponent, ItemTemplateDirective } from '@progress/kendo-angular-dropdowns';
import { DropDownToolDirective } from '../shared/dropdown-tool.directive';
import * as i0 from "@angular/core";
/**
* @hidden
*/
export class FormatDropDownListComponent {
data;
value;
defaultItem;
itemDisabled;
title;
disabled;
tabindex;
valueChange = new EventEmitter();
element;
dropDownList;
onValueChange(tag) {
this.valueChange.emit(tag);
}
focus() {
this.dropDownList.focus();
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FormatDropDownListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: FormatDropDownListComponent, isStandalone: true, selector: "kendo-editor-format-dropdownlist", inputs: { data: "data", value: "value", defaultItem: "defaultItem", itemDisabled: "itemDisabled", title: "title", disabled: "disabled", tabindex: "tabindex" }, outputs: { valueChange: "valueChange" }, viewQueries: [{ propertyName: "element", first: true, predicate: ["element"], descendants: true, static: true }, { propertyName: "dropDownList", first: true, predicate: ["element"], descendants: true, read: DropDownListComponent, static: true }], ngImport: i0, template: `
<kendo-dropdownlist
#element
kendoEditorDropDownTool
[defaultItem]="defaultItem"
[textField]="'text'"
[valueField]="'tag'"
[data]="data"
[(value)]="value"
[valuePrimitive]="true"
[itemDisabled]="itemDisabled"
[attr.title]="title"
[disabled]="disabled"
[tabindex]="tabindex"
(valueChange)="onValueChange($event)"
[style.width.em]="13"
>
<ng-template kendoDropDownListItemTemplate let-dataItem>
<ng-container [ngSwitch]="dataItem.tag">
<span *ngSwitchCase="'h1'" [style]="'display: block; font-size: 2em; margin-left: 0; font-weight: bold;'">
{{ dataItem.text }}
</span>
<span *ngSwitchCase="'h2'" [style]="'display: block; font-size: 1.5em; margin-left: 0; font-weight: bold;'">
{{ dataItem.text }}
</span>
<span *ngSwitchCase="'h3'" [style]="'display: block; font-size: 1.17em; margin-left: 0; font-weight: bold;'">
{{ dataItem.text }}
</span>
<span *ngSwitchCase="'h4'" [style]="'display: block; font-size: 1em; margin-left: 0; font-weight: bold;'">
{{ dataItem.text }}
</span>
<span *ngSwitchCase="'h5'" [style]="'display: block; font-size: .83em; margin-left: 0; font-weight: bold;'">
{{ dataItem.text }}
</span>
<span *ngSwitchCase="'h6'" [style]="'display: block; font-size: .67em; margin-left: 0; font-weight: bold;'">
{{ dataItem.text }}
</span>
<span *ngSwitchCase="'p'" [style]="'display: block; margin-left: 0;'">
{{ dataItem.text }}
</span>
<span *ngSwitchDefault>{{ dataItem.text }}</span>
</ng-container>
</ng-template>
</kendo-dropdownlist>
`, isInline: true, dependencies: [{ kind: "component", type: DropDownListComponent, selector: "kendo-dropdownlist", inputs: ["customIconClass", "showStickyHeader", "icon", "svgIcon", "loading", "data", "value", "textField", "valueField", "adaptiveMode", "title", "subtitle", "popupSettings", "listHeight", "defaultItem", "disabled", "itemDisabled", "readonly", "filterable", "virtual", "ignoreCase", "delay", "valuePrimitive", "tabindex", "tabIndex", "size", "rounded", "fillMode", "leftRightArrowsNavigation", "id"], outputs: ["valueChange", "filterChange", "selectionChange", "open", "opened", "close", "closed", "focus", "blur"], exportAs: ["kendoDropDownList"] }, { kind: "directive", type: DropDownToolDirective, selector: "[kendoEditorDropDownTool]" }, { kind: "directive", type: ItemTemplateDirective, selector: "[kendoDropDownListItemTemplate],[kendoComboBoxItemTemplate],[kendoAutoCompleteItemTemplate],[kendoMultiSelectItemTemplate]" }, { kind: "directive", type: NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: NgSwitchDefault, selector: "[ngSwitchDefault]" }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FormatDropDownListComponent, decorators: [{
type: Component,
args: [{
selector: 'kendo-editor-format-dropdownlist',
template: `
<kendo-dropdownlist
#element
kendoEditorDropDownTool
[defaultItem]="defaultItem"
[textField]="'text'"
[valueField]="'tag'"
[data]="data"
[(value)]="value"
[valuePrimitive]="true"
[itemDisabled]="itemDisabled"
[attr.title]="title"
[disabled]="disabled"
[tabindex]="tabindex"
(valueChange)="onValueChange($event)"
[style.width.em]="13"
>
<ng-template kendoDropDownListItemTemplate let-dataItem>
<ng-container [ngSwitch]="dataItem.tag">
<span *ngSwitchCase="'h1'" [style]="'display: block; font-size: 2em; margin-left: 0; font-weight: bold;'">
{{ dataItem.text }}
</span>
<span *ngSwitchCase="'h2'" [style]="'display: block; font-size: 1.5em; margin-left: 0; font-weight: bold;'">
{{ dataItem.text }}
</span>
<span *ngSwitchCase="'h3'" [style]="'display: block; font-size: 1.17em; margin-left: 0; font-weight: bold;'">
{{ dataItem.text }}
</span>
<span *ngSwitchCase="'h4'" [style]="'display: block; font-size: 1em; margin-left: 0; font-weight: bold;'">
{{ dataItem.text }}
</span>
<span *ngSwitchCase="'h5'" [style]="'display: block; font-size: .83em; margin-left: 0; font-weight: bold;'">
{{ dataItem.text }}
</span>
<span *ngSwitchCase="'h6'" [style]="'display: block; font-size: .67em; margin-left: 0; font-weight: bold;'">
{{ dataItem.text }}
</span>
<span *ngSwitchCase="'p'" [style]="'display: block; margin-left: 0;'">
{{ dataItem.text }}
</span>
<span *ngSwitchDefault>{{ dataItem.text }}</span>
</ng-container>
</ng-template>
</kendo-dropdownlist>
`,
standalone: true,
imports: [DropDownListComponent, DropDownToolDirective, ItemTemplateDirective, NgSwitch, NgSwitchCase, NgSwitchDefault]
}]
}], propDecorators: { data: [{
type: Input
}], value: [{
type: Input
}], defaultItem: [{
type: Input
}], itemDisabled: [{
type: Input
}], title: [{
type: Input
}], disabled: [{
type: Input
}], tabindex: [{
type: Input
}], valueChange: [{
type: Output
}], element: [{
type: ViewChild,
args: ['element', { static: true }]
}], dropDownList: [{
type: ViewChild,
args: ['element', { read: DropDownListComponent, static: true }]
}] } });