@xuda.io/runtime-bundle 1.0.319 → 1.0.321

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.
@@ -4755,7 +4755,7 @@ func.utils.job_worker = function (session_id) {
4755
4755
  val.containerP,
4756
4756
  val.elementP,
4757
4757
  val.rowP,
4758
- null,
4758
+ val.evt,
4759
4759
  val.descP,
4760
4760
  val.rootScreenIdP,
4761
4761
  val.dsSessionP,
@@ -6409,15 +6409,7 @@ func.utils.get_last_datasource_no = function (SESSION_ID) {
6409
6409
  }
6410
6410
  };
6411
6411
  func.events = {};
6412
- func.events.validate = async function (
6413
- SESSION_ID,
6414
- triggerP,
6415
- dsSessionP,
6416
- eventIdP,
6417
- sourceP,
6418
- argumentsP,
6419
- return_validation_onlyP
6420
- ) {
6412
+ func.events.validate = async function (SESSION_ID, triggerP, dsSessionP, eventIdP, sourceP, argumentsP, return_validation_onlyP) {
6421
6413
  var _session = SESSION_OBJ[SESSION_ID];
6422
6414
  var _ds = _session.DS_GLB[dsSessionP];
6423
6415
  var args = {
@@ -6430,16 +6422,8 @@ func.events.validate = async function (
6430
6422
  return_validation_onlyP,
6431
6423
  };
6432
6424
  const search_event_in_parent_ds = async function () {
6433
- if (_ds && typeof _ds.parentDataSourceNo !== "undefined") {
6434
- await func.events.validate(
6435
- SESSION_ID,
6436
- triggerP,
6437
- _ds.parentDataSourceNo,
6438
- eventIdP,
6439
- sourceP,
6440
- argumentsP,
6441
- return_validation_onlyP
6442
- );
6425
+ if (_ds && typeof _ds.parentDataSourceNo !== 'undefined') {
6426
+ await func.events.validate(SESSION_ID, triggerP, _ds.parentDataSourceNo, eventIdP, sourceP, argumentsP, return_validation_onlyP);
6443
6427
  }
6444
6428
  };
6445
6429
  var ret = false;
@@ -6461,29 +6445,13 @@ func.events.validate = async function (
6461
6445
  var eventProp = undefined;
6462
6446
  if (val.data.type === triggerP) {
6463
6447
  // compare event trigger
6464
- if (
6465
- (triggerP !== "user_defined") |
6466
- (triggerP === "user_defined" && eventIdP === val.data.event_name)
6467
- ) {
6448
+ if ((triggerP !== 'user_defined') | (triggerP === 'user_defined' && eventIdP === val.data.event_name)) {
6468
6449
  // compare user defined name
6469
6450
 
6470
6451
  var expCond;
6471
- if (val.data.condition)
6472
- expCond = await func.expression.get(
6473
- SESSION_ID,
6474
- val.data.condition,
6475
- dsSessionP,
6476
- "condition"
6477
- );
6452
+ if (val.data.condition) expCond = await func.expression.get(SESSION_ID, val.data.condition, dsSessionP, 'condition');
6478
6453
  if (!val.data.condition || expCond.result) {
6479
- func.utils.debug.watch(
6480
- SESSION_ID,
6481
- _ds.prog_id + "%" + val.id,
6482
- "view_event",
6483
- val,
6484
- triggerP + " " + eventIdP,
6485
- expCond
6486
- );
6454
+ func.utils.debug.watch(SESSION_ID, _ds.prog_id + '%' + val.id, 'view_event', val, triggerP + ' ' + eventIdP, expCond);
6487
6455
  ret = true;
6488
6456
  if (return_validation_onlyP) break;
6489
6457
  const set_arguments = async function () {
@@ -6521,48 +6489,24 @@ func.events.validate = async function (
6521
6489
  // await func.datasource.update(SESSION_ID, datasource_changes);
6522
6490
  // }
6523
6491
 
6524
- for await (let [key, fieldId] of Object.entries(
6525
- val.data.parameters
6526
- )) {
6527
- const field_info = func.common.find_item_by_key(
6528
- _view_obj.progFields,
6529
- "field_id",
6530
- fieldId
6531
- );
6532
-
6533
- if (field_info?.data?.type !== "virtual") {
6534
- console.warn("parameter field must be virtual, update ignored");
6492
+ for await (let [key, fieldId] of Object.entries(val.data.parameters)) {
6493
+ const field_info = func.common.find_item_by_key(_view_obj.progFields, 'field_id', fieldId);
6494
+
6495
+ if (field_info?.data?.type !== 'virtual') {
6496
+ console.warn('parameter field must be virtual, update ignored');
6535
6497
  continue;
6536
6498
  }
6537
6499
 
6538
- if (!args[fieldId]) continue
6539
-
6500
+ if (!args[fieldId]) continue;
6540
6501
 
6541
-
6542
- let value = await func.common.get_cast_val(
6543
- SESSION_ID,
6544
- "events",
6545
- fieldId,
6546
- field_info.props.fieldType,
6547
- args[fieldId].value
6548
- );
6502
+ let value = await func.common.get_cast_val(SESSION_ID, 'events', fieldId, field_info.props.fieldType, args[fieldId].value);
6549
6503
 
6550
6504
  if (!_.isEmpty(args[fieldId].fx)) {
6551
- const fx_ret = await func.expression.get(
6552
- SESSION_ID,
6553
- args[fieldId].fx,
6554
- dsSessionP,
6555
- "update"
6556
- )
6505
+ const fx_ret = await func.expression.get(SESSION_ID, args[fieldId].fx, dsSessionP, 'update');
6557
6506
  value = fx_ret.result;
6558
6507
  }
6559
6508
  // find the target field in the program dataset
6560
- const ret = await func.datasource.get_value(
6561
- SESSION_ID,
6562
- fieldId,
6563
- dsSessionP,
6564
- _ds.currentRecordId
6565
- );
6509
+ const ret = await func.datasource.get_value(SESSION_ID, fieldId, dsSessionP, _ds.currentRecordId);
6566
6510
 
6567
6511
  const datasource_changes = {
6568
6512
  [ret.dsSessionP]: {
@@ -6575,11 +6519,7 @@ func.events.validate = async function (
6575
6519
  await add_event();
6576
6520
  };
6577
6521
  const add_event = async function () {
6578
- const _event = func.common.find_item_by_key_root(
6579
- _view_obj.progEvents,
6580
- "id",
6581
- val.id
6582
- );
6522
+ const _event = func.common.find_item_by_key_root(_view_obj.progEvents, 'id', val.id);
6583
6523
  if (_event.triggers) {
6584
6524
  // check if event property exist
6585
6525
 
@@ -6602,22 +6542,19 @@ func.events.validate = async function (
6602
6542
  if (!glb.IS_WORKER) {
6603
6543
  if (_ds.panel_div_id) {
6604
6544
  try {
6605
- container = "#" + _ds.panel_div_id;
6545
+ container = '#' + _ds.panel_div_id;
6606
6546
  if ($(container).data().xuData.panel_info) {
6607
- screen_prop =
6608
- $(container).data().xuData.panel_info.paramsP;
6547
+ screen_prop = $(container).data().xuData.panel_info.paramsP;
6609
6548
  } else {
6610
6549
  ///////////////
6611
- container =
6612
- "#" + _session.DS_GLB[dsSessionP].screenId;
6550
+ container = '#' + _session.DS_GLB[dsSessionP].screenId;
6613
6551
 
6614
6552
  if ($(container) && $(container).data()) {
6615
6553
  screen_prop = $(container).data().xuData.paramsP;
6616
6554
  }
6617
6555
 
6618
6556
  if (!$(container) || !$(container).length) {
6619
- container =
6620
- "#" + _session.DS_GLB[dsSessionP].containerId;
6557
+ container = '#' + _session.DS_GLB[dsSessionP].containerId;
6621
6558
  }
6622
6559
  //////////////
6623
6560
  }
@@ -6625,14 +6562,14 @@ func.events.validate = async function (
6625
6562
  console.error(e);
6626
6563
  }
6627
6564
  } else {
6628
- container = "#" + _ds.screenId;
6565
+ container = '#' + _ds.screenId;
6629
6566
 
6630
6567
  if ($(container) && $(container).data()) {
6631
6568
  screen_prop = $(container).data().xuData.paramsP;
6632
6569
  }
6633
6570
 
6634
6571
  if (!$(container) || !$(container).length) {
6635
- container = "#" + _ds.containerId;
6572
+ container = '#' + _ds.containerId;
6636
6573
  }
6637
6574
  }
6638
6575
  } else {
@@ -6644,7 +6581,7 @@ func.events.validate = async function (
6644
6581
  jobs.push(
6645
6582
  await func.events.add_to_queue(
6646
6583
  SESSION_ID,
6647
- sourceP + " event",
6584
+ sourceP + ' event',
6648
6585
  trigger_obj.id,
6649
6586
  null, // was click
6650
6587
  trigger_obj.data.action,
@@ -6670,8 +6607,8 @@ func.events.validate = async function (
6670
6607
  null,
6671
6608
  args,
6672
6609
  null,
6673
- null
6674
- )
6610
+ null,
6611
+ ),
6675
6612
  );
6676
6613
  }
6677
6614
  }
@@ -6683,15 +6620,7 @@ func.events.validate = async function (
6683
6620
  }
6684
6621
  } else {
6685
6622
  if (val.data.condition && !expCond.result) {
6686
- func.utils.debug.watch(
6687
- SESSION_ID,
6688
- _ds.prog_id + "%" + val.id,
6689
- "view_event",
6690
- val,
6691
- triggerP + " " + eventIdP,
6692
- expCond,
6693
- true
6694
- );
6623
+ func.utils.debug.watch(SESSION_ID, _ds.prog_id + '%' + val.id, 'view_event', val, triggerP + ' ' + eventIdP, expCond, true);
6695
6624
  }
6696
6625
  }
6697
6626
  }
@@ -6714,7 +6643,7 @@ func.events.add_to_queue = async function (
6714
6643
  containerP,
6715
6644
  elementP,
6716
6645
  rowP,
6717
- NA_colP,
6646
+ evt,
6718
6647
  descP,
6719
6648
  NA_rootScreenIdP,
6720
6649
  NA_callingEventIdP,
@@ -6732,7 +6661,7 @@ func.events.add_to_queue = async function (
6732
6661
  calling_job,
6733
6662
  args,
6734
6663
  $div,
6735
- $container
6664
+ $container,
6736
6665
  ) {
6737
6666
  var _session = SESSION_OBJ[SESSION_ID];
6738
6667
  var obj = {
@@ -6757,11 +6686,11 @@ func.events.add_to_queue = async function (
6757
6686
  args,
6758
6687
  $div,
6759
6688
  $container,
6760
-
6689
+ evt,
6761
6690
  job_num: _session.WORKER_OBJ.num,
6762
6691
  };
6763
6692
  var _ds = _session.DS_GLB[dsSessionP];
6764
- if (typeof dsSessionP !== "undefined" && dsSessionP !== null) {
6693
+ if (typeof dsSessionP !== 'undefined' && dsSessionP !== null) {
6765
6694
  obj.prog_id = _ds.prog_id;
6766
6695
  obj.parentDataSourceNo = _ds.parentDataSourceNo;
6767
6696
  obj.nodeId = _ds.nodeId;
@@ -6769,21 +6698,16 @@ func.events.add_to_queue = async function (
6769
6698
  ///////
6770
6699
  if (glb.IS_WORKER && func.utils.is_onscreen_event(functionP)) {
6771
6700
  obj.client = true;
6772
- if (functionP === "call_library") {
6701
+ if (functionP === 'call_library') {
6773
6702
  obj.client = false;
6774
6703
  }
6775
- if (typeof dsSessionP !== "undefined" && dsSessionP !== null) {
6704
+ if (typeof dsSessionP !== 'undefined' && dsSessionP !== null) {
6776
6705
  obj.ds_obj = func.utils.clean_returned_datasource(SESSION_ID, dsSessionP);
6777
6706
  }
6778
6707
  if (obj.client) {
6779
6708
  _session.WORKER_OBJ.num++;
6780
6709
  // if (!_session.IS_API)
6781
- func.utils.post_back_to_client(
6782
- SESSION_ID,
6783
- "job",
6784
- _session.worker_id,
6785
- obj
6786
- );
6710
+ func.utils.post_back_to_client(SESSION_ID, 'job', _session.worker_id, obj);
6787
6711
  return;
6788
6712
  }
6789
6713
  }
@@ -6797,14 +6721,10 @@ func.events.add_to_queue = async function (
6797
6721
  _session.WORKER_OBJ.jobs[job_index].splice_count = 0;
6798
6722
  }
6799
6723
  _session.WORKER_OBJ.jobs[job_index].splice_count++;
6800
- _session.WORKER_OBJ.jobs.splice(
6801
- job_index + _session.WORKER_OBJ.jobs[job_index].splice_count,
6802
- 0,
6803
- obj
6804
- );
6724
+ _session.WORKER_OBJ.jobs.splice(job_index + _session.WORKER_OBJ.jobs[job_index].splice_count, 0, obj);
6805
6725
  // }
6806
6726
  } catch (e) {
6807
- console.error("bug");
6727
+ console.error('bug');
6808
6728
  // _session.WORKER_OBJ.jobs.splice(0, 0, obj);
6809
6729
  }
6810
6730
  } else {
@@ -6836,7 +6756,7 @@ func.events.execute = async function (
6836
6756
  containerP,
6837
6757
  elementP,
6838
6758
  rowP,
6839
- NA_colP,
6759
+ evt,
6840
6760
  descP,
6841
6761
  rootScreenIdP,
6842
6762
  dsSessionP,
@@ -6854,14 +6774,14 @@ func.events.execute = async function (
6854
6774
  NA_viewIdP,
6855
6775
  NA_nodeIdP,
6856
6776
  NA_parentDataSourceNoP,
6857
- $div
6777
+ $div,
6858
6778
  ) {
6859
6779
  var _session = SESSION_OBJ[SESSION_ID];
6860
6780
  var _ds = _session.DS_GLB[dsSessionP];
6861
- if (functionP === "update") refIdP = null; // in case of left over when program changing from call function to update
6781
+ if (functionP === 'update') refIdP = null; // in case of left over when program changing from call function to update
6862
6782
 
6863
6783
  var job_index = func.events.find_job_index(SESSION_ID, jobNoP);
6864
- if (_session.WORKER_OBJ.jobs?.[job_index]?.stat === "busy") {
6784
+ if (_session.WORKER_OBJ.jobs?.[job_index]?.stat === 'busy') {
6865
6785
  if (jobNoP) _session.WORKER_OBJ.stat = job_index;
6866
6786
  return;
6867
6787
  }
@@ -6878,61 +6798,44 @@ func.events.execute = async function (
6878
6798
  }
6879
6799
 
6880
6800
  if (_session.WORKER_OBJ.jobs[job_index]) {
6881
- _session.WORKER_OBJ.jobs[job_index].stat = "busy";
6801
+ _session.WORKER_OBJ.jobs[job_index].stat = 'busy';
6882
6802
  }
6883
6803
 
6884
6804
  var dsSession = dsSessionP; // new 2020420
6885
6805
  var field_elm = elementP;
6886
6806
 
6887
6807
  var calling_field_id = field_elm;
6888
- if (field_elm && typeof field_elm === "object")
6889
- calling_field_id = field_elm.attr("xu-ui-id");
6808
+ if (field_elm && typeof field_elm === 'object') calling_field_id = field_elm.attr('xu-ui-id');
6890
6809
 
6891
6810
  var log_nodeId;
6892
6811
  var log_prog_id;
6893
6812
  var log_source;
6894
6813
 
6895
- if (_session.DS_GLB[dsSession]?.prog_id)
6896
- log_prog_id = _session.DS_GLB[dsSession].prog_id;
6897
- log_nodeId = log_prog_id + "_" + eventIdP;
6814
+ if (_session.DS_GLB[dsSession]?.prog_id) log_prog_id = _session.DS_GLB[dsSession].prog_id;
6815
+ log_nodeId = log_prog_id + '_' + eventIdP;
6898
6816
  var log_prop = callingSourceP;
6899
- if (callingSourceP === "system event") {
6900
- log_prop = "global event";
6817
+ if (callingSourceP === 'system event') {
6818
+ log_prop = 'global event';
6901
6819
  }
6902
6820
  if (calling_field_id) {
6903
6821
  const _view_obj = await func.utils.VIEWS_OBJ.get(SESSION_ID, _ds.prog_id);
6904
- let _field_obj = func.common.find_item_by_key(
6905
- _view_obj.progFields,
6906
- "field_id",
6907
- calling_field_id
6908
- );
6909
- log_nodeId = log_prog_id + "_" + eventIdP + "_" + _field_obj?.id;
6822
+ let _field_obj = func.common.find_item_by_key(_view_obj.progFields, 'field_id', calling_field_id);
6823
+ log_nodeId = log_prog_id + '_' + eventIdP + '_' + _field_obj?.id;
6910
6824
 
6911
6825
  log_source = calling_field_id;
6912
6826
  }
6913
6827
  if (elementP) {
6914
6828
  log_prop = triggerP;
6915
- log_nodeId = log_nodeId + "_ui_prop"; //+"_"+eventIdP;
6829
+ log_nodeId = log_nodeId + '_ui_prop'; //+"_"+eventIdP;
6916
6830
  }
6917
6831
  //check condition
6918
6832
  var expCond;
6919
6833
  if (event_propertiesP) {
6920
6834
  // conditional event
6921
6835
  if (event_propertiesP?.props?.condition) {
6922
- expCond = await func.expression.get(
6923
- SESSION_ID,
6924
- event_propertiesP.props.condition,
6925
- dsSession,
6926
- "condition",
6927
- null,
6928
- null,
6929
- null,
6930
- calling_field_id ? calling_field_id : calling_triggerP,
6931
- null,
6932
- descP
6933
- ); // execute expression
6836
+ expCond = await func.expression.get(SESSION_ID, event_propertiesP.props.condition, dsSession, 'condition', null, null, null, calling_field_id ? calling_field_id : calling_triggerP, null, descP); // execute expression
6934
6837
  func.utils.debug.log(SESSION_ID, log_nodeId, {
6935
- module: "event",
6838
+ module: 'event',
6936
6839
  action: log_prop,
6937
6840
  source: log_source,
6938
6841
  prop: descP,
@@ -6940,7 +6843,7 @@ func.events.execute = async function (
6940
6843
  result: expCond.result,
6941
6844
  error: expCond.error,
6942
6845
  fields: expCond.fields,
6943
- type: "event",
6846
+ type: 'event',
6944
6847
  prog_id: log_prog_id,
6945
6848
  conditional: true,
6946
6849
  });
@@ -6949,21 +6852,13 @@ func.events.execute = async function (
6949
6852
  // condition failed // === true 03/04/16
6950
6853
  func.events.delete_job(SESSION_ID, jobNoP);
6951
6854
 
6952
- func.utils.debug.watch(
6953
- SESSION_ID,
6954
- calling_trigger_prop?.id,
6955
- functionP,
6956
- "",
6957
- "",
6958
- expCond,
6959
- true
6960
- );
6855
+ func.utils.debug.watch(SESSION_ID, calling_trigger_prop?.id, functionP, '', '', expCond, true);
6961
6856
  return;
6962
6857
  }
6963
6858
  } // Non conditional event
6964
6859
  else {
6965
6860
  func.utils.debug.log(SESSION_ID, log_nodeId, {
6966
- module: "event",
6861
+ module: 'event',
6967
6862
  action: log_prop,
6968
6863
  source: log_source,
6969
6864
  prop: descP,
@@ -6971,7 +6866,7 @@ func.events.execute = async function (
6971
6866
  result: null,
6972
6867
  error: null,
6973
6868
  fields: null,
6974
- type: "event",
6869
+ type: 'event',
6975
6870
  prog_id: log_prog_id,
6976
6871
  });
6977
6872
  }
@@ -6994,47 +6889,27 @@ func.events.execute = async function (
6994
6889
  // };
6995
6890
 
6996
6891
  const get_params_obj = async function () {
6997
- const _prog = await func.utils.VIEWS_OBJ.get(
6998
- SESSION_ID,
6999
- await get_prog_id()
7000
- );
6892
+ const _prog = await func.utils.VIEWS_OBJ.get(SESSION_ID, await get_prog_id());
7001
6893
  if (!_prog) {
7002
6894
  func.events.delete_job(SESSION_ID, jobNoP);
7003
- return func.utils.debug_report(
7004
- SESSION_ID,
7005
- "func.events.execute",
7006
- "Program not found: " + refIdP.prog,
7007
- "E"
7008
- );
6895
+ return func.utils.debug_report(SESSION_ID, 'func.events.execute', 'Program not found: ' + refIdP.prog, 'E');
7009
6896
  }
7010
6897
 
7011
6898
  // get in parameters
7012
6899
  var params_obj = {};
7013
6900
  if (_prog?.properties?.progParams) {
7014
- for await (const [key, val] of Object.entries(
7015
- _prog.properties.progParams
7016
- )) {
7017
- if (!val.data.dir === "in") continue;
7018
- if (
7019
- typeof args.parameters_obj_inP?.[val.data.parameter] !== "undefined"
7020
- ) {
6901
+ for await (const [key, val] of Object.entries(_prog.properties.progParams)) {
6902
+ if (!val.data.dir === 'in') continue;
6903
+ if (typeof args.parameters_obj_inP?.[val.data.parameter] !== 'undefined') {
7021
6904
  if (args.parameters_obj_inP?.[val.data.parameter].fx) {
7022
- let ret = await func.expression.get(
7023
- SESSION_ID,
7024
- args.parameters_obj_inP?.[val.data.parameter].fx,
7025
- dsSession,
7026
- "parameters"
7027
- );
6905
+ let ret = await func.expression.get(SESSION_ID, args.parameters_obj_inP?.[val.data.parameter].fx, dsSession, 'parameters');
7028
6906
  params_obj[val.data.parameter] = ret.result;
7029
6907
  } else {
7030
- params_obj[val.data.parameter] =
7031
- args.parameters_obj_inP?.[val.data.parameter].value;
6908
+ params_obj[val.data.parameter] = args.parameters_obj_inP?.[val.data.parameter].value;
7032
6909
  }
7033
6910
  continue;
7034
6911
  }
7035
- console.warn(
7036
- `Warning: Program ${_prog.properties.menuName} expected In parameter: ${val.data.parameter} but received null instead`
7037
- );
6912
+ console.warn(`Warning: Program ${_prog.properties.menuName} expected In parameter: ${val.data.parameter} but received null instead`);
7038
6913
  }
7039
6914
  }
7040
6915
  return params_obj;
@@ -7043,15 +6918,8 @@ func.events.execute = async function (
7043
6918
  const get_prog_id = async function () {
7044
6919
  let _prop = args?.calling_trigger_prop?.data?.name?.properties;
7045
6920
  let _prog_id = args.prog_id;
7046
- if (_prop?.["xu-exp:prog"]) {
7047
- _prog_id = (
7048
- await func.expression.get(
7049
- SESSION_ID,
7050
- _prop["xu-exp:prog"],
7051
- dsSession,
7052
- "prog_id expression"
7053
- )
7054
- ).result;
6921
+ if (_prop?.['xu-exp:prog']) {
6922
+ _prog_id = (await func.expression.get(SESSION_ID, _prop['xu-exp:prog'], dsSession, 'prog_id expression')).result;
7055
6923
  }
7056
6924
 
7057
6925
  return _prog_id;
@@ -7073,7 +6941,6 @@ func.events.execute = async function (
7073
6941
  // return _value;
7074
6942
  // };
7075
6943
 
7076
-
7077
6944
  var args = {
7078
6945
  prog_id: refIdP?.prog,
7079
6946
  screenIdP: refIdP?.prog,
@@ -7101,40 +6968,20 @@ func.events.execute = async function (
7101
6968
  var $calling_container;
7102
6969
  if (_session.WORKER_OBJ.jobs[job_index]) {
7103
6970
  if (_session.WORKER_OBJ.jobs[job_index].paramsP) {
7104
- $calling_container = $(
7105
- "#" + _session.WORKER_OBJ.jobs[job_index].paramsP.callingContainerP
7106
- );
6971
+ $calling_container = $('#' + _session.WORKER_OBJ.jobs[job_index].paramsP.callingContainerP);
7107
6972
  } else {
7108
- $calling_container = ""; // calling from datasource 0
6973
+ $calling_container = ''; // calling from datasource 0
7109
6974
  _session.WORKER_OBJ.jobs[job_index].paramsP = {};
7110
6975
  }
7111
6976
  }
7112
6977
 
7113
6978
  if (!refIdP.prog) {
7114
6979
  func.events.delete_job(SESSION_ID, jobNoP);
7115
- return func.utils.debug_report(
7116
- SESSION_ID,
7117
- "func.events.execute",
7118
- "Program is empty",
7119
- "E"
7120
- );
6980
+ return func.utils.debug_report(SESSION_ID, 'func.events.execute', 'Program is empty', 'E');
7121
6981
  }
7122
6982
 
7123
6983
  const params_obj = await get_params_obj();
7124
- return await func.UI.screen.init(
7125
- SESSION_ID,
7126
- await get_prog_id(),
7127
- $(containerP)?.data()?.xuData.screenId,
7128
- _session.DS_GLB[dsSession],
7129
- $calling_container,
7130
- eventIdP,
7131
- rowP,
7132
- jobNoP,
7133
- is_panel,
7134
- params_obj,
7135
- functionP,
7136
- args.call_screen_propertiesP
7137
- );
6984
+ return await func.UI.screen.init(SESSION_ID, await get_prog_id(), $(containerP)?.data()?.xuData.screenId, _session.DS_GLB[dsSession], $calling_container, eventIdP, rowP, jobNoP, is_panel, params_obj, functionP, args.call_screen_propertiesP);
7138
6985
  },
7139
6986
  call_modal: async function () {
7140
6987
  return await fx.Call_window();
@@ -7157,101 +7004,66 @@ func.events.execute = async function (
7157
7004
 
7158
7005
  const set_SYS_GLOBAL_OBJ_WIDGET_INFO = async function (docP) {
7159
7006
  var obj = _.clone(docP);
7160
- obj.date = await func.utils.get_dateTime(
7161
- SESSION_ID,
7162
- "SYS_DATE",
7163
- docP.date
7164
- );
7165
- obj.time = await func.utils.get_dateTime(
7166
- SESSION_ID,
7167
- "SYS_TIME",
7168
- docP.date
7169
- );
7007
+ obj.date = await func.utils.get_dateTime(SESSION_ID, 'SYS_DATE', docP.date);
7008
+ obj.time = await func.utils.get_dateTime(SESSION_ID, 'SYS_TIME', docP.date);
7170
7009
 
7171
7010
  var datasource_changes = {
7172
7011
  [0]: {
7173
- ["data_system"]: {
7174
- ["SYS_GLOBAL_OBJ_WIDGET_INFO"]: obj,
7012
+ ['data_system']: {
7013
+ ['SYS_GLOBAL_OBJ_WIDGET_INFO']: obj,
7175
7014
  },
7176
7015
  },
7177
7016
  };
7178
7017
  await func.datasource.update(SESSION_ID, datasource_changes);
7179
7018
  };
7180
7019
  const call_plugin_api = async function (plugin_nameP, dataP) {
7181
- return await func.utils.call_plugin_api(
7182
- SESSION_ID,
7183
- plugin_nameP,
7184
- dataP
7185
- );
7020
+ return await func.utils.call_plugin_api(SESSION_ID, plugin_nameP, dataP);
7186
7021
  };
7187
7022
  const report_error = function (descP, warn) {
7188
- func.utils.debug.log(
7189
- SESSION_ID,
7190
- _session.DS_GLB[dsP].prog_id +
7191
- "_" +
7192
- _session.DS_GLB[dsP].callingMenuId,
7193
- {
7194
- module: "widgets",
7195
- action: "Init",
7023
+ func.utils.debug.log(SESSION_ID, _session.DS_GLB[dsP].prog_id + '_' + _session.DS_GLB[dsP].callingMenuId, {
7024
+ module: 'widgets',
7025
+ action: 'Init',
7026
+ source: sourceP,
7027
+ prop: descP,
7028
+ details: descP,
7029
+ result: null,
7030
+ error: warn ? false : true,
7031
+ fields: null,
7032
+ type: 'widgets',
7033
+ prog_id: _session.DS_GLB[dsP].prog_id,
7034
+ });
7035
+ };
7036
+ const get_fields_data = async function (fields, props) {
7037
+ const report_error = function (descP, warn) {
7038
+ func.utils.debug.log(SESSION_ID, _session.DS_GLB[dsP].prog_id + '_' + _session.DS_GLB[dsP].callingMenuId, {
7039
+ module: 'widgets',
7040
+ action: 'Init',
7196
7041
  source: sourceP,
7197
7042
  prop: descP,
7198
7043
  details: descP,
7199
7044
  result: null,
7200
7045
  error: warn ? false : true,
7201
7046
  fields: null,
7202
- type: "widgets",
7047
+ type: 'widgets',
7203
7048
  prog_id: _session.DS_GLB[dsP].prog_id,
7204
- }
7205
- );
7206
- };
7207
- const get_fields_data = async function (fields, props) {
7208
- const report_error = function (descP, warn) {
7209
- func.utils.debug.log(
7210
- SESSION_ID,
7211
- _session.DS_GLB[dsP].prog_id +
7212
- "_" +
7213
- _session.DS_GLB[dsP].callingMenuId,
7214
- {
7215
- module: "widgets",
7216
- action: "Init",
7217
- source: sourceP,
7218
- prop: descP,
7219
- details: descP,
7220
- result: null,
7221
- error: warn ? false : true,
7222
- fields: null,
7223
- type: "widgets",
7224
- prog_id: _session.DS_GLB[dsP].prog_id,
7225
- }
7226
- );
7049
+ });
7227
7050
  };
7228
7051
  const get_property_value = async function (fieldIdP, val) {
7229
7052
  // var value = props[fieldIdP];
7230
7053
 
7231
- var value =
7232
- props[fieldIdP] ||
7233
- (typeof val.defaultValue === "function"
7234
- ? val?.defaultValue?.()
7235
- : val?.defaultValue);
7054
+ var value = props[fieldIdP] || (typeof val.defaultValue === 'function' ? val?.defaultValue?.() : val?.defaultValue);
7236
7055
 
7237
7056
  if (props[`xu-exp:${fieldIdP}`]) {
7238
- value = (
7239
- await func.expression.get(
7240
- SESSION_ID,
7241
- props[`xu-exp:${fieldIdP}`],
7242
- dsP,
7243
- "widget property"
7244
- )
7245
- ).result;
7057
+ value = (await func.expression.get(SESSION_ID, props[`xu-exp:${fieldIdP}`], dsP, 'widget property')).result;
7246
7058
  }
7247
7059
 
7248
7060
  return func.common.get_cast_val(
7249
7061
  SESSION_ID,
7250
- "widgets",
7062
+ 'widgets',
7251
7063
  fieldIdP,
7252
7064
  val.type, //val.type !== "string" || val.type !== "number" ? "string" : val.type,
7253
7065
  value,
7254
- null
7066
+ null,
7255
7067
  );
7256
7068
  };
7257
7069
  var data_obj = {};
@@ -7274,51 +7086,36 @@ func.events.execute = async function (
7274
7086
  };
7275
7087
 
7276
7088
  try {
7277
- const _plugin =
7278
- APP_OBJ[_session.app_id]?.app_plugins_purchased?.[plugin_name];
7089
+ const _plugin = APP_OBJ[_session.app_id]?.app_plugins_purchased?.[plugin_name];
7279
7090
 
7280
- const index = await func.utils.get_plugin_resource(
7281
- SESSION_ID,
7282
- plugin_name,
7283
- `${_plugin.manifest["index.mjs"].dist ? "dist/" : ""}index.mjs`
7284
- );
7091
+ const index = await func.utils.get_plugin_resource(SESSION_ID, plugin_name, `${_plugin.manifest['index.mjs'].dist ? 'dist/' : ''}index.mjs`);
7285
7092
 
7286
7093
  const methods = index.methods;
7287
7094
  if (methods && !methods[method]) {
7288
- return report_error("method not found");
7095
+ return report_error('method not found');
7289
7096
  }
7290
7097
 
7291
- const fields_ret = await get_fields_data(
7292
- methods[method].fields,
7293
- propsP
7294
- );
7098
+ const fields_ret = await get_fields_data(methods[method].fields, propsP);
7295
7099
 
7296
7100
  if (fields_ret.code < 0) {
7297
7101
  return report_error(fields_ret.data);
7298
7102
  }
7299
7103
  const fields = fields_ret.data;
7300
7104
 
7301
- const plugin_setup_ret = await func.utils.get_plugin_setup(
7302
- SESSION_ID,
7303
- plugin_name
7304
- );
7105
+ const plugin_setup_ret = await func.utils.get_plugin_setup(SESSION_ID, plugin_name);
7305
7106
  if (plugin_setup_ret.code < 0) {
7306
7107
  return report_error(plugin_setup_ret);
7307
7108
  }
7308
7109
 
7309
- const api_utils = await func.common.get_module(
7110
+ const api_utils = await func.common.get_module(SESSION_ID, 'xuda-api-library.mjs', {
7111
+ func,
7112
+ glb,
7113
+ SESSION_OBJ,
7310
7114
  SESSION_ID,
7311
- "xuda-api-library.mjs",
7312
- {
7313
- func,
7314
- glb,
7315
- SESSION_OBJ,
7316
- SESSION_ID,
7317
- APP_OBJ,
7318
- dsSession: dsP,
7319
- job_id: jobNoP,
7320
- }
7321
- );
7115
+ APP_OBJ,
7116
+ dsSession: dsP,
7117
+ job_id: jobNoP,
7118
+ });
7322
7119
 
7323
7120
  const params = {
7324
7121
  SESSION_ID,
@@ -7337,11 +7134,7 @@ func.events.execute = async function (
7337
7134
  api_utils,
7338
7135
  };
7339
7136
 
7340
- const fx = await func.utils.get_plugin_resource(
7341
- SESSION_ID,
7342
- plugin_name,
7343
- `${_plugin.manifest["runtime.mjs"].dist ? "dist/" : ""}runtime.mjs`
7344
- );
7137
+ const fx = await func.utils.get_plugin_resource(SESSION_ID, plugin_name, `${_plugin.manifest['runtime.mjs'].dist ? 'dist/' : ''}runtime.mjs`);
7345
7138
 
7346
7139
  if (!fx[method]) {
7347
7140
  throw `Method: ${method} does not exist`;
@@ -7355,41 +7148,21 @@ func.events.execute = async function (
7355
7148
  },
7356
7149
 
7357
7150
  call_native_javascript: async function () {
7358
- const module = await func.common.get_module(
7359
- SESSION_ID,
7360
- "xuda-event-javascript-module.mjs"
7361
- );
7362
- const result = await module.call_javascript(
7363
- SESSION_ID,
7364
- jobNoP,
7365
- refIdP,
7366
- dsSession
7367
- );
7151
+ const module = await func.common.get_module(SESSION_ID, 'xuda-event-javascript-module.mjs');
7152
+ const result = await module.call_javascript(SESSION_ID, jobNoP, refIdP, dsSession);
7368
7153
  await func.datasource.set_outputField(SESSION_ID, dsSessionP, result, args);
7369
7154
 
7370
- return result
7155
+ return result;
7371
7156
  },
7372
7157
  call_evaluate_javascript: async function () {
7373
- const module = await func.common.get_module(
7374
- SESSION_ID,
7375
- "xuda-event-javascript-module.mjs"
7376
- );
7377
- const result = await module.call_javascript(
7378
- SESSION_ID,
7379
- jobNoP,
7380
- refIdP,
7381
- dsSession,
7382
- true
7383
- );
7158
+ const module = await func.common.get_module(SESSION_ID, 'xuda-event-javascript-module.mjs');
7159
+ const result = await module.call_javascript(SESSION_ID, jobNoP, refIdP, dsSession, true);
7384
7160
  await func.datasource.set_outputField(SESSION_ID, dsSessionP, result, args);
7385
7161
 
7386
- return result
7162
+ return result;
7387
7163
  },
7388
7164
  execute_native_javascript: async function () {
7389
- const module = await func.common.get_module(
7390
- SESSION_ID,
7391
- "xuda-event-javascript-module.mjs"
7392
- );
7165
+ const module = await func.common.get_module(SESSION_ID, 'xuda-event-javascript-module.mjs');
7393
7166
 
7394
7167
  const result = await module.run_javascript(
7395
7168
  SESSION_ID,
@@ -7397,17 +7170,14 @@ func.events.execute = async function (
7397
7170
  dsSession,
7398
7171
  `(async function(el) {
7399
7172
  ${refIdP.value}
7400
- })(document.querySelector(\`[xu-ui-id=${elementP}]\`))`
7173
+ })(document.querySelector(\`[xu-ui-id=${elementP}]\`))`,
7401
7174
  );
7402
7175
  await func.datasource.set_outputField(SESSION_ID, dsSessionP, result, args);
7403
7176
 
7404
- return result
7177
+ return result;
7405
7178
  },
7406
7179
  execute_evaluate_javascript: async function () {
7407
- const module = await func.common.get_module(
7408
- SESSION_ID,
7409
- "xuda-event-javascript-module.mjs"
7410
- );
7180
+ const module = await func.common.get_module(SESSION_ID, 'xuda-event-javascript-module.mjs');
7411
7181
 
7412
7182
  const result = await module.run_javascript(
7413
7183
  SESSION_ID,
@@ -7416,11 +7186,11 @@ func.events.execute = async function (
7416
7186
  `(async function(el) {
7417
7187
  ${refIdP.value}
7418
7188
  })(document.querySelector(\`[xu-ui-id=${elementP}]\`))`,
7419
- true
7189
+ true,
7420
7190
  );
7421
7191
  await func.datasource.set_outputField(SESSION_ID, dsSessionP, result, args);
7422
7192
 
7423
- return result
7193
+ return result;
7424
7194
  },
7425
7195
  loader_on: async function () {
7426
7196
  glb.CURRENT_APP_LOADING = null;
@@ -7441,131 +7211,59 @@ func.events.execute = async function (
7441
7211
  // if (descP.value) {
7442
7212
  $(document).trigger(refIdP.value, [_session.DS_GLB[dsSession]]);
7443
7213
  } else {
7444
- func.utils.debug_report(
7445
- SESSION_ID,
7446
- "func.events.execute",
7447
- "Event name missing",
7448
- "E"
7449
- );
7214
+ func.utils.debug_report(SESSION_ID, 'func.events.execute', 'Event name missing', 'E');
7450
7215
  }
7451
7216
  func.events.delete_job(SESSION_ID, jobNoP);
7452
7217
  // if (callbackP) callbackP();
7453
7218
  },
7454
7219
 
7455
7220
  invoke_action: async function () {
7456
- func.utils.debug.watch(
7457
- SESSION_ID,
7458
- calling_trigger_prop?.id,
7459
- functionP,
7460
- null,
7461
- null,
7462
- expCond
7463
- );
7221
+ func.utils.debug.watch(SESSION_ID, calling_trigger_prop?.id, functionP, null, null, expCond);
7464
7222
 
7465
- await func.action.execute(
7466
- SESSION_ID,
7467
- refIdP.value,
7468
- _ds,
7469
- null,
7470
- null,
7471
- jobNoP,
7472
- containerP
7473
- );
7223
+ await func.action.execute(SESSION_ID, refIdP.value, _ds, null, null, jobNoP, containerP);
7474
7224
  },
7475
7225
  raise_event: async function () {
7476
7226
  var _ds = _session.DS_GLB[dsSession];
7477
7227
  const _view_obj = await func.utils.VIEWS_OBJ.get(SESSION_ID, _ds.prog_id);
7478
- if (callingSourceP === "grid" || callingSourceP === "form") {
7479
- let _field_obj = func.common.find_item_by_key(
7480
- _view_obj.progFields,
7481
- "field_id",
7482
- field_elm
7483
- );
7228
+ if (callingSourceP === 'grid' || callingSourceP === 'form') {
7229
+ let _field_obj = func.common.find_item_by_key(_view_obj.progFields, 'field_id', field_elm);
7484
7230
  var event_name = _field_obj?.triggers?.[eventIdP].name.event;
7485
7231
 
7486
- if (_field_obj?.triggers?.[eventIdP].name?.properties["xu-exp:event"]) {
7487
- event_name = (
7488
- await func.expression.get(
7489
- SESSION_ID,
7490
- props[`xu-exp:event`],
7491
- dsSession,
7492
- "event_name expression"
7493
- )
7494
- ).result;
7232
+ if (_field_obj?.triggers?.[eventIdP].name?.properties['xu-exp:event']) {
7233
+ event_name = (await func.expression.get(SESSION_ID, props[`xu-exp:event`], dsSession, 'event_name expression')).result;
7495
7234
  }
7496
7235
 
7497
7236
  if (field_elm && event_name) {
7498
7237
  // get container for fields events
7499
- const dsP = await func.datasource.find_event_dataSource(
7500
- SESSION_ID,
7501
- event_name,
7502
- dsSession
7503
- );
7238
+ const dsP = await func.datasource.find_event_dataSource(SESSION_ID, event_name, dsSession);
7504
7239
 
7505
- return await func.datasource.run_events_functions(
7506
- SESSION_ID,
7507
- dsP,
7508
- event_name,
7509
- jobNoP,
7510
- null,
7511
- calling_trigger_prop?.data?.name?.parameters || {}
7512
- );
7240
+ return await func.datasource.run_events_functions(SESSION_ID, dsP, event_name, jobNoP, null, calling_trigger_prop?.data?.name?.parameters || {});
7513
7241
  }
7514
7242
  // done_execution(event_name);
7515
7243
  }
7516
- if (callingSourceP.includes("event")) {
7244
+ if (callingSourceP.includes('event')) {
7517
7245
  let event_name = refIdP.event;
7518
7246
 
7519
- if (refIdP?.properties?.["xu-exp:event"]) {
7520
- event_name = (
7521
- await func.expression.get(
7522
- SESSION_ID,
7523
- refIdP.properties["xu-exp:event"],
7524
- dsSession,
7525
- "event_name expression"
7526
- )
7527
- ).result;
7247
+ if (refIdP?.properties?.['xu-exp:event']) {
7248
+ event_name = (await func.expression.get(SESSION_ID, refIdP.properties['xu-exp:event'], dsSession, 'event_name expression')).result;
7528
7249
  }
7529
7250
 
7530
- const dsP = await func.datasource.find_event_dataSource(
7531
- SESSION_ID,
7532
- event_name,
7533
- dsSession
7534
- );
7251
+ const dsP = await func.datasource.find_event_dataSource(SESSION_ID, event_name, dsSession);
7535
7252
 
7536
- await func.datasource.run_events_functions(
7537
- SESSION_ID,
7538
- dsP,
7539
- event_name,
7540
- jobNoP,
7541
- calling_trigger_prop?.props?.async,
7542
- calling_trigger_prop?.data?.name?.parameters || {}
7543
- );
7253
+ await func.datasource.run_events_functions(SESSION_ID, dsP, event_name, jobNoP, calling_trigger_prop?.props?.async, calling_trigger_prop?.data?.name?.parameters || {});
7544
7254
  // done_execution(event_name);
7545
7255
  }
7546
7256
 
7547
7257
  func.events.delete_job(SESSION_ID, jobNoP);
7548
7258
  // if (callbackP) callbackP();
7549
7259
 
7550
- func.utils.debug.watch(
7551
- SESSION_ID,
7552
- calling_trigger_prop?.id,
7553
- functionP,
7554
- "",
7555
- "",
7556
- expCond
7557
- );
7260
+ func.utils.debug.watch(SESSION_ID, calling_trigger_prop?.id, functionP, '', '', expCond);
7558
7261
  },
7559
7262
  get_data: async function () {
7560
7263
  const params_obj = await get_params_obj();
7561
7264
 
7562
7265
  if (!(await get_prog_id())) {
7563
- func.utils.debug_report(
7564
- SESSION_ID,
7565
- "func.events.execute",
7566
- `${elementP} > ${triggerP} > ${functionP} > program ${prog} is missing`,
7567
- "E"
7568
- );
7266
+ func.utils.debug_report(SESSION_ID, 'func.events.execute', `${elementP} > ${triggerP} > ${functionP} > program ${prog} is missing`, 'E');
7569
7267
  func.events.delete_job(SESSION_ID, jobNoP);
7570
7268
  return;
7571
7269
  }
@@ -7578,41 +7276,14 @@ func.events.execute = async function (
7578
7276
 
7579
7277
  // args.prog_id = _viewId;
7580
7278
  if (_ds) {
7581
- func.utils.debug.watch(
7582
- SESSION_ID,
7583
- calling_trigger_prop?.id,
7584
- functionP,
7585
- null,
7586
- calling_trigger_prop,
7587
- expCond
7588
- );
7279
+ func.utils.debug.watch(SESSION_ID, calling_trigger_prop?.id, functionP, null, calling_trigger_prop, expCond);
7589
7280
  // }
7590
- const ret = await func.datasource.create(
7591
- SESSION_ID,
7592
- await get_prog_id(),
7593
- args.dataSourceNoP,
7594
- args.parentDataSourceNoP,
7595
- args.containerIdP,
7596
- args.rowIdP,
7597
- args.jobNoP,
7598
- args.calling_trigger_prop,
7599
- null,
7600
- null,
7601
- args.callingSourceP,
7602
- args.calling_jobP,
7603
- args.screen_dsP,
7604
- args.is_panelP,
7605
- params_obj
7606
- );
7281
+ const ret = await func.datasource.create(SESSION_ID, await get_prog_id(), args.dataSourceNoP, args.parentDataSourceNoP, args.containerIdP, args.rowIdP, args.jobNoP, args.calling_trigger_prop, null, null, args.callingSourceP, args.calling_jobP, args.screen_dsP, args.is_panelP, params_obj);
7607
7282
 
7608
7283
  let _ds_new = _session.DS_GLB[ret.dsSessionP];
7609
7284
  let parameters = args?.calling_trigger_prop?.data?.name?.parameters;
7610
7285
  if (parameters && !_.isEmpty(parameters)) {
7611
- await func.datasource.update_changes_for_out_parameter(
7612
- SESSION_ID,
7613
- _ds_new.dsSession,
7614
- _ds.dsSession
7615
- );
7286
+ await func.datasource.update_changes_for_out_parameter(SESSION_ID, _ds_new.dsSession, _ds.dsSession);
7616
7287
  }
7617
7288
  // if (parameters && !_.isEmpty(parameters) && _ds_new.PARAM_OUT_INFO) {
7618
7289
  // let data = {};
@@ -7641,7 +7312,7 @@ func.events.execute = async function (
7641
7312
  // }
7642
7313
 
7643
7314
  func.events.delete_job(SESSION_ID, jobNoP);
7644
- return _ds_new
7315
+ return _ds_new;
7645
7316
  }
7646
7317
  },
7647
7318
  set_data: async function () {
@@ -7651,24 +7322,12 @@ func.events.execute = async function (
7651
7322
  const result = await this.get_data();
7652
7323
 
7653
7324
  // await set_outputField(SESSION_ID, elementP, triggerP, functionP, dsSessionP, result);
7654
- return result
7655
-
7325
+ return result;
7656
7326
  },
7657
7327
  update: async function () {
7658
- const obj_values_to_update =
7659
- func.datasource.get_viewFields_for_update_function(
7660
- SESSION_ID,
7661
- calling_trigger_prop,
7662
- null,
7663
- dsSessionP
7664
- );
7328
+ const obj_values_to_update = func.datasource.get_viewFields_for_update_function(SESSION_ID, calling_trigger_prop, null, dsSessionP);
7665
7329
  if (!obj_values_to_update || _.isEmpty(obj_values_to_update)) {
7666
- func.utils.debug_report(
7667
- SESSION_ID,
7668
- "Update values object is empty",
7669
- "",
7670
- "W"
7671
- );
7330
+ func.utils.debug_report(SESSION_ID, 'Update values object is empty', '', 'W');
7672
7331
  if (jobNoP) func.events.delete_job(SESSION_ID, jobNoP);
7673
7332
  return;
7674
7333
  }
@@ -7681,32 +7340,8 @@ func.events.execute = async function (
7681
7340
  $element = $(`[xu-ui-id="${elementP}"]`).clone(true);
7682
7341
  }
7683
7342
 
7684
- let ret_field_id = await func.expression.get(
7685
- SESSION_ID,
7686
- val.id.trim(),
7687
- dsSessionP,
7688
- "update",
7689
- null,
7690
- null,
7691
- null,
7692
- null,
7693
- null,
7694
- null,
7695
- $element?.length ? $element?.data()?.xuData?.iterate_info : null
7696
- );
7697
- let ret_value = await func.expression.get(
7698
- SESSION_ID,
7699
- val.val.trim(),
7700
- dsSessionP,
7701
- "update",
7702
- null,
7703
- null,
7704
- null,
7705
- null,
7706
- null,
7707
- null,
7708
- $element?.length ? $element?.data()?.xuData?.iterate_info : null
7709
- );
7343
+ let ret_field_id = await func.expression.get(SESSION_ID, val.id.trim(), dsSessionP, 'update', null, null, null, null, null, null, $element?.length ? $element?.data()?.xuData?.iterate_info : null);
7344
+ let ret_value = await func.expression.get(SESSION_ID, val.val.trim(), dsSessionP, 'update', null, null, null, null, null, null, $element?.length ? $element?.data()?.xuData?.iterate_info : null);
7710
7345
  let _field_id = ret_field_id.result;
7711
7346
  let _value = ret_value.result;
7712
7347
 
@@ -7715,25 +7350,16 @@ func.events.execute = async function (
7715
7350
 
7716
7351
  let datasource_changes = {};
7717
7352
  for await (const change of updates) {
7718
- let ret_get_value = await func.datasource.get_value(
7719
- SESSION_ID,
7720
- change._field_id,
7721
- dsSessionP
7722
- );
7353
+ let ret_get_value = await func.datasource.get_value(SESSION_ID, change._field_id, dsSessionP);
7723
7354
  if (ret_get_value.found) {
7724
7355
  let _ds = _session.DS_GLB[ret_get_value.dsSessionP];
7725
7356
  if (!datasource_changes[_ds.dsSession]) {
7726
7357
  datasource_changes[_ds.dsSession] = {};
7727
7358
  }
7728
- if (
7729
- !datasource_changes[_ds.dsSession][ret_get_value.currentRecordId]
7730
- ) {
7731
- datasource_changes[_ds.dsSession][ret_get_value.currentRecordId] =
7732
- {};
7359
+ if (!datasource_changes[_ds.dsSession][ret_get_value.currentRecordId]) {
7360
+ datasource_changes[_ds.dsSession][ret_get_value.currentRecordId] = {};
7733
7361
  }
7734
- datasource_changes[_ds.dsSession][ret_get_value.currentRecordId][
7735
- change._field_id
7736
- ] = change._value;
7362
+ datasource_changes[_ds.dsSession][ret_get_value.currentRecordId][change._field_id] = change._value;
7737
7363
  }
7738
7364
  }
7739
7365
 
@@ -7742,23 +7368,11 @@ func.events.execute = async function (
7742
7368
  // return changes;
7743
7369
  },
7744
7370
  call_alert: async function () {
7745
- await func.utils.alerts.invoke(
7746
- SESSION_ID,
7747
- "call_alert",
7748
- refIdP,
7749
- log_source,
7750
- dsSession
7751
- );
7371
+ await func.utils.alerts.invoke(SESSION_ID, 'call_alert', refIdP, log_source, dsSession);
7752
7372
  func.events.delete_job(SESSION_ID, jobNoP);
7753
7373
  },
7754
7374
  alert: async function () {
7755
- await func.utils.alerts.invoke(
7756
- SESSION_ID,
7757
- "alert",
7758
- refIdP,
7759
- log_source,
7760
- dsSession
7761
- );
7375
+ await func.utils.alerts.invoke(SESSION_ID, 'alert', refIdP, log_source, dsSession);
7762
7376
  func.events.delete_job(SESSION_ID, jobNoP);
7763
7377
  },
7764
7378
  delay: async function () {
@@ -7777,18 +7391,11 @@ func.events.execute = async function (
7777
7391
  const _prog_id = await get_prog_id();
7778
7392
 
7779
7393
  if (!_prog_id) {
7780
- func.utils.debug_report(
7781
- SESSION_ID,
7782
- "func.events.execute",
7783
- `${elementP} > ${triggerP} > ${functionP} > program not defined`,
7784
- "E"
7785
- );
7394
+ func.utils.debug_report(SESSION_ID, 'func.events.execute', `${elementP} > ${triggerP} > ${functionP} > program not defined`, 'E');
7786
7395
  func.events.delete_job(SESSION_ID, jobNoP);
7787
7396
  return;
7788
7397
  }
7789
7398
 
7790
-
7791
-
7792
7399
  // if (!output_field) {
7793
7400
  // func.utils.debug_report(
7794
7401
  // SESSION_ID,
@@ -7804,37 +7411,24 @@ func.events.execute = async function (
7804
7411
 
7805
7412
  await func.datasource.set_outputField(SESSION_ID, dsSessionP, api_ret, args);
7806
7413
 
7807
-
7808
7414
  func.events.delete_job(SESSION_ID, jobNoP);
7809
7415
  },
7810
7416
  call_system_api: async function () {
7811
- const api_method = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args, "api_method");
7417
+ const api_method = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args, 'api_method');
7812
7418
 
7813
7419
  if (!api_method) {
7814
- func.utils.debug_report(
7815
- SESSION_ID,
7816
- "func.events.execute",
7817
- `${elementP} >${triggerP} >${functionP} > api_method not defined`,
7818
- "E"
7819
- );
7420
+ func.utils.debug_report(SESSION_ID, 'func.events.execute', `${elementP} >${triggerP} >${functionP} > api_method not defined`, 'E');
7820
7421
  func.events.delete_job(SESSION_ID, jobNoP);
7821
7422
  return;
7822
7423
  }
7823
7424
  let payload = {};
7824
- const _payload = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args, "payload");
7425
+ const _payload = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args, 'payload');
7825
7426
  if (_payload) {
7826
7427
  const get_payload_property_value = async function (prop_name) {
7827
7428
  let _prop = _payload;
7828
7429
  let _value = _prop[prop_name];
7829
7430
  if (_prop?.[`xu-exp:${prop_name}`]) {
7830
- _value = (
7831
- await func.expression.get(
7832
- SESSION_ID,
7833
- _prop[`xu-exp:${prop_name}`],
7834
- dsSession,
7835
- `${prop_name} expression`
7836
- )
7837
- ).result;
7431
+ _value = (await func.expression.get(SESSION_ID, _prop[`xu-exp:${prop_name}`], dsSession, `${prop_name} expression`)).result;
7838
7432
  }
7839
7433
 
7840
7434
  return _value;
@@ -7842,7 +7436,7 @@ func.events.execute = async function (
7842
7436
 
7843
7437
  for await (let [key, val] of Object.entries(_payload)) {
7844
7438
  // if (key.substring(0, 7) !== "xu-exp:") {
7845
- const new_key = key.replaceAll("xu-exp:", ""); //key.substring(0, 7) === "xu-exp:" ? key.substring(7): key
7439
+ const new_key = key.replaceAll('xu-exp:', ''); //key.substring(0, 7) === "xu-exp:" ? key.substring(7): key
7846
7440
  payload[new_key] = await get_payload_property_value(new_key);
7847
7441
  // }
7848
7442
  }
@@ -7859,7 +7453,7 @@ func.events.execute = async function (
7859
7453
  // return;
7860
7454
  // }
7861
7455
 
7862
- const output_field = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args, "outputField");
7456
+ const output_field = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args, 'outputField');
7863
7457
 
7864
7458
  // if (!output_field) {
7865
7459
  // func.utils.debug_report(
@@ -7876,89 +7470,57 @@ func.events.execute = async function (
7876
7470
  if (output_field) {
7877
7471
  let datasource_changes = {};
7878
7472
 
7879
- let ret_get_value = await func.datasource.get_value(
7880
- SESSION_ID,
7881
- output_field,
7882
- dsSessionP
7883
- );
7473
+ let ret_get_value = await func.datasource.get_value(SESSION_ID, output_field, dsSessionP);
7884
7474
  if (ret_get_value.found) {
7885
7475
  let _ds = _session.DS_GLB[ret_get_value.dsSessionP];
7886
7476
  if (!datasource_changes[_ds.dsSession]) {
7887
7477
  datasource_changes[_ds.dsSession] = {};
7888
7478
  }
7889
- if (
7890
- !datasource_changes[_ds.dsSession][ret_get_value.currentRecordId]
7891
- ) {
7892
- datasource_changes[_ds.dsSession][ret_get_value.currentRecordId] =
7893
- {};
7479
+ if (!datasource_changes[_ds.dsSession][ret_get_value.currentRecordId]) {
7480
+ datasource_changes[_ds.dsSession][ret_get_value.currentRecordId] = {};
7894
7481
  }
7895
- datasource_changes[_ds.dsSession][ret_get_value.currentRecordId][
7896
- output_field
7897
- ] = api_ret;
7482
+ datasource_changes[_ds.dsSession][ret_get_value.currentRecordId][output_field] = api_ret;
7898
7483
  await func.datasource.update(SESSION_ID, datasource_changes);
7899
7484
  }
7900
7485
  }
7901
7486
  func.events.delete_job(SESSION_ID, jobNoP);
7902
7487
  },
7903
7488
  call_external_api: async function () {
7904
- const method = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args, "method");
7489
+ const method = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args, 'method');
7905
7490
 
7906
7491
  if (!method) {
7907
- func.utils.debug_report(
7908
- SESSION_ID,
7909
- "func.events.execute",
7910
- `${elementP} >${triggerP} >${functionP} > method not defined`,
7911
- "E"
7912
- );
7492
+ func.utils.debug_report(SESSION_ID, 'func.events.execute', `${elementP} >${triggerP} >${functionP} > method not defined`, 'E');
7913
7493
  func.events.delete_job(SESSION_ID, jobNoP);
7914
7494
  return;
7915
7495
  }
7916
7496
 
7917
- const url = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args, "url");
7497
+ const url = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args, 'url');
7918
7498
 
7919
7499
  if (!url) {
7920
- func.utils.debug_report(
7921
- SESSION_ID,
7922
- "func.events.execute",
7923
- `${elementP} >${triggerP} >${functionP} > url not defined`,
7924
- "E"
7925
- );
7500
+ func.utils.debug_report(SESSION_ID, 'func.events.execute', `${elementP} >${triggerP} >${functionP} > url not defined`, 'E');
7926
7501
  func.events.delete_job(SESSION_ID, jobNoP);
7927
7502
  return;
7928
7503
  }
7929
7504
 
7930
- const payload_arr = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args, "payload");
7505
+ const payload_arr = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args, 'payload');
7931
7506
 
7932
7507
  const report_conversion_error = function (res, typeP, valP) {
7933
7508
  var msg = `${elementP} >${triggerP} >${functionP} > error converting from ${valP} to ${typeP}`;
7934
7509
  if (error) {
7935
- return func.utils.debug_report(SESSION_ID, msg, "", "W");
7510
+ return func.utils.debug_report(SESSION_ID, msg, '', 'W');
7936
7511
  }
7937
- func.utils.debug_report(
7938
- SESSION_ID,
7939
- msg + " " + _.capitalize(source) + prog_info,
7940
- "",
7941
- "E"
7942
- );
7512
+ func.utils.debug_report(SESSION_ID, msg + ' ' + _.capitalize(source) + prog_info, '', 'E');
7943
7513
  };
7944
7514
  const report_conversion_warn = function (res) {
7945
7515
  var msg = `${elementP} >${triggerP} >${functionP} > type mismatch auto conversion from value ${valP} to ${typeP}`;
7946
- func.utils.debug_report(
7947
- SESSION_ID,
7948
- msg + " " + _.capitalize(source) + prog_info,
7949
- "",
7950
- "W"
7951
- );
7516
+ func.utils.debug_report(SESSION_ID, msg + ' ' + _.capitalize(source) + prog_info, '', 'W');
7952
7517
  };
7953
7518
  // var ret = valP;
7954
7519
  if (error) {
7955
7520
  return report_conversion_error();
7956
7521
  }
7957
7522
 
7958
- const module = await func.common.get_module(
7959
- SESSION_ID,
7960
- "xuda-get-cast-util-module.mjs"
7961
- );
7523
+ const module = await func.common.get_module(SESSION_ID, 'xuda-get-cast-util-module.mjs');
7962
7524
  // return module.cast(
7963
7525
  // typeP,
7964
7526
  // valP,
@@ -7969,16 +7531,11 @@ func.events.execute = async function (
7969
7531
  var payload = _.reduce(
7970
7532
  payload_arr,
7971
7533
  (ret, val, key) => {
7972
- ret[val.key] = module.cast(
7973
- val.type,
7974
- val.val,
7975
- report_conversion_error,
7976
- report_conversion_warn
7977
- );
7534
+ ret[val.key] = module.cast(val.type, val.val, report_conversion_error, report_conversion_warn);
7978
7535
 
7979
7536
  return ret;
7980
7537
  },
7981
- {}
7538
+ {},
7982
7539
  );
7983
7540
  // if (!payload) {
7984
7541
  // func.utils.debug_report(
@@ -7991,7 +7548,7 @@ func.events.execute = async function (
7991
7548
  // return;
7992
7549
  // }
7993
7550
 
7994
- const output_field = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args, "outputField");
7551
+ const output_field = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args, 'outputField');
7995
7552
 
7996
7553
  // if (!output_field) {
7997
7554
  // func.utils.debug_report(
@@ -8008,25 +7565,16 @@ func.events.execute = async function (
8008
7565
  if (output_field) {
8009
7566
  let datasource_changes = {};
8010
7567
 
8011
- let ret_get_value = await func.datasource.get_value(
8012
- SESSION_ID,
8013
- output_field,
8014
- dsSessionP
8015
- );
7568
+ let ret_get_value = await func.datasource.get_value(SESSION_ID, output_field, dsSessionP);
8016
7569
  if (ret_get_value.found) {
8017
7570
  let _ds = _session.DS_GLB[ret_get_value.dsSessionP];
8018
7571
  if (!datasource_changes[_ds.dsSession]) {
8019
7572
  datasource_changes[_ds.dsSession] = {};
8020
7573
  }
8021
- if (
8022
- !datasource_changes[_ds.dsSession][ret_get_value.currentRecordId]
8023
- ) {
8024
- datasource_changes[_ds.dsSession][ret_get_value.currentRecordId] =
8025
- {};
7574
+ if (!datasource_changes[_ds.dsSession][ret_get_value.currentRecordId]) {
7575
+ datasource_changes[_ds.dsSession][ret_get_value.currentRecordId] = {};
8026
7576
  }
8027
- datasource_changes[_ds.dsSession][ret_get_value.currentRecordId][
8028
- output_field
8029
- ] = api_ret;
7577
+ datasource_changes[_ds.dsSession][ret_get_value.currentRecordId][output_field] = api_ret;
8030
7578
  await func.datasource.update(SESSION_ID, datasource_changes);
8031
7579
  }
8032
7580
  }
@@ -8059,16 +7607,9 @@ func.events.delete_job = function (SESSION_ID, jobNoP) {
8059
7607
  var dsSession = _session.WORKER_OBJ.jobs[job_index].dsSessionP;
8060
7608
  let ds_obj = _session?.DS_GLB[dsSession];
8061
7609
  if (ds_obj) {
8062
- delete SCREEN_BLOCKER_OBJ[
8063
- ds_obj.screenId +
8064
- (ds_obj.callingScreenId ? "_" + ds_obj.callingScreenId : "")
8065
- ];
7610
+ delete SCREEN_BLOCKER_OBJ[ds_obj.screenId + (ds_obj.callingScreenId ? '_' + ds_obj.callingScreenId : '')];
8066
7611
  }
8067
- if (
8068
- dsSession &&
8069
- ds_obj?.loops_limit &&
8070
- ds_obj?.loops_count < ds_obj?.loops_limit - 1
8071
- ) {
7612
+ if (dsSession && ds_obj?.loops_limit && ds_obj?.loops_count < ds_obj?.loops_limit - 1) {
8072
7613
  return;
8073
7614
  }
8074
7615
  _session.WORKER_OBJ.stat = null;
@@ -8086,17 +7627,9 @@ func.events.delete_job_0 = function (SESSION_ID) {
8086
7627
  var dsSession = _session.WORKER_OBJ.jobs[job_index].dsSession;
8087
7628
  let ds_obj = _session?.DS_GLB[dsSession];
8088
7629
  if (ds_obj) {
8089
- delete SCREEN_BLOCKER_OBJ[
8090
- ds_obj.screenId +
8091
- (ds_obj.callingScreenId ? "_" + ds_obj.callingScreenId : "")
8092
- ];
7630
+ delete SCREEN_BLOCKER_OBJ[ds_obj.screenId + (ds_obj.callingScreenId ? '_' + ds_obj.callingScreenId : '')];
8093
7631
  }
8094
- if (
8095
- dsSession &&
8096
- ds_obj &&
8097
- ds_obj.loops_limit &&
8098
- ds_obj.loops_count < ds_obj.loops_limit - 1
8099
- ) {
7632
+ if (dsSession && ds_obj && ds_obj.loops_limit && ds_obj.loops_count < ds_obj.loops_limit - 1) {
8100
7633
  return;
8101
7634
  }
8102
7635
  _session.WORKER_OBJ.stat = null;
@@ -8138,8 +7671,7 @@ setInterval(function () {
8138
7671
  }, 1000);
8139
7672
 
8140
7673
  func.events.set_browser_changes = function (dsP, fieldsChangedP) {
8141
- if (fieldsChangedP.includes("SYS_GLOBAL_STR_BROWSER_TITLE"))
8142
- document.title = dsP.dataset_new["SYS_GLOBAL_STR_BROWSER_TITLE"];
7674
+ if (fieldsChangedP.includes('SYS_GLOBAL_STR_BROWSER_TITLE')) document.title = dsP.dataset_new['SYS_GLOBAL_STR_BROWSER_TITLE'];
8143
7675
  };
8144
7676
 
8145
7677
  func.events.execute_PENDING_OPEN_URL_EVENTS = async function () {
@@ -8148,52 +7680,29 @@ func.events.execute_PENDING_OPEN_URL_EVENTS = async function () {
8148
7680
  glb.WINDOW_LOCATION_SEARCH = url;
8149
7681
  glb.ROOT_ELEMENT_ATTRIBUTES = func.UI.utils.get_root_element_attributes();
8150
7682
 
8151
- const params_obj = func.common.getObjectFromUrl(
8152
- url,
8153
- glb.ROOT_ELEMENT_ATTRIBUTES
8154
- );
7683
+ const params_obj = func.common.getObjectFromUrl(url, glb.ROOT_ELEMENT_ATTRIBUTES);
8155
7684
  if (!params_obj.prog) {
8156
- return console.warn("prog empty");
7685
+ return console.warn('prog empty');
8157
7686
  }
8158
7687
 
8159
7688
  await func.utils.TREE_OBJ.get(SESSION_ID, params_obj.prog);
8160
- let screen_ret = await func.utils.get_screen_obj(
8161
- SESSION_ID,
8162
- params_obj.prog
8163
- );
7689
+ let screen_ret = await func.utils.get_screen_obj(SESSION_ID, params_obj.prog);
8164
7690
 
8165
7691
  if (screen_ret) {
8166
- await func.UI.screen.init(
8167
- SESSION_ID,
8168
- params_obj.prog,
8169
- null,
8170
- null,
8171
- $("#embed_" + SESSION_ID),
8172
- null,
8173
- null,
8174
- null,
8175
- null,
8176
- null,
8177
- "pendingUrlEvent_embed"
8178
- );
7692
+ await func.UI.screen.init(SESSION_ID, params_obj.prog, null, null, $('#embed_' + SESSION_ID), null, null, null, null, null, 'pendingUrlEvent_embed');
8179
7693
  } else {
8180
- console.error("Program not exist", params_obj.prog_id);
8181
- func.UI.utils.progressScreen.show(
8182
- SESSION_ID,
8183
- "Program not exist",
8184
- null,
8185
- true
8186
- );
7694
+ console.error('Program not exist', params_obj.prog_id);
7695
+ func.UI.utils.progressScreen.show(SESSION_ID, 'Program not exist', null, true);
8187
7696
  }
8188
7697
  } else {
8189
- console.warn("url empty");
7698
+ console.warn('url empty');
8190
7699
  }
8191
7700
  }
8192
7701
  };
8193
7702
  func.events.invoke = async function (event_id) {
8194
7703
  var _session = SESSION_OBJ[SESSION_ID];
8195
7704
  if (!event_id) {
8196
- console.warn("event_id Cannot be empty");
7705
+ console.warn('event_id Cannot be empty');
8197
7706
  return false;
8198
7707
  }
8199
7708
  var ds;
@@ -8202,10 +7711,7 @@ func.events.invoke = async function (event_id) {
8202
7711
  if (_.isEmpty(_view_obj.progEvents)) continue;
8203
7712
  if (ds) break;
8204
7713
  for await (const [key, val] of Object.entries(_view_obj.progEvents)) {
8205
- if (
8206
- val?.data?.type === "user_defined" &&
8207
- val.data.event_name === event_id
8208
- ) {
7714
+ if (val?.data?.type === 'user_defined' && val.data.event_name === event_id) {
8209
7715
  ds = ds_key;
8210
7716
  break;
8211
7717
  }
@@ -8213,11 +7719,11 @@ func.events.invoke = async function (event_id) {
8213
7719
  }
8214
7720
 
8215
7721
  if (!ds) {
8216
- console.warn("event_id not found");
7722
+ console.warn('event_id not found');
8217
7723
  return false;
8218
7724
  }
8219
7725
 
8220
- func.events.validate(SESSION_ID, "user_defined", ds, event_id);
7726
+ func.events.validate(SESSION_ID, 'user_defined', ds, event_id);
8221
7727
  };
8222
7728
  func.expression = {};
8223
7729