@hestia-earth/ui-components 0.5.0 → 0.5.2

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.
@@ -5700,28 +5700,34 @@
5700
5700
  exports.LogStatus.success,
5701
5701
  exports.LogStatus.error
5702
5702
  ].includes(status) && hasLogs(logs); };
5703
- var logStatus = function (data, logs, index) { return hasLog(logs)
5704
- ? (!data.isRequired
5705
- ? exports.LogStatus.notRequired
5706
- : isRunOrchestrator(logs)
5707
- ? ('shouldRun' in logs
5708
- ? logs.shouldRun
5709
- ? data.isRecalculated
5710
- ? exports.LogStatus.success
5711
- : exports.LogStatus.dataProvided
5712
- : data.isRecalculated && index > 0
5713
- ? exports.LogStatus.skipHierarchy
5714
- : exports.LogStatus.error
5715
- : exports.LogStatus.dataProvided)
5716
- : data.isRecalculated
5717
- ? exports.LogStatus.skipHierarchy
5718
- : exports.LogStatus.dataProvided)
5719
- : ([
5703
+ var logStatus = function (data, logs, index) {
5704
+ var withLogs = hasLog(logs);
5705
+ var isCalculated = [
5720
5706
  typeof data.originalValue === 'undefined',
5721
5707
  data.isRecalculated // is recalculated
5722
- ].every(Boolean)
5723
- ? exports.LogStatus.skipHierarchy
5724
- : exports.LogStatus.dataProvided); };
5708
+ ].every(Boolean);
5709
+ // can be not required for a specific model
5710
+ var isRequired = !!logs && 'runRequired' in logs ? logs.runRequired : data.isRequired;
5711
+ return withLogs
5712
+ ? (!isRequired
5713
+ ? exports.LogStatus.notRequired
5714
+ : isRunOrchestrator(logs)
5715
+ ? ('shouldRun' in logs
5716
+ ? logs.shouldRun
5717
+ ? data.isRecalculated
5718
+ ? exports.LogStatus.success
5719
+ : exports.LogStatus.dataProvided
5720
+ : data.isRecalculated && index > 0
5721
+ ? exports.LogStatus.skipHierarchy
5722
+ : exports.LogStatus.error
5723
+ : exports.LogStatus.dataProvided)
5724
+ : data.isRecalculated
5725
+ ? exports.LogStatus.skipHierarchy
5726
+ : exports.LogStatus.dataProvided)
5727
+ : (isCalculated
5728
+ ? exports.LogStatus.skipHierarchy
5729
+ : exports.LogStatus.dataProvided);
5730
+ };
5725
5731
  var mergeSubValues = function (values) { return Object.values(values.reduce(function (prev, _b) {
5726
5732
  var id = _b.id, key = _b.key, configModels = _b.configModels;
5727
5733
  var uniqueKey = [key, id].filter(Boolean).join('.');
@@ -5816,7 +5822,7 @@
5816
5822
  return ({
5817
5823
  id: transformation === null || transformation === void 0 ? void 0 : transformation['@id'],
5818
5824
  key: 'transformation',
5819
- configModels: ['cycle']
5825
+ configModels: ['cycle/transformation']
5820
5826
  });
5821
5827
  }); };
5822
5828
  var includeCycleSubValue = function (subValues) { return subValues.some(function (v) { return v.key !== 'property'; }); };
@@ -5927,7 +5933,9 @@
5927
5933
  // handle "input.hestiaAggregatedData"
5928
5934
  findMatchingModel(models, modelKeyParams(node, (type === null || type === void 0 ? void 0 : type.toLowerCase()) + "." + methodId)) ||
5929
5935
  // handle "transformation"
5930
- findMatchingModel(models, modelKeyParams(node, subValue === null || subValue === void 0 ? void 0 : subValue.key))
5936
+ ((subValue === null || subValue === void 0 ? void 0 : subValue.key) ? findMatchingModel(models, modelKeyParams(node, subValue === null || subValue === void 0 ? void 0 : subValue.key)) : undefined) ||
5937
+ // handle "transformation/excreta" and other models with "/"
5938
+ (methodId.includes('/') ? findMatchingModel(models, { model: methodId.split('/')[0], modelKey: methodId.split('/')[1] }) : undefined)
5931
5939
  };
5932
5940
  };
5933
5941
  };
@@ -6026,7 +6034,7 @@
6026
6034
  ], __read(blankNodeLogs.flatMap(function (v) { return __spreadArray(__spreadArray([
6027
6035
  v.configModels.length
6028
6036
  ], __read((v.subValues.map(function (s) { var _a; return ((_a = s.configModels) === null || _a === void 0 ? void 0 : _a.length) || 0; })))), __read((v.keys.map(function (s) { var _a; return ((_a = s.configModels) === null || _a === void 0 ? void 0 : _a.length) || 0; })))); })))); };
6029
- var logValueArray = function (value) { return value.includes(';') ?
6037
+ var logValueArray = function (value) { return [';', ':'].some(function (v) { return value.includes(v); }) ?
6030
6038
  value.split(';').flatMap(function (v) {
6031
6039
  var res = v.split('_').map(function (vv) { return vv.split(':'); });
6032
6040
  return res.length <= 1 ? res.flat() : Object.fromEntries(res);
@@ -6049,16 +6057,12 @@
6049
6057
  _c$1[exports.LogStatus.dataProvided] = 'dark',
6050
6058
  _c$1[exports.LogStatus.notRequired] = 'grey',
6051
6059
  _c$1);
6052
- var methodIdLabel = function (methodId, model) { return ((model === null || model === void 0 ? void 0 : model.modelKey) && methodId === 'cycle'
6060
+ var methodIdLabel = function (methodId, model) { return (methodId
6053
6061
  ? ({
6054
- transformation: 'Data From Transformation'
6055
- })[model.modelKey]
6056
- : methodId
6057
- ? ({
6058
- transformation: 'Data From Transformation',
6059
- impact_assessment: 'Data From Cycle'
6060
- })[methodId]
6061
- : '') || utils.keyToLabel(methodId); };
6062
+ 'cycle/transformation': 'Data From Transformation',
6063
+ impact_assessment: 'Data From Cycle'
6064
+ })[methodId]
6065
+ : '') || (methodId.includes('/') ? methodId.split('/')[0] : utils.keyToLabel(methodId)); };
6062
6066
  var getModelsAt = function (log, index) { return ('modelsInSubValues' in log ? !log.modelsInSubValues || !log.isOpen : true) && log.configModels[index]; };
6063
6067
  var requirementKeys = function (requirements) { return Object.keys(requirements).filter(function (k) { return !nodeTypesLowerCase.includes(k); }); };
6064
6068
  var requirementColor = function (value) { return !value || ['None', 'False', '0', '0.0'].includes(value) ? 'danger' : 'white'; };