@xuda.io/runtime-bundle 1.0.318 → 1.0.320

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.
@@ -6379,7 +6379,7 @@ func.utils.job_worker = function (session_id) {
6379
6379
  val.containerP,
6380
6380
  val.elementP,
6381
6381
  val.rowP,
6382
- null,
6382
+ val.evt,
6383
6383
  val.descP,
6384
6384
  val.rootScreenIdP,
6385
6385
  val.dsSessionP,
@@ -9303,15 +9303,7 @@ func.UI.garbage_collector = function (
9303
9303
  };
9304
9304
 
9305
9305
  func.events = {};
9306
- func.events.validate = async function (
9307
- SESSION_ID,
9308
- triggerP,
9309
- dsSessionP,
9310
- eventIdP,
9311
- sourceP,
9312
- argumentsP,
9313
- return_validation_onlyP
9314
- ) {
9306
+ func.events.validate = async function (SESSION_ID, triggerP, dsSessionP, eventIdP, sourceP, argumentsP, return_validation_onlyP) {
9315
9307
  var _session = SESSION_OBJ[SESSION_ID];
9316
9308
  var _ds = _session.DS_GLB[dsSessionP];
9317
9309
  var args = {
@@ -9324,16 +9316,8 @@ func.events.validate = async function (
9324
9316
  return_validation_onlyP,
9325
9317
  };
9326
9318
  const search_event_in_parent_ds = async function () {
9327
- if (_ds && typeof _ds.parentDataSourceNo !== "undefined") {
9328
- await func.events.validate(
9329
- SESSION_ID,
9330
- triggerP,
9331
- _ds.parentDataSourceNo,
9332
- eventIdP,
9333
- sourceP,
9334
- argumentsP,
9335
- return_validation_onlyP
9336
- );
9319
+ if (_ds && typeof _ds.parentDataSourceNo !== 'undefined') {
9320
+ await func.events.validate(SESSION_ID, triggerP, _ds.parentDataSourceNo, eventIdP, sourceP, argumentsP, return_validation_onlyP);
9337
9321
  }
9338
9322
  };
9339
9323
  var ret = false;
@@ -9355,29 +9339,13 @@ func.events.validate = async function (
9355
9339
  var eventProp = undefined;
9356
9340
  if (val.data.type === triggerP) {
9357
9341
  // compare event trigger
9358
- if (
9359
- (triggerP !== "user_defined") |
9360
- (triggerP === "user_defined" && eventIdP === val.data.event_name)
9361
- ) {
9342
+ if ((triggerP !== 'user_defined') | (triggerP === 'user_defined' && eventIdP === val.data.event_name)) {
9362
9343
  // compare user defined name
9363
9344
 
9364
9345
  var expCond;
9365
- if (val.data.condition)
9366
- expCond = await func.expression.get(
9367
- SESSION_ID,
9368
- val.data.condition,
9369
- dsSessionP,
9370
- "condition"
9371
- );
9346
+ if (val.data.condition) expCond = await func.expression.get(SESSION_ID, val.data.condition, dsSessionP, 'condition');
9372
9347
  if (!val.data.condition || expCond.result) {
9373
- func.utils.debug.watch(
9374
- SESSION_ID,
9375
- _ds.prog_id + "%" + val.id,
9376
- "view_event",
9377
- val,
9378
- triggerP + " " + eventIdP,
9379
- expCond
9380
- );
9348
+ func.utils.debug.watch(SESSION_ID, _ds.prog_id + '%' + val.id, 'view_event', val, triggerP + ' ' + eventIdP, expCond);
9381
9349
  ret = true;
9382
9350
  if (return_validation_onlyP) break;
9383
9351
  const set_arguments = async function () {
@@ -9415,48 +9383,24 @@ func.events.validate = async function (
9415
9383
  // await func.datasource.update(SESSION_ID, datasource_changes);
9416
9384
  // }
9417
9385
 
9418
- for await (let [key, fieldId] of Object.entries(
9419
- val.data.parameters
9420
- )) {
9421
- const field_info = func.common.find_item_by_key(
9422
- _view_obj.progFields,
9423
- "field_id",
9424
- fieldId
9425
- );
9386
+ for await (let [key, fieldId] of Object.entries(val.data.parameters)) {
9387
+ const field_info = func.common.find_item_by_key(_view_obj.progFields, 'field_id', fieldId);
9426
9388
 
9427
- if (field_info?.data?.type !== "virtual") {
9428
- console.warn("parameter field must be virtual, update ignored");
9389
+ if (field_info?.data?.type !== 'virtual') {
9390
+ console.warn('parameter field must be virtual, update ignored');
9429
9391
  continue;
9430
9392
  }
9431
9393
 
9432
- if (!args[fieldId]) continue
9433
-
9394
+ if (!args[fieldId]) continue;
9434
9395
 
9435
-
9436
- let value = await func.common.get_cast_val(
9437
- SESSION_ID,
9438
- "events",
9439
- fieldId,
9440
- field_info.props.fieldType,
9441
- args[fieldId].value
9442
- );
9396
+ let value = await func.common.get_cast_val(SESSION_ID, 'events', fieldId, field_info.props.fieldType, args[fieldId].value);
9443
9397
 
9444
9398
  if (!_.isEmpty(args[fieldId].fx)) {
9445
- const fx_ret = await func.expression.get(
9446
- SESSION_ID,
9447
- args[fieldId].fx,
9448
- dsSessionP,
9449
- "update"
9450
- )
9399
+ const fx_ret = await func.expression.get(SESSION_ID, args[fieldId].fx, dsSessionP, 'update');
9451
9400
  value = fx_ret.result;
9452
9401
  }
9453
9402
  // find the target field in the program dataset
9454
- const ret = await func.datasource.get_value(
9455
- SESSION_ID,
9456
- fieldId,
9457
- dsSessionP,
9458
- _ds.currentRecordId
9459
- );
9403
+ const ret = await func.datasource.get_value(SESSION_ID, fieldId, dsSessionP, _ds.currentRecordId);
9460
9404
 
9461
9405
  const datasource_changes = {
9462
9406
  [ret.dsSessionP]: {
@@ -9469,11 +9413,7 @@ func.events.validate = async function (
9469
9413
  await add_event();
9470
9414
  };
9471
9415
  const add_event = async function () {
9472
- const _event = func.common.find_item_by_key_root(
9473
- _view_obj.progEvents,
9474
- "id",
9475
- val.id
9476
- );
9416
+ const _event = func.common.find_item_by_key_root(_view_obj.progEvents, 'id', val.id);
9477
9417
  if (_event.triggers) {
9478
9418
  // check if event property exist
9479
9419
 
@@ -9496,22 +9436,19 @@ func.events.validate = async function (
9496
9436
  if (!glb.IS_WORKER) {
9497
9437
  if (_ds.panel_div_id) {
9498
9438
  try {
9499
- container = "#" + _ds.panel_div_id;
9439
+ container = '#' + _ds.panel_div_id;
9500
9440
  if ($(container).data().xuData.panel_info) {
9501
- screen_prop =
9502
- $(container).data().xuData.panel_info.paramsP;
9441
+ screen_prop = $(container).data().xuData.panel_info.paramsP;
9503
9442
  } else {
9504
9443
  ///////////////
9505
- container =
9506
- "#" + _session.DS_GLB[dsSessionP].screenId;
9444
+ container = '#' + _session.DS_GLB[dsSessionP].screenId;
9507
9445
 
9508
9446
  if ($(container) && $(container).data()) {
9509
9447
  screen_prop = $(container).data().xuData.paramsP;
9510
9448
  }
9511
9449
 
9512
9450
  if (!$(container) || !$(container).length) {
9513
- container =
9514
- "#" + _session.DS_GLB[dsSessionP].containerId;
9451
+ container = '#' + _session.DS_GLB[dsSessionP].containerId;
9515
9452
  }
9516
9453
  //////////////
9517
9454
  }
@@ -9519,14 +9456,14 @@ func.events.validate = async function (
9519
9456
  console.error(e);
9520
9457
  }
9521
9458
  } else {
9522
- container = "#" + _ds.screenId;
9459
+ container = '#' + _ds.screenId;
9523
9460
 
9524
9461
  if ($(container) && $(container).data()) {
9525
9462
  screen_prop = $(container).data().xuData.paramsP;
9526
9463
  }
9527
9464
 
9528
9465
  if (!$(container) || !$(container).length) {
9529
- container = "#" + _ds.containerId;
9466
+ container = '#' + _ds.containerId;
9530
9467
  }
9531
9468
  }
9532
9469
  } else {
@@ -9538,7 +9475,7 @@ func.events.validate = async function (
9538
9475
  jobs.push(
9539
9476
  await func.events.add_to_queue(
9540
9477
  SESSION_ID,
9541
- sourceP + " event",
9478
+ sourceP + ' event',
9542
9479
  trigger_obj.id,
9543
9480
  null, // was click
9544
9481
  trigger_obj.data.action,
@@ -9564,8 +9501,8 @@ func.events.validate = async function (
9564
9501
  null,
9565
9502
  args,
9566
9503
  null,
9567
- null
9568
- )
9504
+ null,
9505
+ ),
9569
9506
  );
9570
9507
  }
9571
9508
  }
@@ -9577,15 +9514,7 @@ func.events.validate = async function (
9577
9514
  }
9578
9515
  } else {
9579
9516
  if (val.data.condition && !expCond.result) {
9580
- func.utils.debug.watch(
9581
- SESSION_ID,
9582
- _ds.prog_id + "%" + val.id,
9583
- "view_event",
9584
- val,
9585
- triggerP + " " + eventIdP,
9586
- expCond,
9587
- true
9588
- );
9517
+ func.utils.debug.watch(SESSION_ID, _ds.prog_id + '%' + val.id, 'view_event', val, triggerP + ' ' + eventIdP, expCond, true);
9589
9518
  }
9590
9519
  }
9591
9520
  }
@@ -9608,7 +9537,7 @@ func.events.add_to_queue = async function (
9608
9537
  containerP,
9609
9538
  elementP,
9610
9539
  rowP,
9611
- NA_colP,
9540
+ evt,
9612
9541
  descP,
9613
9542
  NA_rootScreenIdP,
9614
9543
  NA_callingEventIdP,
@@ -9626,7 +9555,7 @@ func.events.add_to_queue = async function (
9626
9555
  calling_job,
9627
9556
  args,
9628
9557
  $div,
9629
- $container
9558
+ $container,
9630
9559
  ) {
9631
9560
  var _session = SESSION_OBJ[SESSION_ID];
9632
9561
  var obj = {
@@ -9651,11 +9580,11 @@ func.events.add_to_queue = async function (
9651
9580
  args,
9652
9581
  $div,
9653
9582
  $container,
9654
-
9583
+ evt,
9655
9584
  job_num: _session.WORKER_OBJ.num,
9656
9585
  };
9657
9586
  var _ds = _session.DS_GLB[dsSessionP];
9658
- if (typeof dsSessionP !== "undefined" && dsSessionP !== null) {
9587
+ if (typeof dsSessionP !== 'undefined' && dsSessionP !== null) {
9659
9588
  obj.prog_id = _ds.prog_id;
9660
9589
  obj.parentDataSourceNo = _ds.parentDataSourceNo;
9661
9590
  obj.nodeId = _ds.nodeId;
@@ -9663,21 +9592,16 @@ func.events.add_to_queue = async function (
9663
9592
  ///////
9664
9593
  if (glb.IS_WORKER && func.utils.is_onscreen_event(functionP)) {
9665
9594
  obj.client = true;
9666
- if (functionP === "call_library") {
9595
+ if (functionP === 'call_library') {
9667
9596
  obj.client = false;
9668
9597
  }
9669
- if (typeof dsSessionP !== "undefined" && dsSessionP !== null) {
9598
+ if (typeof dsSessionP !== 'undefined' && dsSessionP !== null) {
9670
9599
  obj.ds_obj = func.utils.clean_returned_datasource(SESSION_ID, dsSessionP);
9671
9600
  }
9672
9601
  if (obj.client) {
9673
9602
  _session.WORKER_OBJ.num++;
9674
9603
  // if (!_session.IS_API)
9675
- func.utils.post_back_to_client(
9676
- SESSION_ID,
9677
- "job",
9678
- _session.worker_id,
9679
- obj
9680
- );
9604
+ func.utils.post_back_to_client(SESSION_ID, 'job', _session.worker_id, obj);
9681
9605
  return;
9682
9606
  }
9683
9607
  }
@@ -9691,14 +9615,10 @@ func.events.add_to_queue = async function (
9691
9615
  _session.WORKER_OBJ.jobs[job_index].splice_count = 0;
9692
9616
  }
9693
9617
  _session.WORKER_OBJ.jobs[job_index].splice_count++;
9694
- _session.WORKER_OBJ.jobs.splice(
9695
- job_index + _session.WORKER_OBJ.jobs[job_index].splice_count,
9696
- 0,
9697
- obj
9698
- );
9618
+ _session.WORKER_OBJ.jobs.splice(job_index + _session.WORKER_OBJ.jobs[job_index].splice_count, 0, obj);
9699
9619
  // }
9700
9620
  } catch (e) {
9701
- console.error("bug");
9621
+ console.error('bug');
9702
9622
  // _session.WORKER_OBJ.jobs.splice(0, 0, obj);
9703
9623
  }
9704
9624
  } else {
@@ -9730,7 +9650,7 @@ func.events.execute = async function (
9730
9650
  containerP,
9731
9651
  elementP,
9732
9652
  rowP,
9733
- NA_colP,
9653
+ evt,
9734
9654
  descP,
9735
9655
  rootScreenIdP,
9736
9656
  dsSessionP,
@@ -9748,14 +9668,14 @@ func.events.execute = async function (
9748
9668
  NA_viewIdP,
9749
9669
  NA_nodeIdP,
9750
9670
  NA_parentDataSourceNoP,
9751
- $div
9671
+ $div,
9752
9672
  ) {
9753
9673
  var _session = SESSION_OBJ[SESSION_ID];
9754
9674
  var _ds = _session.DS_GLB[dsSessionP];
9755
- if (functionP === "update") refIdP = null; // in case of left over when program changing from call function to update
9675
+ if (functionP === 'update') refIdP = null; // in case of left over when program changing from call function to update
9756
9676
 
9757
9677
  var job_index = func.events.find_job_index(SESSION_ID, jobNoP);
9758
- if (_session.WORKER_OBJ.jobs?.[job_index]?.stat === "busy") {
9678
+ if (_session.WORKER_OBJ.jobs?.[job_index]?.stat === 'busy') {
9759
9679
  if (jobNoP) _session.WORKER_OBJ.stat = job_index;
9760
9680
  return;
9761
9681
  }
@@ -9772,61 +9692,44 @@ func.events.execute = async function (
9772
9692
  }
9773
9693
 
9774
9694
  if (_session.WORKER_OBJ.jobs[job_index]) {
9775
- _session.WORKER_OBJ.jobs[job_index].stat = "busy";
9695
+ _session.WORKER_OBJ.jobs[job_index].stat = 'busy';
9776
9696
  }
9777
9697
 
9778
9698
  var dsSession = dsSessionP; // new 2020420
9779
9699
  var field_elm = elementP;
9780
9700
 
9781
9701
  var calling_field_id = field_elm;
9782
- if (field_elm && typeof field_elm === "object")
9783
- calling_field_id = field_elm.attr("xu-ui-id");
9702
+ if (field_elm && typeof field_elm === 'object') calling_field_id = field_elm.attr('xu-ui-id');
9784
9703
 
9785
9704
  var log_nodeId;
9786
9705
  var log_prog_id;
9787
9706
  var log_source;
9788
9707
 
9789
- if (_session.DS_GLB[dsSession]?.prog_id)
9790
- log_prog_id = _session.DS_GLB[dsSession].prog_id;
9791
- log_nodeId = log_prog_id + "_" + eventIdP;
9708
+ if (_session.DS_GLB[dsSession]?.prog_id) log_prog_id = _session.DS_GLB[dsSession].prog_id;
9709
+ log_nodeId = log_prog_id + '_' + eventIdP;
9792
9710
  var log_prop = callingSourceP;
9793
- if (callingSourceP === "system event") {
9794
- log_prop = "global event";
9711
+ if (callingSourceP === 'system event') {
9712
+ log_prop = 'global event';
9795
9713
  }
9796
9714
  if (calling_field_id) {
9797
9715
  const _view_obj = await func.utils.VIEWS_OBJ.get(SESSION_ID, _ds.prog_id);
9798
- let _field_obj = func.common.find_item_by_key(
9799
- _view_obj.progFields,
9800
- "field_id",
9801
- calling_field_id
9802
- );
9803
- log_nodeId = log_prog_id + "_" + eventIdP + "_" + _field_obj?.id;
9716
+ let _field_obj = func.common.find_item_by_key(_view_obj.progFields, 'field_id', calling_field_id);
9717
+ log_nodeId = log_prog_id + '_' + eventIdP + '_' + _field_obj?.id;
9804
9718
 
9805
9719
  log_source = calling_field_id;
9806
9720
  }
9807
9721
  if (elementP) {
9808
9722
  log_prop = triggerP;
9809
- log_nodeId = log_nodeId + "_ui_prop"; //+"_"+eventIdP;
9723
+ log_nodeId = log_nodeId + '_ui_prop'; //+"_"+eventIdP;
9810
9724
  }
9811
9725
  //check condition
9812
9726
  var expCond;
9813
9727
  if (event_propertiesP) {
9814
9728
  // conditional event
9815
9729
  if (event_propertiesP?.props?.condition) {
9816
- expCond = await func.expression.get(
9817
- SESSION_ID,
9818
- event_propertiesP.props.condition,
9819
- dsSession,
9820
- "condition",
9821
- null,
9822
- null,
9823
- null,
9824
- calling_field_id ? calling_field_id : calling_triggerP,
9825
- null,
9826
- descP
9827
- ); // execute expression
9730
+ 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
9828
9731
  func.utils.debug.log(SESSION_ID, log_nodeId, {
9829
- module: "event",
9732
+ module: 'event',
9830
9733
  action: log_prop,
9831
9734
  source: log_source,
9832
9735
  prop: descP,
@@ -9834,7 +9737,7 @@ func.events.execute = async function (
9834
9737
  result: expCond.result,
9835
9738
  error: expCond.error,
9836
9739
  fields: expCond.fields,
9837
- type: "event",
9740
+ type: 'event',
9838
9741
  prog_id: log_prog_id,
9839
9742
  conditional: true,
9840
9743
  });
@@ -9843,21 +9746,13 @@ func.events.execute = async function (
9843
9746
  // condition failed // === true 03/04/16
9844
9747
  func.events.delete_job(SESSION_ID, jobNoP);
9845
9748
 
9846
- func.utils.debug.watch(
9847
- SESSION_ID,
9848
- calling_trigger_prop?.id,
9849
- functionP,
9850
- "",
9851
- "",
9852
- expCond,
9853
- true
9854
- );
9749
+ func.utils.debug.watch(SESSION_ID, calling_trigger_prop?.id, functionP, '', '', expCond, true);
9855
9750
  return;
9856
9751
  }
9857
9752
  } // Non conditional event
9858
9753
  else {
9859
9754
  func.utils.debug.log(SESSION_ID, log_nodeId, {
9860
- module: "event",
9755
+ module: 'event',
9861
9756
  action: log_prop,
9862
9757
  source: log_source,
9863
9758
  prop: descP,
@@ -9865,7 +9760,7 @@ func.events.execute = async function (
9865
9760
  result: null,
9866
9761
  error: null,
9867
9762
  fields: null,
9868
- type: "event",
9763
+ type: 'event',
9869
9764
  prog_id: log_prog_id,
9870
9765
  });
9871
9766
  }
@@ -9888,47 +9783,27 @@ func.events.execute = async function (
9888
9783
  // };
9889
9784
 
9890
9785
  const get_params_obj = async function () {
9891
- const _prog = await func.utils.VIEWS_OBJ.get(
9892
- SESSION_ID,
9893
- await get_prog_id()
9894
- );
9786
+ const _prog = await func.utils.VIEWS_OBJ.get(SESSION_ID, await get_prog_id());
9895
9787
  if (!_prog) {
9896
9788
  func.events.delete_job(SESSION_ID, jobNoP);
9897
- return func.utils.debug_report(
9898
- SESSION_ID,
9899
- "func.events.execute",
9900
- "Program not found: " + refIdP.prog,
9901
- "E"
9902
- );
9789
+ return func.utils.debug_report(SESSION_ID, 'func.events.execute', 'Program not found: ' + refIdP.prog, 'E');
9903
9790
  }
9904
9791
 
9905
9792
  // get in parameters
9906
9793
  var params_obj = {};
9907
9794
  if (_prog?.properties?.progParams) {
9908
- for await (const [key, val] of Object.entries(
9909
- _prog.properties.progParams
9910
- )) {
9911
- if (!val.data.dir === "in") continue;
9912
- if (
9913
- typeof args.parameters_obj_inP?.[val.data.parameter] !== "undefined"
9914
- ) {
9795
+ for await (const [key, val] of Object.entries(_prog.properties.progParams)) {
9796
+ if (!val.data.dir === 'in') continue;
9797
+ if (typeof args.parameters_obj_inP?.[val.data.parameter] !== 'undefined') {
9915
9798
  if (args.parameters_obj_inP?.[val.data.parameter].fx) {
9916
- let ret = await func.expression.get(
9917
- SESSION_ID,
9918
- args.parameters_obj_inP?.[val.data.parameter].fx,
9919
- dsSession,
9920
- "parameters"
9921
- );
9799
+ let ret = await func.expression.get(SESSION_ID, args.parameters_obj_inP?.[val.data.parameter].fx, dsSession, 'parameters');
9922
9800
  params_obj[val.data.parameter] = ret.result;
9923
9801
  } else {
9924
- params_obj[val.data.parameter] =
9925
- args.parameters_obj_inP?.[val.data.parameter].value;
9802
+ params_obj[val.data.parameter] = args.parameters_obj_inP?.[val.data.parameter].value;
9926
9803
  }
9927
9804
  continue;
9928
9805
  }
9929
- console.warn(
9930
- `Warning: Program ${_prog.properties.menuName} expected In parameter: ${val.data.parameter} but received null instead`
9931
- );
9806
+ console.warn(`Warning: Program ${_prog.properties.menuName} expected In parameter: ${val.data.parameter} but received null instead`);
9932
9807
  }
9933
9808
  }
9934
9809
  return params_obj;
@@ -9937,15 +9812,8 @@ func.events.execute = async function (
9937
9812
  const get_prog_id = async function () {
9938
9813
  let _prop = args?.calling_trigger_prop?.data?.name?.properties;
9939
9814
  let _prog_id = args.prog_id;
9940
- if (_prop?.["xu-exp:prog"]) {
9941
- _prog_id = (
9942
- await func.expression.get(
9943
- SESSION_ID,
9944
- _prop["xu-exp:prog"],
9945
- dsSession,
9946
- "prog_id expression"
9947
- )
9948
- ).result;
9815
+ if (_prop?.['xu-exp:prog']) {
9816
+ _prog_id = (await func.expression.get(SESSION_ID, _prop['xu-exp:prog'], dsSession, 'prog_id expression')).result;
9949
9817
  }
9950
9818
 
9951
9819
  return _prog_id;
@@ -9967,7 +9835,6 @@ func.events.execute = async function (
9967
9835
  // return _value;
9968
9836
  // };
9969
9837
 
9970
-
9971
9838
  var args = {
9972
9839
  prog_id: refIdP?.prog,
9973
9840
  screenIdP: refIdP?.prog,
@@ -9995,40 +9862,20 @@ func.events.execute = async function (
9995
9862
  var $calling_container;
9996
9863
  if (_session.WORKER_OBJ.jobs[job_index]) {
9997
9864
  if (_session.WORKER_OBJ.jobs[job_index].paramsP) {
9998
- $calling_container = $(
9999
- "#" + _session.WORKER_OBJ.jobs[job_index].paramsP.callingContainerP
10000
- );
9865
+ $calling_container = $('#' + _session.WORKER_OBJ.jobs[job_index].paramsP.callingContainerP);
10001
9866
  } else {
10002
- $calling_container = ""; // calling from datasource 0
9867
+ $calling_container = ''; // calling from datasource 0
10003
9868
  _session.WORKER_OBJ.jobs[job_index].paramsP = {};
10004
9869
  }
10005
9870
  }
10006
9871
 
10007
9872
  if (!refIdP.prog) {
10008
9873
  func.events.delete_job(SESSION_ID, jobNoP);
10009
- return func.utils.debug_report(
10010
- SESSION_ID,
10011
- "func.events.execute",
10012
- "Program is empty",
10013
- "E"
10014
- );
9874
+ return func.utils.debug_report(SESSION_ID, 'func.events.execute', 'Program is empty', 'E');
10015
9875
  }
10016
9876
 
10017
9877
  const params_obj = await get_params_obj();
10018
- return await func.UI.screen.init(
10019
- SESSION_ID,
10020
- await get_prog_id(),
10021
- $(containerP)?.data()?.xuData.screenId,
10022
- _session.DS_GLB[dsSession],
10023
- $calling_container,
10024
- eventIdP,
10025
- rowP,
10026
- jobNoP,
10027
- is_panel,
10028
- params_obj,
10029
- functionP,
10030
- args.call_screen_propertiesP
10031
- );
9878
+ 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);
10032
9879
  },
10033
9880
  call_modal: async function () {
10034
9881
  return await fx.Call_window();
@@ -10051,101 +9898,66 @@ func.events.execute = async function (
10051
9898
 
10052
9899
  const set_SYS_GLOBAL_OBJ_WIDGET_INFO = async function (docP) {
10053
9900
  var obj = _.clone(docP);
10054
- obj.date = await func.utils.get_dateTime(
10055
- SESSION_ID,
10056
- "SYS_DATE",
10057
- docP.date
10058
- );
10059
- obj.time = await func.utils.get_dateTime(
10060
- SESSION_ID,
10061
- "SYS_TIME",
10062
- docP.date
10063
- );
9901
+ obj.date = await func.utils.get_dateTime(SESSION_ID, 'SYS_DATE', docP.date);
9902
+ obj.time = await func.utils.get_dateTime(SESSION_ID, 'SYS_TIME', docP.date);
10064
9903
 
10065
9904
  var datasource_changes = {
10066
9905
  [0]: {
10067
- ["data_system"]: {
10068
- ["SYS_GLOBAL_OBJ_WIDGET_INFO"]: obj,
9906
+ ['data_system']: {
9907
+ ['SYS_GLOBAL_OBJ_WIDGET_INFO']: obj,
10069
9908
  },
10070
9909
  },
10071
9910
  };
10072
9911
  await func.datasource.update(SESSION_ID, datasource_changes);
10073
9912
  };
10074
9913
  const call_plugin_api = async function (plugin_nameP, dataP) {
10075
- return await func.utils.call_plugin_api(
10076
- SESSION_ID,
10077
- plugin_nameP,
10078
- dataP
10079
- );
9914
+ return await func.utils.call_plugin_api(SESSION_ID, plugin_nameP, dataP);
10080
9915
  };
10081
9916
  const report_error = function (descP, warn) {
10082
- func.utils.debug.log(
10083
- SESSION_ID,
10084
- _session.DS_GLB[dsP].prog_id +
10085
- "_" +
10086
- _session.DS_GLB[dsP].callingMenuId,
10087
- {
10088
- module: "widgets",
10089
- action: "Init",
9917
+ func.utils.debug.log(SESSION_ID, _session.DS_GLB[dsP].prog_id + '_' + _session.DS_GLB[dsP].callingMenuId, {
9918
+ module: 'widgets',
9919
+ action: 'Init',
9920
+ source: sourceP,
9921
+ prop: descP,
9922
+ details: descP,
9923
+ result: null,
9924
+ error: warn ? false : true,
9925
+ fields: null,
9926
+ type: 'widgets',
9927
+ prog_id: _session.DS_GLB[dsP].prog_id,
9928
+ });
9929
+ };
9930
+ const get_fields_data = async function (fields, props) {
9931
+ const report_error = function (descP, warn) {
9932
+ func.utils.debug.log(SESSION_ID, _session.DS_GLB[dsP].prog_id + '_' + _session.DS_GLB[dsP].callingMenuId, {
9933
+ module: 'widgets',
9934
+ action: 'Init',
10090
9935
  source: sourceP,
10091
9936
  prop: descP,
10092
9937
  details: descP,
10093
9938
  result: null,
10094
9939
  error: warn ? false : true,
10095
9940
  fields: null,
10096
- type: "widgets",
9941
+ type: 'widgets',
10097
9942
  prog_id: _session.DS_GLB[dsP].prog_id,
10098
- }
10099
- );
10100
- };
10101
- const get_fields_data = async function (fields, props) {
10102
- const report_error = function (descP, warn) {
10103
- func.utils.debug.log(
10104
- SESSION_ID,
10105
- _session.DS_GLB[dsP].prog_id +
10106
- "_" +
10107
- _session.DS_GLB[dsP].callingMenuId,
10108
- {
10109
- module: "widgets",
10110
- action: "Init",
10111
- source: sourceP,
10112
- prop: descP,
10113
- details: descP,
10114
- result: null,
10115
- error: warn ? false : true,
10116
- fields: null,
10117
- type: "widgets",
10118
- prog_id: _session.DS_GLB[dsP].prog_id,
10119
- }
10120
- );
9943
+ });
10121
9944
  };
10122
9945
  const get_property_value = async function (fieldIdP, val) {
10123
9946
  // var value = props[fieldIdP];
10124
9947
 
10125
- var value =
10126
- props[fieldIdP] ||
10127
- (typeof val.defaultValue === "function"
10128
- ? val?.defaultValue?.()
10129
- : val?.defaultValue);
9948
+ var value = props[fieldIdP] || (typeof val.defaultValue === 'function' ? val?.defaultValue?.() : val?.defaultValue);
10130
9949
 
10131
9950
  if (props[`xu-exp:${fieldIdP}`]) {
10132
- value = (
10133
- await func.expression.get(
10134
- SESSION_ID,
10135
- props[`xu-exp:${fieldIdP}`],
10136
- dsP,
10137
- "widget property"
10138
- )
10139
- ).result;
9951
+ value = (await func.expression.get(SESSION_ID, props[`xu-exp:${fieldIdP}`], dsP, 'widget property')).result;
10140
9952
  }
10141
9953
 
10142
9954
  return func.common.get_cast_val(
10143
9955
  SESSION_ID,
10144
- "widgets",
9956
+ 'widgets',
10145
9957
  fieldIdP,
10146
9958
  val.type, //val.type !== "string" || val.type !== "number" ? "string" : val.type,
10147
9959
  value,
10148
- null
9960
+ null,
10149
9961
  );
10150
9962
  };
10151
9963
  var data_obj = {};
@@ -10168,51 +9980,36 @@ func.events.execute = async function (
10168
9980
  };
10169
9981
 
10170
9982
  try {
10171
- const _plugin =
10172
- APP_OBJ[_session.app_id]?.app_plugins_purchased?.[plugin_name];
9983
+ const _plugin = APP_OBJ[_session.app_id]?.app_plugins_purchased?.[plugin_name];
10173
9984
 
10174
- const index = await func.utils.get_plugin_resource(
10175
- SESSION_ID,
10176
- plugin_name,
10177
- `${_plugin.manifest["index.mjs"].dist ? "dist/" : ""}index.mjs`
10178
- );
9985
+ const index = await func.utils.get_plugin_resource(SESSION_ID, plugin_name, `${_plugin.manifest['index.mjs'].dist ? 'dist/' : ''}index.mjs`);
10179
9986
 
10180
9987
  const methods = index.methods;
10181
9988
  if (methods && !methods[method]) {
10182
- return report_error("method not found");
9989
+ return report_error('method not found');
10183
9990
  }
10184
9991
 
10185
- const fields_ret = await get_fields_data(
10186
- methods[method].fields,
10187
- propsP
10188
- );
9992
+ const fields_ret = await get_fields_data(methods[method].fields, propsP);
10189
9993
 
10190
9994
  if (fields_ret.code < 0) {
10191
9995
  return report_error(fields_ret.data);
10192
9996
  }
10193
9997
  const fields = fields_ret.data;
10194
9998
 
10195
- const plugin_setup_ret = await func.utils.get_plugin_setup(
10196
- SESSION_ID,
10197
- plugin_name
10198
- );
9999
+ const plugin_setup_ret = await func.utils.get_plugin_setup(SESSION_ID, plugin_name);
10199
10000
  if (plugin_setup_ret.code < 0) {
10200
10001
  return report_error(plugin_setup_ret);
10201
10002
  }
10202
10003
 
10203
- const api_utils = await func.common.get_module(
10004
+ const api_utils = await func.common.get_module(SESSION_ID, 'xuda-api-library.mjs', {
10005
+ func,
10006
+ glb,
10007
+ SESSION_OBJ,
10204
10008
  SESSION_ID,
10205
- "xuda-api-library.mjs",
10206
- {
10207
- func,
10208
- glb,
10209
- SESSION_OBJ,
10210
- SESSION_ID,
10211
- APP_OBJ,
10212
- dsSession: dsP,
10213
- job_id: jobNoP,
10214
- }
10215
- );
10009
+ APP_OBJ,
10010
+ dsSession: dsP,
10011
+ job_id: jobNoP,
10012
+ });
10216
10013
 
10217
10014
  const params = {
10218
10015
  SESSION_ID,
@@ -10231,11 +10028,7 @@ func.events.execute = async function (
10231
10028
  api_utils,
10232
10029
  };
10233
10030
 
10234
- const fx = await func.utils.get_plugin_resource(
10235
- SESSION_ID,
10236
- plugin_name,
10237
- `${_plugin.manifest["runtime.mjs"].dist ? "dist/" : ""}runtime.mjs`
10238
- );
10031
+ const fx = await func.utils.get_plugin_resource(SESSION_ID, plugin_name, `${_plugin.manifest['runtime.mjs'].dist ? 'dist/' : ''}runtime.mjs`);
10239
10032
 
10240
10033
  if (!fx[method]) {
10241
10034
  throw `Method: ${method} does not exist`;
@@ -10249,41 +10042,21 @@ func.events.execute = async function (
10249
10042
  },
10250
10043
 
10251
10044
  call_native_javascript: async function () {
10252
- const module = await func.common.get_module(
10253
- SESSION_ID,
10254
- "xuda-event-javascript-module.mjs"
10255
- );
10256
- const result = await module.call_javascript(
10257
- SESSION_ID,
10258
- jobNoP,
10259
- refIdP,
10260
- dsSession
10261
- );
10045
+ const module = await func.common.get_module(SESSION_ID, 'xuda-event-javascript-module.mjs');
10046
+ const result = await module.call_javascript(SESSION_ID, jobNoP, refIdP, dsSession);
10262
10047
  await func.datasource.set_outputField(SESSION_ID, dsSessionP, result, args);
10263
10048
 
10264
- return result
10049
+ return result;
10265
10050
  },
10266
10051
  call_evaluate_javascript: async function () {
10267
- const module = await func.common.get_module(
10268
- SESSION_ID,
10269
- "xuda-event-javascript-module.mjs"
10270
- );
10271
- const result = await module.call_javascript(
10272
- SESSION_ID,
10273
- jobNoP,
10274
- refIdP,
10275
- dsSession,
10276
- true
10277
- );
10052
+ const module = await func.common.get_module(SESSION_ID, 'xuda-event-javascript-module.mjs');
10053
+ const result = await module.call_javascript(SESSION_ID, jobNoP, refIdP, dsSession, true);
10278
10054
  await func.datasource.set_outputField(SESSION_ID, dsSessionP, result, args);
10279
10055
 
10280
- return result
10056
+ return result;
10281
10057
  },
10282
10058
  execute_native_javascript: async function () {
10283
- const module = await func.common.get_module(
10284
- SESSION_ID,
10285
- "xuda-event-javascript-module.mjs"
10286
- );
10059
+ const module = await func.common.get_module(SESSION_ID, 'xuda-event-javascript-module.mjs');
10287
10060
 
10288
10061
  const result = await module.run_javascript(
10289
10062
  SESSION_ID,
@@ -10291,17 +10064,14 @@ func.events.execute = async function (
10291
10064
  dsSession,
10292
10065
  `(async function(el) {
10293
10066
  ${refIdP.value}
10294
- })(document.querySelector(\`[xu-ui-id=${elementP}]\`))`
10067
+ })(document.querySelector(\`[xu-ui-id=${elementP}]\`))`,
10295
10068
  );
10296
10069
  await func.datasource.set_outputField(SESSION_ID, dsSessionP, result, args);
10297
10070
 
10298
- return result
10071
+ return result;
10299
10072
  },
10300
10073
  execute_evaluate_javascript: async function () {
10301
- const module = await func.common.get_module(
10302
- SESSION_ID,
10303
- "xuda-event-javascript-module.mjs"
10304
- );
10074
+ const module = await func.common.get_module(SESSION_ID, 'xuda-event-javascript-module.mjs');
10305
10075
 
10306
10076
  const result = await module.run_javascript(
10307
10077
  SESSION_ID,
@@ -10310,11 +10080,11 @@ func.events.execute = async function (
10310
10080
  `(async function(el) {
10311
10081
  ${refIdP.value}
10312
10082
  })(document.querySelector(\`[xu-ui-id=${elementP}]\`))`,
10313
- true
10083
+ true,
10314
10084
  );
10315
10085
  await func.datasource.set_outputField(SESSION_ID, dsSessionP, result, args);
10316
10086
 
10317
- return result
10087
+ return result;
10318
10088
  },
10319
10089
  loader_on: async function () {
10320
10090
  glb.CURRENT_APP_LOADING = null;
@@ -10335,131 +10105,59 @@ func.events.execute = async function (
10335
10105
  // if (descP.value) {
10336
10106
  $(document).trigger(refIdP.value, [_session.DS_GLB[dsSession]]);
10337
10107
  } else {
10338
- func.utils.debug_report(
10339
- SESSION_ID,
10340
- "func.events.execute",
10341
- "Event name missing",
10342
- "E"
10343
- );
10108
+ func.utils.debug_report(SESSION_ID, 'func.events.execute', 'Event name missing', 'E');
10344
10109
  }
10345
10110
  func.events.delete_job(SESSION_ID, jobNoP);
10346
10111
  // if (callbackP) callbackP();
10347
10112
  },
10348
10113
 
10349
10114
  invoke_action: async function () {
10350
- func.utils.debug.watch(
10351
- SESSION_ID,
10352
- calling_trigger_prop?.id,
10353
- functionP,
10354
- null,
10355
- null,
10356
- expCond
10357
- );
10115
+ func.utils.debug.watch(SESSION_ID, calling_trigger_prop?.id, functionP, null, null, expCond);
10358
10116
 
10359
- await func.action.execute(
10360
- SESSION_ID,
10361
- refIdP.value,
10362
- _ds,
10363
- null,
10364
- null,
10365
- jobNoP,
10366
- containerP
10367
- );
10117
+ await func.action.execute(SESSION_ID, refIdP.value, _ds, null, null, jobNoP, containerP);
10368
10118
  },
10369
10119
  raise_event: async function () {
10370
10120
  var _ds = _session.DS_GLB[dsSession];
10371
10121
  const _view_obj = await func.utils.VIEWS_OBJ.get(SESSION_ID, _ds.prog_id);
10372
- if (callingSourceP === "grid" || callingSourceP === "form") {
10373
- let _field_obj = func.common.find_item_by_key(
10374
- _view_obj.progFields,
10375
- "field_id",
10376
- field_elm
10377
- );
10122
+ if (callingSourceP === 'grid' || callingSourceP === 'form') {
10123
+ let _field_obj = func.common.find_item_by_key(_view_obj.progFields, 'field_id', field_elm);
10378
10124
  var event_name = _field_obj?.triggers?.[eventIdP].name.event;
10379
10125
 
10380
- if (_field_obj?.triggers?.[eventIdP].name?.properties["xu-exp:event"]) {
10381
- event_name = (
10382
- await func.expression.get(
10383
- SESSION_ID,
10384
- props[`xu-exp:event`],
10385
- dsSession,
10386
- "event_name expression"
10387
- )
10388
- ).result;
10126
+ if (_field_obj?.triggers?.[eventIdP].name?.properties['xu-exp:event']) {
10127
+ event_name = (await func.expression.get(SESSION_ID, props[`xu-exp:event`], dsSession, 'event_name expression')).result;
10389
10128
  }
10390
10129
 
10391
10130
  if (field_elm && event_name) {
10392
10131
  // get container for fields events
10393
- const dsP = await func.datasource.find_event_dataSource(
10394
- SESSION_ID,
10395
- event_name,
10396
- dsSession
10397
- );
10132
+ const dsP = await func.datasource.find_event_dataSource(SESSION_ID, event_name, dsSession);
10398
10133
 
10399
- return await func.datasource.run_events_functions(
10400
- SESSION_ID,
10401
- dsP,
10402
- event_name,
10403
- jobNoP,
10404
- null,
10405
- calling_trigger_prop?.data?.name?.parameters || {}
10406
- );
10134
+ return await func.datasource.run_events_functions(SESSION_ID, dsP, event_name, jobNoP, null, calling_trigger_prop?.data?.name?.parameters || {});
10407
10135
  }
10408
10136
  // done_execution(event_name);
10409
10137
  }
10410
- if (callingSourceP.includes("event")) {
10138
+ if (callingSourceP.includes('event')) {
10411
10139
  let event_name = refIdP.event;
10412
10140
 
10413
- if (refIdP?.properties?.["xu-exp:event"]) {
10414
- event_name = (
10415
- await func.expression.get(
10416
- SESSION_ID,
10417
- refIdP.properties["xu-exp:event"],
10418
- dsSession,
10419
- "event_name expression"
10420
- )
10421
- ).result;
10141
+ if (refIdP?.properties?.['xu-exp:event']) {
10142
+ event_name = (await func.expression.get(SESSION_ID, refIdP.properties['xu-exp:event'], dsSession, 'event_name expression')).result;
10422
10143
  }
10423
10144
 
10424
- const dsP = await func.datasource.find_event_dataSource(
10425
- SESSION_ID,
10426
- event_name,
10427
- dsSession
10428
- );
10145
+ const dsP = await func.datasource.find_event_dataSource(SESSION_ID, event_name, dsSession);
10429
10146
 
10430
- await func.datasource.run_events_functions(
10431
- SESSION_ID,
10432
- dsP,
10433
- event_name,
10434
- jobNoP,
10435
- calling_trigger_prop?.props?.async,
10436
- calling_trigger_prop?.data?.name?.parameters || {}
10437
- );
10147
+ await func.datasource.run_events_functions(SESSION_ID, dsP, event_name, jobNoP, calling_trigger_prop?.props?.async, calling_trigger_prop?.data?.name?.parameters || {});
10438
10148
  // done_execution(event_name);
10439
10149
  }
10440
10150
 
10441
10151
  func.events.delete_job(SESSION_ID, jobNoP);
10442
10152
  // if (callbackP) callbackP();
10443
10153
 
10444
- func.utils.debug.watch(
10445
- SESSION_ID,
10446
- calling_trigger_prop?.id,
10447
- functionP,
10448
- "",
10449
- "",
10450
- expCond
10451
- );
10154
+ func.utils.debug.watch(SESSION_ID, calling_trigger_prop?.id, functionP, '', '', expCond);
10452
10155
  },
10453
10156
  get_data: async function () {
10454
10157
  const params_obj = await get_params_obj();
10455
10158
 
10456
10159
  if (!(await get_prog_id())) {
10457
- func.utils.debug_report(
10458
- SESSION_ID,
10459
- "func.events.execute",
10460
- `${elementP} > ${triggerP} > ${functionP} > program ${prog} is missing`,
10461
- "E"
10462
- );
10160
+ func.utils.debug_report(SESSION_ID, 'func.events.execute', `${elementP} > ${triggerP} > ${functionP} > program ${prog} is missing`, 'E');
10463
10161
  func.events.delete_job(SESSION_ID, jobNoP);
10464
10162
  return;
10465
10163
  }
@@ -10472,41 +10170,14 @@ func.events.execute = async function (
10472
10170
 
10473
10171
  // args.prog_id = _viewId;
10474
10172
  if (_ds) {
10475
- func.utils.debug.watch(
10476
- SESSION_ID,
10477
- calling_trigger_prop?.id,
10478
- functionP,
10479
- null,
10480
- calling_trigger_prop,
10481
- expCond
10482
- );
10173
+ func.utils.debug.watch(SESSION_ID, calling_trigger_prop?.id, functionP, null, calling_trigger_prop, expCond);
10483
10174
  // }
10484
- const ret = await func.datasource.create(
10485
- SESSION_ID,
10486
- await get_prog_id(),
10487
- args.dataSourceNoP,
10488
- args.parentDataSourceNoP,
10489
- args.containerIdP,
10490
- args.rowIdP,
10491
- args.jobNoP,
10492
- args.calling_trigger_prop,
10493
- null,
10494
- null,
10495
- args.callingSourceP,
10496
- args.calling_jobP,
10497
- args.screen_dsP,
10498
- args.is_panelP,
10499
- params_obj
10500
- );
10175
+ 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);
10501
10176
 
10502
10177
  let _ds_new = _session.DS_GLB[ret.dsSessionP];
10503
10178
  let parameters = args?.calling_trigger_prop?.data?.name?.parameters;
10504
10179
  if (parameters && !_.isEmpty(parameters)) {
10505
- await func.datasource.update_changes_for_out_parameter(
10506
- SESSION_ID,
10507
- _ds_new.dsSession,
10508
- _ds.dsSession
10509
- );
10180
+ await func.datasource.update_changes_for_out_parameter(SESSION_ID, _ds_new.dsSession, _ds.dsSession);
10510
10181
  }
10511
10182
  // if (parameters && !_.isEmpty(parameters) && _ds_new.PARAM_OUT_INFO) {
10512
10183
  // let data = {};
@@ -10535,7 +10206,7 @@ func.events.execute = async function (
10535
10206
  // }
10536
10207
 
10537
10208
  func.events.delete_job(SESSION_ID, jobNoP);
10538
- return _ds_new
10209
+ return _ds_new;
10539
10210
  }
10540
10211
  },
10541
10212
  set_data: async function () {
@@ -10545,24 +10216,12 @@ func.events.execute = async function (
10545
10216
  const result = await this.get_data();
10546
10217
 
10547
10218
  // await set_outputField(SESSION_ID, elementP, triggerP, functionP, dsSessionP, result);
10548
- return result
10549
-
10219
+ return result;
10550
10220
  },
10551
10221
  update: async function () {
10552
- const obj_values_to_update =
10553
- func.datasource.get_viewFields_for_update_function(
10554
- SESSION_ID,
10555
- calling_trigger_prop,
10556
- null,
10557
- dsSessionP
10558
- );
10222
+ const obj_values_to_update = func.datasource.get_viewFields_for_update_function(SESSION_ID, calling_trigger_prop, null, dsSessionP);
10559
10223
  if (!obj_values_to_update || _.isEmpty(obj_values_to_update)) {
10560
- func.utils.debug_report(
10561
- SESSION_ID,
10562
- "Update values object is empty",
10563
- "",
10564
- "W"
10565
- );
10224
+ func.utils.debug_report(SESSION_ID, 'Update values object is empty', '', 'W');
10566
10225
  if (jobNoP) func.events.delete_job(SESSION_ID, jobNoP);
10567
10226
  return;
10568
10227
  }
@@ -10575,32 +10234,8 @@ func.events.execute = async function (
10575
10234
  $element = $(`[xu-ui-id="${elementP}"]`).clone(true);
10576
10235
  }
10577
10236
 
10578
- let ret_field_id = await func.expression.get(
10579
- SESSION_ID,
10580
- val.id.trim(),
10581
- dsSessionP,
10582
- "update",
10583
- null,
10584
- null,
10585
- null,
10586
- null,
10587
- null,
10588
- null,
10589
- $element?.length ? $element?.data()?.xuData?.iterate_info : null
10590
- );
10591
- let ret_value = await func.expression.get(
10592
- SESSION_ID,
10593
- val.val.trim(),
10594
- dsSessionP,
10595
- "update",
10596
- null,
10597
- null,
10598
- null,
10599
- null,
10600
- null,
10601
- null,
10602
- $element?.length ? $element?.data()?.xuData?.iterate_info : null
10603
- );
10237
+ 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);
10238
+ 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);
10604
10239
  let _field_id = ret_field_id.result;
10605
10240
  let _value = ret_value.result;
10606
10241
 
@@ -10609,25 +10244,16 @@ func.events.execute = async function (
10609
10244
 
10610
10245
  let datasource_changes = {};
10611
10246
  for await (const change of updates) {
10612
- let ret_get_value = await func.datasource.get_value(
10613
- SESSION_ID,
10614
- change._field_id,
10615
- dsSessionP
10616
- );
10247
+ let ret_get_value = await func.datasource.get_value(SESSION_ID, change._field_id, dsSessionP);
10617
10248
  if (ret_get_value.found) {
10618
10249
  let _ds = _session.DS_GLB[ret_get_value.dsSessionP];
10619
10250
  if (!datasource_changes[_ds.dsSession]) {
10620
10251
  datasource_changes[_ds.dsSession] = {};
10621
10252
  }
10622
- if (
10623
- !datasource_changes[_ds.dsSession][ret_get_value.currentRecordId]
10624
- ) {
10625
- datasource_changes[_ds.dsSession][ret_get_value.currentRecordId] =
10626
- {};
10253
+ if (!datasource_changes[_ds.dsSession][ret_get_value.currentRecordId]) {
10254
+ datasource_changes[_ds.dsSession][ret_get_value.currentRecordId] = {};
10627
10255
  }
10628
- datasource_changes[_ds.dsSession][ret_get_value.currentRecordId][
10629
- change._field_id
10630
- ] = change._value;
10256
+ datasource_changes[_ds.dsSession][ret_get_value.currentRecordId][change._field_id] = change._value;
10631
10257
  }
10632
10258
  }
10633
10259
 
@@ -10636,23 +10262,11 @@ func.events.execute = async function (
10636
10262
  // return changes;
10637
10263
  },
10638
10264
  call_alert: async function () {
10639
- await func.utils.alerts.invoke(
10640
- SESSION_ID,
10641
- "call_alert",
10642
- refIdP,
10643
- log_source,
10644
- dsSession
10645
- );
10265
+ await func.utils.alerts.invoke(SESSION_ID, 'call_alert', refIdP, log_source, dsSession);
10646
10266
  func.events.delete_job(SESSION_ID, jobNoP);
10647
10267
  },
10648
10268
  alert: async function () {
10649
- await func.utils.alerts.invoke(
10650
- SESSION_ID,
10651
- "alert",
10652
- refIdP,
10653
- log_source,
10654
- dsSession
10655
- );
10269
+ await func.utils.alerts.invoke(SESSION_ID, 'alert', refIdP, log_source, dsSession);
10656
10270
  func.events.delete_job(SESSION_ID, jobNoP);
10657
10271
  },
10658
10272
  delay: async function () {
@@ -10671,18 +10285,11 @@ func.events.execute = async function (
10671
10285
  const _prog_id = await get_prog_id();
10672
10286
 
10673
10287
  if (!_prog_id) {
10674
- func.utils.debug_report(
10675
- SESSION_ID,
10676
- "func.events.execute",
10677
- `${elementP} > ${triggerP} > ${functionP} > program not defined`,
10678
- "E"
10679
- );
10288
+ func.utils.debug_report(SESSION_ID, 'func.events.execute', `${elementP} > ${triggerP} > ${functionP} > program not defined`, 'E');
10680
10289
  func.events.delete_job(SESSION_ID, jobNoP);
10681
10290
  return;
10682
10291
  }
10683
10292
 
10684
-
10685
-
10686
10293
  // if (!output_field) {
10687
10294
  // func.utils.debug_report(
10688
10295
  // SESSION_ID,
@@ -10698,37 +10305,24 @@ func.events.execute = async function (
10698
10305
 
10699
10306
  await func.datasource.set_outputField(SESSION_ID, dsSessionP, api_ret, args);
10700
10307
 
10701
-
10702
10308
  func.events.delete_job(SESSION_ID, jobNoP);
10703
10309
  },
10704
10310
  call_system_api: async function () {
10705
- const api_method = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args, "api_method");
10311
+ const api_method = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args, 'api_method');
10706
10312
 
10707
10313
  if (!api_method) {
10708
- func.utils.debug_report(
10709
- SESSION_ID,
10710
- "func.events.execute",
10711
- `${elementP} >${triggerP} >${functionP} > api_method not defined`,
10712
- "E"
10713
- );
10314
+ func.utils.debug_report(SESSION_ID, 'func.events.execute', `${elementP} >${triggerP} >${functionP} > api_method not defined`, 'E');
10714
10315
  func.events.delete_job(SESSION_ID, jobNoP);
10715
10316
  return;
10716
10317
  }
10717
10318
  let payload = {};
10718
- const _payload = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args, "payload");
10319
+ const _payload = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args, 'payload');
10719
10320
  if (_payload) {
10720
10321
  const get_payload_property_value = async function (prop_name) {
10721
10322
  let _prop = _payload;
10722
10323
  let _value = _prop[prop_name];
10723
10324
  if (_prop?.[`xu-exp:${prop_name}`]) {
10724
- _value = (
10725
- await func.expression.get(
10726
- SESSION_ID,
10727
- _prop[`xu-exp:${prop_name}`],
10728
- dsSession,
10729
- `${prop_name} expression`
10730
- )
10731
- ).result;
10325
+ _value = (await func.expression.get(SESSION_ID, _prop[`xu-exp:${prop_name}`], dsSession, `${prop_name} expression`)).result;
10732
10326
  }
10733
10327
 
10734
10328
  return _value;
@@ -10736,7 +10330,7 @@ func.events.execute = async function (
10736
10330
 
10737
10331
  for await (let [key, val] of Object.entries(_payload)) {
10738
10332
  // if (key.substring(0, 7) !== "xu-exp:") {
10739
- const new_key = key.replaceAll("xu-exp:", ""); //key.substring(0, 7) === "xu-exp:" ? key.substring(7): key
10333
+ const new_key = key.replaceAll('xu-exp:', ''); //key.substring(0, 7) === "xu-exp:" ? key.substring(7): key
10740
10334
  payload[new_key] = await get_payload_property_value(new_key);
10741
10335
  // }
10742
10336
  }
@@ -10753,7 +10347,7 @@ func.events.execute = async function (
10753
10347
  // return;
10754
10348
  // }
10755
10349
 
10756
- const output_field = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args, "outputField");
10350
+ const output_field = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args, 'outputField');
10757
10351
 
10758
10352
  // if (!output_field) {
10759
10353
  // func.utils.debug_report(
@@ -10770,89 +10364,57 @@ func.events.execute = async function (
10770
10364
  if (output_field) {
10771
10365
  let datasource_changes = {};
10772
10366
 
10773
- let ret_get_value = await func.datasource.get_value(
10774
- SESSION_ID,
10775
- output_field,
10776
- dsSessionP
10777
- );
10367
+ let ret_get_value = await func.datasource.get_value(SESSION_ID, output_field, dsSessionP);
10778
10368
  if (ret_get_value.found) {
10779
10369
  let _ds = _session.DS_GLB[ret_get_value.dsSessionP];
10780
10370
  if (!datasource_changes[_ds.dsSession]) {
10781
10371
  datasource_changes[_ds.dsSession] = {};
10782
10372
  }
10783
- if (
10784
- !datasource_changes[_ds.dsSession][ret_get_value.currentRecordId]
10785
- ) {
10786
- datasource_changes[_ds.dsSession][ret_get_value.currentRecordId] =
10787
- {};
10373
+ if (!datasource_changes[_ds.dsSession][ret_get_value.currentRecordId]) {
10374
+ datasource_changes[_ds.dsSession][ret_get_value.currentRecordId] = {};
10788
10375
  }
10789
- datasource_changes[_ds.dsSession][ret_get_value.currentRecordId][
10790
- output_field
10791
- ] = api_ret;
10376
+ datasource_changes[_ds.dsSession][ret_get_value.currentRecordId][output_field] = api_ret;
10792
10377
  await func.datasource.update(SESSION_ID, datasource_changes);
10793
10378
  }
10794
10379
  }
10795
10380
  func.events.delete_job(SESSION_ID, jobNoP);
10796
10381
  },
10797
10382
  call_external_api: async function () {
10798
- const method = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args, "method");
10383
+ const method = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args, 'method');
10799
10384
 
10800
10385
  if (!method) {
10801
- func.utils.debug_report(
10802
- SESSION_ID,
10803
- "func.events.execute",
10804
- `${elementP} >${triggerP} >${functionP} > method not defined`,
10805
- "E"
10806
- );
10386
+ func.utils.debug_report(SESSION_ID, 'func.events.execute', `${elementP} >${triggerP} >${functionP} > method not defined`, 'E');
10807
10387
  func.events.delete_job(SESSION_ID, jobNoP);
10808
10388
  return;
10809
10389
  }
10810
10390
 
10811
- const url = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args, "url");
10391
+ const url = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args, 'url');
10812
10392
 
10813
10393
  if (!url) {
10814
- func.utils.debug_report(
10815
- SESSION_ID,
10816
- "func.events.execute",
10817
- `${elementP} >${triggerP} >${functionP} > url not defined`,
10818
- "E"
10819
- );
10394
+ func.utils.debug_report(SESSION_ID, 'func.events.execute', `${elementP} >${triggerP} >${functionP} > url not defined`, 'E');
10820
10395
  func.events.delete_job(SESSION_ID, jobNoP);
10821
10396
  return;
10822
10397
  }
10823
10398
 
10824
- const payload_arr = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args, "payload");
10399
+ const payload_arr = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args, 'payload');
10825
10400
 
10826
10401
  const report_conversion_error = function (res, typeP, valP) {
10827
10402
  var msg = `${elementP} >${triggerP} >${functionP} > error converting from ${valP} to ${typeP}`;
10828
10403
  if (error) {
10829
- return func.utils.debug_report(SESSION_ID, msg, "", "W");
10404
+ return func.utils.debug_report(SESSION_ID, msg, '', 'W');
10830
10405
  }
10831
- func.utils.debug_report(
10832
- SESSION_ID,
10833
- msg + " " + _.capitalize(source) + prog_info,
10834
- "",
10835
- "E"
10836
- );
10406
+ func.utils.debug_report(SESSION_ID, msg + ' ' + _.capitalize(source) + prog_info, '', 'E');
10837
10407
  };
10838
10408
  const report_conversion_warn = function (res) {
10839
10409
  var msg = `${elementP} >${triggerP} >${functionP} > type mismatch auto conversion from value ${valP} to ${typeP}`;
10840
- func.utils.debug_report(
10841
- SESSION_ID,
10842
- msg + " " + _.capitalize(source) + prog_info,
10843
- "",
10844
- "W"
10845
- );
10410
+ func.utils.debug_report(SESSION_ID, msg + ' ' + _.capitalize(source) + prog_info, '', 'W');
10846
10411
  };
10847
10412
  // var ret = valP;
10848
10413
  if (error) {
10849
10414
  return report_conversion_error();
10850
10415
  }
10851
10416
 
10852
- const module = await func.common.get_module(
10853
- SESSION_ID,
10854
- "xuda-get-cast-util-module.mjs"
10855
- );
10417
+ const module = await func.common.get_module(SESSION_ID, 'xuda-get-cast-util-module.mjs');
10856
10418
  // return module.cast(
10857
10419
  // typeP,
10858
10420
  // valP,
@@ -10863,16 +10425,11 @@ func.events.execute = async function (
10863
10425
  var payload = _.reduce(
10864
10426
  payload_arr,
10865
10427
  (ret, val, key) => {
10866
- ret[val.key] = module.cast(
10867
- val.type,
10868
- val.val,
10869
- report_conversion_error,
10870
- report_conversion_warn
10871
- );
10428
+ ret[val.key] = module.cast(val.type, val.val, report_conversion_error, report_conversion_warn);
10872
10429
 
10873
10430
  return ret;
10874
10431
  },
10875
- {}
10432
+ {},
10876
10433
  );
10877
10434
  // if (!payload) {
10878
10435
  // func.utils.debug_report(
@@ -10885,7 +10442,7 @@ func.events.execute = async function (
10885
10442
  // return;
10886
10443
  // }
10887
10444
 
10888
- const output_field = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args, "outputField");
10445
+ const output_field = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args, 'outputField');
10889
10446
 
10890
10447
  // if (!output_field) {
10891
10448
  // func.utils.debug_report(
@@ -10902,25 +10459,16 @@ func.events.execute = async function (
10902
10459
  if (output_field) {
10903
10460
  let datasource_changes = {};
10904
10461
 
10905
- let ret_get_value = await func.datasource.get_value(
10906
- SESSION_ID,
10907
- output_field,
10908
- dsSessionP
10909
- );
10462
+ let ret_get_value = await func.datasource.get_value(SESSION_ID, output_field, dsSessionP);
10910
10463
  if (ret_get_value.found) {
10911
10464
  let _ds = _session.DS_GLB[ret_get_value.dsSessionP];
10912
10465
  if (!datasource_changes[_ds.dsSession]) {
10913
10466
  datasource_changes[_ds.dsSession] = {};
10914
10467
  }
10915
- if (
10916
- !datasource_changes[_ds.dsSession][ret_get_value.currentRecordId]
10917
- ) {
10918
- datasource_changes[_ds.dsSession][ret_get_value.currentRecordId] =
10919
- {};
10468
+ if (!datasource_changes[_ds.dsSession][ret_get_value.currentRecordId]) {
10469
+ datasource_changes[_ds.dsSession][ret_get_value.currentRecordId] = {};
10920
10470
  }
10921
- datasource_changes[_ds.dsSession][ret_get_value.currentRecordId][
10922
- output_field
10923
- ] = api_ret;
10471
+ datasource_changes[_ds.dsSession][ret_get_value.currentRecordId][output_field] = api_ret;
10924
10472
  await func.datasource.update(SESSION_ID, datasource_changes);
10925
10473
  }
10926
10474
  }
@@ -10953,16 +10501,9 @@ func.events.delete_job = function (SESSION_ID, jobNoP) {
10953
10501
  var dsSession = _session.WORKER_OBJ.jobs[job_index].dsSessionP;
10954
10502
  let ds_obj = _session?.DS_GLB[dsSession];
10955
10503
  if (ds_obj) {
10956
- delete SCREEN_BLOCKER_OBJ[
10957
- ds_obj.screenId +
10958
- (ds_obj.callingScreenId ? "_" + ds_obj.callingScreenId : "")
10959
- ];
10504
+ delete SCREEN_BLOCKER_OBJ[ds_obj.screenId + (ds_obj.callingScreenId ? '_' + ds_obj.callingScreenId : '')];
10960
10505
  }
10961
- if (
10962
- dsSession &&
10963
- ds_obj?.loops_limit &&
10964
- ds_obj?.loops_count < ds_obj?.loops_limit - 1
10965
- ) {
10506
+ if (dsSession && ds_obj?.loops_limit && ds_obj?.loops_count < ds_obj?.loops_limit - 1) {
10966
10507
  return;
10967
10508
  }
10968
10509
  _session.WORKER_OBJ.stat = null;
@@ -10980,17 +10521,9 @@ func.events.delete_job_0 = function (SESSION_ID) {
10980
10521
  var dsSession = _session.WORKER_OBJ.jobs[job_index].dsSession;
10981
10522
  let ds_obj = _session?.DS_GLB[dsSession];
10982
10523
  if (ds_obj) {
10983
- delete SCREEN_BLOCKER_OBJ[
10984
- ds_obj.screenId +
10985
- (ds_obj.callingScreenId ? "_" + ds_obj.callingScreenId : "")
10986
- ];
10524
+ delete SCREEN_BLOCKER_OBJ[ds_obj.screenId + (ds_obj.callingScreenId ? '_' + ds_obj.callingScreenId : '')];
10987
10525
  }
10988
- if (
10989
- dsSession &&
10990
- ds_obj &&
10991
- ds_obj.loops_limit &&
10992
- ds_obj.loops_count < ds_obj.loops_limit - 1
10993
- ) {
10526
+ if (dsSession && ds_obj && ds_obj.loops_limit && ds_obj.loops_count < ds_obj.loops_limit - 1) {
10994
10527
  return;
10995
10528
  }
10996
10529
  _session.WORKER_OBJ.stat = null;
@@ -11032,8 +10565,7 @@ setInterval(function () {
11032
10565
  }, 1000);
11033
10566
 
11034
10567
  func.events.set_browser_changes = function (dsP, fieldsChangedP) {
11035
- if (fieldsChangedP.includes("SYS_GLOBAL_STR_BROWSER_TITLE"))
11036
- document.title = dsP.dataset_new["SYS_GLOBAL_STR_BROWSER_TITLE"];
10568
+ if (fieldsChangedP.includes('SYS_GLOBAL_STR_BROWSER_TITLE')) document.title = dsP.dataset_new['SYS_GLOBAL_STR_BROWSER_TITLE'];
11037
10569
  };
11038
10570
 
11039
10571
  func.events.execute_PENDING_OPEN_URL_EVENTS = async function () {
@@ -11042,52 +10574,29 @@ func.events.execute_PENDING_OPEN_URL_EVENTS = async function () {
11042
10574
  glb.WINDOW_LOCATION_SEARCH = url;
11043
10575
  glb.ROOT_ELEMENT_ATTRIBUTES = func.UI.utils.get_root_element_attributes();
11044
10576
 
11045
- const params_obj = func.common.getObjectFromUrl(
11046
- url,
11047
- glb.ROOT_ELEMENT_ATTRIBUTES
11048
- );
10577
+ const params_obj = func.common.getObjectFromUrl(url, glb.ROOT_ELEMENT_ATTRIBUTES);
11049
10578
  if (!params_obj.prog) {
11050
- return console.warn("prog empty");
10579
+ return console.warn('prog empty');
11051
10580
  }
11052
10581
 
11053
10582
  await func.utils.TREE_OBJ.get(SESSION_ID, params_obj.prog);
11054
- let screen_ret = await func.utils.get_screen_obj(
11055
- SESSION_ID,
11056
- params_obj.prog
11057
- );
10583
+ let screen_ret = await func.utils.get_screen_obj(SESSION_ID, params_obj.prog);
11058
10584
 
11059
10585
  if (screen_ret) {
11060
- await func.UI.screen.init(
11061
- SESSION_ID,
11062
- params_obj.prog,
11063
- null,
11064
- null,
11065
- $("#embed_" + SESSION_ID),
11066
- null,
11067
- null,
11068
- null,
11069
- null,
11070
- null,
11071
- "pendingUrlEvent_embed"
11072
- );
10586
+ await func.UI.screen.init(SESSION_ID, params_obj.prog, null, null, $('#embed_' + SESSION_ID), null, null, null, null, null, 'pendingUrlEvent_embed');
11073
10587
  } else {
11074
- console.error("Program not exist", params_obj.prog_id);
11075
- func.UI.utils.progressScreen.show(
11076
- SESSION_ID,
11077
- "Program not exist",
11078
- null,
11079
- true
11080
- );
10588
+ console.error('Program not exist', params_obj.prog_id);
10589
+ func.UI.utils.progressScreen.show(SESSION_ID, 'Program not exist', null, true);
11081
10590
  }
11082
10591
  } else {
11083
- console.warn("url empty");
10592
+ console.warn('url empty');
11084
10593
  }
11085
10594
  }
11086
10595
  };
11087
10596
  func.events.invoke = async function (event_id) {
11088
10597
  var _session = SESSION_OBJ[SESSION_ID];
11089
10598
  if (!event_id) {
11090
- console.warn("event_id Cannot be empty");
10599
+ console.warn('event_id Cannot be empty');
11091
10600
  return false;
11092
10601
  }
11093
10602
  var ds;
@@ -11096,10 +10605,7 @@ func.events.invoke = async function (event_id) {
11096
10605
  if (_.isEmpty(_view_obj.progEvents)) continue;
11097
10606
  if (ds) break;
11098
10607
  for await (const [key, val] of Object.entries(_view_obj.progEvents)) {
11099
- if (
11100
- val?.data?.type === "user_defined" &&
11101
- val.data.event_name === event_id
11102
- ) {
10608
+ if (val?.data?.type === 'user_defined' && val.data.event_name === event_id) {
11103
10609
  ds = ds_key;
11104
10610
  break;
11105
10611
  }
@@ -11107,11 +10613,11 @@ func.events.invoke = async function (event_id) {
11107
10613
  }
11108
10614
 
11109
10615
  if (!ds) {
11110
- console.warn("event_id not found");
10616
+ console.warn('event_id not found');
11111
10617
  return false;
11112
10618
  }
11113
10619
 
11114
- func.events.validate(SESSION_ID, "user_defined", ds, event_id);
10620
+ func.events.validate(SESSION_ID, 'user_defined', ds, event_id);
11115
10621
  };
11116
10622
  func.expression = {};
11117
10623
 
@@ -13364,8 +12870,8 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
13364
12870
  'xu-on': async function ($elm, val) {
13365
12871
  CLIENT_ACTIVITY_TS = Date.now();
13366
12872
  const trigger = val.key.split('xu-on:')[1].toLowerCase();
13367
- $elm.on(trigger, async function (e) {
13368
- for await (const [key, val] of Object.entries($elm.data().xuAttributes['xu-on:' + e.type])) {
12873
+ $elm.on(trigger, async function (evt) {
12874
+ for await (const [key, val] of Object.entries($elm.data().xuAttributes['xu-on:' + evt.type])) {
13369
12875
  if (val.handler === 'custom') {
13370
12876
  // do BL
13371
12877
  for await (const [key2, val2] of Object.entries(val.event)) {
@@ -13375,7 +12881,12 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
13375
12881
  cond = expCond.result;
13376
12882
  }
13377
12883
  if (!cond) continue;
13378
- 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);
12884
+
12885
+ if (val.event_modifiers && evt[val.event_modifiers]) {
12886
+ evt[val.event_modifiers]();
12887
+ }
12888
+
12889
+ 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, evt, null, null, null, paramsP.dsSessionP, null, null, null, e.type, val2.data.name, null, null, val2, null, null, null, null, null, null);
13379
12890
  }
13380
12891
  }
13381
12892
  }