ps-toolkit-ui 1.15.89 → 1.15.91

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.
@@ -319,6 +319,7 @@
319
319
  FormBaseErrorNotRegistered: 'خطا در تایید کد نرم افزار',
320
320
  FormBaseErrorExpiredRegistered: 'کد نرم افزار منقضی شده است',
321
321
  FormBaseErrorInvalidIp: 'آی‌پی شما نامعتبر است',
322
+ FormBaseErrorNoCredit: 'اعتبار شما بارای انجام این عمیات ناکافی است',
322
323
  ErrorUpload: 'خطا در بارگذاری فایل',
323
324
  FormBaseErrorInvalidParam: 'خطا در اطلاعات ارسال شده',
324
325
  FormBaseErrorTimeOut: 'درخواست شما بیش از حد معمول زمان برده است. لطفا مجددا تلاش کنید',
@@ -1041,6 +1042,7 @@
1041
1042
  ResultStatusEnum[ResultStatusEnum["NotRegistered"] = 4] = "NotRegistered";
1042
1043
  ResultStatusEnum[ResultStatusEnum["ExpiredRegistered"] = 5] = "ExpiredRegistered";
1043
1044
  ResultStatusEnum[ResultStatusEnum["InvalidIp"] = 6] = "InvalidIp";
1045
+ ResultStatusEnum[ResultStatusEnum["NoCredit"] = 7] = "NoCredit";
1044
1046
  })(exports.ResultStatusEnum || (exports.ResultStatusEnum = {}));
1045
1047
  (function (PermissionTypeEnum) {
1046
1048
  PermissionTypeEnum[PermissionTypeEnum["Form"] = -1] = "Form";
@@ -1697,6 +1699,20 @@
1697
1699
  HelperClass.getRandomInt = function (min, max) {
1698
1700
  return Math.floor(Math.random() * (max - min)) + min;
1699
1701
  };
1702
+ HelperClass.fixChars = function (str) {
1703
+ if (str == null) {
1704
+ return null;
1705
+ }
1706
+ var arabicLetter = ['ي', 'ك', 'ة'];
1707
+ var persianLetter = ['ی', 'ک', 'ه'];
1708
+ for (var i = 0; i < 3; i++) {
1709
+ var re = new RegExp(arabicLetter[i], 'g');
1710
+ str = str.toString().Replace(re, persianLetter[i]);
1711
+ }
1712
+ return str.toString()
1713
+ .replace(/[۰-۹]/g, function (d) { return '۰۱۲۳۴۵۶۷۸۹'.indexOf(d); })
1714
+ .replace(/[٠-٩]/g, function (d) { return '٠١٢٣٤٥٦٧٨٩'.indexOf(d); });
1715
+ };
1700
1716
  HelperClass.ToReadablePlaque = function (p) {
1701
1717
  var tn = p.split('_');
1702
1718
  if (tn.length === 4) {
@@ -1849,6 +1865,9 @@
1849
1865
  else if (res.status === exports.ResultStatusEnum.InvalidIp) {
1850
1866
  m = form.l('FormBaseErrorInvalidIp');
1851
1867
  }
1868
+ else if (res.status === exports.ResultStatusEnum.NoCredit) {
1869
+ m = form.l('FormBaseErrorNoCredit');
1870
+ }
1852
1871
  else if (res.status === exports.ResultStatusEnum.Unauthorized) {
1853
1872
  m = form.l('FormBaseErrorExpired');
1854
1873
  }
@@ -1951,6 +1970,9 @@
1951
1970
  else if (res.status === exports.ResultStatusEnum.InvalidIp) {
1952
1971
  m = 'FormBaseErrorInvalidIp';
1953
1972
  }
1973
+ else if (res.status === exports.ResultStatusEnum.NoCredit) {
1974
+ m = 'FormBaseErrorNoCredit';
1975
+ }
1954
1976
  else if (res.status === exports.ResultStatusEnum.Unauthorized) {
1955
1977
  m = 'FormBaseErrorExpired';
1956
1978
  }
@@ -2025,6 +2047,9 @@
2025
2047
  else if (res.status === exports.ResultStatusEnum.InvalidIp) {
2026
2048
  m = 'FormBaseErrorInvalidIp';
2027
2049
  }
2050
+ else if (res.status === exports.ResultStatusEnum.NoCredit) {
2051
+ m = 'FormBaseErrorNoCredit';
2052
+ }
2028
2053
  else if (res.status === exports.ResultStatusEnum.Unauthorized) {
2029
2054
  m = 'FormBaseErrorExpired';
2030
2055
  }
@@ -6517,7 +6542,7 @@
6517
6542
  if (v === null || v === '' || v === undefined) {
6518
6543
  return null;
6519
6544
  }
6520
- return v;
6545
+ return HelperClass.fixChars(v);
6521
6546
  };
6522
6547
  this.inp.focus = function () {
6523
6548
  _this.onFocusIn();
@@ -6685,6 +6710,7 @@
6685
6710
  if (v === null || v === '' || v === undefined) {
6686
6711
  return null;
6687
6712
  }
6713
+ v = HelperClass.fixChars(v);
6688
6714
  if (v && _this.inp.type === exports.InputType.Number || _this.inp.type === exports.InputType.Price) {
6689
6715
  v = parseFloat(v.toString().replace(/,/g, '')) || 0;
6690
6716
  }
@@ -8346,7 +8372,6 @@
8346
8372
  }
8347
8373
  };
8348
8374
  FormTagComponent.prototype.onKeyDown = function (e) {
8349
- var _this = this;
8350
8375
  var v = $__namespace(this.inputBase.nativeElement);
8351
8376
  if (this.inp.onKeyDown) {
8352
8377
  this.inp.onKeyDown(e);
@@ -8354,36 +8379,33 @@
8354
8379
  var code = e.keyCode || e.which;
8355
8380
  if (code === 9) {
8356
8381
  e.preventDefault();
8357
- if (v.val() !== '') {
8358
- this.inp.value = this.inp.value.concat(v.val().toString().split(/[,]/).filter(function (x) { return x !== '' && !_this.inp.value.includes(x); }));
8359
- v.val('');
8360
- }
8382
+ this.setValue(v);
8361
8383
  this.changeIndex.emit(code === 9 ? e.shiftKey ? 'ShiftTab' : 'Tab' : e.shiftKey ? 'ShiftEnter' : 'Enter');
8362
8384
  }
8363
8385
  else if (code === 13) {
8364
8386
  if (v.val() !== '') {
8365
- this.inp.value = this.inp.value.concat(v.val().toString().split(/[,]/).filter(function (x) { return x !== '' && !_this.inp.value.includes(x); }));
8366
- v.val('');
8387
+ this.setValue(v);
8367
8388
  }
8368
8389
  }
8369
8390
  else if (code === 8) {
8370
- if (v.val() === '') {
8371
- this.inp.value.pop();
8372
- }
8391
+ this.inp.value.pop();
8373
8392
  }
8374
8393
  this.inp.error = null;
8375
8394
  };
8376
8395
  FormTagComponent.prototype.onFocusOut = function () {
8377
- var _this = this;
8378
8396
  var v = $__namespace(this.inputBase.nativeElement);
8379
- if (v.val() !== '') {
8380
- this.inp.value = this.inp.value.concat(v.val().toString().split(/[,]/).filter(function (x) { return x !== '' && !_this.inp.value.includes(x); }));
8381
- v.val('');
8382
- }
8397
+ this.setValue(v);
8383
8398
  };
8384
8399
  FormTagComponent.prototype.removeTag = function (t) {
8385
8400
  this.inp.value = this.inp.value.filter(function (x) { return x !== t; });
8386
8401
  };
8402
+ FormTagComponent.prototype.setValue = function (v) {
8403
+ var _this = this;
8404
+ if (v.val() !== '') {
8405
+ this.inp.value = this.inp.value.concat(HelperClass.fixChars(v.val().toString()).split(/[,]/).filter(function (x) { return x !== '' && !_this.inp.value.includes(x); }));
8406
+ v.val('');
8407
+ }
8408
+ };
8387
8409
  return FormTagComponent;
8388
8410
  }());
8389
8411
  FormTagComponent.decorators = [
@@ -8455,7 +8477,7 @@
8455
8477
  _this.inp.value = _this.inp.default;
8456
8478
  };
8457
8479
  this.inp.data = function () {
8458
- return _this.inp.value;
8480
+ return HelperClass.fixChars(_this.inp.value);
8459
8481
  };
8460
8482
  this.inp.focus = function () {
8461
8483
  _this.onFocusIn();