@progress/kendo-angular-toolbar 19.0.0-develop.3 → 19.0.0-develop.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,53 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2025 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ "use strict";
6
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
+ if (k2 === undefined) k2 = k;
8
+ var desc = Object.getOwnPropertyDescriptor(m, k);
9
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
10
+ desc = { enumerable: true, get: function() { return m[k]; } };
11
+ }
12
+ Object.defineProperty(o, k2, desc);
13
+ }) : (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ o[k2] = m[k];
16
+ }));
17
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
18
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
19
+ }) : function(o, v) {
20
+ o["default"] = v;
21
+ });
22
+ var __importStar = (this && this.__importStar) || function (mod) {
23
+ if (mod && mod.__esModule) return mod;
24
+ var result = {};
25
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
26
+ __setModuleDefault(result, mod);
27
+ return result;
28
+ };
29
+ Object.defineProperty(exports, "__esModule", { value: true });
30
+ const index_1 = require("../template-transformer/index");
31
+ const utils_1 = require("../utils");
32
+ const fs = __importStar(require("fs"));
33
+ function default_1(fileInfo, api) {
34
+ const filePath = fileInfo.path;
35
+ if (filePath.endsWith('.html')) {
36
+ let updatedContent = fileInfo.source;
37
+ updatedContent = (0, utils_1.htmlAttributeValueTransformer)({ ...fileInfo, source: updatedContent }, 'kendo-toolbar-button', 'showIcon', 'overflow', 'menu');
38
+ updatedContent = (0, utils_1.htmlAttributeValueTransformer)({ ...fileInfo, source: updatedContent }, 'kendo-toolbar-button', 'showIcon', 'both', 'always');
39
+ // Only write to file once after all transformations
40
+ fs.writeFileSync(filePath, updatedContent, 'utf-8');
41
+ return;
42
+ }
43
+ const j = api.jscodeshift;
44
+ const rootSource = j(fileInfo.source);
45
+ (0, index_1.templateTransformer)(rootSource, j, (root) => {
46
+ (0, utils_1.templateAttributeValueTransformer)(root, 'kendo-toolbar-button', 'showIcon', 'overflow', 'menu');
47
+ (0, utils_1.templateAttributeValueTransformer)(root, 'kendo-toolbar-button', 'showIcon', 'both', 'always');
48
+ });
49
+ (0, utils_1.tsPropertyValueTransformer)(rootSource, j, 'DisplayMode', 'overflow', 'menu');
50
+ (0, utils_1.tsPropertyValueTransformer)(rootSource, j, 'DisplayMode', 'both', 'always');
51
+ return rootSource.toSource();
52
+ }
53
+ exports.default = default_1;
@@ -0,0 +1,53 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2025 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ "use strict";
6
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
+ if (k2 === undefined) k2 = k;
8
+ var desc = Object.getOwnPropertyDescriptor(m, k);
9
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
10
+ desc = { enumerable: true, get: function() { return m[k]; } };
11
+ }
12
+ Object.defineProperty(o, k2, desc);
13
+ }) : (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ o[k2] = m[k];
16
+ }));
17
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
18
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
19
+ }) : function(o, v) {
20
+ o["default"] = v;
21
+ });
22
+ var __importStar = (this && this.__importStar) || function (mod) {
23
+ if (mod && mod.__esModule) return mod;
24
+ var result = {};
25
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
26
+ __setModuleDefault(result, mod);
27
+ return result;
28
+ };
29
+ Object.defineProperty(exports, "__esModule", { value: true });
30
+ const index_1 = require("../template-transformer/index");
31
+ const utils_1 = require("../utils");
32
+ const fs = __importStar(require("fs"));
33
+ function default_1(fileInfo, api) {
34
+ const filePath = fileInfo.path;
35
+ if (filePath.endsWith('.html')) {
36
+ let updatedContent = fileInfo.source;
37
+ updatedContent = (0, utils_1.htmlAttributeValueTransformer)({ ...fileInfo, source: updatedContent }, 'kendo-toolbar-button', 'showText', 'overflow', 'menu');
38
+ updatedContent = (0, utils_1.htmlAttributeValueTransformer)({ ...fileInfo, source: updatedContent }, 'kendo-toolbar-button', 'showText', 'both', 'always');
39
+ // Only write to file once after all transformations
40
+ fs.writeFileSync(filePath, updatedContent, 'utf-8');
41
+ return;
42
+ }
43
+ const j = api.jscodeshift;
44
+ const rootSource = j(fileInfo.source);
45
+ (0, index_1.templateTransformer)(rootSource, j, (root) => {
46
+ (0, utils_1.templateAttributeValueTransformer)(root, 'kendo-toolbar-button', 'showText', 'overflow', 'menu');
47
+ (0, utils_1.templateAttributeValueTransformer)(root, 'kendo-toolbar-button', 'showText', 'both', 'always');
48
+ });
49
+ (0, utils_1.tsPropertyValueTransformer)(rootSource, j, 'DisplayMode', 'overflow', 'menu');
50
+ (0, utils_1.tsPropertyValueTransformer)(rootSource, j, 'DisplayMode', 'both', 'always');
51
+ return rootSource.toSource();
52
+ }
53
+ exports.default = default_1;
package/display-mode.d.ts CHANGED
@@ -3,8 +3,14 @@
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  /**
6
- * The position of the text inside the Toolbar buttons.
6
+ * Specifies the visibility of the toolbar tool text or icon.
7
7
  *
8
- * @default 'both'
8
+ * The possible values are:
9
+ * - `always`—The text or icon is always visible, regardless of the current overflow mode.
10
+ * - `toolbar`—The text or icon is displayed in the main ToolBar and in the overflow element when `section` overflow mode is used.
11
+ * - `menu`—The text or icon is displayed only in the overflow popup when `menu` overflow mode is used.
12
+ * - `never`—The text or icon is never rendered.
13
+ *
14
+ * @default 'always'
9
15
  */
10
- export type DisplayMode = 'both' | 'toolbar' | 'overflow';
16
+ export type DisplayMode = 'always' | 'toolbar' | 'menu' | 'never';
@@ -10,7 +10,7 @@ export const packageMetadata = {
10
10
  productName: 'Kendo UI for Angular',
11
11
  productCode: 'KENDOUIANGULAR',
12
12
  productCodes: ['KENDOUIANGULAR'],
13
- publishDate: 1745498572,
14
- version: '19.0.0-develop.3',
13
+ publishDate: 1747836229,
14
+ version: '19.0.0-develop.30',
15
15
  licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/'
16
16
  };
@@ -3,6 +3,7 @@
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import { Input, Renderer2 as Renderer, Output, EventEmitter, Directive, ViewContainerRef } from '@angular/core';
6
+ import { isPresent } from '@progress/kendo-angular-common';
6
7
  import { ToolBarToolComponent } from './tools/toolbar-tool.component';
7
8
  import { RefreshService } from './refresh.service';
8
9
  import { RendererService } from './renderer.service';
@@ -59,24 +60,38 @@ export class ToolBarRendererComponent {
59
60
  if (this.resizable) {
60
61
  if (this.location === 'toolbar') {
61
62
  this.template = this.tool.toolbarTemplate;
62
- this.renderer.setStyle(this.internalComponentRef, 'visibility', 'hidden');
63
- this.renderer.setStyle(this.internalComponentRef, 'display', 'none');
63
+ this.hideTool();
64
64
  }
65
65
  else if (this.location === 'section') {
66
66
  this.template = this.tool.toolbarTemplate;
67
- this.renderer.setStyle(this.internalComponentRef, 'visibility', 'visible');
68
- this.renderer.setStyle(this.internalComponentRef, 'display', 'inline-flex');
67
+ if (this.tool.isHidden) {
68
+ this.hideTool();
69
+ }
70
+ else {
71
+ this.renderer.setStyle(this.internalComponentRef, 'visibility', 'visible');
72
+ this.renderer.setStyle(this.internalComponentRef, 'display', 'inline-flex');
73
+ }
69
74
  }
70
75
  else {
71
76
  this.template = this.tool.popupTemplate;
72
- this.renderer.setStyle(this.internalComponentRef, 'display', 'none');
77
+ if (this.tool.isHidden) {
78
+ this.hideTool();
79
+ }
80
+ else {
81
+ this.renderer.setStyle(this.internalComponentRef, 'display', 'none');
82
+ }
73
83
  }
74
84
  }
75
85
  else {
76
86
  this.tool.overflows = false;
77
87
  this.template = this.tool.toolbarTemplate;
78
- this.renderer.setStyle(this.internalComponentRef, 'visibility', 'visible');
79
- this.renderer.setStyle(this.internalComponentRef, 'display', 'inline-flex');
88
+ if (this.tool.isHidden) {
89
+ this.hideTool();
90
+ }
91
+ else {
92
+ this.renderer.setStyle(this.internalComponentRef, 'visibility', 'visible');
93
+ this.renderer.setStyle(this.internalComponentRef, 'display', 'inline-flex');
94
+ }
80
95
  }
81
96
  }
82
97
  ngOnDestroy() {
@@ -103,7 +118,13 @@ export class ToolBarRendererComponent {
103
118
  }
104
119
  refresh() {
105
120
  this.tool.location = this.location;
106
- if (this.resizable && this.internalComponentRef) {
121
+ if (!isPresent(this.internalComponentRef)) {
122
+ return;
123
+ }
124
+ if (this.tool.isHidden) {
125
+ this.hideTool();
126
+ }
127
+ else if (this.resizable) {
107
128
  if (this.location === 'toolbar') {
108
129
  this.renderer.setStyle(this.internalComponentRef, 'visibility', this.tool.visibility);
109
130
  this.renderer.setStyle(this.internalComponentRef, 'display', this.tool.toolbarDisplay);
@@ -111,8 +132,12 @@ export class ToolBarRendererComponent {
111
132
  else {
112
133
  this.renderer.setStyle(this.internalComponentRef, 'display', this.tool.overflowDisplay);
113
134
  }
114
- this.updateTools();
115
135
  }
136
+ else {
137
+ this.renderer.setStyle(this.internalComponentRef, 'visibility', 'visible');
138
+ this.renderer.setStyle(this.internalComponentRef, 'display', 'inline-flex');
139
+ }
140
+ this.updateTools();
116
141
  }
117
142
  setAttribute(element, attr, value) {
118
143
  this.renderer.setAttribute(element, attr, value);
@@ -138,6 +163,10 @@ export class ToolBarRendererComponent {
138
163
  }
139
164
  }
140
165
  }
166
+ hideTool() {
167
+ this.renderer.setStyle(this.internalComponentRef, 'visibility', 'hidden');
168
+ this.renderer.setStyle(this.internalComponentRef, 'display', 'none');
169
+ }
141
170
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ToolBarRendererComponent, deps: [{ token: i0.Renderer2 }, { token: i1.RendererService }, { token: i2.RefreshService }, { token: i3.ToolbarToolsService }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
142
171
  static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: ToolBarRendererComponent, isStandalone: true, selector: "[kendoToolbarRenderer]", inputs: { tool: "tool", location: "location", resizable: "resizable" }, outputs: { rendererClick: "rendererClick" }, providers: [RendererService], ngImport: i0 });
143
172
  }
@@ -178,6 +178,34 @@ export class ToolBarComponent {
178
178
  get tabIndex() {
179
179
  return this.tabindex;
180
180
  }
181
+ /**
182
+ * Specifies the icons visibility for all tools in the ToolBar.
183
+ * This can be overridden by the `showIcon` property of each tool.
184
+ */
185
+ showIcon = 'always';
186
+ /**
187
+ * @hidden
188
+ */
189
+ get normalizedShowIcon() {
190
+ if (typeof this.showIcon === 'boolean') {
191
+ return this.showIcon ? 'always' : 'never';
192
+ }
193
+ return this.showIcon;
194
+ }
195
+ /**
196
+ * Specifies the text visibility for all tools in the ToolBar.
197
+ * This can be overridden by the `showText` property of each tool.
198
+ */
199
+ showText = 'always';
200
+ /**
201
+ * @hidden
202
+ */
203
+ get normalizedShowText() {
204
+ if (typeof this.showText === 'boolean') {
205
+ return this.showText ? 'always' : 'never';
206
+ }
207
+ return this.showText;
208
+ }
181
209
  /**
182
210
  * Fires when the overflow popup of the ToolBar is opened.
183
211
  */
@@ -789,10 +817,10 @@ export class ToolBarComponent {
789
817
  if (containerWidth > childrenWidth) {
790
818
  for (let i = this.overflowTools.length - 1; i >= 0; i--) {
791
819
  width = this.showFirstHiddenTool(containerWidth, childrenWidth);
792
- if (width) {
820
+ if (width > 0) {
793
821
  childrenWidth += width + this.gap;
794
822
  }
795
- else {
823
+ else if (width === 0) {
796
824
  break;
797
825
  }
798
826
  }
@@ -827,7 +855,7 @@ export class ToolBarComponent {
827
855
  tool.overflows = true;
828
856
  }
829
857
  this.refreshService.refresh(tool);
830
- return renderedElement.width; // returns 0 if `overflows` is true
858
+ return tool.isHidden ? -1 : renderedElement.width; // returns 0 if `overflows` is true and -1 if the tool is hidden
831
859
  }
832
860
  setPopupContentDimensions(isSection) {
833
861
  const popupContentContainer = this.popupRef.popup.instance.contentContainer.nativeElement;
@@ -954,7 +982,7 @@ export class ToolBarComponent {
954
982
  });
955
983
  }
956
984
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ToolBarComponent, deps: [{ token: i1.LocalizationService }, { token: i2.PopupService }, { token: i3.RefreshService }, { token: i4.NavigationService }, { token: i0.ElementRef }, { token: i0.NgZone }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: i5.ToolbarToolsService }, { token: i6.ScrollService }], target: i0.ɵɵFactoryTarget.Component });
957
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ToolBarComponent, isStandalone: true, selector: "kendo-toolbar", inputs: { overflow: "overflow", resizable: "resizable", popupSettings: "popupSettings", fillMode: "fillMode", tabindex: "tabindex", size: "size", tabIndex: "tabIndex" }, outputs: { open: "open", close: "close" }, host: { listeners: { "focus": "onFocus($event)", "focusout": "onFocusOut($event)" }, properties: { "class.k-toolbar": "this.hostClass", "class.k-toolbar-scrollable": "this.scrollableClass", "class.k-toolbar-section": "this.sectionClass", "attr.role": "this.role", "attr.dir": "this.getDir", "class.k-toolbar-resizable": "this.resizableClass" } }, providers: [
985
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ToolBarComponent, isStandalone: true, selector: "kendo-toolbar", inputs: { overflow: "overflow", resizable: "resizable", popupSettings: "popupSettings", fillMode: "fillMode", tabindex: "tabindex", size: "size", tabIndex: "tabIndex", showIcon: "showIcon", showText: "showText" }, outputs: { open: "open", close: "close" }, host: { listeners: { "focus": "onFocus($event)", "focusout": "onFocusOut($event)" }, properties: { "class.k-toolbar": "this.hostClass", "class.k-toolbar-scrollable": "this.scrollableClass", "class.k-toolbar-section": "this.sectionClass", "attr.role": "this.role", "attr.dir": "this.getDir", "class.k-toolbar-resizable": "this.resizableClass" } }, providers: [
958
986
  RefreshService,
959
987
  NavigationService,
960
988
  LocalizationService,
@@ -1397,6 +1425,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
1397
1425
  }], tabIndex: [{
1398
1426
  type: Input,
1399
1427
  args: ['tabIndex']
1428
+ }], showIcon: [{
1429
+ type: Input
1430
+ }], showText: [{
1431
+ type: Input
1400
1432
  }], open: [{
1401
1433
  type: Output
1402
1434
  }], close: [{
@@ -10,28 +10,37 @@ import { take } from 'rxjs/operators';
10
10
  import { IconWrapperComponent } from '@progress/kendo-angular-icons';
11
11
  import { BadgeComponent } from '@progress/kendo-angular-indicators';
12
12
  import { NgStyle, NgClass, NgIf } from '@angular/common';
13
+ import { ToolBarComponent } from '../toolbar.component';
13
14
  import * as i0 from "@angular/core";
15
+ import * as i1 from "../toolbar.component";
14
16
  /**
15
17
  * Represents the [Kendo UI ToolBar Button tool for Angular]({% slug controltypes_toolbar %}#toc-buttons).
16
18
  */
17
19
  export class ToolBarButtonComponent extends ToolBarToolComponent {
18
20
  element;
19
21
  zone;
22
+ host;
20
23
  // showText and showIcon showIcon should be declared first
21
24
  /**
22
- * Specifies where button text should be displayed
25
+ * Specifies the button text visibility.
23
26
  */
24
27
  set showText(value) {
25
28
  this._showText = value;
26
29
  this.setTextDisplayMode();
27
30
  }
28
31
  get showText() {
29
- return this._showText;
32
+ return this._showText || this.host.normalizedShowText;
30
33
  }
31
34
  /**
32
- * Specifies where button icon should be displayed
35
+ * Specifies the button icon visibility.
33
36
  */
34
- showIcon = 'both';
37
+ set showIcon(value) {
38
+ this._showIcon = value;
39
+ this.setTextDisplayMode();
40
+ }
41
+ get showIcon() {
42
+ return this._showIcon || this.host.normalizedShowIcon;
43
+ }
35
44
  /**
36
45
  * Specifies the text of the Button ([see example]({% slug controltypes_toolbar %}#toc-buttons)).
37
46
  */
@@ -192,12 +201,14 @@ export class ToolBarButtonComponent extends ToolBarToolComponent {
192
201
  toolbarButtonElement;
193
202
  sectionButtonElement;
194
203
  overflowButtonElement;
195
- _showText = 'both';
204
+ _showText;
205
+ _showIcon;
196
206
  _text;
197
- constructor(element, zone) {
207
+ constructor(element, zone, host) {
198
208
  super();
199
209
  this.element = element;
200
210
  this.zone = zone;
211
+ this.host = host;
201
212
  this.isBuiltInTool = true;
202
213
  }
203
214
  ngOnInit() {
@@ -249,16 +260,19 @@ export class ToolBarButtonComponent extends ToolBarToolComponent {
249
260
  this.selected = state;
250
261
  this.selectedChange.emit(state);
251
262
  }
263
+ /**
264
+ * @hidden
265
+ */
252
266
  getButton() {
253
267
  return this[`${this.location}ButtonElement`]?.nativeElement;
254
268
  }
255
269
  setTextDisplayMode() {
256
- this.toolbarOptions.text = this.showText === 'overflow' ? undefined : this.text;
270
+ this.toolbarOptions.text = this.showText === 'menu' || this.showText === 'never' ? undefined : this.text;
257
271
  this.zone.onStable.pipe(take(1)).subscribe(() => {
258
- this.overflowOptions.text = this.showText === 'toolbar' ? undefined : this.text;
272
+ this.overflowOptions.text = this.showText === 'toolbar' || this.showText === 'never' ? undefined : this.text;
259
273
  });
260
274
  }
261
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ToolBarButtonComponent, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
275
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ToolBarButtonComponent, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }, { token: i1.ToolBarComponent }], target: i0.ɵɵFactoryTarget.Component });
262
276
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ToolBarButtonComponent, isStandalone: true, selector: "kendo-toolbar-button", inputs: { showText: "showText", showIcon: "showIcon", text: "text", style: "style", className: "className", title: "title", disabled: "disabled", toggleable: "toggleable", look: "look", togglable: "togglable", selected: "selected", fillMode: "fillMode", themeColor: "themeColor", icon: "icon", iconClass: "iconClass", svgIcon: "svgIcon", imageUrl: "imageUrl" }, outputs: { click: "click", pointerdown: "pointerdown", selectedChange: "selectedChange" }, providers: [{ provide: ToolBarToolComponent, useExisting: forwardRef(() => ToolBarButtonComponent) }], viewQueries: [{ propertyName: "toolbarButtonElement", first: true, predicate: ["toolbarButton"], descendants: true, read: ElementRef }, { propertyName: "sectionButtonElement", first: true, predicate: ["sectionButton"], descendants: true, read: ElementRef }, { propertyName: "overflowButtonElement", first: true, predicate: ["overflowButton"], descendants: true, read: ElementRef }], exportAs: ["kendoToolBarButton"], usesInheritance: true, ngImport: i0, template: `
263
277
  <ng-template #toolbarTemplate>
264
278
  <button
@@ -435,7 +449,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
435
449
  standalone: true,
436
450
  imports: [ButtonComponent, NgStyle, NgClass, NgIf, IconWrapperComponent, BadgeComponent],
437
451
  }]
438
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }]; }, propDecorators: { showText: [{
452
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: i1.ToolBarComponent }]; }, propDecorators: { showText: [{
439
453
  type: Input
440
454
  }], showIcon: [{
441
455
  type: Input
@@ -9,13 +9,16 @@ import { getValueForLocation, makePeeker, getIndexOfFocused, getPrevKey, getNext
9
9
  import { IconWrapperComponent } from '@progress/kendo-angular-icons';
10
10
  import { NgClass, NgIf, NgFor } from '@angular/common';
11
11
  import { take } from 'rxjs/operators';
12
+ import { ToolBarComponent } from '../toolbar.component';
12
13
  import * as i0 from "@angular/core";
14
+ import * as i1 from "../toolbar.component";
13
15
  /**
14
16
  * Represents the [Kendo UI ToolBar DropDownButton for Angular](slug:controltypes_toolbar#drop-down-buttons).
15
17
  */
16
18
  export class ToolBarDropDownButtonComponent extends ToolBarToolComponent {
17
19
  zone;
18
20
  renderer;
21
+ host;
19
22
  /**
20
23
  * Allows showing the default arrow icon or providing alternative one instead.
21
24
  * @default false
@@ -28,19 +31,24 @@ export class ToolBarDropDownButtonComponent extends ToolBarToolComponent {
28
31
  title = '';
29
32
  // showText and showIcon showIcon should be declared first
30
33
  /**
31
- * Defines the location of the button text that will be displayed.
34
+ * Specifies the button text visibility.
32
35
  */
33
36
  set showText(value) {
34
37
  this._showText = value;
35
38
  this.setTextDisplayMode();
36
39
  }
37
40
  get showText() {
38
- return this._showText;
41
+ return this._showText || this.host.normalizedShowText;
39
42
  }
40
43
  /**
41
- * Defines the location of the button icon that will be displayed.
44
+ * Specifies the button icon visibility.
42
45
  */
43
- showIcon = 'both';
46
+ set showIcon(value) {
47
+ this._showIcon = value;
48
+ }
49
+ get showIcon() {
50
+ return this._showIcon || this.host.normalizedShowIcon;
51
+ }
44
52
  /**
45
53
  * Sets the text of the DropDownButton
46
54
  * ([see example](slug:controltypes_toolbar#toc-drop-down-buttons)).
@@ -215,14 +223,16 @@ export class ToolBarDropDownButtonComponent extends ToolBarToolComponent {
215
223
  _data;
216
224
  _popupSettings = { animate: true, popupClass: '' };
217
225
  focusedIndex = -1;
218
- _showText = 'both';
226
+ _showText;
227
+ _showIcon;
219
228
  _text;
220
229
  getNextKey;
221
230
  getPrevKey;
222
- constructor(zone, renderer) {
231
+ constructor(zone, renderer, host) {
223
232
  super();
224
233
  this.zone = zone;
225
234
  this.renderer = renderer;
235
+ this.host = host;
226
236
  this.getNextKey = getNextKey();
227
237
  this.getPrevKey = getPrevKey();
228
238
  this.isBuiltInTool = true;
@@ -232,9 +242,9 @@ export class ToolBarDropDownButtonComponent extends ToolBarToolComponent {
232
242
  }
233
243
  ngAfterViewInit() {
234
244
  this.zone.onStable.pipe(take(1)).subscribe(() => {
235
- const dropDownButton = this[`${this.location}DropDownButton`];
236
- if (dropDownButton) {
237
- this.renderer.addClass(dropDownButton.button.nativeElement, 'k-toolbar-menu-button');
245
+ const dropdownButton = this[`${this.location}DropDownButton`];
246
+ if (dropdownButton?.button) {
247
+ this.renderer.addClass(dropdownButton.button.nativeElement, 'k-toolbar-menu-button');
238
248
  }
239
249
  });
240
250
  }
@@ -288,7 +298,6 @@ export class ToolBarDropDownButtonComponent extends ToolBarToolComponent {
288
298
  if (dataItem) {
289
299
  return this.textField ? dataItem[this.textField] : dataItem.text || dataItem;
290
300
  }
291
- return undefined;
292
301
  }
293
302
  /**
294
303
  * @hidden
@@ -307,10 +316,10 @@ export class ToolBarDropDownButtonComponent extends ToolBarToolComponent {
307
316
  }
308
317
  }
309
318
  setTextDisplayMode() {
310
- this.toolbarOptions.text = this.showText === 'overflow' ? undefined : this.text;
311
- this.overflowOptions.text = this.showText === 'toolbar' ? undefined : this.text;
319
+ this.toolbarOptions.text = this.showText === 'menu' || this.showText === 'never' ? undefined : this.text;
320
+ this.overflowOptions.text = this.showText === 'toolbar' || this.showText === 'never' ? undefined : this.text;
312
321
  }
313
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ToolBarDropDownButtonComponent, deps: [{ token: i0.NgZone }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
322
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ToolBarDropDownButtonComponent, deps: [{ token: i0.NgZone }, { token: i0.Renderer2 }, { token: i1.ToolBarComponent }], target: i0.ɵɵFactoryTarget.Component });
314
323
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ToolBarDropDownButtonComponent, isStandalone: true, selector: "kendo-toolbar-dropdownbutton", inputs: { arrowIcon: "arrowIcon", title: "title", showText: "showText", showIcon: "showIcon", text: "text", icon: "icon", svgIcon: "svgIcon", iconClass: "iconClass", imageUrl: "imageUrl", popupSettings: "popupSettings", look: "look", primary: "primary", fillMode: "fillMode", themeColor: "themeColor", buttonClass: "buttonClass", textField: "textField", disabled: "disabled", data: "data" }, outputs: { itemClick: "itemClick", open: "open", close: "close" }, providers: [{ provide: ToolBarToolComponent, useExisting: forwardRef(() => ToolBarDropDownButtonComponent) }], viewQueries: [{ propertyName: "dropdownButton", first: true, predicate: ["dropdownButton"], descendants: true, read: ElementRef, static: true }, { propertyName: "toolbarDropDownButton", first: true, predicate: ["toolbarDropDownButton"], descendants: true }, { propertyName: "sectionDropDownButton", first: true, predicate: ["sectionDropDownButton"], descendants: true }, { propertyName: "overflowListItems", predicate: ["listItem"], descendants: true }], exportAs: ["kendoToolBarDropDownButton"], usesInheritance: true, ngImport: i0, template: `
315
324
  <ng-template #toolbarTemplate>
316
325
  <kendo-dropdownbutton #toolbarDropDownButton
@@ -501,7 +510,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
501
510
  standalone: true,
502
511
  imports: [DropDownButtonComponent, NgClass, NgIf, IconWrapperComponent, NgFor]
503
512
  }]
504
- }], ctorParameters: function () { return [{ type: i0.NgZone }, { type: i0.Renderer2 }]; }, propDecorators: { arrowIcon: [{
513
+ }], ctorParameters: function () { return [{ type: i0.NgZone }, { type: i0.Renderer2 }, { type: i1.ToolBarComponent }]; }, propDecorators: { arrowIcon: [{
505
514
  type: Input
506
515
  }], title: [{
507
516
  type: Input
@@ -9,26 +9,46 @@ import { getValueForLocation, makePeeker, getIndexOfFocused, getPrevKey, getNext
9
9
  import { caretAltDownIcon } from '@progress/kendo-svg-icons';
10
10
  import { IconWrapperComponent } from '@progress/kendo-angular-icons';
11
11
  import { NgClass, NgIf, NgFor } from '@angular/common';
12
+ import { isPresent } from '@progress/kendo-angular-common';
13
+ import { ToolBarComponent } from '../toolbar.component';
12
14
  import * as i0 from "@angular/core";
15
+ import * as i1 from "../toolbar.component";
13
16
  /**
14
17
  * Represents the [Kendo UI ToolBar SplitButton for Angular](slug:controltypes_toolbar#toc-split-buttons).
15
18
  */
16
19
  export class ToolBarSplitButtonComponent extends ToolBarToolComponent {
20
+ host;
17
21
  // showText and showIcon showIcon should be declared first
18
22
  /**
19
- * Specifies where button text should be displayed
23
+ * Specifies the button text visibility.
20
24
  */
21
25
  set showText(value) {
22
- this._showText = value;
26
+ if (!isPresent(value)) {
27
+ this._showText = this.host.normalizedShowText;
28
+ }
29
+ else {
30
+ this._showText = value;
31
+ }
23
32
  this.setTextDisplayMode();
24
33
  }
25
34
  get showText() {
26
- return this._showText;
35
+ return this._showText || this.host.normalizedShowText;
27
36
  }
28
37
  /**
29
- * Specifies where button icon should be displayed
38
+ * Specifies the button icon visibility.
30
39
  */
31
- showIcon = 'both';
40
+ set showIcon(value) {
41
+ if (!isPresent(value)) {
42
+ this._showIcon = this.host.normalizedShowIcon;
43
+ }
44
+ else {
45
+ this._showIcon = value;
46
+ }
47
+ this.setTextDisplayMode();
48
+ }
49
+ get showIcon() {
50
+ return this._showIcon || this.host.normalizedShowIcon;
51
+ }
32
52
  /**
33
53
  * Sets the text of the SplitButton ([see example](slug:controltypes_toolbar#toc-split-buttons)).
34
54
  */
@@ -215,7 +235,8 @@ export class ToolBarSplitButtonComponent extends ToolBarToolComponent {
215
235
  _data;
216
236
  _popupSettings = { animate: true, popupClass: '' };
217
237
  focusedIndex = -1;
218
- _showText = 'both';
238
+ _showText;
239
+ _showIcon;
219
240
  _text;
220
241
  getNextKey;
221
242
  getPrevKey;
@@ -223,8 +244,9 @@ export class ToolBarSplitButtonComponent extends ToolBarToolComponent {
223
244
  sectionSplitButton;
224
245
  overflowMainButton;
225
246
  overflowListItems;
226
- constructor() {
247
+ constructor(host) {
227
248
  super();
249
+ this.host = host;
228
250
  this.getNextKey = getNextKey();
229
251
  this.getPrevKey = getPrevKey();
230
252
  this.isBuiltInTool = true;
@@ -284,7 +306,6 @@ export class ToolBarSplitButtonComponent extends ToolBarToolComponent {
284
306
  if (dataItem) {
285
307
  return this.textField ? dataItem[this.textField] : dataItem.text || dataItem;
286
308
  }
287
- return undefined;
288
309
  }
289
310
  /**
290
311
  * @hidden
@@ -303,10 +324,10 @@ export class ToolBarSplitButtonComponent extends ToolBarToolComponent {
303
324
  }
304
325
  }
305
326
  setTextDisplayMode() {
306
- this.toolbarOptions.text = this.showText === 'overflow' ? undefined : this.text;
307
- this.overflowOptions.text = this.showText === 'toolbar' ? undefined : this.text;
327
+ this.toolbarOptions.text = this.showText === 'menu' || this.showText === 'never' ? undefined : this.text;
328
+ this.overflowOptions.text = this.showText === 'toolbar' || this.showText === 'never' ? undefined : this.text;
308
329
  }
309
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ToolBarSplitButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
330
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ToolBarSplitButtonComponent, deps: [{ token: i1.ToolBarComponent }], target: i0.ɵɵFactoryTarget.Component });
310
331
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ToolBarSplitButtonComponent, isStandalone: true, selector: "kendo-toolbar-splitbutton", inputs: { showText: "showText", showIcon: "showIcon", text: "text", icon: "icon", svgIcon: "svgIcon", iconClass: "iconClass", imageUrl: "imageUrl", disabled: "disabled", popupSettings: "popupSettings", fillMode: "fillMode", themeColor: "themeColor", look: "look", buttonClass: "buttonClass", arrowButtonClass: "arrowButtonClass", arrowButtonIcon: "arrowButtonIcon", arrowButtonSvgIcon: "arrowButtonSvgIcon", textField: "textField", data: "data" }, outputs: { buttonClick: "buttonClick", itemClick: "itemClick", open: "open", close: "close" }, providers: [{ provide: ToolBarToolComponent, useExisting: forwardRef(() => ToolBarSplitButtonComponent) }], viewQueries: [{ propertyName: "toolbarSplitButton", first: true, predicate: ["toolbarSplitButton"], descendants: true }, { propertyName: "sectionSplitButton", first: true, predicate: ["sectionSplitButton"], descendants: true }, { propertyName: "overflowMainButton", first: true, predicate: ["overflowMainButton"], descendants: true, read: ElementRef }, { propertyName: "overflowListItems", predicate: ["listItem"], descendants: true }], exportAs: ["kendoToolBarSplitButton"], usesInheritance: true, ngImport: i0, template: `
311
332
  <ng-template #toolbarTemplate>
312
333
  <kendo-splitbutton
@@ -511,7 +532,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
511
532
  standalone: true,
512
533
  imports: [SplitButtonComponent, NgClass, NgIf, IconWrapperComponent, NgFor]
513
534
  }]
514
- }], ctorParameters: function () { return []; }, propDecorators: { showText: [{
535
+ }], ctorParameters: function () { return [{ type: i1.ToolBarComponent }]; }, propDecorators: { showText: [{
515
536
  type: Input
516
537
  }], showIcon: [{
517
538
  type: Input
@@ -17,6 +17,10 @@ export class ToolBarToolComponent {
17
17
  visibility;
18
18
  element;
19
19
  isBuiltInTool = false;
20
+ /**
21
+ * @hidden
22
+ */
23
+ isHidden = false;
20
24
  /**
21
25
  * @hidden
22
26
  */
package/esm2022/util.mjs CHANGED
@@ -179,8 +179,10 @@ export const getValueForLocation = (property, displayMode, overflows) => {
179
179
  switch (displayMode) {
180
180
  case 'toolbar':
181
181
  return overflows ? undefined : property;
182
- case 'overflow':
182
+ case 'menu':
183
183
  return overflows ? property : undefined;
184
+ case 'never':
185
+ return;
184
186
  default:
185
187
  return property;
186
188
  }