@magic-xpa/gui 4.900.0-dev491.7 → 4.1000.0-dev000.0

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.
@@ -1595,7 +1595,7 @@ class Manager {
1595
1595
  return Commands.getValue(ctrl, ctrl.getDisplayLine(true));
1596
1596
  }
1597
1597
  static async SetReadOnlyControl(ctrl, isReadOnly) {
1598
- if (ctrl.isTextControl() || ctrl.IsRepeatable) {
1598
+ if (ctrl.isTextControl() || ctrl.IsRepeatable || ctrl.isComboBox() || ctrl.isListBox() || ctrl.isCheckBox() || ctrl.isRadio()) {
1599
1599
  if (UtilStrByteMode.isLocaleDefLangDBCS()) {
1600
1600
  if (await ctrl.getForm().getTask().checkProp(PropInterface.PROP_TYPE_ALLOW_LOCATE_IN_QUERY, false))
1601
1601
  return;
@@ -2023,6 +2023,7 @@ class PIC {
2023
2023
  this._maskChars = 0;
2024
2024
  this._maskSize = 0;
2025
2025
  this._mixed = false;
2026
+ this._formatExp = false;
2026
2027
  this._msk = null;
2027
2028
  this._needLength = false;
2028
2029
  this._negative = false;
@@ -2110,6 +2111,12 @@ class PIC {
2110
2111
  decInFirstPos() {
2111
2112
  return this._decPointIsFirst;
2112
2113
  }
2114
+ setFormatExp(val) {
2115
+ this._formatExp = val;
2116
+ }
2117
+ isFormatExp() {
2118
+ return this._formatExp;
2119
+ }
2113
2120
  getPosPref_() {
2114
2121
  return this._posPref.ToString();
2115
2122
  }
@@ -5638,25 +5645,16 @@ class DisplayConvertor {
5638
5645
  case PICInterface.PIC_YY:
5639
5646
  {
5640
5647
  this.int_2_a(outVal, outIdx, 2, breakParams.year, '0');
5641
- let yearStr = NString.FromChars(outVal);
5642
- year = +yearStr.substr(outIdx);
5643
- outIdx += 2;
5644
- len -= 2;
5645
- }
5646
- break;
5647
- case PICInterface.PIC_YY:
5648
- {
5649
- this.int_2_a(outVal, outIdx, 2, breakParams.year, '0');
5650
- let yearStr = NString.FromChars(outVal);
5651
- year = +yearStr.substr(outIdx);
5648
+ let yearStr = NString.FromChars(outVal, outIdx, 2);
5649
+ year = +yearStr;
5652
5650
  outIdx += 2;
5653
5651
  len -= 2;
5654
5652
  }
5655
5653
  break;
5656
5654
  case PICInterface.PIC_YYYY:
5657
- this.int_2_a(outVal, outIdx, 4, year, '0');
5658
- let yearStr = NString.FromChars(outVal);
5659
- year = +yearStr.substr(outIdx);
5655
+ this.int_2_a(outVal, outIdx, 4, breakParams.year, '0');
5656
+ let yearStr = NString.FromChars(outVal, outIdx, 4);
5657
+ year = +yearStr;
5660
5658
  outIdx += 4;
5661
5659
  len -= 4;
5662
5660
  break;
@@ -7083,7 +7081,7 @@ class RecordUtils {
7083
7081
  case StorageAttribute.TIME:
7084
7082
  itemVal = !toBase64
7085
7083
  ? itemVal.substr(0, significantNumSize)
7086
- : Base64.encode(this.byteStreamToString(itemVal.substr(0, significantNumSize)), GuiEnvironment.Environment.GetEncoding());
7084
+ : Base64.encode(this.byteStreamToString(itemVal.substr(0, significantNumSize)));
7087
7085
  break;
7088
7086
  case StorageAttribute.ALPHA:
7089
7087
  case StorageAttribute.UNICODE:
@@ -7166,7 +7164,7 @@ class RecordUtils {
7166
7164
  itemVal = itemVal.substr(pos, (fldValLen) - (pos));
7167
7165
  itemVal = !toBase64
7168
7166
  ? StrUtil.stringToHexaDump(itemVal, 4)
7169
- : Base64.encode(itemVal, GuiEnvironment.Environment.GetEncoding());
7167
+ : Base64.encode(itemVal);
7170
7168
  pos = fldValLen;
7171
7169
  }
7172
7170
  else {
@@ -7175,7 +7173,7 @@ class RecordUtils {
7175
7173
  if (!toBase64)
7176
7174
  tmpBuf.Append(StrUtil.stringToHexaDump(itemVal.substr(pos, 0x7FFF), 4));
7177
7175
  else
7178
- tmpBuf.Append(Base64.encode(itemVal.substr(pos, 0x7FFF), GuiEnvironment.Environment.GetEncoding()));
7176
+ tmpBuf.Append(Base64.encode(itemVal.substr(pos, 0x7FFF)));
7179
7177
  tmpBuf.Append("0000");
7180
7178
  pos += 0x7FFF;
7181
7179
  }
@@ -9810,7 +9808,7 @@ class Property {
9810
9808
  async onModifiable() {
9811
9809
  if (this._parentType === GuiConstants.PARENT_TYPE_CONTROL) {
9812
9810
  let ctrl = this._parentObj;
9813
- if (ctrl.isTextControl()) {
9811
+ if (ctrl.isTextControl() || ctrl.isChoiceControl() || ctrl.isCheckBox()) {
9814
9812
  let task = this.GetTaskByParentObject();
9815
9813
  let readOnlyValue = !this.GetComputedValueBoolean();
9816
9814
  if ((readOnlyValue || task.getMode() !== Constants.TASK_MODE_QUERY) && ctrl.GetCurrReadOnly() !== readOnlyValue) {
@@ -10386,7 +10384,7 @@ class FieldValidator {
10386
10384
  return valDet;
10387
10385
  }
10388
10386
  if (ctrl.DataType !== StorageAttribute.ALPHA && ctrl.DataType !== StorageAttribute.UNICODE && ctrl.DataType !== StorageAttribute.BLOB) {
10389
- if ((typeof this._newvalue === 'string' && this._newvalue.trim().length === 0) || (ctrl.DataType === StorageAttribute.DATE && (ctrl.isDateZero(this._newvalue) || this.isNullDisplayVal()))) {
10387
+ if ((typeof this._newvalue === 'string' && this._newvalue.trim().length === 0) || (ctrl.DataType == StorageAttribute.NUMERIC && this._newvalue == null) || (ctrl.DataType === StorageAttribute.DATE && (ctrl.isDateZero(this._newvalue) || this.isNullDisplayVal()))) {
10390
10388
  let field = ctrl.getField();
10391
10389
  let defaultValue = field.getDefaultValue();
10392
10390
  let text = null;
@@ -11576,7 +11574,6 @@ class MgControlBase extends GuiControlPropertyAdapter {
11576
11574
  this._firstRefreshProperties = true;
11577
11575
  this._form = null;
11578
11576
  this._hasValidItmAndDispVal = false;
11579
- this._id = -1;
11580
11577
  this._controlIsn = -1;
11581
11578
  this._linkedParentDitIdx = -1;
11582
11579
  this._orgChoiceDisps = null;
@@ -11619,9 +11616,6 @@ class MgControlBase extends GuiControlPropertyAdapter {
11619
11616
  get Form() {
11620
11617
  return this._form;
11621
11618
  }
11622
- get Id() {
11623
- return this._id;
11624
- }
11625
11619
  get ControlIsn() {
11626
11620
  return this._controlIsn;
11627
11621
  }
@@ -11843,9 +11837,6 @@ class MgControlBase extends GuiControlPropertyAdapter {
11843
11837
  case XMLConstants.MG_ATTR_CONTAINER:
11844
11838
  this.setContainer(XmlParser.getInt(valueStr));
11845
11839
  break;
11846
- case XMLConstants.MG_ATTR_ID:
11847
- this._id = XmlParser.getInt(valueStr);
11848
- break;
11849
11840
  case XMLConstants.MG_ATTR_CONTROL_ISN:
11850
11841
  this._controlIsn = XmlParser.getInt(valueStr);
11851
11842
  break;
@@ -11980,6 +11971,8 @@ class MgControlBase extends GuiControlPropertyAdapter {
11980
11971
  }
11981
11972
  }
11982
11973
  getPIC() {
11974
+ if (this._picExpExists)
11975
+ this._pic.setFormatExp(this._picExpExists);
11983
11976
  return this._pic;
11984
11977
  }
11985
11978
  getParent() {
@@ -12058,7 +12051,7 @@ class MgControlBase extends GuiControlPropertyAdapter {
12058
12051
  }
12059
12052
  getRangedValue(newVal) {
12060
12053
  let vd;
12061
- vd = this.buildCopyPicture(this.Value, newVal);
12054
+ vd = this.buildPicture(this.Value, newVal);
12062
12055
  vd.evaluate();
12063
12056
  this.ModifiedByUser = true;
12064
12057
  let val = vd.getDispValue();
@@ -12068,7 +12061,7 @@ class MgControlBase extends GuiControlPropertyAdapter {
12068
12061
  let vd;
12069
12062
  let modified = this.ModifiedByUser;
12070
12063
  this.ModifiedByUser = true;
12071
- vd = this.buildCopyPicture(this.Value, newVal);
12064
+ vd = this.buildPicture(this.Value, newVal);
12072
12065
  vd.evaluate();
12073
12066
  this.ModifiedByUser = modified;
12074
12067
  if (vd.ValidationFailed)
@@ -13076,6 +13069,11 @@ class MgControlBase extends GuiControlPropertyAdapter {
13076
13069
  if (prevMustInput !== await this.checkProp(PropInterface.PROP_TYPE_MUST_INPUT, false))
13077
13070
  Commands.addOperationWithLine(CommandType.SET_PROPERTY, this, this.getDisplayLine(false), HtmlProperties.MustInput, !prevMustInput);
13078
13071
  }
13072
+ else if (mustInputProperty != null) {
13073
+ let mustInputVal = this.GetComputedBooleanProperty(PropInterface.PROP_TYPE_MUST_INPUT, false);
13074
+ if (mustInputVal)
13075
+ Commands.addOperationWithLine(CommandType.SET_PROPERTY, this, this.getDisplayLine(false), HtmlProperties.MustInput, mustInputVal);
13076
+ }
13079
13077
  if (!this.GetComputedBooleanProperty(PropInterface.PROP_TYPE_TAB_IN, true))
13080
13078
  Commands.addOperationWithLine(CommandType.SET_PROPERTY, this, this.getDisplayLine(false), HtmlProperties.TabIndex, -1);
13081
13079
  }
@@ -13392,15 +13390,17 @@ class MgControlBase extends GuiControlPropertyAdapter {
13392
13390
  async ZoomButtonInitialization() {
13393
13391
  if (this.isTextControl() && this.checkIfExistProp(PropInterface.PROP_TYPE_CONNECTED_ZOOM_CONTROL)) {
13394
13392
  let connectedButton = this.Form.CtrlTab.GetControlByIsn((await (await this.getProp(PropInterface.PROP_TYPE_CONNECTED_ZOOM_CONTROL)).getValueInt()));
13395
- let imageFileName = null;
13396
- if (connectedButton.IsImageButton() && connectedButton.PropertyExists(PropInterface.PROP_TYPE_IMAGE_FILENAME)) {
13397
- imageFileName = await (await connectedButton.getProp(PropInterface.PROP_TYPE_IMAGE_FILENAME)).getValue();
13398
- if (!Misc.IsWebUrl(imageFileName))
13399
- imageFileName = "./assets/images/" + imageFileName;
13400
- Commands.addOperationWithLine(CommandType.SET_STYLE, this, 0, MagicProperties.ImageFile, imageFileName);
13393
+ if (connectedButton) {
13394
+ let imageFileName = null;
13395
+ if (connectedButton.IsImageButton() && connectedButton.PropertyExists(PropInterface.PROP_TYPE_IMAGE_FILENAME)) {
13396
+ imageFileName = await (await connectedButton.getProp(PropInterface.PROP_TYPE_IMAGE_FILENAME)).getValue();
13397
+ if (!Misc.IsWebUrl(imageFileName))
13398
+ imageFileName = "./assets/images/" + imageFileName;
13399
+ Commands.addOperationWithLine(CommandType.SET_STYLE, this, 0, MagicProperties.ImageFile, imageFileName);
13400
+ }
13401
+ this.ConnectedControl = connectedButton;
13402
+ connectedButton.ConnectedControl = this;
13401
13403
  }
13402
- this.ConnectedControl = connectedButton;
13403
- connectedButton.ConnectedControl = this;
13404
13404
  }
13405
13405
  }
13406
13406
  }
@@ -13949,13 +13949,8 @@ class MgFormBase extends GuiFormPropertyAdapter {
13949
13949
  if (idx >= 0 && idx < this.Rows.length)
13950
13950
  this.Rows.set_Item(idx, new Row(false, false));
13951
13951
  }
13952
- SelectRow(sendAlwaysOrRowIdx, sendAlways) {
13953
- if (arguments.length === 0)
13954
- this.SelectRow_0();
13955
- else if (arguments.length === 1)
13956
- this.SelectRow_1(sendAlwaysOrRowIdx);
13957
- else
13958
- this.SelectRow_2(sendAlwaysOrRowIdx, sendAlways);
13952
+ SelectRow() {
13953
+ this.SelectRowByIdx(this.DisplayLine);
13959
13954
  }
13960
13955
  getRowsInPage() {
13961
13956
  return this._rowsInPage;
@@ -14193,19 +14188,13 @@ class MgFormBase extends GuiFormPropertyAdapter {
14193
14188
  this.Rows.SetSize(idx + 1);
14194
14189
  this.Rows.set_Item(idx, new Row(true, true));
14195
14190
  }
14196
- SelectRow_0() {
14197
- this.SelectRow(false);
14198
- }
14199
- SelectRow_1(sendAlways) {
14200
- this.SelectRow(this.DisplayLine, sendAlways);
14201
- }
14202
- SelectRow_2(rowIdx, sendAlways) {
14191
+ SelectRowByIdx(rowIdx) {
14203
14192
  let mainControl = this.getMainControl();
14204
14193
  if (mainControl !== null && this.RefreshRepeatableAllowed) {
14205
14194
  let index = rowIdx;
14206
14195
  if (this._task.DataView.isEmptyDataview())
14207
14196
  index = GuiConstants.NO_ROW_SELECTED;
14208
- if (sendAlways || index !== this._prevSelIndex) {
14197
+ if (index !== this._prevSelIndex) {
14209
14198
  this._prevSelIndex = index;
14210
14199
  Commands.addOperationWithLine(CommandType.SET_PROPERTY, mainControl, 0, HtmlProperties.SelectedRow, index);
14211
14200
  }
@@ -15052,6 +15041,7 @@ ExpressionInterface.EXP_OP_CLIENT_DB_DISCONNECT = 636;
15052
15041
  ExpressionInterface.EXP_OP_DATAVIEW_TO_DATASOURCE = 637;
15053
15042
  ExpressionInterface.EXP_OP_CLIENT_DB_DEL = 638;
15054
15043
  ExpressionInterface.EXP_OP_VARDISPLAYNAME = 647;
15044
+ ExpressionInterface.EXP_OP_CONTROL_ITEMS_REFRESH = 649;
15055
15045
  ExpressionInterface.EXP_OP_VARCONTROLID = 650;
15056
15046
  ExpressionInterface.EXP_OP_CONTROLITEMSLIST = 651;
15057
15047
  ExpressionInterface.EXP_OP_CONTROLDISPLAYLIST = 652;
@@ -15439,9 +15429,16 @@ class Helps {
15439
15429
  initInnerObjects(foundTagName, parser) {
15440
15430
  if (foundTagName === null)
15441
15431
  return false;
15442
- if (foundTagName === XMLConstants.MG_TAG_HELPTABLE)
15432
+ if (foundTagName === XMLConstants.MG_TAG_HELPTABLE) {
15433
+ let currrentIndex = parser.getCurrIndex();
15434
+ let encoded = parser.ReadContentOfCurrentElement().trim();
15435
+ let decoded = Base64.decode(encoded.substr(0, encoded.length).trim());
15436
+ let newXmlData = parser.getXMLdata().replace(encoded.trim(), decoded);
15437
+ parser.setXMLdata(newXmlData);
15438
+ parser.setCurrIndex(currrentIndex);
15443
15439
  parser.setCurrIndex(parser.getXMLdata().indexOf(XMLConstants.TAG_CLOSE, parser.getCurrIndex()) +
15444
15440
  1);
15441
+ }
15445
15442
  else if (foundTagName === XMLConstants.MG_TAG_HELPITEM) {
15446
15443
  let endContext = parser.getXMLdata().indexOf(XMLConstants.TAG_TERM, parser.getCurrIndex());
15447
15444
  if (endContext !== -1 && endContext < parser.getXMLdata().length) {
@@ -15601,16 +15598,17 @@ class GuiTaskBase {
15601
15598
  constructor() {
15602
15599
  this._flowMonitor = null;
15603
15600
  this._keyboardMappingState = 0xFFFF0000;
15604
- this._refreshType = 'T';
15601
+ this._refreshType = "T";
15605
15602
  this._lastParkedCtrl = null;
15606
15603
  this._brkLevel = null;
15607
15604
  this._brkLevelIndex = -1;
15608
15605
  this._mainLevel = null;
15609
- this._level = '\0';
15606
+ this._level = "\0";
15610
15607
  this._enteredRecLevel = false;
15611
15608
  this._currParkedFld = null;
15612
15609
  this.isInRecompute = false;
15613
15610
  this.CurrentEditingControl = null;
15611
+ this.shouldResumeSubformLayout = true;
15614
15612
  this.ApplicationGuid = null;
15615
15613
  this.ProgramIsn = 0;
15616
15614
  this.TaskIsn = 0;
@@ -15758,7 +15756,7 @@ class GuiTaskBase {
15758
15756
  return this._helpTab.getHelp(idx);
15759
15757
  }
15760
15758
  setProp(propId, val) {
15761
- this._propTab.setProp(propId, val, this, 'T');
15759
+ this._propTab.setProp(propId, val, this, "T");
15762
15760
  }
15763
15761
  setBrkLevel(cBrkLevel, NewBrkLevelIndex) {
15764
15762
  this._brkLevel = cBrkLevel;
@@ -15864,6 +15862,15 @@ class GuiTaskBase {
15864
15862
  this.Form.InInitForm = false;
15865
15863
  }
15866
15864
  }
15865
+ ResumeSubformLayout() {
15866
+ if (this.Form !== null) {
15867
+ let subFormCtrl = this.Form.getSubFormCtrl();
15868
+ if (subFormCtrl !== null && this.shouldResumeSubformLayout) {
15869
+ Commands.addOperationWithLine(CommandType.SET_PROPERTY, subFormCtrl, 0, HtmlProperties.Visible, subFormCtrl.isVisible());
15870
+ this.shouldResumeSubformLayout = false;
15871
+ }
15872
+ }
15873
+ }
15867
15874
  GetLastParkedCtrlName(depth) {
15868
15875
  let ancestor = this.GetTaskAncestor(depth);
15869
15876
  if (ancestor === null || ancestor._lastParkedCtrl === null)
@@ -15924,7 +15931,7 @@ class GuiTaskBase {
15924
15931
  return this.GetExpressionStorage(expId);
15925
15932
  }
15926
15933
  async CalculateExpression(expId, resType, length) {
15927
- return Promise.resolve('');
15934
+ return Promise.resolve("");
15928
15935
  }
15929
15936
  isStarted() {
15930
15937
  return true;
@@ -16011,7 +16018,8 @@ class GuiTaskBase {
16011
16018
  this.IsParallel = XmlParser.getBoolean(valueStr);
16012
16019
  break;
16013
16020
  case XMLConstants.MG_ATTR_ROUTER_PATH:
16014
- this.routerPath = valueStr;
16021
+ if (valueStr.trim() != "")
16022
+ this.routerPath = valueStr;
16015
16023
  break;
16016
16024
  case XMLConstants.MG_ATTR_IN_DEFAULT_ROUTER_OUTLET:
16017
16025
  this.inDefaultRouterOutlet = XmlParser.getBoolean(valueStr);