@sumaris-net/ngx-components 1.23.25 → 1.23.26

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.
@@ -589,6 +589,10 @@
589
589
  return isNotNil(value) && NUMBER_RANGE_REGEXP.test(value);
590
590
  }
591
591
  function getPropertyByPath(obj, path, defaultValue) {
592
+ // Path is an array: convert path to string
593
+ if (Array.isArray(path)) {
594
+ return getPropertyByPath(obj, path.join('.'), defaultValue);
595
+ }
592
596
  if (isNil(obj))
593
597
  return defaultValue;
594
598
  if (isNilOrBlank(path))
@@ -603,7 +607,8 @@
603
607
  var key = path.substring(0, i);
604
608
  if (isNil(obj[key]))
605
609
  return defaultValue;
606
- if (obj[key] && typeof obj[key] === 'object') {
610
+ if (typeof obj[key] === 'object') { // Object or Array
611
+ // Recursive call
607
612
  return getPropertyByPath(obj[key], path.substring(i + 1));
608
613
  }
609
614
  throw new Error("Invalid property path: '" + key + "' is not an valid object.");
@@ -615,7 +620,7 @@
615
620
  }
616
621
  function getPropertyByPathAsString(obj, path) {
617
622
  var res = getPropertyByPath(obj, path);
618
- return res && (typeof res === 'string' ? res : ('' + res));
623
+ return (typeof res === 'string') ? res : ('' + res);
619
624
  }
620
625
  function sleep(ms) {
621
626
  if (ms <= 0)
@@ -3096,10 +3101,18 @@
3096
3101
  var ArrayPluckPipe = /** @class */ (function () {
3097
3102
  function ArrayPluckPipe() {
3098
3103
  }
3099
- ArrayPluckPipe.prototype.transform = function (val, opts) {
3100
- return (opts.omitNil !== true) ?
3101
- (val || []).map(function (value) { return value && value[opts.property]; }) :
3102
- (val || []).map(function (value) { return value && value[opts.property]; }).filter(isNotNil);
3104
+ /**
3105
+ *
3106
+ * @param values
3107
+ * @param opts property to get, or options
3108
+ */
3109
+ ArrayPluckPipe.prototype.transform = function (values, opts) {
3110
+ if (!opts || !values)
3111
+ return values;
3112
+ var property = (typeof opts === 'string') || Array.isArray(opts) ? opts : opts.property;
3113
+ return (opts['omitNil'] !== true) ?
3114
+ values.map(function (value) { return getPropertyByPath(value, property); }) :
3115
+ values.map(function (value) { return getPropertyByPath(value, property); }).filter(isNotNil);
3103
3116
  };
3104
3117
  return ArrayPluckPipe;
3105
3118
  }());
@@ -3134,6 +3147,19 @@
3134
3147
  name: 'arrayFilter'
3135
3148
  },] }
3136
3149
  ];
3150
+ var ArrayJoinPipe = /** @class */ (function () {
3151
+ function ArrayJoinPipe() {
3152
+ }
3153
+ ArrayJoinPipe.prototype.transform = function (val, separator) {
3154
+ return val && val.join(separator) || '';
3155
+ };
3156
+ return ArrayJoinPipe;
3157
+ }());
3158
+ ArrayJoinPipe.decorators = [
3159
+ { type: i0.Pipe, args: [{
3160
+ name: 'arrayJoin'
3161
+ },] }
3162
+ ];
3137
3163
 
3138
3164
  var MapGetPipe = /** @class */ (function () {
3139
3165
  function MapGetPipe() {
@@ -5043,6 +5069,7 @@
5043
5069
  ArrayPluckPipe,
5044
5070
  ArrayIncludesPipe,
5045
5071
  ArrayFilterPipe,
5072
+ ArrayJoinPipe,
5046
5073
  MapGetPipe,
5047
5074
  MapKeysPipe,
5048
5075
  MapValuesPipe,
@@ -5083,6 +5110,7 @@
5083
5110
  ArrayLengthPipe,
5084
5111
  ArrayFirstPipe,
5085
5112
  ArrayPluckPipe,
5113
+ ArrayJoinPipe,
5086
5114
  MapGetPipe,
5087
5115
  MapKeysPipe,
5088
5116
  MapValuesPipe,
@@ -35220,6 +35248,7 @@
35220
35248
  exports.ArrayFilterPipe = ArrayFilterPipe;
35221
35249
  exports.ArrayFirstPipe = ArrayFirstPipe;
35222
35250
  exports.ArrayIncludesPipe = ArrayIncludesPipe;
35251
+ exports.ArrayJoinPipe = ArrayJoinPipe;
35223
35252
  exports.ArrayLengthPipe = ArrayLengthPipe;
35224
35253
  exports.ArrayPluckPipe = ArrayPluckPipe;
35225
35254
  exports.AudioProvider = AudioProvider;