@elderbyte/ngx-starter 15.5.2 → 15.6.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.
@@ -21163,7 +21163,10 @@ class ElderChipLabelDirective {
21163
21163
  * *
21164
21164
  **************************************************************************/
21165
21165
  this.baseClass = 'elder-chip-label';
21166
- this.appearance = 'md3';
21166
+ this._appearance = 'md3';
21167
+ }
21168
+ ngOnInit() {
21169
+ this.refreshClasses();
21167
21170
  }
21168
21171
  /***************************************************************************
21169
21172
  * *
@@ -21171,44 +21174,89 @@ class ElderChipLabelDirective {
21171
21174
  * *
21172
21175
  **************************************************************************/
21173
21176
  get classes() {
21174
- return this.buildClassesString();
21177
+ return this.cssClasses;
21178
+ }
21179
+ /***************************************************************************
21180
+ * *
21181
+ * Properties *
21182
+ * *
21183
+ **************************************************************************/
21184
+ set appearance(appearance) {
21185
+ this._appearance = appearance;
21186
+ this.refreshClasses();
21187
+ }
21188
+ set themeColor(themeColor) {
21189
+ this._themeColor = themeColor;
21190
+ this.refreshClasses();
21191
+ }
21192
+ set stateColor(stateColor) {
21193
+ this._stateColor = stateColor;
21194
+ this.refreshClasses();
21195
+ }
21196
+ set levelColor(levelColor) {
21197
+ this._levelColor = levelColor;
21198
+ this.refreshClasses();
21175
21199
  }
21176
21200
  /***************************************************************************
21177
21201
  * *
21178
21202
  * Private methods *
21179
21203
  * *
21180
21204
  **************************************************************************/
21205
+ refreshClasses() {
21206
+ this.cssClasses = this.buildClassesString();
21207
+ }
21181
21208
  buildClassesString() {
21182
- const classes = [this.baseClass];
21183
- if (this.appearance) {
21184
- classes.push(this.getAppearanceClass(this.appearance));
21209
+ return this.buildClasses()
21210
+ .filter(cls => !!cls)
21211
+ .join(' ');
21212
+ }
21213
+ buildClasses() {
21214
+ const appearance = this._appearance ?? 'legacy';
21215
+ switch (appearance) {
21216
+ case 'md3':
21217
+ return [this.baseClass, 'md3', this.resolveColorClass() ?? 'none'];
21218
+ case 'legacy':
21219
+ return [this.baseClass, 'legacy', this.resolveColorClass()];
21220
+ }
21221
+ }
21222
+ resolveColorClass() {
21223
+ let colorClass;
21224
+ if (this._themeColor) {
21225
+ colorClass = this.getThemeColorClass(this._themeColor);
21185
21226
  }
21186
- if (this.themeColor) {
21187
- classes.push(this.getThemeColorClass(this.themeColor));
21227
+ else if (this._stateColor) {
21228
+ colorClass = this.getStateColorClass(this._stateColor);
21188
21229
  }
21189
- if (this.stateColor) {
21190
- classes.push(this.getStateColorClass(this.stateColor));
21230
+ else if (this._levelColor) {
21231
+ colorClass = this.getLevelColorClass(this._levelColor);
21191
21232
  }
21192
- return classes.join(' ');
21233
+ else {
21234
+ return undefined;
21235
+ }
21236
+ return colorClass;
21193
21237
  }
21194
- getAppearanceClass(appearance) {
21195
- if (appearance) {
21196
- switch (appearance) {
21197
- case 'md3':
21198
- return 'md3';
21199
- case 'legacy':
21200
- return 'legacy';
21238
+ getLevelColorClass(state) {
21239
+ if (state) {
21240
+ switch (state) {
21241
+ case 'low':
21242
+ return 'level-low';
21243
+ case 'medium':
21244
+ return 'level-medium';
21245
+ case 'high':
21246
+ return 'level-high';
21247
+ case 'critical':
21248
+ return 'level-critical';
21249
+ default:
21250
+ return 'state-other'; // TODO
21201
21251
  }
21202
21252
  }
21203
21253
  else {
21204
- return 'legacy';
21254
+ return undefined;
21205
21255
  }
21206
21256
  }
21207
21257
  getStateColorClass(state) {
21208
21258
  if (state) {
21209
21259
  switch (state) {
21210
- case 'none':
21211
- return 'state-none';
21212
21260
  case 'open':
21213
21261
  return 'state-open';
21214
21262
  case 'inProgress':
@@ -21224,7 +21272,7 @@ class ElderChipLabelDirective {
21224
21272
  }
21225
21273
  }
21226
21274
  else {
21227
- return 'state-none';
21275
+ return undefined;
21228
21276
  }
21229
21277
  }
21230
21278
  getThemeColorClass(color) {
@@ -21244,7 +21292,7 @@ class ElderChipLabelDirective {
21244
21292
  }
21245
21293
  }
21246
21294
  ElderChipLabelDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: ElderChipLabelDirective, deps: [{ token: i6.MatChip, host: true, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
21247
- ElderChipLabelDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.2", type: ElderChipLabelDirective, selector: "[elderChipLabel]", inputs: { themeColor: ["color", "themeColor"], stateColor: "stateColor", appearance: "appearance" }, host: { properties: { "class": "this.classes" } }, ngImport: i0 });
21295
+ ElderChipLabelDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.2", type: ElderChipLabelDirective, selector: "[elderChipLabel]", inputs: { appearance: "appearance", themeColor: ["color", "themeColor"], stateColor: "stateColor", levelColor: "levelColor" }, host: { properties: { "class": "this.classes" } }, ngImport: i0 });
21248
21296
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: ElderChipLabelDirective, decorators: [{
21249
21297
  type: Directive,
21250
21298
  args: [{
@@ -21254,16 +21302,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImpor
21254
21302
  type: Optional
21255
21303
  }, {
21256
21304
  type: Host
21257
- }] }]; }, propDecorators: { themeColor: [{
21305
+ }] }]; }, propDecorators: { classes: [{
21306
+ type: HostBinding,
21307
+ args: ['class']
21308
+ }], appearance: [{
21309
+ type: Input
21310
+ }], themeColor: [{
21258
21311
  type: Input,
21259
21312
  args: ['color']
21260
21313
  }], stateColor: [{
21261
21314
  type: Input
21262
- }], appearance: [{
21315
+ }], levelColor: [{
21263
21316
  type: Input
21264
- }], classes: [{
21265
- type: HostBinding,
21266
- args: ['class']
21267
21317
  }] } });
21268
21318
 
21269
21319
  class ElderChipsModule {