@magic-xpa/engine 4.900.0-dev490.25 → 4.900.0-dev490.256

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.
@@ -1205,7 +1205,8 @@ class MgControl extends MgControlBase {
1205
1205
  if (!isTagProcessed) {
1206
1206
  switch (attribute) {
1207
1207
  case ConstInterface.MG_ATTR_SUBFORM_TASK:
1208
- this._subformTaskId = valueStr;
1208
+ if (valueStr.trim() != "")
1209
+ this._subformTaskId = valueStr;
1209
1210
  break;
1210
1211
  case ConstInterface.MG_ATTR_REFRESHON:
1211
1212
  this.refreshOnString = valueStr.trim();
@@ -6125,17 +6126,22 @@ class LanguageData {
6125
6126
  if (this._mlsContent.length > 0) {
6126
6127
  let linePairs = 0;
6127
6128
  let srcLine = this._mlsContent + 3;
6129
+ let transLine;
6128
6130
  this._mlsStrings = new Hashtable();
6129
- let linesStr = this._mlsContent.substring(this._mlsContent.length - MLS_EOF_CHARS_TO_READ, 8);
6131
+ let linesStr = this._mlsContent.substr(this._mlsContent.length - MLS_EOF_CHARS_TO_READ, 8);
6130
6132
  linePairs = parseInt(linesStr.toString(), 16);
6131
6133
  let tokens = StrUtil.tokenize(srcLine.toString(), "\n");
6132
- for (let line = 0; line < linePairs * 2; line += 2) {
6133
- if (this._mlsStrings.get_Item(tokens[line].toString()) == null)
6134
- this._mlsStrings.set_Item(tokens[line].toString(), tokens[line + 1].toString());
6134
+ for (let pairNum = 0; pairNum < linePairs * 2; pairNum += 2) {
6135
+ srcLine = tokens[pairNum].substr(0, tokens[pairNum].length - 1);
6136
+ transLine = tokens[pairNum + 1].substr(0, tokens[pairNum + 1].length - 1);
6137
+ if (this._mlsStrings.get_Item(srcLine.toString()) == null)
6138
+ this._mlsStrings.set_Item(srcLine.toString(), transLine);
6135
6139
  }
6136
6140
  }
6137
6141
  }
6138
6142
  else if (this._mlsFileUrl != null) {
6143
+ if (this._mlsFileUrl.startsWith("./"))
6144
+ this._mlsFileUrl = NString.Replace(this._mlsFileUrl, './', './assets/cache/');
6139
6145
  let contentStr = await CommandsProcessorManager.GetContent(this._mlsFileUrl, true);
6140
6146
  let buffer = contentStr;
6141
6147
  if (buffer != null && buffer.length > 0) {
@@ -10126,7 +10132,7 @@ class CookieService {
10126
10132
  var cookie = cookies[i];
10127
10133
  var eqPos = cookie.indexOf('=');
10128
10134
  var name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie;
10129
- if (cookieName === decodeURI(name)) {
10135
+ if (cookieName === NString.TrimStart(decodeURI(name))) {
10130
10136
  document.cookie = name + '=;expires=Thu, 01 Jan 1970 00:00:00 GMT';
10131
10137
  return true;
10132
10138
  }
@@ -14196,7 +14202,7 @@ class ExpressionEvaluator extends GuiExpressionEvaluator {
14196
14202
  }
14197
14203
  path = args[3];
14198
14204
  domain = args[4];
14199
- resVal.BoolVal = CookieService.setCookie(cookieName, args[0], nativeDt, path, domain, secure, sameSite);
14205
+ resVal.BoolVal = CookieService.setCookie(cookieName, (args[0] != null ? args[0].toString() : ""), nativeDt, path, domain, secure, sameSite);
14200
14206
  }
14201
14207
  eval_op_get_cookie(cookieName, resVal) {
14202
14208
  resVal.StrVal = CookieService.getCookie(cookieName);
@@ -16262,7 +16268,8 @@ class Field extends FieldBase {
16262
16268
  }
16263
16269
  break;
16264
16270
  case ConstInterface.MG_ATTR_CHACHED_FLD_ID:
16265
- this.CacheTableFldIdx = NNumber.Parse(data[1]);
16271
+ if (data[0] != "")
16272
+ this.CacheTableFldIdx = NNumber.Parse(data[1]);
16266
16273
  break;
16267
16274
  case ConstInterface.MG_ATTR_LOCATE:
16268
16275
  this.Locate = new Boundary(this.getTask(), NNumber.Parse(data[1]), NNumber.Parse(data[0]), this.getType(), this.getSize(), this.CacheTableFldIdx);
@@ -20443,8 +20450,8 @@ class RemoteTaskService extends TaskServiceBase {
20443
20450
  OwnerTransactionTask = task.DataviewManager.RemoteDataviewManager.Transaction.OwnerTask;
20444
20451
  return OwnerTransactionTask;
20445
20452
  }
20446
- static PreparePropMainDisplay(task) {
20447
- task.ComputeMainDisplay();
20453
+ static async PreparePropMainDisplay(task) {
20454
+ await task.ComputeMainDisplay();
20448
20455
  return task.FormIsLegal() ? ReturnResult.SuccessfulResult : new ReturnResult(MsgInterface.BRKTAB_STR_ERR_FORM);
20449
20456
  }
20450
20457
  }
@@ -20844,15 +20851,18 @@ class RemoteDataviewHeader extends DataviewHeaderBase {
20844
20851
  setAttribute(attribute, valueStr) {
20845
20852
  switch (attribute) {
20846
20853
  case ConstInterface.MG_ATTR_CACHED_TABLE:
20847
- if (TableCacheManager.Instance.TableExists(valueStr))
20848
- this._table = TableCacheManager.Instance.GetTableById(valueStr);
20849
- else {
20850
- this._table = new TableCache(valueStr);
20851
- TableCacheManager.Instance.InsertTable(this._table);
20854
+ if (valueStr != "") {
20855
+ if (TableCacheManager.Instance.TableExists(valueStr))
20856
+ this._table = TableCacheManager.Instance.GetTableById(valueStr);
20857
+ else {
20858
+ this._table = new TableCache(valueStr);
20859
+ TableCacheManager.Instance.InsertTable(this._table);
20860
+ }
20852
20861
  }
20853
20862
  break;
20854
20863
  case ConstInterface.MG_ATTR_IDENT:
20855
- this._table.SetTableIdent(valueStr);
20864
+ if (valueStr != "")
20865
+ this._table.SetTableIdent(valueStr);
20856
20866
  break;
20857
20867
  default:
20858
20868
  super.setAttribute(attribute, valueStr);
@@ -21946,9 +21956,17 @@ class RecomputeTable {
21946
21956
  this.fillData_1(task.DataView, task, parser);
21947
21957
  }
21948
21958
  else
21949
- throw new ApplicationException("in RecomputeTable.fillData() invalid task id: ");
21959
+ parser.setCurrIndex(parser.getXMLdata().indexOf(XMLConstants.TAG_CLOSE, parser.getCurrIndex()) + 1);
21950
21960
  }
21951
21961
  fillData_1(dataView, task, parser) {
21962
+ if (parser.getNextTag() == XMLConstants.MG_TAG_RECOMPUTE) {
21963
+ let currrentIndex = parser.getCurrIndex();
21964
+ let encoded = parser.ReadContentOfCurrentElement().trim();
21965
+ let decoded = Base64.decode(encoded.substr(0, encoded.length).trim());
21966
+ let newXmlData = parser.getXMLdata().replace(encoded.trim(), decoded);
21967
+ parser.setXMLdata(newXmlData);
21968
+ parser.setCurrIndex(currrentIndex);
21969
+ }
21952
21970
  while (this.initInnerObjects(parser, parser.getNextTag(), dataView, task)) {
21953
21971
  }
21954
21972
  }
@@ -22694,10 +22712,12 @@ class Task extends TaskBase {
22694
22712
  this.setDescriptor(valueStr);
22695
22713
  break;
22696
22714
  case ConstInterface.MG_ATTR_HAS_LOCATE:
22697
- this.hasLocate = true;
22715
+ if (+valueStr == 1)
22716
+ this.hasLocate = true;
22698
22717
  break;
22699
22718
  case ConstInterface.MG_ATTR_AS_PARENT:
22700
- this.ModeAsParent = true;
22719
+ if (+valueStr == 1)
22720
+ this.ModeAsParent = true;
22701
22721
  break;
22702
22722
  case ConstInterface.MG_ATTR_TASK_UNIQUE_SORT:
22703
22723
  this.UniqueSort = valueStr[0];
@@ -23024,6 +23044,7 @@ class Task extends TaskBase {
23024
23044
  result = await this.DataviewManager.Execute(dataViewCommand);
23025
23045
  if (!result.Success)
23026
23046
  return null;
23047
+ this.ResumeSubformLayout();
23027
23048
  }
23028
23049
  nonInteractiveTask = await this.StartSubTasks(moveToFirstControl, nonInteractiveTask, callByDestSubForm);
23029
23050
  this.InStartProcess = false;
@@ -24647,16 +24668,16 @@ class Task extends TaskBase {
24647
24668
  }
24648
24669
  }
24649
24670
  }
24650
- ComputeMainDisplay() {
24671
+ async ComputeMainDisplay() {
24651
24672
  let propMainDisplay = this.getProp(PropInterface.PROP_TYPE_MAIN_DISPLAY);
24652
- let mainDisplayIndex = propMainDisplay.GetComputedValueInteger();
24673
+ let mainDisplayIndex = await propMainDisplay.getValueInt();
24653
24674
  mainDisplayIndex = this.GetRealMainDisplayIndexOnCurrentTask(mainDisplayIndex);
24654
24675
  this._forms.InitFormFromXmlString(mainDisplayIndex);
24655
24676
  this.EnsureValidForm();
24656
24677
  }
24657
24678
  async PrepareTaskForm() {
24658
24679
  await TaskServiceBase.PreparePropOpenTaskWindow(this);
24659
- return RemoteTaskService.PreparePropMainDisplay(this);
24680
+ return await RemoteTaskService.PreparePropMainDisplay(this);
24660
24681
  }
24661
24682
  FormIsLegal() {
24662
24683
  let isFormIsLegal = super.isMainProg();
@@ -24725,7 +24746,12 @@ class Task extends TaskBase {
24725
24746
  let tokensVector = XmlParser.getTokens(RuntimeContextBase.Instance.Parser.getXMLsubstring(endTaskUrlIdx), XMLConstants.XML_ATTR_DELIM);
24726
24747
  let taskCacheURL = tokensVector.get_Item(1);
24727
24748
  let refListStr = tokensVector.get_Item(3);
24728
- let taskContentOriginal = await Task.CommandsProcessor.GetContent(taskCacheURL, true);
24749
+ let taskContentOriginal = "";
24750
+ if (taskCacheURL.trim() != "") {
24751
+ if (taskCacheURL.startsWith("./"))
24752
+ taskCacheURL = NString.Replace(taskCacheURL, './', './assets/cache/');
24753
+ taskContentOriginal = await Task.CommandsProcessor.GetContent(taskCacheURL, true);
24754
+ }
24729
24755
  let taskContentFinal = new StringBuilder(xmlData.substr(0, RuntimeContextBase.Instance.Parser.getCurrIndex() - (ConstInterface.MG_TAG_TASKURL.length + 1)), taskContentOriginal.length);
24730
24756
  let reflist = this.getReflist(refListStr, ';', true, -1);
24731
24757
  let refListIdx = 0;
@@ -26925,7 +26951,7 @@ class EventsManager {
26925
26951
  val = Manager.GetCtrlVal(ctrl);
26926
26952
  task.CurrentEditingControl = null;
26927
26953
  if (!task.cancelWasRaised() &&
26928
- (ctrl.Type !== MgControlType.CTRL_TYPE_BROWSER && (!isNullOrUndefined(ctrl._field) && ctrl._field.getType() === StorageAttribute.DATE || val !== null) && typeof val != 'undefined' &&
26954
+ (ctrl.Type !== MgControlType.CTRL_TYPE_BROWSER && (!isNullOrUndefined(ctrl._field) && (ctrl._field.getType() === StorageAttribute.DATE || ctrl._field.getType() == StorageAttribute.NUMERIC) || val !== null) && typeof val != 'undefined' &&
26929
26955
  !await ctrl.validateAndSetValue(val, true))) {
26930
26956
  this.setStopExecution(true);
26931
26957
  return false;
@@ -29517,7 +29543,7 @@ class CommandsTable {
29517
29543
  }
29518
29544
  }
29519
29545
 
29520
- let CurrentClientVersion = '4.900.0-dev490.25';
29546
+ let CurrentClientVersion = '4.900.0-dev490.256';
29521
29547
 
29522
29548
  class ClientManager {
29523
29549
  constructor() {
@@ -29778,7 +29804,7 @@ class ClientManager {
29778
29804
  }
29779
29805
  return pic;
29780
29806
  }
29781
- static GetFormattedValue(taskId, controlName, value) {
29807
+ static GetFormattedValue(taskId, controlName, value, rowId) {
29782
29808
  let pic = null;
29783
29809
  let task = MGDataCollection.Instance.GetTaskByID(taskId);
29784
29810
  let control = null;
@@ -29786,7 +29812,12 @@ class ClientManager {
29786
29812
  if (controlName !== null && task !== null)
29787
29813
  control = task.getForm().GetCtrl(controlName);
29788
29814
  if (control != null && control.DataType == StorageAttribute.NUMERIC) {
29789
- pic = control.getPIC();
29815
+ if (control.isRepeatable() && control.getProp(PropInterface.PROP_TYPE_FORMAT).isExpression()) {
29816
+ let picval = control.getProp(PropInterface.PROP_TYPE_FORMAT).getPrevValue(+rowId);
29817
+ pic = new PIC(picval, StorageAttribute.NUMERIC, control.getForm().getTask().getCompIdx());
29818
+ }
29819
+ else
29820
+ pic = control.getPIC();
29790
29821
  let dispValue = String(value);
29791
29822
  let newPic = pic.getUnformattedNumericPic();
29792
29823
  let num = DisplayConvertor.Instance.toNum(dispValue, newPic, 0);
@@ -29887,8 +29918,8 @@ class MagicBridge {
29887
29918
  static GetControlPictureMask(taskId, controlName) {
29888
29919
  return ClientManager.GetControlPictureMask(taskId, controlName);
29889
29920
  }
29890
- static GetFormattedValue(taskId, controlName, value) {
29891
- return ClientManager.GetFormattedValue(taskId, controlName, value);
29921
+ static GetFormattedValue(taskId, controlName, value, rowId) {
29922
+ return ClientManager.GetFormattedValue(taskId, controlName, value, rowId);
29892
29923
  }
29893
29924
  static GetRangedValue(taskId, controlName, value) {
29894
29925
  return ClientManager.GetRangedValue(taskId, controlName, value);