@seniorsistemas/angular-components 17.30.0 → 17.31.0

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.
@@ -328,68 +328,90 @@
328
328
  var AccordionComponent = /** @class */ (function () {
329
329
  function AccordionComponent() {
330
330
  this.multiple = false;
331
- this._unsubscribe$ = new rxjs.Subject();
332
- this._panels = [];
331
+ this.unsubscribe$ = new rxjs.Subject();
332
+ this.panels = [];
333
333
  }
334
+ AccordionComponent.prototype.ngOnInit = function () {
335
+ this.validateInputs();
336
+ };
334
337
  AccordionComponent.prototype.ngAfterContentInit = function () {
335
- this._panels = this.panelsComponents.toArray();
336
- this._openSubs = new Array(this._panels.length);
337
- this._setBehavior(this.multiple);
338
- this._setupTabs();
338
+ this.panels = this.panelsComponents.toArray();
339
+ this.openSubs = new Array(this.panels.length);
340
+ this.setBehavior(this.multiple);
341
+ this.setupTabs();
339
342
  };
340
343
  AccordionComponent.prototype.ngOnChanges = function (changes) {
341
344
  if (changes.multiple) {
342
- this._setBehavior(changes.multiple.currentValue);
345
+ this.setBehavior(changes.multiple.currentValue);
343
346
  }
344
347
  };
345
348
  AccordionComponent.prototype.ngOnDestroy = function () {
346
- this._unsubscribe$.next();
347
- this._unsubscribe$.complete();
349
+ this.unsubscribe$.next();
350
+ this.unsubscribe$.complete();
348
351
  };
349
- AccordionComponent.prototype._setupTabs = function () {
350
- var _a;
351
- if ((_a = this._panels) === null || _a === void 0 ? void 0 : _a.length) {
352
+ AccordionComponent.prototype.validateInputs = function () {
353
+ if (!this.multiple && Array.isArray(this.activeIndex)) {
354
+ throw new Error("The activeIndex should not be an array when multiple is set to false.");
355
+ }
356
+ };
357
+ AccordionComponent.prototype.setupTabs = function () {
358
+ var e_1, _a;
359
+ var _this = this;
360
+ var _b;
361
+ if ((_b = this.panels) === null || _b === void 0 ? void 0 : _b.length) {
352
362
  if (this.activeIndex !== undefined && this.activeIndex !== null) {
353
- var activeTab = this._panels[this.activeIndex];
354
- if (!activeTab) {
363
+ var activeTabs = Array.isArray(this.activeIndex)
364
+ ? this.panels.filter(function (_, index) { return _this.activeIndex.includes(index); })
365
+ : [this.panels[this.activeIndex]];
366
+ if (activeTabs.length === 0) {
355
367
  throw new Error("activeIndex does not represent any panel.");
356
368
  }
357
- if (!activeTab.disabled) {
358
- this._panels[this.activeIndex].isOpen = true;
369
+ try {
370
+ for (var activeTabs_1 = __values(activeTabs), activeTabs_1_1 = activeTabs_1.next(); !activeTabs_1_1.done; activeTabs_1_1 = activeTabs_1.next()) {
371
+ var activeTab = activeTabs_1_1.value;
372
+ if (!activeTab.disabled) {
373
+ activeTab.isOpen = true;
374
+ }
375
+ }
376
+ }
377
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
378
+ finally {
379
+ try {
380
+ if (activeTabs_1_1 && !activeTabs_1_1.done && (_a = activeTabs_1.return)) _a.call(activeTabs_1);
381
+ }
382
+ finally { if (e_1) throw e_1.error; }
359
383
  }
360
384
  }
361
385
  }
362
386
  };
363
- AccordionComponent.prototype._closeOtherTabs = function (exception) {
364
- this._panels.forEach(function (panel, index) {
387
+ AccordionComponent.prototype.closeOtherTabs = function (exception) {
388
+ this.panels.forEach(function (panel, index) {
365
389
  if (index !== exception) {
366
390
  panel.isOpen = false;
367
391
  }
368
392
  });
369
393
  };
370
- AccordionComponent.prototype._setBehavior = function (multiple) {
394
+ AccordionComponent.prototype.setBehavior = function (multiple) {
371
395
  if (multiple) {
372
- this._enableMultiplePanelBehavior();
396
+ this.enableMultiplePanelBehavior();
373
397
  }
374
398
  else {
375
- this._enableSinglePanelBehavior();
399
+ this.enableSinglePanelBehavior();
376
400
  }
377
401
  };
378
- AccordionComponent.prototype._enableSinglePanelBehavior = function () {
402
+ AccordionComponent.prototype.enableSinglePanelBehavior = function () {
379
403
  var _this = this;
380
- this._panels.forEach(function (panel, index) {
381
- _this._openSubs[index] = panel.panelOpened
382
- .pipe(operators.takeUntil(_this._unsubscribe$))
383
- .subscribe(function () {
384
- _this._closeOtherTabs(index);
404
+ this.panels.forEach(function (panel, index) {
405
+ _this.openSubs[index] = panel.panelOpened.pipe(operators.takeUntil(_this.unsubscribe$)).subscribe(function () {
406
+ _this.closeOtherTabs(index);
385
407
  });
386
408
  });
387
409
  };
388
- AccordionComponent.prototype._enableMultiplePanelBehavior = function () {
410
+ AccordionComponent.prototype.enableMultiplePanelBehavior = function () {
389
411
  var _this = this;
390
- this._panels.forEach(function (_, index) {
391
- if (_this._openSubs[index]) {
392
- _this._openSubs[index].unsubscribe();
412
+ this.panels.forEach(function (_, index) {
413
+ if (_this.openSubs[index]) {
414
+ _this.openSubs[index].unsubscribe();
393
415
  }
394
416
  });
395
417
  };
@@ -607,7 +629,7 @@
607
629
  elementHeight: elementHeight,
608
630
  elementWidth: elementWidth,
609
631
  elementVerticalCenter: elementVerticalCenter,
610
- elementHorizontalCenter: elementHorizontalCenter
632
+ elementHorizontalCenter: elementHorizontalCenter,
611
633
  };
612
634
  };
613
635
  var getElementLeftoverContentAvailable = function (element) {
@@ -621,9 +643,14 @@
621
643
  freeDistanceToBottom: freeDistanceToBottom,
622
644
  freeDistanceToTop: freeDistanceToTop,
623
645
  freeDistanceToLeft: freeDistanceToLeft,
624
- freeDistanceToRight: freeDistanceToRight
646
+ freeDistanceToRight: freeDistanceToRight,
625
647
  };
626
648
  };
649
+ var deepClone = function (obj) {
650
+ if (typeof structuredClone === "function")
651
+ return structuredClone(obj);
652
+ return JSON.parse(JSON.stringify(obj));
653
+ };
627
654
 
628
655
  var MobileBehavior;
629
656
  (function (MobileBehavior) {
@@ -10377,11 +10404,11 @@
10377
10404
  };
10378
10405
  TableColumnsComponent.prototype.createColumnsTemplate = function (changes) {
10379
10406
  var _this = this;
10380
- var _a, _b, _c;
10407
+ var _a, _b, _c, _d;
10381
10408
  this.viewContainerRef.clear();
10382
10409
  var columns = ((_a = changes.columns) === null || _a === void 0 ? void 0 : _a.currentValue) || this.columns;
10383
- var rowValue = ((_b = changes.rowValue) === null || _b === void 0 ? void 0 : _b.currentValue) || this.rowValue;
10384
- var locale = ((_c = changes.locale) === null || _c === void 0 ? void 0 : _c.currentValue) || this.locale;
10410
+ var rowValue = deepClone((_c = (_b = changes.rowValue) === null || _b === void 0 ? void 0 : _b.currentValue) !== null && _c !== void 0 ? _c : this.rowValue);
10411
+ var locale = ((_d = changes.locale) === null || _d === void 0 ? void 0 : _d.currentValue) || this.locale;
10385
10412
  this.formattedColumns = columns.map(function (column) { return _this.getColumnValue(column, rowValue, locale); });
10386
10413
  this.cellsData = this.formattedColumns.map(function (column) { return _this.getCellData(column); });
10387
10414
  this.viewContainerRef.createEmbeddedView(this.columnsTemplate);
@@ -10512,14 +10539,14 @@
10512
10539
  };
10513
10540
  TableColumnsComponent.prototype.getColumnScale = function (scale) {
10514
10541
  if (typeof scale === "function") {
10515
- return scale(this.rowValue);
10542
+ return scale(deepClone(this.rowValue));
10516
10543
  }
10517
10544
  return scale;
10518
10545
  };
10519
10546
  TableColumnsComponent.prototype.getColumnInfoSign = function (infoSign) {
10520
10547
  if (infoSign !== undefined && infoSign !== null) {
10521
10548
  if (typeof infoSign === "function") {
10522
- return infoSign(this.rowValue);
10549
+ return infoSign(deepClone(this.rowValue));
10523
10550
  }
10524
10551
  return infoSign;
10525
10552
  }
@@ -10528,7 +10555,7 @@
10528
10555
  TableColumnsComponent.prototype.getColumnTooltip = function (tooltip) {
10529
10556
  if (tooltip !== undefined && tooltip !== null) {
10530
10557
  if (typeof tooltip === "function") {
10531
- return tooltip(this.rowValue);
10558
+ return tooltip(deepClone(this.rowValue));
10532
10559
  }
10533
10560
  return tooltip;
10534
10561
  }
@@ -10743,7 +10770,7 @@
10743
10770
  });
10744
10771
  };
10745
10772
  TablePagingComponent.prototype.getCurrentPageRowsToExport = function (columns) {
10746
- var tableData = this.table.value;
10773
+ var tableData = deepClone(this.table.value);
10747
10774
  if (this.loadCurrentPageRecords) {
10748
10775
  tableData = this.loadCurrentPageRecords();
10749
10776
  }
@@ -10752,7 +10779,7 @@
10752
10779
  return this.mapColumnsTranslations(columns, tableData);
10753
10780
  };
10754
10781
  TablePagingComponent.prototype.getSelectedRowsToExport = function (columns) {
10755
- var tableData = this.table.selection;
10782
+ var tableData = deepClone(this.table.selection);
10756
10783
  if (this.loadSelectedRecords) {
10757
10784
  tableData = this.loadSelectedRecords();
10758
10785
  }
@@ -24376,6 +24403,7 @@
24376
24403
  exports.WorkspaceSwitchModule = WorkspaceSwitchModule;
24377
24404
  exports.convertToMomentDateFormat = convertToMomentDateFormat;
24378
24405
  exports.countries = countries;
24406
+ exports.deepClone = deepClone;
24379
24407
  exports.fallback = fallback;
24380
24408
  exports.getElementLeftoverContentAvailable = getElementLeftoverContentAvailable;
24381
24409
  exports.getElementPositionInfo = getElementPositionInfo;