@jooler/inputs 0.0.51 → 0.0.53

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 (50) hide show
  1. package/esm2022/lib/ag-grid-select-mixin.mjs +73 -0
  2. package/esm2022/lib/choose-enum/choose-enum.component.mjs +57 -42
  3. package/esm2022/lib/choose-enum-renderer/choose-enum-renderer.component.mjs +35 -21
  4. package/esm2022/lib/custom-colors/bom-production-type.enum.mjs +11 -0
  5. package/esm2022/lib/custom-colors/enum-custom-color-mapping.mjs +32 -0
  6. package/esm2022/lib/custom-colors/enum-custom-colors.mjs +21 -0
  7. package/esm2022/lib/custom-colors/sales-order-status.enum.mjs +27 -0
  8. package/esm2022/lib/enum-custom-label-mapping.mjs +32 -0
  9. package/esm2022/lib/enum-helper-functions.mjs +85 -0
  10. package/esm2022/lib/enum-helper.model.mjs +14 -0
  11. package/esm2022/lib/enum-models/bill-status.model.mjs +25 -0
  12. package/esm2022/lib/enum-models/charge-level.enum.mjs +6 -0
  13. package/esm2022/lib/enum-models/custom-order-request-status.enum.mjs +29 -0
  14. package/esm2022/lib/enum-models/invitation-status.model.mjs +15 -0
  15. package/esm2022/lib/enum-models/invoice-status.model.mjs +15 -0
  16. package/esm2022/lib/enum-models/locker-transfer-status.enum.mjs +11 -0
  17. package/esm2022/lib/enum-models/priority.model.mjs +13 -0
  18. package/esm2022/lib/enum-models/quotation-status.model.mjs +19 -0
  19. package/esm2022/lib/enum-models/request-status.model.mjs +15 -0
  20. package/esm2022/lib/enum-string-class-map.mjs +26 -0
  21. package/esm2022/lib/json/enum-custom-label-mappings.json +10 -0
  22. package/esm2022/lib/primary-colors.mjs +9 -1
  23. package/fesm2022/inputs.mjs +523 -96
  24. package/fesm2022/inputs.mjs.map +1 -1
  25. package/lib/ag-grid-select-mixin.d.ts +22 -0
  26. package/lib/choose-enum/choose-enum.component.d.ts +12 -7
  27. package/lib/choose-enum-renderer/choose-enum-renderer.component.d.ts +7 -9
  28. package/lib/custom-colors/bom-production-type.enum.d.ts +5 -0
  29. package/lib/custom-colors/enum-custom-color-mapping.d.ts +11 -0
  30. package/lib/custom-colors/enum-custom-colors.d.ts +2 -0
  31. package/lib/custom-colors/sales-order-status.enum.d.ts +13 -0
  32. package/lib/enum-custom-label-mapping.d.ts +7 -0
  33. package/lib/enum-helper-functions.d.ts +7 -0
  34. package/lib/enum-helper.model.d.ts +8 -0
  35. package/lib/enum-models/bill-status.model.d.ts +12 -0
  36. package/lib/enum-models/charge-level.enum.d.ts +4 -0
  37. package/lib/enum-models/custom-order-request-status.enum.d.ts +14 -0
  38. package/lib/enum-models/invitation-status.model.d.ts +7 -0
  39. package/lib/enum-models/invoice-status.model.d.ts +13 -0
  40. package/lib/enum-models/locker-transfer-status.enum.d.ts +5 -0
  41. package/lib/enum-models/priority.model.d.ts +6 -0
  42. package/lib/enum-models/quotation-status.model.d.ts +9 -0
  43. package/lib/enum-models/request-status.model.d.ts +7 -0
  44. package/lib/enum-string-class-map.d.ts +3 -0
  45. package/lib/primary-colors.d.ts +8 -0
  46. package/package.json +1 -1
  47. package/esm2022/lib/models/enum-helper-functions.mjs +0 -57
  48. package/esm2022/lib/models/enum-helper.model.mjs +0 -2
  49. package/lib/models/enum-helper-functions.d.ts +0 -5
  50. package/lib/models/enum-helper.model.d.ts +0 -6
@@ -17,6 +17,260 @@ import { AppMaterialModule } from '@jooler/app-material';
17
17
  import * as i1$2 from '@angular/router';
18
18
  import * as i3$1 from '@angular/material/menu';
19
19
 
20
+ class PrimaryColors {
21
+ static $primaryBlueColor = '#155ED4';
22
+ static $primaryPinkColor = '#F0509C';
23
+ static $primaryTealColor = '#12957E';
24
+ static $primaryCarbonColor = '#32353B';
25
+ static $primaryGrayColor = '#676767';
26
+ static $primaryPurpleColor = '#E3B1EB';
27
+ static $primaryRedColor = '#A80002';
28
+ static $primaryLightRedColor = '#FFDBDB';
29
+ static $primaryLightGrayBlueColor = '#f7f8f9';
30
+ static $primaryLightGrayColor = '#f0f0f0';
31
+ static $primaryLightBlueColor = '#b9cff2';
32
+ static $primaryYellowColor = '#F2CD5C';
33
+ static $primaryOrangeColor = '#F2921D';
34
+ static $primaryLimeGreenColor = '#AFFF00';
35
+ static $primaryNavyBlueColor = '#000080';
36
+ static $primaryOrangeRedColor = '#FF4500';
37
+ static $primaryDarkPurpleColor = '#7600BC';
38
+ }
39
+
40
+ var BOMProductionType;
41
+ (function (BOMProductionType) {
42
+ BOMProductionType[BOMProductionType["MANUFACTURED_IN_HOUSE"] = 0] = "MANUFACTURED_IN_HOUSE";
43
+ BOMProductionType[BOMProductionType["PARTIALLY_MANUFACTURED_IN_HOUSE"] = 1] = "PARTIALLY_MANUFACTURED_IN_HOUSE";
44
+ })(BOMProductionType || (BOMProductionType = {}));
45
+ const bomProductionTypeColors = Object.values({
46
+ [BOMProductionType.MANUFACTURED_IN_HOUSE]: PrimaryColors.$primaryLimeGreenColor,
47
+ [BOMProductionType.PARTIALLY_MANUFACTURED_IN_HOUSE]: PrimaryColors.$primaryBlueColor,
48
+ });
49
+
50
+ var SalesOrderStatus;
51
+ (function (SalesOrderStatus) {
52
+ SalesOrderStatus[SalesOrderStatus["DRAFT"] = 0] = "DRAFT";
53
+ SalesOrderStatus[SalesOrderStatus["PENDING_APPROVAL"] = 1] = "PENDING_APPROVAL";
54
+ SalesOrderStatus[SalesOrderStatus["APPROVED"] = 2] = "APPROVED";
55
+ SalesOrderStatus[SalesOrderStatus["TO_DELIVER_AND_TO_BILL"] = 3] = "TO_DELIVER_AND_TO_BILL";
56
+ SalesOrderStatus[SalesOrderStatus["TO_BILL"] = 4] = "TO_BILL";
57
+ SalesOrderStatus[SalesOrderStatus["PARTIALLY_DELIVERED_AND_PARTIALLY_BILLED"] = 5] = "PARTIALLY_DELIVERED_AND_PARTIALLY_BILLED";
58
+ SalesOrderStatus[SalesOrderStatus["PARTIALLY_DELIVERED_AND_TO_BILL"] = 6] = "PARTIALLY_DELIVERED_AND_TO_BILL";
59
+ SalesOrderStatus[SalesOrderStatus["COMPLETED"] = 7] = "COMPLETED";
60
+ SalesOrderStatus[SalesOrderStatus["CANCELED"] = 8] = "CANCELED";
61
+ SalesOrderStatus[SalesOrderStatus["CLOSED"] = 9] = "CLOSED";
62
+ })(SalesOrderStatus || (SalesOrderStatus = {}));
63
+ const salesOrderStatusColors = Object.values({
64
+ [SalesOrderStatus.DRAFT]: PrimaryColors.$primaryBlueColor,
65
+ [SalesOrderStatus.PENDING_APPROVAL]: PrimaryColors.$primaryYellowColor,
66
+ [SalesOrderStatus.APPROVED]: PrimaryColors.$primaryTealColor,
67
+ [SalesOrderStatus.TO_DELIVER_AND_TO_BILL]: PrimaryColors.$primaryPurpleColor,
68
+ [SalesOrderStatus.TO_BILL]: PrimaryColors.$primaryPinkColor,
69
+ [SalesOrderStatus.PARTIALLY_DELIVERED_AND_PARTIALLY_BILLED]: PrimaryColors.$primaryOrangeColor,
70
+ [SalesOrderStatus.PARTIALLY_DELIVERED_AND_TO_BILL]: PrimaryColors.$primaryNavyBlueColor,
71
+ [SalesOrderStatus.COMPLETED]: PrimaryColors.$primaryLimeGreenColor,
72
+ [SalesOrderStatus.CANCELED]: PrimaryColors.$primaryGrayColor,
73
+ [SalesOrderStatus.CLOSED]: PrimaryColors.$primaryCarbonColor,
74
+ });
75
+
76
+ var BillStatus;
77
+ (function (BillStatus) {
78
+ BillStatus[BillStatus["DRAFT"] = 0] = "DRAFT";
79
+ BillStatus[BillStatus["RECEIVED"] = 1] = "RECEIVED";
80
+ BillStatus[BillStatus["PAID"] = 2] = "PAID";
81
+ BillStatus[BillStatus["CANCELLED"] = 3] = "CANCELLED";
82
+ BillStatus[BillStatus["RETURN"] = 4] = "RETURN";
83
+ BillStatus[BillStatus["DEBIT_NOTE_ISSUED"] = 5] = "DEBIT_NOTE_ISSUED";
84
+ BillStatus[BillStatus["PARTLY_PAID"] = 6] = "PARTLY_PAID";
85
+ BillStatus[BillStatus["UNPAID"] = 7] = "UNPAID";
86
+ BillStatus[BillStatus["OVERDUE"] = 8] = "OVERDUE";
87
+ })(BillStatus || (BillStatus = {}));
88
+ const billStatusColors = Object.values({
89
+ [BillStatus.DRAFT]: PrimaryColors.$primaryBlueColor,
90
+ [BillStatus.RECEIVED]: PrimaryColors.$primaryTealColor,
91
+ [BillStatus.PAID]: PrimaryColors.$primaryPurpleColor,
92
+ [BillStatus.CANCELLED]: PrimaryColors.$primaryGrayColor,
93
+ [BillStatus.RETURN]: PrimaryColors.$primaryPinkColor,
94
+ [BillStatus.DEBIT_NOTE_ISSUED]: PrimaryColors.$primaryNavyBlueColor,
95
+ [BillStatus.PARTLY_PAID]: PrimaryColors.$primaryYellowColor,
96
+ [BillStatus.UNPAID]: PrimaryColors.$primaryRedColor,
97
+ [BillStatus.OVERDUE]: PrimaryColors.$primaryOrangeColor,
98
+ });
99
+
100
+ var ChargeLevel;
101
+ (function (ChargeLevel) {
102
+ ChargeLevel[ChargeLevel["MAIN"] = 0] = "MAIN";
103
+ ChargeLevel[ChargeLevel["LINE"] = 1] = "LINE";
104
+ })(ChargeLevel || (ChargeLevel = {}));
105
+
106
+ var CustomOrderRequestStatus;
107
+ (function (CustomOrderRequestStatus) {
108
+ CustomOrderRequestStatus[CustomOrderRequestStatus["DRAFT"] = 0] = "DRAFT";
109
+ CustomOrderRequestStatus[CustomOrderRequestStatus["SENT"] = 1] = "SENT";
110
+ CustomOrderRequestStatus[CustomOrderRequestStatus["RESPONDED"] = 2] = "RESPONDED";
111
+ CustomOrderRequestStatus[CustomOrderRequestStatus["REJECTED"] = 3] = "REJECTED";
112
+ CustomOrderRequestStatus[CustomOrderRequestStatus["CANCELED"] = 4] = "CANCELED";
113
+ CustomOrderRequestStatus[CustomOrderRequestStatus["DECLINED"] = 5] = "DECLINED";
114
+ CustomOrderRequestStatus[CustomOrderRequestStatus["ACCEPTED"] = 6] = "ACCEPTED";
115
+ CustomOrderRequestStatus[CustomOrderRequestStatus["ORDER_CONFIRMED"] = 7] = "ORDER_CONFIRMED";
116
+ CustomOrderRequestStatus[CustomOrderRequestStatus["DELIVERED"] = 8] = "DELIVERED";
117
+ CustomOrderRequestStatus[CustomOrderRequestStatus["ON_HOLD"] = 9] = "ON_HOLD";
118
+ CustomOrderRequestStatus[CustomOrderRequestStatus["IN_PRODUCTION"] = 10] = "IN_PRODUCTION";
119
+ })(CustomOrderRequestStatus || (CustomOrderRequestStatus = {}));
120
+ const customOrderRequestStatusColors = Object.values({
121
+ [CustomOrderRequestStatus.DRAFT]: PrimaryColors.$primaryBlueColor,
122
+ [CustomOrderRequestStatus.SENT]: PrimaryColors.$primaryNavyBlueColor,
123
+ [CustomOrderRequestStatus.RESPONDED]: PrimaryColors.$primaryPurpleColor,
124
+ [CustomOrderRequestStatus.REJECTED]: PrimaryColors.$primaryRedColor,
125
+ [CustomOrderRequestStatus.CANCELED]: PrimaryColors.$primaryGrayColor,
126
+ [CustomOrderRequestStatus.DECLINED]: PrimaryColors.$primaryPinkColor,
127
+ [CustomOrderRequestStatus.ACCEPTED]: PrimaryColors.$primaryPurpleColor,
128
+ [CustomOrderRequestStatus.ORDER_CONFIRMED]: PrimaryColors.$primaryDarkPurpleColor,
129
+ [CustomOrderRequestStatus.IN_PRODUCTION]: PrimaryColors.$primaryLimeGreenColor,
130
+ [CustomOrderRequestStatus.DELIVERED]: PrimaryColors.$primaryTealColor,
131
+ [CustomOrderRequestStatus.ON_HOLD]: PrimaryColors.$primaryOrangeColor,
132
+ });
133
+
134
+ var InvitationStatus;
135
+ (function (InvitationStatus) {
136
+ InvitationStatus[InvitationStatus["PENDING"] = 0] = "PENDING";
137
+ InvitationStatus[InvitationStatus["ACCEPTED"] = 1] = "ACCEPTED";
138
+ InvitationStatus[InvitationStatus["EXPIRED"] = 2] = "EXPIRED";
139
+ InvitationStatus[InvitationStatus["CANCELED"] = 3] = "CANCELED";
140
+ })(InvitationStatus || (InvitationStatus = {}));
141
+ const invitationStatusColors = Object.values({
142
+ [InvitationStatus.PENDING]: PrimaryColors.$primaryYellowColor,
143
+ [InvitationStatus.ACCEPTED]: PrimaryColors.$primaryTealColor,
144
+ [InvitationStatus.EXPIRED]: PrimaryColors.$primaryGrayColor,
145
+ [InvitationStatus.CANCELED]: PrimaryColors.$primaryPinkColor,
146
+ });
147
+
148
+ var InvoiceStatus;
149
+ (function (InvoiceStatus) {
150
+ InvoiceStatus[InvoiceStatus["DRAFT"] = 0] = "DRAFT";
151
+ InvoiceStatus[InvoiceStatus["SUBMITTED"] = 1] = "SUBMITTED";
152
+ InvoiceStatus[InvoiceStatus["PAID"] = 2] = "PAID";
153
+ InvoiceStatus[InvoiceStatus["UNPAID"] = 3] = "UNPAID";
154
+ InvoiceStatus[InvoiceStatus["PARTLY_PAID"] = 4] = "PARTLY_PAID";
155
+ InvoiceStatus[InvoiceStatus["CANCELLED"] = 5] = "CANCELLED";
156
+ InvoiceStatus[InvoiceStatus["OVERDUE"] = 6] = "OVERDUE";
157
+ InvoiceStatus[InvoiceStatus["CREDIT_NOTE_ISSUED"] = 7] = "CREDIT_NOTE_ISSUED";
158
+ InvoiceStatus[InvoiceStatus["RETURN"] = 8] = "RETURN";
159
+ InvoiceStatus[InvoiceStatus["UNPAID_AND_DISCOUNTED"] = 9] = "UNPAID_AND_DISCOUNTED";
160
+ InvoiceStatus[InvoiceStatus["OVERDUE_AND_DISCOUNTED"] = 10] = "OVERDUE_AND_DISCOUNTED";
161
+ })(InvoiceStatus || (InvoiceStatus = {}));
162
+
163
+ var LockerTransferStatus;
164
+ (function (LockerTransferStatus) {
165
+ LockerTransferStatus[LockerTransferStatus["DRAFT"] = 0] = "DRAFT";
166
+ LockerTransferStatus[LockerTransferStatus["POSTED"] = 1] = "POSTED";
167
+ })(LockerTransferStatus || (LockerTransferStatus = {}));
168
+ const lockerTransferStatusColors = Object.values({
169
+ [LockerTransferStatus.DRAFT]: PrimaryColors.$primaryBlueColor,
170
+ [LockerTransferStatus.POSTED]: PrimaryColors.$primaryTealColor,
171
+ });
172
+
173
+ var Priority;
174
+ (function (Priority) {
175
+ Priority[Priority["LOW"] = 0] = "LOW";
176
+ Priority[Priority["NORMAL"] = 1] = "NORMAL";
177
+ Priority[Priority["HIGH"] = 2] = "HIGH";
178
+ })(Priority || (Priority = {}));
179
+ const priorityColors = Object.values({
180
+ [Priority.LOW]: PrimaryColors.$primaryTealColor,
181
+ [Priority.NORMAL]: PrimaryColors.$primaryOrangeColor,
182
+ [Priority.HIGH]: PrimaryColors.$primaryRedColor,
183
+ });
184
+
185
+ var QuotationStatus;
186
+ (function (QuotationStatus) {
187
+ QuotationStatus[QuotationStatus["CREATED"] = 0] = "CREATED";
188
+ QuotationStatus[QuotationStatus["SENT"] = 1] = "SENT";
189
+ QuotationStatus[QuotationStatus["REJECTED"] = 2] = "REJECTED";
190
+ QuotationStatus[QuotationStatus["CANCELED"] = 3] = "CANCELED";
191
+ QuotationStatus[QuotationStatus["ACCEPTED"] = 4] = "ACCEPTED";
192
+ QuotationStatus[QuotationStatus["EXPIRED"] = 5] = "EXPIRED";
193
+ })(QuotationStatus || (QuotationStatus = {}));
194
+ const quotationStatusColors = Object.values({
195
+ [QuotationStatus.CREATED]: PrimaryColors.$primaryLimeGreenColor,
196
+ [QuotationStatus.SENT]: PrimaryColors.$primaryNavyBlueColor,
197
+ [QuotationStatus.REJECTED]: PrimaryColors.$primaryOrangeRedColor,
198
+ [QuotationStatus.CANCELED]: PrimaryColors.$primaryOrangeColor,
199
+ [QuotationStatus.ACCEPTED]: PrimaryColors.$primaryTealColor,
200
+ [QuotationStatus.EXPIRED]: PrimaryColors.$primaryGrayColor,
201
+ });
202
+
203
+ var RequestStatus;
204
+ (function (RequestStatus) {
205
+ RequestStatus[RequestStatus["PENDING"] = 0] = "PENDING";
206
+ RequestStatus[RequestStatus["REJECTED"] = 1] = "REJECTED";
207
+ RequestStatus[RequestStatus["APPROVED"] = 2] = "APPROVED";
208
+ RequestStatus[RequestStatus["CANCELED"] = 3] = "CANCELED";
209
+ })(RequestStatus || (RequestStatus = {}));
210
+ const requestStatusColors = Object.values({
211
+ [RequestStatus.PENDING]: PrimaryColors.$primaryYellowColor,
212
+ [RequestStatus.REJECTED]: PrimaryColors.$primaryRedColor,
213
+ [RequestStatus.APPROVED]: PrimaryColors.$primaryTealColor,
214
+ [RequestStatus.CANCELED]: PrimaryColors.$primaryGrayColor,
215
+ });
216
+
217
+ // Enum Class Mapping
218
+ const enumClassMap = {
219
+ BOMProductionType: BOMProductionType,
220
+ InvoiceStatus: InvoiceStatus,
221
+ CustomOrderRequestStatus: CustomOrderRequestStatus,
222
+ Priority: Priority,
223
+ QuotationStatus: QuotationStatus,
224
+ LockerTransferStatus: LockerTransferStatus,
225
+ BillStatus: BillStatus,
226
+ SalesOrderStatus: SalesOrderStatus,
227
+ RequestStatus: RequestStatus,
228
+ InvitationStatus: InvitationStatus,
229
+ ChargeLevel: ChargeLevel,
230
+ };
231
+
232
+ const enumCustomColors = [
233
+ { enumClass: 'CustomOrderRequestStatus', colors: customOrderRequestStatusColors },
234
+ { enumClass: 'Priority', colors: priorityColors },
235
+ { enumClass: 'QuotationStatus', colors: quotationStatusColors },
236
+ { enumClass: 'LockerTransferStatus', colors: lockerTransferStatusColors },
237
+ { enumClass: 'BillStatus', colors: billStatusColors },
238
+ { enumClass: 'SalesOrderStatus', colors: salesOrderStatusColors },
239
+ { enumClass: 'RequestStatus', colors: requestStatusColors },
240
+ { enumClass: 'InvitationStatus', colors: invitationStatusColors },
241
+ { enumClass: 'BOMProductionType', colors: bomProductionTypeColors },
242
+ ];
243
+
244
+ class EnumCustomColorMapping {
245
+ enumClass;
246
+ colors;
247
+ constructor(enumClass, colors) {
248
+ this.enumClass = enumClass;
249
+ if (this.validateColors(enumClass, colors)) {
250
+ this.colors = colors;
251
+ }
252
+ else {
253
+ throw new Error(`The length of your custom colors list does not match the enum class provided.`);
254
+ }
255
+ }
256
+ validateColors(enumClass, colors) {
257
+ // Get the total number of enum values by counting keys
258
+ const enumValues = Object.keys(enumClass).filter(key => isNaN(Number(key))).length;
259
+ return colors.length === enumValues;
260
+ }
261
+ }
262
+ // Function to create EnumCustomColorMapping instances from JSON array
263
+ function createEnumCustomColorMappings(mappings) {
264
+ return mappings.map(json => {
265
+ const enumClass = enumClassMap[json.enumClass];
266
+ if (!enumClass) {
267
+ throw new Error(`Enum class "${json.enumClass}" not found.`);
268
+ }
269
+ return new EnumCustomColorMapping(enumClass, json.colors);
270
+ });
271
+ }
272
+ const enumCustomColorMappings = createEnumCustomColorMappings(enumCustomColors);
273
+
20
274
  class CustomTheme {
21
275
  static $joolerBlue = [
22
276
  '#e3ecfa',
@@ -121,49 +375,135 @@ class CustomTheme {
121
375
  ];
122
376
  }
123
377
 
378
+ var enumCustomLabelMappingsJSON = [
379
+ {
380
+ enumClass: "BOMProductionType",
381
+ labels: [
382
+ "Manufactured In-House",
383
+ "Partially Manufactured In-House"
384
+ ]
385
+ },
386
+ {
387
+ enumClass: "ChargeLevel",
388
+ labels: [
389
+ "Header",
390
+ "Line"
391
+ ]
392
+ }
393
+ ];
394
+
395
+ class EnumCustomLabelMapping {
396
+ enumClass;
397
+ labels;
398
+ constructor(enumClass, labels) {
399
+ this.enumClass = enumClass;
400
+ if (this.validateLabels(enumClass, labels)) {
401
+ this.labels = labels;
402
+ }
403
+ else {
404
+ throw new Error('The length of your custom labels list does not match the enum class provided.');
405
+ }
406
+ }
407
+ validateLabels(enumClass, labels) {
408
+ // Get the total number of enum values by counting keys
409
+ const enumValues = Object.keys(enumClass).filter(key => isNaN(Number(key))).length;
410
+ return labels.length === enumValues;
411
+ }
412
+ }
413
+ // Function to create EnumCustomLabelMapping instances from JSON array
414
+ function createEnumCustomLabelMappingsFromJSON(jsonArray) {
415
+ return jsonArray.map(json => {
416
+ const enumClass = enumClassMap[json.enumClass];
417
+ if (!enumClass) {
418
+ throw new Error(`Enum class "${json.enumClass}" not found.`);
419
+ }
420
+ return new EnumCustomLabelMapping(enumClass, json.labels);
421
+ });
422
+ }
423
+ const enumCustomLabelMappings = createEnumCustomLabelMappingsFromJSON(enumCustomLabelMappingsJSON);
424
+
425
+ class EnumOption {
426
+ value;
427
+ label;
428
+ color;
429
+ description;
430
+ disabled;
431
+ constructor(value, label, color, disabled = false) {
432
+ this.value = value;
433
+ this.label = label;
434
+ this.color = color;
435
+ this.disabled = disabled;
436
+ }
437
+ }
438
+
124
439
  class EnumHelperBaseClass {
125
- static getEnumOptionsFromEnumClass(enumClass, customColors, isAllCaps) {
440
+ static getEnumOptionsFromEnumClass(enumClass, customColors, isAllCaps = false, isIntegerChoice = true) {
441
+ const enumOptions = [];
442
+ // Get string keys only (filter out numeric reverse mappings)
443
+ const enumKeys = Object.keys(enumClass).filter(k => isNaN(Number(k)));
444
+ // Prepare display labels
445
+ const stringValues = EnumHelperBaseClass.getStringValuesForEnumClass(enumClass, isAllCaps);
446
+ // Prepare colors
447
+ const colors = EnumHelperBaseClass.getColorsForEnumClass(enumClass, stringValues, customColors);
448
+ enumKeys.forEach((key, idx) => {
449
+ let value;
450
+ if (isIntegerChoice) {
451
+ value = enumClass[key]; // numeric value
452
+ }
453
+ else {
454
+ value = key; // string value
455
+ }
456
+ const label = stringValues[idx];
457
+ const color = colors[idx];
458
+ enumOptions.push(new EnumOption(value, label, color));
459
+ });
460
+ return enumOptions;
461
+ }
462
+ static getColorsForEnumClass(enumClass, stringValues, customColors) {
126
463
  let colors = CustomTheme.$joolerCombo;
464
+ let enumSpecificColors = enumCustomColorMappings.find(item => Object.keys(item.enumClass).toString() == Object.keys(enumClass).toString());
465
+ if (enumSpecificColors) {
466
+ colors = enumSpecificColors.colors;
467
+ }
127
468
  if (customColors && customColors.length > 0) {
128
469
  colors = customColors;
129
470
  }
471
+ // in case the array of colors is smaller than the stringValues array, we repeat the the colors so that they are enough
472
+ if (stringValues.length > colors.length) {
473
+ for (let label of stringValues) {
474
+ colors.push(colors[stringValues.indexOf(label) % colors.length]);
475
+ }
476
+ }
477
+ return colors;
478
+ }
479
+ static getStringValuesForEnumClass(enumClass, isAllCaps) {
130
480
  let stringValues = [];
131
- let enumOption;
132
- let enumOptions = [];
133
- for (let item in enumClass) {
134
- if (isNaN(Number(item))) {
135
- let joinedString;
136
- stringValues.push(item);
137
- let splitStr = item.toLowerCase().split('_');
138
- if (!isAllCaps) {
139
- for (let i = 0; i < splitStr.length; i++) {
140
- splitStr[i] =
141
- splitStr[i].charAt(0).toUpperCase() + splitStr[i].substring(1);
481
+ let enumCustomLabels = enumCustomLabelMappings.find(item => Object.keys(item.enumClass).toString() == Object.keys(enumClass).toString());
482
+ if (enumCustomLabels) {
483
+ stringValues = enumCustomLabels.labels;
484
+ }
485
+ else {
486
+ for (let item in enumClass) {
487
+ if (isNaN(Number(item))) {
488
+ let joinedString;
489
+ stringValues.push(item);
490
+ let splitStr = item.toLowerCase().split('_');
491
+ if (!isAllCaps) {
492
+ for (let i = 0; i < splitStr.length; i++) {
493
+ splitStr[i] = splitStr[i].charAt(0).toUpperCase() + splitStr[i].substring(1);
494
+ }
142
495
  }
143
- }
144
- else {
145
- for (let i = 0; i < splitStr.length; i++) {
146
- splitStr[i] = splitStr[i].toUpperCase();
496
+ else {
497
+ for (let i = 0; i < splitStr.length; i++) {
498
+ splitStr[i] = splitStr[i].toUpperCase();
499
+ }
147
500
  }
501
+ joinedString = splitStr.join(' ');
502
+ stringValues.splice(stringValues.indexOf(item), 1, joinedString);
148
503
  }
149
- joinedString = splitStr.join(' ');
150
- stringValues.splice(stringValues.indexOf(item), 1, joinedString);
151
504
  }
152
505
  }
153
- let repeatedColors = [];
154
- let i = 0;
155
- for (let label of stringValues) {
156
- // in case the array of colors is smaller than the stringValues array, we repeat the the colors so that they are enough
157
- repeatedColors.push(colors[stringValues.indexOf(label) % colors.length]);
158
- enumOption = {
159
- value: Object.keys(enumClass).map(Number)[i],
160
- label: label,
161
- color: repeatedColors[i],
162
- };
163
- enumOptions.push(enumOption);
164
- i++;
165
- }
166
- return enumOptions;
506
+ return stringValues;
167
507
  }
168
508
  static getLabelAndColorFromEnumValue(enumClass, enumValue, customColors) {
169
509
  let enumOptions = EnumHelperBaseClass.getEnumOptionsFromEnumClass(enumClass, customColors);
@@ -184,13 +524,11 @@ class ChooseEnumComponent {
184
524
  clearable = true;
185
525
  customColors;
186
526
  enumChoices;
187
- virtualScroll = false;
188
527
  getValuesArrayFromEnum = EnumHelperBaseClass.getEnumOptionsFromEnumClass;
189
- indexesToDisable = [];
528
+ valuesToDisable = [];
529
+ valuesToHide = [];
190
530
  isChip = true;
191
531
  isDropdownDisabled = false;
192
- isItemHidden;
193
- isItemDisabled;
194
532
  isMultiple;
195
533
  label = 'label';
196
534
  labelTextAlign = 'left';
@@ -201,49 +539,63 @@ class ChooseEnumComponent {
201
539
  percentWidth = false;
202
540
  selectedItem;
203
541
  width;
542
+ isReadOnly = false;
543
+ virtualScroll = false;
204
544
  change = new EventEmitter();
205
545
  close = new EventEmitter();
206
546
  constructor() { }
207
- ngOnChanges() {
547
+ ngOnInit() {
208
548
  if (this.getValuesArrayFromEnum != null) {
209
549
  this.items = this.getValuesArrayFromEnum(this.enumChoices, this.customColors, this.allowAllCapsValues);
210
550
  }
211
- if (this.isItemDisabled == true) {
212
- if (this.indexesToDisable.length > 0) {
213
- for (let index of this.indexesToDisable) {
214
- this.items[index].disabled = true;
215
- }
216
- }
551
+ if (this.valuesToDisable.length > 0) {
552
+ this.disabledItems();
217
553
  }
218
- if (this.isItemHidden == true) {
219
- if (this.indexesToDisable.length > 0) {
220
- for (let index of this.indexesToDisable) {
221
- let itemIndex = this.items.findIndex((item) => item.value == index);
222
- this.items.splice(itemIndex, 1);
223
- }
224
- }
554
+ if (this.valuesToHide.length > 0) {
555
+ this.hideItems();
225
556
  }
557
+ this.sortAndReorderItems();
226
558
  }
227
- ngOnInit() {
559
+ ngOnChanges() {
228
560
  if (this.getValuesArrayFromEnum != null) {
229
561
  this.items = this.getValuesArrayFromEnum(this.enumChoices, this.customColors, this.allowAllCapsValues);
230
562
  }
231
- if (this.isItemDisabled == true) {
232
- if (this.indexesToDisable.length > 0) {
233
- for (let index of this.indexesToDisable) {
234
- this.items[index].disabled = true;
235
- }
563
+ if (this.valuesToDisable.length > 0) {
564
+ this.disabledItems();
565
+ }
566
+ if (this.valuesToHide.length > 0) {
567
+ this.hideItems();
568
+ }
569
+ this.sortAndReorderItems();
570
+ }
571
+ disabledItems() {
572
+ for (let value of this.valuesToDisable) {
573
+ let index = this.items.findIndex(enumOption => enumOption.value == value);
574
+ if (index >= 0) {
575
+ this.items[index].disabled = true;
576
+ }
577
+ else {
578
+ throw Error('Index was not found for an enum element in the valuesToDisable array provided.');
236
579
  }
237
580
  }
238
- if (this.isItemHidden == true) {
239
- if (this.indexesToDisable.length > 0) {
240
- for (let index of this.indexesToDisable) {
241
- let itemIndex = this.items.findIndex((item) => item.value == index);
242
- this.items.splice(itemIndex, 1);
243
- }
581
+ }
582
+ hideItems() {
583
+ for (let value of this.valuesToHide) {
584
+ let index = this.items.findIndex(enumOption => enumOption.value == value);
585
+ if (index >= 0) {
586
+ this.items.splice(index, 1);
587
+ }
588
+ else {
589
+ throw Error('Index was not found for an enum element in the valuesToHide array provided.');
244
590
  }
245
591
  }
246
592
  }
593
+ sortAndReorderItems() {
594
+ const nonDisabledItems = this.items.filter(item => !item.disabled);
595
+ const disabledItems = this.items.filter(item => item.disabled);
596
+ nonDisabledItems.sort((a, b) => a.label.localeCompare(b.label));
597
+ this.items = [...nonDisabledItems, ...disabledItems];
598
+ }
247
599
  writeValue(type) {
248
600
  if (type != undefined) {
249
601
  this.selectedItem = type;
@@ -265,6 +617,7 @@ class ChooseEnumComponent {
265
617
  this.close.emit();
266
618
  }
267
619
  onSelectedItemChanged() {
620
+ this.propogateTouch();
268
621
  this.propagateChange(this.selectedItem);
269
622
  this.change.emit(this.selectedItem);
270
623
  }
@@ -273,6 +626,7 @@ class ChooseEnumComponent {
273
626
  }
274
627
  clear() {
275
628
  this.selectedItem = null;
629
+ this.propogateTouch();
276
630
  }
277
631
  setStyles() {
278
632
  let style = {
@@ -288,17 +642,18 @@ class ChooseEnumComponent {
288
642
  textAlign: this.labelTextAlign,
289
643
  fontWeight: this.labelTextFontWeight,
290
644
  fontSize: this.labelTextFontSize + 'rem',
645
+ padding: '0.4rem',
291
646
  };
292
647
  return style;
293
648
  }
294
649
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ChooseEnumComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
295
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ChooseEnumComponent, selector: "choose-enum", inputs: { appendTo: "appendTo", allowAllCapsValues: "allowAllCapsValues", clearable: "clearable", customColors: "customColors", enumChoices: "enumChoices", virtualScroll: "virtualScroll", getValuesArrayFromEnum: "getValuesArrayFromEnum", indexesToDisable: "indexesToDisable", isChip: "isChip", isDropdownDisabled: "isDropdownDisabled", isItemHidden: "isItemHidden", isItemDisabled: "isItemDisabled", isMultiple: "isMultiple", label: "label", labelTextAlign: "labelTextAlign", labelTextFontWeight: "labelTextFontWeight", labelTextFontSize: "labelTextFontSize", paddingTop: "paddingTop", placeholder: "placeholder", percentWidth: "percentWidth", selectedItem: "selectedItem", width: "width" }, outputs: { change: "change", close: "close" }, providers: [
650
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ChooseEnumComponent, selector: "choose-enum", inputs: { appendTo: "appendTo", allowAllCapsValues: "allowAllCapsValues", clearable: "clearable", customColors: "customColors", enumChoices: "enumChoices", getValuesArrayFromEnum: "getValuesArrayFromEnum", valuesToDisable: "valuesToDisable", valuesToHide: "valuesToHide", isChip: "isChip", isDropdownDisabled: "isDropdownDisabled", isMultiple: "isMultiple", label: "label", labelTextAlign: "labelTextAlign", labelTextFontWeight: "labelTextFontWeight", labelTextFontSize: "labelTextFontSize", paddingTop: "paddingTop", placeholder: "placeholder", percentWidth: "percentWidth", selectedItem: "selectedItem", width: "width", isReadOnly: "isReadOnly", virtualScroll: "virtualScroll" }, outputs: { change: "change", close: "close" }, providers: [
296
651
  {
297
652
  provide: NG_VALUE_ACCESSOR,
298
653
  useExisting: forwardRef(() => ChooseEnumComponent),
299
654
  multi: true,
300
655
  },
301
- ], usesOnChanges: true, ngImport: i0, template: "<div class=\"select\">\r\n <ng-select\r\n [ngStyle]=\"setStyles()\"\r\n (blur)=\"updateBlur()\"\r\n bindLabel=\"label\"\r\n bindValue=\"value\"\r\n [items]=\"items\"\r\n [placeholder]=\"placeholder\"\r\n (change)=\"onSelectedItemChanged()\"\r\n [(ngModel)]=\"selectedItem\"\r\n [multiple]=\"isMultiple\"\r\n [disabled]=\"isDropdownDisabled\"\r\n [clearable]=\"clearable\"\r\n [virtualScroll]=\"virtualScroll\"\r\n [clearAllText]=\"'clear everything'\"\r\n (clear)=\"clear()\"\r\n [appendTo]=\"appendTo\"\r\n dropdownPosition=\"bottom\">\r\n <ng-template\r\n class=\"template\"\r\n ng-option-tmp\r\n ng-label-tmp\r\n let-item=\"item\"\r\n let-index=\"index\"\r\n let-search=\"searchTerm\">\r\n <div *ngIf=\"isChip\">\r\n <ng-chip [enumClass]=\"enumChoices\" [enumValue]=\"item.value\" [customColors]=\"customColors\">\r\n </ng-chip>\r\n </div>\r\n <div [ngStyle]=\"setLabelStyle()\" *ngIf=\"!isChip\">{{ item.label }}</div>\r\n </ng-template>\r\n </ng-select>\r\n</div>\r\n", styles: [".select{width:100%}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: i2.NgSelectComponent, selector: "ng-select", inputs: ["bindLabel", "bindValue", "markFirst", "placeholder", "notFoundText", "typeToSearchText", "addTagText", "loadingText", "clearAllText", "appearance", "dropdownPosition", "appendTo", "loading", "closeOnSelect", "hideSelected", "selectOnTab", "openOnEnter", "maxSelectedItems", "groupBy", "groupValue", "bufferAmount", "virtualScroll", "selectableGroup", "selectableGroupAsModel", "searchFn", "trackByFn", "clearOnBackspace", "labelForId", "inputAttrs", "tabIndex", "readonly", "searchWhileComposing", "minTermLength", "editableSearchTerm", "keyDownFn", "typeahead", "multiple", "addTag", "searchable", "clearable", "isOpen", "items", "compareWith", "clearSearchOnAdd", "deselectOnClick"], outputs: ["blur", "focus", "change", "open", "close", "search", "clear", "add", "remove", "scroll", "scrollToEnd"] }, { kind: "directive", type: i2.NgOptionTemplateDirective, selector: "[ng-option-tmp]" }, { kind: "directive", type: i2.NgLabelTemplateDirective, selector: "[ng-label-tmp]" }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i4.NgChipComponent, selector: "ng-chip", inputs: ["backgroundColor", "size", "clear", "customColors", "enumClass", "enumValue", "inputType", "item", "isClickable", "label", "width", "withCross"] }] });
656
+ ], usesOnChanges: true, ngImport: i0, template: "<div>\r\n <ng-select [ngStyle]=\"setStyles()\" (blur)=\"updateBlur()\" bindLabel=\"label\" bindValue=\"value\" [items]=\"items\"\r\n [virtualScroll]=\"virtualScroll\" [placeholder]=\"placeholder\" (change)=\"onSelectedItemChanged()\"\r\n [(ngModel)]=\"selectedItem\" [multiple]=\"isMultiple\" [disabled]=\"isDropdownDisabled\" [readonly]=\"isReadOnly\"\r\n [clearable]=\"clearable\" (clear)=\"clear()\" [appendTo]=\"appendTo\" dropdownPosition=\"bottom\">\r\n <ng-template ng-label-tmp let-item=\"item\" let-clear=\"clear\">\r\n <ng-container *ngIf=\"isChip\">\r\n <ng-container [ngTemplateOutlet]=\"chip\"\r\n [ngTemplateOutletContext]=\"{ item: item, showCross: clearable, clear: clear }\">\r\n </ng-container>\r\n </ng-container>\r\n <div [ngStyle]=\"setLabelStyle()\" *ngIf=\"!isChip\">{{ item.label }}</div>\r\n </ng-template>\r\n <ng-template ng-option-tmp let-item=\"item\" let-index=\"index\" let-search=\"searchTerm\" let-clear=\"clear\">\r\n <div [ngClass]=\"{ disabled: item.disabled }\">\r\n <div *ngIf=\"isChip\" class=\"chip\">\r\n <ng-container [ngTemplateOutlet]=\"chip\"\r\n [ngTemplateOutletContext]=\"{ item: item, showCross: false, clear: clear }\">\r\n </ng-container>\r\n </div>\r\n <div [ngStyle]=\"setLabelStyle()\" *ngIf=\"!isChip\">{{ item.label }}</div>\r\n </div>\r\n </ng-template>\r\n </ng-select>\r\n</div>\r\n\r\n<ng-template #chip let-showCross=\"showCross\" let-item=\"item\" let-clear=\"clear\">\r\n <ng-chip [enumClass]=\"enumChoices\" [withCross]=\"showCross\" [enumValue]=\"item.value\" [customColors]=\"customColors\"\r\n [item]=\"item\" [clear]=\"clear\">\r\n </ng-chip>\r\n</ng-template>", styles: [".disabled{cursor:not-allowed}.disabled .chip{filter:opacity(.3)}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: i2.NgSelectComponent, selector: "ng-select", inputs: ["bindLabel", "bindValue", "markFirst", "placeholder", "notFoundText", "typeToSearchText", "addTagText", "loadingText", "clearAllText", "appearance", "dropdownPosition", "appendTo", "loading", "closeOnSelect", "hideSelected", "selectOnTab", "openOnEnter", "maxSelectedItems", "groupBy", "groupValue", "bufferAmount", "virtualScroll", "selectableGroup", "selectableGroupAsModel", "searchFn", "trackByFn", "clearOnBackspace", "labelForId", "inputAttrs", "tabIndex", "readonly", "searchWhileComposing", "minTermLength", "editableSearchTerm", "keyDownFn", "typeahead", "multiple", "addTag", "searchable", "clearable", "isOpen", "items", "compareWith", "clearSearchOnAdd", "deselectOnClick"], outputs: ["blur", "focus", "change", "open", "close", "search", "clear", "add", "remove", "scroll", "scrollToEnd"] }, { kind: "directive", type: i2.NgOptionTemplateDirective, selector: "[ng-option-tmp]" }, { kind: "directive", type: i2.NgLabelTemplateDirective, selector: "[ng-label-tmp]" }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i4.NgChipComponent, selector: "ng-chip", inputs: ["backgroundColor", "size", "clear", "customColors", "enumClass", "enumValue", "inputType", "item", "isClickable", "label", "width", "withCross"] }] });
302
657
  }
303
658
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ChooseEnumComponent, decorators: [{
304
659
  type: Component,
@@ -308,7 +663,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
308
663
  useExisting: forwardRef(() => ChooseEnumComponent),
309
664
  multi: true,
310
665
  },
311
- ], template: "<div class=\"select\">\r\n <ng-select\r\n [ngStyle]=\"setStyles()\"\r\n (blur)=\"updateBlur()\"\r\n bindLabel=\"label\"\r\n bindValue=\"value\"\r\n [items]=\"items\"\r\n [placeholder]=\"placeholder\"\r\n (change)=\"onSelectedItemChanged()\"\r\n [(ngModel)]=\"selectedItem\"\r\n [multiple]=\"isMultiple\"\r\n [disabled]=\"isDropdownDisabled\"\r\n [clearable]=\"clearable\"\r\n [virtualScroll]=\"virtualScroll\"\r\n [clearAllText]=\"'clear everything'\"\r\n (clear)=\"clear()\"\r\n [appendTo]=\"appendTo\"\r\n dropdownPosition=\"bottom\">\r\n <ng-template\r\n class=\"template\"\r\n ng-option-tmp\r\n ng-label-tmp\r\n let-item=\"item\"\r\n let-index=\"index\"\r\n let-search=\"searchTerm\">\r\n <div *ngIf=\"isChip\">\r\n <ng-chip [enumClass]=\"enumChoices\" [enumValue]=\"item.value\" [customColors]=\"customColors\">\r\n </ng-chip>\r\n </div>\r\n <div [ngStyle]=\"setLabelStyle()\" *ngIf=\"!isChip\">{{ item.label }}</div>\r\n </ng-template>\r\n </ng-select>\r\n</div>\r\n", styles: [".select{width:100%}\n"] }]
666
+ ], template: "<div>\r\n <ng-select [ngStyle]=\"setStyles()\" (blur)=\"updateBlur()\" bindLabel=\"label\" bindValue=\"value\" [items]=\"items\"\r\n [virtualScroll]=\"virtualScroll\" [placeholder]=\"placeholder\" (change)=\"onSelectedItemChanged()\"\r\n [(ngModel)]=\"selectedItem\" [multiple]=\"isMultiple\" [disabled]=\"isDropdownDisabled\" [readonly]=\"isReadOnly\"\r\n [clearable]=\"clearable\" (clear)=\"clear()\" [appendTo]=\"appendTo\" dropdownPosition=\"bottom\">\r\n <ng-template ng-label-tmp let-item=\"item\" let-clear=\"clear\">\r\n <ng-container *ngIf=\"isChip\">\r\n <ng-container [ngTemplateOutlet]=\"chip\"\r\n [ngTemplateOutletContext]=\"{ item: item, showCross: clearable, clear: clear }\">\r\n </ng-container>\r\n </ng-container>\r\n <div [ngStyle]=\"setLabelStyle()\" *ngIf=\"!isChip\">{{ item.label }}</div>\r\n </ng-template>\r\n <ng-template ng-option-tmp let-item=\"item\" let-index=\"index\" let-search=\"searchTerm\" let-clear=\"clear\">\r\n <div [ngClass]=\"{ disabled: item.disabled }\">\r\n <div *ngIf=\"isChip\" class=\"chip\">\r\n <ng-container [ngTemplateOutlet]=\"chip\"\r\n [ngTemplateOutletContext]=\"{ item: item, showCross: false, clear: clear }\">\r\n </ng-container>\r\n </div>\r\n <div [ngStyle]=\"setLabelStyle()\" *ngIf=\"!isChip\">{{ item.label }}</div>\r\n </div>\r\n </ng-template>\r\n </ng-select>\r\n</div>\r\n\r\n<ng-template #chip let-showCross=\"showCross\" let-item=\"item\" let-clear=\"clear\">\r\n <ng-chip [enumClass]=\"enumChoices\" [withCross]=\"showCross\" [enumValue]=\"item.value\" [customColors]=\"customColors\"\r\n [item]=\"item\" [clear]=\"clear\">\r\n </ng-chip>\r\n</ng-template>", styles: [".disabled{cursor:not-allowed}.disabled .chip{filter:opacity(.3)}\n"] }]
312
667
  }], ctorParameters: function () { return []; }, propDecorators: { appendTo: [{
313
668
  type: Input
314
669
  }], allowAllCapsValues: [{
@@ -319,20 +674,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
319
674
  type: Input
320
675
  }], enumChoices: [{
321
676
  type: Input
322
- }], virtualScroll: [{
323
- type: Input
324
677
  }], getValuesArrayFromEnum: [{
325
678
  type: Input
326
- }], indexesToDisable: [{
679
+ }], valuesToDisable: [{
680
+ type: Input
681
+ }], valuesToHide: [{
327
682
  type: Input
328
683
  }], isChip: [{
329
684
  type: Input
330
685
  }], isDropdownDisabled: [{
331
686
  type: Input
332
- }], isItemHidden: [{
333
- type: Input
334
- }], isItemDisabled: [{
335
- type: Input
336
687
  }], isMultiple: [{
337
688
  type: Input
338
689
  }], label: [{
@@ -353,6 +704,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
353
704
  type: Input
354
705
  }], width: [{
355
706
  type: Input
707
+ }], isReadOnly: [{
708
+ type: Input
709
+ }], virtualScroll: [{
710
+ type: Input
356
711
  }], change: [{
357
712
  type: Output
358
713
  }], close: [{
@@ -380,32 +735,116 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
380
735
  type: Input
381
736
  }] } });
382
737
 
383
- class ChooseEnumRendererComponent {
738
+ class AgGridSelectMixin {
384
739
  params;
385
- formControlValue;
386
740
  key;
387
- enumValue;
741
+ value;
388
742
  rowId;
389
- constructor() { }
743
+ isEdit;
744
+ index;
745
+ arrayKey = 'entries';
746
+ rowLevelFG;
747
+ width;
748
+ selectedItemId;
390
749
  agInit(params) {
750
+ this.initializeRenderer(params);
751
+ }
752
+ initializeRenderer(params) {
391
753
  this.params = params;
392
- this.enumValue = params.value;
754
+ this.width = params.width;
393
755
  this.key = params.context.createKey(params.columnApi, params.column);
756
+ this.value = params.value;
757
+ this.rowId = params.node.id;
758
+ this.index = params.node.rowIndex;
759
+ if (params.context.arrayKey) {
760
+ this.arrayKey = params.context.arrayKey;
761
+ }
762
+ this.setRowLevelFG();
763
+ }
764
+ setRowLevelFG() {
765
+ this.index = this.params.node.rowIndex;
766
+ let tableFG = this.params.context.formGroup;
767
+ let fa = tableFG.get(this.arrayKey);
768
+ let rowLevelFG = fa.at(this.index);
769
+ this.rowLevelFG = rowLevelFG;
770
+ }
771
+ getFormControl() {
772
+ let fc = this.rowLevelFG.get(this.key);
773
+ return fc;
774
+ }
775
+ updateValue(params, value) {
776
+ this.setRowLevelFG();
777
+ this.getFormControl().setValue(value);
778
+ let rowNode = params.node;
779
+ rowNode.setDataValue(this.key, value);
780
+ }
781
+ // $event here is an object.
782
+ onSelection($event) {
783
+ this.selectedItemId = $event?.id;
784
+ this.updateValue(this.params, $event?.id);
785
+ if (this.params.onSelection instanceof Function) {
786
+ const params = {
787
+ object: $event,
788
+ rowData: this.params.node.data,
789
+ value: $event.id,
790
+ rowNode: this.params.node,
791
+ };
792
+ this.params.onSelection(params);
793
+ }
394
794
  }
395
- onCellDataChanged($event) {
396
- let value = $event;
397
- this.formControlValue = this.params.context.formGroup.get("entries").at(this.params.node.rowIndex);
398
- this.formControlValue?.get(this.key).setValue(value);
795
+ onEnumSelected($event) {
796
+ this.updateValue(this.params, $event);
797
+ if (this.params.onSelection instanceof Function) {
798
+ const params = {
799
+ rowData: this.params.node.data,
800
+ value: $event,
801
+ rowNode: this.params.node,
802
+ };
803
+ this.params.onSelection(params);
804
+ }
399
805
  }
400
- refresh(params) {
806
+ refresh(param) {
401
807
  return false;
402
808
  }
809
+ }
810
+
811
+ class ChooseEnumRendererComponent extends AgGridSelectMixin {
812
+ valuesToDisable = [];
813
+ valuesToHide = [];
814
+ isChip = true;
815
+ clearable = true;
816
+ constructor() {
817
+ super();
818
+ }
819
+ agInit(params) {
820
+ super.agInit(params);
821
+ if (params.valuesToDisable != null) {
822
+ this.valuesToDisable = params.valuesToDisable;
823
+ }
824
+ if (params.valuesToHide != null) {
825
+ this.valuesToHide = params.valuesToHide;
826
+ }
827
+ if (params.isChip != null) {
828
+ this.isChip = params.isChip;
829
+ }
830
+ if (params.clearable != null) {
831
+ this.clearable = params.clearable;
832
+ }
833
+ }
834
+ get showError() {
835
+ if (this.rowLevelFG.get(this.key).errors && this.rowLevelFG.get(this.key).touched) {
836
+ return true;
837
+ }
838
+ else {
839
+ return false;
840
+ }
841
+ }
403
842
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ChooseEnumRendererComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
404
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ChooseEnumRendererComponent, selector: "choose-enum-renderer", ngImport: i0, template: "<choose-enum [label]=\"params.label\" [appendTo]=\"'body'\" [isItemHidden]=\"params.isItemHidden\"\r\n [isItemDisabled]=\"params.isItemDisabled\" [labelTextAlign]=\"params.labelTextAlign\"\r\n [labelTextFontWeight]=\"params.labelTextFontWeight\" [labelTextFontSize]=\"params.labelTextFontSize\"\r\n [selectedItem]=\"params.value\" [indexesToDisable]=\"params.indexesToDisable\"\r\n [isDropdownDisabled]=\"params.isDropdownDisabled\" [getValuesArrayFromEnum]=\"params.getLabelAndColorFromEnumValue\"\r\n [enumChoices]=\"params.enumChoices\" [placeholder]=\"params.placeholder\" [width]=\"params.width\"\r\n [isChip]=\"params.isChip\" [paddingTop]=\"params.paddingTop\" [allowAllCapsValues]=\"params.allowAllCapsValues\"\r\n (change)=\"onCellDataChanged($event)\">\r\n</choose-enum>", styles: [""], dependencies: [{ kind: "component", type: ChooseEnumComponent, selector: "choose-enum", inputs: ["appendTo", "allowAllCapsValues", "clearable", "customColors", "enumChoices", "virtualScroll", "getValuesArrayFromEnum", "indexesToDisable", "isChip", "isDropdownDisabled", "isItemHidden", "isItemDisabled", "isMultiple", "label", "labelTextAlign", "labelTextFontWeight", "labelTextFontSize", "paddingTop", "placeholder", "percentWidth", "selectedItem", "width"], outputs: ["change", "close"] }] });
843
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ChooseEnumRendererComponent, selector: "choose-enum-renderer", usesInheritance: true, ngImport: i0, template: "<div class=\"all\" [ngClass]=\"{ single: !showError, double: showError }\" *ngIf=\"rowLevelFG\" [formGroup]=\"rowLevelFG\">\r\n <choose-enum [clearable]=\"clearable\" [formControlName]=\"key\" [appendTo]=\"'body'\" [label]=\"params.label\"\r\n [labelTextAlign]=\"params.labelTextAlign\" [labelTextFontWeight]=\"params.labelTextFontWeight\"\r\n [labelTextFontSize]=\"params.labelTextFontSize\" [selectedItem]=\"params.value\" [valuesToHide]=\"valuesToHide\"\r\n [valuesToDisable]=\"valuesToDisable\" [isDropdownDisabled]=\"params.isDropdownDisabled\"\r\n [enumChoices]=\"params.enumChoices\" [placeholder]=\"params.placeholder\" [width]=\"params.width\" [isChip]=\"isChip\"\r\n [paddingTop]=\"params.paddingTop\" [customColors]=\"params.customColors\" (change)=\"onEnumSelected($event)\">\r\n </choose-enum>\r\n</div>", styles: [".all{display:grid;gap:.5rem;align-items:center;margin:auto}.single{grid-template-columns:auto}.double{grid-template-columns:auto max-content}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: ChooseEnumComponent, selector: "choose-enum", inputs: ["appendTo", "allowAllCapsValues", "clearable", "customColors", "enumChoices", "getValuesArrayFromEnum", "valuesToDisable", "valuesToHide", "isChip", "isDropdownDisabled", "isMultiple", "label", "labelTextAlign", "labelTextFontWeight", "labelTextFontSize", "paddingTop", "placeholder", "percentWidth", "selectedItem", "width", "isReadOnly", "virtualScroll"], outputs: ["change", "close"] }] });
405
844
  }
406
845
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ChooseEnumRendererComponent, decorators: [{
407
846
  type: Component,
408
- args: [{ selector: 'choose-enum-renderer', template: "<choose-enum [label]=\"params.label\" [appendTo]=\"'body'\" [isItemHidden]=\"params.isItemHidden\"\r\n [isItemDisabled]=\"params.isItemDisabled\" [labelTextAlign]=\"params.labelTextAlign\"\r\n [labelTextFontWeight]=\"params.labelTextFontWeight\" [labelTextFontSize]=\"params.labelTextFontSize\"\r\n [selectedItem]=\"params.value\" [indexesToDisable]=\"params.indexesToDisable\"\r\n [isDropdownDisabled]=\"params.isDropdownDisabled\" [getValuesArrayFromEnum]=\"params.getLabelAndColorFromEnumValue\"\r\n [enumChoices]=\"params.enumChoices\" [placeholder]=\"params.placeholder\" [width]=\"params.width\"\r\n [isChip]=\"params.isChip\" [paddingTop]=\"params.paddingTop\" [allowAllCapsValues]=\"params.allowAllCapsValues\"\r\n (change)=\"onCellDataChanged($event)\">\r\n</choose-enum>" }]
847
+ args: [{ selector: 'choose-enum-renderer', template: "<div class=\"all\" [ngClass]=\"{ single: !showError, double: showError }\" *ngIf=\"rowLevelFG\" [formGroup]=\"rowLevelFG\">\r\n <choose-enum [clearable]=\"clearable\" [formControlName]=\"key\" [appendTo]=\"'body'\" [label]=\"params.label\"\r\n [labelTextAlign]=\"params.labelTextAlign\" [labelTextFontWeight]=\"params.labelTextFontWeight\"\r\n [labelTextFontSize]=\"params.labelTextFontSize\" [selectedItem]=\"params.value\" [valuesToHide]=\"valuesToHide\"\r\n [valuesToDisable]=\"valuesToDisable\" [isDropdownDisabled]=\"params.isDropdownDisabled\"\r\n [enumChoices]=\"params.enumChoices\" [placeholder]=\"params.placeholder\" [width]=\"params.width\" [isChip]=\"isChip\"\r\n [paddingTop]=\"params.paddingTop\" [customColors]=\"params.customColors\" (change)=\"onEnumSelected($event)\">\r\n </choose-enum>\r\n</div>", styles: [".all{display:grid;gap:.5rem;align-items:center;margin:auto}.single{grid-template-columns:auto}.double{grid-template-columns:auto max-content}\n"] }]
409
848
  }], ctorParameters: function () { return []; } });
410
849
 
411
850
  // import { environment } from '../../environments/environment';
@@ -1394,18 +1833,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
1394
1833
  type: Output
1395
1834
  }] } });
1396
1835
 
1397
- class PrimaryColors {
1398
- static $primaryBlueColor = '#155ED4';
1399
- static $primaryPinkColor = '#F0509C';
1400
- static $primaryTealColor = '#12957E';
1401
- static $primaryCarbonColor = '#32353B';
1402
- static $primaryPurpleColor = '#E3B1EB';
1403
- static $primaryRedColor = '#A80002';
1404
- static $primaryLightRedColor = '#FFDBDB';
1405
- static $primaryLightGrayBlueColor = '#f7f8f9';
1406
- static $primaryLightGrayColor = '#f0f0f0';
1407
- }
1408
-
1409
1836
  class AddAsteriskDirective {
1410
1837
  elem;
1411
1838
  show = true;