@acorex/components 16.18.6 → 16.18.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -979,21 +979,43 @@ class AXCalendarBoxComponent {
979
979
  jalali: {
980
980
  locale: AXConfig.get('dateTime.jalali.locale') || 'fa',
981
981
  dir: 'rtl',
982
- number: 1
982
+ number: 1,
983
983
  },
984
984
  gregorian: {
985
985
  locale: AXConfig.get('dateTime.gregorian.locale') || 'en',
986
986
  dir: 'ltr',
987
- number: 0
988
- }
987
+ number: 0,
988
+ },
989
989
  };
990
990
  numRotate;
991
991
  size = 'md';
992
992
  type;
993
993
  locale;
994
994
  dir;
995
- min;
996
- max;
995
+ _min;
996
+ set min(v) {
997
+ if (v) {
998
+ this._min = v;
999
+ this.focusedValue = this.today;
1000
+ this.viewRange = this.today.month.range;
1001
+ this.navigate(0);
1002
+ }
1003
+ }
1004
+ get min() {
1005
+ return this._min;
1006
+ }
1007
+ _max;
1008
+ set max(v) {
1009
+ if (v) {
1010
+ this._max = v;
1011
+ this.focusedValue = this.today;
1012
+ this.viewRange = this.today.month.range;
1013
+ this.navigate(0);
1014
+ }
1015
+ }
1016
+ get max() {
1017
+ return this._max;
1018
+ }
997
1019
  selectableHoliday = true;
998
1020
  dayStyle = [];
999
1021
  dayMinMaxResoan = '';
@@ -1034,7 +1056,7 @@ class AXCalendarBoxComponent {
1034
1056
  vv = AXDateTime.convert(v);
1035
1057
  }
1036
1058
  let unValidDate = false;
1037
- if (this.max || this.min) {
1059
+ if (this._max || this._min) {
1038
1060
  unValidDate = this.isInMInMaxRange(vv);
1039
1061
  }
1040
1062
  if (!unValidDate) {
@@ -1046,7 +1068,7 @@ class AXCalendarBoxComponent {
1046
1068
  this.onValueChanged.emit({
1047
1069
  component: this,
1048
1070
  value: this._value?.date,
1049
- htmlElement: this.ref.nativeElement
1071
+ htmlElement: this.ref.nativeElement,
1050
1072
  });
1051
1073
  }
1052
1074
  if (v == undefined) {
@@ -1058,7 +1080,7 @@ class AXCalendarBoxComponent {
1058
1080
  this.onClick.emit({
1059
1081
  component: this,
1060
1082
  value: this._value?.date,
1061
- htmlElement: this.ref.nativeElement
1083
+ htmlElement: this.ref.nativeElement,
1062
1084
  });
1063
1085
  }
1064
1086
  }
@@ -1094,8 +1116,10 @@ class AXCalendarBoxComponent {
1094
1116
  return this.dayStyle.find((c) => c.date.split('T')[0] == date.toISOString().split('T')[0]).text;
1095
1117
  }
1096
1118
  else {
1097
- if ((this.min && this.max && date.compaireNew(new AXDateTime(this.min, this.type), 'YMD', this.type) === -1) ||
1098
- date.compaireNew(new AXDateTime(this.max, this.type), 'YMD', this.type) === 1) {
1119
+ if ((this._min &&
1120
+ this._max &&
1121
+ date.compaireNew(new AXDateTime(this._min, this.type), 'YMD', this.type) === -1) ||
1122
+ date.compaireNew(new AXDateTime(this._max, this.type), 'YMD', this.type) === 1) {
1099
1123
  return this.dayMinMaxResoan;
1100
1124
  }
1101
1125
  else {
@@ -1149,7 +1173,7 @@ class AXCalendarBoxComponent {
1149
1173
  AXTranslator.get(`${path}.wed`, this.locale),
1150
1174
  AXTranslator.get(`${path}.thu`, this.locale),
1151
1175
  AXTranslator.get(`${path}.fri`, this.locale),
1152
- AXTranslator.get(`${path}.sat`, this.locale)
1176
+ AXTranslator.get(`${path}.sat`, this.locale),
1153
1177
  ];
1154
1178
  }
1155
1179
  getTodayName() {
@@ -1163,7 +1187,11 @@ class AXCalendarBoxComponent {
1163
1187
  }
1164
1188
  rotate(array, n) {
1165
1189
  const len = array.length;
1166
- return !(n % len) ? array : n > 0 ? array.map((e, i, a) => a[(i + n) % len]) : array.map((e, i, a) => a[(len - ((len - i - n) % len)) % len]);
1190
+ return !(n % len)
1191
+ ? array
1192
+ : n > 0
1193
+ ? array.map((e, i, a) => a[(i + n) % len])
1194
+ : array.map((e, i, a) => a[(len - ((len - i - n) % len)) % len]);
1167
1195
  }
1168
1196
  navigate(value) {
1169
1197
  let start;
@@ -1174,7 +1202,10 @@ class AXCalendarBoxComponent {
1174
1202
  fd = value.startOf('month');
1175
1203
  }
1176
1204
  else {
1177
- fd = this.viewRange.startTime.add('day', 15).add('month', value).startOf('month');
1205
+ fd = this.viewRange.startTime
1206
+ .add('day', 15)
1207
+ .add('month', value)
1208
+ .startOf('month');
1178
1209
  }
1179
1210
  start = fd.firstDayOfWeek;
1180
1211
  end = fd.endOf('month').endDayOfWeek;
@@ -1197,7 +1228,10 @@ class AXCalendarBoxComponent {
1197
1228
  fd = value.startOf('year');
1198
1229
  }
1199
1230
  else {
1200
- fd = this.viewRange.startTime.add('day', 15).add('year', value).startOf('year');
1231
+ fd = this.viewRange.startTime
1232
+ .add('day', 15)
1233
+ .add('year', value)
1234
+ .startOf('year');
1201
1235
  }
1202
1236
  start = fd;
1203
1237
  end = fd.endOf('year');
@@ -1227,7 +1261,8 @@ class AXCalendarBoxComponent {
1227
1261
  //
1228
1262
  if (this.view === 'day') {
1229
1263
  this.matrix = this.matrixify(this.applyStyle(this.viewRange.enumurate('day', this.type)), 7);
1230
- if (this.matrix.length > 0 && this.matrix[0].find((c) => c.nextMonth === false) === undefined) {
1264
+ if (this.matrix.length > 0 &&
1265
+ this.matrix[0].find((c) => c.nextMonth === false) === undefined) {
1231
1266
  this.matrix.splice(0, 1);
1232
1267
  }
1233
1268
  if (this.matrix[this.matrix.length - 1].find((c) => c.nextMonth === false) === undefined) {
@@ -1247,12 +1282,17 @@ class AXCalendarBoxComponent {
1247
1282
  dates.forEach((d, i, j) => {
1248
1283
  const item = {};
1249
1284
  item.date = d;
1250
- item.selected = d.compaireNew(new AXDateTime(this.value, this.type), this.getViewCompaire(this.view), this.type) === 0;
1251
- item.focused = d.compaireNew(this.focusedValue, this.getViewCompaire(this.view), this.type) === 0;
1252
- item.today = this.today && d.compaireNew(this.today, this.getViewCompaire(this.view), this.type) === 0;
1285
+ item.selected =
1286
+ d.compaireNew(new AXDateTime(this.value, this.type), this.getViewCompaire(this.view), this.type) === 0;
1287
+ item.focused =
1288
+ d.compaireNew(this.focusedValue, this.getViewCompaire(this.view), this.type) === 0;
1289
+ item.today =
1290
+ this.today &&
1291
+ d.compaireNew(this.today, this.getViewCompaire(this.view), this.type) === 0;
1253
1292
  if (this.view === 'day') {
1254
1293
  // item.nextMonth = d.compaireNew(this.viewRange.startTime.add('day', 10), 'YM') !== 0;
1255
- item.nextMonth = d.compaireNew(this.viewRange.startTime.add('day', 10), 'YM', this.type) !== 0;
1294
+ item.nextMonth =
1295
+ d.compaireNew(this.viewRange.startTime.add('day', 10), 'YM', this.type) !== 0;
1256
1296
  item.unselect = this.isInMInMaxRange(d);
1257
1297
  this.holidays.forEach((h) => {
1258
1298
  const comp = d.compaireNew(new AXDateTime(h.date, this.type), 'YMD', this.type);
@@ -1304,16 +1344,18 @@ class AXCalendarBoxComponent {
1304
1344
  isInMInMaxRange(d) {
1305
1345
  let r = false;
1306
1346
  if (d !== undefined) {
1307
- if (this.min && !this.max) {
1308
- r = d.compaireNew(new AXDateTime(this.min, this.type), this.getViewCompaire(this.view), this.type) === -1;
1347
+ if (this._min && !this._max) {
1348
+ r =
1349
+ d.compaireNew(new AXDateTime(this._min, this.type), this.getViewCompaire(this.view), this.type) === -1;
1309
1350
  }
1310
- if (this.max && !this.min) {
1311
- r = d.compaireNew(new AXDateTime(this.max, this.type), this.getViewCompaire(this.view), this.type) === 1;
1351
+ if (this._max && !this._min) {
1352
+ r =
1353
+ d.compaireNew(new AXDateTime(this._max, this.type), this.getViewCompaire(this.view), this.type) === 1;
1312
1354
  }
1313
- if (this.min && this.max) {
1355
+ if (this._min && this._max) {
1314
1356
  r =
1315
- d.compaireNew(new AXDateTime(this.min, this.type), this.getViewCompaire(this.view), this.type) === -1 ||
1316
- d.compaireNew(new AXDateTime(this.max, this.type), this.getViewCompaire(this.view), this.type) === 1;
1357
+ d.compaireNew(new AXDateTime(this._min, this.type), this.getViewCompaire(this.view), this.type) === -1 ||
1358
+ d.compaireNew(new AXDateTime(this._max, this.type), this.getViewCompaire(this.view), this.type) === 1;
1317
1359
  }
1318
1360
  }
1319
1361
  return r;
@@ -1324,7 +1366,9 @@ class AXCalendarBoxComponent {
1324
1366
  }
1325
1367
  else {
1326
1368
  this.view = 'day';
1327
- this.setFocus(new AXDateTime(this.value, this.type).set('year', date.year).set('month', date.monthOfYear));
1369
+ this.setFocus(new AXDateTime(this.value, this.type)
1370
+ .set('year', date.year)
1371
+ .set('month', date.monthOfYear));
1328
1372
  }
1329
1373
  event.stopPropagation();
1330
1374
  }
@@ -13207,7 +13251,7 @@ class AXSelectBoxPropertyEditorComponent extends AXProperyEditorComponent {
13207
13251
  selectionMode = 'single';
13208
13252
  selectionDataMode = 'value';
13209
13253
  allowSearch = true;
13210
- allowNull = false;
13254
+ allowNull = true;
13211
13255
  disabled = false;
13212
13256
  items = [];
13213
13257
  remoteOperation = false;