@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.
@@ -1023,7 +1023,7 @@ var AXButtonComponent = /** @class */ (function (_super) {
1023
1023
  Component({
1024
1024
  selector: 'ax-button',
1025
1025
  encapsulation: ViewEncapsulation.None,
1026
- 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>"
1026
+ 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>"
1027
1027
  }),
1028
1028
  __metadata("design:paramtypes", [ElementRef])
1029
1029
  ], AXButtonComponent);
@@ -1132,6 +1132,7 @@ var AXCalendarBoxComponent = /** @class */ (function () {
1132
1132
  if (v == undefined) {
1133
1133
  this._value = null;
1134
1134
  this.focusedValue = this.today;
1135
+ this.viewRange = this.today.month.range;
1135
1136
  this.navigate(0);
1136
1137
  }
1137
1138
  this.onClick.emit({
@@ -1144,6 +1145,13 @@ var AXCalendarBoxComponent = /** @class */ (function () {
1144
1145
  enumerable: true,
1145
1146
  configurable: true
1146
1147
  });
1148
+ Object.defineProperty(AXCalendarBoxComponent.prototype, "today", {
1149
+ get: function () {
1150
+ return new AXDateTime(new Date(), this.type);
1151
+ },
1152
+ enumerable: true,
1153
+ configurable: true
1154
+ });
1147
1155
  AXCalendarBoxComponent.prototype.findDay = function (date) {
1148
1156
  if (this.dayStyle.find(function (c) { return c.date == date.toISOString().split('T')[0]; })) {
1149
1157
  return true;
@@ -1169,12 +1177,17 @@ var AXCalendarBoxComponent = /** @class */ (function () {
1169
1177
  }
1170
1178
  };
1171
1179
  AXCalendarBoxComponent.prototype.ngOnInit = function () {
1172
- this.today = this.focusedValue = new AXDateTime(new Date(), this.type);
1180
+ this.focusedValue = new AXDateTime(new Date(), this.type);
1173
1181
  //
1174
1182
  this.initLayout();
1175
1183
  //
1176
1184
  this.viewRange = this.today.month.range;
1177
- this.setFocus(this.today);
1185
+ if (this.value) {
1186
+ this.setFocus(new AXDateTime(this.value, this.type));
1187
+ }
1188
+ else {
1189
+ this.setFocus(this.today);
1190
+ }
1178
1191
  this.view = 'day';
1179
1192
  };
1180
1193
  AXCalendarBoxComponent.prototype.getViewCompaire = function (view) {
@@ -1224,9 +1237,7 @@ var AXCalendarBoxComponent = /** @class */ (function () {
1224
1237
  };
1225
1238
  AXCalendarBoxComponent.prototype.rotate = function (array, n) {
1226
1239
  var len = array.length;
1227
- return !(n % len) ? array
1228
- : n > 0 ? array.map(function (e, i, a) { return a[(i + n) % len]; })
1229
- : array.map(function (e, i, a) { return a[(len - (len - i - n) % len) % len]; });
1240
+ 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]; });
1230
1241
  };
1231
1242
  AXCalendarBoxComponent.prototype.navigate = function (value) {
1232
1243
  var start;
@@ -1237,10 +1248,7 @@ var AXCalendarBoxComponent = /** @class */ (function () {
1237
1248
  fd = value.startOf('month');
1238
1249
  }
1239
1250
  else {
1240
- fd = this.viewRange.startTime
1241
- .add('day', 15)
1242
- .add('month', value)
1243
- .startOf('month');
1251
+ fd = this.viewRange.startTime.add('day', 15).add('month', value).startOf('month');
1244
1252
  }
1245
1253
  start = fd.firstDayOfWeek;
1246
1254
  end = fd.endOf('month').endDayOfWeek;
@@ -1263,10 +1271,7 @@ var AXCalendarBoxComponent = /** @class */ (function () {
1263
1271
  fd = value.startOf('year');
1264
1272
  }
1265
1273
  else {
1266
- fd = this.viewRange.startTime
1267
- .add('day', 15)
1268
- .add('year', value)
1269
- .startOf('year');
1274
+ fd = this.viewRange.startTime.add('day', 15).add('year', value).startOf('year');
1270
1275
  }
1271
1276
  start = fd;
1272
1277
  end = fd.endOf('year');
@@ -1287,10 +1292,10 @@ var AXCalendarBoxComponent = /** @class */ (function () {
1287
1292
  }
1288
1293
  this.viewRange = new AXDateTimeRange(start, end);
1289
1294
  //
1290
- if (this.getHoliday && typeof (this.getHoliday) === 'function') {
1295
+ if (this.getHoliday && typeof this.getHoliday === 'function') {
1291
1296
  this.holidays = this.getHoliday(start.date, end.date, this.type);
1292
1297
  }
1293
- if (this.getWeekend && typeof (this.getWeekend) === 'function') {
1298
+ if (this.getWeekend && typeof this.getWeekend === 'function') {
1294
1299
  this.weekends = this.getWeekend(start.date, end.date, this.type);
1295
1300
  }
1296
1301
  //
@@ -1381,8 +1386,9 @@ var AXCalendarBoxComponent = /** @class */ (function () {
1381
1386
  r = d.compaireNew(new AXDateTime(this.max, this.type), this.getViewCompaire(this.view), this.type) === 1;
1382
1387
  }
1383
1388
  if (this.min && this.max) {
1384
- r = (d.compaireNew(new AXDateTime(this.min, this.type), this.getViewCompaire(this.view), this.type) === -1 ||
1385
- d.compaireNew(new AXDateTime(this.max, this.type), this.getViewCompaire(this.view), this.type) === 1);
1389
+ r =
1390
+ d.compaireNew(new AXDateTime(this.min, this.type), this.getViewCompaire(this.view), this.type) === -1 ||
1391
+ d.compaireNew(new AXDateTime(this.max, this.type), this.getViewCompaire(this.view), this.type) === 1;
1386
1392
  }
1387
1393
  }
1388
1394
  return r;
@@ -1492,8 +1498,7 @@ var AXCalendarBoxComponent = /** @class */ (function () {
1492
1498
  encapsulation: ViewEncapsulation.None,
1493
1499
  changeDetection: ChangeDetectionStrategy.OnPush
1494
1500
  }),
1495
- __metadata("design:paramtypes", [ChangeDetectorRef,
1496
- ElementRef])
1501
+ __metadata("design:paramtypes", [ChangeDetectorRef, ElementRef])
1497
1502
  ], AXCalendarBoxComponent);
1498
1503
  return AXCalendarBoxComponent;
1499
1504
  }());
@@ -8221,6 +8226,7 @@ var AXSelectBoxComponent = /** @class */ (function (_super) {
8221
8226
  _this.showCheckBox = true;
8222
8227
  _this.readonly = false;
8223
8228
  _this.rtl = AXConfig.get('layout.rtl');
8229
+ _this.disabled = false;
8224
8230
  _this.size = 'md';
8225
8231
  _this.allowNull = true;
8226
8232
  _this.textAlign = null;
@@ -8318,12 +8324,13 @@ var AXSelectBoxComponent = /** @class */ (function (_super) {
8318
8324
  enumerable: true,
8319
8325
  configurable: true
8320
8326
  });
8321
- AXSelectBoxComponent.prototype.setSelectedItemsChange = function (v) {
8327
+ AXSelectBoxComponent.prototype.setSelectedItemsChange = function (v, old) {
8322
8328
  var _this = this;
8329
+ if (old === void 0) { old = this.selectedItems; }
8323
8330
  if (!v) {
8324
8331
  v = [];
8325
8332
  }
8326
- var old = this.selectedItems;
8333
+ // const old = this.selectedItems;
8327
8334
  if (JSON.stringify(old) !== JSON.stringify(v)) {
8328
8335
  this._selectedItems = this.mode == 'single' ? v.slice(0, 1) : __spread(new Set(v)); //[...new Set(v[0])] : [...new Set(v)];
8329
8336
  this._selectedItems.forEach(function (c) { return (c.selected = true); });
@@ -8387,9 +8394,11 @@ var AXSelectBoxComponent = /** @class */ (function (_super) {
8387
8394
  // this.searchText = e.value;
8388
8395
  // this.text = e.value;
8389
8396
  // this.items = [];
8390
- var t = this.items.length;
8391
- for (var i = 0; i < t; i++) {
8392
- this.items.pop();
8397
+ if (this.items) {
8398
+ var t = this.items.length;
8399
+ for (var i = 0; i < t; i++) {
8400
+ this.items.pop();
8401
+ }
8393
8402
  }
8394
8403
  // this.items.forEach((element) => {
8395
8404
  // this.items.pop();
@@ -8503,7 +8512,7 @@ var AXSelectBoxComponent = /** @class */ (function (_super) {
8503
8512
  _this.selectedItems.push(res);
8504
8513
  });
8505
8514
  // this.selectedItems.push(this.items.filter((c) => vv.includes(c[this.valueField])));
8506
- _this.setSelectedItemsChange(_this.selectedItems);
8515
+ _this.setSelectedItemsChange(_this.selectedItems, vv_1.length > 0 ? [1] : _this.selectedItems);
8507
8516
  }
8508
8517
  // this.selectedItems = this.items.filter((c) => v.includes(c[this.valueField]));
8509
8518
  }
@@ -8671,9 +8680,11 @@ var AXSelectBoxComponent = /** @class */ (function (_super) {
8671
8680
  // this.items.forEach((element) => {
8672
8681
  // this.items.pop();
8673
8682
  // });
8674
- var t = this.items.length;
8675
- for (var i = 0; i < t; i++) {
8676
- this.items.pop();
8683
+ if (this.items) {
8684
+ var t = this.items.length;
8685
+ for (var i = 0; i < t; i++) {
8686
+ this.items.pop();
8687
+ }
8677
8688
  }
8678
8689
  this.fetch(params);
8679
8690
  }
@@ -8698,6 +8709,7 @@ var AXSelectBoxComponent = /** @class */ (function (_super) {
8698
8709
  };
8699
8710
  AXSelectBoxComponent.prototype.onFocusTextBox = function (e) { };
8700
8711
  AXSelectBoxComponent.prototype.onTextBoxClick = function (e) {
8712
+ debugger;
8701
8713
  if (this.disabled == false && this.readonly == false) {
8702
8714
  this.dropdown.open();
8703
8715
  }
@@ -8738,6 +8750,7 @@ var AXSelectBoxComponent = /** @class */ (function (_super) {
8738
8750
  };
8739
8751
  AXSelectBoxComponent.prototype.handleKeyEventSearch = function (e) {
8740
8752
  var _this = this;
8753
+ var _a;
8741
8754
  if (this.disabled || this.readonly) {
8742
8755
  this.dropdown.close();
8743
8756
  setTimeout(function () {
@@ -8822,7 +8835,7 @@ var AXSelectBoxComponent = /** @class */ (function (_super) {
8822
8835
  }
8823
8836
  }
8824
8837
  else {
8825
- if (this.text && this.itemsFiltered.length === 1) {
8838
+ if (this.text && ((_a = this.itemsFiltered) === null || _a === void 0 ? void 0 : _a.length) === 1) {
8826
8839
  this.setSelectedItems(this.itemsFiltered, true);
8827
8840
  }
8828
8841
  if (this.mode == 'single') {
@@ -13725,7 +13738,6 @@ var AXTreeViewComponent = /** @class */ (function (_super) {
13725
13738
  _this.isSelectedItem = true;
13726
13739
  }
13727
13740
  }
13728
- debugger;
13729
13741
  });
13730
13742
  }
13731
13743
  else {