@acorex/components 1.3.90 → 1.3.94

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.
@@ -1229,7 +1229,7 @@
1229
1229
  core.Component({
1230
1230
  selector: 'ax-button',
1231
1231
  encapsulation: core.ViewEncapsulation.None,
1232
- template: "<button #container class=\"ax button form-control {{type}} {{size}}\" [class.selected]=\"selected\" [class.icon]=\"icon\"\r\n [class.icon]=\"loading\" [class.disabled]=\"disabled || loading\" (click)=\"handleClick($event)\" [disabled]=\"disabled\"\r\n [ngStyle]=\"{'width.%': block ? 100 : 'auto'}\" [attr.tabindex]=\"tabIndex\">\r\n <div class=\"button-inner-content\">\r\n <ng-container *ngIf=\"icon && !loading\">\r\n <i class=\"{{icon}} icon\"></i><ng-container *ngIf=\"refContent.innerText.length==0 && refContent.children.length == 0\">&nbsp;&nbsp;</ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"loading\">\r\n <i class=\"far fa-circle-notch fa-spin icon\"></i><ng-container *ngIf=\"refContent.innerText.length==0 && refContent.children.length == 0\">&nbsp;&nbsp;</ng-container>\r\n </ng-container>\r\n <div class=\"ax-wrapper\" #refContent>\r\n <ng-content></ng-content>\r\n </div>\r\n </div>\r\n</button>"
1232
+ template: "<button #container class=\"ax button form-control {{type}} {{size}}\" [class.selected]=\"selected\" [class.icon]=\"icon\"\r\n [class.icon]=\"loading\" [class.disabled]=\"disabled || loading\" (click)=\"handleClick($event)\" [disabled]=\"disabled\"\r\n [ngStyle]=\"{'width.%': block ? 100 : 'auto'}\" [attr.tabindex]=\"tabIndex\">\r\n <div class=\"button-inner-content\">\r\n <ng-container *ngIf=\"icon && !loading\">\r\n <i class=\"{{icon}} icon\"></i>\r\n <ng-container *ngIf=\"refContent.innerText.length==0 && refContent.children.length == 0\"></ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"loading\">\r\n <i class=\"far fa-circle-notch fa-spin icon\"></i>\r\n <ng-container *ngIf=\"refContent.innerText.length==0 && refContent.children.length == 0\"></ng-container>\r\n </ng-container>\r\n <div class=\"ax-wrapper\" #refContent>\r\n <ng-content></ng-content>\r\n </div>\r\n </div>\r\n</button>"
1233
1233
  }),
1234
1234
  __metadata("design:paramtypes", [core.ElementRef])
1235
1235
  ], AXButtonComponent);
@@ -1338,6 +1338,7 @@
1338
1338
  if (v == undefined) {
1339
1339
  this._value = null;
1340
1340
  this.focusedValue = this.today;
1341
+ this.viewRange = this.today.month.range;
1341
1342
  this.navigate(0);
1342
1343
  }
1343
1344
  this.onClick.emit({
@@ -1350,6 +1351,13 @@
1350
1351
  enumerable: true,
1351
1352
  configurable: true
1352
1353
  });
1354
+ Object.defineProperty(AXCalendarBoxComponent.prototype, "today", {
1355
+ get: function () {
1356
+ return new core$1.AXDateTime(new Date(), this.type);
1357
+ },
1358
+ enumerable: true,
1359
+ configurable: true
1360
+ });
1353
1361
  AXCalendarBoxComponent.prototype.findDay = function (date) {
1354
1362
  if (this.dayStyle.find(function (c) { return c.date == date.toISOString().split('T')[0]; })) {
1355
1363
  return true;
@@ -1375,12 +1383,17 @@
1375
1383
  }
1376
1384
  };
1377
1385
  AXCalendarBoxComponent.prototype.ngOnInit = function () {
1378
- this.today = this.focusedValue = new core$1.AXDateTime(new Date(), this.type);
1386
+ this.focusedValue = new core$1.AXDateTime(new Date(), this.type);
1379
1387
  //
1380
1388
  this.initLayout();
1381
1389
  //
1382
1390
  this.viewRange = this.today.month.range;
1383
- this.setFocus(this.today);
1391
+ if (this.value) {
1392
+ this.setFocus(new core$1.AXDateTime(this.value, this.type));
1393
+ }
1394
+ else {
1395
+ this.setFocus(this.today);
1396
+ }
1384
1397
  this.view = 'day';
1385
1398
  };
1386
1399
  AXCalendarBoxComponent.prototype.getViewCompaire = function (view) {
@@ -1430,9 +1443,7 @@
1430
1443
  };
1431
1444
  AXCalendarBoxComponent.prototype.rotate = function (array, n) {
1432
1445
  var len = array.length;
1433
- return !(n % len) ? array
1434
- : n > 0 ? array.map(function (e, i, a) { return a[(i + n) % len]; })
1435
- : array.map(function (e, i, a) { return a[(len - (len - i - n) % len) % len]; });
1446
+ return !(n % len) ? array : n > 0 ? array.map(function (e, i, a) { return a[(i + n) % len]; }) : array.map(function (e, i, a) { return a[(len - ((len - i - n) % len)) % len]; });
1436
1447
  };
1437
1448
  AXCalendarBoxComponent.prototype.navigate = function (value) {
1438
1449
  var start;
@@ -1443,10 +1454,7 @@
1443
1454
  fd = value.startOf('month');
1444
1455
  }
1445
1456
  else {
1446
- fd = this.viewRange.startTime
1447
- .add('day', 15)
1448
- .add('month', value)
1449
- .startOf('month');
1457
+ fd = this.viewRange.startTime.add('day', 15).add('month', value).startOf('month');
1450
1458
  }
1451
1459
  start = fd.firstDayOfWeek;
1452
1460
  end = fd.endOf('month').endDayOfWeek;
@@ -1469,10 +1477,7 @@
1469
1477
  fd = value.startOf('year');
1470
1478
  }
1471
1479
  else {
1472
- fd = this.viewRange.startTime
1473
- .add('day', 15)
1474
- .add('year', value)
1475
- .startOf('year');
1480
+ fd = this.viewRange.startTime.add('day', 15).add('year', value).startOf('year');
1476
1481
  }
1477
1482
  start = fd;
1478
1483
  end = fd.endOf('year');
@@ -1493,10 +1498,10 @@
1493
1498
  }
1494
1499
  this.viewRange = new core$1.AXDateTimeRange(start, end);
1495
1500
  //
1496
- if (this.getHoliday && typeof (this.getHoliday) === 'function') {
1501
+ if (this.getHoliday && typeof this.getHoliday === 'function') {
1497
1502
  this.holidays = this.getHoliday(start.date, end.date, this.type);
1498
1503
  }
1499
- if (this.getWeekend && typeof (this.getWeekend) === 'function') {
1504
+ if (this.getWeekend && typeof this.getWeekend === 'function') {
1500
1505
  this.weekends = this.getWeekend(start.date, end.date, this.type);
1501
1506
  }
1502
1507
  //
@@ -1587,8 +1592,9 @@
1587
1592
  r = d.compaireNew(new core$1.AXDateTime(this.max, this.type), this.getViewCompaire(this.view), this.type) === 1;
1588
1593
  }
1589
1594
  if (this.min && this.max) {
1590
- r = (d.compaireNew(new core$1.AXDateTime(this.min, this.type), this.getViewCompaire(this.view), this.type) === -1 ||
1591
- d.compaireNew(new core$1.AXDateTime(this.max, this.type), this.getViewCompaire(this.view), this.type) === 1);
1595
+ r =
1596
+ d.compaireNew(new core$1.AXDateTime(this.min, this.type), this.getViewCompaire(this.view), this.type) === -1 ||
1597
+ d.compaireNew(new core$1.AXDateTime(this.max, this.type), this.getViewCompaire(this.view), this.type) === 1;
1592
1598
  }
1593
1599
  }
1594
1600
  return r;
@@ -1698,8 +1704,7 @@
1698
1704
  encapsulation: core.ViewEncapsulation.None,
1699
1705
  changeDetection: core.ChangeDetectionStrategy.OnPush
1700
1706
  }),
1701
- __metadata("design:paramtypes", [core.ChangeDetectorRef,
1702
- core.ElementRef])
1707
+ __metadata("design:paramtypes", [core.ChangeDetectorRef, core.ElementRef])
1703
1708
  ], AXCalendarBoxComponent);
1704
1709
  return AXCalendarBoxComponent;
1705
1710
  }());
@@ -8427,6 +8432,7 @@
8427
8432
  _this.showCheckBox = true;
8428
8433
  _this.readonly = false;
8429
8434
  _this.rtl = core$1.AXConfig.get('layout.rtl');
8435
+ _this.disabled = false;
8430
8436
  _this.size = 'md';
8431
8437
  _this.allowNull = true;
8432
8438
  _this.textAlign = null;
@@ -8524,12 +8530,13 @@
8524
8530
  enumerable: true,
8525
8531
  configurable: true
8526
8532
  });
8527
- AXSelectBoxComponent.prototype.setSelectedItemsChange = function (v) {
8533
+ AXSelectBoxComponent.prototype.setSelectedItemsChange = function (v, old) {
8528
8534
  var _this = this;
8535
+ if (old === void 0) { old = this.selectedItems; }
8529
8536
  if (!v) {
8530
8537
  v = [];
8531
8538
  }
8532
- var old = this.selectedItems;
8539
+ // const old = this.selectedItems;
8533
8540
  if (JSON.stringify(old) !== JSON.stringify(v)) {
8534
8541
  this._selectedItems = this.mode == 'single' ? v.slice(0, 1) : __spread(new Set(v)); //[...new Set(v[0])] : [...new Set(v)];
8535
8542
  this._selectedItems.forEach(function (c) { return (c.selected = true); });
@@ -8593,9 +8600,11 @@
8593
8600
  // this.searchText = e.value;
8594
8601
  // this.text = e.value;
8595
8602
  // this.items = [];
8596
- var t = this.items.length;
8597
- for (var i = 0; i < t; i++) {
8598
- this.items.pop();
8603
+ if (this.items) {
8604
+ var t = this.items.length;
8605
+ for (var i = 0; i < t; i++) {
8606
+ this.items.pop();
8607
+ }
8599
8608
  }
8600
8609
  // this.items.forEach((element) => {
8601
8610
  // this.items.pop();
@@ -8709,7 +8718,7 @@
8709
8718
  _this.selectedItems.push(res);
8710
8719
  });
8711
8720
  // this.selectedItems.push(this.items.filter((c) => vv.includes(c[this.valueField])));
8712
- _this.setSelectedItemsChange(_this.selectedItems);
8721
+ _this.setSelectedItemsChange(_this.selectedItems, vv_1.length > 0 ? [1] : _this.selectedItems);
8713
8722
  }
8714
8723
  // this.selectedItems = this.items.filter((c) => v.includes(c[this.valueField]));
8715
8724
  }
@@ -8877,9 +8886,11 @@
8877
8886
  // this.items.forEach((element) => {
8878
8887
  // this.items.pop();
8879
8888
  // });
8880
- var t = this.items.length;
8881
- for (var i = 0; i < t; i++) {
8882
- this.items.pop();
8889
+ if (this.items) {
8890
+ var t = this.items.length;
8891
+ for (var i = 0; i < t; i++) {
8892
+ this.items.pop();
8893
+ }
8883
8894
  }
8884
8895
  this.fetch(params);
8885
8896
  }
@@ -8904,6 +8915,7 @@
8904
8915
  };
8905
8916
  AXSelectBoxComponent.prototype.onFocusTextBox = function (e) { };
8906
8917
  AXSelectBoxComponent.prototype.onTextBoxClick = function (e) {
8918
+ debugger;
8907
8919
  if (this.disabled == false && this.readonly == false) {
8908
8920
  this.dropdown.open();
8909
8921
  }
@@ -8944,6 +8956,7 @@
8944
8956
  };
8945
8957
  AXSelectBoxComponent.prototype.handleKeyEventSearch = function (e) {
8946
8958
  var _this = this;
8959
+ var _a;
8947
8960
  if (this.disabled || this.readonly) {
8948
8961
  this.dropdown.close();
8949
8962
  setTimeout(function () {
@@ -9028,7 +9041,7 @@
9028
9041
  }
9029
9042
  }
9030
9043
  else {
9031
- if (this.text && this.itemsFiltered.length === 1) {
9044
+ if (this.text && ((_a = this.itemsFiltered) === null || _a === void 0 ? void 0 : _a.length) === 1) {
9032
9045
  this.setSelectedItems(this.itemsFiltered, true);
9033
9046
  }
9034
9047
  if (this.mode == 'single') {
@@ -13931,7 +13944,6 @@
13931
13944
  _this.isSelectedItem = true;
13932
13945
  }
13933
13946
  }
13934
- debugger;
13935
13947
  });
13936
13948
  }
13937
13949
  else {