@magic-xpa/gui 4.801.0-dev481.262 → 4.801.0-dev481.276
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.
- package/esm2020/src/management/gui/DisplayConvertor.mjs +1 -77
- package/esm2020/src/management/gui/FieldValidator.mjs +4 -796
- package/esm2020/src/management/gui/HebrewDate.mjs +1 -24
- package/fesm2015/magic-xpa-gui.mjs +0 -888
- package/fesm2015/magic-xpa-gui.mjs.map +1 -1
- package/fesm2020/magic-xpa-gui.mjs +0 -888
- package/fesm2020/magic-xpa-gui.mjs.map +1 -1
- package/package.json +2 -2
- package/src/management/gui/DisplayConvertor.d.ts +0 -3
- package/src/management/gui/FieldValidator.d.ts +0 -29
- package/src/management/gui/HebrewDate.d.ts +1 -5
|
@@ -5871,26 +5871,6 @@ class HebrewDate {
|
|
|
5871
5871
|
}
|
|
5872
5872
|
return val;
|
|
5873
5873
|
}
|
|
5874
|
-
static isHebrewLetter(letter) {
|
|
5875
|
-
if (letter >= HebrewDate.ALEF && letter <= HebrewDate.TAV)
|
|
5876
|
-
return true;
|
|
5877
|
-
else
|
|
5878
|
-
return false;
|
|
5879
|
-
}
|
|
5880
|
-
static add2Date(newValue, currValue, letters, buffer) {
|
|
5881
|
-
let start = currValue;
|
|
5882
|
-
let i;
|
|
5883
|
-
let currAdd = new StringBuilder(newValue.length);
|
|
5884
|
-
while (start < newValue.length && !HebrewDate.isHebrewLetter(newValue.charAt(start)))
|
|
5885
|
-
start = start + 1;
|
|
5886
|
-
for (i = start; i < start + letters && i < newValue.length; i++) {
|
|
5887
|
-
if (HebrewDate.isHebrewLetter(newValue.charAt(i)) || newValue.charAt(i) === ' ' || newValue.charAt(i) === '"' || newValue.charAt(i) === '\'')
|
|
5888
|
-
buffer.Append(newValue.charAt(i));
|
|
5889
|
-
else
|
|
5890
|
-
break;
|
|
5891
|
-
}
|
|
5892
|
-
return i;
|
|
5893
|
-
}
|
|
5894
5874
|
static dateheb_2_d(year, month, day) {
|
|
5895
5875
|
if (day === 0 && month === 0 && year === 0)
|
|
5896
5876
|
return 0;
|
|
@@ -5924,8 +5904,6 @@ HebrewDate.NORM_YEARS_PER_CYCLE = 12;
|
|
|
5924
5904
|
HebrewDate.LEAP_YEARS_PER_CYCLE = 7;
|
|
5925
5905
|
HebrewDate.YEARS_PER_CYCLE = (HebrewDate.NORM_YEARS_PER_CYCLE + HebrewDate.LEAP_YEARS_PER_CYCLE);
|
|
5926
5906
|
HebrewDate.MONTHS_PER_CYCLE = (HebrewDate.NORM_YEARS_PER_CYCLE * HebrewDate.MONTHS_PER_NORM_YEAR + HebrewDate.LEAP_YEARS_PER_CYCLE * HebrewDate.MONTHS_PER_LEAP_YEAR);
|
|
5927
|
-
HebrewDate.PARTS_PER_NORM_YEAR = (HebrewDate.MONTHS_PER_NORM_YEAR * HebrewDate.PARTS_PER_MONTH);
|
|
5928
|
-
HebrewDate.DAYS_PER_NORM_YEAR = Math.floor(HebrewDate.PARTS_PER_NORM_YEAR / HebrewDate.PARTS_PER_DAY);
|
|
5929
5907
|
HebrewDate.PARTS_PER_LEAP_YEAR = (HebrewDate.MONTHS_PER_LEAP_YEAR * HebrewDate.PARTS_PER_MONTH);
|
|
5930
5908
|
HebrewDate.DAYS_PER_LEAP_YEAR = Math.floor(HebrewDate.PARTS_PER_LEAP_YEAR / HebrewDate.PARTS_PER_DAY);
|
|
5931
5909
|
HebrewDate.PARTS_PER_CYCLE = (HebrewDate.MONTHS_PER_CYCLE * HebrewDate.PARTS_PER_MONTH);
|
|
@@ -6703,8 +6681,6 @@ class DisplayConvertor {
|
|
|
6703
6681
|
return (ret);
|
|
6704
6682
|
}
|
|
6705
6683
|
fromMgTimeToNativeTime(dataStr, pic) {
|
|
6706
|
-
let mask = pic.getMask();
|
|
6707
|
-
let maskSize = pic.getMaskSize();
|
|
6708
6684
|
let time = new NUM_TYPE(dataStr).NUM_2_ULONG();
|
|
6709
6685
|
let breakParams = new TimeBreakParams();
|
|
6710
6686
|
DisplayConvertor.time_break(breakParams, time);
|
|
@@ -6823,22 +6799,6 @@ class DisplayConvertor {
|
|
|
6823
6799
|
breakParams.second = time - breakParams.minute * 60;
|
|
6824
6800
|
}
|
|
6825
6801
|
}
|
|
6826
|
-
fromLogical(dataStr, pic, rangeStr) {
|
|
6827
|
-
let Str = NString.ToCharArray(pic.getMask());
|
|
6828
|
-
if (pic.getMaskSize() > Str.length) {
|
|
6829
|
-
MemoryUtil.char_memset(Str, 0, '*', Str.length);
|
|
6830
|
-
return NString.FromChars(Str);
|
|
6831
|
-
}
|
|
6832
|
-
else {
|
|
6833
|
-
let array2 = new Array(50);
|
|
6834
|
-
for (let _ai = 0; _ai < array2.length; ++_ai)
|
|
6835
|
-
array2[_ai] = (0).toString();
|
|
6836
|
-
this.win_rng_bool_sub(array2, array2.length, dataStr.charAt(0) === '1', rangeStr);
|
|
6837
|
-
let len = pic.getMaskSize();
|
|
6838
|
-
let resStr = this.win_data_cpy(Str, len, array2, pic.isAttrAlpha());
|
|
6839
|
-
return resStr;
|
|
6840
|
-
}
|
|
6841
|
-
}
|
|
6842
6802
|
fromMgLogicalToNativeLogical(dataStr) {
|
|
6843
6803
|
let nativeVal;
|
|
6844
6804
|
nativeVal = (dataStr.charAt(0) === '1') ? true : false;
|
|
@@ -6849,70 +6809,12 @@ class DisplayConvertor {
|
|
|
6849
6809
|
mgVal = (dispVal === true) ? "1" : "0";
|
|
6850
6810
|
return mgVal;
|
|
6851
6811
|
}
|
|
6852
|
-
win_rng_bool_sub(Sub, SubSiz, BoolVal, rng) {
|
|
6853
|
-
let crk = new Array(PICInterface.DB_STR_MAX + 2);
|
|
6854
|
-
for (let _ai = 0; _ai < crk.length; ++_ai)
|
|
6855
|
-
crk[_ai] = (0).toString();
|
|
6856
|
-
let gap = new Array(PICInterface.DB_STR_MAX + 2);
|
|
6857
|
-
for (let _ai = 0; _ai < gap.length; ++_ai)
|
|
6858
|
-
gap[_ai] = (0).toString();
|
|
6859
|
-
let i = 0;
|
|
6860
|
-
rng = this.win_rng_bool(rng);
|
|
6861
|
-
this.win_rng_crk(crk, gap, rng);
|
|
6862
|
-
let s;
|
|
6863
|
-
if (BoolVal) {
|
|
6864
|
-
s = 0;
|
|
6865
|
-
}
|
|
6866
|
-
else {
|
|
6867
|
-
while (crk[i] > '\0') {
|
|
6868
|
-
i = i + 1;
|
|
6869
|
-
}
|
|
6870
|
-
s = i + 1;
|
|
6871
|
-
}
|
|
6872
|
-
let len = s;
|
|
6873
|
-
while (crk[len] > '\0') {
|
|
6874
|
-
len = len + 1;
|
|
6875
|
-
}
|
|
6876
|
-
len = len - s;
|
|
6877
|
-
MemoryUtil.char_memcpy(Sub, 0, crk, s, Math.min(len, SubSiz));
|
|
6878
|
-
if (len < SubSiz) {
|
|
6879
|
-
MemoryUtil.char_memset(Sub, len, ' ', SubSiz - len);
|
|
6880
|
-
}
|
|
6881
|
-
}
|
|
6882
6812
|
win_rng_bool(rng) {
|
|
6883
6813
|
if (rng === null || rng.length === 0) {
|
|
6884
6814
|
rng = "True, False";
|
|
6885
6815
|
}
|
|
6886
6816
|
return rng;
|
|
6887
6817
|
}
|
|
6888
|
-
win_rng_crk(crk, gap, range) {
|
|
6889
|
-
let rngLen = range.length;
|
|
6890
|
-
let rng = NString.ToCharArray(range);
|
|
6891
|
-
let crkPos = 0;
|
|
6892
|
-
let rngPos = 0;
|
|
6893
|
-
let gapPos = 0;
|
|
6894
|
-
while (rngPos < rngLen) {
|
|
6895
|
-
if (rng[rngPos] === ',' || rng[rngPos] === '-') {
|
|
6896
|
-
gap[gapPos++] = rng[rngPos++];
|
|
6897
|
-
crk[crkPos++] = '\0';
|
|
6898
|
-
if (rngPos < rngLen) {
|
|
6899
|
-
while (rng[rngPos] === ' ') {
|
|
6900
|
-
rngPos = rngPos + 1;
|
|
6901
|
-
}
|
|
6902
|
-
}
|
|
6903
|
-
}
|
|
6904
|
-
else {
|
|
6905
|
-
if (rng[rngPos] === '\\') {
|
|
6906
|
-
rngPos = rngPos + 1;
|
|
6907
|
-
}
|
|
6908
|
-
crk[crkPos] = rng[rngPos++];
|
|
6909
|
-
crkPos = crkPos + 1;
|
|
6910
|
-
}
|
|
6911
|
-
}
|
|
6912
|
-
gap[gapPos] = '\0';
|
|
6913
|
-
crk[crkPos++] = '\0';
|
|
6914
|
-
crk[crkPos] = '\0';
|
|
6915
|
-
}
|
|
6916
6818
|
toNum(dispValue, pic, compIdx) {
|
|
6917
6819
|
let mgNum = new NUM_TYPE(dispValue, pic, compIdx);
|
|
6918
6820
|
return mgNum.toXMLrecord();
|
|
@@ -11312,7 +11214,6 @@ class FieldValidator {
|
|
|
11312
11214
|
return this._newvalue;
|
|
11313
11215
|
}
|
|
11314
11216
|
isPossibleAlphaLetter(indexInput, indexPicture) {
|
|
11315
|
-
let result;
|
|
11316
11217
|
switch (this._picture.charCodeAt(indexPicture)) {
|
|
11317
11218
|
case PICInterface.PIC_X:
|
|
11318
11219
|
case PICInterface.PIC_J:
|
|
@@ -11343,34 +11244,6 @@ class FieldValidator {
|
|
|
11343
11244
|
return false;
|
|
11344
11245
|
}
|
|
11345
11246
|
}
|
|
11346
|
-
fillAllAlpha() {
|
|
11347
|
-
let stringBuilder = new StringBuilder(this._picture.length);
|
|
11348
|
-
stringBuilder.Append(this._newvalue);
|
|
11349
|
-
if (UtilStrByteMode.isLocaleDefLangDBCS() && this._valDet.getType() === StorageAttribute.ALPHA) {
|
|
11350
|
-
let intNewvalueLenB = UtilStrByteMode.lenB(this._newvalue);
|
|
11351
|
-
let strBuiedPicture = UtilStrByteMode.leftB(this._picture, intNewvalueLenB);
|
|
11352
|
-
for (let i = strBuiedPicture.length; i < this._picture.length; i = i + 1) {
|
|
11353
|
-
if (DisplayConvertor.isAlphaPositionalDirective(this._picture.charAt(i))) {
|
|
11354
|
-
stringBuilder.Append(' ');
|
|
11355
|
-
}
|
|
11356
|
-
else {
|
|
11357
|
-
stringBuilder.Append(this._picture.charAt(i));
|
|
11358
|
-
}
|
|
11359
|
-
}
|
|
11360
|
-
}
|
|
11361
|
-
else {
|
|
11362
|
-
for (let i = this._newvalue.length - 1; i < this._picture.length && i >= 0; i++) {
|
|
11363
|
-
if (DisplayConvertor.isAlphaPositionalDirective(this._picture.charAt(i))) {
|
|
11364
|
-
stringBuilder.Append(' ');
|
|
11365
|
-
}
|
|
11366
|
-
else {
|
|
11367
|
-
stringBuilder.Append(this._picture.charAt(i));
|
|
11368
|
-
}
|
|
11369
|
-
i = i + 1;
|
|
11370
|
-
}
|
|
11371
|
-
}
|
|
11372
|
-
return stringBuilder.ToString();
|
|
11373
|
-
}
|
|
11374
11247
|
fillAlphaByRange(ContinuousRangeValues, DiscreteRangeValues) {
|
|
11375
11248
|
let tmpBuffer = DisplayConvertor.Instance.fillAlphaByDiscreteRangeValues(DiscreteRangeValues, this._newvalue);
|
|
11376
11249
|
if (tmpBuffer !== null) {
|
|
@@ -11640,46 +11513,6 @@ class FieldValidator {
|
|
|
11640
11513
|
}
|
|
11641
11514
|
throw new WrongFormatException();
|
|
11642
11515
|
}
|
|
11643
|
-
getDoubleVal(val) {
|
|
11644
|
-
let dotFound = false;
|
|
11645
|
-
let minusFound = false;
|
|
11646
|
-
let digitFound = false;
|
|
11647
|
-
let endOfNum = false;
|
|
11648
|
-
let i = 0;
|
|
11649
|
-
for (i = 0; i < val.length && !endOfNum; i++) {
|
|
11650
|
-
let c = val[i];
|
|
11651
|
-
if (c >= '0' && c <= '9')
|
|
11652
|
-
digitFound = true;
|
|
11653
|
-
else {
|
|
11654
|
-
switch (c) {
|
|
11655
|
-
case '-':
|
|
11656
|
-
if (digitFound || dotFound || minusFound)
|
|
11657
|
-
endOfNum = true;
|
|
11658
|
-
minusFound = true;
|
|
11659
|
-
break;
|
|
11660
|
-
case '.':
|
|
11661
|
-
if (dotFound || minusFound && !digitFound)
|
|
11662
|
-
endOfNum = true;
|
|
11663
|
-
dotFound = true;
|
|
11664
|
-
break;
|
|
11665
|
-
case ' ':
|
|
11666
|
-
if (digitFound || dotFound || minusFound)
|
|
11667
|
-
endOfNum = true;
|
|
11668
|
-
break;
|
|
11669
|
-
default:
|
|
11670
|
-
endOfNum = true;
|
|
11671
|
-
break;
|
|
11672
|
-
}
|
|
11673
|
-
}
|
|
11674
|
-
}
|
|
11675
|
-
if (endOfNum) {
|
|
11676
|
-
i = i - 1;
|
|
11677
|
-
}
|
|
11678
|
-
if (i > 0) {
|
|
11679
|
-
return NNumber.Parse(val.substr(0, i));
|
|
11680
|
-
}
|
|
11681
|
-
return -Infinity;
|
|
11682
|
-
}
|
|
11683
11516
|
setNumericValueWithoutPicture(val) {
|
|
11684
11517
|
let checkedStr = new StringBuilder(val.length);
|
|
11685
11518
|
let isFirstDecimal = false;
|
|
@@ -11738,274 +11571,6 @@ class FieldValidator {
|
|
|
11738
11571
|
}
|
|
11739
11572
|
return newDate;
|
|
11740
11573
|
}
|
|
11741
|
-
add2Date(currValue, buffer, type) {
|
|
11742
|
-
let start = currValue;
|
|
11743
|
-
let currAdd = new StringBuilder(this._newvalue.length);
|
|
11744
|
-
let letters = 0;
|
|
11745
|
-
switch (type) {
|
|
11746
|
-
case PICInterface.PIC_DD:
|
|
11747
|
-
case PICInterface.PIC_DDDD:
|
|
11748
|
-
case PICInterface.PIC_MMD:
|
|
11749
|
-
case PICInterface.PIC_YY:
|
|
11750
|
-
letters = 2;
|
|
11751
|
-
break;
|
|
11752
|
-
case PICInterface.PIC_DDD:
|
|
11753
|
-
letters = 3;
|
|
11754
|
-
break;
|
|
11755
|
-
case PICInterface.PIC_YYYY:
|
|
11756
|
-
letters = 4;
|
|
11757
|
-
break;
|
|
11758
|
-
case PICInterface.PIC_W:
|
|
11759
|
-
letters = 1;
|
|
11760
|
-
break;
|
|
11761
|
-
case PICInterface.PIC_YJ:
|
|
11762
|
-
letters = 2;
|
|
11763
|
-
type = PICInterface.PIC_YY;
|
|
11764
|
-
break;
|
|
11765
|
-
}
|
|
11766
|
-
while (start < this._newvalue.length && !UtilStrByteMode.isDigit(this._newvalue.charAt(start)))
|
|
11767
|
-
start++;
|
|
11768
|
-
if (start === this._newvalue.length && (this._newvalue.length === 0 || this._newvalue === "0")) {
|
|
11769
|
-
for (let nul = 0; nul < letters; nul = nul + 1) {
|
|
11770
|
-
buffer.Append('0');
|
|
11771
|
-
}
|
|
11772
|
-
return currValue;
|
|
11773
|
-
}
|
|
11774
|
-
else if (start === this._newvalue.length) {
|
|
11775
|
-
this._newvalue = this._newvalue + "0";
|
|
11776
|
-
}
|
|
11777
|
-
let i;
|
|
11778
|
-
for (i = start; i < start + letters && i < this._newvalue.length; i++) {
|
|
11779
|
-
if (UtilStrByteMode.isDigit(this._newvalue.charAt(i)))
|
|
11780
|
-
currAdd.Append(this._newvalue.charAt(i));
|
|
11781
|
-
else
|
|
11782
|
-
break;
|
|
11783
|
-
}
|
|
11784
|
-
if (currAdd.Length === 0) {
|
|
11785
|
-
currAdd.Append('0');
|
|
11786
|
-
}
|
|
11787
|
-
let add = NNumber.Parse(currAdd.ToString());
|
|
11788
|
-
if ((add < 1 && type !== PICInterface.PIC_YYYY && type !== PICInterface.PIC_YY) ||
|
|
11789
|
-
(add > 31 && (type === PICInterface.PIC_DD || type === PICInterface.PIC_DDDD)) ||
|
|
11790
|
-
(add > 12 && type === PICInterface.PIC_MMD) || (add > 7 && type === PICInterface.PIC_W)) {
|
|
11791
|
-
throw new WrongFormatException(MsgInterface.STR_ERR_DATE);
|
|
11792
|
-
}
|
|
11793
|
-
if (type === PICInterface.PIC_YYYY && this._environment.GetCentury(this._valDet.getControl().getForm().getTask().getCompIdx()) > 999 && currAdd.Length < 3)
|
|
11794
|
-
currAdd = this.checkCentury(add);
|
|
11795
|
-
for (let j = 0; j < letters - currAdd.Length; j = j + 1) {
|
|
11796
|
-
buffer.Append('0');
|
|
11797
|
-
}
|
|
11798
|
-
buffer.Append(currAdd.ToString());
|
|
11799
|
-
return i;
|
|
11800
|
-
}
|
|
11801
|
-
addM2Date(currValue, letters, buffer, type) {
|
|
11802
|
-
let array;
|
|
11803
|
-
let result;
|
|
11804
|
-
if (type === PICInterface.PIC_MMM || type === PICInterface.PIC_MMD) {
|
|
11805
|
-
if (this.hebrew) {
|
|
11806
|
-
array = HebrewDate.GetLocalMonths();
|
|
11807
|
-
}
|
|
11808
|
-
else {
|
|
11809
|
-
let messageString = Events.GetMessageString(MsgInterface.MONTHS_PTR);
|
|
11810
|
-
array = DateUtil.getLocalMonths(messageString);
|
|
11811
|
-
}
|
|
11812
|
-
}
|
|
11813
|
-
else {
|
|
11814
|
-
if (type === PICInterface.PIC_WWW || type === PICInterface.PIC_W) {
|
|
11815
|
-
if (this.hebrew) {
|
|
11816
|
-
array = HebrewDate.GetLocalDows();
|
|
11817
|
-
}
|
|
11818
|
-
else {
|
|
11819
|
-
let dayStr = Events.GetMessageString(MsgInterface.DAYS_PTR);
|
|
11820
|
-
array = DateUtil.getLocalDays(dayStr);
|
|
11821
|
-
}
|
|
11822
|
-
}
|
|
11823
|
-
else {
|
|
11824
|
-
if (type === PICInterface.PIC_BB) {
|
|
11825
|
-
array = UtilDateJpn.getArrayDow();
|
|
11826
|
-
}
|
|
11827
|
-
else {
|
|
11828
|
-
if (type === PICInterface.PIC_JY1 || type === PICInterface.PIC_JY2 || type === PICInterface.PIC_JY4) {
|
|
11829
|
-
if (this._newvalue.length < currValue + letters) {
|
|
11830
|
-
throw new WrongFormatException(MsgInterface.STR_ERR_DATE);
|
|
11831
|
-
}
|
|
11832
|
-
let text = this._newvalue.substr(currValue, letters);
|
|
11833
|
-
buffer.Append(text);
|
|
11834
|
-
return currValue + text.length;
|
|
11835
|
-
}
|
|
11836
|
-
else {
|
|
11837
|
-
return currValue + letters;
|
|
11838
|
-
}
|
|
11839
|
-
}
|
|
11840
|
-
}
|
|
11841
|
-
}
|
|
11842
|
-
if (this._newvalue.length < currValue) {
|
|
11843
|
-
currValue = this._newvalue.length;
|
|
11844
|
-
}
|
|
11845
|
-
let max = this.getMonthOrWeek(this._newvalue.substr(currValue), letters, type);
|
|
11846
|
-
if (array[max].trim().length >= letters) {
|
|
11847
|
-
buffer.Append(array[max].trim().substr(0, letters));
|
|
11848
|
-
}
|
|
11849
|
-
else {
|
|
11850
|
-
buffer.Append(array[max].trim());
|
|
11851
|
-
for (let i = letters - array[max].trim().length; i > 0; i = i - 1) {
|
|
11852
|
-
buffer.Append(' ');
|
|
11853
|
-
}
|
|
11854
|
-
}
|
|
11855
|
-
return currValue + letters;
|
|
11856
|
-
}
|
|
11857
|
-
getEndOfNumericBlock(currValue) {
|
|
11858
|
-
while (currValue < this._newvalue.length && !UtilStrByteMode.isDigit(this._newvalue.charAt(currValue))) {
|
|
11859
|
-
currValue = currValue + 1;
|
|
11860
|
-
}
|
|
11861
|
-
return currValue;
|
|
11862
|
-
}
|
|
11863
|
-
addDateSuffix(last) {
|
|
11864
|
-
let thenumber = NNumber.Parse(last);
|
|
11865
|
-
if (thenumber === 1 || thenumber === 21 || thenumber === 31)
|
|
11866
|
-
return "st";
|
|
11867
|
-
else if (thenumber === 2 || thenumber === 22)
|
|
11868
|
-
return "nd";
|
|
11869
|
-
else if (thenumber === 3 || thenumber === 23)
|
|
11870
|
-
return "rd";
|
|
11871
|
-
return "th";
|
|
11872
|
-
}
|
|
11873
|
-
getSizeOfBlock(start, type) {
|
|
11874
|
-
let letters = start + 1;
|
|
11875
|
-
while (letters < this._picture.length && this._picture.charCodeAt(letters) === type)
|
|
11876
|
-
letters++;
|
|
11877
|
-
return letters - start;
|
|
11878
|
-
}
|
|
11879
|
-
getMonthOrWeek(month_str, letters, type) {
|
|
11880
|
-
let array;
|
|
11881
|
-
if (type === PICInterface.PIC_MMM || type === PICInterface.PIC_MMD) {
|
|
11882
|
-
if (this.hebrew)
|
|
11883
|
-
array = HebrewDate.GetLocalMonths();
|
|
11884
|
-
else {
|
|
11885
|
-
let monthStr = Events.GetMessageString(MsgInterface.MONTHS_PTR);
|
|
11886
|
-
array = DateUtil.getLocalMonths(monthStr.toString());
|
|
11887
|
-
}
|
|
11888
|
-
}
|
|
11889
|
-
else if (type === PICInterface.PIC_WWW || type === PICInterface.PIC_W) {
|
|
11890
|
-
if (this.hebrew)
|
|
11891
|
-
array = HebrewDate.GetLocalDows();
|
|
11892
|
-
else {
|
|
11893
|
-
let dayStr = Events.GetMessageString(MsgInterface.DAYS_PTR);
|
|
11894
|
-
array = DateUtil.getLocalDays(dayStr.toString());
|
|
11895
|
-
}
|
|
11896
|
-
}
|
|
11897
|
-
else if (type === PICInterface.PIC_BB) {
|
|
11898
|
-
array = UtilDateJpn.getArrayDow();
|
|
11899
|
-
}
|
|
11900
|
-
else {
|
|
11901
|
-
return 1;
|
|
11902
|
-
}
|
|
11903
|
-
if (letters > month_str.length)
|
|
11904
|
-
letters = month_str.length;
|
|
11905
|
-
if (this.hebrew) {
|
|
11906
|
-
let hstr = NString.TrimStart(month_str).substr(0, letters).trim();
|
|
11907
|
-
for (let i = 1; i < array.length; i++) {
|
|
11908
|
-
if (array[i].trim() === hstr) {
|
|
11909
|
-
if (i === 14)
|
|
11910
|
-
i = 6;
|
|
11911
|
-
return i;
|
|
11912
|
-
}
|
|
11913
|
-
}
|
|
11914
|
-
return 0;
|
|
11915
|
-
}
|
|
11916
|
-
try {
|
|
11917
|
-
let str = month_str.substr(0, letters).trim();
|
|
11918
|
-
let numBuffer = new StringBuilder(str.length);
|
|
11919
|
-
for (let i = 0; i < str.length; i++) {
|
|
11920
|
-
if (UtilStrByteMode.isDigit(str[i]))
|
|
11921
|
-
numBuffer.Append(str[i]);
|
|
11922
|
-
else
|
|
11923
|
-
break;
|
|
11924
|
-
}
|
|
11925
|
-
let theNumber = NNumber.Parse(numBuffer.ToString());
|
|
11926
|
-
if (theNumber < 1)
|
|
11927
|
-
return 1;
|
|
11928
|
-
if (type === PICInterface.PIC_MMM || type === PICInterface.PIC_MMD) {
|
|
11929
|
-
if (theNumber > 12)
|
|
11930
|
-
return 12;
|
|
11931
|
-
}
|
|
11932
|
-
else if (type === PICInterface.PIC_WWW || type === PICInterface.PIC_W || type === PICInterface.PIC_BB) {
|
|
11933
|
-
if (theNumber > 7)
|
|
11934
|
-
return 7;
|
|
11935
|
-
}
|
|
11936
|
-
return theNumber;
|
|
11937
|
-
}
|
|
11938
|
-
catch (ex_21A) {
|
|
11939
|
-
}
|
|
11940
|
-
let found = new Array(array.length);
|
|
11941
|
-
let from;
|
|
11942
|
-
let max = -1;
|
|
11943
|
-
for (let tmp = 1; tmp < array.length; tmp++) {
|
|
11944
|
-
found[tmp] = 0;
|
|
11945
|
-
from = 0;
|
|
11946
|
-
for (let i = 0; i < array[tmp].length && from < month_str.length && i < letters; i++, from++) {
|
|
11947
|
-
if (array[tmp].toLowerCase()[i] === month_str.toLowerCase()[from])
|
|
11948
|
-
found[tmp]++;
|
|
11949
|
-
else
|
|
11950
|
-
break;
|
|
11951
|
-
}
|
|
11952
|
-
if (from === letters || from === array[tmp].length) {
|
|
11953
|
-
max = tmp;
|
|
11954
|
-
break;
|
|
11955
|
-
}
|
|
11956
|
-
}
|
|
11957
|
-
if (max === -1)
|
|
11958
|
-
max = this.findMax(found);
|
|
11959
|
-
return max;
|
|
11960
|
-
}
|
|
11961
|
-
isNumberAllowedInDate() {
|
|
11962
|
-
for (let i = 0; i < this._picture.length; i++) {
|
|
11963
|
-
if (this.isDatePositionalNumericDirective(this._picture[i]))
|
|
11964
|
-
return true;
|
|
11965
|
-
}
|
|
11966
|
-
return false;
|
|
11967
|
-
}
|
|
11968
|
-
isAllNumbers0() {
|
|
11969
|
-
let currChr;
|
|
11970
|
-
for (let i = 0; i < this._newvalue.length; i++) {
|
|
11971
|
-
currChr = this._newvalue[i];
|
|
11972
|
-
if (UtilStrByteMode.isDigit(currChr) && currChr !== '0')
|
|
11973
|
-
return false;
|
|
11974
|
-
}
|
|
11975
|
-
return true;
|
|
11976
|
-
}
|
|
11977
|
-
checkCentury(yearIn) {
|
|
11978
|
-
let outVal;
|
|
11979
|
-
let start_century = this._environment.GetCentury(this._valDet.getControl().getForm().getTask().getCompIdx());
|
|
11980
|
-
let century = Math.floor(start_century / 100);
|
|
11981
|
-
let years = start_century % 100;
|
|
11982
|
-
if (yearIn >= years && yearIn !== 0)
|
|
11983
|
-
outVal = (century * 100 + yearIn);
|
|
11984
|
-
else
|
|
11985
|
-
outVal = ((++century) * 100 + yearIn);
|
|
11986
|
-
return new StringBuilder(outVal.toString());
|
|
11987
|
-
}
|
|
11988
|
-
isDateLegal4Range(ContinuousRange, DiscreteRange, currDate) {
|
|
11989
|
-
let pic = this._valDet.getPIC();
|
|
11990
|
-
let i;
|
|
11991
|
-
let downDate;
|
|
11992
|
-
let topDate;
|
|
11993
|
-
if (ContinuousRange != null) {
|
|
11994
|
-
for (i = 0; i < ContinuousRange.length - 1; i++) {
|
|
11995
|
-
downDate = DisplayConvertor.Instance.a_2_date_pic(ContinuousRange.get_Item(i), pic, pic.getMask(), this._valDet.getControl().getForm().getTask().getCompIdx());
|
|
11996
|
-
topDate = DisplayConvertor.Instance.a_2_date_pic(ContinuousRange.get_Item(++i), pic, pic.getMask(), this._valDet.getControl().getForm().getTask().getCompIdx());
|
|
11997
|
-
if (currDate >= downDate && currDate <= topDate)
|
|
11998
|
-
return true;
|
|
11999
|
-
}
|
|
12000
|
-
}
|
|
12001
|
-
if (DiscreteRange != null) {
|
|
12002
|
-
for (i = 0; i < DiscreteRange.length; i++) {
|
|
12003
|
-
if (currDate === DisplayConvertor.Instance.a_2_date_pic(DiscreteRange.get_Item(i), pic, pic.getMask(), this._valDet.getControl().getForm().getTask().getCompIdx()))
|
|
12004
|
-
return true;
|
|
12005
|
-
}
|
|
12006
|
-
}
|
|
12007
|
-
throw new WrongFormatException();
|
|
12008
|
-
}
|
|
12009
11574
|
fillDateByRange(ContinuousRange, DiscreteRange, buffer) {
|
|
12010
11575
|
let pic = this._valDet.getPIC();
|
|
12011
11576
|
let i;
|
|
@@ -12030,332 +11595,6 @@ class FieldValidator {
|
|
|
12030
11595
|
}
|
|
12031
11596
|
throw new WrongFormatException();
|
|
12032
11597
|
}
|
|
12033
|
-
checkDay(date, isDoy) {
|
|
12034
|
-
let day = this.getDateElement(date, DateElement.DAY);
|
|
12035
|
-
if (day < 29 && !isDoy)
|
|
12036
|
-
return new StringBuilder(date);
|
|
12037
|
-
let year = this.getDateElement(date, DateElement.YEAR);
|
|
12038
|
-
if (!isDoy) {
|
|
12039
|
-
if (year.toString().length < 3)
|
|
12040
|
-
year = NNumber.Parse(this.checkCentury(year).ToString());
|
|
12041
|
-
if (this._environment.GetDateMode(this._valDet.getControl().getForm().getTask().getCompIdx()) === 'B')
|
|
12042
|
-
year -= PICInterface.DATE_BUDDHIST_GAP;
|
|
12043
|
-
let month = this.getDateElement(date, DateElement.MONTH);
|
|
12044
|
-
let dayMax = this.getMaxDayInMonth(year, month);
|
|
12045
|
-
if (day > dayMax) {
|
|
12046
|
-
throw new WrongFormatException(MsgInterface.STR_ERR_DATE);
|
|
12047
|
-
}
|
|
12048
|
-
}
|
|
12049
|
-
else {
|
|
12050
|
-
let monthReal = this.getMonthByDay(year, day);
|
|
12051
|
-
if (monthReal < 1 || monthReal > 12)
|
|
12052
|
-
throw new WrongFormatException(MsgInterface.STR_ERR_DATE);
|
|
12053
|
-
}
|
|
12054
|
-
return new StringBuilder(date);
|
|
12055
|
-
}
|
|
12056
|
-
checkWeek(date) {
|
|
12057
|
-
let dow = this.getDateElement(date, DateElement.DOW);
|
|
12058
|
-
let breakParams = DisplayConvertor.Instance.getNewDateBreakParams();
|
|
12059
|
-
let dateMagic = DisplayConvertor.Instance.a_2_date(date, this._picture, this._valDet.getControl().getForm().getTask().getCompIdx());
|
|
12060
|
-
DisplayConvertor.Instance.date_break_datemode(breakParams, dateMagic, true, this._valDet.getControl().getForm().getTask().getCompIdx());
|
|
12061
|
-
let dowReal = breakParams.dow;
|
|
12062
|
-
if (dowReal !== dowReal)
|
|
12063
|
-
date = this.changeDow(date, dowReal);
|
|
12064
|
-
return new StringBuilder(date);
|
|
12065
|
-
}
|
|
12066
|
-
checkJpnEraYear(strDate) {
|
|
12067
|
-
let breakParams = DisplayConvertor.Instance.getNewDateBreakParams();
|
|
12068
|
-
let dateMagic = DisplayConvertor.Instance.a_2_date(strDate, this._picture, this._valDet.getControl().getForm().getTask().getCompIdx());
|
|
12069
|
-
DisplayConvertor.Instance.date_break_datemode(breakParams, dateMagic, true, this._valDet.getControl().getForm().getTask().getCompIdx());
|
|
12070
|
-
let intYearAD = breakParams.year;
|
|
12071
|
-
let intDoy = breakParams.doy;
|
|
12072
|
-
let strEraAlpha;
|
|
12073
|
-
let strEraKanji;
|
|
12074
|
-
strEraAlpha = UtilDateJpn.getInstance().date_jpn_yr_2_a(intYearAD, intDoy, false);
|
|
12075
|
-
strEraKanji = UtilDateJpn.getInstance().date_jpn_yr_2_a(intYearAD, intDoy, true);
|
|
12076
|
-
let strYearJpnEra = new StringBuilder();
|
|
12077
|
-
let num = UtilDateJpn.getInstance().date_jpn_year_ofs(intYearAD, intDoy);
|
|
12078
|
-
if (num <= 0) {
|
|
12079
|
-
throw new WrongFormatException(MsgInterface.STR_ERR_DATE);
|
|
12080
|
-
}
|
|
12081
|
-
if (num <= 9) {
|
|
12082
|
-
strYearJpnEra.Append("0");
|
|
12083
|
-
}
|
|
12084
|
-
strYearJpnEra.Append(num.toString());
|
|
12085
|
-
let intPicIdxOfs = 0;
|
|
12086
|
-
for (let intCnt = 0; intCnt + intPicIdxOfs < this._picture.length; intCnt++) {
|
|
12087
|
-
switch (this._picture.charCodeAt(intCnt + intPicIdxOfs)) {
|
|
12088
|
-
case (PICInterface.PIC_JY1):
|
|
12089
|
-
strDate = UtilStrByteMode.repC(strDate, strEraAlpha, intCnt + 1, 1);
|
|
12090
|
-
break;
|
|
12091
|
-
case (PICInterface.PIC_JY2):
|
|
12092
|
-
strDate = UtilStrByteMode.repC(strDate, strEraKanji, intCnt + 1, 1);
|
|
12093
|
-
intPicIdxOfs++;
|
|
12094
|
-
break;
|
|
12095
|
-
case (PICInterface.PIC_JY4):
|
|
12096
|
-
strDate = UtilStrByteMode.repC(strDate, strEraKanji, intCnt + 1, 2);
|
|
12097
|
-
intCnt++;
|
|
12098
|
-
intPicIdxOfs += 2;
|
|
12099
|
-
break;
|
|
12100
|
-
case (PICInterface.PIC_YJ):
|
|
12101
|
-
strDate = UtilStrByteMode.repC(strDate, strYearJpnEra.toString(), intCnt + 1, 2);
|
|
12102
|
-
intCnt++;
|
|
12103
|
-
break;
|
|
12104
|
-
default:
|
|
12105
|
-
if (intCnt < strDate.length) {
|
|
12106
|
-
if (UtilStrByteMode.isHalfWidth(strDate[intCnt]) === false && UtilStrByteMode.isHalfWidth(this._picture[intCnt + intPicIdxOfs]) === true)
|
|
12107
|
-
intPicIdxOfs++;
|
|
12108
|
-
}
|
|
12109
|
-
break;
|
|
12110
|
-
}
|
|
12111
|
-
}
|
|
12112
|
-
return new StringBuilder(strDate);
|
|
12113
|
-
}
|
|
12114
|
-
getMaxDayInMonth(year, month) {
|
|
12115
|
-
let array = [
|
|
12116
|
-
0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
|
|
12117
|
-
];
|
|
12118
|
-
let leapyear = year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
|
|
12119
|
-
if (leapyear && month === 2)
|
|
12120
|
-
return array[month] + 1;
|
|
12121
|
-
return array[month];
|
|
12122
|
-
}
|
|
12123
|
-
getMonthByDay(year, day) {
|
|
12124
|
-
let i;
|
|
12125
|
-
let LeapYear;
|
|
12126
|
-
LeapYear = (year % 4 === 0) && ((year % 100 !== 0) || (year % 400 === 0));
|
|
12127
|
-
for (i = 0; i < PICInterface.date_day_tab.length; i++) {
|
|
12128
|
-
if (!LeapYear) {
|
|
12129
|
-
if (PICInterface.date_day_tab[i] >= day)
|
|
12130
|
-
return i;
|
|
12131
|
-
}
|
|
12132
|
-
else {
|
|
12133
|
-
if (i < 3) {
|
|
12134
|
-
if (PICInterface.date_day_tab[i] >= day)
|
|
12135
|
-
return i;
|
|
12136
|
-
}
|
|
12137
|
-
else {
|
|
12138
|
-
if (PICInterface.date_day_tab[i] + 1 >= day)
|
|
12139
|
-
return i;
|
|
12140
|
-
}
|
|
12141
|
-
}
|
|
12142
|
-
}
|
|
12143
|
-
return i;
|
|
12144
|
-
}
|
|
12145
|
-
getDateElement(date, element) {
|
|
12146
|
-
let buffer = null;
|
|
12147
|
-
let letters = 0;
|
|
12148
|
-
let exitLoop = false;
|
|
12149
|
-
let picWeekType = PICInterface.PIC_WWW;
|
|
12150
|
-
let isJpnEraYear = false;
|
|
12151
|
-
let era_year = 0;
|
|
12152
|
-
let intPicIdxOfs = 0;
|
|
12153
|
-
let minLen = 0;
|
|
12154
|
-
if (UtilStrByteMode.isLocaleDefLangJPN())
|
|
12155
|
-
minLen = UtilStrByteMode.getMinLenPicture(date, this._picture);
|
|
12156
|
-
else
|
|
12157
|
-
minLen = Math.min(date.length, this._picture.length);
|
|
12158
|
-
for (let i = 0; i + intPicIdxOfs < minLen && !exitLoop; i++) {
|
|
12159
|
-
if (this.isDataPositionalDirective(this._picture[i + intPicIdxOfs])) {
|
|
12160
|
-
switch (this._picture.charCodeAt(i + intPicIdxOfs)) {
|
|
12161
|
-
case PICInterface.PIC_DD:
|
|
12162
|
-
if (element === DateElement.DAY) {
|
|
12163
|
-
buffer = date.substr(i, 2);
|
|
12164
|
-
exitLoop = true;
|
|
12165
|
-
break;
|
|
12166
|
-
}
|
|
12167
|
-
i++;
|
|
12168
|
-
break;
|
|
12169
|
-
case PICInterface.PIC_DDD:
|
|
12170
|
-
if (element === DateElement.DAY) {
|
|
12171
|
-
buffer = date.substr(i, 3);
|
|
12172
|
-
exitLoop = true;
|
|
12173
|
-
break;
|
|
12174
|
-
}
|
|
12175
|
-
i += 2;
|
|
12176
|
-
break;
|
|
12177
|
-
case PICInterface.PIC_DDDD:
|
|
12178
|
-
if (element === DateElement.DAY) {
|
|
12179
|
-
buffer = date.substr(i, 2);
|
|
12180
|
-
exitLoop = true;
|
|
12181
|
-
}
|
|
12182
|
-
i += 3;
|
|
12183
|
-
break;
|
|
12184
|
-
case PICInterface.PIC_MMD:
|
|
12185
|
-
if (element === DateElement.MONTH) {
|
|
12186
|
-
buffer = date.substr(i, 2);
|
|
12187
|
-
exitLoop = true;
|
|
12188
|
-
}
|
|
12189
|
-
i++;
|
|
12190
|
-
break;
|
|
12191
|
-
case PICInterface.PIC_MMM:
|
|
12192
|
-
letters = this.getSizeOfBlock(i + intPicIdxOfs, PICInterface.PIC_MMM);
|
|
12193
|
-
if (element === DateElement.MONTH) {
|
|
12194
|
-
buffer = date.substr(i, letters);
|
|
12195
|
-
exitLoop = true;
|
|
12196
|
-
break;
|
|
12197
|
-
}
|
|
12198
|
-
i += letters - 1;
|
|
12199
|
-
letters = 0;
|
|
12200
|
-
break;
|
|
12201
|
-
case PICInterface.PIC_YY:
|
|
12202
|
-
if (element === DateElement.YEAR) {
|
|
12203
|
-
buffer = date.substr(i, 2);
|
|
12204
|
-
exitLoop = true;
|
|
12205
|
-
}
|
|
12206
|
-
i++;
|
|
12207
|
-
break;
|
|
12208
|
-
case PICInterface.PIC_YYYY:
|
|
12209
|
-
if (element === DateElement.YEAR) {
|
|
12210
|
-
buffer = date.substr(i, 4);
|
|
12211
|
-
exitLoop = true;
|
|
12212
|
-
}
|
|
12213
|
-
i += 3;
|
|
12214
|
-
break;
|
|
12215
|
-
case PICInterface.PIC_W:
|
|
12216
|
-
if (element === DateElement.DOW) {
|
|
12217
|
-
buffer = date.substr(i, 1);
|
|
12218
|
-
exitLoop = true;
|
|
12219
|
-
}
|
|
12220
|
-
break;
|
|
12221
|
-
case PICInterface.PIC_WWW:
|
|
12222
|
-
letters = this.getSizeOfBlock(i + intPicIdxOfs, PICInterface.PIC_WWW);
|
|
12223
|
-
if (element === DateElement.DOW) {
|
|
12224
|
-
buffer = date.substr(i, letters);
|
|
12225
|
-
exitLoop = true;
|
|
12226
|
-
break;
|
|
12227
|
-
}
|
|
12228
|
-
i += letters - 1;
|
|
12229
|
-
letters = 0;
|
|
12230
|
-
break;
|
|
12231
|
-
case PICInterface.PIC_HYYYYY:
|
|
12232
|
-
case PICInterface.PIC_HL:
|
|
12233
|
-
case PICInterface.PIC_HDD:
|
|
12234
|
-
break;
|
|
12235
|
-
case PICInterface.PIC_BB:
|
|
12236
|
-
letters = this.getSizeOfBlock(i + intPicIdxOfs, PICInterface.PIC_BB);
|
|
12237
|
-
if (i + Math.floor(letters / 2) < date.length) {
|
|
12238
|
-
buffer = date.substr(i, Math.floor(letters / 2));
|
|
12239
|
-
intPicIdxOfs += letters - buffer.length;
|
|
12240
|
-
}
|
|
12241
|
-
if (element === DateElement.DOW) {
|
|
12242
|
-
exitLoop = true;
|
|
12243
|
-
picWeekType = PICInterface.PIC_BB;
|
|
12244
|
-
}
|
|
12245
|
-
else {
|
|
12246
|
-
buffer = null;
|
|
12247
|
-
}
|
|
12248
|
-
i += letters - 1;
|
|
12249
|
-
break;
|
|
12250
|
-
case PICInterface.PIC_JY1:
|
|
12251
|
-
isJpnEraYear = true;
|
|
12252
|
-
break;
|
|
12253
|
-
case PICInterface.PIC_JY2:
|
|
12254
|
-
isJpnEraYear = true;
|
|
12255
|
-
intPicIdxOfs++;
|
|
12256
|
-
break;
|
|
12257
|
-
case PICInterface.PIC_JY4:
|
|
12258
|
-
isJpnEraYear = true;
|
|
12259
|
-
intPicIdxOfs += 2;
|
|
12260
|
-
i++;
|
|
12261
|
-
break;
|
|
12262
|
-
case PICInterface.PIC_YJ:
|
|
12263
|
-
if (element === DateElement.YEAR) {
|
|
12264
|
-
buffer = date.substr(i, 2);
|
|
12265
|
-
exitLoop = true;
|
|
12266
|
-
}
|
|
12267
|
-
i++;
|
|
12268
|
-
break;
|
|
12269
|
-
}
|
|
12270
|
-
}
|
|
12271
|
-
}
|
|
12272
|
-
if (buffer == null) {
|
|
12273
|
-
if (element === DateElement.YEAR)
|
|
12274
|
-
return DateTime.Now.Year;
|
|
12275
|
-
else
|
|
12276
|
-
return 1;
|
|
12277
|
-
}
|
|
12278
|
-
buffer = buffer.trim();
|
|
12279
|
-
if (letters > 0) {
|
|
12280
|
-
if (element === DateElement.MONTH)
|
|
12281
|
-
letters = this.getMonthOrWeek(buffer.toString(), letters, PICInterface.PIC_MMM);
|
|
12282
|
-
else if (element === DateElement.DOW)
|
|
12283
|
-
letters = this.getMonthOrWeek(buffer.toString(), letters, picWeekType);
|
|
12284
|
-
}
|
|
12285
|
-
else {
|
|
12286
|
-
while (buffer.toString().startsWith("0") || buffer.toString().startsWith(" "))
|
|
12287
|
-
buffer = buffer.toString().substr(1);
|
|
12288
|
-
if (buffer.length === 0)
|
|
12289
|
-
letters = 0;
|
|
12290
|
-
else
|
|
12291
|
-
letters = NNumber.Parse(buffer.toString());
|
|
12292
|
-
}
|
|
12293
|
-
if (element === DateElement.YEAR && isJpnEraYear) {
|
|
12294
|
-
era_year = UtilDateJpn.getInstance().getStartYearOfEra(date, this._picture);
|
|
12295
|
-
if (era_year === 0)
|
|
12296
|
-
return 0;
|
|
12297
|
-
letters += era_year - 1;
|
|
12298
|
-
}
|
|
12299
|
-
return letters;
|
|
12300
|
-
}
|
|
12301
|
-
changeDow(date, dow) {
|
|
12302
|
-
let isDate = false;
|
|
12303
|
-
let letters;
|
|
12304
|
-
let startPart;
|
|
12305
|
-
let finishPart;
|
|
12306
|
-
let number1;
|
|
12307
|
-
number1 = "" + dow;
|
|
12308
|
-
let intPicIdxOfs = 0;
|
|
12309
|
-
for (let i = 0; i + intPicIdxOfs < this._picture.length && !isDate; i++) {
|
|
12310
|
-
if (this.isDataPositionalDirective(this._picture[i + intPicIdxOfs])) {
|
|
12311
|
-
switch (this._picture.charCodeAt(i + intPicIdxOfs)) {
|
|
12312
|
-
case PICInterface.PIC_W:
|
|
12313
|
-
startPart = date.substr(0, i);
|
|
12314
|
-
finishPart = date.substr(i + 1);
|
|
12315
|
-
date = startPart + number1 + finishPart;
|
|
12316
|
-
isDate = true;
|
|
12317
|
-
break;
|
|
12318
|
-
case PICInterface.PIC_WWW:
|
|
12319
|
-
letters = this.getSizeOfBlock(i + intPicIdxOfs, PICInterface.PIC_WWW);
|
|
12320
|
-
startPart = date.substr(0, i);
|
|
12321
|
-
finishPart = date.substr(i + letters);
|
|
12322
|
-
let dayStr = Events.GetMessageString(MsgInterface.DAYS_PTR);
|
|
12323
|
-
let dayNames = DateUtil.getLocalDays(dayStr);
|
|
12324
|
-
number1 = dayNames[dow];
|
|
12325
|
-
if (number1.length > letters)
|
|
12326
|
-
number1 = number1.substr(0, letters);
|
|
12327
|
-
else if (number1.length < letters)
|
|
12328
|
-
while (number1.length < letters)
|
|
12329
|
-
number1 = number1 + ' ';
|
|
12330
|
-
date = startPart + number1 + finishPart;
|
|
12331
|
-
isDate = true;
|
|
12332
|
-
break;
|
|
12333
|
-
case PICInterface.PIC_BB:
|
|
12334
|
-
letters = this.getSizeOfBlock(i + intPicIdxOfs, PICInterface.PIC_BB);
|
|
12335
|
-
startPart = date.substr(0, i);
|
|
12336
|
-
finishPart = date.substr(i + Math.floor(letters / 2));
|
|
12337
|
-
number1 = UtilDateJpn.getStrDow(dow);
|
|
12338
|
-
if (UtilStrByteMode.lenB(number1) > letters)
|
|
12339
|
-
number1 = UtilStrByteMode.leftB(number1, letters);
|
|
12340
|
-
else if (UtilStrByteMode.lenB(number1) < letters)
|
|
12341
|
-
while (UtilStrByteMode.lenB(number1) < letters)
|
|
12342
|
-
number1 = number1 + ' ';
|
|
12343
|
-
date = startPart + number1 + finishPart;
|
|
12344
|
-
isDate = true;
|
|
12345
|
-
break;
|
|
12346
|
-
default:
|
|
12347
|
-
if (UtilStrByteMode.isLocaleDefLangDBCS()) {
|
|
12348
|
-
if (i < date.length) {
|
|
12349
|
-
if (UtilStrByteMode.isHalfWidth(date[i]) === false && UtilStrByteMode.isHalfWidth(this._picture[i + intPicIdxOfs]) === true)
|
|
12350
|
-
intPicIdxOfs++;
|
|
12351
|
-
}
|
|
12352
|
-
}
|
|
12353
|
-
break;
|
|
12354
|
-
}
|
|
12355
|
-
}
|
|
12356
|
-
}
|
|
12357
|
-
return date;
|
|
12358
|
-
}
|
|
12359
11598
|
checkTimeField() {
|
|
12360
11599
|
let newTime = new Date(this._newvalue);
|
|
12361
11600
|
this.setValidationFailed(false);
|
|
@@ -12369,85 +11608,6 @@ class FieldValidator {
|
|
|
12369
11608
|
}
|
|
12370
11609
|
return newTime;
|
|
12371
11610
|
}
|
|
12372
|
-
add2Time(currValue, buffer, type) {
|
|
12373
|
-
let start = currValue;
|
|
12374
|
-
let i;
|
|
12375
|
-
let STR_00 = "00";
|
|
12376
|
-
let currAdd = new StringBuilder();
|
|
12377
|
-
while (start < this._newvalue.length && !UtilStrByteMode.isDigit(this._newvalue[start])) {
|
|
12378
|
-
start++;
|
|
12379
|
-
}
|
|
12380
|
-
if (start === this._newvalue.length) {
|
|
12381
|
-
buffer.Append(STR_00.toString());
|
|
12382
|
-
return currValue;
|
|
12383
|
-
}
|
|
12384
|
-
for (i = start; i < start + 2 && i < this._newvalue.length; i++) {
|
|
12385
|
-
if (UtilStrByteMode.isDigit(this._newvalue[i]))
|
|
12386
|
-
currAdd.Append(this._newvalue[i]);
|
|
12387
|
-
else {
|
|
12388
|
-
currAdd.Insert(0, '0');
|
|
12389
|
-
break;
|
|
12390
|
-
}
|
|
12391
|
-
}
|
|
12392
|
-
if (i === this._newvalue.length && i === start + 1)
|
|
12393
|
-
currAdd.Insert(0, '0');
|
|
12394
|
-
else if (i === this._newvalue.length && i === start)
|
|
12395
|
-
currAdd.Append(STR_00.toString());
|
|
12396
|
-
let add = NNumber.Parse(currAdd.ToString());
|
|
12397
|
-
if (add < 0 || (add > 59 && type === PICInterface.PIC_MMT) || (add > 59 && type === PICInterface.PIC_SS))
|
|
12398
|
-
throw new WrongFormatException(MsgInterface.STR_ERR_TIME);
|
|
12399
|
-
else if (type === PICInterface.PIC_HH) {
|
|
12400
|
-
let PM = this.getIsPM();
|
|
12401
|
-
let newStr = null;
|
|
12402
|
-
let dif;
|
|
12403
|
-
if ((add >= 12 || add === 0) && PM) {
|
|
12404
|
-
let addTmp = add % 24;
|
|
12405
|
-
this._isPm = (addTmp >= 12 && addTmp < 24);
|
|
12406
|
-
if (addTmp > 12)
|
|
12407
|
-
dif = addTmp - 12;
|
|
12408
|
-
else if (addTmp === 0)
|
|
12409
|
-
dif = 12;
|
|
12410
|
-
else
|
|
12411
|
-
dif = addTmp;
|
|
12412
|
-
newStr = ((dif > 9 ? "" : "0") + dif);
|
|
12413
|
-
}
|
|
12414
|
-
else if (add > 99 && !PM)
|
|
12415
|
-
newStr = "99";
|
|
12416
|
-
if (newStr != null) {
|
|
12417
|
-
currAdd.Remove(0, currAdd.Length);
|
|
12418
|
-
currAdd.Append(newStr.toString());
|
|
12419
|
-
}
|
|
12420
|
-
}
|
|
12421
|
-
buffer.Append(currAdd.ToString());
|
|
12422
|
-
return i;
|
|
12423
|
-
}
|
|
12424
|
-
addPM2Time(currValue, buffer) {
|
|
12425
|
-
let i;
|
|
12426
|
-
if ((i = this._newvalue.toUpperCase().indexOf("AM", currValue)) !== -1) {
|
|
12427
|
-
buffer.Append("am");
|
|
12428
|
-
return i + 2;
|
|
12429
|
-
}
|
|
12430
|
-
else {
|
|
12431
|
-
if ((i = this._newvalue.toUpperCase().indexOf("PM", currValue)) !== -1) {
|
|
12432
|
-
buffer.Append("pm");
|
|
12433
|
-
return i + 2;
|
|
12434
|
-
}
|
|
12435
|
-
else if (this._isPm) {
|
|
12436
|
-
buffer.Append("pm");
|
|
12437
|
-
return currValue;
|
|
12438
|
-
}
|
|
12439
|
-
else
|
|
12440
|
-
buffer.Append("am");
|
|
12441
|
-
}
|
|
12442
|
-
return currValue;
|
|
12443
|
-
}
|
|
12444
|
-
getIsPM() {
|
|
12445
|
-
for (let curr = 0; curr < this._picture.length; curr++) {
|
|
12446
|
-
if (this._picture.charCodeAt(curr) === PICInterface.PIC_PM)
|
|
12447
|
-
return true;
|
|
12448
|
-
}
|
|
12449
|
-
return false;
|
|
12450
|
-
}
|
|
12451
11611
|
fillTimeByRange(ContinuousRange, DiscreteRange, buffer) {
|
|
12452
11612
|
let pic = this._valDet.getPIC();
|
|
12453
11613
|
let currTime = DisplayConvertor.Instance.fromNativeTimeToMgTimeNumber(buffer);
|
|
@@ -12521,54 +11681,6 @@ class FieldValidator {
|
|
|
12521
11681
|
this._picture = this._picture.substr(0, pIC.getMaskSize());
|
|
12522
11682
|
}
|
|
12523
11683
|
}
|
|
12524
|
-
findMax(array) {
|
|
12525
|
-
let index = 0;
|
|
12526
|
-
let max = array[index];
|
|
12527
|
-
for (let i = 1; i < array.length; i++) {
|
|
12528
|
-
if (array[i] > max) {
|
|
12529
|
-
max = array[i];
|
|
12530
|
-
index = i;
|
|
12531
|
-
}
|
|
12532
|
-
}
|
|
12533
|
-
return index;
|
|
12534
|
-
}
|
|
12535
|
-
isDataPositionalDirective(toCheck) {
|
|
12536
|
-
let ascii = toCheck.charCodeAt(0);
|
|
12537
|
-
return (ascii === PICInterface.PIC_YY || ascii === PICInterface.PIC_YYYY || ascii === PICInterface.PIC_MMD || ascii === PICInterface.PIC_MMM
|
|
12538
|
-
|| ascii === PICInterface.PIC_DD || ascii === PICInterface.PIC_DDD || ascii === PICInterface.PIC_DDDD || ascii === PICInterface.PIC_W
|
|
12539
|
-
|| ascii === PICInterface.PIC_WWW || ascii === PICInterface.PIC_HYYYYY || ascii === PICInterface.PIC_HL || ascii === PICInterface.PIC_HDD || ascii === PICInterface.PIC_YJ
|
|
12540
|
-
|| ascii === PICInterface.PIC_JY1 || ascii === PICInterface.PIC_JY2 || ascii === PICInterface.PIC_JY4 || ascii === PICInterface.PIC_BB);
|
|
12541
|
-
}
|
|
12542
|
-
isDatePositionalNumericDirective(toCheck) {
|
|
12543
|
-
let ascii = toCheck.charCodeAt(0);
|
|
12544
|
-
return (ascii === PICInterface.PIC_YY || ascii === PICInterface.PIC_YYYY || ascii === PICInterface.PIC_MMD || ascii === PICInterface.PIC_DD
|
|
12545
|
-
|| ascii === PICInterface.PIC_DDD || ascii === PICInterface.PIC_DDDD || ascii === PICInterface.PIC_W || ascii === PICInterface.PIC_HYYYYY
|
|
12546
|
-
|| ascii === PICInterface.PIC_HL || ascii === PICInterface.PIC_HDD || ascii === PICInterface.PIC_YJ || ascii === PICInterface.PIC_JY1
|
|
12547
|
-
|| ascii === PICInterface.PIC_JY2 || ascii === PICInterface.PIC_JY4 || ascii === PICInterface.PIC_BB);
|
|
12548
|
-
}
|
|
12549
|
-
isNumericPositionalDirective(toCheck) {
|
|
12550
|
-
let ascii = toCheck.charCodeAt(0);
|
|
12551
|
-
return (ascii === PICInterface.PIC_N);
|
|
12552
|
-
}
|
|
12553
|
-
isLogicPositionalDirective(toCheck) {
|
|
12554
|
-
let ascii = toCheck.charCodeAt(0);
|
|
12555
|
-
return (ascii === PICInterface.PIC_X);
|
|
12556
|
-
}
|
|
12557
|
-
isTimePositionalDirective(toCheck) {
|
|
12558
|
-
let ascii = toCheck.charCodeAt(0);
|
|
12559
|
-
return (ascii === PICInterface.PIC_HH || ascii === PICInterface.PIC_MMT || ascii === PICInterface.PIC_SS || ascii === PICInterface.PIC_PM || ascii === PICInterface.PIC_MS);
|
|
12560
|
-
}
|
|
12561
|
-
indexOfPositionalNonDirective(str) {
|
|
12562
|
-
let tmp;
|
|
12563
|
-
for (let i = 0; i < str.length; i++) {
|
|
12564
|
-
tmp = str[i];
|
|
12565
|
-
if (DisplayConvertor.isAlphaPositionalDirective(tmp) || this.isDataPositionalDirective(tmp) || this.isNumericPositionalDirective(tmp)
|
|
12566
|
-
|| this.isLogicPositionalDirective(tmp) || this.isTimePositionalDirective(tmp))
|
|
12567
|
-
continue;
|
|
12568
|
-
return i;
|
|
12569
|
-
}
|
|
12570
|
-
return -1;
|
|
12571
|
-
}
|
|
12572
11684
|
setValidationFailed(val) {
|
|
12573
11685
|
if (this._valDet.ValidationFailed)
|
|
12574
11686
|
return;
|