sf-crud 12.0.1-beta26 → 12.0.1-beta27

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.
@@ -903,7 +903,7 @@
903
903
  }
904
904
  };
905
905
  RegistroChildComponent.prototype.setValueEvent = function (data, params) {
906
- var _this = this;
906
+ var _a;
907
907
  var value;
908
908
  switch (params.op) {
909
909
  case 'sum':
@@ -911,11 +911,11 @@
911
911
  break;
912
912
  case 'concat':
913
913
  var array_1 = [];
914
- params.key.reduce(function (acc, cur) {
915
- array_1.push(jsonpath__namespace.query(_this.data, cur)[0]);
914
+ (_a = params === null || params === void 0 ? void 0 : params.key) === null || _a === void 0 ? void 0 : _a.reduce(function (acc, cur) {
915
+ array_1.push(jsonpath__namespace.query(data, cur)[0]);
916
916
  }, []);
917
917
  if (params === null || params === void 0 ? void 0 : params.separator)
918
- value = array_1.join((params === null || params === void 0 ? void 0 : params.separator) || ' ');
918
+ jsonpath__namespace.value(data, params.scope[0], array_1.join((params === null || params === void 0 ? void 0 : params.separator) || ' '));
919
919
  break;
920
920
  case 'enable':
921
921
  jsonpath__namespace.value(this.esquema, params.scope[0], false);
@@ -1065,28 +1065,25 @@
1065
1065
  return object;
1066
1066
  };
1067
1067
  RegistroComponent.prototype.submit = function () {
1068
- var _this = this;
1069
1068
  console.log(this.data);
1070
- if (!this.validateData())
1071
- return;
1072
- this.applyValuesOnEvent('onSubmit', this.crudConfig.esquema);
1073
- this.enProceso = true;
1074
- var endpoint = this.configOperation.endpoint;
1075
- endpoint = endpoint.replace('@idKatios', this.idKatios);
1076
- endpoint = endpoint.replace('@id', this.id);
1077
- this.generalService.genericRequest(this.configOperation.method, this.configOperation.server, endpoint, this.data)
1078
- .then(function () {
1079
- _this.messageSerice.add({ severity: 'success', detail: "Proceso exitoso!" });
1080
- setTimeout(function () {
1081
- _this.enProceso = false;
1082
- _this.back();
1083
- }, 2000);
1084
- })
1085
- .catch(function (err) {
1086
- var _a;
1087
- _this.messageSerice.add({ severity: 'warn', detail: "" + (((_a = err === null || err === void 0 ? void 0 : err.error) === null || _a === void 0 ? void 0 : _a.message) || 'Error no controlado, por favor comunicarse con del admin.') });
1088
- _this.enProceso = false;
1089
- });
1069
+ // if (!this.validateData()) return;
1070
+ // this.applyValuesOnEvent('onSubmit', this.crudConfig.esquema)
1071
+ // this.enProceso = true;
1072
+ // let endpoint = this.configOperation.endpoint;
1073
+ // endpoint = endpoint.replace('@idKatios', this.idKatios)
1074
+ // endpoint = endpoint.replace('@id', this.id)
1075
+ // this.generalService.genericRequest(this.configOperation.method, this.configOperation.server, endpoint, this.data)
1076
+ // .then(() => {
1077
+ // this.messageSerice.add({ severity: 'success', detail: `Proceso exitoso!` })
1078
+ // setTimeout(() => {
1079
+ // this.enProceso = false;
1080
+ // this.back()
1081
+ // }, 2000);
1082
+ // })
1083
+ // .catch(err => {
1084
+ // this.messageSerice.add({ severity: 'warn', detail: `${err?.error?.message || 'Error no controlado, por favor comunicarse con del admin.'}` })
1085
+ // this.enProceso = false;
1086
+ // })
1090
1087
  };
1091
1088
  RegistroComponent.prototype.validateData = function () {
1092
1089
  if (this.configOperation.validations.type == 'local')
@@ -1157,7 +1154,7 @@
1157
1154
  this.dialogRef.onClose.subscribe(function (data) {
1158
1155
  if (data)
1159
1156
  _this.data[element.scope.replace('$..properties.', '')].push(data);
1160
- _this.applyValuesOnEvent('onChange', _this.crudConfig.esquema);
1157
+ _this.applyValuesOnEvent('onChange', _this.crudConfig.esquema, element.scope.replace('$..properties.', ''));
1161
1158
  });
1162
1159
  };
1163
1160
  RegistroComponent.prototype.editRow = function (element, data) {
@@ -1176,7 +1173,7 @@
1176
1173
  this.dialogRef.onClose.subscribe(function (data) {
1177
1174
  if (data)
1178
1175
  _this.data[element.scope.replace('$..properties.', '')][data.id - 1] = data;
1179
- _this.applyValuesOnEvent('onChange', _this.crudConfig.esquema);
1176
+ _this.applyValuesOnEvent('onChange', _this.crudConfig.esquema, element.scope.replace('$..properties.', ''));
1180
1177
  });
1181
1178
  };
1182
1179
  RegistroComponent.prototype.deleteRow = function (element, index) {
@@ -1186,7 +1183,7 @@
1186
1183
  el.id = index;
1187
1184
  index++;
1188
1185
  });
1189
- this.applyValuesOnEvent('onChange', this.crudConfig.esquema, element.scope.replace('$..properties', ''));
1186
+ this.applyValuesOnEvent('onChange', this.crudConfig.esquema, element.scope.replace('$..properties.', ''));
1190
1187
  };
1191
1188
  RegistroComponent.prototype.applyValuesOnEvent = function (event, esquema, key) {
1192
1189
  var _this = this;
@@ -1208,20 +1205,18 @@
1208
1205
  }
1209
1206
  };
1210
1207
  RegistroComponent.prototype.setValueEvent = function (data, params) {
1211
- var _this = this;
1212
1208
  var _a;
1213
- var value;
1214
1209
  switch (params.op) {
1215
1210
  case 'sum':
1216
- value = jsonpath__namespace.query(data, params.scope[0]).reduce(function (acc, cur) { return acc += (params === null || params === void 0 ? void 0 : params.key) ? cur[params.key] : cur; }, 0);
1211
+ jsonpath__namespace.value(data, params.scope[1], jsonpath__namespace.query(data, params.scope[0]).reduce(function (acc, cur) { return acc += (params === null || params === void 0 ? void 0 : params.key) ? cur[params.key] : cur; }, 0));
1217
1212
  break;
1218
1213
  case 'concat':
1219
1214
  var array_1 = [];
1220
1215
  (_a = params === null || params === void 0 ? void 0 : params.key) === null || _a === void 0 ? void 0 : _a.reduce(function (acc, cur) {
1221
- array_1.push(jsonpath__namespace.query(_this.data, cur)[0]);
1216
+ array_1.push(jsonpath__namespace.query(data, cur)[0]);
1222
1217
  }, []);
1223
1218
  if (params === null || params === void 0 ? void 0 : params.separator)
1224
- value = array_1.join((params === null || params === void 0 ? void 0 : params.separator) || ' ');
1219
+ jsonpath__namespace.value(data, params.scope[0], array_1.join((params === null || params === void 0 ? void 0 : params.separator) || ' '));
1225
1220
  break;
1226
1221
  case 'enable':
1227
1222
  jsonpath__namespace.value(this.crudConfig.esquema, params.scope[0], false);
@@ -1238,7 +1233,6 @@
1238
1233
  default:
1239
1234
  break;
1240
1235
  }
1241
- return value;
1242
1236
  };
1243
1237
  return RegistroComponent;
1244
1238
  }());