@xuda.io/runtime-bundle 1.0.280 → 1.0.281

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.
@@ -13139,23 +13139,10 @@ func.expression.secure_eval = async function (
13139
13139
  }
13140
13140
  };
13141
13141
  func.UI.screen = {};
13142
- func.UI.screen.init = async function (
13143
- SESSION_ID,
13144
- prog_id,
13145
- sourceScreenP,
13146
- callingDataSource_objP,
13147
- $callingContainerP,
13148
- triggerIdP,
13149
- rowIdP,
13150
- jobNoP,
13151
- is_panelP,
13152
- parameters_obj_inP,
13153
- source_functionP,
13154
- call_screen_propertiesP
13155
- ) {
13156
- if (!prog_id) return console.error("program is empty");
13142
+ func.UI.screen.init = async function (SESSION_ID, prog_id, sourceScreenP, callingDataSource_objP, $callingContainerP, triggerIdP, rowIdP, jobNoP, is_panelP, parameters_obj_inP, source_functionP, call_screen_propertiesP) {
13143
+ if (!prog_id) return console.error('program is empty');
13157
13144
  let screen_ret = await func.utils.get_screen_obj(SESSION_ID, prog_id);
13158
- if (!screen_ret) return console.error("program is not a screen object");
13145
+ if (!screen_ret) return console.error('program is not a screen object');
13159
13146
  await func.UI.utils.init_ui_framework(SESSION_ID, prog_id);
13160
13147
 
13161
13148
  let _session = SESSION_OBJ[SESSION_ID];
@@ -13163,21 +13150,15 @@ func.UI.screen.init = async function (
13163
13150
  const screenInfo = _.cloneDeep(screen_ret);
13164
13151
  const $callingContainerP_data = $callingContainerP.clone(true)?.data();
13165
13152
 
13166
- var screen_type = source_functionP?.split("_")?.[1]; //|| (is_panelP && "panel");
13153
+ var screen_type = source_functionP?.split('_')?.[1]; //|| (is_panelP && "panel");
13167
13154
 
13168
13155
  var screenId = (glb.screen_num++).toString();
13169
13156
 
13170
- if (
13171
- SCREEN_BLOCKER_OBJ[prog_id + (sourceScreenP ? "_" + sourceScreenP : "")]
13172
- ) {
13157
+ if (SCREEN_BLOCKER_OBJ[prog_id + (sourceScreenP ? '_' + sourceScreenP : '')]) {
13173
13158
  const wait_for_SCREEN_BLOCKER_release = () => {
13174
13159
  return new Promise((resolve) => {
13175
13160
  var interval = setInterval(function () {
13176
- if (
13177
- !SCREEN_BLOCKER_OBJ[
13178
- prog_id + (sourceScreenP ? "_" + sourceScreenP : "")
13179
- ]
13180
- ) {
13161
+ if (!SCREEN_BLOCKER_OBJ[prog_id + (sourceScreenP ? '_' + sourceScreenP : '')]) {
13181
13162
  window.clearInterval(interval);
13182
13163
  resolve();
13183
13164
  // run_screen();
@@ -13188,13 +13169,9 @@ func.UI.screen.init = async function (
13188
13169
  await wait_for_SCREEN_BLOCKER_release();
13189
13170
  }
13190
13171
 
13191
- func.UI.utils.screen_blocker(
13192
- true,
13193
- prog_id + (sourceScreenP ? "_" + sourceScreenP : "")
13194
- );
13172
+ func.UI.utils.screen_blocker(true, prog_id + (sourceScreenP ? '_' + sourceScreenP : ''));
13195
13173
 
13196
- if ($callingContainerP && !_.isEmpty($callingContainerP))
13197
- $callingContainerP.data().xuData.screenInfo = screenInfo;
13174
+ if ($callingContainerP && !_.isEmpty($callingContainerP)) $callingContainerP.data().xuData.screenInfo = screenInfo;
13198
13175
 
13199
13176
  var $dialogDiv;
13200
13177
  var $rootFrame;
@@ -13214,20 +13191,17 @@ func.UI.screen.init = async function (
13214
13191
  screen_type,
13215
13192
  screenInfo,
13216
13193
  call_screen_propertiesP,
13217
- parentDataSourceNoP:
13218
- _session.DS_GLB?.[callingDataSource_objP?.dsSession]?.dsSession ||
13219
- callingDataSource_objP?.parentDataSourceNo ||
13220
- 0,
13194
+ parentDataSourceNoP: _session.DS_GLB?.[callingDataSource_objP?.dsSession]?.dsSession || callingDataSource_objP?.parentDataSourceNo || 0,
13221
13195
  };
13222
13196
 
13223
13197
  switch (screen_type) {
13224
- case "embed":
13225
- $dialogDiv = $("<div>")
13198
+ case 'embed':
13199
+ $dialogDiv = $('<div>')
13226
13200
  .attr({
13227
13201
  id: screenId,
13228
13202
  ui_engine: UI_FRAMEWORK_INSTALLED,
13229
13203
  })
13230
- .addClass("xu_embed_div")
13204
+ .addClass('xu_embed_div')
13231
13205
  .data({
13232
13206
  xuData: {
13233
13207
  paramsP: params,
@@ -13235,21 +13209,18 @@ func.UI.screen.init = async function (
13235
13209
  },
13236
13210
  });
13237
13211
 
13238
- let rootTagName = "div";
13239
- if (typeof glb.SLIM_BUNDLE === "undefined" && !glb.SLIM_BUNDLE) {
13212
+ let rootTagName = 'div';
13213
+ if (typeof glb.SLIM_BUNDLE === 'undefined' && !glb.SLIM_BUNDLE) {
13240
13214
  const ui_plugin_core = new UI_FRAMEWORK_PLUGIN.core();
13241
13215
  rootTagName = ui_plugin_core?.rootTagName();
13242
13216
  }
13243
13217
 
13244
- $rootFrame = $(`<${rootTagName}>`)
13245
- .data("xuData", {})
13246
- .data("xuAttributes", {})
13247
- .appendTo($dialogDiv);
13218
+ $rootFrame = $(`<${rootTagName}>`).data('xuData', {}).data('xuAttributes', {}).appendTo($dialogDiv);
13248
13219
 
13249
13220
  $dialogDiv.appendTo($callingContainerP);
13250
13221
  break;
13251
13222
 
13252
- case "panel":
13223
+ case 'panel':
13253
13224
  $dialogDiv = $callingContainerP;
13254
13225
  $dialogDiv.data({
13255
13226
  xuData: {
@@ -13260,31 +13231,30 @@ func.UI.screen.init = async function (
13260
13231
  $rootFrame = $dialogDiv;
13261
13232
  break;
13262
13233
 
13263
- case "page":
13264
- case "modal":
13265
- case "popover":
13266
- $dialogDiv = $("<div>");
13267
- $rootFrame = $("<div>").appendTo($dialogDiv);
13268
- $dialogDiv.appendTo("body");
13234
+ case 'page':
13235
+ case 'modal':
13236
+ case 'popover':
13237
+ $dialogDiv = $('<div>');
13238
+ $rootFrame = $('<div>').appendTo($dialogDiv);
13239
+ $dialogDiv.appendTo('body');
13269
13240
  break;
13270
13241
 
13271
13242
  default:
13272
13243
  }
13273
13244
 
13274
- params.containerIdP = $rootFrame.attr("id");
13245
+ params.containerIdP = $rootFrame.attr('id');
13275
13246
  params.$container = $rootFrame;
13276
13247
 
13277
- containerId =
13278
- "container_" + params.screenInfo.properties?.id + "_" + screenId;
13248
+ containerId = 'container_' + params.screenInfo.properties?.id + '_' + screenId;
13279
13249
 
13280
13250
  var data = {
13281
- note: " ROOT container",
13251
+ note: ' ROOT container',
13282
13252
  root: true,
13283
13253
  screenId,
13284
13254
  is_panelP,
13285
13255
  prog_id,
13286
13256
  screen_type,
13287
- container: "#" + containerId, // initiate container that hold the element
13257
+ container: '#' + containerId, // initiate container that hold the element
13288
13258
  };
13289
13259
  if (is_panelP) {
13290
13260
  $rootFrame.data().xuData.rootFrame = data;
@@ -13292,8 +13262,8 @@ func.UI.screen.init = async function (
13292
13262
  if (!$rootFrame.data().xuData) {
13293
13263
  $rootFrame.data().xuData = {};
13294
13264
  }
13295
- $rootFrame.attr("id", containerId).data().xuData.rootFrame = data;
13296
- $rootFrame.css("display", "contents");
13265
+ $rootFrame.attr('id', containerId).data().xuData.rootFrame = data;
13266
+ $rootFrame.css('display', 'contents');
13297
13267
  }
13298
13268
 
13299
13269
  // ////////// skeleton
@@ -13379,23 +13349,7 @@ func.UI.screen.init = async function (
13379
13349
  // console.log("***");
13380
13350
  func.UI.utils.indicator.screen.busy();
13381
13351
 
13382
- const ret = await func.datasource.create(
13383
- SESSION_ID,
13384
- prog_id,
13385
- null,
13386
- params.parentDataSourceNoP,
13387
- $rootFrame.attr("id"),
13388
- rowIdP,
13389
- jobNoP,
13390
- null,
13391
- null,
13392
- null,
13393
- null,
13394
- null,
13395
- null,
13396
- null,
13397
- parameters_obj_inP
13398
- );
13352
+ const ret = await func.datasource.create(SESSION_ID, prog_id, null, params.parentDataSourceNoP, $rootFrame.attr('id'), rowIdP, jobNoP, null, null, null, null, null, null, null, parameters_obj_inP);
13399
13353
 
13400
13354
  var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[ret.dsSessionP];
13401
13355
  _ds.screen_params = params;
@@ -13412,46 +13366,24 @@ func.UI.screen.init = async function (
13412
13366
  if (ret.dsSessionP >= 0) {
13413
13367
  // Call from contact info screen
13414
13368
  var viewDoc;
13415
- let view_ret = await func.utils.VIEWS_OBJ.get(
13416
- SESSION_ID,
13417
- SESSION_OBJ[SESSION_ID].DS_GLB[ret.dsSessionP].prog_id
13418
- );
13369
+ let view_ret = await func.utils.VIEWS_OBJ.get(SESSION_ID, SESSION_OBJ[SESSION_ID].DS_GLB[ret.dsSessionP].prog_id);
13419
13370
  if (view_ret) {
13420
13371
  viewDoc = view_ret;
13421
13372
  }
13422
13373
  if (!viewDoc?.progUi) {
13423
- return func.utils.alerts.invoke(
13424
- SESSION_ID,
13425
- "system_msg",
13426
- "SYS_MSG_0780",
13427
- params.renderType,
13428
- ret.dsSessionP
13429
- );
13374
+ return func.utils.alerts.invoke(SESSION_ID, 'system_msg', 'SYS_MSG_0780', params.renderType, ret.dsSessionP);
13430
13375
  }
13431
13376
  var node;
13432
13377
  node = _.cloneDeep(viewDoc.progUi);
13433
- if (!node.length) return console.warn("ui node empty");
13434
- const ret_render_$container = await func.UI.screen.render_ui_tree(
13435
- SESSION_ID,
13436
- $rootFrame,
13437
- node[0],
13438
- null,
13439
- params,
13440
- jobNoP,
13441
- null,
13442
- null,
13443
- null,
13444
- null,
13445
- null,
13446
- $rootFrame
13447
- );
13378
+ if (!node.length) return console.warn('ui node empty');
13379
+ const ret_render_$container = await func.UI.screen.render_ui_tree(SESSION_ID, $rootFrame, node[0], null, params, jobNoP, null, null, null, null, null, $rootFrame);
13448
13380
 
13449
13381
  // $(".skeleton_wrapper").remove();
13450
13382
 
13451
13383
  // fix for svg
13452
13384
 
13453
13385
  const fix_svg = function () {
13454
- let $svg = $("svg");
13386
+ let $svg = $('svg');
13455
13387
  $.each($svg, function (key, elm) {
13456
13388
  elm.outerHTML = elm.outerHTML;
13457
13389
  });
@@ -13461,12 +13393,7 @@ func.UI.screen.init = async function (
13461
13393
  }, 200);
13462
13394
  func.UI.utils.indicator.screen.normal();
13463
13395
 
13464
- let ret_screen_loading = await func.UI.screen.screen_loading_done(
13465
- SESSION_ID,
13466
- params,
13467
- ret_render_$container,
13468
- jobNoP
13469
- );
13396
+ let ret_screen_loading = await func.UI.screen.screen_loading_done(SESSION_ID, params, ret_render_$container, jobNoP);
13470
13397
  return ret_screen_loading;
13471
13398
  }
13472
13399
  };
@@ -13478,11 +13405,10 @@ func.UI.screen.update_SYS_OBJ_WIN_INFO = function (SESSION_ID, dsNoP) {
13478
13405
  _ds.data_system = {};
13479
13406
  }
13480
13407
 
13481
- _ds.data_system["SYS_STR_WIN_ID"] = _ds.tree_obj?.id;
13482
- _ds.data_system["SYS_STR_WIN_NAME"] = _ds.tree_obj?.menuName;
13408
+ _ds.data_system['SYS_STR_WIN_ID'] = _ds.tree_obj?.id;
13409
+ _ds.data_system['SYS_STR_WIN_NAME'] = _ds.tree_obj?.menuName;
13483
13410
  if (SESSION_OBJ[SESSION_ID].DS_GLB[dsNoP].mode) {
13484
- _ds.data_system["SYS_STR_WIN_MODE"] =
13485
- SESSION_OBJ[SESSION_ID].DS_GLB[dsNoP].mode;
13411
+ _ds.data_system['SYS_STR_WIN_MODE'] = SESSION_OBJ[SESSION_ID].DS_GLB[dsNoP].mode;
13486
13412
  }
13487
13413
  // _ds.data_system["SYS_OBJ_WIN_INFO"] = func.UI.screen.get_info(
13488
13414
  // SESSION_ID,
@@ -13491,19 +13417,9 @@ func.UI.screen.update_SYS_OBJ_WIN_INFO = function (SESSION_ID, dsNoP) {
13491
13417
  // get all top fields into json
13492
13418
  };
13493
13419
 
13494
- func.UI.screen.validate_exit_events = async function (
13495
- SESSION_ID,
13496
- div_data_paramsP,
13497
- forceP
13498
- ) {
13420
+ func.UI.screen.validate_exit_events = async function (SESSION_ID, div_data_paramsP, forceP) {
13499
13421
  return new Promise(async (resolve) => {
13500
- await func.events.validate(
13501
- SESSION_ID,
13502
- "on_exit",
13503
- div_data_paramsP.dsSessionP,
13504
- null,
13505
- "screen"
13506
- );
13422
+ await func.events.validate(SESSION_ID, 'on_exit', div_data_paramsP.dsSessionP, null, 'screen');
13507
13423
 
13508
13424
  var interval = setInterval(function () {
13509
13425
  if (!SESSION_OBJ[SESSION_ID].WORKER_OBJ.jobs.length || forceP) {
@@ -13515,7 +13431,7 @@ func.UI.screen.validate_exit_events = async function (
13515
13431
  };
13516
13432
 
13517
13433
  func.UI.screen.call_embed = function (SESSION_ID, prog) {
13518
- $("#embed_" + SESSION_ID)
13434
+ $('#embed_' + SESSION_ID)
13519
13435
  .empty()
13520
13436
  .data().xuData.screenInfo = null;
13521
13437
 
@@ -13524,24 +13440,18 @@ func.UI.screen.call_embed = function (SESSION_ID, prog) {
13524
13440
  });
13525
13441
  func.UI.main.embed_prog_execute(SESSION_ID, prog);
13526
13442
  };
13527
- func.UI.screen.refresh_xu_attributes = async function (
13528
- SESSION_ID,
13529
- fields_arr,
13530
- jobNoP,
13531
- $elm_to_search,
13532
- dsSession
13533
- ) {
13443
+ func.UI.screen.refresh_xu_attributes = async function (SESSION_ID, fields_arr, jobNoP, $elm_to_search, dsSession) {
13534
13444
  var selectors = {};
13535
- var search_from = "body";
13445
+ var search_from = 'body';
13536
13446
  var new_job = jobNoP;
13537
13447
 
13538
13448
  if ($elm_to_search) {
13539
- search_from = "#" + $elm_to_search.attr("id");
13449
+ search_from = '#' + $elm_to_search.attr('id');
13540
13450
  }
13541
13451
  const get_selectors = function () {
13542
13452
  $.each(fields_arr, function (key_field, val_field) {
13543
13453
  $(search_from)
13544
- .find("*")
13454
+ .find('*')
13545
13455
  .filter(function () {
13546
13456
  var attr = [];
13547
13457
 
@@ -13551,41 +13461,33 @@ func.UI.screen.refresh_xu_attributes = async function (
13551
13461
  // )
13552
13462
  // return;
13553
13463
 
13554
-
13555
-
13556
13464
  $.each($(this).data()?.xuAttributes, function (key, val) {
13557
-
13558
- if (key === "xu-for") { // match static value for xu-for
13465
+ if (key === 'xu-for') {
13466
+ // match static value for xu-for
13559
13467
  if (val?.includes?.(val_field)) {
13560
13468
  attr.push(key);
13561
-
13562
13469
  }
13563
13470
  }
13564
13471
 
13565
-
13566
- if (!key.substr(0, 2) === "xu") return;
13567
- if (key.substr(0, 6) === "xu-exp" && key.substr(6, 1) === ":") {
13472
+ if (!key.substr(0, 2) === 'xu') return;
13473
+ if (key.substr(0, 6) === 'xu-exp' && key.substr(6, 1) === ':') {
13568
13474
  if (val?.includes?.(val_field)) {
13569
13475
  attr.push(key);
13570
-
13571
13476
  }
13572
-
13573
13477
  }
13574
13478
 
13575
-
13576
-
13577
- if (key.substr(0, 8) === "xu-class") {
13479
+ if (key.substr(0, 8) === 'xu-class') {
13578
13480
  try {
13579
13481
  let obj = JSON.parse(val);
13580
13482
  $.each(obj, function (cla, cond) {
13581
13483
  if (cond.includes(val_field)) {
13582
13484
  // attr.push("xuClass");
13583
- attr.push("xu-class");
13485
+ attr.push('xu-class');
13584
13486
  return false;
13585
13487
  }
13586
13488
  });
13587
13489
  } catch (e) {
13588
- console.warn("parse error:" + val);
13490
+ console.warn('parse error:' + val);
13589
13491
  }
13590
13492
  }
13591
13493
  // return attr;
@@ -13600,8 +13502,7 @@ func.UI.screen.refresh_xu_attributes = async function (
13600
13502
  selectors[selector_id] = { attributes: [], $elm: $(this) };
13601
13503
  }
13602
13504
  attr.forEach(function (value) {
13603
- if (!selectors[selector_id].attributes.includes(value))
13604
- selectors[selector_id].attributes.push(value);
13505
+ if (!selectors[selector_id].attributes.includes(value)) selectors[selector_id].attributes.push(value);
13605
13506
  });
13606
13507
  }
13607
13508
  });
@@ -13611,14 +13512,14 @@ func.UI.screen.refresh_xu_attributes = async function (
13611
13512
  get_selectors();
13612
13513
 
13613
13514
  for await (let [elem_key, elem_val] of Object.entries(selectors)) {
13614
- if (elem_key === "length") break;
13515
+ if (elem_key === 'length') break;
13615
13516
 
13616
13517
  const add_execute_queue = async function (type) {
13617
13518
  if (!elem_val.$elm?.data?.()?.xuData) return;
13618
13519
 
13619
13520
  new_job = await func.UI.worker.add_to_queue(
13620
13521
  SESSION_ID,
13621
- "gui event",
13522
+ 'gui event',
13622
13523
  type,
13623
13524
  {
13624
13525
  ui_type: elem_val.$elm.data().xuData.ui_type,
@@ -13628,7 +13529,7 @@ func.UI.screen.refresh_xu_attributes = async function (
13628
13529
  elem_val,
13629
13530
  },
13630
13531
  new_job,
13631
- elem_val.$elm
13532
+ elem_val.$elm,
13632
13533
  );
13633
13534
  };
13634
13535
  //////////// process render first ///////////////
@@ -13637,27 +13538,15 @@ func.UI.screen.refresh_xu_attributes = async function (
13637
13538
 
13638
13539
  if (!elem_val?.$elm?.data()?.xuAttributes) continue;
13639
13540
 
13640
- if (elem_val.attributes.includes("xu-exp:xu-render")) {
13641
- var res = await func.expression.get(
13642
- SESSION_ID,
13643
- elem_val.$elm.data().xuAttributes["xu-exp:xu-render"],
13644
- elem_val.$elm.data().xuData.paramsP.dsSessionP,
13645
- "UI Property EXP",
13646
- elem_val.$elm.data().xuData.recordid
13647
- );
13541
+ if (elem_val.attributes.includes('xu-exp:xu-render')) {
13542
+ var res = await func.expression.get(SESSION_ID, elem_val.$elm.data().xuAttributes['xu-exp:xu-render'], elem_val.$elm.data().xuData.paramsP.dsSessionP, 'UI Property EXP', elem_val.$elm.data().xuData.recordid);
13648
13543
 
13649
- var attr_value = await func.common.get_cast_val(
13650
- SESSION_ID,
13651
- "refresh xu-attributes",
13652
- "xu-render",
13653
- "bool",
13654
- res.result
13655
- );
13544
+ var attr_value = await func.common.get_cast_val(SESSION_ID, 'refresh xu-attributes', 'xu-render', 'bool', res.result);
13656
13545
 
13657
- if (!attr_value & (elem_val.$elm[0].tagName === "XURENDER")) continue; // bypass job
13546
+ if (!attr_value & (elem_val.$elm[0].tagName === 'XURENDER')) continue; // bypass job
13658
13547
 
13659
- if (attr_value & (elem_val.$elm[0].tagName !== "XURENDER")) {
13660
- await add_execute_queue("execute_xu_all_attributes");
13548
+ if (attr_value & (elem_val.$elm[0].tagName !== 'XURENDER')) {
13549
+ await add_execute_queue('execute_xu_all_attributes');
13661
13550
  continue; // bypass render job
13662
13551
  }
13663
13552
 
@@ -13665,8 +13554,8 @@ func.UI.screen.refresh_xu_attributes = async function (
13665
13554
 
13666
13555
  new_job = await func.UI.worker.add_to_queue(
13667
13556
  SESSION_ID,
13668
- "gui event",
13669
- "execute_xu_render_attributes",
13557
+ 'gui event',
13558
+ 'execute_xu_render_attributes',
13670
13559
  {
13671
13560
  ui_type: elem_val.$elm.data().xuData.ui_type,
13672
13561
  SESSION_ID,
@@ -13677,50 +13566,47 @@ func.UI.screen.refresh_xu_attributes = async function (
13677
13566
  },
13678
13567
  new_job,
13679
13568
  elem_val.$elm,
13680
- elem_val.$elm.data().xuData.paramsP.dsSessionP
13569
+ elem_val.$elm.data().xuData.paramsP.dsSessionP,
13681
13570
  );
13682
13571
  performed_render = true;
13683
13572
  }
13684
13573
 
13685
- if (performed_render || elem_val.$elm[0].tagName === "XURENDER") continue; // bypass job
13574
+ if (performed_render || elem_val.$elm[0].tagName === 'XURENDER') continue; // bypass job
13686
13575
 
13687
- if (elem_val.attributes.includes("xu-exp:xu-for") || elem_val.attributes.includes("xu-for")) continue;
13688
- add_execute_queue("execute_xu_all_attributes");
13576
+ if (elem_val.attributes.includes('xu-exp:xu-for') || elem_val.attributes.includes('xu-for')) continue;
13577
+ add_execute_queue('execute_xu_all_attributes');
13689
13578
  }
13690
13579
 
13691
13580
  // xu-for
13692
13581
  selectors = {};
13693
13582
  get_selectors();
13694
- let refreshed_ids = []
13583
+ let refreshed_ids = [];
13695
13584
  // handle xu-for
13696
- let parent_element_ui_id
13585
+ let parent_element_ui_id;
13697
13586
  for await (let [elem_key, elem_val] of Object.entries(selectors)) {
13698
- if (elem_key === "length") break;
13587
+ if (elem_key === 'length') break;
13699
13588
 
13700
- if (!elem_val.attributes.includes("xu-exp:xu-for") && !elem_val.attributes.includes("xu-for")) continue;
13589
+ if (!elem_val.attributes.includes('xu-exp:xu-for') && !elem_val.attributes.includes('xu-for')) continue;
13701
13590
 
13702
-
13703
- let _parent_element_ui_id
13591
+ let _parent_element_ui_id;
13704
13592
  if (elem_val?.$elm?.data()?.xuPanelData) {
13705
13593
  // handle li panel
13706
- _parent_element_ui_id = elem_val?.$elm?.data()?.xuPanelData?.parent_element_ui_id
13594
+ _parent_element_ui_id = elem_val?.$elm?.data()?.xuPanelData?.parent_element_ui_id;
13707
13595
  } else {
13708
- // handle regular li
13596
+ // handle regular li
13709
13597
  _parent_element_ui_id = elem_val?.$elm?.data()?.xuData?.parent_element_ui_id;
13710
13598
  }
13711
13599
 
13712
13600
  if (!parent_element_ui_id || _parent_element_ui_id != parent_element_ui_id) {
13713
13601
  parent_element_ui_id = _parent_element_ui_id;
13714
13602
 
13715
- const _$elem = $(`[xu-ui-id=${parent_element_ui_id}]`)
13716
- const _elem_key = parent_element_ui_id
13717
- const _elem_val = { attributes: [], $elm: _$elem }
13603
+ const _$elem = $(`[xu-ui-id=${parent_element_ui_id}]`);
13604
+ const _elem_key = parent_element_ui_id;
13605
+ const _elem_val = { attributes: [], $elm: _$elem };
13718
13606
 
13719
13607
  $.each(_$elem.data()?.xuAttributes, function (key, val) {
13720
13608
  _elem_val.attributes.push(key);
13721
- })
13722
-
13723
-
13609
+ });
13724
13610
 
13725
13611
  // await func.UI.worker.add_to_queue(
13726
13612
  // SESSION_ID,
@@ -13740,8 +13626,8 @@ func.UI.screen.refresh_xu_attributes = async function (
13740
13626
 
13741
13627
  await func.UI.worker.add_to_queue(
13742
13628
  SESSION_ID,
13743
- "gui event",
13744
- "execute_xu_for",
13629
+ 'gui event',
13630
+ 'execute_xu_for',
13745
13631
  {
13746
13632
  ui_type: _elem_val.$elm.data().xuData.ui_type,
13747
13633
  SESSION_ID,
@@ -13751,45 +13637,40 @@ func.UI.screen.refresh_xu_attributes = async function (
13751
13637
  },
13752
13638
  new_job,
13753
13639
  _elem_val.$elm,
13754
- _elem_val.$elm.data().xuData.paramsP.dsSessionP
13640
+ _elem_val.$elm.data().xuData.paramsP.dsSessionP,
13755
13641
  );
13756
13642
 
13757
- refreshed_ids.push(parent_element_ui_id)
13643
+ refreshed_ids.push(parent_element_ui_id);
13758
13644
  }
13759
13645
  }
13760
13646
 
13761
- /////////// xu-for for non displayed elements ////////////
13647
+ /////////// xu-for for non displayed elements ////////////
13762
13648
  const iterate_field_in_progUi = async function (progUi, field_id) {
13763
- let found
13649
+ let found;
13764
13650
  const iterate_progUi = async function (node, node_id) {
13765
13651
  for (let item of node) {
13766
-
13767
13652
  if (!_.isEmpty(item.attributes)) {
13768
13653
  for await (const [attr, val] of Object.entries(item.attributes)) {
13769
-
13770
- if (attr === "xu-exp:xu-for" || attr === "xu-for") {
13654
+ if (attr === 'xu-exp:xu-for' || attr === 'xu-for') {
13771
13655
  if (val?.includes(field_id)) {
13656
+ const parent_element_ui_id = node_id;
13772
13657
 
13773
- const parent_element_ui_id = node_id
13658
+ const _$elem = $(`[xu-ui-id^=${parent_element_ui_id}]`);
13774
13659
 
13660
+ if (refreshed_ids.includes(_$elem.attr('xu-ui-id'))) break;
13775
13661
 
13776
-
13777
- const _$elem = $(`[xu-ui-id^=${parent_element_ui_id}]`)
13778
-
13779
- if (refreshed_ids.includes(_$elem.attr("xu-ui-id"))) break
13780
-
13781
- if (!_$elem?.length) continue
13782
- const _elem_key = parent_element_ui_id
13783
- const _elem_val = { attributes: [], $elm: _$elem }
13662
+ if (!_$elem?.length) continue;
13663
+ const _elem_key = parent_element_ui_id;
13664
+ const _elem_val = { attributes: [], $elm: _$elem };
13784
13665
 
13785
13666
  $.each(_$elem.data()?.xuAttributes, function (key, val) {
13786
13667
  _elem_val.attributes.push(key);
13787
- })
13668
+ });
13788
13669
 
13789
13670
  await func.UI.worker.add_to_queue(
13790
13671
  SESSION_ID,
13791
- "gui event",
13792
- "execute_xu_for",
13672
+ 'gui event',
13673
+ 'execute_xu_for',
13793
13674
  {
13794
13675
  ui_type: _elem_val.$elm.data().xuData.ui_type,
13795
13676
  SESSION_ID,
@@ -13799,98 +13680,77 @@ func.UI.screen.refresh_xu_attributes = async function (
13799
13680
  },
13800
13681
  new_job,
13801
13682
  _elem_val.$elm,
13802
- _elem_val.$elm.data().xuData.paramsP.dsSessionP
13683
+ _elem_val.$elm.data().xuData.paramsP.dsSessionP,
13803
13684
  );
13804
13685
 
13805
- break
13806
-
13686
+ break;
13807
13687
  }
13808
13688
  }
13809
13689
  }
13810
13690
  }
13811
- if (found) break
13691
+ if (found) break;
13812
13692
 
13813
13693
  if (item.children) {
13814
13694
  await iterate_progUi(item.children, item.id);
13815
13695
  }
13816
13696
  }
13817
- }
13818
- await iterate_progUi(progUi)
13819
- return found
13820
- }
13821
-
13822
- const $xu_embed_div = $(".xu_embed_div");
13823
- const panels_obj = func.UI.utils.get_panels_from_dom(SESSION_ID, true)
13697
+ };
13698
+ await iterate_progUi(progUi);
13699
+ return found;
13700
+ };
13824
13701
 
13702
+ const $xu_embed_div = $('.xu_embed_div');
13703
+ const panels_obj = func.UI.utils.get_panels_from_dom(SESSION_ID, true);
13825
13704
 
13826
13705
  for await (const field_id of fields_arr) {
13827
13706
  // run root
13828
13707
  if ($xu_embed_div.length) {
13829
- const progUi = $xu_embed_div?.data()?.xuData?.screenInfo?.progUi
13708
+ const progUi = $xu_embed_div?.data()?.xuData?.screenInfo?.progUi;
13830
13709
  if (progUi) {
13831
- await iterate_field_in_progUi(progUi, field_id)
13710
+ await iterate_field_in_progUi(progUi, field_id);
13832
13711
  }
13833
13712
  }
13834
13713
  // run panels
13835
- for await (const [parent_element_ui_id, panel_val] of Object.entries(
13836
- panels_obj
13837
- )) {
13838
-
13839
- const prog_doc = await func.utils.DOCS_OBJ.get(
13840
- SESSION_ID,
13841
- panel_val._ds.prog_id
13842
- );
13714
+ for await (const [parent_element_ui_id, panel_val] of Object.entries(panels_obj)) {
13715
+ const prog_doc = await func.utils.DOCS_OBJ.get(SESSION_ID, panel_val._ds.prog_id);
13843
13716
 
13844
- await iterate_field_in_progUi(prog_doc.progUi, field_id)
13717
+ await iterate_field_in_progUi(prog_doc.progUi, field_id);
13845
13718
  }
13846
13719
  }
13847
13720
 
13848
13721
  // }
13849
13722
 
13850
-
13851
-
13852
13723
  func.events.delete_job(SESSION_ID, jobNoP);
13853
-
13854
13724
  };
13855
13725
 
13856
-
13857
- func.UI.screen.refresh_screen = async function (
13858
- SESSION_ID,
13859
- fields_changed_arr,
13860
- datasource_changed,
13861
- fields_changed_datasource
13862
- ) {
13863
- const $elm = func.UI.utils.find_in_element_data(
13864
- "xuPanelData",
13865
- $(SESSION_OBJ[SESSION_ID].root_element),
13866
- "parent_element_ui_id"
13867
- );
13726
+ func.UI.screen.refresh_screen = async function (SESSION_ID, fields_changed_arr, datasource_changed, fields_changed_datasource) {
13727
+ const $elm = func.UI.utils.find_in_element_data('xuPanelData', $(SESSION_OBJ[SESSION_ID].root_element), 'parent_element_ui_id');
13868
13728
  // var panels_obj = {};
13869
- const panels_obj = func.UI.utils.get_panels_from_dom(SESSION_ID, false)
13729
+ const panels_obj = func.UI.utils.get_panels_from_dom(SESSION_ID, false);
13870
13730
 
13871
13731
  const find_field_in_progUi = function (progUi, field_id) {
13872
- let found
13732
+ let found;
13873
13733
  const iterate_progUi = function (node) {
13874
13734
  for (let item of node) {
13875
13735
  // if (item.tagName === "xu-panel") {
13876
13736
  if (!_.isEmpty(item.attributes)) {
13877
13737
  for (const [attr, val] of Object.entries(item.attributes)) {
13878
13738
  // if (attr === "xu-exp:program" || attr === "xu-exp:xu-for") {
13879
- if (attr === "xu-exp:program") {
13880
- found = val.includes("@" + field_id)
13739
+ if (attr === 'xu-exp:program') {
13740
+ found = val.includes('@' + field_id);
13881
13741
  }
13882
13742
  }
13883
13743
  }
13884
- if (found) break
13744
+ if (found) break;
13885
13745
  // }
13886
13746
  if (item.children) {
13887
13747
  iterate_progUi(item.children);
13888
13748
  }
13889
13749
  }
13890
- }
13891
- iterate_progUi(progUi)
13892
- return found
13893
- }
13750
+ };
13751
+ iterate_progUi(progUi);
13752
+ return found;
13753
+ };
13894
13754
 
13895
13755
  // // set panels_obj
13896
13756
  // for await (const [elem_key, elem_val] of Object.entries($elm)) {
@@ -13920,13 +13780,8 @@ func.UI.screen.refresh_screen = async function (
13920
13780
  // panels_obj[parent_element_ui_id].ids.push($div.attr("xu-ui-id"));
13921
13781
  // }
13922
13782
 
13923
- for await (const [parent_element_ui_id, panel_val] of Object.entries(
13924
- panels_obj
13925
- )) {
13926
- const prog_doc = await func.utils.DOCS_OBJ.get(
13927
- SESSION_ID,
13928
- panel_val._ds.prog_id
13929
- );
13783
+ for await (const [parent_element_ui_id, panel_val] of Object.entries(panels_obj)) {
13784
+ const prog_doc = await func.utils.DOCS_OBJ.get(SESSION_ID, panel_val._ds.prog_id);
13930
13785
  const progDataSource_str = JSON.stringify(prog_doc.progDataSource);
13931
13786
  // const progUi_str = JSON.stringify(prog_doc.progUi);
13932
13787
 
@@ -13934,58 +13789,48 @@ func.UI.screen.refresh_screen = async function (
13934
13789
 
13935
13790
  var found;
13936
13791
  if (fields_changed_arr) {
13937
- if (
13938
- fields_changed_datasource &&
13939
- panel_val._ds.dsSession < fields_changed_datasource
13940
- ) {
13792
+ if (fields_changed_datasource && panel_val._ds.dsSession < fields_changed_datasource) {
13941
13793
  continue;
13942
13794
  }
13943
13795
  for (const field_id of fields_changed_arr) {
13944
-
13945
13796
  // get panel attributes
13946
- const _attributes =
13947
- panel_val?.$div?.data()?.xuPanelData?.node?.attributes || {};
13797
+ const _attributes = panel_val?.$div?.data()?.xuPanelData?.node?.attributes || {};
13948
13798
 
13949
13799
  // detect if program changed
13950
- found = _attributes["xu-exp:program"]?.includes("@" + field_id);
13800
+ found = _attributes['xu-exp:program']?.includes('@' + field_id);
13951
13801
  if (found) break;
13952
13802
 
13953
-
13954
-
13955
-
13956
13803
  // _attributes holds also info of parameters in code_in: @code
13957
13804
  // search field changed in panel call send parameters exp
13958
13805
  for (const [attr, value] of Object.entries(_attributes)) {
13959
-
13960
13806
  const pattern = /xu-exp:(\w+)/;
13961
13807
  const match = attr.match(pattern);
13962
13808
  // if (!match && value !== "@" + field_id) {
13963
13809
  if (!match) {
13964
13810
  // continue if attribute is not expression
13965
- continue
13811
+ continue;
13966
13812
  }
13967
13813
  // code_in
13968
13814
  const parameter_in_field_id = match?.[1];
13969
13815
  // @code
13970
13816
  if (value.includes(field_id)) {
13971
- // search parameter in field in the target program's progDataSource
13972
- found = progDataSource_str?.includes("@" + parameter_in_field_id);
13973
- if (found) break
13817
+ // search parameter in field in the target program's progDataSource
13818
+ found = progDataSource_str?.includes('@' + parameter_in_field_id);
13819
+ if (found) break;
13974
13820
 
13975
13821
  // found = progUi_str?.includes("@" + parameter_in_field_id);
13976
13822
  // if (found) return false;
13977
13823
 
13978
13824
  // found = find_field_in_progUi(prog_doc.progUi, parameter_in_field_id)
13979
13825
  // if (found) break
13980
-
13981
13826
  }
13982
13827
  }
13983
13828
 
13984
- if (found) break
13829
+ if (found) break;
13985
13830
 
13986
13831
  // search field changed in the target program's progDataSource // @code
13987
- found = progDataSource_str?.includes("@" + field_id);
13988
- if (found) break
13832
+ found = progDataSource_str?.includes('@' + field_id);
13833
+ if (found) break;
13989
13834
 
13990
13835
  // found = progUi_str?.includes("@" + field_id);
13991
13836
  // if (found) return false;
@@ -14013,20 +13858,7 @@ func.UI.screen.refresh_screen = async function (
14013
13858
  // const old_ds = $($org_panel).data().xuData.paramsP.dsSessionP;
14014
13859
  // func.datasource.del(SESSION_ID, old_ds);
14015
13860
 
14016
- const new_$div = await func.UI.screen.render_ui_tree(
14017
- SESSION_ID,
14018
- $div_elm,
14019
- _.cloneDeep(panel_val.$div.data().xuPanelData.node),
14020
- {},
14021
- $div_elm.data().xuData.paramsP,
14022
- null,
14023
- null,
14024
- $div_elm.data().xuData.key,
14025
- null,
14026
- $div_elm.data().xuData.parent_node,
14027
- null,
14028
- $div_elm.data().xuData.$root_container
14029
- );
13861
+ const new_$div = await func.UI.screen.render_ui_tree(SESSION_ID, $div_elm, _.cloneDeep(panel_val.$div.data().xuPanelData.node), {}, $div_elm.data().xuData.paramsP, null, null, $div_elm.data().xuData.key, null, $div_elm.data().xuData.parent_node, null, $div_elm.data().xuData.$root_container);
14030
13862
  // const new_$div = await func.UI.screen.render_ui_tree(
14031
13863
  // SESSION_ID,
14032
13864
  // $div_elm,
@@ -14053,11 +13885,7 @@ func.UI.screen.refresh_screen = async function (
14053
13885
  }
14054
13886
  };
14055
13887
 
14056
- const get_params_obj = async function (
14057
- SESSION_ID,
14058
- prog_id,
14059
- parameters_obj_inP
14060
- ) {
13888
+ const get_params_obj = async function (SESSION_ID, prog_id, parameters_obj_inP) {
14061
13889
  const _prog = await func.utils.VIEWS_OBJ.get(SESSION_ID, prog_id);
14062
13890
  if (!_prog) {
14063
13891
  return;
@@ -14066,66 +13894,42 @@ const get_params_obj = async function (
14066
13894
  // get in parameters
14067
13895
  var params_obj = {};
14068
13896
  if (_prog?.properties?.progParams) {
14069
- for await (const [key, val] of Object.entries(
14070
- _prog.properties.progParams
14071
- )) {
14072
- if (!val.data.dir === "in") continue;
14073
- if (typeof parameters_obj_inP?.[val.data.parameter] !== "undefined") {
13897
+ for await (const [key, val] of Object.entries(_prog.properties.progParams)) {
13898
+ if (!val.data.dir === 'in') continue;
13899
+ if (typeof parameters_obj_inP?.[val.data.parameter] !== 'undefined') {
14074
13900
  if (parameters_obj_inP?.[val.data.parameter].fx) {
14075
- let ret = await func.expression.get(
14076
- SESSION_ID,
14077
- parameters_obj_inP?.[val.data.parameter].fx,
14078
- dsSession,
14079
- "parameters"
14080
- );
13901
+ let ret = await func.expression.get(SESSION_ID, parameters_obj_inP?.[val.data.parameter].fx, dsSession, 'parameters');
14081
13902
  params_obj[val.data.parameter] = ret.result;
14082
13903
  } else {
14083
- params_obj[val.data.parameter] =
14084
- parameters_obj_inP?.[val.data.parameter].value;
13904
+ params_obj[val.data.parameter] = parameters_obj_inP?.[val.data.parameter].value;
14085
13905
  }
14086
13906
  continue;
14087
13907
  }
14088
- console.warn(
14089
- `Warning: Program ${_prog.properties.menuName} expected In parameter: ${val.data.parameter} but received null instead`
14090
- );
13908
+ console.warn(`Warning: Program ${_prog.properties.menuName} expected In parameter: ${val.data.parameter} but received null instead`);
14091
13909
  }
14092
13910
  }
14093
13911
  return params_obj;
14094
13912
  };
14095
- const get_params_obj_new = async function (
14096
- SESSION_ID,
14097
- prog_id,
14098
- nodeP,
14099
- dsSession
14100
- ) {
13913
+ const get_params_obj_new = async function (SESSION_ID, prog_id, nodeP, dsSession) {
14101
13914
  const _prog = await func.utils.VIEWS_OBJ.get(SESSION_ID, prog_id);
14102
13915
  if (!_prog) return;
14103
13916
 
14104
13917
  // get in parameters
14105
13918
  var params_obj = {};
14106
13919
  if (_prog?.properties?.progParams) {
14107
- for await (const [key, val] of Object.entries(
14108
- _prog.properties.progParams
14109
- )) {
14110
- if (!["in", "out"].includes(val.data.dir)) continue;
13920
+ for await (const [key, val] of Object.entries(_prog.properties.progParams)) {
13921
+ if (!['in', 'out'].includes(val.data.dir)) continue;
14111
13922
 
14112
13923
  if (nodeP.attributes) {
14113
13924
  if (nodeP.attributes[val.data.parameter]) {
14114
13925
  params_obj[val.data.parameter] = nodeP.attributes[val.data.parameter];
14115
13926
  } else if (nodeP.attributes[`xu-exp:${val.data.parameter}`]) {
14116
- if (val.data.dir == "out") {
13927
+ if (val.data.dir == 'out') {
14117
13928
  // only reference
14118
- params_obj[val.data.parameter] = nodeP.attributes[
14119
- `xu-exp:${val.data.parameter}`
14120
- ].replaceAll("@", "");
13929
+ params_obj[val.data.parameter] = nodeP.attributes[`xu-exp:${val.data.parameter}`].replaceAll('@', '');
14121
13930
  } else {
14122
13931
  // in parameter
14123
- let ret = await func.expression.get(
14124
- SESSION_ID,
14125
- nodeP.attributes[`xu-exp:${val.data.parameter}`],
14126
- dsSession,
14127
- "parameters"
14128
- );
13932
+ let ret = await func.expression.get(SESSION_ID, nodeP.attributes[`xu-exp:${val.data.parameter}`], dsSession, 'parameters');
14129
13933
  params_obj[val.data.parameter] = ret.result;
14130
13934
  }
14131
13935
  }
@@ -14144,30 +13948,13 @@ const get_params_obj_new = async function (
14144
13948
  // }
14145
13949
  continue;
14146
13950
  }
14147
- console.warn(
14148
- `Warning: Program ${_prog.properties.menuName} expected In parameter: ${val.data.parameter} but received null instead`
14149
- );
13951
+ console.warn(`Warning: Program ${_prog.properties.menuName} expected In parameter: ${val.data.parameter} but received null instead`);
14150
13952
  }
14151
13953
  }
14152
13954
  return params_obj;
14153
13955
  };
14154
13956
 
14155
- func.UI.screen.execute_xu_functions = async function (
14156
- SESSION_ID,
14157
- is_skeleton,
14158
- $root_container,
14159
- nodeP,
14160
- $container,
14161
- paramsP,
14162
- parent_infoP,
14163
- jobNoP,
14164
- keyP,
14165
- parent_nodeP,
14166
- xu_func,
14167
- $elm,
14168
- val,
14169
- is_init
14170
- ) {
13957
+ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, xu_func, $elm, val, is_init) {
14171
13958
  if (is_skeleton) return;
14172
13959
 
14173
13960
  // console.log(nodeP.id, xu_func, val);
@@ -14181,25 +13968,8 @@ func.UI.screen.execute_xu_functions = async function (
14181
13968
  const init_program = async function () {
14182
13969
  async function render_panel() {
14183
13970
  const prog_id = val.value?.prog || val.value;
14184
- const param_obj = await get_params_obj_new(
14185
- SESSION_ID,
14186
- prog_id,
14187
- nodeP,
14188
- paramsP.dsSessionP
14189
- );
14190
- let ret_panel = await func.UI.screen.init(
14191
- SESSION_ID,
14192
- prog_id,
14193
- paramsP.screenId,
14194
- _ds,
14195
- $elm,
14196
- null,
14197
- _ds.currentRecordId,
14198
- null,
14199
- true,
14200
- param_obj,
14201
- "initXu_panel"
14202
- );
13971
+ const param_obj = await get_params_obj_new(SESSION_ID, prog_id, nodeP, paramsP.dsSessionP);
13972
+ let ret_panel = await func.UI.screen.init(SESSION_ID, prog_id, paramsP.screenId, _ds, $elm, null, _ds.currentRecordId, null, true, param_obj, 'initXu_panel');
14203
13973
  ret = { $new_div: ret_panel };
14204
13974
  return ret;
14205
13975
  }
@@ -14210,7 +13980,7 @@ func.UI.screen.execute_xu_functions = async function (
14210
13980
  // }
14211
13981
  if (!val.value) {
14212
13982
  // return render_empty_panel();
14213
- val.value = "_empty_panel_program";
13983
+ val.value = '_empty_panel_program';
14214
13984
  // return { abort: true, program_null: true };
14215
13985
  }
14216
13986
 
@@ -14253,55 +14023,15 @@ func.UI.screen.execute_xu_functions = async function (
14253
14023
  // // func.events.delete_job(SESSION_ID, jobNo);
14254
14024
  // };
14255
14025
  const program = val.value?.prog || val.value;
14256
- var $wrapper = $("<div>");
14257
- var $div = func.UI.screen.create_container(
14258
- SESSION_ID,
14259
- $root_container,
14260
- nodeP,
14261
- $container,
14262
- paramsP,
14263
- parent_infoP,
14264
- jobNoP,
14265
- keyP,
14266
- parent_nodeP,
14267
- nodeP.attributes,
14268
- null,
14269
- null,
14270
- null,
14271
- $wrapper,
14272
- ""
14273
- );
14274
- const param_obj = await get_params_obj_new(
14275
- SESSION_ID,
14276
- program,
14277
- nodeP,
14278
- paramsP.dsSessionP
14279
- );
14280
- let ret_init = await func.UI.screen.init(
14281
- SESSION_ID,
14282
- program,
14283
- paramsP.screenId,
14284
- _ds,
14285
- $div,
14286
- null,
14287
- _ds.currentRecordId,
14288
- jobNoP,
14289
- true,
14290
- param_obj,
14291
- "alterXu_panel"
14292
- );
14026
+ var $wrapper = $('<div>');
14027
+ var $div = func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, nodeP.attributes, null, null, null, $wrapper, '');
14028
+ const param_obj = await get_params_obj_new(SESSION_ID, program, nodeP, paramsP.dsSessionP);
14029
+ let ret_init = await func.UI.screen.init(SESSION_ID, program, paramsP.screenId, _ds, $div, null, _ds.currentRecordId, jobNoP, true, param_obj, 'alterXu_panel');
14293
14030
  ret = {
14294
14031
  $new_div: ret_init,
14295
14032
  abort: true,
14296
14033
  };
14297
- await func.UI.screen.panel_post_render_handler(
14298
- SESSION_ID,
14299
- $elm,
14300
- $new_div,
14301
- nodeP,
14302
- $div.clone(true),
14303
- jobNoP
14304
- );
14034
+ await func.UI.screen.panel_post_render_handler(SESSION_ID, $elm, $new_div, nodeP, $div.clone(true), jobNoP);
14305
14035
 
14306
14036
  return ret;
14307
14037
  }
@@ -14319,8 +14049,8 @@ func.UI.screen.execute_xu_functions = async function (
14319
14049
  return alter_program();
14320
14050
  },
14321
14051
  // programParameters: async function ($elm, val) {},
14322
- "xu-render": async function ($elm, val) {
14323
- let ret = await common_fx["xu-render"]($elm, val);
14052
+ 'xu-render': async function ($elm, val) {
14053
+ let ret = await common_fx['xu-render']($elm, val);
14324
14054
  return ret;
14325
14055
  },
14326
14056
  },
@@ -14329,22 +14059,22 @@ func.UI.screen.execute_xu_functions = async function (
14329
14059
  const load_cdn = async function (resource) {
14330
14060
  // console.log("loading cdn", resource);
14331
14061
  if (!_.isObject(resource) && _.isString(resource)) {
14332
- resource = { src: resource, type: "js" };
14062
+ resource = { src: resource, type: 'js' };
14333
14063
  }
14334
14064
  if (!_.isObject(resource)) {
14335
- throw new Error("cdn resource in wrong format");
14065
+ throw new Error('cdn resource in wrong format');
14336
14066
  }
14337
14067
  return new Promise(async (resolve) => {
14338
14068
  try {
14339
14069
  switch (resource.type) {
14340
- case "js":
14070
+ case 'js':
14341
14071
  await func.utils.load_js_on_demand(resource.src);
14342
14072
  break;
14343
- case "css":
14073
+ case 'css':
14344
14074
  await func.utils.load_js_on_demand(resource.src);
14345
14075
  break;
14346
- case "module":
14347
- func.utils.load_js_on_demand(resource.src, "module");
14076
+ case 'module':
14077
+ func.utils.load_js_on_demand(resource.src, 'module');
14348
14078
  break;
14349
14079
 
14350
14080
  default:
@@ -14353,12 +14083,7 @@ func.UI.screen.execute_xu_functions = async function (
14353
14083
  }
14354
14084
  resolve();
14355
14085
  } catch (error) {
14356
- func.utils.debug_report(
14357
- SESSION_ID,
14358
- "xu-cdn",
14359
- "Fail to load: " + resource,
14360
- "W"
14361
- );
14086
+ func.utils.debug_report(SESSION_ID, 'xu-cdn', 'Fail to load: ' + resource, 'W');
14362
14087
  resolve();
14363
14088
  }
14364
14089
 
@@ -14385,38 +14110,34 @@ func.UI.screen.execute_xu_functions = async function (
14385
14110
  };
14386
14111
 
14387
14112
  const common_fx = {
14388
- "xu-bind": async function ($elm, val) {
14113
+ 'xu-bind': async function ($elm, val) {
14389
14114
  if (is_skeleton) return;
14390
14115
 
14391
14116
  // let view_field_id = val.value;
14392
- let val_is_reference_field = false
14117
+ let val_is_reference_field = false;
14393
14118
 
14394
14119
  let _prog_id = $elm.data().xuData.paramsP.prog_id;
14395
14120
  let _dsP = $elm.data().xuData.paramsP.dsSessionP;
14396
14121
  const view_ret = await func.utils.VIEWS_OBJ.get(SESSION_ID, _prog_id);
14397
14122
  if (!view_ret) return {};
14398
14123
 
14399
- let is_dynamic_field = false
14124
+ let is_dynamic_field = false;
14400
14125
  let field_prop;
14401
14126
  let bind_field_id;
14402
- let bind_field_exp
14127
+ let bind_field_exp;
14403
14128
 
14404
14129
  const get_bind_field = async function (field_id) {
14405
- if (["_FOR_VAL", "_FOR_KEY"].includes(field_id)) {
14406
- is_dynamic_field = true
14407
- field_prop = _ds.dynamic_fields[field_id]
14130
+ if (['_FOR_VAL', '_FOR_KEY'].includes(field_id)) {
14131
+ is_dynamic_field = true;
14132
+ field_prop = _ds.dynamic_fields[field_id];
14408
14133
  } else {
14409
- field_prop = func.common.find_item_by_key(
14410
- view_ret.progFields,
14411
- "field_id",
14412
- field_id
14413
- );
14134
+ field_prop = func.common.find_item_by_key(view_ret.progFields, 'field_id', field_id);
14414
14135
  if (!field_prop) {
14415
14136
  /// find the field everywhere in the chain Aug 30 2024
14416
14137
  const ret_get_value = await func.datasource.get_value(
14417
14138
  SESSION_ID,
14418
14139
  field_id,
14419
- _dsP // $elm.data().xuData.paramsP.dsSessionP
14140
+ _dsP, // $elm.data().xuData.paramsP.dsSessionP
14420
14141
  );
14421
14142
 
14422
14143
  if (ret_get_value.found) {
@@ -14425,44 +14146,33 @@ func.UI.screen.execute_xu_functions = async function (
14425
14146
  _prog_id = _ds.prog_id;
14426
14147
  const view_ret = await func.utils.VIEWS_OBJ.get(SESSION_ID, _prog_id);
14427
14148
  if (!view_ret) return {};
14428
- field_prop = func.common.find_item_by_key(
14429
- view_ret.progFields,
14430
- "field_id",
14431
- field_id
14432
- );
14149
+ field_prop = func.common.find_item_by_key(view_ret.progFields, 'field_id', field_id);
14433
14150
  }
14434
14151
  if (!field_prop) {
14435
- throw (`field ${field_id} not found in the program scope`)
14152
+ throw `field ${field_id} not found in the program scope`;
14436
14153
  }
14437
14154
  }
14438
14155
  }
14439
- return field_id
14440
- }
14156
+ return field_id;
14157
+ };
14441
14158
 
14442
14159
  try {
14443
- bind_field_id = await get_bind_field(val.value)
14444
- val_is_reference_field = true
14160
+ bind_field_id = await get_bind_field(val.value);
14161
+ val_is_reference_field = true;
14445
14162
  } catch (err) {
14446
14163
  try {
14447
- if (!_.isEmpty($elm?.data()?.xuAttributes?.["xu-exp:xu-bind"])) {
14448
- bind_field_exp = $elm.data().xuAttributes["xu-exp:xu-bind"]
14449
- const res = (
14450
- await func.expression.get(
14451
- SESSION_ID,
14452
- bind_field_exp,
14453
- paramsP.dsSessionP,
14454
- "UI Attr EXP"
14455
- )
14456
- )
14164
+ if (!_.isEmpty($elm?.data()?.xuAttributes?.['xu-exp:xu-bind'])) {
14165
+ bind_field_exp = $elm.data().xuAttributes['xu-exp:xu-bind'];
14166
+ const res = await func.expression.get(SESSION_ID, bind_field_exp, paramsP.dsSessionP, 'UI Attr EXP');
14457
14167
 
14458
14168
  if (Object.keys(res.fields).length) {
14459
- const field_id_from_exp = Object.keys(res.fields)[0]
14460
- bind_field_id = await get_bind_field(field_id_from_exp)
14169
+ const field_id_from_exp = Object.keys(res.fields)[0];
14170
+ bind_field_id = await get_bind_field(field_id_from_exp);
14461
14171
  } else {
14462
- throw (err.message)
14172
+ throw err.message;
14463
14173
  }
14464
14174
  } else {
14465
- throw (err.message)
14175
+ throw err.message;
14466
14176
  }
14467
14177
  } catch (err) {
14468
14178
  console.error(err.message);
@@ -14471,20 +14181,12 @@ func.UI.screen.execute_xu_functions = async function (
14471
14181
  // return {};
14472
14182
  }
14473
14183
 
14474
-
14475
14184
  const field_changed = async function (e) {
14476
-
14477
14185
  var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[_dsP];
14478
- var value = await func.common.get_cast_val(
14479
- SESSION_ID,
14480
- "xu-bind",
14481
- "value",
14482
- field_prop.props.fieldType,
14483
- bind.getter($elm[0])
14484
- );
14186
+ var value = await func.common.get_cast_val(SESSION_ID, 'xu-bind', 'value', field_prop.props.fieldType, bind.getter($elm[0]));
14485
14187
 
14486
- if (field_prop.props.fieldType === "object" && !val_is_reference_field) {
14487
- value = bind.getter($elm[0])
14188
+ if (field_prop.props.fieldType === 'object' && !val_is_reference_field) {
14189
+ value = bind.getter($elm[0]);
14488
14190
  }
14489
14191
 
14490
14192
  if (!_ds.currentRecordId) return;
@@ -14498,22 +14200,22 @@ func.UI.screen.execute_xu_functions = async function (
14498
14200
  };
14499
14201
 
14500
14202
  await func.datasource.update(SESSION_ID, datasource_changes);
14501
- const iterate_info = $elm?.data()?.xuData?.iterate_info
14502
- const reference_source_obj = iterate_info?.reference_source_obj
14203
+ const iterate_info = $elm?.data()?.xuData?.iterate_info;
14204
+ const reference_source_obj = iterate_info?.reference_source_obj;
14503
14205
  if (reference_source_obj) {
14504
- if (reference_source_obj.ret.type === "array") {
14206
+ if (reference_source_obj.ret.type === 'array') {
14505
14207
  if (iterate_info.iterator_val === bind_field_id) {
14506
- const arr_idx = Number($elm?.data()?.xuData?.iterate_info._key)
14507
- let new_arr = reference_source_obj.ret.value
14508
- if (field_prop.props.fieldType === "object" && !val_is_reference_field) {
14509
- let obj_item = new_arr[arr_idx]
14510
- let e_exp = bind_field_exp.replace("@_FOR_VAL", "obj_item");
14511
- let new_val = eval(e_exp + `="${value}"`)
14512
- new_arr[arr_idx] = obj_item
14208
+ const arr_idx = Number($elm?.data()?.xuData?.iterate_info._key);
14209
+ let new_arr = reference_source_obj.ret.value;
14210
+ if (field_prop.props.fieldType === 'object' && !val_is_reference_field) {
14211
+ let obj_item = new_arr[arr_idx];
14212
+ let e_exp = bind_field_exp.replace('@_FOR_VAL', 'obj_item');
14213
+ let new_val = eval(e_exp + `="${value}"`);
14214
+ new_arr[arr_idx] = obj_item;
14513
14215
  } else {
14514
- new_arr[arr_idx] = value
14216
+ new_arr[arr_idx] = value;
14515
14217
  }
14516
- datasource_changes[_dsP][_ds.currentRecordId][reference_source_obj.fieldIdP] = new_arr
14218
+ datasource_changes[_dsP][_ds.currentRecordId][reference_source_obj.fieldIdP] = new_arr;
14517
14219
 
14518
14220
  datasource_changes = {
14519
14221
  [_dsP]: {
@@ -14521,18 +14223,13 @@ func.UI.screen.execute_xu_functions = async function (
14521
14223
  [reference_source_obj.fieldIdP]: new_arr,
14522
14224
  },
14523
14225
  },
14524
- }
14226
+ };
14525
14227
  await func.datasource.update(SESSION_ID, datasource_changes, null, true);
14526
14228
  }
14527
14229
  }
14528
14230
  }
14529
14231
 
14530
-
14531
- await func.datasource.update_changes_for_out_parameter(
14532
- SESSION_ID,
14533
- _dsP,
14534
- _ds.parentDataSourceNo
14535
- );
14232
+ await func.datasource.update_changes_for_out_parameter(SESSION_ID, _dsP, _ds.parentDataSourceNo);
14536
14233
  };
14537
14234
 
14538
14235
  const bind = new UI_FRAMEWORK_PLUGIN.bind();
@@ -14540,10 +14237,9 @@ func.UI.screen.execute_xu_functions = async function (
14540
14237
  bind.listener($elm[0], field_changed);
14541
14238
 
14542
14239
  const set_value = function () {
14543
-
14544
14240
  let _ds = SESSION_OBJ[SESSION_ID].DS_GLB[paramsP.dsSessionP];
14545
14241
  if (!_ds.currentRecordId) return;
14546
- let value
14242
+ let value;
14547
14243
  try {
14548
14244
  if (val_is_reference_field) {
14549
14245
  if (is_dynamic_field) {
@@ -14553,36 +14249,29 @@ func.UI.screen.execute_xu_functions = async function (
14553
14249
  value = _ds.data_feed.rows?.[row_idx]?.[val.value];
14554
14250
  }
14555
14251
  } else {
14556
- value = val.value
14252
+ value = val.value;
14557
14253
  }
14558
- if (typeof value === "undefined") return;
14254
+ if (typeof value === 'undefined') return;
14559
14255
  bind.setter($elm[0], value);
14560
14256
  } catch (err) {
14561
14257
  console.error(err);
14562
14258
  }
14563
-
14564
- }
14259
+ };
14565
14260
  /// init value from ds
14566
- $("body").on("xu-bind-refresh." + _ds.dsSession.toString(), () => {
14567
- set_value()
14261
+ $('body').on('xu-bind-refresh.' + _ds.dsSession.toString(), () => {
14262
+ set_value();
14568
14263
  });
14569
14264
  // $("body").trigger("xu-bind-refresh." + _ds.dsSession.toString());
14570
- set_value()
14265
+ set_value();
14571
14266
  return {};
14572
14267
  },
14573
- "xu-render": async function ($elm, val) {
14574
- var value = await func.common.get_cast_val(
14575
- SESSION_ID,
14576
- "common fx",
14577
- "xu-render",
14578
- "bool",
14579
- val.value
14580
- );
14268
+ 'xu-render': async function ($elm, val) {
14269
+ var value = await func.common.get_cast_val(SESSION_ID, 'common fx', 'xu-render', 'bool', val.value);
14581
14270
  const init_render = function () {
14582
14271
  if (!value) {
14583
14272
  var cloned_$div = $elm.clone(true);
14584
14273
 
14585
- let $xurender = $("<xurender>").appendTo($container).hide();
14274
+ let $xurender = $('<xurender>').appendTo($container).hide();
14586
14275
  let original_data_obj = {
14587
14276
  $container: cloned_$div,
14588
14277
  nodeP: _.cloneDeep(nodeP),
@@ -14592,7 +14281,7 @@ func.UI.screen.execute_xu_functions = async function (
14592
14281
  parent_nodeP,
14593
14282
  $root_container,
14594
14283
  };
14595
- $xurender.data("xuData", cloned_$div.data().xuData);
14284
+ $xurender.data('xuData', cloned_$div.data().xuData);
14596
14285
  $xurender.data().xuData.original_data_obj = original_data_obj;
14597
14286
  $xurender.data().xuData.xurender_node = cloned_$div;
14598
14287
  $xurender.data().xuAttributes = nodeP.attributes;
@@ -14624,7 +14313,7 @@ func.UI.screen.execute_xu_functions = async function (
14624
14313
  null,
14625
14314
  original_data_obj.parent_nodeP,
14626
14315
  null,
14627
- original_data_obj.$root_container
14316
+ original_data_obj.$root_container,
14628
14317
  );
14629
14318
 
14630
14319
  new_$div.data().xuData.original_data_obj = original_data_obj;
@@ -14635,25 +14324,12 @@ func.UI.screen.execute_xu_functions = async function (
14635
14324
  $elm.replaceWith(new_$div);
14636
14325
 
14637
14326
  if (val.fields_arr) {
14638
- return await func.UI.screen.refresh_xu_attributes(
14639
- SESSION_ID,
14640
- val.fields_arr,
14641
- val.jobNoP,
14642
- new_$div
14643
- );
14327
+ return await func.UI.screen.refresh_xu_attributes(SESSION_ID, val.fields_arr, val.jobNoP, new_$div);
14644
14328
  }
14645
14329
  func.events.delete_job(SESSION_ID, jobNoP);
14646
14330
  };
14647
14331
 
14648
- if (
14649
- $elm &&
14650
- func.UI.utils.find_in_element_data(
14651
- "xuData",
14652
- $(SESSION_OBJ[SESSION_ID].root_element),
14653
- "xu_id",
14654
- $elm.data().xuData.xu_id
14655
- ).length
14656
- ) {
14332
+ if ($elm && func.UI.utils.find_in_element_data('xuData', $(SESSION_OBJ[SESSION_ID].root_element), 'xu_id', $elm.data().xuData.xu_id).length) {
14657
14333
  if (new_$div.data().xuData.paramsP) {
14658
14334
  return await replace();
14659
14335
  }
@@ -14663,14 +14339,14 @@ func.UI.screen.execute_xu_functions = async function (
14663
14339
  return;
14664
14340
  }
14665
14341
  // if (!value) {
14666
- if ($elm.prop("tagName") === "XURENDER") {
14342
+ if ($elm.prop('tagName') === 'XURENDER') {
14667
14343
  func.events.delete_job(SESSION_ID, jobNoP);
14668
14344
  return;
14669
14345
  }
14670
14346
 
14671
- let tmp_$div = $("<div>");
14347
+ let tmp_$div = $('<div>');
14672
14348
 
14673
- let $xurender = $("<xurender>").appendTo(tmp_$div).hide();
14349
+ let $xurender = $('<xurender>').appendTo(tmp_$div).hide();
14674
14350
  // was true before
14675
14351
  if ($elm.data().xuData.xurender_node) {
14676
14352
  $xurender.data({
@@ -14700,14 +14376,8 @@ func.UI.screen.execute_xu_functions = async function (
14700
14376
  }
14701
14377
  return await post_render();
14702
14378
  },
14703
- "xu-show": async function ($elm, val) {
14704
- var value = await func.common.get_cast_val(
14705
- SESSION_ID,
14706
- "common fx",
14707
- "xu-show",
14708
- "bool",
14709
- val.value
14710
- );
14379
+ 'xu-show': async function ($elm, val) {
14380
+ var value = await func.common.get_cast_val(SESSION_ID, 'common fx', 'xu-show', 'bool', val.value);
14711
14381
  if (value) {
14712
14382
  $elm.show();
14713
14383
  }
@@ -14716,7 +14386,7 @@ func.UI.screen.execute_xu_functions = async function (
14716
14386
  }
14717
14387
  return {};
14718
14388
  },
14719
- "xu-content": async function ($elm, val) {
14389
+ 'xu-content': async function ($elm, val) {
14720
14390
  try {
14721
14391
  $elm.html(val.value);
14722
14392
  } catch (error) {
@@ -14725,7 +14395,7 @@ func.UI.screen.execute_xu_functions = async function (
14725
14395
 
14726
14396
  return {};
14727
14397
  },
14728
- "xu-for": async function ($elm, data) {
14398
+ 'xu-for': async function ($elm, data) {
14729
14399
  // exit if call from rendered xu-for item to prevent infante loop (parent_infoP?.iterate_info indicate call from rendered item)
14730
14400
  if (parent_infoP?.iterate_info) return {};
14731
14401
  if (!data.value) return {};
@@ -14734,107 +14404,76 @@ func.UI.screen.execute_xu_functions = async function (
14734
14404
  let arr = data.value;
14735
14405
 
14736
14406
  // find reference source field
14737
- let reference_source_obj
14407
+ let reference_source_obj;
14738
14408
 
14739
- const _progFields = await func.datasource.get_progFields(
14740
- SESSION_ID,
14741
- paramsP.dsSessionP
14742
- );
14409
+ const _progFields = await func.datasource.get_progFields(SESSION_ID, paramsP.dsSessionP);
14743
14410
 
14744
- let view_field_obj = func.common.find_item_by_key(
14745
- _progFields,
14746
- "field_id",
14747
- data.value
14748
- );
14749
- // detect if data.value (xu-for) is reference field_id by checking if exist in the dataset
14411
+ let view_field_obj = func.common.find_item_by_key(_progFields, 'field_id', data.value);
14412
+ // detect if data.value (xu-for) is reference field_id by checking if exist in the dataset
14750
14413
  if (view_field_obj) {
14751
14414
  // xu-for is reference field_id
14752
- reference_source_obj = await func.datasource.get_value(SESSION_ID, data.value, paramsP.dsSessionP)
14753
- arr = reference_source_obj?.ret?.value
14415
+ reference_source_obj = await func.datasource.get_value(SESSION_ID, data.value, paramsP.dsSessionP);
14416
+ arr = reference_source_obj?.ret?.value;
14754
14417
  } else {
14755
- // xu-for is actual data
14756
- if (typeof data.value === "string") {
14757
- arr = eval(data.value.replaceAll("\\", ""));
14418
+ // xu-for is actual data
14419
+ if (typeof data.value === 'string') {
14420
+ arr = eval(data.value.replaceAll('\\', ''));
14758
14421
  }
14759
- if (typeof arr === "number") {
14422
+ if (typeof arr === 'number') {
14760
14423
  arr = Array.from(Array(arr).keys());
14761
14424
  }
14762
14425
  }
14763
14426
 
14764
- const custom_iterator_key = $elm.data().xuData.iterator_key
14765
- const custom_iterator_val = $elm.data().xuData.iterator_val
14427
+ const custom_iterator_key = $elm.data().xuData.iterator_key;
14428
+ const custom_iterator_val = $elm.data().xuData.iterator_val;
14766
14429
 
14767
- let iterator_key = custom_iterator_key
14768
- let iterator_val = custom_iterator_val
14769
- let is_key_dynamic_field, is_val_dynamic_field
14430
+ let iterator_key = custom_iterator_key;
14431
+ let iterator_val = custom_iterator_val;
14432
+ let is_key_dynamic_field, is_val_dynamic_field;
14770
14433
 
14771
- // custom FOR_VAL name or namespaced default name
14434
+ // custom FOR_VAL name or namespaced default name
14772
14435
  if (!custom_iterator_key) {
14773
- is_key_dynamic_field = true
14436
+ is_key_dynamic_field = true;
14774
14437
 
14775
14438
  // iterator_key = $elm.data().xuData.node_org.id.replaceAll("-", "_") + "_FOR_KEY";
14776
- iterator_key = "_FOR_KEY";
14439
+ iterator_key = '_FOR_KEY';
14777
14440
  }
14778
14441
 
14779
14442
  if (!custom_iterator_val) {
14780
- is_val_dynamic_field = true
14443
+ is_val_dynamic_field = true;
14781
14444
 
14782
14445
  // iterator_val = $elm.data().xuData.node_org.id.replaceAll("-", "_") + "_FOR_VAL";
14783
- iterator_val = "_FOR_VAL";
14446
+ iterator_val = '_FOR_VAL';
14784
14447
  }
14785
14448
 
14786
14449
  var i = 0;
14787
14450
  for await (let [_key, _val] of Object.entries(arr)) {
14788
-
14789
- if (_.isArray(arr)) { _key = Number(_key) }
14451
+ if (_.isArray(arr)) {
14452
+ _key = Number(_key);
14453
+ }
14790
14454
 
14791
14455
  const set_value = async function (is_dynamic_field, currentRecordId, field_id, value) {
14792
-
14793
-
14794
14456
  if (is_dynamic_field) {
14795
-
14796
- func.datasource.add_dynamic_field_to_ds(
14797
- SESSION_ID,
14798
- paramsP.dsSessionP,
14799
- field_id,
14800
- value
14801
- );
14802
-
14457
+ func.datasource.add_dynamic_field_to_ds(SESSION_ID, paramsP.dsSessionP, field_id, value);
14803
14458
  } else {
14459
+ const _progFields = await func.datasource.get_progFields(SESSION_ID, paramsP.dsSessionP);
14804
14460
 
14805
- const _progFields = await func.datasource.get_progFields(
14806
- SESSION_ID,
14807
- paramsP.dsSessionP
14808
- );
14809
-
14810
- let view_field_obj = func.common.find_item_by_key(
14811
- _progFields,
14812
- "field_id",
14813
- field_id
14814
- );
14461
+ let view_field_obj = func.common.find_item_by_key(_progFields, 'field_id', field_id);
14815
14462
  if (view_field_obj) {
14816
14463
  let _ds = SESSION_OBJ[SESSION_ID].DS_GLB[paramsP.dsSessionP];
14817
14464
  try {
14818
- const row_idx = func.common.find_ROWID_idx(
14819
- _ds,
14820
- currentRecordId
14821
- );
14465
+ const row_idx = func.common.find_ROWID_idx(_ds, currentRecordId);
14822
14466
  _ds.data_feed.rows[row_idx][field_id] = value;
14823
14467
  } catch (err) {
14824
14468
  console.error(err);
14825
14469
  }
14826
14470
  } else {
14827
- console.error("field not exist in dataset for xu-for method")
14471
+ console.error('field not exist in dataset for xu-for method');
14828
14472
  }
14829
14473
  }
14830
-
14831
-
14832
14474
  };
14833
14475
 
14834
- var currentRecordId =
14835
- SESSION_OBJ[SESSION_ID].DS_GLB[
14836
- paramsP.dsSessionP
14837
- ].currentRecordId.toString();
14476
+ var currentRecordId = SESSION_OBJ[SESSION_ID].DS_GLB[paramsP.dsSessionP].currentRecordId.toString();
14838
14477
 
14839
14478
  await set_value(is_key_dynamic_field, currentRecordId, iterator_key, _key);
14840
14479
  await set_value(is_val_dynamic_field, currentRecordId, iterator_val, _val);
@@ -14846,10 +14485,10 @@ func.UI.screen.execute_xu_functions = async function (
14846
14485
  iterator_val,
14847
14486
  is_key_dynamic_field,
14848
14487
  is_val_dynamic_field,
14849
- reference_source_obj
14488
+ reference_source_obj,
14850
14489
  };
14851
- let _parent_info = _.cloneDeep(parent_infoP) || {}
14852
- _parent_info.iterate_info = iterate_info
14490
+ let _parent_info = _.cloneDeep(parent_infoP) || {};
14491
+ _parent_info.iterate_info = iterate_info;
14853
14492
  // if (parent_infoP) {
14854
14493
  // _parent_info = iterate_info;
14855
14494
  // } else {
@@ -14861,7 +14500,7 @@ func.UI.screen.execute_xu_functions = async function (
14861
14500
  SESSION_ID,
14862
14501
  $container,
14863
14502
  nodeP,
14864
- _parent_info,//parent_infoP ? _.cloneDeep(_parent_info) : null,
14503
+ _parent_info, //parent_infoP ? _.cloneDeep(_parent_info) : null,
14865
14504
  paramsP,
14866
14505
  jobNoP,
14867
14506
  null,
@@ -14869,7 +14508,7 @@ func.UI.screen.execute_xu_functions = async function (
14869
14508
  null,
14870
14509
  nodeP,
14871
14510
  null,
14872
- $root_container
14511
+ $root_container,
14873
14512
  );
14874
14513
 
14875
14514
  $.each($divP.children(), function (key, val) {
@@ -14883,19 +14522,19 @@ func.UI.screen.execute_xu_functions = async function (
14883
14522
  $elm.remove();
14884
14523
  return { abort: true };
14885
14524
  } catch (e) {
14886
- console.error(" Iterator Arr parse error");
14525
+ console.error(' Iterator Arr parse error');
14887
14526
  return { abort: true };
14888
14527
  }
14889
14528
  },
14890
- "xu-for-key": async function ($elm, val) {
14529
+ 'xu-for-key': async function ($elm, val) {
14891
14530
  $elm.data().xuData.iterator_key = val.value;
14892
14531
  return {};
14893
14532
  },
14894
- "xu-for-val": async function ($elm, val) {
14533
+ 'xu-for-val': async function ($elm, val) {
14895
14534
  $elm.data().xuData.iterator_val = val.value;
14896
14535
  return {};
14897
14536
  },
14898
- "xu-class": async function ($elm, val) {
14537
+ 'xu-class': async function ($elm, val) {
14899
14538
  try {
14900
14539
  let obj = JSON.parse(val.value);
14901
14540
  for await (const [cla, cond] of Object.entries(obj)) {
@@ -14904,8 +14543,8 @@ func.UI.screen.execute_xu_functions = async function (
14904
14543
  SESSION_ID,
14905
14544
  cond,
14906
14545
  paramsP.dsSessionP,
14907
- "UI Attr EXP",
14908
- $elm.data().xuData.currentRecordId // SESSION_OBJ[SESSION_ID].DS_GLB[paramsP.dsSessionP].currentRecordId
14546
+ 'UI Attr EXP',
14547
+ $elm.data().xuData.currentRecordId, // SESSION_OBJ[SESSION_ID].DS_GLB[paramsP.dsSessionP].currentRecordId
14909
14548
  )
14910
14549
  ).result;
14911
14550
  if (res) {
@@ -14916,12 +14555,12 @@ func.UI.screen.execute_xu_functions = async function (
14916
14555
  }
14917
14556
  return {};
14918
14557
  } catch (e) {
14919
- console.warn("parse error:" + val.value);
14558
+ console.warn('parse error:' + val.value);
14920
14559
  return { abort: true };
14921
14560
  }
14922
14561
  },
14923
- "xu-exp": async function ($elm, val) {
14924
- let exp = val.value === null ? true : val.value
14562
+ 'xu-exp': async function ($elm, val) {
14563
+ let exp = val.value === null ? true : val.value;
14925
14564
  // if (val.value.includes("@_FOR_KEY")) {
14926
14565
  // exp = exp.replaceAll("@_FOR_KEY", "@" + $elm.data().xuData.iterate_info.iterator_key);
14927
14566
  // }
@@ -14930,15 +14569,7 @@ func.UI.screen.execute_xu_functions = async function (
14930
14569
  // exp = exp.replaceAll("@_FOR_VAL", "@" + $elm.data().xuData.iterate_info.iterator_val);
14931
14570
  // }
14932
14571
 
14933
-
14934
-
14935
- let exp_ret = await func.expression.get(
14936
- SESSION_ID,
14937
- exp,
14938
- paramsP.dsSessionP,
14939
- "UI Attr EXP",
14940
- SESSION_OBJ[SESSION_ID].DS_GLB[paramsP.dsSessionP].currentRecordId
14941
- );
14572
+ let exp_ret = await func.expression.get(SESSION_ID, exp, paramsP.dsSessionP, 'UI Attr EXP', SESSION_OBJ[SESSION_ID].DS_GLB[paramsP.dsSessionP].currentRecordId);
14942
14573
 
14943
14574
  let value = func.UI.screen.fix_val_defaults(val.key, exp_ret.result);
14944
14575
 
@@ -14947,7 +14578,7 @@ func.UI.screen.execute_xu_functions = async function (
14947
14578
  value,
14948
14579
  };
14949
14580
 
14950
- if (nodeP.tagName.substr(0, 3) === "xu-") {
14581
+ if (nodeP.tagName.substr(0, 3) === 'xu-') {
14951
14582
  if (tag_fx[nodeP.tagName][new_val.key]) {
14952
14583
  return await tag_fx[nodeP.tagName][new_val.key]($elm, new_val);
14953
14584
  }
@@ -14957,7 +14588,7 @@ func.UI.screen.execute_xu_functions = async function (
14957
14588
  $elm.data().xuData.debug_info.attribute_stat[new_val.key] = new_val.value;
14958
14589
 
14959
14590
  // IGNORE UNDEFINED or NULL ATTRIBUTES
14960
- if (typeof new_val.value === "undefined" || new_val.value === null) {
14591
+ if (typeof new_val.value === 'undefined' || new_val.value === null) {
14961
14592
  return {};
14962
14593
  }
14963
14594
 
@@ -14966,77 +14597,40 @@ func.UI.screen.execute_xu_functions = async function (
14966
14597
  return {};
14967
14598
  }
14968
14599
 
14969
- if (new_val.key.substr(0, 2) === "xu") {
14600
+ if (new_val.key.substr(0, 2) === 'xu') {
14970
14601
  return await common_fx[new_val.key]($elm, new_val);
14971
14602
  }
14972
14603
 
14973
- $elm.attr(new_val.key, ($elm.attr(new_val.key) || "") + new_val.value);
14604
+ $elm.attr(new_val.key, ($elm.attr(new_val.key) || '') + new_val.value);
14974
14605
  return {};
14975
14606
  },
14976
- "xu-on": async function ($elm, val) {
14607
+ 'xu-on': async function ($elm, val) {
14977
14608
  CLIENT_ACTIVITY_TS = Date.now();
14978
- const trigger = val.key.split("xu-on:")[1].toLowerCase();
14609
+ const trigger = val.key.split('xu-on:')[1].toLowerCase();
14979
14610
  $elm.on(trigger, async function (e) {
14980
- for await (const [key, val] of Object.entries(
14981
- $elm.data().xuAttributes["xu-on:" + e.type]
14982
- )) {
14983
- if (val.handler === "custom") {
14611
+ for await (const [key, val] of Object.entries($elm.data().xuAttributes['xu-on:' + e.type])) {
14612
+ if (val.handler === 'custom') {
14984
14613
  // do BL
14985
14614
  for await (const [key2, val2] of Object.entries(val.event)) {
14986
14615
  var cond = val2.data.enabled;
14987
14616
  if (val2.data.enabled && val2.props.condition) {
14988
- expCond = await func.expression.get(
14989
- SESSION_ID,
14990
- val2.props.condition,
14991
- paramsP.dsSessionP,
14992
- "condition",
14993
- paramsP.recordid
14994
- ); // execute expression
14617
+ expCond = await func.expression.get(SESSION_ID, val2.props.condition, paramsP.dsSessionP, 'condition', paramsP.recordid); // execute expression
14995
14618
  cond = expCond.result;
14996
14619
  }
14997
14620
  if (!cond) continue;
14998
- func.events.add_to_queue(
14999
- SESSION_ID,
15000
- "element event",
15001
- val2.id,
15002
- e.type,
15003
- val2.data.action,
15004
- val2.data.name,
15005
- null,
15006
- $elm.attr("xu-ui-id"),
15007
- null,
15008
- null,
15009
- null,
15010
- null,
15011
- null,
15012
- paramsP.dsSessionP,
15013
- null,
15014
- null,
15015
- null,
15016
- e.type,
15017
- val2.data.name,
15018
- null,
15019
- null,
15020
- val2,
15021
- null,
15022
- null,
15023
- null,
15024
- null,
15025
- null,
15026
- null
15027
- );
14621
+ func.events.add_to_queue(SESSION_ID, 'element event', val2.id, e.type, val2.data.action, val2.data.name, null, $elm.attr('xu-ui-id'), null, null, null, null, null, paramsP.dsSessionP, null, null, null, e.type, val2.data.name, null, null, val2, null, null, null, null, null, null);
15028
14622
  }
15029
14623
  }
15030
14624
  }
15031
14625
  });
15032
14626
  return {};
15033
14627
  },
15034
- "xu-script": async function ($elm, val) {
14628
+ 'xu-script': async function ($elm, val) {
15035
14629
  var checkExist = setInterval(function () {
15036
- if ($elm.is(":visible")) {
14630
+ if ($elm.is(':visible')) {
15037
14631
  try {
15038
- var res = eval("(" + val.value + ")");
15039
- if (typeof res === "function") {
14632
+ var res = eval('(' + val.value + ')');
14633
+ if (typeof res === 'function') {
15040
14634
  res($elm[0]);
15041
14635
  }
15042
14636
  } catch (e) {
@@ -15049,71 +14643,54 @@ func.UI.screen.execute_xu_functions = async function (
15049
14643
 
15050
14644
  return {};
15051
14645
  },
15052
- "xu-style-global": async function ($elm, val) {
15053
- $("head").append(`<style>${val.value}</style>`);
14646
+ 'xu-style-global': async function ($elm, val) {
14647
+ $('head').append(`<style>${val.value}</style>`);
15054
14648
  return {};
15055
14649
  },
15056
- "xu-style": async function ($elm, val) {
14650
+ 'xu-style': async function ($elm, val) {
15057
14651
  var cssString = val.value;
15058
14652
 
15059
14653
  var parser = new cssjs();
15060
14654
 
15061
14655
  var parsed = parser.parseCSS(cssString);
15062
- var xuUiId = `[xu-ui-id="${$elm.attr("xu-ui-id")}"]`;
14656
+ var xuUiId = `[xu-ui-id="${$elm.attr('xu-ui-id')}"]`;
15063
14657
 
15064
14658
  $.each(parsed, function (key, val) {
15065
- var selectors_arr = val.selector.split(",");
14659
+ var selectors_arr = val.selector.split(',');
15066
14660
 
15067
14661
  $.each(selectors_arr, function (key2, val2) {
15068
14662
  selectors_arr[key2] = `${xuUiId} ${val2}, ${xuUiId}${val2}`;
15069
14663
  // console.log(new_selector);
15070
14664
  });
15071
14665
 
15072
- val.selector = selectors_arr.join(",");
14666
+ val.selector = selectors_arr.join(',');
15073
14667
  // console.log(parsed);
15074
14668
  });
15075
14669
 
15076
14670
  var newCSSString = parser.getCSSForEditor(parsed);
15077
14671
 
15078
- $("head").append(`<style>${newCSSString}</style>`);
14672
+ $('head').append(`<style>${newCSSString}</style>`);
15079
14673
  return {};
15080
14674
  },
15081
- "xu-cdn": async function ($elm, val) {
14675
+ 'xu-cdn': async function ($elm, val) {
15082
14676
  for await (const [key, resource] of Object.entries(val.value)) {
15083
14677
  await load_cdn(resource);
15084
14678
  }
15085
14679
 
15086
14680
  return {};
15087
14681
  },
15088
- "xu-ui-plugin": async function ($elm, val) {
14682
+ 'xu-ui-plugin': async function ($elm, val) {
15089
14683
  var _session = SESSION_OBJ[SESSION_ID];
15090
14684
 
15091
14685
  for await (const [plugin_name, value] of Object.entries(val.value)) {
15092
- const _plugin =
15093
- APP_OBJ[_session.app_id]?.app_plugins_purchased?.[plugin_name];
15094
- if (
15095
- _plugin?.installed &&
15096
- _plugin?.manifest?.["runtime.mjs"]?.exist &&
15097
- _plugin?.manifest?.["index.mjs"]?.exist &&
15098
- value.enabled
15099
- ) {
15100
- if (
15101
- _plugin?.manifest?.["runtime.mjs"].dist &&
15102
- _plugin?.manifest?.["runtime.mjs"]?.css
15103
- ) {
15104
- const plugin_runtime_css_url = await func.utils.get_plugin_npm_cdn(
15105
- SESSION_ID,
15106
- plugin_name,
15107
- "dist/runtime.css"
15108
- );
14686
+ const _plugin = APP_OBJ[_session.app_id]?.app_plugins_purchased?.[plugin_name];
14687
+ if (_plugin?.installed && _plugin?.manifest?.['runtime.mjs']?.exist && _plugin?.manifest?.['index.mjs']?.exist && value.enabled) {
14688
+ if (_plugin?.manifest?.['runtime.mjs'].dist && _plugin?.manifest?.['runtime.mjs']?.css) {
14689
+ const plugin_runtime_css_url = await func.utils.get_plugin_npm_cdn(SESSION_ID, plugin_name, 'dist/runtime.css');
15109
14690
  func.utils.load_css_on_demand(plugin_runtime_css_url);
15110
14691
  }
15111
14692
 
15112
- const plugin_index_src = await func.utils.get_plugin_npm_cdn(
15113
- SESSION_ID,
15114
- plugin_name,
15115
- `${_plugin.manifest["index.mjs"].dist ? "dist/" : ""}index.mjs`
15116
- );
14693
+ const plugin_index_src = await func.utils.get_plugin_npm_cdn(SESSION_ID, plugin_name, `${_plugin.manifest['index.mjs'].dist ? 'dist/' : ''}index.mjs`);
15117
14694
 
15118
14695
  const plugin_index_resources = await import(plugin_index_src);
15119
14696
 
@@ -15122,45 +14699,29 @@ func.UI.screen.execute_xu_functions = async function (
15122
14699
  prop_val.value = value?.attributes?.[prop_name];
15123
14700
  }
15124
14701
 
15125
- const plugin_runtime_src = await func.utils.get_plugin_npm_cdn(
15126
- SESSION_ID,
15127
- plugin_name,
15128
- `${_plugin.manifest["runtime.mjs"].dist ? "dist/" : ""}runtime.mjs`
15129
- );
14702
+ const plugin_runtime_src = await func.utils.get_plugin_npm_cdn(SESSION_ID, plugin_name, `${_plugin.manifest['runtime.mjs'].dist ? 'dist/' : ''}runtime.mjs`);
15130
14703
 
15131
14704
  const plugin_runtime_resources = await import(plugin_runtime_src);
15132
14705
 
15133
- if (
15134
- plugin_runtime_resources.cdn &&
15135
- typeof _.isArray(plugin_runtime_resources.cdn)
15136
- ) {
14706
+ if (plugin_runtime_resources.cdn && typeof _.isArray(plugin_runtime_resources.cdn)) {
15137
14707
  for await (const resource of plugin_runtime_resources.cdn) {
15138
14708
  await load_cdn(resource);
15139
14709
  }
15140
14710
  }
15141
14711
 
15142
14712
  if (plugin_runtime_resources.fn) {
15143
- await plugin_runtime_resources.fn(
15144
- plugin_name,
15145
- $elm?.[0],
15146
- properties
15147
- );
14713
+ await plugin_runtime_resources.fn(plugin_name, $elm?.[0], properties);
15148
14714
  }
15149
14715
  }
15150
14716
  }
15151
14717
 
15152
14718
  return {};
15153
14719
  },
15154
- "xu-store": async function ($elm, val) {
14720
+ 'xu-store': async function ($elm, val) {
15155
14721
  try {
15156
14722
  const fields_obj = JSON5.parse(val.value);
15157
14723
  for (const [field_id, value] of Object.entries(fields_obj)) {
15158
- func.datasource.add_dynamic_field_to_ds(
15159
- SESSION_ID,
15160
- paramsP.dsSessionP,
15161
- field_id,
15162
- value
15163
- );
14724
+ func.datasource.add_dynamic_field_to_ds(SESSION_ID, paramsP.dsSessionP, field_id, value);
15164
14725
  }
15165
14726
  } catch (err) {
15166
14727
  console.error(err);
@@ -15169,8 +14730,8 @@ func.UI.screen.execute_xu_functions = async function (
15169
14730
  },
15170
14731
  };
15171
14732
 
15172
- if (nodeP.tagName.substr(0, 3) === "xu-") {
15173
- if (xu_func === "xu-exp") {
14733
+ if (nodeP.tagName.substr(0, 3) === 'xu-') {
14734
+ if (xu_func === 'xu-exp') {
15174
14735
  return common_fx[xu_func]($elm, val);
15175
14736
  }
15176
14737
 
@@ -15188,7 +14749,7 @@ func.UI.screen.execute_xu_functions = async function (
15188
14749
  if (!$elm.data().xuData.debug_info.attribute_stat) {
15189
14750
  $elm.data().xuData.debug_info.attribute_stat = {};
15190
14751
  }
15191
- if (xu_func !== "xu-exp") {
14752
+ if (xu_func !== 'xu-exp') {
15192
14753
  $elm.data().xuData.debug_info.attribute_stat[xu_func] = val.value;
15193
14754
  }
15194
14755
  try {
@@ -15201,35 +14762,21 @@ func.UI.screen.execute_xu_functions = async function (
15201
14762
  func.UI.screen.fix_val_defaults = function (key, val) {
15202
14763
  var ret = val;
15203
14764
  if (
15204
- key === "xu-render" &&
15205
- (typeof val === "undefined" || val === null) //|| val === ""
14765
+ key === 'xu-render' &&
14766
+ (typeof val === 'undefined' || val === null) //|| val === ""
15206
14767
  ) {
15207
- ret = "Y"; // was ret = "N";
14768
+ ret = 'Y'; // was ret = "N";
15208
14769
  }
15209
14770
  if (
15210
- key === "xu-show" &&
15211
- (typeof val === "undefined" || val === null) //|| val === ""
14771
+ key === 'xu-show' &&
14772
+ (typeof val === 'undefined' || val === null) //|| val === ""
15212
14773
  ) {
15213
- ret = "Y";
14774
+ ret = 'Y';
15214
14775
  }
15215
14776
  return ret;
15216
14777
  };
15217
14778
 
15218
- func.UI.screen.set_attributes_new = async function (
15219
- SESSION_ID,
15220
- is_skeleton,
15221
- $root_container,
15222
- nodeP,
15223
- $container,
15224
- paramsP,
15225
- parent_infoP,
15226
- jobNoP,
15227
- keyP,
15228
- parent_nodeP,
15229
- $elm,
15230
- is_init,
15231
- execute_attributes = []
15232
- ) {
14779
+ func.UI.screen.set_attributes_new = async function (SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $elm, is_init, execute_attributes = []) {
15233
14780
  var done_exp = [];
15234
14781
 
15235
14782
  const _ds = SESSION_OBJ[SESSION_ID].DS_GLB[paramsP.dsSessionP];
@@ -15240,36 +14787,26 @@ func.UI.screen.set_attributes_new = async function (
15240
14787
  const attr = `xu-exp:${attrib}`;
15241
14788
  // const attr = `xu-exp-${attrib}`;
15242
14789
  var value = nodeP.attributes[attr];
15243
- if (!value)
15244
- return func.UI.screen.fix_val_defaults(
15245
- attrib,
15246
- value || nodeP.attributes[attrib]
15247
- );
14790
+ if (!value) return func.UI.screen.fix_val_defaults(attrib, value || nodeP.attributes[attrib]);
15248
14791
 
15249
- var res = await func.expression.get(
15250
- SESSION_ID,
15251
- value,
15252
- paramsP.dsSessionP,
15253
- "UI Attr EXP",
15254
- _ds.currentRecordId
15255
- );
14792
+ var res = await func.expression.get(SESSION_ID, value, paramsP.dsSessionP, 'UI Attr EXP', _ds.currentRecordId);
15256
14793
  nodeP.attributes[attr] = value; //{ value: value, res: res };
15257
14794
  done_exp.push(attr);
15258
14795
  return func.UI.screen.fix_val_defaults(attrib, res.result);
15259
14796
  };
15260
14797
 
15261
14798
  var _ret = {};
15262
- if (nodeP.type !== "element" || !nodeP.attributes) return _ret;
14799
+ if (nodeP.type !== 'element' || !nodeP.attributes) return _ret;
15263
14800
 
15264
14801
  for (let [key, val] of Object.entries(nodeP.attributes)) {
15265
14802
  // REMOVE STATIC ATTRIBUTES IF EXP EXISTS to avoid dup
15266
- if (key.substring(0, 6) === "xu-exp") {
14803
+ if (key.substring(0, 6) === 'xu-exp') {
15267
14804
  if (_.isEmpty(val)) {
15268
14805
  delete nodeP.attributes[key];
15269
- continue
14806
+ continue;
15270
14807
  }
15271
- const clean_key = key.split(":")[1];
15272
- if (typeof nodeP.attributes[clean_key] !== "undefined") {
14808
+ const clean_key = key.split(':')[1];
14809
+ if (typeof nodeP.attributes[clean_key] !== 'undefined') {
15273
14810
  delete nodeP.attributes[clean_key];
15274
14811
  }
15275
14812
  }
@@ -15277,13 +14814,13 @@ func.UI.screen.set_attributes_new = async function (
15277
14814
  if (glb.attr_abbreviations_arr.includes(key)) {
15278
14815
  nodeP.attributes[`xu-on:${key.substring(3)}`] = [
15279
14816
  {
15280
- handler: "custom",
14817
+ handler: 'custom',
15281
14818
  props: {},
15282
14819
  event: [
15283
14820
  {
15284
14821
  id: Date.now(),
15285
14822
  data: {
15286
- action: "update",
14823
+ action: 'update',
15287
14824
  name: { value: val },
15288
14825
  enabled: true,
15289
14826
  },
@@ -15301,7 +14838,7 @@ func.UI.screen.set_attributes_new = async function (
15301
14838
  val = func.UI.screen.fix_val_defaults(key, val);
15302
14839
 
15303
14840
  // REMOVE UNDEFINED or NULL ATTRIBUTES
15304
- if (typeof val === "undefined" || val === null) {
14841
+ if (typeof val === 'undefined' || val === null) {
15305
14842
  delete nodeP.attributes[key];
15306
14843
  }
15307
14844
 
@@ -15315,17 +14852,11 @@ func.UI.screen.set_attributes_new = async function (
15315
14852
 
15316
14853
  for await (const [key, attr] of Object.entries(glb.run_xu_before)) {
15317
14854
  if (_ret.abort) break;
15318
- if (
15319
- glb.html5_events_handler.includes(attr) ||
15320
- execute_attributes.includes(attr)
15321
- ) {
14855
+ if (glb.html5_events_handler.includes(attr) || execute_attributes.includes(attr)) {
15322
14856
  continue;
15323
14857
  }
15324
14858
 
15325
- if (
15326
- !nodeP.attributes ||
15327
- !nodeP.attributes[attr] & !nodeP.attributes[`xu-exp:${attr}`]
15328
- ) {
14859
+ if (!nodeP.attributes || !nodeP.attributes[attr] & !nodeP.attributes[`xu-exp:${attr}`]) {
15329
14860
  continue;
15330
14861
  }
15331
14862
 
@@ -15347,7 +14878,7 @@ func.UI.screen.set_attributes_new = async function (
15347
14878
  // value: _value,
15348
14879
  value: (await get_xuExp(attr)) || nodeP.attributes[attr],
15349
14880
  },
15350
- is_init
14881
+ is_init,
15351
14882
  );
15352
14883
  _ret = _.assignIn(_ret, ret);
15353
14884
  }
@@ -15357,17 +14888,14 @@ func.UI.screen.set_attributes_new = async function (
15357
14888
  // let svg_attributes_str = ""
15358
14889
  for await (const [key, val] of Object.entries(nodeP.attributes)) {
15359
14890
  if (_ret.abort) break;
15360
- if (
15361
- glb.html5_events_handler.includes(key) ||
15362
- execute_attributes.includes(key)
15363
- ) {
14891
+ if (glb.html5_events_handler.includes(key) || execute_attributes.includes(key)) {
15364
14892
  continue;
15365
14893
  }
15366
14894
 
15367
- const new_key = key.split(":")[0]; // break expression
14895
+ const new_key = key.split(':')[0]; // break expression
15368
14896
  if (
15369
- nodeP.tagName !== "xu-panel" && // nodeP.tagName.substr(0, 3) !== "xu-" &&
15370
- (new_key.substr(0, 2) !== "xu" || new_key.substr(2, 1) !== "-")
14897
+ nodeP.tagName !== 'xu-panel' && // nodeP.tagName.substr(0, 3) !== "xu-" &&
14898
+ (new_key.substr(0, 2) !== 'xu' || new_key.substr(2, 1) !== '-')
15371
14899
  ) {
15372
14900
  // handle common html attributes
15373
14901
  try {
@@ -15375,7 +14903,7 @@ func.UI.screen.set_attributes_new = async function (
15375
14903
  // if (nodeP.tagName === "svg") {
15376
14904
  // svg_attributes_str += `${key}="${val}" `
15377
14905
  // } else {
15378
- $elm.get(0).setAttribute(key, val)
14906
+ $elm.get(0).setAttribute(key, val);
15379
14907
  // }
15380
14908
  } catch (err) {
15381
14909
  console.error(err.message);
@@ -15392,16 +14920,11 @@ func.UI.screen.set_attributes_new = async function (
15392
14920
  console.error(error);
15393
14921
  }
15394
14922
 
15395
- if (
15396
- new_key === "xu-exp" ||
15397
- nodeP.attributes["xu-exp:" + new_key] ||
15398
- glb.run_xu_before.includes(new_key) ||
15399
- glb.run_xu_after.includes(new_key)
15400
- ) {
14923
+ if (new_key === 'xu-exp' || nodeP.attributes['xu-exp:' + new_key] || glb.run_xu_before.includes(new_key) || glb.run_xu_after.includes(new_key)) {
15401
14924
  continue;
15402
14925
  }
15403
14926
 
15404
- if (new_key === "xu-on") {
14927
+ if (new_key === 'xu-on') {
15405
14928
  let ret = await func.UI.screen.execute_xu_functions(
15406
14929
  SESSION_ID,
15407
14930
  is_skeleton,
@@ -15413,13 +14936,13 @@ func.UI.screen.set_attributes_new = async function (
15413
14936
  jobNoP,
15414
14937
  keyP,
15415
14938
  parent_nodeP,
15416
- "xu-on",
14939
+ 'xu-on',
15417
14940
  $elm,
15418
14941
  {
15419
14942
  key: key,
15420
14943
  value: (await get_xuExp(new_key)) || val,
15421
14944
  },
15422
- is_init
14945
+ is_init,
15423
14946
  );
15424
14947
  _ret = _.assignIn(_ret, ret);
15425
14948
  continue;
@@ -15442,7 +14965,7 @@ func.UI.screen.set_attributes_new = async function (
15442
14965
  key: key,
15443
14966
  value: (await get_xuExp(new_key)) || val,
15444
14967
  },
15445
- is_init
14968
+ is_init,
15446
14969
  );
15447
14970
 
15448
14971
  _ret = _.assignIn(_ret, ret);
@@ -15452,23 +14975,18 @@ func.UI.screen.set_attributes_new = async function (
15452
14975
  // console.log(svg_attributes_str);
15453
14976
  // }
15454
14977
 
15455
-
15456
14978
  // EXP for
15457
14979
 
15458
14980
  for await (const [key, val] of Object.entries(nodeP.attributes)) {
15459
14981
  if (_ret.abort) break;
15460
14982
 
15461
- const attr = key.split("xu-exp:")[1];
14983
+ const attr = key.split('xu-exp:')[1];
15462
14984
 
15463
14985
  if (!attr) {
15464
14986
  continue;
15465
14987
  }
15466
14988
 
15467
- if (
15468
- glb.html5_events_handler.includes(attr) ||
15469
- execute_attributes.includes(attr)
15470
- )
15471
- continue;
14989
+ if (glb.html5_events_handler.includes(attr) || execute_attributes.includes(attr)) continue;
15472
14990
 
15473
14991
  if (done_exp.includes(key)) {
15474
14992
  continue;
@@ -15484,13 +15002,13 @@ func.UI.screen.set_attributes_new = async function (
15484
15002
  jobNoP,
15485
15003
  keyP,
15486
15004
  parent_nodeP,
15487
- "xu-exp",
15005
+ 'xu-exp',
15488
15006
  $elm,
15489
15007
  {
15490
15008
  key: attr,
15491
15009
  value: val,
15492
15010
  },
15493
- true
15011
+ true,
15494
15012
  );
15495
15013
  _ret = _.assignIn(_ret, ret);
15496
15014
  }
@@ -15498,17 +15016,9 @@ func.UI.screen.set_attributes_new = async function (
15498
15016
  // AFTER
15499
15017
 
15500
15018
  for await (const [key, attr] of Object.entries(glb.run_xu_after)) {
15501
- if (
15502
- glb.html5_events_handler.includes(attr) ||
15503
- execute_attributes.includes(attr)
15504
- )
15505
- continue;
15019
+ if (glb.html5_events_handler.includes(attr) || execute_attributes.includes(attr)) continue;
15506
15020
 
15507
- if (
15508
- !nodeP.attributes ||
15509
- !nodeP.attributes[attr] & !nodeP.attributes[`xu-exp:${attr}`]
15510
- )
15511
- continue;
15021
+ if (!nodeP.attributes || !nodeP.attributes[attr] & !nodeP.attributes[`xu-exp:${attr}`]) continue;
15512
15022
 
15513
15023
  let ret = await func.UI.screen.execute_xu_functions(
15514
15024
  SESSION_ID,
@@ -15527,7 +15037,7 @@ func.UI.screen.set_attributes_new = async function (
15527
15037
  key: attr,
15528
15038
  value: (await get_xuExp(attr)) || nodeP.attributes[attr],
15529
15039
  },
15530
- is_init
15040
+ is_init,
15531
15041
  );
15532
15042
  _ret = _.assignIn(_ret, ret);
15533
15043
  }
@@ -15548,19 +15058,12 @@ func.UI.screen.panel_post_render_handler = async function (
15548
15058
  $wrapper, // the wrapper element contains the rendered panel elements e.g: xu-single-view
15549
15059
  nodeP, // the xu-panel node
15550
15060
  $panel_div, // the panel div
15551
- jobNoP
15061
+ jobNoP,
15552
15062
  ) {
15553
- const _container_ds =
15554
- SESSION_OBJ[SESSION_ID].DS_GLB[$container.data().xuData.paramsP.dsSessionP];
15555
- const _ds =
15556
- SESSION_OBJ[SESSION_ID].DS_GLB[$wrapper.data().xuData.paramsP.dsSessionP];
15063
+ const _container_ds = SESSION_OBJ[SESSION_ID].DS_GLB[$container.data().xuData.paramsP.dsSessionP];
15064
+ const _ds = SESSION_OBJ[SESSION_ID].DS_GLB[$wrapper.data().xuData.paramsP.dsSessionP];
15557
15065
  const find_old_panels_elements = function () {
15558
- return func.UI.utils.find_in_element_data(
15559
- "xuPanelData",
15560
- $container.parent(),
15561
- "xu-ui-id",
15562
- $container.data()?.xuPanelData?.xu_panel_xu_ui_id
15563
- );
15066
+ return func.UI.utils.find_in_element_data('xuPanelData', $container.parent(), 'xu-ui-id', $container.data()?.xuPanelData?.xu_panel_xu_ui_id);
15564
15067
  };
15565
15068
  var $old_panel_div = find_old_panels_elements();
15566
15069
  const set_xuPanelData_to_the_new_rendered_items = (_) => {
@@ -15568,12 +15071,9 @@ func.UI.screen.panel_post_render_handler = async function (
15568
15071
  if (!$(val).data().xuPanelData) {
15569
15072
  $(val).data().xuPanelData = {};
15570
15073
  }
15571
- $(val).data().xuPanelData.parent_element_ui_id = $old_panel_div?.length
15572
- ? $container.parent().data().xuData.ui_id
15573
- : $container.data().xuData.ui_id;
15074
+ $(val).data().xuPanelData.parent_element_ui_id = $old_panel_div?.length ? $container.parent().data().xuData.ui_id : $container.data().xuData.ui_id;
15574
15075
 
15575
- $(val).data().xuPanelData.xu_panel_xu_ui_id =
15576
- (nodeP.xu_tree_id || nodeP.id) + "-" + _container_ds?.currentRecordId;
15076
+ $(val).data().xuPanelData.xu_panel_xu_ui_id = (nodeP.xu_tree_id || nodeP.id) + '-' + _container_ds?.currentRecordId;
15577
15077
  $(val).data().xuPanelData.node = nodeP;
15578
15078
  $(val).data().xuPanelData.$panel_div = $panel_div.clone(true);
15579
15079
  });
@@ -15610,8 +15110,7 @@ func.UI.screen.panel_post_render_handler = async function (
15610
15110
  if (!$wrapper.data()?.xuData?.dsSession) return;
15611
15111
 
15612
15112
  if ($old_panel_div?.length) {
15613
- $container.parent().data().xuData.paramsP.dsSessionP =
15614
- _ds.parentDataSourceNo; // set the new ds when panel replaced
15113
+ $container.parent().data().xuData.paramsP.dsSessionP = _ds.parentDataSourceNo; // set the new ds when panel replaced
15615
15114
  } else {
15616
15115
  $container.data().xuData.paramsP.dsSessionP = _ds.parentDataSourceNo; // set the new ds when panel replaced
15617
15116
  }
@@ -15622,66 +15121,45 @@ func.UI.screen.panel_post_render_handler = async function (
15622
15121
  return jobNoP;
15623
15122
  };
15624
15123
 
15625
- func.UI.screen.create_container = function (
15626
- SESSION_ID,
15627
- $root_container,
15628
- nodeP,
15629
- $container,
15630
- paramsP,
15631
- parent_infoP,
15632
- jobNoP,
15633
- keyP,
15634
- parent_nodeP,
15635
- prop,
15636
- classP,
15637
- elem_propP,
15638
- div_typeP,
15639
- $appendToP,
15640
- attr_str
15641
- ) {
15124
+ func.UI.screen.create_container = function (SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, classP, elem_propP, div_typeP, $appendToP, attr_str) {
15642
15125
  const _paramsP = _.cloneDeep(paramsP);
15643
15126
  var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[_paramsP.dsSessionP];
15644
15127
  var $appendTo = $container;
15645
15128
  if ($appendToP) $appendTo = $appendToP;
15646
15129
  if (!$appendTo || !$appendTo.length) return null; // screen closed or not exist abort build
15647
- var div = "div";
15130
+ var div = 'div';
15648
15131
  if (div_typeP) div = div_typeP;
15649
15132
  var items = [];
15650
15133
  if (nodeP.children)
15651
15134
  items = nodeP.children.map(function (val) {
15652
15135
  return val.xu_tree_id || val.id;
15653
15136
  });
15654
- var currentRecordId = _ds ? _ds.currentRecordId : "";
15137
+ var currentRecordId = _ds ? _ds.currentRecordId : '';
15655
15138
  var xu_id = (glb.screen_num++).toString();
15656
- xu_id = xu_id += "_" + currentRecordId;
15139
+ xu_id = xu_id += '_' + currentRecordId;
15657
15140
 
15658
15141
  try {
15659
-
15660
- const key_path = `${$container?.data()?.xuData?.key_path || "0"}-${keyP || "0"
15661
- }`;
15662
- const elem_key = `${nodeP.xu_tree_id || nodeP.id
15663
- }-${key_path}-${currentRecordId}`;
15664
- let ui_id = `${nodeP.xu_tree_id || nodeP.id}-${elem_key}-${_paramsP?.dsSessionP?.toString() || ""
15665
- }`;
15142
+ const key_path = `${$container?.data()?.xuData?.key_path || '0'}-${keyP || '0'}`;
15143
+ const elem_key = `${nodeP.xu_tree_id || nodeP.id}-${key_path}-${currentRecordId}`;
15144
+ let ui_id = `${nodeP.xu_tree_id || nodeP.id}-${elem_key}-${_paramsP?.dsSessionP?.toString() || ''}`;
15666
15145
 
15667
15146
  /////////////////////////////////
15668
15147
 
15669
- var $div
15670
- if (div === "svg") {
15671
-
15148
+ var $div;
15149
+ if (div === 'svg') {
15672
15150
  const draw_svg = function (element) {
15673
15151
  const get_tag_str = function (element, prop, val) {
15674
- let class_str = "";
15675
- let attr_str = "";
15152
+ let class_str = '';
15153
+ let attr_str = '';
15676
15154
  for (const [key, val] of Object.entries(prop)) {
15677
- if (key.substr(0, 2) !== "xu") {
15155
+ if (key.substr(0, 2) !== 'xu') {
15678
15156
  attr_str += ` ${key}="${val}" `;
15679
15157
  }
15680
15158
  }
15681
- if (element === "svg") {
15159
+ if (element === 'svg') {
15682
15160
  return `<${element} ${attr_str} > `;
15683
15161
  }
15684
- let ret = "";
15162
+ let ret = '';
15685
15163
  if (val?.children?.length) {
15686
15164
  ret = iterate_svg(val);
15687
15165
  }
@@ -15689,9 +15167,9 @@ func.UI.screen.create_container = function (
15689
15167
  return `<${element} ${class_str} ${attr_str} > ${ret} </${element}>`;
15690
15168
  };
15691
15169
  let svg_str = get_tag_str(element, prop);
15692
- let inner_str = "";
15170
+ let inner_str = '';
15693
15171
  const iterate_svg = function (node) {
15694
- let ret = "";
15172
+ let ret = '';
15695
15173
  if (node.children) {
15696
15174
  for (let val of node.children) {
15697
15175
  let prop = val.attributes;
@@ -15702,52 +15180,50 @@ func.UI.screen.create_container = function (
15702
15180
  };
15703
15181
  inner_str = iterate_svg(nodeP);
15704
15182
 
15705
- $div = $(svg_str + inner_str + "</svg>").appendTo($appendTo);
15183
+ $div = $(svg_str + inner_str + '</svg>').appendTo($appendTo);
15706
15184
  };
15707
15185
 
15708
15186
  draw_svg(div_typeP);
15709
15187
  } else {
15710
- $div = $(`<${div} ${attr_str ? attr_str : ""}>`)
15188
+ $div = $(`<${div} ${attr_str ? attr_str : ''}>`);
15711
15189
  }
15712
15190
  // const svgNS = "http://www.w3.org/2000/svg";
15713
15191
  // // $div = $(document.createElementNS(svgNS, "svg"));
15714
15192
  // $div = $(`<${div} ${attr_str ? attr_str : ""} ${svg_attributes_str}>`);
15715
15193
  // } else {
15716
15194
  // $div = $(`<${div} ${attr_str ? attr_str : ""}>`);
15717
- $div
15718
- .attr("xu-ui-id", ui_id)
15719
- .data({
15720
- xuData: {
15721
- prog_id: _paramsP.prog_id,
15722
- nodeid: nodeP.id,
15723
- ui_type: nodeP.tagName,
15724
- xu_id: xu_id,
15725
- recordid: currentRecordId,
15726
- paramsP: _paramsP,
15727
- key: keyP,
15728
- key_path, //:($container?.data()?.xuData?.key || "0") + "-" + (keyP || "0"),
15729
- screenId: _paramsP.screenId,
15730
- parent_container: $container?.attr("id"),
15731
- elem_key,
15732
- ui_id,
15733
- properties: prop,
15734
- node: nodeP,
15735
- node_org: _.cloneDeep(nodeP),
15736
- is_panelP: _paramsP.is_panelP,
15737
-
15738
- elem_prop: elem_propP,
15739
- debug_info: {
15740
- id: nodeP.id,
15741
- parent_id: $container?.data()?.xuData?.ui_id,
15742
- items: items,
15743
- },
15744
- parent_node: parent_nodeP,
15745
- currentRecordId: currentRecordId,
15746
- $root_container: $root_container,
15747
- parent_element_ui_id: $container?.data()?.xuData?.ui_id,
15195
+ $div.attr('xu-ui-id', ui_id).data({
15196
+ xuData: {
15197
+ prog_id: _paramsP.prog_id,
15198
+ nodeid: nodeP.id,
15199
+ ui_type: nodeP.tagName,
15200
+ xu_id: xu_id,
15201
+ recordid: currentRecordId,
15202
+ paramsP: _paramsP,
15203
+ key: keyP,
15204
+ key_path, //:($container?.data()?.xuData?.key || "0") + "-" + (keyP || "0"),
15205
+ screenId: _paramsP.screenId,
15206
+ parent_container: $container?.attr('id'),
15207
+ elem_key,
15208
+ ui_id,
15209
+ properties: prop,
15210
+ node: nodeP,
15211
+ node_org: _.cloneDeep(nodeP),
15212
+ is_panelP: _paramsP.is_panelP,
15213
+
15214
+ elem_prop: elem_propP,
15215
+ debug_info: {
15216
+ id: nodeP.id,
15217
+ parent_id: $container?.data()?.xuData?.ui_id,
15218
+ items: items,
15748
15219
  },
15749
- xuAttributes: {},
15750
- })
15220
+ parent_node: parent_nodeP,
15221
+ currentRecordId: currentRecordId,
15222
+ $root_container: $root_container,
15223
+ parent_element_ui_id: $container?.data()?.xuData?.ui_id,
15224
+ },
15225
+ xuAttributes: {},
15226
+ });
15751
15227
  // }
15752
15228
 
15753
15229
  // $div.appendTo($appendTo);
@@ -15801,10 +15277,9 @@ func.UI.screen.create_container = function (
15801
15277
  // if (div_typeP === "svg") {
15802
15278
  // $div.removeAttr("xu-ui-id")
15803
15279
  // }
15804
- if (div_typeP !== "svg") {
15280
+ if (div_typeP !== 'svg') {
15805
15281
  $div.appendTo($appendTo);
15806
15282
  }
15807
-
15808
15283
  } catch (e) {
15809
15284
  console.error(e);
15810
15285
  }
@@ -15817,14 +15292,7 @@ func.UI.screen.create_container = function (
15817
15292
 
15818
15293
  return $div;
15819
15294
  };
15820
- func.UI.screen.execute_screen_ready_events = async function (
15821
- SESSION_ID,
15822
- paramsP,
15823
- sourceP,
15824
- $div,
15825
- jobNoP,
15826
- $div_objP
15827
- ) {
15295
+ func.UI.screen.execute_screen_ready_events = async function (SESSION_ID, paramsP, sourceP, $div, jobNoP, $div_objP) {
15828
15296
  var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[paramsP.dsSessionP];
15829
15297
  if (!_ds) return;
15830
15298
  var viewEventExec_arr = [];
@@ -15832,13 +15300,7 @@ func.UI.screen.execute_screen_ready_events = async function (
15832
15300
  for await (const val of viewEventExec_arr) {
15833
15301
  cond = val.eventInfo.data.enabled;
15834
15302
  if (val.expression) {
15835
- expCond = await func.expression.get(
15836
- SESSION_ID,
15837
- val.expression,
15838
- paramsP.dsSessionP,
15839
- "condition",
15840
- paramsP.rowIdP
15841
- ); // execute expression
15303
+ expCond = await func.expression.get(SESSION_ID, val.expression, paramsP.dsSessionP, 'condition', paramsP.rowIdP); // execute expression
15842
15304
  cond = expCond.result;
15843
15305
  }
15844
15306
  if (cond) {
@@ -15857,7 +15319,7 @@ func.UI.screen.execute_screen_ready_events = async function (
15857
15319
  null,
15858
15320
  paramsP.dsSessionP,
15859
15321
  val.eventId,
15860
- sourceP + " event",
15322
+ sourceP + ' event',
15861
15323
  true,
15862
15324
  null,
15863
15325
  null,
@@ -15871,7 +15333,7 @@ func.UI.screen.execute_screen_ready_events = async function (
15871
15333
  _ds.prog_id,
15872
15334
  _ds.nodeId,
15873
15335
  _ds.parentDataSourceNo,
15874
- $div
15336
+ $div,
15875
15337
  );
15876
15338
 
15877
15339
  // update changed values to screen added 18/09/13
@@ -15883,43 +15345,20 @@ func.UI.screen.execute_screen_ready_events = async function (
15883
15345
  }
15884
15346
 
15885
15347
  if (_ds?.data_feed?.form_fields_changed?.[current_record_id]) {
15886
- $.each(
15887
- _ds.data_feed.form_fields_changed[current_record_id],
15888
- function (key, val) {
15889
- fields_to_refresh.push(key);
15890
- }
15891
- );
15348
+ $.each(_ds.data_feed.form_fields_changed[current_record_id], function (key, val) {
15349
+ fields_to_refresh.push(key);
15350
+ });
15892
15351
 
15893
15352
  var containerId = _ds.containerId;
15894
- var $container = $("#" + containerId);
15895
- if (
15896
- $container?.data()?.xuData?.is_mobile_modal ||
15897
- $container?.data()?.xuData?.params?.is_mobile_page
15898
- ) {
15899
- await func.UI.screen.refresh_container(
15900
- SESSION_ID,
15901
- "init",
15902
- fields_to_refresh,
15903
- $container,
15904
- paramsP.dsSessionP,
15905
- null
15906
- );
15353
+ var $container = $('#' + containerId);
15354
+ if ($container?.data()?.xuData?.is_mobile_modal || $container?.data()?.xuData?.params?.is_mobile_page) {
15355
+ await func.UI.screen.refresh_container(SESSION_ID, 'init', fields_to_refresh, $container, paramsP.dsSessionP, null);
15907
15356
  } else {
15908
- $container.trigger(containerId + ".refresh", [
15909
- "init",
15910
- fields_to_refresh,
15911
- ]);
15357
+ $container.trigger(containerId + '.refresh', ['init', fields_to_refresh]);
15912
15358
  }
15913
15359
 
15914
15360
  if ($div_objP) {
15915
- await func.UI.screen.refresh_container(
15916
- SESSION_ID,
15917
- "init",
15918
- fields_to_refresh,
15919
- $div_objP,
15920
- paramsP.dsSessionP,
15921
- null
15922
- );
15361
+ await func.UI.screen.refresh_container(SESSION_ID, 'init', fields_to_refresh, $div_objP, paramsP.dsSessionP, null);
15923
15362
  }
15924
15363
  }
15925
15364
  }
@@ -15939,18 +15378,7 @@ func.UI.screen.execute_screen_ready_events = async function (
15939
15378
  if (_.isEmpty(event_obj.triggers)) continue;
15940
15379
 
15941
15380
  if (event_obj.data.condition) {
15942
- let res = await func.expression.get(
15943
- SESSION_ID,
15944
- event_obj.data.condition,
15945
- paramsP.dsSessionP,
15946
- "condition",
15947
- paramsP.rowIdP,
15948
- null,
15949
- null,
15950
- null,
15951
- null,
15952
- event_obj
15953
- );
15381
+ let res = await func.expression.get(SESSION_ID, event_obj.data.condition, paramsP.dsSessionP, 'condition', paramsP.rowIdP, null, null, null, null, event_obj);
15954
15382
  if (!res.result) {
15955
15383
  continue;
15956
15384
  }
@@ -15963,41 +15391,20 @@ func.UI.screen.execute_screen_ready_events = async function (
15963
15391
  continue;
15964
15392
  }
15965
15393
  cond = true;
15966
- if (trigger_obj.props.condition)
15967
- expression = trigger_obj.props.condition;
15394
+ if (trigger_obj.props.condition) expression = trigger_obj.props.condition;
15968
15395
  var expCond = {};
15969
15396
  if (expression) {
15970
- expCond = await func.expression.get(
15971
- SESSION_ID,
15972
- expression,
15973
- paramsP.dsSessionP,
15974
- "condition",
15975
- paramsP.rowIdP,
15976
- trigger_obj.data.type
15977
- ); // execute expression
15397
+ expCond = await func.expression.get(SESSION_ID, expression, paramsP.dsSessionP, 'condition', paramsP.rowIdP, trigger_obj.data.type); // execute expression
15978
15398
  cond = expCond.result;
15979
15399
  expCond.conditional = true;
15980
15400
  }
15981
15401
 
15982
15402
  if (!trigger_obj.data.action) {
15983
- func.utils.debug_report(
15984
- SESSION_ID,
15985
- "get_view_events_count",
15986
- `Error initiating ${typeP} prog: ${_ds.viewSourceDesc} reason: missing action`,
15987
- "E"
15988
- );
15403
+ func.utils.debug_report(SESSION_ID, 'get_view_events_count', `Error initiating ${typeP} prog: ${_ds.viewSourceDesc} reason: missing action`, 'E');
15989
15404
  break;
15990
15405
  }
15991
- if (
15992
- !glb.REFERENCE_LESS_FUNCTIONS.includes(trigger_obj.data.action) &&
15993
- !trigger_obj.data.name?.prog
15994
- ) {
15995
- func.utils.debug_report(
15996
- SESSION_ID,
15997
- "get_view_events_count",
15998
- `Error initiating ${typeP} prog: ${_ds.viewSourceDesc} reason: missing reference`,
15999
- "E"
16000
- );
15406
+ if (!glb.REFERENCE_LESS_FUNCTIONS.includes(trigger_obj.data.action) && !trigger_obj.data.name?.prog) {
15407
+ func.utils.debug_report(SESSION_ID, 'get_view_events_count', `Error initiating ${typeP} prog: ${_ds.viewSourceDesc} reason: missing reference`, 'E');
16001
15408
  break;
16002
15409
  }
16003
15410
 
@@ -16012,41 +15419,24 @@ func.UI.screen.execute_screen_ready_events = async function (
16012
15419
  return viewEventExec_arr.length;
16013
15420
  };
16014
15421
 
16015
- let count = await get_view_events_count("screen_ready");
15422
+ let count = await get_view_events_count('screen_ready');
16016
15423
  if (!count) return;
16017
15424
  return await execute_view_events(sourceP);
16018
15425
  };
16019
- func.UI.screen.screen_loading_done = async function (
16020
- SESSION_ID,
16021
- paramsP,
16022
- $div,
16023
- jobNoP
16024
- ) {
15426
+ func.UI.screen.screen_loading_done = async function (SESSION_ID, paramsP, $div, jobNoP) {
16025
15427
  // await
16026
- func.UI.screen.execute_screen_ready_events(
16027
- SESSION_ID,
16028
- paramsP,
16029
- paramsP.screenInfo.properties?.renderType,
16030
- $div,
16031
- jobNoP
16032
- );
15428
+ func.UI.screen.execute_screen_ready_events(SESSION_ID, paramsP, paramsP.screenInfo.properties?.renderType, $div, jobNoP);
16033
15429
  var _session = SESSION_OBJ[SESSION_ID];
16034
15430
  func.events.delete_job(SESSION_ID, jobNoP);
16035
- func.UI.utils.screen_blocker(
16036
- false,
16037
- paramsP.prog_id + (paramsP.sourceScreenP ? "_" + paramsP.sourceScreenP : "")
16038
- );
15431
+ func.UI.utils.screen_blocker(false, paramsP.prog_id + (paramsP.sourceScreenP ? '_' + paramsP.sourceScreenP : ''));
16039
15432
  if (_session.prog_id === paramsP.prog_id) {
16040
15433
  _session.system_ready = true;
16041
- if (
16042
- _session.engine_mode === "live_preview" &&
16043
- STUDIO_PEER_CONN_SEND_METHOD
16044
- ) {
15434
+ if (_session.engine_mode === 'live_preview' && STUDIO_PEER_CONN_SEND_METHOD) {
16045
15435
  STUDIO_PEER_CONN_SEND_METHOD({
16046
- service: "system_ready",
15436
+ service: 'system_ready',
16047
15437
  data: {},
16048
15438
  id: STUDIO_PEER.id,
16049
- source: "runtime",
15439
+ source: 'runtime',
16050
15440
  session_id: SESSION_ID,
16051
15441
  app_id: _session.app_id,
16052
15442
  gtp_token: _session.gtp_token,
@@ -16059,20 +15449,7 @@ func.UI.screen.screen_loading_done = async function (
16059
15449
  return $div;
16060
15450
  };
16061
15451
 
16062
- func.UI.screen.render_ui_tree = async function (
16063
- SESSION_ID,
16064
- $container,
16065
- nodeP,
16066
- parent_infoP,
16067
- paramsP,
16068
- jobNoP,
16069
- is_skeleton,
16070
- keyP,
16071
- is_mainP,
16072
- parent_nodeP,
16073
- check_existP,
16074
- $root_container
16075
- ) {
15452
+ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, parent_infoP, paramsP, jobNoP, is_skeleton, keyP, is_mainP, parent_nodeP, check_existP, $root_container) {
16076
15453
  if (!is_skeleton) {
16077
15454
  var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[paramsP.dsSessionP];
16078
15455
  }
@@ -16083,29 +15460,16 @@ func.UI.screen.render_ui_tree = async function (
16083
15460
  // debugger;
16084
15461
  }
16085
15462
 
16086
- var is_mobile = glb.MOBILE_ARR.includes(
16087
- paramsP.screenInfo.properties?.menuType
16088
- )
16089
- ? true
16090
- : false;
15463
+ var is_mobile = glb.MOBILE_ARR.includes(paramsP.screenInfo.properties?.menuType) ? true : false;
16091
15464
 
16092
15465
  var get_element_info = function () {
16093
15466
  var ret = {};
16094
- let currentRecordId = _ds?.currentRecordId || "";
15467
+ let currentRecordId = _ds?.currentRecordId || '';
16095
15468
 
16096
- let $div = func.UI.utils.find_in_element_data(
16097
- "xuData",
16098
- $container.parent(),
16099
- "nodeid",
16100
- nodeP.id
16101
- );
15469
+ let $div = func.UI.utils.find_in_element_data('xuData', $container.parent(), 'nodeid', nodeP.id);
16102
15470
 
16103
15471
  $.each($div, function (key, val) {
16104
- if (
16105
- $(val)?.data().xuData?.recordid === currentRecordId &&
16106
- $(val)?.data().xuData?.key === keyP &&
16107
- $(val)?.prop("tagName") !== "XURENDER"
16108
- ) {
15472
+ if ($(val)?.data().xuData?.recordid === currentRecordId && $(val)?.data().xuData?.key === keyP && $(val)?.prop('tagName') !== 'XURENDER') {
16109
15473
  ret = {
16110
15474
  div: $div,
16111
15475
  };
@@ -16121,34 +15485,30 @@ func.UI.screen.render_ui_tree = async function (
16121
15485
  return ret;
16122
15486
  };
16123
15487
  const debug = function (is_errorP, error_descP) {
16124
- func.utils.debug.log(
16125
- SESSION_ID,
16126
- paramsP.prog_id + "_" + nodeP.id_org + "_ui_prop",
16127
- {
16128
- module: "gui",
16129
- action: "init",
16130
- prop: nodeP.id,
16131
- details: error_descP,
16132
- result: null,
16133
- error: is_errorP,
16134
- source: _ds?.tree_obj?.menuName || "",
16135
- fields: null,
16136
- type: null,
16137
- prog_id: paramsP.prog_id,
16138
- dsSession: null,
16139
- }
16140
- );
15488
+ func.utils.debug.log(SESSION_ID, paramsP.prog_id + '_' + nodeP.id_org + '_ui_prop', {
15489
+ module: 'gui',
15490
+ action: 'init',
15491
+ prop: nodeP.id,
15492
+ details: error_descP,
15493
+ result: null,
15494
+ error: is_errorP,
15495
+ source: _ds?.tree_obj?.menuName || '',
15496
+ fields: null,
15497
+ type: null,
15498
+ prog_id: paramsP.prog_id,
15499
+ dsSession: null,
15500
+ });
16141
15501
  };
16142
15502
 
16143
15503
  const open_modal = async function ($div) {
16144
- const modal_id = "app_modal-" + paramsP.dsSessionP.toString();
16145
- var xu_modal_controller = document.querySelector("xu-modal-controller");
15504
+ const modal_id = 'app_modal-' + paramsP.dsSessionP.toString();
15505
+ var xu_modal_controller = document.querySelector('xu-modal-controller');
16146
15506
  if (!xu_modal_controller) {
16147
15507
  func.UI.component.create_app_modal_component(SESSION_ID, modal_id);
16148
- xu_modal_controller = document.querySelector("xu-modal-controller");
15508
+ xu_modal_controller = document.querySelector('xu-modal-controller');
16149
15509
  }
16150
15510
 
16151
- var controller_params = $(xu_modal_controller).data("xuControllerParams");
15511
+ var controller_params = $(xu_modal_controller).data('xuControllerParams');
16152
15512
 
16153
15513
  if (!controller_params) {
16154
15514
  controller_params = {};
@@ -16164,16 +15524,11 @@ func.UI.screen.render_ui_tree = async function (
16164
15524
 
16165
15525
  controller_params[modal_id] = params;
16166
15526
 
16167
- $(xu_modal_controller).data("xuControllerParams", controller_params);
15527
+ $(xu_modal_controller).data('xuControllerParams', controller_params);
16168
15528
  const modalController = await new UI_FRAMEWORK_PLUGIN.modal();
16169
15529
 
16170
15530
  if (!APP_MODAL_OBJ[modal_id]) {
16171
- const modal = await modalController.create(
16172
- SESSION_ID,
16173
- modal_id,
16174
- paramsP.screenInfo,
16175
- close_modal
16176
- );
15531
+ const modal = await modalController.create(SESSION_ID, modal_id, paramsP.screenInfo, close_modal);
16177
15532
  APP_MODAL_OBJ[modal_id] = modal;
16178
15533
  } else {
16179
15534
  $(modal_id).empty();
@@ -16185,14 +15540,10 @@ func.UI.screen.render_ui_tree = async function (
16185
15540
 
16186
15541
  const close_modal = async function (modal_id) {
16187
15542
  delete APP_MODAL_OBJ[modal_id];
16188
- const xu_modal_controller = document.querySelector("xu-modal-controller");
15543
+ const xu_modal_controller = document.querySelector('xu-modal-controller');
16189
15544
  var params = $(xu_modal_controller).data().xuControllerParams[modal_id];
16190
15545
  if (params && params.$container) {
16191
- await func.UI.screen.validate_exit_events(
16192
- SESSION_ID,
16193
- params.$container.data().xuData.paramsP,
16194
- null
16195
- );
15546
+ await func.UI.screen.validate_exit_events(SESSION_ID, params.$container.data().xuData.paramsP, null);
16196
15547
  func.datasource.clean_all(SESSION_ID, params.dsSession);
16197
15548
  }
16198
15549
  };
@@ -16207,17 +15558,16 @@ func.UI.screen.render_ui_tree = async function (
16207
15558
  };
16208
15559
 
16209
15560
  const open_popover = async function ($div) {
16210
- const xu_popover_controller =
16211
- func.UI.component.create_app_popover_component(SESSION_ID);
15561
+ const xu_popover_controller = func.UI.component.create_app_popover_component(SESSION_ID);
16212
15562
 
16213
- $(xu_popover_controller).data("xuControllerParams", {
15563
+ $(xu_popover_controller).data('xuControllerParams', {
16214
15564
  menuTitle: paramsP.screenInfo.properties?.menuTitle,
16215
15565
  screenId: paramsP.screenId,
16216
15566
  $dialogDiv: $div.children(),
16217
15567
  $container: $container,
16218
15568
  });
16219
15569
  const popover = new UI_FRAMEWORK_PLUGIN.popover(
16220
- SESSION_ID
15570
+ SESSION_ID,
16221
15571
  // ELEMENT_CLICK_EVENT,
16222
15572
  // props
16223
15573
  );
@@ -16227,7 +15577,7 @@ func.UI.screen.render_ui_tree = async function (
16227
15577
  return;
16228
15578
  popoverController
16229
15579
  .create({
16230
- component: "xu-popover-content-" + SESSION_ID,
15580
+ component: 'xu-popover-content-' + SESSION_ID,
16231
15581
  event: ELEMENT_CLICK_EVENT,
16232
15582
  translucent: true,
16233
15583
  })
@@ -16239,14 +15589,7 @@ func.UI.screen.render_ui_tree = async function (
16239
15589
  });
16240
15590
  });
16241
15591
  };
16242
- const iterate_child = async function (
16243
- $divP,
16244
- nodeP,
16245
- parent_infoP,
16246
- countP,
16247
- $root_container,
16248
- before_record_function
16249
- ) {
15592
+ const iterate_child = async function ($divP, nodeP, parent_infoP, countP, $root_container, before_record_function) {
16250
15593
  if (!is_mobile && nodeP.busy) return;
16251
15594
  nodeP.busy = true;
16252
15595
  const done = async function ($divP) {
@@ -16260,26 +15603,12 @@ func.UI.screen.render_ui_tree = async function (
16260
15603
  return await done($divP);
16261
15604
  }
16262
15605
 
16263
-
16264
15606
  if (before_record_function) {
16265
15607
  await before_record_function();
16266
15608
  }
16267
15609
  if (nodeP?.children?.length) {
16268
15610
  for await (const [key, val] of Object.entries(nodeP.children)) {
16269
- const ret = await func.UI.screen.render_ui_tree(
16270
- SESSION_ID,
16271
- $divP,
16272
- nodeP.children[key],
16273
- parent_infoP,
16274
- paramsP,
16275
- jobNoP,
16276
- is_skeleton,
16277
- Number(key),
16278
- null,
16279
- nodeP,
16280
- null,
16281
- $root_container
16282
- );
15611
+ const ret = await func.UI.screen.render_ui_tree(SESSION_ID, $divP, nodeP.children[key], parent_infoP, paramsP, jobNoP, is_skeleton, Number(key), null, nodeP, null, $root_container);
16283
15612
  }
16284
15613
  }
16285
15614
  return await done($divP);
@@ -16287,12 +15616,12 @@ func.UI.screen.render_ui_tree = async function (
16287
15616
 
16288
15617
  const _$ = function ($elm) {
16289
15618
  try {
16290
- const id = $elm.attr("xu-ui-id");
15619
+ const id = $elm.attr('xu-ui-id');
16291
15620
  if (!id) return $elm;
16292
15621
  const $el = $(`[xu-ui-id="${id}"]`); // $("#" + id);
16293
15622
 
16294
15623
  if ($el.length > 1) {
16295
- console.warn("Multiple elements for xu-ui-id: " + id, $el);
15624
+ console.warn('Multiple elements for xu-ui-id: ' + id, $el);
16296
15625
  }
16297
15626
 
16298
15627
  return $($el[0]);
@@ -16304,9 +15633,7 @@ func.UI.screen.render_ui_tree = async function (
16304
15633
  const hover_in = function ($div) {
16305
15634
  if (is_skeleton) return;
16306
15635
  CLIENT_ACTIVITY_TS = Date.now();
16307
- if (_$($container)?.data()?.xuData?.debug_info)
16308
- _$($container).data().xuData.debug_info.hover_item =
16309
- $div.attr("xu-ui-id");
15636
+ if (_$($container)?.data()?.xuData?.debug_info) _$($container).data().xuData.debug_info.hover_item = $div.attr('xu-ui-id');
16310
15637
  if (!_ds) return;
16311
15638
  ///////// SET Attributes///////////
16312
15639
  let attributes = {};
@@ -16314,9 +15641,7 @@ func.UI.screen.render_ui_tree = async function (
16314
15641
  attributes[attr.name] = attr.value;
16315
15642
  });
16316
15643
 
16317
- SESSION_OBJ[
16318
- SESSION_ID
16319
- ].DS_GLB[0].data_system.SYS_OBJ_WIN_ELEMENT_HOVERED_ATTRIBUTES = attributes;
15644
+ SESSION_OBJ[SESSION_ID].DS_GLB[0].data_system.SYS_OBJ_WIN_ELEMENT_HOVERED_ATTRIBUTES = attributes;
16320
15645
  //////////////////////////////////
16321
15646
  const _iterate_info = $div.data().xuData.iterate_info;
16322
15647
  if (_iterate_info) {
@@ -16325,8 +15650,7 @@ func.UI.screen.render_ui_tree = async function (
16325
15650
  } else {
16326
15651
  try {
16327
15652
  const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
16328
- _ds.data_feed.rows[row_idx][_iterate_info.iterator_key] =
16329
- _iterate_info._key;
15653
+ _ds.data_feed.rows[row_idx][_iterate_info.iterator_key] = _iterate_info._key;
16330
15654
  } catch (err) {
16331
15655
  console.error(err);
16332
15656
  }
@@ -16337,24 +15661,15 @@ func.UI.screen.render_ui_tree = async function (
16337
15661
  } else {
16338
15662
  try {
16339
15663
  const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
16340
- _ds.data_feed.rows[row_idx][_iterate_info.iterator_val] =
16341
- _iterate_info._val;
15664
+ _ds.data_feed.rows[row_idx][_iterate_info.iterator_val] = _iterate_info._val;
16342
15665
  } catch (err) {
16343
15666
  console.error(err);
16344
15667
  }
16345
15668
  }
16346
15669
  }
16347
15670
 
16348
- if ($div && _$($div) && _ds && paramsP.renderType === "grid") {
16349
- func.UI.worker.add_to_queue(
16350
- SESSION_ID,
16351
- "gui event",
16352
- "update_datasource",
16353
- { currentRecordId: _$($div).data().xuData.currentRecordId },
16354
- null,
16355
- null,
16356
- paramsP.dsSessionP
16357
- );
15671
+ if ($div && _$($div) && _ds && paramsP.renderType === 'grid') {
15672
+ func.UI.worker.add_to_queue(SESSION_ID, 'gui event', 'update_datasource', { currentRecordId: _$($div).data().xuData.currentRecordId }, null, null, paramsP.dsSessionP);
16358
15673
  }
16359
15674
 
16360
15675
  const set_value = function (field_id, value) {
@@ -16362,8 +15677,8 @@ func.UI.screen.render_ui_tree = async function (
16362
15677
 
16363
15678
  func.UI.worker.add_to_queue(
16364
15679
  SESSION_ID,
16365
- "gui event",
16366
- "update_datasource",
15680
+ 'gui event',
15681
+ 'update_datasource',
16367
15682
  {
16368
15683
  currentRecordId,
16369
15684
  field_id,
@@ -16371,7 +15686,7 @@ func.UI.screen.render_ui_tree = async function (
16371
15686
  },
16372
15687
  null,
16373
15688
  null,
16374
- paramsP.dsSessionP
15689
+ paramsP.dsSessionP,
16375
15690
  );
16376
15691
  };
16377
15692
 
@@ -16392,40 +15707,27 @@ func.UI.screen.render_ui_tree = async function (
16392
15707
  _$($container).data().xuData.debug_info.hover_item = null;
16393
15708
  }
16394
15709
  if (_ds?.data_system) {
16395
- SESSION_OBJ[
16396
- SESSION_ID
16397
- ].DS_GLB[0].data_system.SYS_OBJ_WIN_ELEMENT_HOVERED_ATTRIBUTES = {};
15710
+ SESSION_OBJ[SESSION_ID].DS_GLB[0].data_system.SYS_OBJ_WIN_ELEMENT_HOVERED_ATTRIBUTES = {};
16398
15711
  }
16399
15712
  };
16400
15713
  const render_screen_type = async function ($div) {
16401
15714
  const set_call_screen_properties_values = async function (ui_framework) {
16402
15715
  params.properties = {};
16403
15716
  const get_values = async function (property) {
16404
- var property_value =
16405
- paramsP?.screenInfo?.properties?.[property] ||
16406
- paramsP?.screenInfo?.properties?.frameworkProperties?.[property];
15717
+ var property_value = paramsP?.screenInfo?.properties?.[property] || paramsP?.screenInfo?.properties?.frameworkProperties?.[property];
16407
15718
  if (paramsP?.call_screen_propertiesP) {
16408
15719
  if (paramsP.call_screen_propertiesP?.[property]) {
16409
15720
  property_value = paramsP.call_screen_propertiesP[property];
16410
15721
  }
16411
15722
  if (paramsP.call_screen_propertiesP[`xu-exp:${property}`]) {
16412
- property_value = (
16413
- await func.expression.get(
16414
- SESSION_ID,
16415
- paramsP.call_screen_propertiesP[`xu-exp:${property}`],
16416
- paramsP.dsSessionP,
16417
- property
16418
- )
16419
- ).result;
15723
+ property_value = (await func.expression.get(SESSION_ID, paramsP.call_screen_propertiesP[`xu-exp:${property}`], paramsP.dsSessionP, property)).result;
16420
15724
  }
16421
15725
  }
16422
15726
  return property_value;
16423
15727
  };
16424
- params.properties["name"] = await get_values("menuTitle");
15728
+ params.properties['name'] = await get_values('menuTitle');
16425
15729
  if (await ui_framework?.properties()) {
16426
- for await (const [key, val] of Object.entries(
16427
- await ui_framework.properties()
16428
- )) {
15730
+ for await (const [key, val] of Object.entries(await ui_framework.properties())) {
16429
15731
  params.properties[key] = await get_values(key);
16430
15732
  }
16431
15733
  }
@@ -16437,24 +15739,22 @@ func.UI.screen.render_ui_tree = async function (
16437
15739
  if (!$(val)?.data()?.xuData?.parent_container) {
16438
15740
  return true;
16439
15741
  }
16440
- $(val).data().xuData.parent_container =
16441
- $div.data().xuData.parent_container;
15742
+ $(val).data().xuData.parent_container = $div.data().xuData.parent_container;
16442
15743
  });
16443
15744
 
16444
15745
  let $ret = $div;
16445
- var $nav = $(SESSION_OBJ[SESSION_ID].root_element).find("xu-nav");
15746
+ var $nav = $(SESSION_OBJ[SESSION_ID].root_element).find('xu-nav');
16446
15747
  var params;
16447
15748
  switch (paramsP.screen_type) {
16448
- case "modal":
16449
- const modal_id = "app_modal-" + paramsP.dsSessionP.toString();
16450
- var xu_modal_controller = document.querySelector("xu-modal-controller");
15749
+ case 'modal':
15750
+ const modal_id = 'app_modal-' + paramsP.dsSessionP.toString();
15751
+ var xu_modal_controller = document.querySelector('xu-modal-controller');
16451
15752
  if (!xu_modal_controller) {
16452
15753
  func.UI.component.create_app_modal_component(SESSION_ID, modal_id);
16453
- xu_modal_controller = document.querySelector("xu-modal-controller");
15754
+ xu_modal_controller = document.querySelector('xu-modal-controller');
16454
15755
  }
16455
15756
 
16456
- var controller_params =
16457
- $(xu_modal_controller).data("xuControllerParams");
15757
+ var controller_params = $(xu_modal_controller).data('xuControllerParams');
16458
15758
 
16459
15759
  if (!controller_params) {
16460
15760
  controller_params = {};
@@ -16473,7 +15773,7 @@ func.UI.screen.render_ui_tree = async function (
16473
15773
 
16474
15774
  controller_params[modal_id] = params;
16475
15775
 
16476
- $(xu_modal_controller).data("xuControllerParams", controller_params);
15776
+ $(xu_modal_controller).data('xuControllerParams', controller_params);
16477
15777
  const modalController = await new UI_FRAMEWORK_PLUGIN.modal();
16478
15778
  await set_call_screen_properties_values(modalController);
16479
15779
  if (!APP_MODAL_OBJ[modal_id]) {
@@ -16488,11 +15788,10 @@ func.UI.screen.render_ui_tree = async function (
16488
15788
 
16489
15789
  break;
16490
15790
 
16491
- case "popover":
15791
+ case 'popover':
16492
15792
  // open_popover($div);
16493
15793
 
16494
- const xu_popover_controller =
16495
- func.UI.component.create_app_popover_component(SESSION_ID);
15794
+ const xu_popover_controller = func.UI.component.create_app_popover_component(SESSION_ID);
16496
15795
  params = {
16497
15796
  menuTitle: paramsP.screenInfo.properties?.menuTitle,
16498
15797
  screenId: paramsP.screenId,
@@ -16500,19 +15799,16 @@ func.UI.screen.render_ui_tree = async function (
16500
15799
  $container: $container,
16501
15800
  };
16502
15801
 
16503
- $(xu_popover_controller).data("xuControllerParams", params);
15802
+ $(xu_popover_controller).data('xuControllerParams', params);
16504
15803
  const popover = new UI_FRAMEWORK_PLUGIN.popover(SESSION_ID);
16505
15804
  await set_call_screen_properties_values(popover);
16506
15805
  await popover.open(params);
16507
15806
  CURRENT_APP_POPOVER = popover;
16508
15807
 
16509
- func.UI.utils.screen_blocker(
16510
- false,
16511
- paramsP.prog_id + "_" + paramsP.sourceScreenP
16512
- );
15808
+ func.UI.utils.screen_blocker(false, paramsP.prog_id + '_' + paramsP.sourceScreenP);
16513
15809
  break;
16514
15810
 
16515
- case "page":
15811
+ case 'page':
16516
15812
  const nav = $nav[0];
16517
15813
 
16518
15814
  params = {
@@ -16526,38 +15822,31 @@ func.UI.screen.render_ui_tree = async function (
16526
15822
  paramsP,
16527
15823
  };
16528
15824
 
16529
- var component_name = "xu-page-component-" + paramsP.dsSessionP;
15825
+ var component_name = 'xu-page-component-' + paramsP.dsSessionP;
16530
15826
  if (!$(nav).data().xuData.nav_params) {
16531
15827
  $(nav).data().xuData.nav_params = {};
16532
15828
  }
16533
15829
 
16534
15830
  //restore validate
16535
15831
  if ($(nav)?.data()?.xuData?.params?.[paramsP.dsSessionP]) {
16536
- params.$container.data().xuData.validate_screen_ready = $(nav)
16537
- .data()
16538
- .xuData.params[
16539
- paramsP.dsSessionP
16540
- ].$container.data().xuData.validate_screen_ready;
15832
+ params.$container.data().xuData.validate_screen_ready = $(nav).data().xuData.params[paramsP.dsSessionP].$container.data().xuData.validate_screen_ready;
16541
15833
  }
16542
15834
 
16543
15835
  if (!$(nav)?.data()?.xuData) return;
16544
15836
  $(nav).data().xuData.nav_params[paramsP.dsSessionP] = params;
16545
15837
  if (!$(component_name).length) {
16546
- await func.UI.component.create_app_page_component(
16547
- SESSION_ID,
16548
- paramsP.dsSessionP
16549
- );
15838
+ await func.UI.component.create_app_page_component(SESSION_ID, paramsP.dsSessionP);
16550
15839
  const page = new UI_FRAMEWORK_PLUGIN.page();
16551
15840
  await set_call_screen_properties_values(page);
16552
15841
  await page.create(
16553
- params
15842
+ params,
16554
15843
  // SESSION_ID,
16555
15844
  // paramsP.dsSessionP,
16556
15845
  // nav,
16557
15846
  // $nav.data().xuData.nav_params[paramsP.dsSessionP]
16558
15847
  );
16559
15848
  await page.init(
16560
- params
15849
+ params,
16561
15850
  // SESSION_ID,
16562
15851
  // paramsP.dsSessionP,
16563
15852
  // nav,
@@ -16573,7 +15862,7 @@ func.UI.screen.render_ui_tree = async function (
16573
15862
  $div.data().xuData.paramsP = $container.data().xuData.paramsP;
16574
15863
  break;
16575
15864
 
16576
- case "panel":
15865
+ case 'panel':
16577
15866
  $container.append($div_content);
16578
15867
  $ret = $container;
16579
15868
  break;
@@ -16582,14 +15871,14 @@ func.UI.screen.render_ui_tree = async function (
16582
15871
  if ($nav && $nav.length) {
16583
15872
  // refresh made
16584
15873
  } else {
16585
- $nav = $("<xu-nav>");
15874
+ $nav = $('<xu-nav>');
16586
15875
  $container.append($nav);
16587
15876
  func.UI.component.init_xu_nav($container, $nav);
16588
15877
  }
16589
15878
 
16590
15879
  $nav.data().xuData.$div = $div_content;
16591
15880
 
16592
- await $nav[0].setRoot("xu-root-component-" + SESSION_ID);
15881
+ await $nav[0].setRoot('xu-root-component-' + SESSION_ID);
16593
15882
  $ret = $container;
16594
15883
  break;
16595
15884
  }
@@ -16605,31 +15894,15 @@ func.UI.screen.render_ui_tree = async function (
16605
15894
  var exist_elm_obj = get_element_info();
16606
15895
  var $div = exist_elm_obj.div;
16607
15896
  if (!exist_elm_obj.div) {
16608
- $div = func.UI.screen.create_container(
16609
- SESSION_ID,
16610
- $root_container,
16611
- nodeP,
16612
- $container,
16613
- paramsP,
16614
- parent_infoP,
16615
- jobNoP,
16616
- keyP,
16617
- parent_nodeP,
16618
- prop,
16619
- "widget_wrapper",
16620
- null,
16621
- null,
16622
- null,
16623
- null
16624
- );
15897
+ $div = func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, 'widget_wrapper', null, null, null, null);
16625
15898
 
16626
15899
  //////////////////////////
16627
15900
 
16628
- let plugin_name = prop["xu-widget"],
16629
- method = prop["xu-method"],
15901
+ let plugin_name = prop['xu-widget'],
15902
+ method = prop['xu-method'],
16630
15903
  dsP = paramsP.dsSessionP,
16631
15904
  propsP = prop,
16632
- sourceP = "widgets";
15905
+ sourceP = 'widgets';
16633
15906
 
16634
15907
  // const set_SYS_GLOBAL_OBJ_WIDGET_INFO = async function (docP) {
16635
15908
  // var obj = _.clone(docP);
@@ -16654,82 +15927,55 @@ func.UI.screen.render_ui_tree = async function (
16654
15927
  // await func.datasource.update(SESSION_ID, datasource_changes);
16655
15928
  // };
16656
15929
  const call_plugin_api = async function (plugin_nameP, dataP) {
16657
- return await func.utils.call_plugin_api(
16658
- SESSION_ID,
16659
- plugin_nameP,
16660
- dataP
16661
- );
15930
+ return await func.utils.call_plugin_api(SESSION_ID, plugin_nameP, dataP);
16662
15931
  };
16663
15932
  const report_error = function (descP, warn) {
16664
- func.utils.debug.log(
16665
- SESSION_ID,
16666
- _session.DS_GLB[dsP].prog_id +
16667
- "_" +
16668
- _session.DS_GLB[dsP].callingMenuId,
16669
- {
16670
- module: "widgets",
16671
- action: "Init",
15933
+ func.utils.debug.log(SESSION_ID, _session.DS_GLB[dsP].prog_id + '_' + _session.DS_GLB[dsP].callingMenuId, {
15934
+ module: 'widgets',
15935
+ action: 'Init',
15936
+ source: sourceP,
15937
+ prop: descP,
15938
+ details: descP,
15939
+ result: null,
15940
+ error: warn ? false : true,
15941
+ fields: null,
15942
+ type: 'widgets',
15943
+ prog_id: _session.DS_GLB[dsP].prog_id,
15944
+ });
15945
+ };
15946
+ const get_fields_data = async function (fields, props) {
15947
+ const report_error = function (descP, warn) {
15948
+ func.utils.debug.log(SESSION_ID, _session.DS_GLB[dsP].prog_id + '_' + _session.DS_GLB[dsP].callingMenuId, {
15949
+ module: 'widgets',
15950
+ action: 'Init',
16672
15951
  source: sourceP,
16673
15952
  prop: descP,
16674
15953
  details: descP,
16675
15954
  result: null,
16676
15955
  error: warn ? false : true,
16677
15956
  fields: null,
16678
- type: "widgets",
15957
+ type: 'widgets',
16679
15958
  prog_id: _session.DS_GLB[dsP].prog_id,
16680
- }
16681
- );
16682
- };
16683
- const get_fields_data = async function (fields, props) {
16684
- const report_error = function (descP, warn) {
16685
- func.utils.debug.log(
16686
- SESSION_ID,
16687
- _session.DS_GLB[dsP].prog_id +
16688
- "_" +
16689
- _session.DS_GLB[dsP].callingMenuId,
16690
- {
16691
- module: "widgets",
16692
- action: "Init",
16693
- source: sourceP,
16694
- prop: descP,
16695
- details: descP,
16696
- result: null,
16697
- error: warn ? false : true,
16698
- fields: null,
16699
- type: "widgets",
16700
- prog_id: _session.DS_GLB[dsP].prog_id,
16701
- }
16702
- );
15959
+ });
16703
15960
  };
16704
15961
  const get_property_value = async function (fieldIdP, val) {
16705
15962
  if (!val) return;
16706
- var value =
16707
- props[fieldIdP] ||
16708
- (typeof val.defaultValue === "function"
16709
- ? val?.defaultValue?.()
16710
- : val?.defaultValue);
16711
- if (val.render === "eventId") {
15963
+ var value = props[fieldIdP] || (typeof val.defaultValue === 'function' ? val?.defaultValue?.() : val?.defaultValue);
15964
+ if (val.render === 'eventId') {
16712
15965
  value = props?.[fieldIdP]?.event;
16713
15966
  }
16714
15967
 
16715
15968
  if (props[`xu-exp:${fieldIdP}`]) {
16716
- value = (
16717
- await func.expression.get(
16718
- SESSION_ID,
16719
- props[`xu-exp:${fieldIdP}`],
16720
- dsP,
16721
- "widget property"
16722
- )
16723
- ).result;
15969
+ value = (await func.expression.get(SESSION_ID, props[`xu-exp:${fieldIdP}`], dsP, 'widget property')).result;
16724
15970
  }
16725
15971
 
16726
15972
  return func.common.get_cast_val(
16727
15973
  SESSION_ID,
16728
- "widgets",
15974
+ 'widgets',
16729
15975
  fieldIdP,
16730
15976
  val.type, //val.type !== "string" || val.type !== "number" ? "string" : val.type,
16731
15977
  value,
16732
- null
15978
+ null,
16733
15979
  );
16734
15980
  };
16735
15981
  var data_obj = {};
@@ -16744,7 +15990,7 @@ func.UI.screen.render_ui_tree = async function (
16744
15990
  }
16745
15991
  // console.log(val);
16746
15992
  }
16747
- for await (const key of ["xu-bind"]) {
15993
+ for await (const key of ['xu-bind']) {
16748
15994
  data_obj[key] = await get_property_value(key, props[key]);
16749
15995
  }
16750
15996
 
@@ -16752,32 +15998,24 @@ func.UI.screen.render_ui_tree = async function (
16752
15998
  };
16753
15999
 
16754
16000
  const load_css_style = function () {
16755
- let path = get_path("style.css");
16001
+ let path = get_path('style.css');
16756
16002
  func.utils.load_css_on_demand(path);
16757
16003
  };
16758
16004
 
16759
16005
  const get_path = function (resource) {
16760
- if (_session.worker_type === "Dev") {
16006
+ if (_session.worker_type === 'Dev') {
16761
16007
  return `../../plugins/${plugin_name}/${resource}`;
16762
16008
  }
16763
16009
  return `https://${_session.domain}/plugins/${plugin_name}/${resource}?gtp_token=${_session.gtp_token}&app_id=${_session.app_id}`;
16764
16010
  };
16765
- const _plugin =
16766
- APP_OBJ[_session.app_id]?.app_plugins_purchased?.[plugin_name];
16767
- const index = await func.utils.get_plugin_resource(
16768
- SESSION_ID,
16769
- plugin_name,
16770
- `${_plugin.manifest["index.mjs"].dist ? "dist/" : ""}index.mjs`
16771
- );
16011
+ const _plugin = APP_OBJ[_session.app_id]?.app_plugins_purchased?.[plugin_name];
16012
+ const index = await func.utils.get_plugin_resource(SESSION_ID, plugin_name, `${_plugin.manifest['index.mjs'].dist ? 'dist/' : ''}index.mjs`);
16772
16013
  const methods = index.methods;
16773
16014
  if (methods && !methods[method]) {
16774
- return report_error("method not found");
16015
+ return report_error('method not found');
16775
16016
  }
16776
16017
 
16777
- const fields_ret = await get_fields_data(
16778
- methods[method].fields,
16779
- propsP
16780
- );
16018
+ const fields_ret = await get_fields_data(methods[method].fields, propsP);
16781
16019
  if (fields_ret.code < 0) {
16782
16020
  return report_error(fields_ret.data);
16783
16021
  }
@@ -16785,65 +16023,37 @@ func.UI.screen.render_ui_tree = async function (
16785
16023
 
16786
16024
  let exclude_attributes = [];
16787
16025
  for await (const [key, val] of Object.entries(propsP)) {
16788
- if (
16789
- typeof fields[key] !== "undefined" ||
16790
- typeof fields[`xu-exp:${key}`] !== "undefined"
16791
- ) {
16026
+ if (typeof fields[key] !== 'undefined' || typeof fields[`xu-exp:${key}`] !== 'undefined') {
16792
16027
  exclude_attributes.push(key);
16793
16028
  }
16794
16029
  }
16795
16030
 
16796
- let ret = await func.UI.screen.set_attributes_new(
16797
- SESSION_ID,
16798
- is_skeleton,
16799
- $root_container,
16800
- nodeP,
16801
- $container,
16802
- paramsP,
16803
- parent_infoP,
16804
- jobNoP,
16805
- keyP,
16806
- parent_nodeP,
16807
- $div,
16808
- true,
16809
- exclude_attributes
16810
- );
16031
+ let ret = await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $div, true, exclude_attributes);
16811
16032
 
16812
- $div.addClass("widget_wrapper"); // class get override in set_attributes_new
16033
+ $div.addClass('widget_wrapper'); // class get override in set_attributes_new
16813
16034
 
16814
16035
  if (!APP_OBJ[_session.app_id].app_plugins_purchased[plugin_name]) {
16815
16036
  return report_error(`plugin ${plugin_name} not found`);
16816
16037
  }
16817
16038
 
16818
- if (
16819
- APP_OBJ[_session.app_id].app_plugins_purchased[plugin_name].manifest[
16820
- "style.css"
16821
- ].exist
16822
- ) {
16039
+ if (APP_OBJ[_session.app_id].app_plugins_purchased[plugin_name].manifest['style.css'].exist) {
16823
16040
  load_css_style();
16824
16041
  }
16825
16042
 
16826
- const plugin_setup_ret = await func.utils.get_plugin_setup(
16827
- SESSION_ID,
16828
- plugin_name
16829
- );
16043
+ const plugin_setup_ret = await func.utils.get_plugin_setup(SESSION_ID, plugin_name);
16830
16044
  if (plugin_setup_ret.code < 0) {
16831
16045
  return report_error(plugin_setup_ret);
16832
16046
  }
16833
16047
 
16834
- const api_utils = await func.common.get_module(
16048
+ const api_utils = await func.common.get_module(SESSION_ID, 'xuda-api-library.mjs', {
16049
+ func,
16050
+ glb,
16051
+ SESSION_OBJ,
16835
16052
  SESSION_ID,
16836
- "xuda-api-library.mjs",
16837
- {
16838
- func,
16839
- glb,
16840
- SESSION_OBJ,
16841
- SESSION_ID,
16842
- APP_OBJ,
16843
- dsSession: paramsP.dsSessionP,
16844
- job_id: jobNoP,
16845
- }
16846
- );
16053
+ APP_OBJ,
16054
+ dsSession: paramsP.dsSessionP,
16055
+ job_id: jobNoP,
16056
+ });
16847
16057
 
16848
16058
  const params = {
16849
16059
  SESSION_ID,
@@ -16862,21 +16072,10 @@ func.UI.screen.render_ui_tree = async function (
16862
16072
  api_utils,
16863
16073
  };
16864
16074
 
16865
- const fx = await func.utils.get_plugin_resource(
16866
- SESSION_ID,
16867
- plugin_name,
16868
- `${_plugin.manifest["runtime.mjs"].dist ? "dist/" : ""}runtime.mjs`
16869
- );
16075
+ const fx = await func.utils.get_plugin_resource(SESSION_ID, plugin_name, `${_plugin.manifest['runtime.mjs'].dist ? 'dist/' : ''}runtime.mjs`);
16870
16076
 
16871
- if (
16872
- _plugin?.manifest?.["runtime.mjs"].dist &&
16873
- _plugin?.manifest?.["runtime.mjs"]?.css
16874
- ) {
16875
- const plugin_runtime_css_url = await func.utils.get_plugin_npm_cdn(
16876
- SESSION_ID,
16877
- plugin_name,
16878
- "dist/runtime.css"
16879
- );
16077
+ if (_plugin?.manifest?.['runtime.mjs'].dist && _plugin?.manifest?.['runtime.mjs']?.css) {
16078
+ const plugin_runtime_css_url = await func.utils.get_plugin_npm_cdn(SESSION_ID, plugin_name, 'dist/runtime.css');
16880
16079
  func.utils.load_css_on_demand(plugin_runtime_css_url);
16881
16080
  }
16882
16081
 
@@ -16886,12 +16085,7 @@ func.UI.screen.render_ui_tree = async function (
16886
16085
  try {
16887
16086
  await fx[method](fields, params);
16888
16087
  } catch (err) {
16889
- func.utils.debug_report(
16890
- SESSION_ID,
16891
- `${plugin_name} widget`,
16892
- err.message,
16893
- "E"
16894
- );
16088
+ func.utils.debug_report(SESSION_ID, `${plugin_name} widget`, err.message, 'E');
16895
16089
  }
16896
16090
 
16897
16091
  // glb.lifecycle.plugins[plugin_name] = {
@@ -16914,35 +16108,16 @@ func.UI.screen.render_ui_tree = async function (
16914
16108
  var exist_elm_obj = get_element_info();
16915
16109
  var $div = exist_elm_obj.div;
16916
16110
  if (!exist_elm_obj.div) {
16917
- var $wrapper = $("<div>");
16918
- $div = func.UI.screen.create_container(
16919
- SESSION_ID,
16920
- $root_container,
16921
- nodeP,
16922
- $container,
16923
- paramsP,
16924
- parent_infoP,
16925
- jobNoP,
16926
- keyP,
16927
- parent_nodeP,
16928
- prop,
16929
- null,
16930
- null,
16931
- "div",
16932
- $wrapper,
16933
- ""
16934
- );
16111
+ var $wrapper = $('<div>');
16112
+ $div = func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, null, null, 'div', $wrapper, '');
16935
16113
 
16936
16114
  if (paramsP.is_panelP) {
16937
- var id = $div.attr("id");
16115
+ var id = $div.attr('id');
16938
16116
  }
16939
16117
 
16940
16118
  if (!$div) return;
16941
16119
 
16942
- if (
16943
- !REFRESHER_IN_PROGRESS &&
16944
- (paramsP.is_mobile_popover || paramsP.is_mobile_page)
16945
- ) {
16120
+ if (!REFRESHER_IN_PROGRESS && (paramsP.is_mobile_popover || paramsP.is_mobile_page)) {
16946
16121
  close_all_modals();
16947
16122
  }
16948
16123
 
@@ -16952,26 +16127,13 @@ func.UI.screen.render_ui_tree = async function (
16952
16127
  },
16953
16128
  function (e) {
16954
16129
  hover_out();
16955
- }
16130
+ },
16956
16131
  );
16957
16132
  }
16958
16133
 
16959
16134
  const ret = await iterate_child($div, nodeP, null, null, $div);
16960
16135
  if ($container.data().xuAttributes) {
16961
- await func.UI.screen.set_attributes_new(
16962
- SESSION_ID,
16963
- is_skeleton,
16964
- $root_container,
16965
- nodeP,
16966
- $container,
16967
- paramsP,
16968
- parent_infoP,
16969
- jobNoP,
16970
- keyP,
16971
- parent_nodeP,
16972
- $container,
16973
- true
16974
- );
16136
+ await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $container, true);
16975
16137
  }
16976
16138
 
16977
16139
  $.each($div.data().xuData, function (key, val) {
@@ -17111,25 +16273,12 @@ func.UI.screen.render_ui_tree = async function (
17111
16273
  // }
17112
16274
 
17113
16275
  if (paramsP.screenInfo.properties?.rtl) {
17114
- $div_content.attr("dir", "rtl");
16276
+ $div_content.attr('dir', 'rtl');
17115
16277
  }
17116
16278
 
17117
16279
  return $div;
17118
16280
  };
17119
- await func.UI.screen.set_attributes_new(
17120
- SESSION_ID,
17121
- is_skeleton,
17122
- $root_container,
17123
- nodeP,
17124
- $container,
17125
- paramsP,
17126
- parent_infoP,
17127
- jobNoP,
17128
- keyP,
17129
- parent_nodeP,
17130
- $container,
17131
- true
17132
- );
16281
+ await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $container, true);
17133
16282
  // var $div_content = $div.children();
17134
16283
 
17135
16284
  // if (continuous_idx !== null || !prop.app_items_per_page) {
@@ -17168,55 +16317,35 @@ func.UI.screen.render_ui_tree = async function (
17168
16317
  return await render_screen_type($div);
17169
16318
  };
17170
16319
 
17171
- if (
17172
- !REFRESHER_IN_PROGRESS &&
17173
- (paramsP.is_mobile_popover || paramsP.is_mobile_page)
17174
- ) {
16320
+ if (!REFRESHER_IN_PROGRESS && (paramsP.is_mobile_popover || paramsP.is_mobile_page)) {
17175
16321
  close_all_modals();
17176
16322
  }
17177
16323
 
17178
16324
  const empty_result = async function () {
17179
- var content = prop.empty_result_content || "";
16325
+ var content = prop.empty_result_content || '';
17180
16326
 
17181
16327
  var res = await func.expression.get(
17182
16328
  SESSION_ID,
17183
16329
  content, // prop["xu-exp:empty_result_content"],
17184
16330
  paramsP.dsSessionP,
17185
- "empty_result_content_EXP",
17186
- _ds.currentRecordId
16331
+ 'empty_result_content_EXP',
16332
+ _ds.currentRecordId,
17187
16333
  );
17188
16334
  content = res.result;
17189
16335
  // }
17190
16336
 
17191
16337
  let empty_result_node = {
17192
- type: "element",
16338
+ type: 'element',
17193
16339
  id: crypto.randomUUID(),
17194
16340
  content,
17195
16341
  // : content || (typeof content === "undefined" && "Empty results"),
17196
- tagName: "div",
16342
+ tagName: 'div',
17197
16343
  attributes: {},
17198
16344
  children: [],
17199
16345
  };
17200
16346
 
17201
- const ret = await func.UI.screen.render_ui_tree(
17202
- SESSION_ID,
17203
- $container,
17204
- empty_result_node,
17205
- parent_infoP,
17206
- paramsP,
17207
- jobNoP,
17208
- null,
17209
- 0,
17210
- null,
17211
- nodeP,
17212
- null,
17213
- $root_container
17214
- );
17215
- await func.events.validate(
17216
- SESSION_ID,
17217
- "record_not_found",
17218
- paramsP.dsSessionP
17219
- );
16347
+ const ret = await func.UI.screen.render_ui_tree(SESSION_ID, $container, empty_result_node, parent_infoP, paramsP, jobNoP, null, 0, null, nodeP, null, $root_container);
16348
+ await func.events.validate(SESSION_ID, 'record_not_found', paramsP.dsSessionP);
17220
16349
  return await done(null);
17221
16350
 
17222
16351
  // var text = "";
@@ -17282,29 +16411,10 @@ func.UI.screen.render_ui_tree = async function (
17282
16411
  // }
17283
16412
  ////////
17284
16413
  _ds.currentRecordId = val._ROWID;
17285
- const ret = await iterate_child(
17286
- $div,
17287
- node,
17288
- { continuous_idx },
17289
- null,
17290
- $root_container
17291
- );
16414
+ const ret = await iterate_child($div, node, { continuous_idx }, null, $root_container);
17292
16415
 
17293
16416
  if ($container.data().xuAttributes) {
17294
- await func.UI.screen.set_attributes_new(
17295
- SESSION_ID,
17296
- is_skeleton,
17297
- $root_container,
17298
- nodeP,
17299
- $container,
17300
- paramsP,
17301
- parent_infoP,
17302
- jobNoP,
17303
- keyP,
17304
- parent_nodeP,
17305
- $container,
17306
- true
17307
- );
16417
+ await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $container, true);
17308
16418
  }
17309
16419
  }
17310
16420
 
@@ -17317,14 +16427,7 @@ func.UI.screen.render_ui_tree = async function (
17317
16427
  }
17318
16428
  var $div_items = $div.data().xuData.node.children;
17319
16429
 
17320
- await func.UI.screen.panel_post_render_handler(
17321
- SESSION_ID,
17322
- $container,
17323
- $new_div,
17324
- nodeP,
17325
- $div,
17326
- jobNoP
17327
- );
16430
+ await func.UI.screen.panel_post_render_handler(SESSION_ID, $container, $new_div, nodeP, $div, jobNoP);
17328
16431
 
17329
16432
  // TO FIX should be timeout
17330
16433
  $container.data().xuData.node.children = $div_items;
@@ -17332,39 +16435,10 @@ func.UI.screen.render_ui_tree = async function (
17332
16435
  return $container;
17333
16436
  };
17334
16437
 
17335
- var $wrapper = $("<div>");
17336
- $div = func.UI.screen.create_container(
17337
- SESSION_ID,
17338
- $root_container,
17339
- nodeP,
17340
- $container,
17341
- paramsP,
17342
- parent_infoP,
17343
- jobNoP,
17344
- keyP,
17345
- parent_nodeP,
17346
- prop,
17347
- null,
17348
- null,
17349
- null,
17350
- $wrapper,
17351
- ""
17352
- );
16438
+ var $wrapper = $('<div>');
16439
+ $div = func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, null, null, null, $wrapper, '');
17353
16440
 
17354
- let ret = await func.UI.screen.set_attributes_new(
17355
- SESSION_ID,
17356
- is_skeleton,
17357
- $root_container,
17358
- nodeP,
17359
- $container,
17360
- paramsP,
17361
- parent_infoP,
17362
- jobNoP,
17363
- keyP,
17364
- parent_nodeP,
17365
- $div.clone(true),
17366
- true
17367
- );
16441
+ let ret = await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $div.clone(true), true);
17368
16442
  if (ret.abort) {
17369
16443
  // // program null
17370
16444
  // if (ret.program_null) {
@@ -17372,7 +16446,7 @@ func.UI.screen.render_ui_tree = async function (
17372
16446
  // }
17373
16447
 
17374
16448
  // render N
17375
- return (ret.$new_div = $("<template>").append($div));
16449
+ return (ret.$new_div = $('<template>').append($div));
17376
16450
 
17377
16451
  // ret.$new_div = $("<template>").append($div);
17378
16452
  }
@@ -17385,8 +16459,8 @@ func.UI.screen.render_ui_tree = async function (
17385
16459
  const done = async function () {
17386
16460
  return $div;
17387
16461
  };
17388
- if (!element || element === "script") return await done();
17389
- let str = "";
16462
+ if (!element || element === 'script') return await done();
16463
+ let str = '';
17390
16464
  // var $div
17391
16465
  // const draw_svg = function () {
17392
16466
  // const get_tag_str = function (element, prop, val) {
@@ -17428,23 +16502,7 @@ func.UI.screen.render_ui_tree = async function (
17428
16502
  // // return await done();
17429
16503
  // }
17430
16504
 
17431
- var $div = func.UI.screen.create_container(
17432
- SESSION_ID,
17433
- $root_container,
17434
- nodeP,
17435
- $container,
17436
- paramsP,
17437
- parent_infoP,
17438
- jobNoP,
17439
- keyP,
17440
- parent_nodeP,
17441
- prop,
17442
- null,
17443
- null,
17444
- element,
17445
- null,
17446
- str
17447
- );
16505
+ var $div = func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, null, null, element, null, str);
17448
16506
 
17449
16507
  $div.hover(
17450
16508
  function (e) {
@@ -17452,42 +16510,23 @@ func.UI.screen.render_ui_tree = async function (
17452
16510
  },
17453
16511
  function (e) {
17454
16512
  hover_out();
17455
- }
16513
+ },
17456
16514
  );
17457
16515
 
17458
- let ret = await func.UI.screen.set_attributes_new(
17459
- SESSION_ID,
17460
- is_skeleton,
17461
- $root_container,
17462
- nodeP,
17463
- $container,
17464
- paramsP,
17465
- parent_infoP,
17466
- jobNoP,
17467
- keyP,
17468
- parent_nodeP,
17469
- $div,
17470
- true
17471
- );
16516
+ let ret = await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $div, true);
17472
16517
  if (ret.abort) return await done();
17473
16518
  // check if iterator made to prevent children render
17474
16519
 
17475
- const ret_iterate_child = await iterate_child(
17476
- $div,
17477
- nodeP,
17478
- parent_infoP,
17479
- null,
17480
- $root_container
17481
- );
16520
+ const ret_iterate_child = await iterate_child($div, nodeP, parent_infoP, null, $root_container);
17482
16521
  return await done();
17483
16522
  };
17484
16523
 
17485
16524
  if (nodeP.content && nodeP.attributes) {
17486
- nodeP.attributes["xu-content"] = nodeP.content;
16525
+ nodeP.attributes['xu-content'] = nodeP.content;
17487
16526
  }
17488
- if (nodeP.tagName === "xu-widget") {
16527
+ if (nodeP.tagName === 'xu-widget') {
17489
16528
  if (is_skeleton) return;
17490
- return await fx["widget"]();
16529
+ return await fx['widget']();
17491
16530
  }
17492
16531
  if (fx[nodeP.tagName]) {
17493
16532
  return await fx[nodeP.tagName]();
@@ -17496,17 +16535,11 @@ func.UI.screen.render_ui_tree = async function (
17496
16535
  return await draw_html_element(nodeP.tagName);
17497
16536
  };
17498
16537
 
17499
- func.UI.screen.refresh_document_changes_for_realtime_update = async function (
17500
- SESSION_ID,
17501
- doc_change
17502
- ) {
16538
+ func.UI.screen.refresh_document_changes_for_realtime_update = async function (SESSION_ID, doc_change) {
17503
16539
  let _session = SESSION_OBJ[SESSION_ID];
17504
16540
  for (const [key, _ds] of Object.entries(_session.DS_GLB)) {
17505
16541
  let prog_obj = await func.utils.VIEWS_OBJ.get(SESSION_ID, _ds.prog_id);
17506
- if (
17507
- prog_obj?.progDataSource?.dataSourceRealtime &&
17508
- prog_obj?.progDataSource?.dataSourceTableId === doc_change.table_id
17509
- ) {
16542
+ if (prog_obj?.progDataSource?.dataSourceRealtime && prog_obj?.progDataSource?.dataSourceTableId === doc_change.table_id) {
17510
16543
  try {
17511
16544
  // disabled in purpose to support create row
17512
16545
 
@@ -17521,7 +16554,7 @@ func.UI.screen.refresh_document_changes_for_realtime_update = async function (
17521
16554
  if (_ds.screen_params.is_panelP) {
17522
16555
  func.UI.screen.refresh_screen(SESSION_ID, null, key);
17523
16556
  } else {
17524
- func.action.execute(SESSION_ID, "act_refresh", _ds, null, null);
16557
+ func.action.execute(SESSION_ID, 'act_refresh', _ds, null, null);
17525
16558
  }
17526
16559
  } catch (err) {
17527
16560
  // console.error(err);