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

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.
@@ -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,7 +31,7 @@ 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;
@@ -38,9 +41,14 @@ export class ToolBarDropDownButtonComponent extends ToolBarToolComponent {
38
41
  return this._showText;
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;
51
+ }
44
52
  /**
45
53
  * Sets the text of the DropDownButton
46
54
  * ([see example](slug:controltypes_toolbar#toc-drop-down-buttons)).
@@ -215,26 +223,40 @@ 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;
229
+ propertyChangeSub;
220
230
  getNextKey;
221
231
  getPrevKey;
222
- constructor(zone, renderer) {
232
+ constructor(zone, renderer, host) {
223
233
  super();
224
234
  this.zone = zone;
225
235
  this.renderer = renderer;
236
+ this.host = host;
226
237
  this.getNextKey = getNextKey();
227
238
  this.getPrevKey = getPrevKey();
228
239
  this.isBuiltInTool = true;
240
+ this.propertyChangeSub = this.host.propertyChange.subscribe(change => {
241
+ if (change.property === 'showText' || change.property === 'showIcon') {
242
+ this[change.property] = change.value;
243
+ }
244
+ });
229
245
  }
230
246
  ngOnInit() {
231
247
  this.setTextDisplayMode();
232
248
  }
249
+ ngOnDestroy() {
250
+ if (this.propertyChangeSub) {
251
+ this.propertyChangeSub.unsubscribe();
252
+ this.propertyChangeSub = null;
253
+ }
254
+ }
233
255
  ngAfterViewInit() {
234
256
  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');
257
+ const dropdownButton = this[`${this.location}DropDownButton`];
258
+ if (dropdownButton?.button) {
259
+ this.renderer.addClass(dropdownButton.button.nativeElement, 'k-toolbar-menu-button');
238
260
  }
239
261
  });
240
262
  }
@@ -246,6 +268,12 @@ export class ToolBarDropDownButtonComponent extends ToolBarToolComponent {
246
268
  .toArray()
247
269
  .findIndex(b => b.nativeElement.contains(ev.target));
248
270
  }
271
+ /**
272
+ * @hidden
273
+ */
274
+ get size() {
275
+ return this.host.size;
276
+ }
249
277
  /**
250
278
  * @hidden
251
279
  */
@@ -288,7 +316,6 @@ export class ToolBarDropDownButtonComponent extends ToolBarToolComponent {
288
316
  if (dataItem) {
289
317
  return this.textField ? dataItem[this.textField] : dataItem.text || dataItem;
290
318
  }
291
- return undefined;
292
319
  }
293
320
  /**
294
321
  * @hidden
@@ -307,10 +334,10 @@ export class ToolBarDropDownButtonComponent extends ToolBarToolComponent {
307
334
  }
308
335
  }
309
336
  setTextDisplayMode() {
310
- this.toolbarOptions.text = this.showText === 'overflow' ? undefined : this.text;
311
- this.overflowOptions.text = this.showText === 'toolbar' ? undefined : this.text;
337
+ this.toolbarOptions.text = this.showText === 'menu' || this.showText === 'never' ? undefined : this.text;
338
+ this.overflowOptions.text = this.showText === 'toolbar' || this.showText === 'never' ? undefined : this.text;
312
339
  }
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 });
340
+ 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
341
  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
342
  <ng-template #toolbarTemplate>
316
343
  <kendo-dropdownbutton #toolbarDropDownButton
@@ -321,6 +348,7 @@ export class ToolBarDropDownButtonComponent extends ToolBarToolComponent {
321
348
  [arrowIcon]="arrowIcon"
322
349
  [buttonClass]="buttonClass"
323
350
  [disabled]="disabled"
351
+ [size]="size"
324
352
  [tabIndex]="-1"
325
353
  [data]="data"
326
354
  [buttonAttributes]="{'title': title}"
@@ -386,6 +414,7 @@ export class ToolBarDropDownButtonComponent extends ToolBarToolComponent {
386
414
  [arrowIcon]="arrowIcon"
387
415
  [buttonClass]="buttonClass"
388
416
  [disabled]="disabled"
417
+ [size]="size"
389
418
  [tabIndex]="-1"
390
419
  [data]="data"
391
420
  [buttonAttributes]="{'title': title}"
@@ -418,6 +447,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
418
447
  [arrowIcon]="arrowIcon"
419
448
  [buttonClass]="buttonClass"
420
449
  [disabled]="disabled"
450
+ [size]="size"
421
451
  [tabIndex]="-1"
422
452
  [data]="data"
423
453
  [buttonAttributes]="{'title': title}"
@@ -483,6 +513,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
483
513
  [arrowIcon]="arrowIcon"
484
514
  [buttonClass]="buttonClass"
485
515
  [disabled]="disabled"
516
+ [size]="size"
486
517
  [tabIndex]="-1"
487
518
  [data]="data"
488
519
  [buttonAttributes]="{'title': title}"
@@ -501,7 +532,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
501
532
  standalone: true,
502
533
  imports: [DropDownButtonComponent, NgClass, NgIf, IconWrapperComponent, NgFor]
503
534
  }]
504
- }], ctorParameters: function () { return [{ type: i0.NgZone }, { type: i0.Renderer2 }]; }, propDecorators: { arrowIcon: [{
535
+ }], ctorParameters: function () { return [{ type: i0.NgZone }, { type: i0.Renderer2 }, { type: i1.ToolBarComponent }]; }, propDecorators: { arrowIcon: [{
505
536
  type: Input
506
537
  }], title: [{
507
538
  type: Input
@@ -9,14 +9,17 @@ 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 { 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 SplitButton for Angular](slug:controltypes_toolbar#toc-split-buttons).
15
17
  */
16
18
  export class ToolBarSplitButtonComponent extends ToolBarToolComponent {
19
+ host;
17
20
  // showText and showIcon showIcon should be declared first
18
21
  /**
19
- * Specifies where button text should be displayed
22
+ * Specifies the button text visibility.
20
23
  */
21
24
  set showText(value) {
22
25
  this._showText = value;
@@ -26,9 +29,15 @@ export class ToolBarSplitButtonComponent extends ToolBarToolComponent {
26
29
  return this._showText;
27
30
  }
28
31
  /**
29
- * Specifies where button icon should be displayed
32
+ * Specifies the button icon visibility.
30
33
  */
31
- showIcon = 'both';
34
+ set showIcon(value) {
35
+ this._showIcon = value;
36
+ this.setTextDisplayMode();
37
+ }
38
+ get showIcon() {
39
+ return this._showIcon;
40
+ }
32
41
  /**
33
42
  * Sets the text of the SplitButton ([see example](slug:controltypes_toolbar#toc-split-buttons)).
34
43
  */
@@ -209,25 +218,39 @@ export class ToolBarSplitButtonComponent extends ToolBarToolComponent {
209
218
  ngOnInit() {
210
219
  this.setTextDisplayMode();
211
220
  }
221
+ ngOnDestroy() {
222
+ if (this.propertyChangeSub) {
223
+ this.propertyChangeSub.unsubscribe();
224
+ this.propertyChangeSub = null;
225
+ }
226
+ }
212
227
  get overflowButtons() {
213
228
  return [this.overflowMainButton, ...this.overflowListItems.toArray().filter(el => !el.nativeElement.classList.contains('k-disabled'))];
214
229
  }
215
230
  _data;
216
231
  _popupSettings = { animate: true, popupClass: '' };
217
232
  focusedIndex = -1;
218
- _showText = 'both';
233
+ _showText;
234
+ _showIcon;
219
235
  _text;
236
+ propertyChangeSub;
220
237
  getNextKey;
221
238
  getPrevKey;
222
239
  toolbarSplitButton;
223
240
  sectionSplitButton;
224
241
  overflowMainButton;
225
242
  overflowListItems;
226
- constructor() {
243
+ constructor(host) {
227
244
  super();
245
+ this.host = host;
228
246
  this.getNextKey = getNextKey();
229
247
  this.getPrevKey = getPrevKey();
230
248
  this.isBuiltInTool = true;
249
+ this.propertyChangeSub = this.host.propertyChange.subscribe(change => {
250
+ if (change.property === 'showText' || change.property === 'showIcon') {
251
+ this[change.property] = change.value;
252
+ }
253
+ });
231
254
  }
232
255
  /**
233
256
  * @hidden
@@ -248,6 +271,12 @@ export class ToolBarSplitButtonComponent extends ToolBarToolComponent {
248
271
  canFocus() {
249
272
  return !this.disabled;
250
273
  }
274
+ /**
275
+ * @hidden
276
+ */
277
+ get size() {
278
+ return this.host.size;
279
+ }
251
280
  /**
252
281
  * @hidden
253
282
  */
@@ -284,7 +313,6 @@ export class ToolBarSplitButtonComponent extends ToolBarToolComponent {
284
313
  if (dataItem) {
285
314
  return this.textField ? dataItem[this.textField] : dataItem.text || dataItem;
286
315
  }
287
- return undefined;
288
316
  }
289
317
  /**
290
318
  * @hidden
@@ -303,10 +331,10 @@ export class ToolBarSplitButtonComponent extends ToolBarToolComponent {
303
331
  }
304
332
  }
305
333
  setTextDisplayMode() {
306
- this.toolbarOptions.text = this.showText === 'overflow' ? undefined : this.text;
307
- this.overflowOptions.text = this.showText === 'toolbar' ? undefined : this.text;
334
+ this.toolbarOptions.text = this.showText === 'menu' || this.showText === 'never' ? undefined : this.text;
335
+ this.overflowOptions.text = this.showText === 'toolbar' || this.showText === 'never' ? undefined : this.text;
308
336
  }
309
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ToolBarSplitButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
337
+ 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
338
  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
339
  <ng-template #toolbarTemplate>
312
340
  <kendo-splitbutton
@@ -323,6 +351,7 @@ export class ToolBarSplitButtonComponent extends ToolBarToolComponent {
323
351
  [arrowButtonIcon]="arrowButtonIcon"
324
352
  [arrowButtonSvgIcon]="arrowButtonSvgIcon"
325
353
  [disabled]="disabled"
354
+ [size]="size"
326
355
  [tabIndex]="-1"
327
356
  [textField]="textField"
328
357
  [popupSettings]="popupSettings"
@@ -392,6 +421,7 @@ export class ToolBarSplitButtonComponent extends ToolBarToolComponent {
392
421
  [arrowButtonIcon]="arrowButtonIcon"
393
422
  [arrowButtonSvgIcon]="arrowButtonSvgIcon"
394
423
  [disabled]="disabled"
424
+ [size]="size"
395
425
  [tabIndex]="-1"
396
426
  [textField]="textField"
397
427
  [popupSettings]="popupSettings"
@@ -427,6 +457,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
427
457
  [arrowButtonIcon]="arrowButtonIcon"
428
458
  [arrowButtonSvgIcon]="arrowButtonSvgIcon"
429
459
  [disabled]="disabled"
460
+ [size]="size"
430
461
  [tabIndex]="-1"
431
462
  [textField]="textField"
432
463
  [popupSettings]="popupSettings"
@@ -496,6 +527,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
496
527
  [arrowButtonIcon]="arrowButtonIcon"
497
528
  [arrowButtonSvgIcon]="arrowButtonSvgIcon"
498
529
  [disabled]="disabled"
530
+ [size]="size"
499
531
  [tabIndex]="-1"
500
532
  [textField]="textField"
501
533
  [popupSettings]="popupSettings"
@@ -511,7 +543,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
511
543
  standalone: true,
512
544
  imports: [SplitButtonComponent, NgClass, NgIf, IconWrapperComponent, NgFor]
513
545
  }]
514
- }], ctorParameters: function () { return []; }, propDecorators: { showText: [{
546
+ }], ctorParameters: function () { return [{ type: i1.ToolBarComponent }]; }, propDecorators: { showText: [{
515
547
  type: Input
516
548
  }], showIcon: [{
517
549
  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
  }