@senior-agronegocio/angular-components 0.0.81 → 0.0.83-updated

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.
@@ -3001,6 +3001,101 @@
3001
3001
  return AgroArrayUtils;
3002
3002
  }());
3003
3003
 
3004
+ var AgroLogics = /** @class */ (function () {
3005
+ function AgroLogics() {
3006
+ }
3007
+ /**
3008
+ * Agrupa o conjunto de dados pelos campos de entidade fornecidos e calcula
3009
+ * a distribuição de probabilidade (frequência e porcentagem).
3010
+ *
3011
+ * @param data - Array de objetos a serem analisados
3012
+ * @param keys - Chaves ou caminhos aninhados para agrupar (ex: ["entity1", "entity2"])
3013
+ * @returns Array de estatísticas agrupadas ordenadas por samplingSuccess (decrescente)
3014
+ */
3015
+ AgroLogics.entityDistributionStats = function (data, keys) {
3016
+ var e_1, _a;
3017
+ var total = data.length;
3018
+ var map = new Map();
3019
+ var _loop_1 = function (item) {
3020
+ var e_2, _a, e_3, _b;
3021
+ var uniqueKey = JSON.stringify(keys.map(function (c) {
3022
+ var e_4, _a;
3023
+ var parts = c.split(".");
3024
+ var value = item;
3025
+ try {
3026
+ for (var parts_2 = (e_4 = void 0, __values(parts)), parts_2_1 = parts_2.next(); !parts_2_1.done; parts_2_1 = parts_2.next()) {
3027
+ var p = parts_2_1.value;
3028
+ value = value === null || value === void 0 ? void 0 : value[p];
3029
+ }
3030
+ }
3031
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
3032
+ finally {
3033
+ try {
3034
+ if (parts_2_1 && !parts_2_1.done && (_a = parts_2.return)) _a.call(parts_2);
3035
+ }
3036
+ finally { if (e_4) throw e_4.error; }
3037
+ }
3038
+ return value;
3039
+ }));
3040
+ if (!map.has(uniqueKey)) {
3041
+ var groupedData = {};
3042
+ try {
3043
+ for (var keys_1 = (e_2 = void 0, __values(keys)), keys_1_1 = keys_1.next(); !keys_1_1.done; keys_1_1 = keys_1.next()) {
3044
+ var c = keys_1_1.value;
3045
+ var parts = c.split(".");
3046
+ var value = item;
3047
+ try {
3048
+ for (var parts_1 = (e_3 = void 0, __values(parts)), parts_1_1 = parts_1.next(); !parts_1_1.done; parts_1_1 = parts_1.next()) {
3049
+ var p = parts_1_1.value;
3050
+ value = value === null || value === void 0 ? void 0 : value[p];
3051
+ }
3052
+ }
3053
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
3054
+ finally {
3055
+ try {
3056
+ if (parts_1_1 && !parts_1_1.done && (_b = parts_1.return)) _b.call(parts_1);
3057
+ }
3058
+ finally { if (e_3) throw e_3.error; }
3059
+ }
3060
+ // add the full entity (not only its ID)
3061
+ groupedData[c.toString().split(".")[0]] = value;
3062
+ }
3063
+ }
3064
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
3065
+ finally {
3066
+ try {
3067
+ if (keys_1_1 && !keys_1_1.done && (_a = keys_1.return)) _a.call(keys_1);
3068
+ }
3069
+ finally { if (e_2) throw e_2.error; }
3070
+ }
3071
+ map.set(uniqueKey, { data: groupedData, count: 0 });
3072
+ }
3073
+ map.get(uniqueKey).count++;
3074
+ };
3075
+ try {
3076
+ for (var data_1 = __values(data), data_1_1 = data_1.next(); !data_1_1.done; data_1_1 = data_1.next()) {
3077
+ var item = data_1_1.value;
3078
+ _loop_1(item);
3079
+ }
3080
+ }
3081
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
3082
+ finally {
3083
+ try {
3084
+ if (data_1_1 && !data_1_1.done && (_a = data_1.return)) _a.call(data_1);
3085
+ }
3086
+ finally { if (e_1) throw e_1.error; }
3087
+ }
3088
+ var result = Array.from(map.values()).map(function (entry) { return ({
3089
+ data: entry.data,
3090
+ samplingQuantity: entry.count,
3091
+ samplingSuccess: Math.round((entry.count / total) * 100),
3092
+ }); });
3093
+ result.sort(function (a, b) { return b.samplingSuccess - a.samplingSuccess; });
3094
+ return result;
3095
+ };
3096
+ return AgroLogics;
3097
+ }());
3098
+
3004
3099
  var AsyncLock = /** @class */ (function () {
3005
3100
  function AsyncLock() {
3006
3101
  this.queue = [];
@@ -5514,6 +5609,7 @@
5514
5609
  };
5515
5610
  EventControlBoardComponent.prototype.openModal = function () {
5516
5611
  this.displayModal = true;
5612
+ this.showSidebar = false;
5517
5613
  };
5518
5614
  EventControlBoardComponent.prototype.openCancelModal = function () {
5519
5615
  var _a, _b, _c;
@@ -5538,7 +5634,6 @@
5538
5634
  EventControlBoardComponent.prototype.confirmModal = function () {
5539
5635
  this.reprocessEvent();
5540
5636
  this.displayModal = false;
5541
- this.showSidebar = false;
5542
5637
  };
5543
5638
  EventControlBoardComponent.prototype.cancelModal = function () {
5544
5639
  this.displayModal = false;
@@ -6538,6 +6633,7 @@
6538
6633
  exports.AgroCookieUtils = AgroCookieUtils;
6539
6634
  exports.AgroDateUtils = AgroDateUtils;
6540
6635
  exports.AgroFormValidator = AgroFormValidator;
6636
+ exports.AgroLogics = AgroLogics;
6541
6637
  exports.AgroNameUtils = AgroNameUtils;
6542
6638
  exports.AgroNumberUtils = AgroNumberUtils;
6543
6639
  exports.AgroObjectUtils = AgroObjectUtils;