@progress/kendo-angular-buttons 6.4.0 → 7.0.0-dev.202201101733

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.
Files changed (82) hide show
  1. package/dist/cdn/js/kendo-angular-buttons.js +2 -2
  2. package/dist/cdn/main.js +1 -1
  3. package/dist/es/button/button.directive.js +239 -89
  4. package/dist/es/button/button.service.js +1 -5
  5. package/dist/es/buttongroup/buttongroup.component.js +1 -53
  6. package/dist/es/chip/chip-list.component.js +54 -7
  7. package/dist/es/chip/chip.component.js +175 -86
  8. package/dist/es/{chip/models/chip-look.js → common/models/fillmode.js} +0 -0
  9. package/dist/es/{chip/models/type.js → common/models/rounded.js} +0 -0
  10. package/dist/{es2015/button-look.js → es/common/models/styling-classes.js} +0 -0
  11. package/dist/es/{button-look.js → common/models.js} +0 -0
  12. package/dist/es/dropdownbutton/dropdownbutton.component.js +74 -33
  13. package/dist/es/floatingactionbutton/dial-item.component.js +1 -1
  14. package/dist/es/floatingactionbutton/floatingactionbutton.component.js +66 -41
  15. package/dist/es/focusable/focusable.directive.js +4 -4
  16. package/dist/es/listbutton/list-button.js +1 -1
  17. package/dist/es/listbutton/list.component.js +20 -1
  18. package/dist/es/package-metadata.js +1 -1
  19. package/dist/es/splitbutton/splitbutton.component.js +91 -33
  20. package/dist/es/util.js +52 -0
  21. package/dist/es2015/button/button.directive.d.ts +85 -22
  22. package/dist/es2015/button/button.directive.js +222 -85
  23. package/dist/es2015/button/button.service.d.ts +1 -4
  24. package/dist/es2015/button/button.service.js +1 -5
  25. package/dist/es2015/buttongroup/buttongroup.component.d.ts +0 -15
  26. package/dist/es2015/buttongroup/buttongroup.component.js +1 -41
  27. package/dist/es2015/chip/chip-list.component.d.ts +19 -3
  28. package/dist/es2015/chip/chip-list.component.js +49 -7
  29. package/dist/es2015/chip/chip.component.d.ts +67 -32
  30. package/dist/es2015/chip/chip.component.js +186 -97
  31. package/dist/es2015/common/models/fillmode.d.ts +12 -0
  32. package/dist/es2015/{chip/models/type.js → common/models/fillmode.js} +0 -0
  33. package/dist/es2015/common/models/rounded.d.ts +12 -0
  34. package/dist/es2015/common/models/rounded.js +4 -0
  35. package/dist/es2015/common/models/shape.d.ts +2 -9
  36. package/dist/es2015/common/models/size.d.ts +9 -6
  37. package/dist/es2015/common/models/styling-classes.d.ts +11 -0
  38. package/dist/es2015/common/models/styling-classes.js +4 -0
  39. package/dist/es2015/common/models/theme-color.d.ts +15 -4
  40. package/dist/es2015/common/models.d.ts +10 -0
  41. package/dist/es2015/{chip/models/chip-look.js → common/models.js} +0 -0
  42. package/dist/es2015/dropdownbutton/dropdownbutton.component.d.ts +58 -7
  43. package/dist/es2015/dropdownbutton/dropdownbutton.component.js +81 -28
  44. package/dist/es2015/floatingactionbutton/dial-item.component.js +1 -1
  45. package/dist/es2015/floatingactionbutton/floatingactionbutton.component.d.ts +28 -21
  46. package/dist/es2015/floatingactionbutton/floatingactionbutton.component.js +62 -42
  47. package/dist/es2015/focusable/focusable.directive.js +4 -4
  48. package/dist/es2015/index.metadata.json +1 -1
  49. package/dist/es2015/listbutton/list-button.js +1 -1
  50. package/dist/es2015/listbutton/list.component.d.ts +3 -0
  51. package/dist/es2015/listbutton/list.component.js +37 -20
  52. package/dist/es2015/main.d.ts +4 -4
  53. package/dist/es2015/package-metadata.js +1 -1
  54. package/dist/es2015/splitbutton/splitbutton.component.d.ts +53 -7
  55. package/dist/es2015/splitbutton/splitbutton.component.js +101 -29
  56. package/dist/es2015/util.d.ts +21 -0
  57. package/dist/es2015/util.js +52 -0
  58. package/dist/fesm2015/index.js +832 -395
  59. package/dist/fesm5/index.js +817 -393
  60. package/dist/npm/button/button.directive.js +239 -89
  61. package/dist/npm/button/button.service.js +0 -4
  62. package/dist/npm/buttongroup/buttongroup.component.js +1 -53
  63. package/dist/npm/chip/chip-list.component.js +52 -5
  64. package/dist/npm/chip/chip.component.js +173 -84
  65. package/dist/npm/{chip/models/chip-look.js → common/models/fillmode.js} +0 -0
  66. package/dist/npm/{chip/models/type.js → common/models/rounded.js} +0 -0
  67. package/dist/npm/common/models/styling-classes.js +6 -0
  68. package/dist/npm/{button-look.js → common/models.js} +0 -0
  69. package/dist/npm/dropdownbutton/dropdownbutton.component.js +74 -33
  70. package/dist/npm/floatingactionbutton/dial-item.component.js +1 -1
  71. package/dist/npm/floatingactionbutton/floatingactionbutton.component.js +66 -41
  72. package/dist/npm/focusable/focusable.directive.js +4 -4
  73. package/dist/npm/listbutton/list-button.js +1 -1
  74. package/dist/npm/listbutton/list.component.js +20 -1
  75. package/dist/npm/package-metadata.js +1 -1
  76. package/dist/npm/splitbutton/splitbutton.component.js +89 -31
  77. package/dist/npm/util.js +52 -0
  78. package/dist/systemjs/kendo-angular-buttons.js +1 -1
  79. package/package.json +18 -15
  80. package/dist/es2015/button-look.d.ts +0 -21
  81. package/dist/es2015/chip/models/chip-look.d.ts +0 -20
  82. package/dist/es2015/chip/models/type.d.ts +0 -21
@@ -71,11 +71,12 @@ var NAVIGATION_SETTINGS_PROVIDER = {
71
71
  */
72
72
  var SplitButtonComponent = /** @class */ (function (_super) {
73
73
  tslib_1.__extends(SplitButtonComponent, _super);
74
- function SplitButtonComponent(focusService, navigationService, wrapperRef, zone, popupService, elRef, localization, cdr) {
74
+ function SplitButtonComponent(focusService, navigationService, wrapperRef, zone, popupService, elRef, localization, cdr, renderer) {
75
75
  var _this = _super.call(this, focusService, navigationService, wrapperRef, zone, localization, cdr) || this;
76
76
  _this.popupService = popupService;
77
77
  _this.elRef = elRef;
78
78
  _this.localization = localization;
79
+ _this.renderer = renderer;
79
80
  /**
80
81
  * Sets the text of the SplitButton.
81
82
  */
@@ -100,13 +101,46 @@ var SplitButtonComponent = /** @class */ (function (_super) {
100
101
  */
101
102
  _this.imageUrl = '';
102
103
  /**
103
- * Changes the visual appearance by using alternative styling options.
104
+ * The size property specifies the width and height of the SplitButton
105
+ * ([see example]({% slug api_buttons_splitbuttoncomponent %}#toc-size)).
106
+ *
107
+ * The possible values are:
108
+ * * `'small'`
109
+ * * `'medium'` (default)
110
+ * * `'large'`
111
+ * * `null`
112
+ */
113
+ _this.size = 'medium';
114
+ /**
115
+ * The fillMode property specifies the background and border styles of the SplitButton
116
+ * ([see example]({% slug api_buttons_splitbuttoncomponent %}#toc-fillMode)).
104
117
  *
105
118
  * The available values are:
119
+ * * `solid` (default)
106
120
  * * `flat`
107
121
  * * `outline`
122
+ * * `link`
123
+ */
124
+ _this.fillMode = 'solid';
125
+ /**
126
+ * The SplitButton allows you to specify predefined theme colors.
127
+ * The theme color will be applied as a background and border color while also amending the text color accordingly
128
+ * ([see example]({% slug api_buttons_splitbuttoncomponent %}#toc-themeColor)).
129
+ *
130
+ * The possible values are:
131
+ * * `base` —Applies coloring based on the `base` theme color. (default)
132
+ * * `primary` —Applies coloring based on the `primary` theme color.
133
+ * * `secondary`—Applies coloring based on the `secondary` theme color.
134
+ * * `tertiary`— Applies coloring based on the `tertiary` theme color.
135
+ * * `info`—Applies coloring based on the `info` theme color.
136
+ * * `success`— Applies coloring based on the `success` theme color.
137
+ * * `warning`— Applies coloring based on the `warning` theme color.
138
+ * * `error`— Applies coloring based on the `error` theme color.
139
+ * * `dark`— Applies coloring based on the `dark` theme color.
140
+ * * `light`— Applies coloring based on the `light` theme color.
141
+ * * `inverse`— Applies coloring based on the `inverse` theme color.
108
142
  */
109
- _this.look = 'default';
143
+ _this.themeColor = 'base';
110
144
  /**
111
145
  * Specifies the [`tabIndex`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the component.
112
146
  */
@@ -191,10 +225,33 @@ var SplitButtonComponent = /** @class */ (function (_super) {
191
225
  _this.activeArrow = false;
192
226
  _this.buttonText = '';
193
227
  _this.lockFocus = false;
228
+ _this._rounded = 'medium';
194
229
  _this._itemClick = _this.itemClick;
195
230
  _this._blur = _this.onBlur;
196
231
  return _this;
197
232
  }
233
+ Object.defineProperty(SplitButtonComponent.prototype, "rounded", {
234
+ get: function () {
235
+ return this._rounded;
236
+ },
237
+ /**
238
+ * The rounded property specifies the border radius of the SplitButton
239
+ * ([see example]({% slug api_buttons_splitbuttoncomponent %}#toc-rounded)).
240
+ *
241
+ * The possible values are:
242
+ * * `'small'`
243
+ * * `'medium'` (default)
244
+ * * `'large'`
245
+ * * `'full'`
246
+ * * `null`
247
+ */
248
+ set: function (rounded) {
249
+ this.handleClasses(rounded, 'rounded');
250
+ this._rounded = rounded;
251
+ },
252
+ enumerable: true,
253
+ configurable: true
254
+ });
198
255
  Object.defineProperty(SplitButtonComponent.prototype, "disabled", {
199
256
  get: function () {
200
257
  return this._disabled;
@@ -308,20 +365,6 @@ var SplitButtonComponent = /** @class */ (function (_super) {
308
365
  enumerable: true,
309
366
  configurable: true
310
367
  });
311
- Object.defineProperty(SplitButtonComponent.prototype, "isFlat", {
312
- get: function () {
313
- return this.look === 'flat';
314
- },
315
- enumerable: true,
316
- configurable: true
317
- });
318
- Object.defineProperty(SplitButtonComponent.prototype, "isOutline", {
319
- get: function () {
320
- return this.look === 'outline';
321
- },
322
- enumerable: true,
323
- configurable: true
324
- });
325
368
  Object.defineProperty(SplitButtonComponent.prototype, "widgetClasses", {
326
369
  get: function () {
327
370
  return true;
@@ -420,6 +463,7 @@ var SplitButtonComponent = /** @class */ (function (_super) {
420
463
  */
421
464
  SplitButtonComponent.prototype.ngAfterViewInit = function () {
422
465
  this.updateButtonText();
466
+ this.handleClasses(this.rounded, 'rounded');
423
467
  };
424
468
  /**
425
469
  * @hidden
@@ -586,6 +630,16 @@ var SplitButtonComponent = /** @class */ (function (_super) {
586
630
  this.popupRef = null;
587
631
  }
588
632
  };
633
+ SplitButtonComponent.prototype.handleClasses = function (value, input) {
634
+ var elem = this.wrapperRef.nativeElement;
635
+ var classes = util_2.getStylingClasses('button', input, this[input], value);
636
+ if (classes.toRemove) {
637
+ this.renderer.removeClass(elem, classes.toRemove);
638
+ }
639
+ if (classes.toAdd) {
640
+ this.renderer.addClass(elem, classes.toAdd);
641
+ }
642
+ };
589
643
  tslib_1.__decorate([
590
644
  core_1.Input(),
591
645
  tslib_1.__metadata("design:type", String)
@@ -609,7 +663,20 @@ var SplitButtonComponent = /** @class */ (function (_super) {
609
663
  tslib_1.__decorate([
610
664
  core_1.Input(),
611
665
  tslib_1.__metadata("design:type", String)
612
- ], SplitButtonComponent.prototype, "look", void 0);
666
+ ], SplitButtonComponent.prototype, "size", void 0);
667
+ tslib_1.__decorate([
668
+ core_1.Input(),
669
+ tslib_1.__metadata("design:type", String),
670
+ tslib_1.__metadata("design:paramtypes", [String])
671
+ ], SplitButtonComponent.prototype, "rounded", null);
672
+ tslib_1.__decorate([
673
+ core_1.Input(),
674
+ tslib_1.__metadata("design:type", String)
675
+ ], SplitButtonComponent.prototype, "fillMode", void 0);
676
+ tslib_1.__decorate([
677
+ core_1.Input(),
678
+ tslib_1.__metadata("design:type", String)
679
+ ], SplitButtonComponent.prototype, "themeColor", void 0);
613
680
  tslib_1.__decorate([
614
681
  core_1.Input(),
615
682
  tslib_1.__metadata("design:type", Boolean),
@@ -690,20 +757,10 @@ var SplitButtonComponent = /** @class */ (function (_super) {
690
757
  tslib_1.__metadata("design:type", core_1.ViewContainerRef)
691
758
  ], SplitButtonComponent.prototype, "containerRef", void 0);
692
759
  tslib_1.__decorate([
693
- core_1.HostBinding('class.k-state-focused'),
760
+ core_1.HostBinding('class.k-focus'),
694
761
  tslib_1.__metadata("design:type", Boolean),
695
762
  tslib_1.__metadata("design:paramtypes", [Boolean])
696
763
  ], SplitButtonComponent.prototype, "isFocused", null);
697
- tslib_1.__decorate([
698
- core_1.HostBinding('class.k-flat'),
699
- tslib_1.__metadata("design:type", Boolean),
700
- tslib_1.__metadata("design:paramtypes", [])
701
- ], SplitButtonComponent.prototype, "isFlat", null);
702
- tslib_1.__decorate([
703
- core_1.HostBinding('class.k-outline'),
704
- tslib_1.__metadata("design:type", Boolean),
705
- tslib_1.__metadata("design:paramtypes", [])
706
- ], SplitButtonComponent.prototype, "isOutline", null);
707
764
  tslib_1.__decorate([
708
765
  core_1.HostBinding('class.k-split-button'),
709
766
  core_1.HostBinding('class.k-button-group'),
@@ -747,7 +804,7 @@ var SplitButtonComponent = /** @class */ (function (_super) {
747
804
  }
748
805
  ],
749
806
  selector: 'kendo-splitbutton',
750
- template: "\n <ng-container kendoSplitButtonLocalizedMessages\n i18n-splitButtonLabel=\"kendo.splitbutton.splitButtonLabel|The text for the SplitButton aria-label\"\n splitButtonLabel=\"{{ '{buttonText} splitbutton' }}\">\n </ng-container>\n <button\n kendoButton\n #button\n [type]=\"type\"\n [look]=\"look\"\n [tabindex]=\"componentTabIndex\"\n [disabled]=\"disabled\"\n [icon]=\"icon\"\n [class.k-state-active]=\"active\"\n [iconClass]=\"iconClass\"\n [imageUrl]=\"imageUrl\"\n [ngClass]=\"buttonClass\"\n (focus)=\"onButtonFocus()\"\n (click)=\"onButtonClick()\"\n (blur)=\"onButtonBlur()\"\n (mousedown)=\"toggleButtonActiveState(true)\"\n (mouseup)=\"toggleButtonActiveState(false)\"\n [attr.aria-disabled]=\"disabled\"\n [attr.aria-expanded]=\"openState\"\n [attr.aria-haspopup]=\"true\"\n [attr.aria-owns]=\"listId\"\n [attr.aria-label]=\"ariaLabel\"\n >\n {{ text }}<ng-content></ng-content>\n </button>\n <button\n kendoButton\n #arrowButton\n type=\"button\"\n [class.k-state-active]=\"activeArrow\"\n [disabled]=\"disabled\"\n [icon]=\"arrowButtonIcon\"\n [look]=\"look\"\n [tabindex]=\"-1\"\n [ngClass]=\"arrowButtonClass\"\n (click)=\"onArrowButtonClick()\"\n (mousedown)=\"toggleArrowButtonActiveState(true)\"\n (mouseup)=\"toggleArrowButtonActiveState(false)\"\n ></button>\n <ng-template #popupTemplate>\n <kendo-button-list\n [id]=\"listId\"\n [data]=\"data\"\n [textField]=\"textField\"\n [itemTemplate]=\"itemTemplate\"\n (onItemClick)=\"onItemClick($event)\"\n (keydown)=\"keyDownHandler($event)\"\n (keypress)=\"keyPressHandler($event)\"\n (keyup)=\"keyUpHandler($event)\"\n [attr.dir]=\"dir\"\n >\n </kendo-button-list>\n </ng-template>\n <ng-container #container></ng-container>\n "
807
+ template: "\n <ng-container kendoSplitButtonLocalizedMessages\n i18n-splitButtonLabel=\"kendo.splitbutton.splitButtonLabel|The text for the SplitButton aria-label\"\n splitButtonLabel=\"{{ '{buttonText} splitbutton' }}\">\n </ng-container>\n <button\n kendoButton\n #button\n [type]=\"type\"\n [tabindex]=\"componentTabIndex\"\n [disabled]=\"disabled\"\n [size]=\"size\"\n [rounded]=\"rounded\"\n [fillMode]=\"fillMode\"\n [themeColor]=\"themeColor\"\n [icon]=\"icon\"\n [class.k-active]=\"active\"\n [class.k-icon-button]=\"!text && icon\"\n [iconClass]=\"iconClass\"\n [imageUrl]=\"imageUrl\"\n [ngClass]=\"buttonClass\"\n (focus)=\"onButtonFocus()\"\n (click)=\"onButtonClick()\"\n (blur)=\"onButtonBlur()\"\n (mousedown)=\"toggleButtonActiveState(true)\"\n (mouseup)=\"toggleButtonActiveState(false)\"\n [attr.aria-disabled]=\"disabled\"\n [attr.aria-expanded]=\"openState\"\n [attr.aria-haspopup]=\"true\"\n [attr.aria-owns]=\"listId\"\n [attr.aria-label]=\"ariaLabel\"\n >\n <span *ngIf=\"text\" class=\"k-button-text\">\n {{ text }}\n </span><ng-content></ng-content>\n </button>\n <button\n kendoButton\n #arrowButton\n type=\"button\"\n [class.k-active]=\"activeArrow\"\n [disabled]=\"disabled\"\n [icon]=\"arrowButtonIcon\"\n [size]=\"size\"\n [rounded]=\"rounded\"\n [fillMode]=\"fillMode\"\n [themeColor]=\"fillMode ? themeColor : null\"\n [tabindex]=\"-1\"\n [ngClass]=\"arrowButtonClass\"\n (click)=\"onArrowButtonClick()\"\n (mousedown)=\"toggleArrowButtonActiveState(true)\"\n (mouseup)=\"toggleArrowButtonActiveState(false)\"\n ></button>\n <ng-template #popupTemplate>\n <kendo-button-list\n [id]=\"listId\"\n [data]=\"data\"\n [textField]=\"textField\"\n [itemTemplate]=\"itemTemplate\"\n (onItemClick)=\"onItemClick($event)\"\n (keydown)=\"keyDownHandler($event)\"\n (keypress)=\"keyPressHandler($event)\"\n (keyup)=\"keyUpHandler($event)\"\n [attr.dir]=\"dir\"\n [size]=\"size\"\n >\n </kendo-button-list>\n </ng-template>\n <ng-container #container></ng-container>\n "
751
808
  }),
752
809
  tslib_1.__metadata("design:paramtypes", [focus_service_1.FocusService,
753
810
  navigation_service_1.NavigationService,
@@ -756,7 +813,8 @@ var SplitButtonComponent = /** @class */ (function (_super) {
756
813
  kendo_angular_popup_1.PopupService,
757
814
  core_1.ElementRef,
758
815
  kendo_angular_l10n_1.LocalizationService,
759
- core_1.ChangeDetectorRef])
816
+ core_1.ChangeDetectorRef,
817
+ core_1.Renderer2])
760
818
  ], SplitButtonComponent);
761
819
  return SplitButtonComponent;
762
820
  }(list_button_1.ListButton));
package/dist/npm/util.js CHANGED
@@ -46,3 +46,55 @@ exports.closest = closest;
46
46
  exports.replaceMessagePlaceholder = function (message, name, value) {
47
47
  return message.replace(new RegExp("{\\s*" + name + "\\s*}", 'g'), value);
48
48
  };
49
+ /**
50
+ * @hidden
51
+ */
52
+ exports.SIZES = {
53
+ small: 'sm',
54
+ medium: 'md',
55
+ large: 'lg'
56
+ };
57
+ var ROUNDNESS = {
58
+ small: 'sm',
59
+ medium: 'md',
60
+ large: 'lg',
61
+ full: 'full'
62
+ };
63
+ /**
64
+ * @hidden
65
+ *
66
+ * Returns the styling classes to be added and removed
67
+ */
68
+ exports.getStylingClasses = function (componentType, stylingOption, previousValue, newValue) {
69
+ switch (stylingOption) {
70
+ case 'size':
71
+ return {
72
+ toRemove: "k-" + componentType + "-" + exports.SIZES[previousValue],
73
+ toAdd: newValue ? "k-" + componentType + "-" + exports.SIZES[newValue] : null
74
+ };
75
+ case 'rounded':
76
+ return {
77
+ toRemove: "k-rounded-" + ROUNDNESS[previousValue],
78
+ toAdd: newValue ? "k-rounded-" + ROUNDNESS[newValue] : null
79
+ };
80
+ case 'fillMode':
81
+ case 'shape':
82
+ return {
83
+ toRemove: "k-" + componentType + "-" + previousValue,
84
+ toAdd: newValue ? "k-" + componentType + "-" + newValue : null
85
+ };
86
+ default:
87
+ break;
88
+ }
89
+ };
90
+ /**
91
+ * @hidden
92
+ *
93
+ * Returns the themeColor classes to be added and removed
94
+ */
95
+ exports.getThemeColorClasses = function (componentType, prevFillMode, fillMode, previousValue, newValue) {
96
+ return {
97
+ toRemove: "k-" + componentType + "-" + prevFillMode + "-" + previousValue,
98
+ toAdd: newValue ? "k-" + componentType + "-" + fillMode + "-" + newValue : null
99
+ };
100
+ };