@progress/kendo-angular-toolbar 19.0.0-develop.8 → 19.0.0

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: 1746081163,
14
- version: '19.0.0-develop.8',
13
+ publishDate: 1748362403,
14
+ version: '19.0.0',
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';
@@ -41,14 +42,8 @@ export class ToolBarRendererComponent {
41
42
  this.viewContainer = viewContainer;
42
43
  }
43
44
  ngOnInit() {
44
- const viewContainerRootNodes = this.viewContainer.get(0)?.rootNodes?.filter(isElementOrTextNode);
45
- if (!viewContainerRootNodes || viewContainerRootNodes.length === 0) {
46
- return;
47
- }
48
45
  this.tool.location = this.location;
49
- this.internalComponentRef = viewContainerRootNodes[0];
50
46
  this.element = this.tool.element;
51
- this.internalComponentRef.addEventListener('click', this.onClick);
52
47
  this.rendererService.element = this.element;
53
48
  this.rendererService.renderer = this;
54
49
  this.refreshSubscription = this.refreshService.onRefresh.subscribe((tool) => {
@@ -56,34 +51,54 @@ export class ToolBarRendererComponent {
56
51
  this.refresh();
57
52
  }
58
53
  });
54
+ }
55
+ ngOnDestroy() {
56
+ this.refreshSubscription?.unsubscribe();
57
+ this.internalComponentRef?.removeEventListener('click', this.onClick);
58
+ }
59
+ ngAfterViewInit() {
60
+ const viewContainerRootNodes = this.viewContainer.get(0)?.rootNodes?.filter(isElementOrTextNode);
61
+ if (!viewContainerRootNodes || viewContainerRootNodes.length === 0) {
62
+ return;
63
+ }
64
+ this.internalComponentRef = viewContainerRootNodes[0];
65
+ this.internalComponentRef.addEventListener('click', this.onClick);
59
66
  if (this.resizable) {
60
67
  if (this.location === 'toolbar') {
61
68
  this.template = this.tool.toolbarTemplate;
62
- this.renderer.setStyle(this.internalComponentRef, 'visibility', 'hidden');
63
- this.renderer.setStyle(this.internalComponentRef, 'display', 'none');
69
+ this.hideTool();
64
70
  }
65
71
  else if (this.location === 'section') {
66
72
  this.template = this.tool.toolbarTemplate;
67
- this.renderer.setStyle(this.internalComponentRef, 'visibility', 'visible');
68
- this.renderer.setStyle(this.internalComponentRef, 'display', 'inline-flex');
73
+ if (this.tool.isHidden) {
74
+ this.hideTool();
75
+ }
76
+ else {
77
+ this.renderer.setStyle(this.internalComponentRef, 'visibility', 'visible');
78
+ this.renderer.setStyle(this.internalComponentRef, 'display', 'inline-flex');
79
+ }
69
80
  }
70
81
  else {
71
82
  this.template = this.tool.popupTemplate;
72
- this.renderer.setStyle(this.internalComponentRef, 'display', 'none');
83
+ if (this.tool.isHidden) {
84
+ this.hideTool();
85
+ }
86
+ else {
87
+ this.renderer.setStyle(this.internalComponentRef, 'display', 'none');
88
+ }
73
89
  }
74
90
  }
75
91
  else {
76
92
  this.tool.overflows = false;
77
93
  this.template = this.tool.toolbarTemplate;
78
- this.renderer.setStyle(this.internalComponentRef, 'visibility', 'visible');
79
- this.renderer.setStyle(this.internalComponentRef, 'display', 'inline-flex');
94
+ if (this.tool.isHidden) {
95
+ this.hideTool();
96
+ }
97
+ else {
98
+ this.renderer.setStyle(this.internalComponentRef, 'visibility', 'visible');
99
+ this.renderer.setStyle(this.internalComponentRef, 'display', 'inline-flex');
100
+ }
80
101
  }
81
- }
82
- ngOnDestroy() {
83
- this.refreshSubscription && this.refreshSubscription.unsubscribe();
84
- this.internalComponentRef && this.internalComponentRef.removeEventListener('click', this.onClick);
85
- }
86
- ngAfterViewInit() {
87
102
  if (this.resizable) {
88
103
  this.refresh();
89
104
  }
@@ -96,6 +111,9 @@ export class ToolBarRendererComponent {
96
111
  if (this.isSpacer) {
97
112
  return MIN_SPACER_WIDTH;
98
113
  }
114
+ if (!this.internalComponentRef) {
115
+ return;
116
+ }
99
117
  return this.tool.overflows ? 0 : outerWidth(this.internalComponentRef);
100
118
  }
101
119
  isDisplayed() {
@@ -103,7 +121,13 @@ export class ToolBarRendererComponent {
103
121
  }
104
122
  refresh() {
105
123
  this.tool.location = this.location;
106
- if (this.resizable && this.internalComponentRef) {
124
+ if (!isPresent(this.internalComponentRef)) {
125
+ return;
126
+ }
127
+ if (this.tool.isHidden) {
128
+ this.hideTool();
129
+ }
130
+ else if (this.resizable) {
107
131
  if (this.location === 'toolbar') {
108
132
  this.renderer.setStyle(this.internalComponentRef, 'visibility', this.tool.visibility);
109
133
  this.renderer.setStyle(this.internalComponentRef, 'display', this.tool.toolbarDisplay);
@@ -111,8 +135,12 @@ export class ToolBarRendererComponent {
111
135
  else {
112
136
  this.renderer.setStyle(this.internalComponentRef, 'display', this.tool.overflowDisplay);
113
137
  }
114
- this.updateTools();
115
138
  }
139
+ else {
140
+ this.renderer.setStyle(this.internalComponentRef, 'visibility', 'visible');
141
+ this.renderer.setStyle(this.internalComponentRef, 'display', 'inline-flex');
142
+ }
143
+ this.updateTools();
116
144
  }
117
145
  setAttribute(element, attr, value) {
118
146
  this.renderer.setAttribute(element, attr, value);
@@ -138,6 +166,10 @@ export class ToolBarRendererComponent {
138
166
  }
139
167
  }
140
168
  }
169
+ hideTool() {
170
+ this.renderer.setStyle(this.internalComponentRef, 'visibility', 'hidden');
171
+ this.renderer.setStyle(this.internalComponentRef, 'display', 'none');
172
+ }
141
173
  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
174
  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
175
  }
@@ -21,7 +21,7 @@ import { take, takeUntil } from 'rxjs/operators';
21
21
  import { filter } from 'rxjs/operators';
22
22
  import { isDocumentAvailable } from '@progress/kendo-angular-common';
23
23
  import { caretAltLeftIcon, caretAltRightIcon, moreHorizontalIcon, moreVerticalIcon } from '@progress/kendo-svg-icons';
24
- import { ButtonComponent, ButtonGroupComponent } from '@progress/kendo-angular-buttons';
24
+ import { ButtonComponent } from '@progress/kendo-angular-buttons';
25
25
  import { NgFor, NgIf, NgClass, NgTemplateOutlet } from '@angular/common';
26
26
  import { LocalizedToolbarMessagesDirective } from './localization/localized-toolbar-messages.directive';
27
27
  import { ToolbarToolsService } from './tools/tools.service';
@@ -178,6 +178,36 @@ 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
+ set showIcon(value) {
186
+ if (this._showIcon === value) {
187
+ return;
188
+ }
189
+ const normalizedValue = this.normalizeDisplayValue(value);
190
+ this._showIcon = value;
191
+ this.propertyChange.emit({
192
+ property: 'showIcon',
193
+ value: normalizedValue
194
+ });
195
+ }
196
+ /**
197
+ * Specifies the text visibility for all tools in the ToolBar.
198
+ * This can be overridden by the `showText` property of each tool.
199
+ */
200
+ set showText(value) {
201
+ if (this._showText === value) {
202
+ return;
203
+ }
204
+ const normalizedValue = this.normalizeDisplayValue(value);
205
+ this._showText = value;
206
+ this.propertyChange.emit({
207
+ property: 'showText',
208
+ value: normalizedValue
209
+ });
210
+ }
181
211
  /**
182
212
  * Fires when the overflow popup of the ToolBar is opened.
183
213
  */
@@ -234,6 +264,10 @@ export class ToolBarComponent {
234
264
  * @hidden
235
265
  */
236
266
  nextButtonIcon = caretAltRightIcon;
267
+ /**
268
+ * @hidden
269
+ */
270
+ propertyChange = new EventEmitter();
237
271
  hostClass = true;
238
272
  get scrollableClass() {
239
273
  return this.isScrollMode;
@@ -252,6 +286,8 @@ export class ToolBarComponent {
252
286
  cachedGap;
253
287
  _size = DEFAULT_SIZE;
254
288
  _fillMode = DEFAULT_FILL_MODE;
289
+ _showText = 'always';
290
+ _showIcon = 'always';
255
291
  overflowButtonClickedTime = null;
256
292
  showAutoButtons = false;
257
293
  scrollButtonStateChangeSub;
@@ -789,10 +825,10 @@ export class ToolBarComponent {
789
825
  if (containerWidth > childrenWidth) {
790
826
  for (let i = this.overflowTools.length - 1; i >= 0; i--) {
791
827
  width = this.showFirstHiddenTool(containerWidth, childrenWidth);
792
- if (width) {
828
+ if (width > 0) {
793
829
  childrenWidth += width + this.gap;
794
830
  }
795
- else {
831
+ else if (width === 0) {
796
832
  break;
797
833
  }
798
834
  }
@@ -827,7 +863,7 @@ export class ToolBarComponent {
827
863
  tool.overflows = true;
828
864
  }
829
865
  this.refreshService.refresh(tool);
830
- return renderedElement.width; // returns 0 if `overflows` is true
866
+ return tool.isHidden ? -1 : renderedElement.width; // returns 0 if `overflows` is true and -1 if the tool is hidden
831
867
  }
832
868
  setPopupContentDimensions(isSection) {
833
869
  const popupContentContainer = this.popupRef.popup.instance.contentContainer.nativeElement;
@@ -953,8 +989,14 @@ export class ToolBarComponent {
953
989
  }
954
990
  });
955
991
  }
992
+ normalizeDisplayValue(value) {
993
+ if (typeof value === 'boolean') {
994
+ return value ? 'always' : 'never';
995
+ }
996
+ return value;
997
+ }
956
998
  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: [
999
+ 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
1000
  RefreshService,
959
1001
  NavigationService,
960
1002
  LocalizationService,
@@ -1380,7 +1422,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
1380
1422
  <kendo-resize-sensor *ngIf="overflowEnabled" #resizeSensor></kendo-resize-sensor>
1381
1423
  `,
1382
1424
  standalone: true,
1383
- imports: [NgTemplateOutlet, LocalizedToolbarMessagesDirective, NgFor, ToolBarRendererComponent, NgIf, ButtonComponent, NgClass, ResizeSensorComponent, ButtonGroupComponent, ToolbarScrollableButtonComponent]
1425
+ imports: [NgTemplateOutlet, LocalizedToolbarMessagesDirective, NgFor, ToolBarRendererComponent, NgIf, ButtonComponent, NgClass, ResizeSensorComponent, ToolbarScrollableButtonComponent]
1384
1426
  }]
1385
1427
  }], ctorParameters: function () { return [{ type: i1.LocalizationService }, { type: i2.PopupService }, { type: i3.RefreshService }, { type: i4.NavigationService }, { type: i0.ElementRef }, { type: i0.NgZone }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }, { type: i5.ToolbarToolsService }, { type: i6.ScrollService }]; }, propDecorators: { overflow: [{
1386
1428
  type: Input
@@ -1397,6 +1439,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
1397
1439
  }], tabIndex: [{
1398
1440
  type: Input,
1399
1441
  args: ['tabIndex']
1442
+ }], showIcon: [{
1443
+ type: Input
1444
+ }], showText: [{
1445
+ type: Input
1400
1446
  }], open: [{
1401
1447
  type: Output
1402
1448
  }], close: [{