@hestia-earth/ui-components 0.3.4 → 0.3.5

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.
@@ -1091,7 +1091,7 @@
1091
1091
  }] });
1092
1092
 
1093
1093
  var get$5 = require('lodash.get');
1094
- var isMethodModelAllowed = function (filterMethod) { return function (node) { var _a, _b; return ((_a = node.methodModel) === null || _a === void 0 ? void 0 : _a['@id']) === (filterMethod ? filterMethod['@id'] : glossary.getDefaultModeId((_b = node.term) === null || _b === void 0 ? void 0 : _b['@id'])); }; };
1094
+ var isMethodModelAllowed = function (filterMethod) { return function (node) { var _a, _b; return ((_a = node.methodModel) === null || _a === void 0 ? void 0 : _a['@id']) === (filterMethod ? filterMethod['@id'] : glossary.getDefaultModelId((_b = node.term) === null || _b === void 0 ? void 0 : _b['@id'])); }; };
1095
1095
  var NodeKeyState;
1096
1096
  (function (NodeKeyState) {
1097
1097
  NodeKeyState["added"] = "added";
@@ -5679,6 +5679,16 @@
5679
5679
  ].every(Boolean)
5680
5680
  ? exports.LogStatus.skipHierarchy
5681
5681
  : exports.LogStatus.dataProvided); };
5682
+ var mergeSubValues = function (values) { return Object.values(values.reduce(function (prev, _b) {
5683
+ var id = _b.id, key = _b.key, configModels = _b.configModels;
5684
+ var uniqueKey = [key, id].filter(Boolean).join('.');
5685
+ prev[uniqueKey] = {
5686
+ id: id,
5687
+ key: key,
5688
+ configModels: __spreadArray(__spreadArray([], __read(((prev[uniqueKey] || {}).configModels || []))), __read((configModels || [])))
5689
+ };
5690
+ return prev;
5691
+ }, {})); };
5682
5692
  var reduceValues = function (values, termId) {
5683
5693
  var propertyValues = values
5684
5694
  .map(function (_b) {
@@ -5739,7 +5749,7 @@
5739
5749
  }) }); }); };
5740
5750
  var logSubValues = function (allLogs, logs, original, recalculated, models, _b) {
5741
5751
  var nodeType = _b.nodeType, type = _b.type, termId = _b.termId;
5742
- return utils.unique(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(Object.keys(logs)
5752
+ return mergeSubValues(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(Object.keys(logs)
5743
5753
  .filter(function (id) { return logs[id].isProperty; })
5744
5754
  .map(function (id) { return ({
5745
5755
  id: id,
@@ -5813,7 +5823,7 @@
5813
5823
  return indexes.length ? indexes[0] : '';
5814
5824
  };
5815
5825
  var configModelWithDocs = function (models, _b, subValue) {
5816
- var nodeType = _b.nodeType, type = _b.type, termId = _b.termId;
5826
+ var nodeType = _b.nodeType, type = _b.type, termId = _b.termId, termType = _b.termType;
5817
5827
  return function (methodId) {
5818
5828
  var node = {
5819
5829
  '@type': nodeType,
@@ -5823,6 +5833,8 @@
5823
5833
  return {
5824
5834
  methodId: methodId,
5825
5835
  model: findMatchingModel(models, modelParams(node)) ||
5836
+ // handle "liveAnimal"
5837
+ (termType && findMatchingModel(models, modelKeyParams(node, termType))) ||
5826
5838
  findMatchingModel(models, modelKeyParams(node, (subValue === null || subValue === void 0 ? void 0 : subValue.key) + "." + methodId)) ||
5827
5839
  // handle "input.price"
5828
5840
  findMatchingModel(models, modelKeyParams(node, type.toLowerCase() + "." + (subValue === null || subValue === void 0 ? void 0 : subValue.key))) ||
@@ -5875,11 +5887,12 @@
5875
5887
  undefined;
5876
5888
  return function (term) {
5877
5889
  var termId = term['@id'];
5890
+ var termType = term.termType;
5878
5891
  var termLogs = get$3(logs, termId, {});
5879
5892
  var original = originalValues.filter(function (v) { return termId === v.term['@id']; });
5880
5893
  var recalculated = recalculatedValues.filter(function (v) { return termId === v.term['@id']; });
5881
5894
  var hasData = !!original.length || !!recalculated.length || Object.keys(termLogs).length > 0;
5882
- var configModelsData = { nodeType: nodeType, type: type, termId: termId };
5895
+ var configModelsData = { nodeType: nodeType, type: type, termId: termId, termType: termType };
5883
5896
  var configModels = groupParallelModels(config, termId, nodeKey, utils.unique(__spreadArray(__spreadArray([], __read((termLogs.models || []).filter(function (key) { return isModelLog(termLogs[key]); }))), __read(findConfigModels(config, termId, nodeKey, models).map(function (_b) {
5884
5897
  var model = _b.model;
5885
5898
  return model;
@@ -6933,15 +6946,16 @@
6933
6946
  };
6934
6947
  Object.defineProperty(CyclesPracticesComponent.prototype, "showTimeline", {
6935
6948
  get: function () {
6936
- return (this.cycles[0].practices || []).some(function (p) { var _a; return timelineTermType.includes((_a = p.term) === null || _a === void 0 ? void 0 : _a.termType); });
6949
+ var _a, _b;
6950
+ return (((_b = (_a = this.cycles) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.practices) || []).some(function (p) { var _a; return timelineTermType.includes((_a = p.term) === null || _a === void 0 ? void 0 : _a.termType); });
6937
6951
  },
6938
6952
  enumerable: false,
6939
6953
  configurable: true
6940
6954
  });
6941
6955
  // Recalculation logs
6942
- CyclesPracticesComponent.prototype.selectIndex = function (_b) {
6956
+ CyclesPracticesComponent.prototype.selectIndex = function (_c) {
6943
6957
  var _this = this;
6944
- var value = _b.target.value;
6958
+ var value = _c.target.value;
6945
6959
  this.selectedIndex = -1;
6946
6960
  // force a refresh of the logs
6947
6961
  setTimeout(function () { return (_this.selectedIndex = +value); });
@@ -9288,11 +9302,11 @@
9288
9302
  return __generator(this, function (_e) {
9289
9303
  switch (_e.label) {
9290
9304
  case 0:
9291
- this.terms = utils.unique(this.indicators.map(function (_d) {
9305
+ this.terms = utils.unique((this.indicators || []).map(function (_d) {
9292
9306
  var term = _d.term;
9293
9307
  return term;
9294
9308
  }).filter(Boolean));
9295
- this.methods = utils.unique(this.indicators.map(function (_d) {
9309
+ this.methods = utils.unique((this.indicators || []).map(function (_d) {
9296
9310
  var methodModel = _d.methodModel;
9297
9311
  return methodModel;
9298
9312
  }).filter(Boolean));