ps-toolkit-ui 1.12.2 → 1.12.4

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.
@@ -8039,7 +8039,22 @@
8039
8039
  FormUploaderComponent.prototype.ngOnInit = function () {
8040
8040
  var _this = this;
8041
8041
  this.inp.setValue = function (v) {
8042
- _this.inp.value = v != null && v instanceof Array ? v : [];
8042
+ _this.inp.value = v != null && v instanceof Array && v.every(function (i) { return typeof i === 'string'; }) ? v.map(function (f) {
8043
+ var _a, _b;
8044
+ var typ = (_a = exports.FileIcons[f.split('.').at(-1)]) !== null && _a !== void 0 ? _a : exports.FileIcons.file;
8045
+ var icon = (_b = exports.FileIcons[f.split('.').at(-1)]) !== null && _b !== void 0 ? _b : exports.FileIcons.file;
8046
+ var close = new InputClass(_this.inp.environment, _this.inp.l, null, 'fas fa-times', exports.InputType.Icon, 'red h-15');
8047
+ close.onClick = function () {
8048
+ _this.inp.value = _this.inp.value.filter(function (x) { return x.file !== f; });
8049
+ };
8050
+ return {
8051
+ type: typ,
8052
+ icon: icon,
8053
+ url: _this.inp.environment.url + f,
8054
+ close: close,
8055
+ file: f
8056
+ };
8057
+ }) : [];
8043
8058
  };
8044
8059
  this.inp.isValid = function () {
8045
8060
  _this.inp.error = null;
@@ -8070,7 +8085,8 @@
8070
8085
  var result = {};
8071
8086
  result[_this.inp.name] = _this.inp.name;
8072
8087
  if (_this.inp.value != null && _this.inp.value instanceof Array) {
8073
- result[_this.inp.name + 'Files'] = _this.inp.value.map(function (x) { return x.file; });
8088
+ result[_this.inp.name + 'Files'] = _this.inp.value.filter(function (x) { return typeof x.file !== 'string'; }).map(function (x) { return x.file; });
8089
+ result[_this.inp.name + 'Urls'] = _this.inp.value.filter(function (x) { return typeof x.file === 'string'; }).map(function (x) { return x.file; });
8074
8090
  return result;
8075
8091
  }
8076
8092
  return result;