@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
|
@@ -5864,26 +5864,6 @@ class HebrewDate {
|
|
|
5864
5864
|
}
|
|
5865
5865
|
return val;
|
|
5866
5866
|
}
|
|
5867
|
-
static isHebrewLetter(letter) {
|
|
5868
|
-
if (letter >= HebrewDate.ALEF && letter <= HebrewDate.TAV)
|
|
5869
|
-
return true;
|
|
5870
|
-
else
|
|
5871
|
-
return false;
|
|
5872
|
-
}
|
|
5873
|
-
static add2Date(newValue, currValue, letters, buffer) {
|
|
5874
|
-
let start = currValue;
|
|
5875
|
-
let i;
|
|
5876
|
-
let currAdd = new StringBuilder(newValue.length);
|
|
5877
|
-
while (start < newValue.length && !HebrewDate.isHebrewLetter(newValue.charAt(start)))
|
|
5878
|
-
start = start + 1;
|
|
5879
|
-
for (i = start; i < start + letters && i < newValue.length; i++) {
|
|
5880
|
-
if (HebrewDate.isHebrewLetter(newValue.charAt(i)) || newValue.charAt(i) === ' ' || newValue.charAt(i) === '"' || newValue.charAt(i) === '\'')
|
|
5881
|
-
buffer.Append(newValue.charAt(i));
|
|
5882
|
-
else
|
|
5883
|
-
break;
|
|
5884
|
-
}
|
|
5885
|
-
return i;
|
|
5886
|
-
}
|
|
5887
5867
|
static dateheb_2_d(year, month, day) {
|
|
5888
5868
|
if (day === 0 && month === 0 && year === 0)
|
|
5889
5869
|
return 0;
|
|
@@ -5917,8 +5897,6 @@ HebrewDate.NORM_YEARS_PER_CYCLE = 12;
|
|
|
5917
5897
|
HebrewDate.LEAP_YEARS_PER_CYCLE = 7;
|
|
5918
5898
|
HebrewDate.YEARS_PER_CYCLE = (HebrewDate.NORM_YEARS_PER_CYCLE + HebrewDate.LEAP_YEARS_PER_CYCLE);
|
|
5919
5899
|
HebrewDate.MONTHS_PER_CYCLE = (HebrewDate.NORM_YEARS_PER_CYCLE * HebrewDate.MONTHS_PER_NORM_YEAR + HebrewDate.LEAP_YEARS_PER_CYCLE * HebrewDate.MONTHS_PER_LEAP_YEAR);
|
|
5920
|
-
HebrewDate.PARTS_PER_NORM_YEAR = (HebrewDate.MONTHS_PER_NORM_YEAR * HebrewDate.PARTS_PER_MONTH);
|
|
5921
|
-
HebrewDate.DAYS_PER_NORM_YEAR = Math.floor(HebrewDate.PARTS_PER_NORM_YEAR / HebrewDate.PARTS_PER_DAY);
|
|
5922
5900
|
HebrewDate.PARTS_PER_LEAP_YEAR = (HebrewDate.MONTHS_PER_LEAP_YEAR * HebrewDate.PARTS_PER_MONTH);
|
|
5923
5901
|
HebrewDate.DAYS_PER_LEAP_YEAR = Math.floor(HebrewDate.PARTS_PER_LEAP_YEAR / HebrewDate.PARTS_PER_DAY);
|
|
5924
5902
|
HebrewDate.PARTS_PER_CYCLE = (HebrewDate.MONTHS_PER_CYCLE * HebrewDate.PARTS_PER_MONTH);
|
|
@@ -6696,8 +6674,6 @@ class DisplayConvertor {
|
|
|
6696
6674
|
return (ret);
|
|
6697
6675
|
}
|
|
6698
6676
|
fromMgTimeToNativeTime(dataStr, pic) {
|
|
6699
|
-
let mask = pic.getMask();
|
|
6700
|
-
let maskSize = pic.getMaskSize();
|
|
6701
6677
|
let time = new NUM_TYPE(dataStr).NUM_2_ULONG();
|
|
6702
6678
|
let breakParams = new TimeBreakParams();
|
|
6703
6679
|
DisplayConvertor.time_break(breakParams, time);
|
|
@@ -6816,22 +6792,6 @@ class DisplayConvertor {
|
|
|
6816
6792
|
breakParams.second = time - breakParams.minute * 60;
|
|
6817
6793
|
}
|
|
6818
6794
|
}
|
|
6819
|
-
fromLogical(dataStr, pic, rangeStr) {
|
|
6820
|
-
let Str = NString.ToCharArray(pic.getMask());
|
|
6821
|
-
if (pic.getMaskSize() > Str.length) {
|
|
6822
|
-
MemoryUtil.char_memset(Str, 0, '*', Str.length);
|
|
6823
|
-
return NString.FromChars(Str);
|
|
6824
|
-
}
|
|
6825
|
-
else {
|
|
6826
|
-
let array2 = new Array(50);
|
|
6827
|
-
for (let _ai = 0; _ai < array2.length; ++_ai)
|
|
6828
|
-
array2[_ai] = (0).toString();
|
|
6829
|
-
this.win_rng_bool_sub(array2, array2.length, dataStr.charAt(0) === '1', rangeStr);
|
|
6830
|
-
let len = pic.getMaskSize();
|
|
6831
|
-
let resStr = this.win_data_cpy(Str, len, array2, pic.isAttrAlpha());
|
|
6832
|
-
return resStr;
|
|
6833
|
-
}
|
|
6834
|
-
}
|
|
6835
6795
|
fromMgLogicalToNativeLogical(dataStr) {
|
|
6836
6796
|
let nativeVal;
|
|
6837
6797
|
nativeVal = (dataStr.charAt(0) === '1') ? true : false;
|
|
@@ -6842,70 +6802,12 @@ class DisplayConvertor {
|
|
|
6842
6802
|
mgVal = (dispVal === true) ? "1" : "0";
|
|
6843
6803
|
return mgVal;
|
|
6844
6804
|
}
|
|
6845
|
-
win_rng_bool_sub(Sub, SubSiz, BoolVal, rng) {
|
|
6846
|
-
let crk = new Array(PICInterface.DB_STR_MAX + 2);
|
|
6847
|
-
for (let _ai = 0; _ai < crk.length; ++_ai)
|
|
6848
|
-
crk[_ai] = (0).toString();
|
|
6849
|
-
let gap = new Array(PICInterface.DB_STR_MAX + 2);
|
|
6850
|
-
for (let _ai = 0; _ai < gap.length; ++_ai)
|
|
6851
|
-
gap[_ai] = (0).toString();
|
|
6852
|
-
let i = 0;
|
|
6853
|
-
rng = this.win_rng_bool(rng);
|
|
6854
|
-
this.win_rng_crk(crk, gap, rng);
|
|
6855
|
-
let s;
|
|
6856
|
-
if (BoolVal) {
|
|
6857
|
-
s = 0;
|
|
6858
|
-
}
|
|
6859
|
-
else {
|
|
6860
|
-
while (crk[i] > '\0') {
|
|
6861
|
-
i = i + 1;
|
|
6862
|
-
}
|
|
6863
|
-
s = i + 1;
|
|
6864
|
-
}
|
|
6865
|
-
let len = s;
|
|
6866
|
-
while (crk[len] > '\0') {
|
|
6867
|
-
len = len + 1;
|
|
6868
|
-
}
|
|
6869
|
-
len = len - s;
|
|
6870
|
-
MemoryUtil.char_memcpy(Sub, 0, crk, s, Math.min(len, SubSiz));
|
|
6871
|
-
if (len < SubSiz) {
|
|
6872
|
-
MemoryUtil.char_memset(Sub, len, ' ', SubSiz - len);
|
|
6873
|
-
}
|
|
6874
|
-
}
|
|
6875
6805
|
win_rng_bool(rng) {
|
|
6876
6806
|
if (rng === null || rng.length === 0) {
|
|
6877
6807
|
rng = "True, False";
|
|
6878
6808
|
}
|
|
6879
6809
|
return rng;
|
|
6880
6810
|
}
|
|
6881
|
-
win_rng_crk(crk, gap, range) {
|
|
6882
|
-
let rngLen = range.length;
|
|
6883
|
-
let rng = NString.ToCharArray(range);
|
|
6884
|
-
let crkPos = 0;
|
|
6885
|
-
let rngPos = 0;
|
|
6886
|
-
let gapPos = 0;
|
|
6887
|
-
while (rngPos < rngLen) {
|
|
6888
|
-
if (rng[rngPos] === ',' || rng[rngPos] === '-') {
|
|
6889
|
-
gap[gapPos++] = rng[rngPos++];
|
|
6890
|
-
crk[crkPos++] = '\0';
|
|
6891
|
-
if (rngPos < rngLen) {
|
|
6892
|
-
while (rng[rngPos] === ' ') {
|
|
6893
|
-
rngPos = rngPos + 1;
|
|
6894
|
-
}
|
|
6895
|
-
}
|
|
6896
|
-
}
|
|
6897
|
-
else {
|
|
6898
|
-
if (rng[rngPos] === '\\') {
|
|
6899
|
-
rngPos = rngPos + 1;
|
|
6900
|
-
}
|
|
6901
|
-
crk[crkPos] = rng[rngPos++];
|
|
6902
|
-
crkPos = crkPos + 1;
|
|
6903
|
-
}
|
|
6904
|
-
}
|
|
6905
|
-
gap[gapPos] = '\0';
|
|
6906
|
-
crk[crkPos++] = '\0';
|
|
6907
|
-
crk[crkPos] = '\0';
|
|
6908
|
-
}
|
|
6909
6811
|
toNum(dispValue, pic, compIdx) {
|
|
6910
6812
|
let mgNum = new NUM_TYPE(dispValue, pic, compIdx);
|
|
6911
6813
|
return mgNum.toXMLrecord();
|
|
@@ -11259,7 +11161,6 @@ class FieldValidator {
|
|
|
11259
11161
|
return this._newvalue;
|
|
11260
11162
|
}
|
|
11261
11163
|
isPossibleAlphaLetter(indexInput, indexPicture) {
|
|
11262
|
-
let result;
|
|
11263
11164
|
switch (this._picture.charCodeAt(indexPicture)) {
|
|
11264
11165
|
case PICInterface.PIC_X:
|
|
11265
11166
|
case PICInterface.PIC_J:
|
|
@@ -11290,34 +11191,6 @@ class FieldValidator {
|
|
|
11290
11191
|
return false;
|
|
11291
11192
|
}
|
|
11292
11193
|
}
|
|
11293
|
-
fillAllAlpha() {
|
|
11294
|
-
let stringBuilder = new StringBuilder(this._picture.length);
|
|
11295
|
-
stringBuilder.Append(this._newvalue);
|
|
11296
|
-
if (UtilStrByteMode.isLocaleDefLangDBCS() && this._valDet.getType() === StorageAttribute.ALPHA) {
|
|
11297
|
-
let intNewvalueLenB = UtilStrByteMode.lenB(this._newvalue);
|
|
11298
|
-
let strBuiedPicture = UtilStrByteMode.leftB(this._picture, intNewvalueLenB);
|
|
11299
|
-
for (let i = strBuiedPicture.length; i < this._picture.length; i = i + 1) {
|
|
11300
|
-
if (DisplayConvertor.isAlphaPositionalDirective(this._picture.charAt(i))) {
|
|
11301
|
-
stringBuilder.Append(' ');
|
|
11302
|
-
}
|
|
11303
|
-
else {
|
|
11304
|
-
stringBuilder.Append(this._picture.charAt(i));
|
|
11305
|
-
}
|
|
11306
|
-
}
|
|
11307
|
-
}
|
|
11308
|
-
else {
|
|
11309
|
-
for (let i = this._newvalue.length - 1; i < this._picture.length && i >= 0; i++) {
|
|
11310
|
-
if (DisplayConvertor.isAlphaPositionalDirective(this._picture.charAt(i))) {
|
|
11311
|
-
stringBuilder.Append(' ');
|
|
11312
|
-
}
|
|
11313
|
-
else {
|
|
11314
|
-
stringBuilder.Append(this._picture.charAt(i));
|
|
11315
|
-
}
|
|
11316
|
-
i = i + 1;
|
|
11317
|
-
}
|
|
11318
|
-
}
|
|
11319
|
-
return stringBuilder.ToString();
|
|
11320
|
-
}
|
|
11321
11194
|
fillAlphaByRange(ContinuousRangeValues, DiscreteRangeValues) {
|
|
11322
11195
|
let tmpBuffer = DisplayConvertor.Instance.fillAlphaByDiscreteRangeValues(DiscreteRangeValues, this._newvalue);
|
|
11323
11196
|
if (tmpBuffer !== null) {
|
|
@@ -11587,46 +11460,6 @@ class FieldValidator {
|
|
|
11587
11460
|
}
|
|
11588
11461
|
throw new WrongFormatException();
|
|
11589
11462
|
}
|
|
11590
|
-
getDoubleVal(val) {
|
|
11591
|
-
let dotFound = false;
|
|
11592
|
-
let minusFound = false;
|
|
11593
|
-
let digitFound = false;
|
|
11594
|
-
let endOfNum = false;
|
|
11595
|
-
let i = 0;
|
|
11596
|
-
for (i = 0; i < val.length && !endOfNum; i++) {
|
|
11597
|
-
let c = val[i];
|
|
11598
|
-
if (c >= '0' && c <= '9')
|
|
11599
|
-
digitFound = true;
|
|
11600
|
-
else {
|
|
11601
|
-
switch (c) {
|
|
11602
|
-
case '-':
|
|
11603
|
-
if (digitFound || dotFound || minusFound)
|
|
11604
|
-
endOfNum = true;
|
|
11605
|
-
minusFound = true;
|
|
11606
|
-
break;
|
|
11607
|
-
case '.':
|
|
11608
|
-
if (dotFound || minusFound && !digitFound)
|
|
11609
|
-
endOfNum = true;
|
|
11610
|
-
dotFound = true;
|
|
11611
|
-
break;
|
|
11612
|
-
case ' ':
|
|
11613
|
-
if (digitFound || dotFound || minusFound)
|
|
11614
|
-
endOfNum = true;
|
|
11615
|
-
break;
|
|
11616
|
-
default:
|
|
11617
|
-
endOfNum = true;
|
|
11618
|
-
break;
|
|
11619
|
-
}
|
|
11620
|
-
}
|
|
11621
|
-
}
|
|
11622
|
-
if (endOfNum) {
|
|
11623
|
-
i = i - 1;
|
|
11624
|
-
}
|
|
11625
|
-
if (i > 0) {
|
|
11626
|
-
return NNumber.Parse(val.substr(0, i));
|
|
11627
|
-
}
|
|
11628
|
-
return -Infinity;
|
|
11629
|
-
}
|
|
11630
11463
|
setNumericValueWithoutPicture(val) {
|
|
11631
11464
|
let checkedStr = new StringBuilder(val.length);
|
|
11632
11465
|
let isFirstDecimal = false;
|
|
@@ -11685,274 +11518,6 @@ class FieldValidator {
|
|
|
11685
11518
|
}
|
|
11686
11519
|
return newDate;
|
|
11687
11520
|
}
|
|
11688
|
-
add2Date(currValue, buffer, type) {
|
|
11689
|
-
let start = currValue;
|
|
11690
|
-
let currAdd = new StringBuilder(this._newvalue.length);
|
|
11691
|
-
let letters = 0;
|
|
11692
|
-
switch (type) {
|
|
11693
|
-
case PICInterface.PIC_DD:
|
|
11694
|
-
case PICInterface.PIC_DDDD:
|
|
11695
|
-
case PICInterface.PIC_MMD:
|
|
11696
|
-
case PICInterface.PIC_YY:
|
|
11697
|
-
letters = 2;
|
|
11698
|
-
break;
|
|
11699
|
-
case PICInterface.PIC_DDD:
|
|
11700
|
-
letters = 3;
|
|
11701
|
-
break;
|
|
11702
|
-
case PICInterface.PIC_YYYY:
|
|
11703
|
-
letters = 4;
|
|
11704
|
-
break;
|
|
11705
|
-
case PICInterface.PIC_W:
|
|
11706
|
-
letters = 1;
|
|
11707
|
-
break;
|
|
11708
|
-
case PICInterface.PIC_YJ:
|
|
11709
|
-
letters = 2;
|
|
11710
|
-
type = PICInterface.PIC_YY;
|
|
11711
|
-
break;
|
|
11712
|
-
}
|
|
11713
|
-
while (start < this._newvalue.length && !UtilStrByteMode.isDigit(this._newvalue.charAt(start)))
|
|
11714
|
-
start++;
|
|
11715
|
-
if (start === this._newvalue.length && (this._newvalue.length === 0 || this._newvalue === "0")) {
|
|
11716
|
-
for (let nul = 0; nul < letters; nul = nul + 1) {
|
|
11717
|
-
buffer.Append('0');
|
|
11718
|
-
}
|
|
11719
|
-
return currValue;
|
|
11720
|
-
}
|
|
11721
|
-
else if (start === this._newvalue.length) {
|
|
11722
|
-
this._newvalue = this._newvalue + "0";
|
|
11723
|
-
}
|
|
11724
|
-
let i;
|
|
11725
|
-
for (i = start; i < start + letters && i < this._newvalue.length; i++) {
|
|
11726
|
-
if (UtilStrByteMode.isDigit(this._newvalue.charAt(i)))
|
|
11727
|
-
currAdd.Append(this._newvalue.charAt(i));
|
|
11728
|
-
else
|
|
11729
|
-
break;
|
|
11730
|
-
}
|
|
11731
|
-
if (currAdd.Length === 0) {
|
|
11732
|
-
currAdd.Append('0');
|
|
11733
|
-
}
|
|
11734
|
-
let add = NNumber.Parse(currAdd.ToString());
|
|
11735
|
-
if ((add < 1 && type !== PICInterface.PIC_YYYY && type !== PICInterface.PIC_YY) ||
|
|
11736
|
-
(add > 31 && (type === PICInterface.PIC_DD || type === PICInterface.PIC_DDDD)) ||
|
|
11737
|
-
(add > 12 && type === PICInterface.PIC_MMD) || (add > 7 && type === PICInterface.PIC_W)) {
|
|
11738
|
-
throw new WrongFormatException(MsgInterface.STR_ERR_DATE);
|
|
11739
|
-
}
|
|
11740
|
-
if (type === PICInterface.PIC_YYYY && this._environment.GetCentury(this._valDet.getControl().getForm().getTask().getCompIdx()) > 999 && currAdd.Length < 3)
|
|
11741
|
-
currAdd = this.checkCentury(add);
|
|
11742
|
-
for (let j = 0; j < letters - currAdd.Length; j = j + 1) {
|
|
11743
|
-
buffer.Append('0');
|
|
11744
|
-
}
|
|
11745
|
-
buffer.Append(currAdd.ToString());
|
|
11746
|
-
return i;
|
|
11747
|
-
}
|
|
11748
|
-
addM2Date(currValue, letters, buffer, type) {
|
|
11749
|
-
let array;
|
|
11750
|
-
let result;
|
|
11751
|
-
if (type === PICInterface.PIC_MMM || type === PICInterface.PIC_MMD) {
|
|
11752
|
-
if (this.hebrew) {
|
|
11753
|
-
array = HebrewDate.GetLocalMonths();
|
|
11754
|
-
}
|
|
11755
|
-
else {
|
|
11756
|
-
let messageString = Events.GetMessageString(MsgInterface.MONTHS_PTR);
|
|
11757
|
-
array = DateUtil.getLocalMonths(messageString);
|
|
11758
|
-
}
|
|
11759
|
-
}
|
|
11760
|
-
else {
|
|
11761
|
-
if (type === PICInterface.PIC_WWW || type === PICInterface.PIC_W) {
|
|
11762
|
-
if (this.hebrew) {
|
|
11763
|
-
array = HebrewDate.GetLocalDows();
|
|
11764
|
-
}
|
|
11765
|
-
else {
|
|
11766
|
-
let dayStr = Events.GetMessageString(MsgInterface.DAYS_PTR);
|
|
11767
|
-
array = DateUtil.getLocalDays(dayStr);
|
|
11768
|
-
}
|
|
11769
|
-
}
|
|
11770
|
-
else {
|
|
11771
|
-
if (type === PICInterface.PIC_BB) {
|
|
11772
|
-
array = UtilDateJpn.getArrayDow();
|
|
11773
|
-
}
|
|
11774
|
-
else {
|
|
11775
|
-
if (type === PICInterface.PIC_JY1 || type === PICInterface.PIC_JY2 || type === PICInterface.PIC_JY4) {
|
|
11776
|
-
if (this._newvalue.length < currValue + letters) {
|
|
11777
|
-
throw new WrongFormatException(MsgInterface.STR_ERR_DATE);
|
|
11778
|
-
}
|
|
11779
|
-
let text = this._newvalue.substr(currValue, letters);
|
|
11780
|
-
buffer.Append(text);
|
|
11781
|
-
return currValue + text.length;
|
|
11782
|
-
}
|
|
11783
|
-
else {
|
|
11784
|
-
return currValue + letters;
|
|
11785
|
-
}
|
|
11786
|
-
}
|
|
11787
|
-
}
|
|
11788
|
-
}
|
|
11789
|
-
if (this._newvalue.length < currValue) {
|
|
11790
|
-
currValue = this._newvalue.length;
|
|
11791
|
-
}
|
|
11792
|
-
let max = this.getMonthOrWeek(this._newvalue.substr(currValue), letters, type);
|
|
11793
|
-
if (array[max].trim().length >= letters) {
|
|
11794
|
-
buffer.Append(array[max].trim().substr(0, letters));
|
|
11795
|
-
}
|
|
11796
|
-
else {
|
|
11797
|
-
buffer.Append(array[max].trim());
|
|
11798
|
-
for (let i = letters - array[max].trim().length; i > 0; i = i - 1) {
|
|
11799
|
-
buffer.Append(' ');
|
|
11800
|
-
}
|
|
11801
|
-
}
|
|
11802
|
-
return currValue + letters;
|
|
11803
|
-
}
|
|
11804
|
-
getEndOfNumericBlock(currValue) {
|
|
11805
|
-
while (currValue < this._newvalue.length && !UtilStrByteMode.isDigit(this._newvalue.charAt(currValue))) {
|
|
11806
|
-
currValue = currValue + 1;
|
|
11807
|
-
}
|
|
11808
|
-
return currValue;
|
|
11809
|
-
}
|
|
11810
|
-
addDateSuffix(last) {
|
|
11811
|
-
let thenumber = NNumber.Parse(last);
|
|
11812
|
-
if (thenumber === 1 || thenumber === 21 || thenumber === 31)
|
|
11813
|
-
return "st";
|
|
11814
|
-
else if (thenumber === 2 || thenumber === 22)
|
|
11815
|
-
return "nd";
|
|
11816
|
-
else if (thenumber === 3 || thenumber === 23)
|
|
11817
|
-
return "rd";
|
|
11818
|
-
return "th";
|
|
11819
|
-
}
|
|
11820
|
-
getSizeOfBlock(start, type) {
|
|
11821
|
-
let letters = start + 1;
|
|
11822
|
-
while (letters < this._picture.length && this._picture.charCodeAt(letters) === type)
|
|
11823
|
-
letters++;
|
|
11824
|
-
return letters - start;
|
|
11825
|
-
}
|
|
11826
|
-
getMonthOrWeek(month_str, letters, type) {
|
|
11827
|
-
let array;
|
|
11828
|
-
if (type === PICInterface.PIC_MMM || type === PICInterface.PIC_MMD) {
|
|
11829
|
-
if (this.hebrew)
|
|
11830
|
-
array = HebrewDate.GetLocalMonths();
|
|
11831
|
-
else {
|
|
11832
|
-
let monthStr = Events.GetMessageString(MsgInterface.MONTHS_PTR);
|
|
11833
|
-
array = DateUtil.getLocalMonths(monthStr.toString());
|
|
11834
|
-
}
|
|
11835
|
-
}
|
|
11836
|
-
else if (type === PICInterface.PIC_WWW || type === PICInterface.PIC_W) {
|
|
11837
|
-
if (this.hebrew)
|
|
11838
|
-
array = HebrewDate.GetLocalDows();
|
|
11839
|
-
else {
|
|
11840
|
-
let dayStr = Events.GetMessageString(MsgInterface.DAYS_PTR);
|
|
11841
|
-
array = DateUtil.getLocalDays(dayStr.toString());
|
|
11842
|
-
}
|
|
11843
|
-
}
|
|
11844
|
-
else if (type === PICInterface.PIC_BB) {
|
|
11845
|
-
array = UtilDateJpn.getArrayDow();
|
|
11846
|
-
}
|
|
11847
|
-
else {
|
|
11848
|
-
return 1;
|
|
11849
|
-
}
|
|
11850
|
-
if (letters > month_str.length)
|
|
11851
|
-
letters = month_str.length;
|
|
11852
|
-
if (this.hebrew) {
|
|
11853
|
-
let hstr = NString.TrimStart(month_str).substr(0, letters).trim();
|
|
11854
|
-
for (let i = 1; i < array.length; i++) {
|
|
11855
|
-
if (array[i].trim() === hstr) {
|
|
11856
|
-
if (i === 14)
|
|
11857
|
-
i = 6;
|
|
11858
|
-
return i;
|
|
11859
|
-
}
|
|
11860
|
-
}
|
|
11861
|
-
return 0;
|
|
11862
|
-
}
|
|
11863
|
-
try {
|
|
11864
|
-
let str = month_str.substr(0, letters).trim();
|
|
11865
|
-
let numBuffer = new StringBuilder(str.length);
|
|
11866
|
-
for (let i = 0; i < str.length; i++) {
|
|
11867
|
-
if (UtilStrByteMode.isDigit(str[i]))
|
|
11868
|
-
numBuffer.Append(str[i]);
|
|
11869
|
-
else
|
|
11870
|
-
break;
|
|
11871
|
-
}
|
|
11872
|
-
let theNumber = NNumber.Parse(numBuffer.ToString());
|
|
11873
|
-
if (theNumber < 1)
|
|
11874
|
-
return 1;
|
|
11875
|
-
if (type === PICInterface.PIC_MMM || type === PICInterface.PIC_MMD) {
|
|
11876
|
-
if (theNumber > 12)
|
|
11877
|
-
return 12;
|
|
11878
|
-
}
|
|
11879
|
-
else if (type === PICInterface.PIC_WWW || type === PICInterface.PIC_W || type === PICInterface.PIC_BB) {
|
|
11880
|
-
if (theNumber > 7)
|
|
11881
|
-
return 7;
|
|
11882
|
-
}
|
|
11883
|
-
return theNumber;
|
|
11884
|
-
}
|
|
11885
|
-
catch (ex_21A) {
|
|
11886
|
-
}
|
|
11887
|
-
let found = new Array(array.length);
|
|
11888
|
-
let from;
|
|
11889
|
-
let max = -1;
|
|
11890
|
-
for (let tmp = 1; tmp < array.length; tmp++) {
|
|
11891
|
-
found[tmp] = 0;
|
|
11892
|
-
from = 0;
|
|
11893
|
-
for (let i = 0; i < array[tmp].length && from < month_str.length && i < letters; i++, from++) {
|
|
11894
|
-
if (array[tmp].toLowerCase()[i] === month_str.toLowerCase()[from])
|
|
11895
|
-
found[tmp]++;
|
|
11896
|
-
else
|
|
11897
|
-
break;
|
|
11898
|
-
}
|
|
11899
|
-
if (from === letters || from === array[tmp].length) {
|
|
11900
|
-
max = tmp;
|
|
11901
|
-
break;
|
|
11902
|
-
}
|
|
11903
|
-
}
|
|
11904
|
-
if (max === -1)
|
|
11905
|
-
max = this.findMax(found);
|
|
11906
|
-
return max;
|
|
11907
|
-
}
|
|
11908
|
-
isNumberAllowedInDate() {
|
|
11909
|
-
for (let i = 0; i < this._picture.length; i++) {
|
|
11910
|
-
if (this.isDatePositionalNumericDirective(this._picture[i]))
|
|
11911
|
-
return true;
|
|
11912
|
-
}
|
|
11913
|
-
return false;
|
|
11914
|
-
}
|
|
11915
|
-
isAllNumbers0() {
|
|
11916
|
-
let currChr;
|
|
11917
|
-
for (let i = 0; i < this._newvalue.length; i++) {
|
|
11918
|
-
currChr = this._newvalue[i];
|
|
11919
|
-
if (UtilStrByteMode.isDigit(currChr) && currChr !== '0')
|
|
11920
|
-
return false;
|
|
11921
|
-
}
|
|
11922
|
-
return true;
|
|
11923
|
-
}
|
|
11924
|
-
checkCentury(yearIn) {
|
|
11925
|
-
let outVal;
|
|
11926
|
-
let start_century = this._environment.GetCentury(this._valDet.getControl().getForm().getTask().getCompIdx());
|
|
11927
|
-
let century = Math.floor(start_century / 100);
|
|
11928
|
-
let years = start_century % 100;
|
|
11929
|
-
if (yearIn >= years && yearIn !== 0)
|
|
11930
|
-
outVal = (century * 100 + yearIn);
|
|
11931
|
-
else
|
|
11932
|
-
outVal = ((++century) * 100 + yearIn);
|
|
11933
|
-
return new StringBuilder(outVal.toString());
|
|
11934
|
-
}
|
|
11935
|
-
isDateLegal4Range(ContinuousRange, DiscreteRange, currDate) {
|
|
11936
|
-
let pic = this._valDet.getPIC();
|
|
11937
|
-
let i;
|
|
11938
|
-
let downDate;
|
|
11939
|
-
let topDate;
|
|
11940
|
-
if (ContinuousRange != null) {
|
|
11941
|
-
for (i = 0; i < ContinuousRange.length - 1; i++) {
|
|
11942
|
-
downDate = DisplayConvertor.Instance.a_2_date_pic(ContinuousRange.get_Item(i), pic, pic.getMask(), this._valDet.getControl().getForm().getTask().getCompIdx());
|
|
11943
|
-
topDate = DisplayConvertor.Instance.a_2_date_pic(ContinuousRange.get_Item(++i), pic, pic.getMask(), this._valDet.getControl().getForm().getTask().getCompIdx());
|
|
11944
|
-
if (currDate >= downDate && currDate <= topDate)
|
|
11945
|
-
return true;
|
|
11946
|
-
}
|
|
11947
|
-
}
|
|
11948
|
-
if (DiscreteRange != null) {
|
|
11949
|
-
for (i = 0; i < DiscreteRange.length; i++) {
|
|
11950
|
-
if (currDate === DisplayConvertor.Instance.a_2_date_pic(DiscreteRange.get_Item(i), pic, pic.getMask(), this._valDet.getControl().getForm().getTask().getCompIdx()))
|
|
11951
|
-
return true;
|
|
11952
|
-
}
|
|
11953
|
-
}
|
|
11954
|
-
throw new WrongFormatException();
|
|
11955
|
-
}
|
|
11956
11521
|
fillDateByRange(ContinuousRange, DiscreteRange, buffer) {
|
|
11957
11522
|
let pic = this._valDet.getPIC();
|
|
11958
11523
|
let i;
|
|
@@ -11977,332 +11542,6 @@ class FieldValidator {
|
|
|
11977
11542
|
}
|
|
11978
11543
|
throw new WrongFormatException();
|
|
11979
11544
|
}
|
|
11980
|
-
checkDay(date, isDoy) {
|
|
11981
|
-
let day = this.getDateElement(date, DateElement.DAY);
|
|
11982
|
-
if (day < 29 && !isDoy)
|
|
11983
|
-
return new StringBuilder(date);
|
|
11984
|
-
let year = this.getDateElement(date, DateElement.YEAR);
|
|
11985
|
-
if (!isDoy) {
|
|
11986
|
-
if (year.toString().length < 3)
|
|
11987
|
-
year = NNumber.Parse(this.checkCentury(year).ToString());
|
|
11988
|
-
if (this._environment.GetDateMode(this._valDet.getControl().getForm().getTask().getCompIdx()) === 'B')
|
|
11989
|
-
year -= PICInterface.DATE_BUDDHIST_GAP;
|
|
11990
|
-
let month = this.getDateElement(date, DateElement.MONTH);
|
|
11991
|
-
let dayMax = this.getMaxDayInMonth(year, month);
|
|
11992
|
-
if (day > dayMax) {
|
|
11993
|
-
throw new WrongFormatException(MsgInterface.STR_ERR_DATE);
|
|
11994
|
-
}
|
|
11995
|
-
}
|
|
11996
|
-
else {
|
|
11997
|
-
let monthReal = this.getMonthByDay(year, day);
|
|
11998
|
-
if (monthReal < 1 || monthReal > 12)
|
|
11999
|
-
throw new WrongFormatException(MsgInterface.STR_ERR_DATE);
|
|
12000
|
-
}
|
|
12001
|
-
return new StringBuilder(date);
|
|
12002
|
-
}
|
|
12003
|
-
checkWeek(date) {
|
|
12004
|
-
let dow = this.getDateElement(date, DateElement.DOW);
|
|
12005
|
-
let breakParams = DisplayConvertor.Instance.getNewDateBreakParams();
|
|
12006
|
-
let dateMagic = DisplayConvertor.Instance.a_2_date(date, this._picture, this._valDet.getControl().getForm().getTask().getCompIdx());
|
|
12007
|
-
DisplayConvertor.Instance.date_break_datemode(breakParams, dateMagic, true, this._valDet.getControl().getForm().getTask().getCompIdx());
|
|
12008
|
-
let dowReal = breakParams.dow;
|
|
12009
|
-
if (dowReal !== dowReal)
|
|
12010
|
-
date = this.changeDow(date, dowReal);
|
|
12011
|
-
return new StringBuilder(date);
|
|
12012
|
-
}
|
|
12013
|
-
checkJpnEraYear(strDate) {
|
|
12014
|
-
let breakParams = DisplayConvertor.Instance.getNewDateBreakParams();
|
|
12015
|
-
let dateMagic = DisplayConvertor.Instance.a_2_date(strDate, this._picture, this._valDet.getControl().getForm().getTask().getCompIdx());
|
|
12016
|
-
DisplayConvertor.Instance.date_break_datemode(breakParams, dateMagic, true, this._valDet.getControl().getForm().getTask().getCompIdx());
|
|
12017
|
-
let intYearAD = breakParams.year;
|
|
12018
|
-
let intDoy = breakParams.doy;
|
|
12019
|
-
let strEraAlpha;
|
|
12020
|
-
let strEraKanji;
|
|
12021
|
-
strEraAlpha = UtilDateJpn.getInstance().date_jpn_yr_2_a(intYearAD, intDoy, false);
|
|
12022
|
-
strEraKanji = UtilDateJpn.getInstance().date_jpn_yr_2_a(intYearAD, intDoy, true);
|
|
12023
|
-
let strYearJpnEra = new StringBuilder();
|
|
12024
|
-
let num = UtilDateJpn.getInstance().date_jpn_year_ofs(intYearAD, intDoy);
|
|
12025
|
-
if (num <= 0) {
|
|
12026
|
-
throw new WrongFormatException(MsgInterface.STR_ERR_DATE);
|
|
12027
|
-
}
|
|
12028
|
-
if (num <= 9) {
|
|
12029
|
-
strYearJpnEra.Append("0");
|
|
12030
|
-
}
|
|
12031
|
-
strYearJpnEra.Append(num.toString());
|
|
12032
|
-
let intPicIdxOfs = 0;
|
|
12033
|
-
for (let intCnt = 0; intCnt + intPicIdxOfs < this._picture.length; intCnt++) {
|
|
12034
|
-
switch (this._picture.charCodeAt(intCnt + intPicIdxOfs)) {
|
|
12035
|
-
case (PICInterface.PIC_JY1):
|
|
12036
|
-
strDate = UtilStrByteMode.repC(strDate, strEraAlpha, intCnt + 1, 1);
|
|
12037
|
-
break;
|
|
12038
|
-
case (PICInterface.PIC_JY2):
|
|
12039
|
-
strDate = UtilStrByteMode.repC(strDate, strEraKanji, intCnt + 1, 1);
|
|
12040
|
-
intPicIdxOfs++;
|
|
12041
|
-
break;
|
|
12042
|
-
case (PICInterface.PIC_JY4):
|
|
12043
|
-
strDate = UtilStrByteMode.repC(strDate, strEraKanji, intCnt + 1, 2);
|
|
12044
|
-
intCnt++;
|
|
12045
|
-
intPicIdxOfs += 2;
|
|
12046
|
-
break;
|
|
12047
|
-
case (PICInterface.PIC_YJ):
|
|
12048
|
-
strDate = UtilStrByteMode.repC(strDate, strYearJpnEra.toString(), intCnt + 1, 2);
|
|
12049
|
-
intCnt++;
|
|
12050
|
-
break;
|
|
12051
|
-
default:
|
|
12052
|
-
if (intCnt < strDate.length) {
|
|
12053
|
-
if (UtilStrByteMode.isHalfWidth(strDate[intCnt]) === false && UtilStrByteMode.isHalfWidth(this._picture[intCnt + intPicIdxOfs]) === true)
|
|
12054
|
-
intPicIdxOfs++;
|
|
12055
|
-
}
|
|
12056
|
-
break;
|
|
12057
|
-
}
|
|
12058
|
-
}
|
|
12059
|
-
return new StringBuilder(strDate);
|
|
12060
|
-
}
|
|
12061
|
-
getMaxDayInMonth(year, month) {
|
|
12062
|
-
let array = [
|
|
12063
|
-
0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
|
|
12064
|
-
];
|
|
12065
|
-
let leapyear = year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
|
|
12066
|
-
if (leapyear && month === 2)
|
|
12067
|
-
return array[month] + 1;
|
|
12068
|
-
return array[month];
|
|
12069
|
-
}
|
|
12070
|
-
getMonthByDay(year, day) {
|
|
12071
|
-
let i;
|
|
12072
|
-
let LeapYear;
|
|
12073
|
-
LeapYear = (year % 4 === 0) && ((year % 100 !== 0) || (year % 400 === 0));
|
|
12074
|
-
for (i = 0; i < PICInterface.date_day_tab.length; i++) {
|
|
12075
|
-
if (!LeapYear) {
|
|
12076
|
-
if (PICInterface.date_day_tab[i] >= day)
|
|
12077
|
-
return i;
|
|
12078
|
-
}
|
|
12079
|
-
else {
|
|
12080
|
-
if (i < 3) {
|
|
12081
|
-
if (PICInterface.date_day_tab[i] >= day)
|
|
12082
|
-
return i;
|
|
12083
|
-
}
|
|
12084
|
-
else {
|
|
12085
|
-
if (PICInterface.date_day_tab[i] + 1 >= day)
|
|
12086
|
-
return i;
|
|
12087
|
-
}
|
|
12088
|
-
}
|
|
12089
|
-
}
|
|
12090
|
-
return i;
|
|
12091
|
-
}
|
|
12092
|
-
getDateElement(date, element) {
|
|
12093
|
-
let buffer = null;
|
|
12094
|
-
let letters = 0;
|
|
12095
|
-
let exitLoop = false;
|
|
12096
|
-
let picWeekType = PICInterface.PIC_WWW;
|
|
12097
|
-
let isJpnEraYear = false;
|
|
12098
|
-
let era_year = 0;
|
|
12099
|
-
let intPicIdxOfs = 0;
|
|
12100
|
-
let minLen = 0;
|
|
12101
|
-
if (UtilStrByteMode.isLocaleDefLangJPN())
|
|
12102
|
-
minLen = UtilStrByteMode.getMinLenPicture(date, this._picture);
|
|
12103
|
-
else
|
|
12104
|
-
minLen = Math.min(date.length, this._picture.length);
|
|
12105
|
-
for (let i = 0; i + intPicIdxOfs < minLen && !exitLoop; i++) {
|
|
12106
|
-
if (this.isDataPositionalDirective(this._picture[i + intPicIdxOfs])) {
|
|
12107
|
-
switch (this._picture.charCodeAt(i + intPicIdxOfs)) {
|
|
12108
|
-
case PICInterface.PIC_DD:
|
|
12109
|
-
if (element === DateElement.DAY) {
|
|
12110
|
-
buffer = date.substr(i, 2);
|
|
12111
|
-
exitLoop = true;
|
|
12112
|
-
break;
|
|
12113
|
-
}
|
|
12114
|
-
i++;
|
|
12115
|
-
break;
|
|
12116
|
-
case PICInterface.PIC_DDD:
|
|
12117
|
-
if (element === DateElement.DAY) {
|
|
12118
|
-
buffer = date.substr(i, 3);
|
|
12119
|
-
exitLoop = true;
|
|
12120
|
-
break;
|
|
12121
|
-
}
|
|
12122
|
-
i += 2;
|
|
12123
|
-
break;
|
|
12124
|
-
case PICInterface.PIC_DDDD:
|
|
12125
|
-
if (element === DateElement.DAY) {
|
|
12126
|
-
buffer = date.substr(i, 2);
|
|
12127
|
-
exitLoop = true;
|
|
12128
|
-
}
|
|
12129
|
-
i += 3;
|
|
12130
|
-
break;
|
|
12131
|
-
case PICInterface.PIC_MMD:
|
|
12132
|
-
if (element === DateElement.MONTH) {
|
|
12133
|
-
buffer = date.substr(i, 2);
|
|
12134
|
-
exitLoop = true;
|
|
12135
|
-
}
|
|
12136
|
-
i++;
|
|
12137
|
-
break;
|
|
12138
|
-
case PICInterface.PIC_MMM:
|
|
12139
|
-
letters = this.getSizeOfBlock(i + intPicIdxOfs, PICInterface.PIC_MMM);
|
|
12140
|
-
if (element === DateElement.MONTH) {
|
|
12141
|
-
buffer = date.substr(i, letters);
|
|
12142
|
-
exitLoop = true;
|
|
12143
|
-
break;
|
|
12144
|
-
}
|
|
12145
|
-
i += letters - 1;
|
|
12146
|
-
letters = 0;
|
|
12147
|
-
break;
|
|
12148
|
-
case PICInterface.PIC_YY:
|
|
12149
|
-
if (element === DateElement.YEAR) {
|
|
12150
|
-
buffer = date.substr(i, 2);
|
|
12151
|
-
exitLoop = true;
|
|
12152
|
-
}
|
|
12153
|
-
i++;
|
|
12154
|
-
break;
|
|
12155
|
-
case PICInterface.PIC_YYYY:
|
|
12156
|
-
if (element === DateElement.YEAR) {
|
|
12157
|
-
buffer = date.substr(i, 4);
|
|
12158
|
-
exitLoop = true;
|
|
12159
|
-
}
|
|
12160
|
-
i += 3;
|
|
12161
|
-
break;
|
|
12162
|
-
case PICInterface.PIC_W:
|
|
12163
|
-
if (element === DateElement.DOW) {
|
|
12164
|
-
buffer = date.substr(i, 1);
|
|
12165
|
-
exitLoop = true;
|
|
12166
|
-
}
|
|
12167
|
-
break;
|
|
12168
|
-
case PICInterface.PIC_WWW:
|
|
12169
|
-
letters = this.getSizeOfBlock(i + intPicIdxOfs, PICInterface.PIC_WWW);
|
|
12170
|
-
if (element === DateElement.DOW) {
|
|
12171
|
-
buffer = date.substr(i, letters);
|
|
12172
|
-
exitLoop = true;
|
|
12173
|
-
break;
|
|
12174
|
-
}
|
|
12175
|
-
i += letters - 1;
|
|
12176
|
-
letters = 0;
|
|
12177
|
-
break;
|
|
12178
|
-
case PICInterface.PIC_HYYYYY:
|
|
12179
|
-
case PICInterface.PIC_HL:
|
|
12180
|
-
case PICInterface.PIC_HDD:
|
|
12181
|
-
break;
|
|
12182
|
-
case PICInterface.PIC_BB:
|
|
12183
|
-
letters = this.getSizeOfBlock(i + intPicIdxOfs, PICInterface.PIC_BB);
|
|
12184
|
-
if (i + Math.floor(letters / 2) < date.length) {
|
|
12185
|
-
buffer = date.substr(i, Math.floor(letters / 2));
|
|
12186
|
-
intPicIdxOfs += letters - buffer.length;
|
|
12187
|
-
}
|
|
12188
|
-
if (element === DateElement.DOW) {
|
|
12189
|
-
exitLoop = true;
|
|
12190
|
-
picWeekType = PICInterface.PIC_BB;
|
|
12191
|
-
}
|
|
12192
|
-
else {
|
|
12193
|
-
buffer = null;
|
|
12194
|
-
}
|
|
12195
|
-
i += letters - 1;
|
|
12196
|
-
break;
|
|
12197
|
-
case PICInterface.PIC_JY1:
|
|
12198
|
-
isJpnEraYear = true;
|
|
12199
|
-
break;
|
|
12200
|
-
case PICInterface.PIC_JY2:
|
|
12201
|
-
isJpnEraYear = true;
|
|
12202
|
-
intPicIdxOfs++;
|
|
12203
|
-
break;
|
|
12204
|
-
case PICInterface.PIC_JY4:
|
|
12205
|
-
isJpnEraYear = true;
|
|
12206
|
-
intPicIdxOfs += 2;
|
|
12207
|
-
i++;
|
|
12208
|
-
break;
|
|
12209
|
-
case PICInterface.PIC_YJ:
|
|
12210
|
-
if (element === DateElement.YEAR) {
|
|
12211
|
-
buffer = date.substr(i, 2);
|
|
12212
|
-
exitLoop = true;
|
|
12213
|
-
}
|
|
12214
|
-
i++;
|
|
12215
|
-
break;
|
|
12216
|
-
}
|
|
12217
|
-
}
|
|
12218
|
-
}
|
|
12219
|
-
if (buffer == null) {
|
|
12220
|
-
if (element === DateElement.YEAR)
|
|
12221
|
-
return DateTime.Now.Year;
|
|
12222
|
-
else
|
|
12223
|
-
return 1;
|
|
12224
|
-
}
|
|
12225
|
-
buffer = buffer.trim();
|
|
12226
|
-
if (letters > 0) {
|
|
12227
|
-
if (element === DateElement.MONTH)
|
|
12228
|
-
letters = this.getMonthOrWeek(buffer.toString(), letters, PICInterface.PIC_MMM);
|
|
12229
|
-
else if (element === DateElement.DOW)
|
|
12230
|
-
letters = this.getMonthOrWeek(buffer.toString(), letters, picWeekType);
|
|
12231
|
-
}
|
|
12232
|
-
else {
|
|
12233
|
-
while (buffer.toString().startsWith("0") || buffer.toString().startsWith(" "))
|
|
12234
|
-
buffer = buffer.toString().substr(1);
|
|
12235
|
-
if (buffer.length === 0)
|
|
12236
|
-
letters = 0;
|
|
12237
|
-
else
|
|
12238
|
-
letters = NNumber.Parse(buffer.toString());
|
|
12239
|
-
}
|
|
12240
|
-
if (element === DateElement.YEAR && isJpnEraYear) {
|
|
12241
|
-
era_year = UtilDateJpn.getInstance().getStartYearOfEra(date, this._picture);
|
|
12242
|
-
if (era_year === 0)
|
|
12243
|
-
return 0;
|
|
12244
|
-
letters += era_year - 1;
|
|
12245
|
-
}
|
|
12246
|
-
return letters;
|
|
12247
|
-
}
|
|
12248
|
-
changeDow(date, dow) {
|
|
12249
|
-
let isDate = false;
|
|
12250
|
-
let letters;
|
|
12251
|
-
let startPart;
|
|
12252
|
-
let finishPart;
|
|
12253
|
-
let number1;
|
|
12254
|
-
number1 = "" + dow;
|
|
12255
|
-
let intPicIdxOfs = 0;
|
|
12256
|
-
for (let i = 0; i + intPicIdxOfs < this._picture.length && !isDate; i++) {
|
|
12257
|
-
if (this.isDataPositionalDirective(this._picture[i + intPicIdxOfs])) {
|
|
12258
|
-
switch (this._picture.charCodeAt(i + intPicIdxOfs)) {
|
|
12259
|
-
case PICInterface.PIC_W:
|
|
12260
|
-
startPart = date.substr(0, i);
|
|
12261
|
-
finishPart = date.substr(i + 1);
|
|
12262
|
-
date = startPart + number1 + finishPart;
|
|
12263
|
-
isDate = true;
|
|
12264
|
-
break;
|
|
12265
|
-
case PICInterface.PIC_WWW:
|
|
12266
|
-
letters = this.getSizeOfBlock(i + intPicIdxOfs, PICInterface.PIC_WWW);
|
|
12267
|
-
startPart = date.substr(0, i);
|
|
12268
|
-
finishPart = date.substr(i + letters);
|
|
12269
|
-
let dayStr = Events.GetMessageString(MsgInterface.DAYS_PTR);
|
|
12270
|
-
let dayNames = DateUtil.getLocalDays(dayStr);
|
|
12271
|
-
number1 = dayNames[dow];
|
|
12272
|
-
if (number1.length > letters)
|
|
12273
|
-
number1 = number1.substr(0, letters);
|
|
12274
|
-
else if (number1.length < letters)
|
|
12275
|
-
while (number1.length < letters)
|
|
12276
|
-
number1 = number1 + ' ';
|
|
12277
|
-
date = startPart + number1 + finishPart;
|
|
12278
|
-
isDate = true;
|
|
12279
|
-
break;
|
|
12280
|
-
case PICInterface.PIC_BB:
|
|
12281
|
-
letters = this.getSizeOfBlock(i + intPicIdxOfs, PICInterface.PIC_BB);
|
|
12282
|
-
startPart = date.substr(0, i);
|
|
12283
|
-
finishPart = date.substr(i + Math.floor(letters / 2));
|
|
12284
|
-
number1 = UtilDateJpn.getStrDow(dow);
|
|
12285
|
-
if (UtilStrByteMode.lenB(number1) > letters)
|
|
12286
|
-
number1 = UtilStrByteMode.leftB(number1, letters);
|
|
12287
|
-
else if (UtilStrByteMode.lenB(number1) < letters)
|
|
12288
|
-
while (UtilStrByteMode.lenB(number1) < letters)
|
|
12289
|
-
number1 = number1 + ' ';
|
|
12290
|
-
date = startPart + number1 + finishPart;
|
|
12291
|
-
isDate = true;
|
|
12292
|
-
break;
|
|
12293
|
-
default:
|
|
12294
|
-
if (UtilStrByteMode.isLocaleDefLangDBCS()) {
|
|
12295
|
-
if (i < date.length) {
|
|
12296
|
-
if (UtilStrByteMode.isHalfWidth(date[i]) === false && UtilStrByteMode.isHalfWidth(this._picture[i + intPicIdxOfs]) === true)
|
|
12297
|
-
intPicIdxOfs++;
|
|
12298
|
-
}
|
|
12299
|
-
}
|
|
12300
|
-
break;
|
|
12301
|
-
}
|
|
12302
|
-
}
|
|
12303
|
-
}
|
|
12304
|
-
return date;
|
|
12305
|
-
}
|
|
12306
11545
|
checkTimeField() {
|
|
12307
11546
|
let newTime = new Date(this._newvalue);
|
|
12308
11547
|
this.setValidationFailed(false);
|
|
@@ -12316,85 +11555,6 @@ class FieldValidator {
|
|
|
12316
11555
|
}
|
|
12317
11556
|
return newTime;
|
|
12318
11557
|
}
|
|
12319
|
-
add2Time(currValue, buffer, type) {
|
|
12320
|
-
let start = currValue;
|
|
12321
|
-
let i;
|
|
12322
|
-
let STR_00 = "00";
|
|
12323
|
-
let currAdd = new StringBuilder();
|
|
12324
|
-
while (start < this._newvalue.length && !UtilStrByteMode.isDigit(this._newvalue[start])) {
|
|
12325
|
-
start++;
|
|
12326
|
-
}
|
|
12327
|
-
if (start === this._newvalue.length) {
|
|
12328
|
-
buffer.Append(STR_00.toString());
|
|
12329
|
-
return currValue;
|
|
12330
|
-
}
|
|
12331
|
-
for (i = start; i < start + 2 && i < this._newvalue.length; i++) {
|
|
12332
|
-
if (UtilStrByteMode.isDigit(this._newvalue[i]))
|
|
12333
|
-
currAdd.Append(this._newvalue[i]);
|
|
12334
|
-
else {
|
|
12335
|
-
currAdd.Insert(0, '0');
|
|
12336
|
-
break;
|
|
12337
|
-
}
|
|
12338
|
-
}
|
|
12339
|
-
if (i === this._newvalue.length && i === start + 1)
|
|
12340
|
-
currAdd.Insert(0, '0');
|
|
12341
|
-
else if (i === this._newvalue.length && i === start)
|
|
12342
|
-
currAdd.Append(STR_00.toString());
|
|
12343
|
-
let add = NNumber.Parse(currAdd.ToString());
|
|
12344
|
-
if (add < 0 || (add > 59 && type === PICInterface.PIC_MMT) || (add > 59 && type === PICInterface.PIC_SS))
|
|
12345
|
-
throw new WrongFormatException(MsgInterface.STR_ERR_TIME);
|
|
12346
|
-
else if (type === PICInterface.PIC_HH) {
|
|
12347
|
-
let PM = this.getIsPM();
|
|
12348
|
-
let newStr = null;
|
|
12349
|
-
let dif;
|
|
12350
|
-
if ((add >= 12 || add === 0) && PM) {
|
|
12351
|
-
let addTmp = add % 24;
|
|
12352
|
-
this._isPm = (addTmp >= 12 && addTmp < 24);
|
|
12353
|
-
if (addTmp > 12)
|
|
12354
|
-
dif = addTmp - 12;
|
|
12355
|
-
else if (addTmp === 0)
|
|
12356
|
-
dif = 12;
|
|
12357
|
-
else
|
|
12358
|
-
dif = addTmp;
|
|
12359
|
-
newStr = ((dif > 9 ? "" : "0") + dif);
|
|
12360
|
-
}
|
|
12361
|
-
else if (add > 99 && !PM)
|
|
12362
|
-
newStr = "99";
|
|
12363
|
-
if (newStr != null) {
|
|
12364
|
-
currAdd.Remove(0, currAdd.Length);
|
|
12365
|
-
currAdd.Append(newStr.toString());
|
|
12366
|
-
}
|
|
12367
|
-
}
|
|
12368
|
-
buffer.Append(currAdd.ToString());
|
|
12369
|
-
return i;
|
|
12370
|
-
}
|
|
12371
|
-
addPM2Time(currValue, buffer) {
|
|
12372
|
-
let i;
|
|
12373
|
-
if ((i = this._newvalue.toUpperCase().indexOf("AM", currValue)) !== -1) {
|
|
12374
|
-
buffer.Append("am");
|
|
12375
|
-
return i + 2;
|
|
12376
|
-
}
|
|
12377
|
-
else {
|
|
12378
|
-
if ((i = this._newvalue.toUpperCase().indexOf("PM", currValue)) !== -1) {
|
|
12379
|
-
buffer.Append("pm");
|
|
12380
|
-
return i + 2;
|
|
12381
|
-
}
|
|
12382
|
-
else if (this._isPm) {
|
|
12383
|
-
buffer.Append("pm");
|
|
12384
|
-
return currValue;
|
|
12385
|
-
}
|
|
12386
|
-
else
|
|
12387
|
-
buffer.Append("am");
|
|
12388
|
-
}
|
|
12389
|
-
return currValue;
|
|
12390
|
-
}
|
|
12391
|
-
getIsPM() {
|
|
12392
|
-
for (let curr = 0; curr < this._picture.length; curr++) {
|
|
12393
|
-
if (this._picture.charCodeAt(curr) === PICInterface.PIC_PM)
|
|
12394
|
-
return true;
|
|
12395
|
-
}
|
|
12396
|
-
return false;
|
|
12397
|
-
}
|
|
12398
11558
|
fillTimeByRange(ContinuousRange, DiscreteRange, buffer) {
|
|
12399
11559
|
let pic = this._valDet.getPIC();
|
|
12400
11560
|
let currTime = DisplayConvertor.Instance.fromNativeTimeToMgTimeNumber(buffer);
|
|
@@ -12468,54 +11628,6 @@ class FieldValidator {
|
|
|
12468
11628
|
this._picture = this._picture.substr(0, pIC.getMaskSize());
|
|
12469
11629
|
}
|
|
12470
11630
|
}
|
|
12471
|
-
findMax(array) {
|
|
12472
|
-
let index = 0;
|
|
12473
|
-
let max = array[index];
|
|
12474
|
-
for (let i = 1; i < array.length; i++) {
|
|
12475
|
-
if (array[i] > max) {
|
|
12476
|
-
max = array[i];
|
|
12477
|
-
index = i;
|
|
12478
|
-
}
|
|
12479
|
-
}
|
|
12480
|
-
return index;
|
|
12481
|
-
}
|
|
12482
|
-
isDataPositionalDirective(toCheck) {
|
|
12483
|
-
let ascii = toCheck.charCodeAt(0);
|
|
12484
|
-
return (ascii === PICInterface.PIC_YY || ascii === PICInterface.PIC_YYYY || ascii === PICInterface.PIC_MMD || ascii === PICInterface.PIC_MMM
|
|
12485
|
-
|| ascii === PICInterface.PIC_DD || ascii === PICInterface.PIC_DDD || ascii === PICInterface.PIC_DDDD || ascii === PICInterface.PIC_W
|
|
12486
|
-
|| ascii === PICInterface.PIC_WWW || ascii === PICInterface.PIC_HYYYYY || ascii === PICInterface.PIC_HL || ascii === PICInterface.PIC_HDD || ascii === PICInterface.PIC_YJ
|
|
12487
|
-
|| ascii === PICInterface.PIC_JY1 || ascii === PICInterface.PIC_JY2 || ascii === PICInterface.PIC_JY4 || ascii === PICInterface.PIC_BB);
|
|
12488
|
-
}
|
|
12489
|
-
isDatePositionalNumericDirective(toCheck) {
|
|
12490
|
-
let ascii = toCheck.charCodeAt(0);
|
|
12491
|
-
return (ascii === PICInterface.PIC_YY || ascii === PICInterface.PIC_YYYY || ascii === PICInterface.PIC_MMD || ascii === PICInterface.PIC_DD
|
|
12492
|
-
|| ascii === PICInterface.PIC_DDD || ascii === PICInterface.PIC_DDDD || ascii === PICInterface.PIC_W || ascii === PICInterface.PIC_HYYYYY
|
|
12493
|
-
|| ascii === PICInterface.PIC_HL || ascii === PICInterface.PIC_HDD || ascii === PICInterface.PIC_YJ || ascii === PICInterface.PIC_JY1
|
|
12494
|
-
|| ascii === PICInterface.PIC_JY2 || ascii === PICInterface.PIC_JY4 || ascii === PICInterface.PIC_BB);
|
|
12495
|
-
}
|
|
12496
|
-
isNumericPositionalDirective(toCheck) {
|
|
12497
|
-
let ascii = toCheck.charCodeAt(0);
|
|
12498
|
-
return (ascii === PICInterface.PIC_N);
|
|
12499
|
-
}
|
|
12500
|
-
isLogicPositionalDirective(toCheck) {
|
|
12501
|
-
let ascii = toCheck.charCodeAt(0);
|
|
12502
|
-
return (ascii === PICInterface.PIC_X);
|
|
12503
|
-
}
|
|
12504
|
-
isTimePositionalDirective(toCheck) {
|
|
12505
|
-
let ascii = toCheck.charCodeAt(0);
|
|
12506
|
-
return (ascii === PICInterface.PIC_HH || ascii === PICInterface.PIC_MMT || ascii === PICInterface.PIC_SS || ascii === PICInterface.PIC_PM || ascii === PICInterface.PIC_MS);
|
|
12507
|
-
}
|
|
12508
|
-
indexOfPositionalNonDirective(str) {
|
|
12509
|
-
let tmp;
|
|
12510
|
-
for (let i = 0; i < str.length; i++) {
|
|
12511
|
-
tmp = str[i];
|
|
12512
|
-
if (DisplayConvertor.isAlphaPositionalDirective(tmp) || this.isDataPositionalDirective(tmp) || this.isNumericPositionalDirective(tmp)
|
|
12513
|
-
|| this.isLogicPositionalDirective(tmp) || this.isTimePositionalDirective(tmp))
|
|
12514
|
-
continue;
|
|
12515
|
-
return i;
|
|
12516
|
-
}
|
|
12517
|
-
return -1;
|
|
12518
|
-
}
|
|
12519
11631
|
setValidationFailed(val) {
|
|
12520
11632
|
if (this._valDet.ValidationFailed)
|
|
12521
11633
|
return;
|