@progress/kendo-angular-buttons 6.4.1 → 7.0.0-dev.202201180832
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.
- package/LICENSE.md +1 -1
- package/NOTICE.txt +119 -79
- package/README.md +1 -1
- package/dist/cdn/js/kendo-angular-buttons.js +2 -2
- package/dist/cdn/main.js +1 -1
- package/dist/es/button/button.directive.js +236 -89
- package/dist/es/button/button.service.js +1 -5
- package/dist/es/buttongroup/buttongroup.component.js +11 -60
- package/dist/es/chip/chip-list.component.js +57 -7
- package/dist/es/chip/chip.component.js +175 -86
- package/dist/es/{chip/models/chip-look.js → common/models/fillmode.js} +0 -0
- package/dist/es/{chip/models/type.js → common/models/rounded.js} +0 -0
- package/dist/{es2015/button-look.js → es/common/models/styling-classes.js} +0 -0
- package/dist/es/{button-look.js → common/models.js} +0 -0
- package/dist/es/dropdownbutton/dropdownbutton.component.js +89 -36
- package/dist/es/floatingactionbutton/dial-item.component.js +1 -1
- package/dist/es/floatingactionbutton/floatingactionbutton.component.js +66 -41
- package/dist/es/focusable/focusable.directive.js +4 -4
- package/dist/es/listbutton/list-button.js +4 -1
- package/dist/es/listbutton/list.component.js +20 -1
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/splitbutton/splitbutton.component.js +107 -37
- package/dist/es/util.js +52 -0
- package/dist/es2015/button/button.directive.d.ts +85 -22
- package/dist/es2015/button/button.directive.js +219 -85
- package/dist/es2015/button/button.service.d.ts +1 -4
- package/dist/es2015/button/button.service.js +1 -5
- package/dist/es2015/buttongroup/buttongroup.component.d.ts +0 -15
- package/dist/es2015/buttongroup/buttongroup.component.js +11 -48
- package/dist/es2015/chip/chip-list.component.d.ts +19 -3
- package/dist/es2015/chip/chip-list.component.js +52 -7
- package/dist/es2015/chip/chip.component.d.ts +67 -32
- package/dist/es2015/chip/chip.component.js +186 -97
- package/dist/es2015/common/models/fillmode.d.ts +12 -0
- package/dist/es2015/{chip/models/type.js → common/models/fillmode.js} +0 -0
- package/dist/es2015/common/models/rounded.d.ts +12 -0
- package/dist/es2015/common/models/rounded.js +4 -0
- package/dist/es2015/common/models/shape.d.ts +2 -9
- package/dist/es2015/common/models/size.d.ts +9 -6
- package/dist/es2015/common/models/styling-classes.d.ts +11 -0
- package/dist/es2015/common/models/styling-classes.js +4 -0
- package/dist/es2015/common/models/theme-color.d.ts +15 -4
- package/dist/es2015/common/models.d.ts +10 -0
- package/dist/es2015/{chip/models/chip-look.js → common/models.js} +0 -0
- package/dist/es2015/dropdownbutton/dropdownbutton.component.d.ts +59 -7
- package/dist/es2015/dropdownbutton/dropdownbutton.component.js +92 -31
- package/dist/es2015/floatingactionbutton/dial-item.component.js +1 -1
- package/dist/es2015/floatingactionbutton/floatingactionbutton.component.d.ts +28 -21
- package/dist/es2015/floatingactionbutton/floatingactionbutton.component.js +62 -42
- package/dist/es2015/focusable/focusable.directive.js +4 -4
- package/dist/es2015/index.metadata.json +1 -1
- package/dist/es2015/listbutton/list-button.js +4 -1
- package/dist/es2015/listbutton/list.component.d.ts +3 -0
- package/dist/es2015/listbutton/list.component.js +37 -20
- package/dist/es2015/main.d.ts +4 -4
- package/dist/es2015/package-metadata.js +1 -1
- package/dist/es2015/splitbutton/splitbutton.component.d.ts +59 -12
- package/dist/es2015/splitbutton/splitbutton.component.js +113 -33
- package/dist/es2015/util.d.ts +21 -0
- package/dist/es2015/util.js +52 -0
- package/dist/fesm2015/index.js +862 -409
- package/dist/fesm5/index.js +853 -405
- package/dist/npm/button/button.directive.js +236 -89
- package/dist/npm/button/button.service.js +0 -4
- package/dist/npm/buttongroup/buttongroup.component.js +11 -60
- package/dist/npm/chip/chip-list.component.js +55 -5
- package/dist/npm/chip/chip.component.js +173 -84
- package/dist/npm/{chip/models/chip-look.js → common/models/fillmode.js} +0 -0
- package/dist/npm/{chip/models/type.js → common/models/rounded.js} +0 -0
- package/dist/npm/common/models/styling-classes.js +6 -0
- package/dist/npm/{button-look.js → common/models.js} +0 -0
- package/dist/npm/dropdownbutton/dropdownbutton.component.js +89 -36
- package/dist/npm/floatingactionbutton/dial-item.component.js +1 -1
- package/dist/npm/floatingactionbutton/floatingactionbutton.component.js +66 -41
- package/dist/npm/focusable/focusable.directive.js +4 -4
- package/dist/npm/listbutton/list-button.js +4 -1
- package/dist/npm/listbutton/list.component.js +20 -1
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/splitbutton/splitbutton.component.js +105 -35
- package/dist/npm/util.js +52 -0
- package/dist/systemjs/kendo-angular-buttons.js +1 -1
- package/package.json +14 -11
- package/dist/es2015/button-look.d.ts +0 -21
- package/dist/es2015/chip/models/chip-look.d.ts +0 -20
- package/dist/es2015/chip/models/type.d.ts +0 -21
|
@@ -12,6 +12,8 @@ var kendo_angular_common_1 = require("@progress/kendo-angular-common");
|
|
|
12
12
|
var button_service_1 = require("../button/button.service");
|
|
13
13
|
var util_1 = require("../util");
|
|
14
14
|
var preventable_event_1 = require("../preventable-event");
|
|
15
|
+
var package_metadata_1 = require("../package-metadata");
|
|
16
|
+
var kendo_licensing_1 = require("@progress/kendo-licensing");
|
|
15
17
|
/**
|
|
16
18
|
* @hidden
|
|
17
19
|
*/
|
|
@@ -28,23 +30,13 @@ var ButtonGroupComponent = /** @class */ (function () {
|
|
|
28
30
|
* By default, the selection mode of the ButtonGroup is set to `multiple`.
|
|
29
31
|
*/
|
|
30
32
|
this.selection = 'multiple';
|
|
31
|
-
/**
|
|
32
|
-
* Changes the visual appearance by using alternative styling options
|
|
33
|
-
* ([more information and examples]({% slug styling_buttongroup %})).
|
|
34
|
-
* The `look` property of the ButtonGroup takes precedence over the `look` property
|
|
35
|
-
* of the individual buttons that are part of the group.
|
|
36
|
-
*
|
|
37
|
-
* The available values are:
|
|
38
|
-
* * `flat`
|
|
39
|
-
* * `outline`
|
|
40
|
-
*/
|
|
41
|
-
this.look = 'default';
|
|
42
33
|
/**
|
|
43
34
|
* Fires every time keyboard navigation occurs.
|
|
44
35
|
*/
|
|
45
36
|
this.navigate = new core_1.EventEmitter();
|
|
46
37
|
this._tabIndex = 0;
|
|
47
38
|
this.currentTabIndex = 0;
|
|
39
|
+
kendo_licensing_1.validatePackage(package_metadata_1.packageMetadata);
|
|
48
40
|
this.localizationChangeSubscription = localization.changes.subscribe(function (_a) {
|
|
49
41
|
var rtl = _a.rtl;
|
|
50
42
|
return _this.direction = rtl ? 'rtl' : 'ltr';
|
|
@@ -85,27 +77,6 @@ var ButtonGroupComponent = /** @class */ (function () {
|
|
|
85
77
|
enumerable: true,
|
|
86
78
|
configurable: true
|
|
87
79
|
});
|
|
88
|
-
Object.defineProperty(ButtonGroupComponent.prototype, "isFlat", {
|
|
89
|
-
get: function () {
|
|
90
|
-
return this.look === 'flat';
|
|
91
|
-
},
|
|
92
|
-
enumerable: true,
|
|
93
|
-
configurable: true
|
|
94
|
-
});
|
|
95
|
-
Object.defineProperty(ButtonGroupComponent.prototype, "isBare", {
|
|
96
|
-
get: function () {
|
|
97
|
-
return this.look === 'bare';
|
|
98
|
-
},
|
|
99
|
-
enumerable: true,
|
|
100
|
-
configurable: true
|
|
101
|
-
});
|
|
102
|
-
Object.defineProperty(ButtonGroupComponent.prototype, "isOutline", {
|
|
103
|
-
get: function () {
|
|
104
|
-
return this.look === 'outline';
|
|
105
|
-
},
|
|
106
|
-
enumerable: true,
|
|
107
|
-
configurable: true
|
|
108
|
-
});
|
|
109
80
|
Object.defineProperty(ButtonGroupComponent.prototype, "getRole", {
|
|
110
81
|
get: function () {
|
|
111
82
|
return this.isSelectionSingle() ? 'radiogroup' : 'group';
|
|
@@ -171,7 +142,6 @@ var ButtonGroupComponent = /** @class */ (function () {
|
|
|
171
142
|
};
|
|
172
143
|
ButtonGroupComponent.prototype.ngOnInit = function () {
|
|
173
144
|
var _this = this;
|
|
174
|
-
this.service.setButtonLook(this.look);
|
|
175
145
|
this.subscription = this.service.buttonClicked$.subscribe(function (button) {
|
|
176
146
|
var newSelectionValue;
|
|
177
147
|
if (_this.isSelectionSingle()) {
|
|
@@ -185,7 +155,7 @@ var ButtonGroupComponent = /** @class */ (function () {
|
|
|
185
155
|
if (button.togglable) {
|
|
186
156
|
button.setSelected(newSelectionValue);
|
|
187
157
|
}
|
|
188
|
-
button.setAttribute(tabindex,
|
|
158
|
+
button.setAttribute(tabindex, '0');
|
|
189
159
|
});
|
|
190
160
|
};
|
|
191
161
|
ButtonGroupComponent.prototype.ngOnChanges = function (change) {
|
|
@@ -201,10 +171,10 @@ var ButtonGroupComponent = /** @class */ (function () {
|
|
|
201
171
|
ButtonGroupComponent.prototype.ngAfterContentInit = function () {
|
|
202
172
|
this.buttons.forEach(function (button) {
|
|
203
173
|
if (button.selected) {
|
|
204
|
-
button.setAttribute(tabindex,
|
|
174
|
+
button.setAttribute(tabindex, '0');
|
|
205
175
|
}
|
|
206
176
|
else {
|
|
207
|
-
button.setAttribute(tabindex,
|
|
177
|
+
button.setAttribute(tabindex, '-1');
|
|
208
178
|
}
|
|
209
179
|
});
|
|
210
180
|
};
|
|
@@ -248,24 +218,24 @@ var ButtonGroupComponent = /** @class */ (function () {
|
|
|
248
218
|
ButtonGroupComponent.prototype.deactivate = function (buttons) {
|
|
249
219
|
buttons.forEach(function (button) {
|
|
250
220
|
button.setSelected(false);
|
|
251
|
-
button.setAttribute(tabindex,
|
|
221
|
+
button.setAttribute(tabindex, '-1');
|
|
252
222
|
});
|
|
253
223
|
};
|
|
254
224
|
ButtonGroupComponent.prototype.activate = function (buttons) {
|
|
255
225
|
buttons.forEach(function (button) {
|
|
256
226
|
button.setSelected(true);
|
|
257
|
-
button.setAttribute(tabindex,
|
|
227
|
+
button.setAttribute(tabindex, '0');
|
|
258
228
|
button.focus();
|
|
259
229
|
});
|
|
260
230
|
};
|
|
261
231
|
ButtonGroupComponent.prototype.defocus = function (buttons) {
|
|
262
232
|
buttons.forEach(function (button) {
|
|
263
|
-
button.setAttribute(tabindex,
|
|
233
|
+
button.setAttribute(tabindex, '-1');
|
|
264
234
|
});
|
|
265
235
|
};
|
|
266
236
|
ButtonGroupComponent.prototype.focus = function (buttons) {
|
|
267
237
|
buttons.forEach(function (button) {
|
|
268
|
-
button.setAttribute(tabindex,
|
|
238
|
+
button.setAttribute(tabindex, '0');
|
|
269
239
|
button.focus();
|
|
270
240
|
});
|
|
271
241
|
};
|
|
@@ -291,10 +261,6 @@ var ButtonGroupComponent = /** @class */ (function () {
|
|
|
291
261
|
core_1.Input('width'),
|
|
292
262
|
tslib_1.__metadata("design:type", String)
|
|
293
263
|
], ButtonGroupComponent.prototype, "width", void 0);
|
|
294
|
-
tslib_1.__decorate([
|
|
295
|
-
core_1.Input(),
|
|
296
|
-
tslib_1.__metadata("design:type", String)
|
|
297
|
-
], ButtonGroupComponent.prototype, "look", void 0);
|
|
298
264
|
tslib_1.__decorate([
|
|
299
265
|
core_1.Input(),
|
|
300
266
|
tslib_1.__metadata("design:type", Number),
|
|
@@ -314,7 +280,7 @@ var ButtonGroupComponent = /** @class */ (function () {
|
|
|
314
280
|
tslib_1.__metadata("design:paramtypes", [])
|
|
315
281
|
], ButtonGroupComponent.prototype, "wrapperClass", null);
|
|
316
282
|
tslib_1.__decorate([
|
|
317
|
-
core_1.HostBinding('class.k-
|
|
283
|
+
core_1.HostBinding('class.k-disabled'),
|
|
318
284
|
tslib_1.__metadata("design:type", Boolean),
|
|
319
285
|
tslib_1.__metadata("design:paramtypes", [])
|
|
320
286
|
], ButtonGroupComponent.prototype, "disabledClass", null);
|
|
@@ -323,21 +289,6 @@ var ButtonGroupComponent = /** @class */ (function () {
|
|
|
323
289
|
tslib_1.__metadata("design:type", Boolean),
|
|
324
290
|
tslib_1.__metadata("design:paramtypes", [])
|
|
325
291
|
], ButtonGroupComponent.prototype, "stretchedClass", null);
|
|
326
|
-
tslib_1.__decorate([
|
|
327
|
-
core_1.HostBinding('class.k-button-group-flat'),
|
|
328
|
-
tslib_1.__metadata("design:type", Boolean),
|
|
329
|
-
tslib_1.__metadata("design:paramtypes", [])
|
|
330
|
-
], ButtonGroupComponent.prototype, "isFlat", null);
|
|
331
|
-
tslib_1.__decorate([
|
|
332
|
-
core_1.HostBinding('class.k-button-group-bare'),
|
|
333
|
-
tslib_1.__metadata("design:type", Boolean),
|
|
334
|
-
tslib_1.__metadata("design:paramtypes", [])
|
|
335
|
-
], ButtonGroupComponent.prototype, "isBare", null);
|
|
336
|
-
tslib_1.__decorate([
|
|
337
|
-
core_1.HostBinding('class.k-button-group-outline'),
|
|
338
|
-
tslib_1.__metadata("design:type", Boolean),
|
|
339
|
-
tslib_1.__metadata("design:paramtypes", [])
|
|
340
|
-
], ButtonGroupComponent.prototype, "isOutline", null);
|
|
341
292
|
tslib_1.__decorate([
|
|
342
293
|
core_1.HostBinding('attr.role'),
|
|
343
294
|
tslib_1.__metadata("design:type", String),
|
|
@@ -9,10 +9,13 @@ var core_1 = require("@angular/core");
|
|
|
9
9
|
var kendo_angular_l10n_1 = require("@progress/kendo-angular-l10n");
|
|
10
10
|
var chip_component_1 = require("./chip.component");
|
|
11
11
|
var util_1 = require("../util");
|
|
12
|
+
var kendo_licensing_1 = require("@progress/kendo-licensing");
|
|
13
|
+
var package_metadata_1 = require("../package-metadata");
|
|
12
14
|
var ChipListComponent = /** @class */ (function () {
|
|
13
|
-
function ChipListComponent(localizationService, renderer) {
|
|
15
|
+
function ChipListComponent(localizationService, renderer, element) {
|
|
14
16
|
this.localizationService = localizationService;
|
|
15
17
|
this.renderer = renderer;
|
|
18
|
+
this.element = element;
|
|
16
19
|
this.hostClass = true;
|
|
17
20
|
/**
|
|
18
21
|
* Sets the selection mode of the ChipList.
|
|
@@ -32,8 +35,31 @@ var ChipListComponent = /** @class */ (function () {
|
|
|
32
35
|
*/
|
|
33
36
|
this.remove = new core_1.EventEmitter();
|
|
34
37
|
this.role = 'listbox';
|
|
38
|
+
this._size = 'medium';
|
|
39
|
+
kendo_licensing_1.validatePackage(package_metadata_1.packageMetadata);
|
|
35
40
|
this.direction = localizationService.rtl ? 'rtl' : 'ltr';
|
|
36
41
|
}
|
|
42
|
+
Object.defineProperty(ChipListComponent.prototype, "size", {
|
|
43
|
+
get: function () {
|
|
44
|
+
return this._size;
|
|
45
|
+
},
|
|
46
|
+
/**
|
|
47
|
+
* The size property specifies the gap between the Chips in the ChipList
|
|
48
|
+
* ([see example]({% slug appearance_chiplist %}#toc-size)).
|
|
49
|
+
*
|
|
50
|
+
* The possible values are:
|
|
51
|
+
* * `'small'`
|
|
52
|
+
* * `'medium'` (default)
|
|
53
|
+
* * `'large'`
|
|
54
|
+
* * `null`
|
|
55
|
+
*/
|
|
56
|
+
set: function (size) {
|
|
57
|
+
this.handleClasses(size, 'size');
|
|
58
|
+
this._size = size;
|
|
59
|
+
},
|
|
60
|
+
enumerable: true,
|
|
61
|
+
configurable: true
|
|
62
|
+
});
|
|
37
63
|
Object.defineProperty(ChipListComponent.prototype, "single", {
|
|
38
64
|
get: function () {
|
|
39
65
|
return this.selection === 'single';
|
|
@@ -53,7 +79,7 @@ var ChipListComponent = /** @class */ (function () {
|
|
|
53
79
|
*/
|
|
54
80
|
ChipListComponent.prototype.onClick = function ($event) {
|
|
55
81
|
var target = $event.target;
|
|
56
|
-
var isRemoveClicked = util_1.closest(target, '.k-remove-
|
|
82
|
+
var isRemoveClicked = util_1.closest(target, '.k-chip-remove-action');
|
|
57
83
|
var clickedChip = util_1.closest(target, '.k-chip');
|
|
58
84
|
var chip = this.chips.find(function (chip) { return clickedChip === chip.element.nativeElement; });
|
|
59
85
|
if (isRemoveClicked && clickedChip) {
|
|
@@ -72,6 +98,13 @@ var ChipListComponent = /** @class */ (function () {
|
|
|
72
98
|
return _this.direction = rtl ? 'rtl' : 'ltr';
|
|
73
99
|
});
|
|
74
100
|
};
|
|
101
|
+
ChipListComponent.prototype.ngAfterViewInit = function () {
|
|
102
|
+
var _this = this;
|
|
103
|
+
var stylingInputs = ['size'];
|
|
104
|
+
stylingInputs.forEach(function (input) {
|
|
105
|
+
_this.handleClasses(_this[input], input);
|
|
106
|
+
});
|
|
107
|
+
};
|
|
75
108
|
ChipListComponent.prototype.ngAfterContentInit = function () {
|
|
76
109
|
var _this = this;
|
|
77
110
|
this.chips.forEach(function (chip) {
|
|
@@ -103,6 +136,16 @@ var ChipListComponent = /** @class */ (function () {
|
|
|
103
136
|
}
|
|
104
137
|
});
|
|
105
138
|
};
|
|
139
|
+
ChipListComponent.prototype.handleClasses = function (value, input) {
|
|
140
|
+
var elem = this.element.nativeElement;
|
|
141
|
+
var classes = util_1.getStylingClasses('chip-list', input, this[input], value);
|
|
142
|
+
if (classes.toRemove) {
|
|
143
|
+
this.renderer.removeClass(elem, classes.toRemove);
|
|
144
|
+
}
|
|
145
|
+
if (classes.toAdd) {
|
|
146
|
+
this.renderer.addClass(elem, classes.toAdd);
|
|
147
|
+
}
|
|
148
|
+
};
|
|
106
149
|
tslib_1.__decorate([
|
|
107
150
|
core_1.HostBinding('class.k-chip-list'),
|
|
108
151
|
tslib_1.__metadata("design:type", Boolean)
|
|
@@ -115,6 +158,11 @@ var ChipListComponent = /** @class */ (function () {
|
|
|
115
158
|
core_1.Input(),
|
|
116
159
|
tslib_1.__metadata("design:type", String)
|
|
117
160
|
], ChipListComponent.prototype, "selection", void 0);
|
|
161
|
+
tslib_1.__decorate([
|
|
162
|
+
core_1.Input(),
|
|
163
|
+
tslib_1.__metadata("design:type", String),
|
|
164
|
+
tslib_1.__metadata("design:paramtypes", [String])
|
|
165
|
+
], ChipListComponent.prototype, "size", null);
|
|
118
166
|
tslib_1.__decorate([
|
|
119
167
|
core_1.Output(),
|
|
120
168
|
tslib_1.__metadata("design:type", core_1.EventEmitter)
|
|
@@ -149,17 +197,19 @@ var ChipListComponent = /** @class */ (function () {
|
|
|
149
197
|
], ChipListComponent.prototype, "onClick", null);
|
|
150
198
|
ChipListComponent = tslib_1.__decorate([
|
|
151
199
|
core_1.Component({
|
|
152
|
-
selector: 'kendo-
|
|
200
|
+
selector: 'kendo-chiplist, kendo-chip-list',
|
|
153
201
|
template: "\n <ng-content></ng-content>\n ",
|
|
154
202
|
providers: [
|
|
155
203
|
kendo_angular_l10n_1.LocalizationService,
|
|
156
204
|
{
|
|
157
205
|
provide: kendo_angular_l10n_1.L10N_PREFIX,
|
|
158
|
-
useValue: 'kendo.
|
|
206
|
+
useValue: 'kendo.chiplist'
|
|
159
207
|
}
|
|
160
208
|
]
|
|
161
209
|
}),
|
|
162
|
-
tslib_1.__metadata("design:paramtypes", [kendo_angular_l10n_1.LocalizationService,
|
|
210
|
+
tslib_1.__metadata("design:paramtypes", [kendo_angular_l10n_1.LocalizationService,
|
|
211
|
+
core_1.Renderer2,
|
|
212
|
+
core_1.ElementRef])
|
|
163
213
|
], ChipListComponent);
|
|
164
214
|
return ChipListComponent;
|
|
165
215
|
}());
|
|
@@ -20,38 +20,20 @@ var ChipComponent = /** @class */ (function () {
|
|
|
20
20
|
this.renderer = renderer;
|
|
21
21
|
this.ngZone = ngZone;
|
|
22
22
|
this.localizationService = localizationService;
|
|
23
|
-
/**
|
|
24
|
-
* Changes the visual appearance by using alternative styling options.
|
|
25
|
-
*
|
|
26
|
-
* The available values are:
|
|
27
|
-
* * `solid`
|
|
28
|
-
* * `outline`
|
|
29
|
-
* * `filled` (The `filled` option will be deprecated. To apply identical styling, use `solid` instead).
|
|
30
|
-
* * `outlined` (The `outlined` option will be deprecated. To apply identical styling, use `outline` instead).
|
|
31
|
-
*/
|
|
32
|
-
this.look = 'solid';
|
|
33
23
|
/**
|
|
34
24
|
* Specifies the selected state of the Chip.
|
|
25
|
+
* @default false
|
|
35
26
|
*/
|
|
36
27
|
this.selected = false;
|
|
37
28
|
/**
|
|
38
29
|
* Specifies if the Chip will be removable or not.
|
|
39
30
|
* If the property is set to `true`, the Chip renders a remove icon.
|
|
31
|
+
* @default false
|
|
40
32
|
*/
|
|
41
33
|
this.removable = false;
|
|
42
|
-
/**
|
|
43
|
-
* Specifies the Chip type.
|
|
44
|
-
*
|
|
45
|
-
* The possible values are:
|
|
46
|
-
* - `none` (default)
|
|
47
|
-
* - `success`
|
|
48
|
-
* - `error`
|
|
49
|
-
* - `warning`
|
|
50
|
-
* - `info`
|
|
51
|
-
*/
|
|
52
|
-
this.type = 'none';
|
|
53
34
|
/**
|
|
54
35
|
* If set to `true`, the Chip will be disabled.
|
|
36
|
+
* @default false
|
|
55
37
|
*/
|
|
56
38
|
this.disabled = false;
|
|
57
39
|
/**
|
|
@@ -64,34 +46,111 @@ var ChipComponent = /** @class */ (function () {
|
|
|
64
46
|
this.contentClick = new core_1.EventEmitter();
|
|
65
47
|
this.tabIndex = 0;
|
|
66
48
|
this.hostClass = true;
|
|
49
|
+
this._size = 'medium';
|
|
50
|
+
this._rounded = 'medium';
|
|
51
|
+
this._fillMode = 'solid';
|
|
52
|
+
this._themeColor = 'base';
|
|
67
53
|
this.focused = false;
|
|
68
54
|
kendo_licensing_1.validatePackage(package_metadata_1.packageMetadata);
|
|
69
55
|
this.direction = localizationService.rtl ? 'rtl' : 'ltr';
|
|
70
56
|
}
|
|
71
|
-
Object.defineProperty(ChipComponent.prototype, "
|
|
57
|
+
Object.defineProperty(ChipComponent.prototype, "size", {
|
|
72
58
|
get: function () {
|
|
73
|
-
return this.
|
|
59
|
+
return this._size;
|
|
60
|
+
},
|
|
61
|
+
/**
|
|
62
|
+
* The size property specifies the height, padding and line height of the Chip
|
|
63
|
+
* ([see example]({% slug appearance_chip %}#toc-size)).
|
|
64
|
+
*
|
|
65
|
+
* The possible values are:
|
|
66
|
+
* * `'small'`
|
|
67
|
+
* * `'medium'` (default)
|
|
68
|
+
* * `'large'`
|
|
69
|
+
* * `null`
|
|
70
|
+
*/
|
|
71
|
+
set: function (size) {
|
|
72
|
+
this.handleClasses(size, 'size');
|
|
73
|
+
this._size = size;
|
|
74
74
|
},
|
|
75
75
|
enumerable: true,
|
|
76
76
|
configurable: true
|
|
77
77
|
});
|
|
78
|
-
Object.defineProperty(ChipComponent.prototype, "
|
|
78
|
+
Object.defineProperty(ChipComponent.prototype, "rounded", {
|
|
79
79
|
get: function () {
|
|
80
|
-
return this.
|
|
80
|
+
return this._rounded;
|
|
81
|
+
},
|
|
82
|
+
/**
|
|
83
|
+
* The rounded property specifies the border radius of the Chip
|
|
84
|
+
* ([see example]({% slug appearance_chip %}#toc-rounded)).
|
|
85
|
+
*
|
|
86
|
+
* The possible values are:
|
|
87
|
+
* * `'small'`
|
|
88
|
+
* * `'medium'` (default)
|
|
89
|
+
* * `'large'`
|
|
90
|
+
* * `'full'`
|
|
91
|
+
* * `null`
|
|
92
|
+
*/
|
|
93
|
+
set: function (rounded) {
|
|
94
|
+
this.handleClasses(rounded, 'rounded');
|
|
95
|
+
this._rounded = rounded;
|
|
81
96
|
},
|
|
82
97
|
enumerable: true,
|
|
83
98
|
configurable: true
|
|
84
99
|
});
|
|
85
|
-
Object.defineProperty(ChipComponent.prototype, "
|
|
100
|
+
Object.defineProperty(ChipComponent.prototype, "fillMode", {
|
|
86
101
|
get: function () {
|
|
87
|
-
return this.
|
|
102
|
+
return this._fillMode;
|
|
103
|
+
},
|
|
104
|
+
/**
|
|
105
|
+
* The fillMode property specifies the background and border styles of the Chip
|
|
106
|
+
* ([see example]({% slug appearance_chip %}#toc-fillMode)).
|
|
107
|
+
*
|
|
108
|
+
* The possible values are:
|
|
109
|
+
* * `'solid'` (default)
|
|
110
|
+
* * `'outline'`
|
|
111
|
+
* * `null`
|
|
112
|
+
*/
|
|
113
|
+
set: function (fillMode) {
|
|
114
|
+
this.handleClasses(fillMode, 'fillMode');
|
|
115
|
+
this._fillMode = fillMode;
|
|
116
|
+
},
|
|
117
|
+
enumerable: true,
|
|
118
|
+
configurable: true
|
|
119
|
+
});
|
|
120
|
+
Object.defineProperty(ChipComponent.prototype, "themeColor", {
|
|
121
|
+
get: function () {
|
|
122
|
+
return this._themeColor;
|
|
123
|
+
},
|
|
124
|
+
/**
|
|
125
|
+
* The Chip allows you to specify predefined theme colors.
|
|
126
|
+
* The theme color will be applied as a background and border color while also amending the text color accordingly
|
|
127
|
+
* ([see example]({% slug appearance_chip %}#toc-themeColor)).
|
|
128
|
+
*
|
|
129
|
+
* The possible values are:
|
|
130
|
+
* * `'base'` (default)
|
|
131
|
+
* * `'info'`
|
|
132
|
+
* * `'success'`
|
|
133
|
+
* * `'warning'`
|
|
134
|
+
* * `'error'`
|
|
135
|
+
* * `null`
|
|
136
|
+
*/
|
|
137
|
+
set: function (themeColor) {
|
|
138
|
+
this.handleThemeColor(themeColor);
|
|
139
|
+
this._themeColor = themeColor;
|
|
140
|
+
},
|
|
141
|
+
enumerable: true,
|
|
142
|
+
configurable: true
|
|
143
|
+
});
|
|
144
|
+
Object.defineProperty(ChipComponent.prototype, "ariaChecked", {
|
|
145
|
+
get: function () {
|
|
146
|
+
return this.selected;
|
|
88
147
|
},
|
|
89
148
|
enumerable: true,
|
|
90
149
|
configurable: true
|
|
91
150
|
});
|
|
92
151
|
Object.defineProperty(ChipComponent.prototype, "hasIconClass", {
|
|
93
152
|
get: function () {
|
|
94
|
-
return this.icon || this.iconClass ? true : false;
|
|
153
|
+
return this.icon || this.iconClass || this.avatarClass ? true : false;
|
|
95
154
|
},
|
|
96
155
|
enumerable: true,
|
|
97
156
|
configurable: true
|
|
@@ -134,44 +193,48 @@ var ChipComponent = /** @class */ (function () {
|
|
|
134
193
|
}
|
|
135
194
|
};
|
|
136
195
|
ChipComponent.prototype.ngAfterViewInit = function () {
|
|
196
|
+
var _this = this;
|
|
137
197
|
var chip = this.element.nativeElement;
|
|
138
|
-
var
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}
|
|
198
|
+
var stylingOptions = ['size', 'rounded', 'fillMode'];
|
|
199
|
+
stylingOptions.forEach(function (input) {
|
|
200
|
+
_this.handleClasses(_this[input], input);
|
|
201
|
+
});
|
|
142
202
|
this.attachElementEventHandlers(chip);
|
|
143
203
|
};
|
|
144
|
-
Object.defineProperty(ChipComponent.prototype, "
|
|
204
|
+
Object.defineProperty(ChipComponent.prototype, "kendoIconClass", {
|
|
145
205
|
/**
|
|
146
206
|
* @hidden
|
|
147
207
|
*/
|
|
148
208
|
get: function () {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
classes.push("" + this.iconClass);
|
|
152
|
-
}
|
|
153
|
-
if (this.icon) {
|
|
154
|
-
classes.push("k-icon k-i-" + this.icon);
|
|
155
|
-
}
|
|
156
|
-
return classes;
|
|
209
|
+
this.verifyIconSettings([this.iconClass, this.avatarClass]);
|
|
210
|
+
return "k-i-" + this.icon;
|
|
157
211
|
},
|
|
158
212
|
enumerable: true,
|
|
159
213
|
configurable: true
|
|
160
214
|
});
|
|
161
|
-
Object.defineProperty(ChipComponent.prototype, "
|
|
215
|
+
Object.defineProperty(ChipComponent.prototype, "customIconClass", {
|
|
162
216
|
/**
|
|
163
217
|
* @hidden
|
|
164
218
|
*/
|
|
165
219
|
get: function () {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
220
|
+
this.verifyIconSettings([this.icon, this.avatarClass]);
|
|
221
|
+
return "" + this.iconClass;
|
|
222
|
+
},
|
|
223
|
+
enumerable: true,
|
|
224
|
+
configurable: true
|
|
225
|
+
});
|
|
226
|
+
Object.defineProperty(ChipComponent.prototype, "chipAvatarClass", {
|
|
227
|
+
/**
|
|
228
|
+
* @hidden
|
|
229
|
+
*/
|
|
230
|
+
get: function () {
|
|
231
|
+
this.verifyIconSettings([this.icon, this.iconClass]);
|
|
232
|
+
return "" + this.avatarClass;
|
|
170
233
|
},
|
|
171
234
|
enumerable: true,
|
|
172
235
|
configurable: true
|
|
173
236
|
});
|
|
174
|
-
Object.defineProperty(ChipComponent.prototype, "
|
|
237
|
+
Object.defineProperty(ChipComponent.prototype, "removeIconClass", {
|
|
175
238
|
/**
|
|
176
239
|
* @hidden
|
|
177
240
|
*/
|
|
@@ -179,23 +242,11 @@ var ChipComponent = /** @class */ (function () {
|
|
|
179
242
|
if (this.removeIcon) {
|
|
180
243
|
return "" + this.removeIcon;
|
|
181
244
|
}
|
|
182
|
-
return "k-
|
|
245
|
+
return "k-i-close-circle";
|
|
183
246
|
},
|
|
184
247
|
enumerable: true,
|
|
185
248
|
configurable: true
|
|
186
249
|
});
|
|
187
|
-
/**
|
|
188
|
-
* @hidden
|
|
189
|
-
*/
|
|
190
|
-
ChipComponent.prototype.typeClass = function () {
|
|
191
|
-
return {
|
|
192
|
-
'none': '',
|
|
193
|
-
'success': 'k-chip-success',
|
|
194
|
-
'warning': 'k-chip-warning',
|
|
195
|
-
'error': 'k-chip-error',
|
|
196
|
-
'info': 'k-chip-info'
|
|
197
|
-
}[this.type];
|
|
198
|
-
};
|
|
199
250
|
/**
|
|
200
251
|
* Focuses the Chip component.
|
|
201
252
|
*/
|
|
@@ -230,7 +281,7 @@ var ChipComponent = /** @class */ (function () {
|
|
|
230
281
|
_this.renderer.removeClass(chip, 'k-focus');
|
|
231
282
|
});
|
|
232
283
|
var contentClickListener = _this.renderer.listen(chip, 'click', function (e) {
|
|
233
|
-
var isRemoveClicked = util_1.closest(e.target, '.k-remove-
|
|
284
|
+
var isRemoveClicked = util_1.closest(e.target, '.k-chip-remove-action');
|
|
234
285
|
if (!isRemoveClicked) {
|
|
235
286
|
_this.ngZone.run(function () {
|
|
236
287
|
_this.contentClick.emit({ sender: _this, originalEvent: e });
|
|
@@ -244,10 +295,42 @@ var ChipComponent = /** @class */ (function () {
|
|
|
244
295
|
};
|
|
245
296
|
});
|
|
246
297
|
};
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
298
|
+
/**
|
|
299
|
+
* @hidden
|
|
300
|
+
*/
|
|
301
|
+
ChipComponent.prototype.verifyIconSettings = function (iconsToCheck) {
|
|
302
|
+
if (core_1.isDevMode()) {
|
|
303
|
+
if (iconsToCheck.filter(function (icon) { return icon !== null && icon !== undefined; }).length > 0) {
|
|
304
|
+
this.renderer.removeClass(this.element.nativeElement, 'k-chip-has-icon');
|
|
305
|
+
throw new Error('Invalid configuration: Having multiple icons is not supported. Only a single icon on a chip can be displayed.');
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
ChipComponent.prototype.handleClasses = function (value, input) {
|
|
310
|
+
var elem = this.element.nativeElement;
|
|
311
|
+
var classes = util_1.getStylingClasses('chip', input, this[input], value);
|
|
312
|
+
if (input === 'fillMode') {
|
|
313
|
+
this.handleThemeColor(this.themeColor, this[input], value);
|
|
314
|
+
}
|
|
315
|
+
if (classes.toRemove) {
|
|
316
|
+
this.renderer.removeClass(elem, classes.toRemove);
|
|
317
|
+
}
|
|
318
|
+
if (classes.toAdd) {
|
|
319
|
+
this.renderer.addClass(elem, classes.toAdd);
|
|
320
|
+
}
|
|
321
|
+
};
|
|
322
|
+
ChipComponent.prototype.handleThemeColor = function (value, prevFillMode, fillMode) {
|
|
323
|
+
var elem = this.element.nativeElement;
|
|
324
|
+
var removeFillMode = prevFillMode ? prevFillMode : this.fillMode;
|
|
325
|
+
var addFillMode = fillMode ? fillMode : this.fillMode;
|
|
326
|
+
var themeColorClass = util_1.getThemeColorClasses('chip', removeFillMode, addFillMode, this.themeColor, value);
|
|
327
|
+
this.renderer.removeClass(elem, themeColorClass.toRemove);
|
|
328
|
+
if (addFillMode !== null && fillMode !== null) {
|
|
329
|
+
if (themeColorClass.toAdd) {
|
|
330
|
+
this.renderer.addClass(elem, themeColorClass.toAdd);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
};
|
|
251
334
|
tslib_1.__decorate([
|
|
252
335
|
core_1.Input(),
|
|
253
336
|
tslib_1.__metadata("design:type", String)
|
|
@@ -262,12 +345,12 @@ var ChipComponent = /** @class */ (function () {
|
|
|
262
345
|
], ChipComponent.prototype, "iconClass", void 0);
|
|
263
346
|
tslib_1.__decorate([
|
|
264
347
|
core_1.Input(),
|
|
265
|
-
tslib_1.__metadata("design:type",
|
|
266
|
-
], ChipComponent.prototype, "
|
|
348
|
+
tslib_1.__metadata("design:type", String)
|
|
349
|
+
], ChipComponent.prototype, "avatarClass", void 0);
|
|
267
350
|
tslib_1.__decorate([
|
|
268
351
|
core_1.Input(),
|
|
269
|
-
tslib_1.__metadata("design:type",
|
|
270
|
-
], ChipComponent.prototype, "
|
|
352
|
+
tslib_1.__metadata("design:type", Boolean)
|
|
353
|
+
], ChipComponent.prototype, "selected", void 0);
|
|
271
354
|
tslib_1.__decorate([
|
|
272
355
|
core_1.Input(),
|
|
273
356
|
tslib_1.__metadata("design:type", Boolean)
|
|
@@ -276,14 +359,30 @@ var ChipComponent = /** @class */ (function () {
|
|
|
276
359
|
core_1.Input(),
|
|
277
360
|
tslib_1.__metadata("design:type", String)
|
|
278
361
|
], ChipComponent.prototype, "removeIcon", void 0);
|
|
279
|
-
tslib_1.__decorate([
|
|
280
|
-
core_1.Input(),
|
|
281
|
-
tslib_1.__metadata("design:type", String)
|
|
282
|
-
], ChipComponent.prototype, "type", void 0);
|
|
283
362
|
tslib_1.__decorate([
|
|
284
363
|
core_1.Input(),
|
|
285
364
|
tslib_1.__metadata("design:type", Boolean)
|
|
286
365
|
], ChipComponent.prototype, "disabled", void 0);
|
|
366
|
+
tslib_1.__decorate([
|
|
367
|
+
core_1.Input(),
|
|
368
|
+
tslib_1.__metadata("design:type", String),
|
|
369
|
+
tslib_1.__metadata("design:paramtypes", [String])
|
|
370
|
+
], ChipComponent.prototype, "size", null);
|
|
371
|
+
tslib_1.__decorate([
|
|
372
|
+
core_1.Input(),
|
|
373
|
+
tslib_1.__metadata("design:type", String),
|
|
374
|
+
tslib_1.__metadata("design:paramtypes", [String])
|
|
375
|
+
], ChipComponent.prototype, "rounded", null);
|
|
376
|
+
tslib_1.__decorate([
|
|
377
|
+
core_1.Input(),
|
|
378
|
+
tslib_1.__metadata("design:type", String),
|
|
379
|
+
tslib_1.__metadata("design:paramtypes", [String])
|
|
380
|
+
], ChipComponent.prototype, "fillMode", null);
|
|
381
|
+
tslib_1.__decorate([
|
|
382
|
+
core_1.Input(),
|
|
383
|
+
tslib_1.__metadata("design:type", String),
|
|
384
|
+
tslib_1.__metadata("design:paramtypes", [String])
|
|
385
|
+
], ChipComponent.prototype, "themeColor", null);
|
|
287
386
|
tslib_1.__decorate([
|
|
288
387
|
core_1.Output(),
|
|
289
388
|
tslib_1.__metadata("design:type", core_1.EventEmitter)
|
|
@@ -305,16 +404,6 @@ var ChipComponent = /** @class */ (function () {
|
|
|
305
404
|
core_1.HostBinding('class.k-chip'),
|
|
306
405
|
tslib_1.__metadata("design:type", Boolean)
|
|
307
406
|
], ChipComponent.prototype, "hostClass", void 0);
|
|
308
|
-
tslib_1.__decorate([
|
|
309
|
-
core_1.HostBinding('class.k-chip-outline'),
|
|
310
|
-
tslib_1.__metadata("design:type", Boolean),
|
|
311
|
-
tslib_1.__metadata("design:paramtypes", [])
|
|
312
|
-
], ChipComponent.prototype, "outlineClass", null);
|
|
313
|
-
tslib_1.__decorate([
|
|
314
|
-
core_1.HostBinding('class.k-chip-solid'),
|
|
315
|
-
tslib_1.__metadata("design:type", Boolean),
|
|
316
|
-
tslib_1.__metadata("design:paramtypes", [])
|
|
317
|
-
], ChipComponent.prototype, "solidClass", null);
|
|
318
407
|
tslib_1.__decorate([
|
|
319
408
|
core_1.HostBinding('class.k-chip-has-icon'),
|
|
320
409
|
tslib_1.__metadata("design:type", Boolean),
|
|
@@ -343,7 +432,7 @@ var ChipComponent = /** @class */ (function () {
|
|
|
343
432
|
ChipComponent = tslib_1.__decorate([
|
|
344
433
|
core_1.Component({
|
|
345
434
|
selector: 'kendo-chip',
|
|
346
|
-
template: "\n <span
|
|
435
|
+
template: "\n <span\n *ngIf=\"icon\"\n class=\"k-chip-icon k-icon\"\n [ngClass]=\"kendoIconClass\"\n >\n </span>\n\n <span\n *ngIf=\"iconClass\"\n class=\"k-chip-icon\"\n [ngClass]=\"customIconClass\"\n >\n </span>\n\n <span\n *ngIf=\"avatarClass\"\n class=\"k-chip-avatar k-avatar k-rounded-full\"\n >\n <span class=\"k-avatar-image\" [ngClass]=\"chipAvatarClass\"></span>\n </span>\n\n <span class=\"k-chip-content\">\n <span class=\"k-chip-label\" *ngIf=\"label\">\n {{ label }}\n </span>\n <ng-content *ngIf=\"!label\"></ng-content>\n </span>\n\n <span class=\"k-chip-actions\">\n <span class=\"k-chip-action k-chip-remove-action\"\n *ngIf=\"removable\"\n (click)=\"onRemoveClick($event)\"\n >\n <span\n class=\"k-icon\"\n [ngClass]=\"removeIconClass\"\n >\n </span>\n </span>\n </span>\n ",
|
|
347
436
|
providers: [
|
|
348
437
|
kendo_angular_l10n_1.LocalizationService,
|
|
349
438
|
{
|
|
File without changes
|
|
File without changes
|