@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.
- package/js/xuda-runtime-bundle.js +205 -694
- package/js/xuda-runtime-bundle.min.js +1 -1
- package/js/xuda-runtime-mini-bundle.js +1 -1
- package/js/xuda-runtime-mini-bundle.min.js +1 -1
- package/js/xuda-runtime-slim.js +205 -694
- package/js/xuda-runtime-slim.min.es.js +205 -694
- package/js/xuda-runtime-slim.min.js +1 -1
- package/js/xuda-server-bundle.min.mjs +1 -1
- package/js/xuda-server-bundle.mjs +198 -692
- package/js/xuda-worker-bundle.js +198 -692
- package/js/xuda-worker-bundle.min.js +1 -1
- package/package.json +1 -1
|
@@ -6380,7 +6380,7 @@ func.utils.job_worker = function (session_id) {
|
|
|
6380
6380
|
val.containerP,
|
|
6381
6381
|
val.elementP,
|
|
6382
6382
|
val.rowP,
|
|
6383
|
-
|
|
6383
|
+
val.evt,
|
|
6384
6384
|
val.descP,
|
|
6385
6385
|
val.rootScreenIdP,
|
|
6386
6386
|
val.dsSessionP,
|
|
@@ -10774,8 +10774,8 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
|
|
|
10774
10774
|
'xu-on': async function ($elm, val) {
|
|
10775
10775
|
CLIENT_ACTIVITY_TS = Date.now();
|
|
10776
10776
|
const trigger = val.key.split('xu-on:')[1].toLowerCase();
|
|
10777
|
-
$elm.on(trigger, async function (
|
|
10778
|
-
for await (const [key, val] of Object.entries($elm.data().xuAttributes['xu-on:' +
|
|
10777
|
+
$elm.on(trigger, async function (evt) {
|
|
10778
|
+
for await (const [key, val] of Object.entries($elm.data().xuAttributes['xu-on:' + evt.type])) {
|
|
10779
10779
|
if (val.handler === 'custom') {
|
|
10780
10780
|
// do BL
|
|
10781
10781
|
for await (const [key2, val2] of Object.entries(val.event)) {
|
|
@@ -10785,7 +10785,12 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
|
|
|
10785
10785
|
cond = expCond.result;
|
|
10786
10786
|
}
|
|
10787
10787
|
if (!cond) continue;
|
|
10788
|
-
|
|
10788
|
+
|
|
10789
|
+
if (val.event_modifiers && evt[val.event_modifiers]) {
|
|
10790
|
+
evt[val.event_modifiers]();
|
|
10791
|
+
}
|
|
10792
|
+
|
|
10793
|
+
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);
|
|
10789
10794
|
}
|
|
10790
10795
|
}
|
|
10791
10796
|
}
|
|
@@ -13334,15 +13339,7 @@ func.UI.component.init_xu_nav = function ($container, $nav) {
|
|
|
13334
13339
|
});
|
|
13335
13340
|
};
|
|
13336
13341
|
func.events = {};
|
|
13337
|
-
func.events.validate = async function (
|
|
13338
|
-
SESSION_ID,
|
|
13339
|
-
triggerP,
|
|
13340
|
-
dsSessionP,
|
|
13341
|
-
eventIdP,
|
|
13342
|
-
sourceP,
|
|
13343
|
-
argumentsP,
|
|
13344
|
-
return_validation_onlyP
|
|
13345
|
-
) {
|
|
13342
|
+
func.events.validate = async function (SESSION_ID, triggerP, dsSessionP, eventIdP, sourceP, argumentsP, return_validation_onlyP) {
|
|
13346
13343
|
var _session = SESSION_OBJ[SESSION_ID];
|
|
13347
13344
|
var _ds = _session.DS_GLB[dsSessionP];
|
|
13348
13345
|
var args = {
|
|
@@ -13355,16 +13352,8 @@ func.events.validate = async function (
|
|
|
13355
13352
|
return_validation_onlyP,
|
|
13356
13353
|
};
|
|
13357
13354
|
const search_event_in_parent_ds = async function () {
|
|
13358
|
-
if (_ds && typeof _ds.parentDataSourceNo !==
|
|
13359
|
-
await func.events.validate(
|
|
13360
|
-
SESSION_ID,
|
|
13361
|
-
triggerP,
|
|
13362
|
-
_ds.parentDataSourceNo,
|
|
13363
|
-
eventIdP,
|
|
13364
|
-
sourceP,
|
|
13365
|
-
argumentsP,
|
|
13366
|
-
return_validation_onlyP
|
|
13367
|
-
);
|
|
13355
|
+
if (_ds && typeof _ds.parentDataSourceNo !== 'undefined') {
|
|
13356
|
+
await func.events.validate(SESSION_ID, triggerP, _ds.parentDataSourceNo, eventIdP, sourceP, argumentsP, return_validation_onlyP);
|
|
13368
13357
|
}
|
|
13369
13358
|
};
|
|
13370
13359
|
var ret = false;
|
|
@@ -13386,29 +13375,13 @@ func.events.validate = async function (
|
|
|
13386
13375
|
var eventProp = undefined;
|
|
13387
13376
|
if (val.data.type === triggerP) {
|
|
13388
13377
|
// compare event trigger
|
|
13389
|
-
if (
|
|
13390
|
-
(triggerP !== "user_defined") |
|
|
13391
|
-
(triggerP === "user_defined" && eventIdP === val.data.event_name)
|
|
13392
|
-
) {
|
|
13378
|
+
if ((triggerP !== 'user_defined') | (triggerP === 'user_defined' && eventIdP === val.data.event_name)) {
|
|
13393
13379
|
// compare user defined name
|
|
13394
13380
|
|
|
13395
13381
|
var expCond;
|
|
13396
|
-
if (val.data.condition)
|
|
13397
|
-
expCond = await func.expression.get(
|
|
13398
|
-
SESSION_ID,
|
|
13399
|
-
val.data.condition,
|
|
13400
|
-
dsSessionP,
|
|
13401
|
-
"condition"
|
|
13402
|
-
);
|
|
13382
|
+
if (val.data.condition) expCond = await func.expression.get(SESSION_ID, val.data.condition, dsSessionP, 'condition');
|
|
13403
13383
|
if (!val.data.condition || expCond.result) {
|
|
13404
|
-
func.utils.debug.watch(
|
|
13405
|
-
SESSION_ID,
|
|
13406
|
-
_ds.prog_id + "%" + val.id,
|
|
13407
|
-
"view_event",
|
|
13408
|
-
val,
|
|
13409
|
-
triggerP + " " + eventIdP,
|
|
13410
|
-
expCond
|
|
13411
|
-
);
|
|
13384
|
+
func.utils.debug.watch(SESSION_ID, _ds.prog_id + '%' + val.id, 'view_event', val, triggerP + ' ' + eventIdP, expCond);
|
|
13412
13385
|
ret = true;
|
|
13413
13386
|
if (return_validation_onlyP) break;
|
|
13414
13387
|
const set_arguments = async function () {
|
|
@@ -13446,48 +13419,24 @@ func.events.validate = async function (
|
|
|
13446
13419
|
// await func.datasource.update(SESSION_ID, datasource_changes);
|
|
13447
13420
|
// }
|
|
13448
13421
|
|
|
13449
|
-
for await (let [key, fieldId] of Object.entries(
|
|
13450
|
-
|
|
13451
|
-
)) {
|
|
13452
|
-
const field_info = func.common.find_item_by_key(
|
|
13453
|
-
_view_obj.progFields,
|
|
13454
|
-
"field_id",
|
|
13455
|
-
fieldId
|
|
13456
|
-
);
|
|
13422
|
+
for await (let [key, fieldId] of Object.entries(val.data.parameters)) {
|
|
13423
|
+
const field_info = func.common.find_item_by_key(_view_obj.progFields, 'field_id', fieldId);
|
|
13457
13424
|
|
|
13458
|
-
if (field_info?.data?.type !==
|
|
13459
|
-
console.warn(
|
|
13425
|
+
if (field_info?.data?.type !== 'virtual') {
|
|
13426
|
+
console.warn('parameter field must be virtual, update ignored');
|
|
13460
13427
|
continue;
|
|
13461
13428
|
}
|
|
13462
13429
|
|
|
13463
|
-
if (!args[fieldId]) continue
|
|
13464
|
-
|
|
13430
|
+
if (!args[fieldId]) continue;
|
|
13465
13431
|
|
|
13466
|
-
|
|
13467
|
-
let value = await func.common.get_cast_val(
|
|
13468
|
-
SESSION_ID,
|
|
13469
|
-
"events",
|
|
13470
|
-
fieldId,
|
|
13471
|
-
field_info.props.fieldType,
|
|
13472
|
-
args[fieldId].value
|
|
13473
|
-
);
|
|
13432
|
+
let value = await func.common.get_cast_val(SESSION_ID, 'events', fieldId, field_info.props.fieldType, args[fieldId].value);
|
|
13474
13433
|
|
|
13475
13434
|
if (!_.isEmpty(args[fieldId].fx)) {
|
|
13476
|
-
const fx_ret = await func.expression.get(
|
|
13477
|
-
SESSION_ID,
|
|
13478
|
-
args[fieldId].fx,
|
|
13479
|
-
dsSessionP,
|
|
13480
|
-
"update"
|
|
13481
|
-
)
|
|
13435
|
+
const fx_ret = await func.expression.get(SESSION_ID, args[fieldId].fx, dsSessionP, 'update');
|
|
13482
13436
|
value = fx_ret.result;
|
|
13483
13437
|
}
|
|
13484
13438
|
// find the target field in the program dataset
|
|
13485
|
-
const ret = await func.datasource.get_value(
|
|
13486
|
-
SESSION_ID,
|
|
13487
|
-
fieldId,
|
|
13488
|
-
dsSessionP,
|
|
13489
|
-
_ds.currentRecordId
|
|
13490
|
-
);
|
|
13439
|
+
const ret = await func.datasource.get_value(SESSION_ID, fieldId, dsSessionP, _ds.currentRecordId);
|
|
13491
13440
|
|
|
13492
13441
|
const datasource_changes = {
|
|
13493
13442
|
[ret.dsSessionP]: {
|
|
@@ -13500,11 +13449,7 @@ func.events.validate = async function (
|
|
|
13500
13449
|
await add_event();
|
|
13501
13450
|
};
|
|
13502
13451
|
const add_event = async function () {
|
|
13503
|
-
const _event = func.common.find_item_by_key_root(
|
|
13504
|
-
_view_obj.progEvents,
|
|
13505
|
-
"id",
|
|
13506
|
-
val.id
|
|
13507
|
-
);
|
|
13452
|
+
const _event = func.common.find_item_by_key_root(_view_obj.progEvents, 'id', val.id);
|
|
13508
13453
|
if (_event.triggers) {
|
|
13509
13454
|
// check if event property exist
|
|
13510
13455
|
|
|
@@ -13527,22 +13472,19 @@ func.events.validate = async function (
|
|
|
13527
13472
|
if (!glb.IS_WORKER) {
|
|
13528
13473
|
if (_ds.panel_div_id) {
|
|
13529
13474
|
try {
|
|
13530
|
-
container =
|
|
13475
|
+
container = '#' + _ds.panel_div_id;
|
|
13531
13476
|
if ($(container).data().xuData.panel_info) {
|
|
13532
|
-
screen_prop =
|
|
13533
|
-
$(container).data().xuData.panel_info.paramsP;
|
|
13477
|
+
screen_prop = $(container).data().xuData.panel_info.paramsP;
|
|
13534
13478
|
} else {
|
|
13535
13479
|
///////////////
|
|
13536
|
-
container =
|
|
13537
|
-
"#" + _session.DS_GLB[dsSessionP].screenId;
|
|
13480
|
+
container = '#' + _session.DS_GLB[dsSessionP].screenId;
|
|
13538
13481
|
|
|
13539
13482
|
if ($(container) && $(container).data()) {
|
|
13540
13483
|
screen_prop = $(container).data().xuData.paramsP;
|
|
13541
13484
|
}
|
|
13542
13485
|
|
|
13543
13486
|
if (!$(container) || !$(container).length) {
|
|
13544
|
-
container =
|
|
13545
|
-
"#" + _session.DS_GLB[dsSessionP].containerId;
|
|
13487
|
+
container = '#' + _session.DS_GLB[dsSessionP].containerId;
|
|
13546
13488
|
}
|
|
13547
13489
|
//////////////
|
|
13548
13490
|
}
|
|
@@ -13550,14 +13492,14 @@ func.events.validate = async function (
|
|
|
13550
13492
|
console.error(e);
|
|
13551
13493
|
}
|
|
13552
13494
|
} else {
|
|
13553
|
-
container =
|
|
13495
|
+
container = '#' + _ds.screenId;
|
|
13554
13496
|
|
|
13555
13497
|
if ($(container) && $(container).data()) {
|
|
13556
13498
|
screen_prop = $(container).data().xuData.paramsP;
|
|
13557
13499
|
}
|
|
13558
13500
|
|
|
13559
13501
|
if (!$(container) || !$(container).length) {
|
|
13560
|
-
container =
|
|
13502
|
+
container = '#' + _ds.containerId;
|
|
13561
13503
|
}
|
|
13562
13504
|
}
|
|
13563
13505
|
} else {
|
|
@@ -13569,7 +13511,7 @@ func.events.validate = async function (
|
|
|
13569
13511
|
jobs.push(
|
|
13570
13512
|
await func.events.add_to_queue(
|
|
13571
13513
|
SESSION_ID,
|
|
13572
|
-
sourceP +
|
|
13514
|
+
sourceP + ' event',
|
|
13573
13515
|
trigger_obj.id,
|
|
13574
13516
|
null, // was click
|
|
13575
13517
|
trigger_obj.data.action,
|
|
@@ -13595,8 +13537,8 @@ func.events.validate = async function (
|
|
|
13595
13537
|
null,
|
|
13596
13538
|
args,
|
|
13597
13539
|
null,
|
|
13598
|
-
null
|
|
13599
|
-
)
|
|
13540
|
+
null,
|
|
13541
|
+
),
|
|
13600
13542
|
);
|
|
13601
13543
|
}
|
|
13602
13544
|
}
|
|
@@ -13608,15 +13550,7 @@ func.events.validate = async function (
|
|
|
13608
13550
|
}
|
|
13609
13551
|
} else {
|
|
13610
13552
|
if (val.data.condition && !expCond.result) {
|
|
13611
|
-
func.utils.debug.watch(
|
|
13612
|
-
SESSION_ID,
|
|
13613
|
-
_ds.prog_id + "%" + val.id,
|
|
13614
|
-
"view_event",
|
|
13615
|
-
val,
|
|
13616
|
-
triggerP + " " + eventIdP,
|
|
13617
|
-
expCond,
|
|
13618
|
-
true
|
|
13619
|
-
);
|
|
13553
|
+
func.utils.debug.watch(SESSION_ID, _ds.prog_id + '%' + val.id, 'view_event', val, triggerP + ' ' + eventIdP, expCond, true);
|
|
13620
13554
|
}
|
|
13621
13555
|
}
|
|
13622
13556
|
}
|
|
@@ -13639,7 +13573,7 @@ func.events.add_to_queue = async function (
|
|
|
13639
13573
|
containerP,
|
|
13640
13574
|
elementP,
|
|
13641
13575
|
rowP,
|
|
13642
|
-
|
|
13576
|
+
evt,
|
|
13643
13577
|
descP,
|
|
13644
13578
|
NA_rootScreenIdP,
|
|
13645
13579
|
NA_callingEventIdP,
|
|
@@ -13657,7 +13591,7 @@ func.events.add_to_queue = async function (
|
|
|
13657
13591
|
calling_job,
|
|
13658
13592
|
args,
|
|
13659
13593
|
$div,
|
|
13660
|
-
$container
|
|
13594
|
+
$container,
|
|
13661
13595
|
) {
|
|
13662
13596
|
var _session = SESSION_OBJ[SESSION_ID];
|
|
13663
13597
|
var obj = {
|
|
@@ -13682,11 +13616,11 @@ func.events.add_to_queue = async function (
|
|
|
13682
13616
|
args,
|
|
13683
13617
|
$div,
|
|
13684
13618
|
$container,
|
|
13685
|
-
|
|
13619
|
+
evt,
|
|
13686
13620
|
job_num: _session.WORKER_OBJ.num,
|
|
13687
13621
|
};
|
|
13688
13622
|
var _ds = _session.DS_GLB[dsSessionP];
|
|
13689
|
-
if (typeof dsSessionP !==
|
|
13623
|
+
if (typeof dsSessionP !== 'undefined' && dsSessionP !== null) {
|
|
13690
13624
|
obj.prog_id = _ds.prog_id;
|
|
13691
13625
|
obj.parentDataSourceNo = _ds.parentDataSourceNo;
|
|
13692
13626
|
obj.nodeId = _ds.nodeId;
|
|
@@ -13694,21 +13628,16 @@ func.events.add_to_queue = async function (
|
|
|
13694
13628
|
///////
|
|
13695
13629
|
if (glb.IS_WORKER && func.utils.is_onscreen_event(functionP)) {
|
|
13696
13630
|
obj.client = true;
|
|
13697
|
-
if (functionP ===
|
|
13631
|
+
if (functionP === 'call_library') {
|
|
13698
13632
|
obj.client = false;
|
|
13699
13633
|
}
|
|
13700
|
-
if (typeof dsSessionP !==
|
|
13634
|
+
if (typeof dsSessionP !== 'undefined' && dsSessionP !== null) {
|
|
13701
13635
|
obj.ds_obj = func.utils.clean_returned_datasource(SESSION_ID, dsSessionP);
|
|
13702
13636
|
}
|
|
13703
13637
|
if (obj.client) {
|
|
13704
13638
|
_session.WORKER_OBJ.num++;
|
|
13705
13639
|
// if (!_session.IS_API)
|
|
13706
|
-
func.utils.post_back_to_client(
|
|
13707
|
-
SESSION_ID,
|
|
13708
|
-
"job",
|
|
13709
|
-
_session.worker_id,
|
|
13710
|
-
obj
|
|
13711
|
-
);
|
|
13640
|
+
func.utils.post_back_to_client(SESSION_ID, 'job', _session.worker_id, obj);
|
|
13712
13641
|
return;
|
|
13713
13642
|
}
|
|
13714
13643
|
}
|
|
@@ -13722,14 +13651,10 @@ func.events.add_to_queue = async function (
|
|
|
13722
13651
|
_session.WORKER_OBJ.jobs[job_index].splice_count = 0;
|
|
13723
13652
|
}
|
|
13724
13653
|
_session.WORKER_OBJ.jobs[job_index].splice_count++;
|
|
13725
|
-
_session.WORKER_OBJ.jobs.splice(
|
|
13726
|
-
job_index + _session.WORKER_OBJ.jobs[job_index].splice_count,
|
|
13727
|
-
0,
|
|
13728
|
-
obj
|
|
13729
|
-
);
|
|
13654
|
+
_session.WORKER_OBJ.jobs.splice(job_index + _session.WORKER_OBJ.jobs[job_index].splice_count, 0, obj);
|
|
13730
13655
|
// }
|
|
13731
13656
|
} catch (e) {
|
|
13732
|
-
console.error(
|
|
13657
|
+
console.error('bug');
|
|
13733
13658
|
// _session.WORKER_OBJ.jobs.splice(0, 0, obj);
|
|
13734
13659
|
}
|
|
13735
13660
|
} else {
|
|
@@ -13761,7 +13686,7 @@ func.events.execute = async function (
|
|
|
13761
13686
|
containerP,
|
|
13762
13687
|
elementP,
|
|
13763
13688
|
rowP,
|
|
13764
|
-
|
|
13689
|
+
evt,
|
|
13765
13690
|
descP,
|
|
13766
13691
|
rootScreenIdP,
|
|
13767
13692
|
dsSessionP,
|
|
@@ -13779,14 +13704,14 @@ func.events.execute = async function (
|
|
|
13779
13704
|
NA_viewIdP,
|
|
13780
13705
|
NA_nodeIdP,
|
|
13781
13706
|
NA_parentDataSourceNoP,
|
|
13782
|
-
$div
|
|
13707
|
+
$div,
|
|
13783
13708
|
) {
|
|
13784
13709
|
var _session = SESSION_OBJ[SESSION_ID];
|
|
13785
13710
|
var _ds = _session.DS_GLB[dsSessionP];
|
|
13786
|
-
if (functionP ===
|
|
13711
|
+
if (functionP === 'update') refIdP = null; // in case of left over when program changing from call function to update
|
|
13787
13712
|
|
|
13788
13713
|
var job_index = func.events.find_job_index(SESSION_ID, jobNoP);
|
|
13789
|
-
if (_session.WORKER_OBJ.jobs?.[job_index]?.stat ===
|
|
13714
|
+
if (_session.WORKER_OBJ.jobs?.[job_index]?.stat === 'busy') {
|
|
13790
13715
|
if (jobNoP) _session.WORKER_OBJ.stat = job_index;
|
|
13791
13716
|
return;
|
|
13792
13717
|
}
|
|
@@ -13803,61 +13728,44 @@ func.events.execute = async function (
|
|
|
13803
13728
|
}
|
|
13804
13729
|
|
|
13805
13730
|
if (_session.WORKER_OBJ.jobs[job_index]) {
|
|
13806
|
-
_session.WORKER_OBJ.jobs[job_index].stat =
|
|
13731
|
+
_session.WORKER_OBJ.jobs[job_index].stat = 'busy';
|
|
13807
13732
|
}
|
|
13808
13733
|
|
|
13809
13734
|
var dsSession = dsSessionP; // new 2020420
|
|
13810
13735
|
var field_elm = elementP;
|
|
13811
13736
|
|
|
13812
13737
|
var calling_field_id = field_elm;
|
|
13813
|
-
if (field_elm && typeof field_elm ===
|
|
13814
|
-
calling_field_id = field_elm.attr("xu-ui-id");
|
|
13738
|
+
if (field_elm && typeof field_elm === 'object') calling_field_id = field_elm.attr('xu-ui-id');
|
|
13815
13739
|
|
|
13816
13740
|
var log_nodeId;
|
|
13817
13741
|
var log_prog_id;
|
|
13818
13742
|
var log_source;
|
|
13819
13743
|
|
|
13820
|
-
if (_session.DS_GLB[dsSession]?.prog_id)
|
|
13821
|
-
|
|
13822
|
-
log_nodeId = log_prog_id + "_" + eventIdP;
|
|
13744
|
+
if (_session.DS_GLB[dsSession]?.prog_id) log_prog_id = _session.DS_GLB[dsSession].prog_id;
|
|
13745
|
+
log_nodeId = log_prog_id + '_' + eventIdP;
|
|
13823
13746
|
var log_prop = callingSourceP;
|
|
13824
|
-
if (callingSourceP ===
|
|
13825
|
-
log_prop =
|
|
13747
|
+
if (callingSourceP === 'system event') {
|
|
13748
|
+
log_prop = 'global event';
|
|
13826
13749
|
}
|
|
13827
13750
|
if (calling_field_id) {
|
|
13828
13751
|
const _view_obj = await func.utils.VIEWS_OBJ.get(SESSION_ID, _ds.prog_id);
|
|
13829
|
-
let _field_obj = func.common.find_item_by_key(
|
|
13830
|
-
|
|
13831
|
-
"field_id",
|
|
13832
|
-
calling_field_id
|
|
13833
|
-
);
|
|
13834
|
-
log_nodeId = log_prog_id + "_" + eventIdP + "_" + _field_obj?.id;
|
|
13752
|
+
let _field_obj = func.common.find_item_by_key(_view_obj.progFields, 'field_id', calling_field_id);
|
|
13753
|
+
log_nodeId = log_prog_id + '_' + eventIdP + '_' + _field_obj?.id;
|
|
13835
13754
|
|
|
13836
13755
|
log_source = calling_field_id;
|
|
13837
13756
|
}
|
|
13838
13757
|
if (elementP) {
|
|
13839
13758
|
log_prop = triggerP;
|
|
13840
|
-
log_nodeId = log_nodeId +
|
|
13759
|
+
log_nodeId = log_nodeId + '_ui_prop'; //+"_"+eventIdP;
|
|
13841
13760
|
}
|
|
13842
13761
|
//check condition
|
|
13843
13762
|
var expCond;
|
|
13844
13763
|
if (event_propertiesP) {
|
|
13845
13764
|
// conditional event
|
|
13846
13765
|
if (event_propertiesP?.props?.condition) {
|
|
13847
|
-
expCond = await func.expression.get(
|
|
13848
|
-
SESSION_ID,
|
|
13849
|
-
event_propertiesP.props.condition,
|
|
13850
|
-
dsSession,
|
|
13851
|
-
"condition",
|
|
13852
|
-
null,
|
|
13853
|
-
null,
|
|
13854
|
-
null,
|
|
13855
|
-
calling_field_id ? calling_field_id : calling_triggerP,
|
|
13856
|
-
null,
|
|
13857
|
-
descP
|
|
13858
|
-
); // execute expression
|
|
13766
|
+
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
|
|
13859
13767
|
func.utils.debug.log(SESSION_ID, log_nodeId, {
|
|
13860
|
-
module:
|
|
13768
|
+
module: 'event',
|
|
13861
13769
|
action: log_prop,
|
|
13862
13770
|
source: log_source,
|
|
13863
13771
|
prop: descP,
|
|
@@ -13865,7 +13773,7 @@ func.events.execute = async function (
|
|
|
13865
13773
|
result: expCond.result,
|
|
13866
13774
|
error: expCond.error,
|
|
13867
13775
|
fields: expCond.fields,
|
|
13868
|
-
type:
|
|
13776
|
+
type: 'event',
|
|
13869
13777
|
prog_id: log_prog_id,
|
|
13870
13778
|
conditional: true,
|
|
13871
13779
|
});
|
|
@@ -13874,21 +13782,13 @@ func.events.execute = async function (
|
|
|
13874
13782
|
// condition failed // === true 03/04/16
|
|
13875
13783
|
func.events.delete_job(SESSION_ID, jobNoP);
|
|
13876
13784
|
|
|
13877
|
-
func.utils.debug.watch(
|
|
13878
|
-
SESSION_ID,
|
|
13879
|
-
calling_trigger_prop?.id,
|
|
13880
|
-
functionP,
|
|
13881
|
-
"",
|
|
13882
|
-
"",
|
|
13883
|
-
expCond,
|
|
13884
|
-
true
|
|
13885
|
-
);
|
|
13785
|
+
func.utils.debug.watch(SESSION_ID, calling_trigger_prop?.id, functionP, '', '', expCond, true);
|
|
13886
13786
|
return;
|
|
13887
13787
|
}
|
|
13888
13788
|
} // Non conditional event
|
|
13889
13789
|
else {
|
|
13890
13790
|
func.utils.debug.log(SESSION_ID, log_nodeId, {
|
|
13891
|
-
module:
|
|
13791
|
+
module: 'event',
|
|
13892
13792
|
action: log_prop,
|
|
13893
13793
|
source: log_source,
|
|
13894
13794
|
prop: descP,
|
|
@@ -13896,7 +13796,7 @@ func.events.execute = async function (
|
|
|
13896
13796
|
result: null,
|
|
13897
13797
|
error: null,
|
|
13898
13798
|
fields: null,
|
|
13899
|
-
type:
|
|
13799
|
+
type: 'event',
|
|
13900
13800
|
prog_id: log_prog_id,
|
|
13901
13801
|
});
|
|
13902
13802
|
}
|
|
@@ -13919,47 +13819,27 @@ func.events.execute = async function (
|
|
|
13919
13819
|
// };
|
|
13920
13820
|
|
|
13921
13821
|
const get_params_obj = async function () {
|
|
13922
|
-
const _prog = await func.utils.VIEWS_OBJ.get(
|
|
13923
|
-
SESSION_ID,
|
|
13924
|
-
await get_prog_id()
|
|
13925
|
-
);
|
|
13822
|
+
const _prog = await func.utils.VIEWS_OBJ.get(SESSION_ID, await get_prog_id());
|
|
13926
13823
|
if (!_prog) {
|
|
13927
13824
|
func.events.delete_job(SESSION_ID, jobNoP);
|
|
13928
|
-
return func.utils.debug_report(
|
|
13929
|
-
SESSION_ID,
|
|
13930
|
-
"func.events.execute",
|
|
13931
|
-
"Program not found: " + refIdP.prog,
|
|
13932
|
-
"E"
|
|
13933
|
-
);
|
|
13825
|
+
return func.utils.debug_report(SESSION_ID, 'func.events.execute', 'Program not found: ' + refIdP.prog, 'E');
|
|
13934
13826
|
}
|
|
13935
13827
|
|
|
13936
13828
|
// get in parameters
|
|
13937
13829
|
var params_obj = {};
|
|
13938
13830
|
if (_prog?.properties?.progParams) {
|
|
13939
|
-
for await (const [key, val] of Object.entries(
|
|
13940
|
-
|
|
13941
|
-
|
|
13942
|
-
if (!val.data.dir === "in") continue;
|
|
13943
|
-
if (
|
|
13944
|
-
typeof args.parameters_obj_inP?.[val.data.parameter] !== "undefined"
|
|
13945
|
-
) {
|
|
13831
|
+
for await (const [key, val] of Object.entries(_prog.properties.progParams)) {
|
|
13832
|
+
if (!val.data.dir === 'in') continue;
|
|
13833
|
+
if (typeof args.parameters_obj_inP?.[val.data.parameter] !== 'undefined') {
|
|
13946
13834
|
if (args.parameters_obj_inP?.[val.data.parameter].fx) {
|
|
13947
|
-
let ret = await func.expression.get(
|
|
13948
|
-
SESSION_ID,
|
|
13949
|
-
args.parameters_obj_inP?.[val.data.parameter].fx,
|
|
13950
|
-
dsSession,
|
|
13951
|
-
"parameters"
|
|
13952
|
-
);
|
|
13835
|
+
let ret = await func.expression.get(SESSION_ID, args.parameters_obj_inP?.[val.data.parameter].fx, dsSession, 'parameters');
|
|
13953
13836
|
params_obj[val.data.parameter] = ret.result;
|
|
13954
13837
|
} else {
|
|
13955
|
-
params_obj[val.data.parameter] =
|
|
13956
|
-
args.parameters_obj_inP?.[val.data.parameter].value;
|
|
13838
|
+
params_obj[val.data.parameter] = args.parameters_obj_inP?.[val.data.parameter].value;
|
|
13957
13839
|
}
|
|
13958
13840
|
continue;
|
|
13959
13841
|
}
|
|
13960
|
-
console.warn(
|
|
13961
|
-
`Warning: Program ${_prog.properties.menuName} expected In parameter: ${val.data.parameter} but received null instead`
|
|
13962
|
-
);
|
|
13842
|
+
console.warn(`Warning: Program ${_prog.properties.menuName} expected In parameter: ${val.data.parameter} but received null instead`);
|
|
13963
13843
|
}
|
|
13964
13844
|
}
|
|
13965
13845
|
return params_obj;
|
|
@@ -13968,15 +13848,8 @@ func.events.execute = async function (
|
|
|
13968
13848
|
const get_prog_id = async function () {
|
|
13969
13849
|
let _prop = args?.calling_trigger_prop?.data?.name?.properties;
|
|
13970
13850
|
let _prog_id = args.prog_id;
|
|
13971
|
-
if (_prop?.[
|
|
13972
|
-
_prog_id = (
|
|
13973
|
-
await func.expression.get(
|
|
13974
|
-
SESSION_ID,
|
|
13975
|
-
_prop["xu-exp:prog"],
|
|
13976
|
-
dsSession,
|
|
13977
|
-
"prog_id expression"
|
|
13978
|
-
)
|
|
13979
|
-
).result;
|
|
13851
|
+
if (_prop?.['xu-exp:prog']) {
|
|
13852
|
+
_prog_id = (await func.expression.get(SESSION_ID, _prop['xu-exp:prog'], dsSession, 'prog_id expression')).result;
|
|
13980
13853
|
}
|
|
13981
13854
|
|
|
13982
13855
|
return _prog_id;
|
|
@@ -13998,7 +13871,6 @@ func.events.execute = async function (
|
|
|
13998
13871
|
// return _value;
|
|
13999
13872
|
// };
|
|
14000
13873
|
|
|
14001
|
-
|
|
14002
13874
|
var args = {
|
|
14003
13875
|
prog_id: refIdP?.prog,
|
|
14004
13876
|
screenIdP: refIdP?.prog,
|
|
@@ -14026,40 +13898,20 @@ func.events.execute = async function (
|
|
|
14026
13898
|
var $calling_container;
|
|
14027
13899
|
if (_session.WORKER_OBJ.jobs[job_index]) {
|
|
14028
13900
|
if (_session.WORKER_OBJ.jobs[job_index].paramsP) {
|
|
14029
|
-
$calling_container = $(
|
|
14030
|
-
"#" + _session.WORKER_OBJ.jobs[job_index].paramsP.callingContainerP
|
|
14031
|
-
);
|
|
13901
|
+
$calling_container = $('#' + _session.WORKER_OBJ.jobs[job_index].paramsP.callingContainerP);
|
|
14032
13902
|
} else {
|
|
14033
|
-
$calling_container =
|
|
13903
|
+
$calling_container = ''; // calling from datasource 0
|
|
14034
13904
|
_session.WORKER_OBJ.jobs[job_index].paramsP = {};
|
|
14035
13905
|
}
|
|
14036
13906
|
}
|
|
14037
13907
|
|
|
14038
13908
|
if (!refIdP.prog) {
|
|
14039
13909
|
func.events.delete_job(SESSION_ID, jobNoP);
|
|
14040
|
-
return func.utils.debug_report(
|
|
14041
|
-
SESSION_ID,
|
|
14042
|
-
"func.events.execute",
|
|
14043
|
-
"Program is empty",
|
|
14044
|
-
"E"
|
|
14045
|
-
);
|
|
13910
|
+
return func.utils.debug_report(SESSION_ID, 'func.events.execute', 'Program is empty', 'E');
|
|
14046
13911
|
}
|
|
14047
13912
|
|
|
14048
13913
|
const params_obj = await get_params_obj();
|
|
14049
|
-
return await func.UI.screen.init(
|
|
14050
|
-
SESSION_ID,
|
|
14051
|
-
await get_prog_id(),
|
|
14052
|
-
$(containerP)?.data()?.xuData.screenId,
|
|
14053
|
-
_session.DS_GLB[dsSession],
|
|
14054
|
-
$calling_container,
|
|
14055
|
-
eventIdP,
|
|
14056
|
-
rowP,
|
|
14057
|
-
jobNoP,
|
|
14058
|
-
is_panel,
|
|
14059
|
-
params_obj,
|
|
14060
|
-
functionP,
|
|
14061
|
-
args.call_screen_propertiesP
|
|
14062
|
-
);
|
|
13914
|
+
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);
|
|
14063
13915
|
},
|
|
14064
13916
|
call_modal: async function () {
|
|
14065
13917
|
return await fx.Call_window();
|
|
@@ -14082,101 +13934,66 @@ func.events.execute = async function (
|
|
|
14082
13934
|
|
|
14083
13935
|
const set_SYS_GLOBAL_OBJ_WIDGET_INFO = async function (docP) {
|
|
14084
13936
|
var obj = _.clone(docP);
|
|
14085
|
-
obj.date = await func.utils.get_dateTime(
|
|
14086
|
-
|
|
14087
|
-
"SYS_DATE",
|
|
14088
|
-
docP.date
|
|
14089
|
-
);
|
|
14090
|
-
obj.time = await func.utils.get_dateTime(
|
|
14091
|
-
SESSION_ID,
|
|
14092
|
-
"SYS_TIME",
|
|
14093
|
-
docP.date
|
|
14094
|
-
);
|
|
13937
|
+
obj.date = await func.utils.get_dateTime(SESSION_ID, 'SYS_DATE', docP.date);
|
|
13938
|
+
obj.time = await func.utils.get_dateTime(SESSION_ID, 'SYS_TIME', docP.date);
|
|
14095
13939
|
|
|
14096
13940
|
var datasource_changes = {
|
|
14097
13941
|
[0]: {
|
|
14098
|
-
[
|
|
14099
|
-
[
|
|
13942
|
+
['data_system']: {
|
|
13943
|
+
['SYS_GLOBAL_OBJ_WIDGET_INFO']: obj,
|
|
14100
13944
|
},
|
|
14101
13945
|
},
|
|
14102
13946
|
};
|
|
14103
13947
|
await func.datasource.update(SESSION_ID, datasource_changes);
|
|
14104
13948
|
};
|
|
14105
13949
|
const call_plugin_api = async function (plugin_nameP, dataP) {
|
|
14106
|
-
return await func.utils.call_plugin_api(
|
|
14107
|
-
SESSION_ID,
|
|
14108
|
-
plugin_nameP,
|
|
14109
|
-
dataP
|
|
14110
|
-
);
|
|
13950
|
+
return await func.utils.call_plugin_api(SESSION_ID, plugin_nameP, dataP);
|
|
14111
13951
|
};
|
|
14112
13952
|
const report_error = function (descP, warn) {
|
|
14113
|
-
func.utils.debug.log(
|
|
14114
|
-
|
|
14115
|
-
|
|
14116
|
-
|
|
14117
|
-
|
|
14118
|
-
|
|
14119
|
-
|
|
14120
|
-
|
|
13953
|
+
func.utils.debug.log(SESSION_ID, _session.DS_GLB[dsP].prog_id + '_' + _session.DS_GLB[dsP].callingMenuId, {
|
|
13954
|
+
module: 'widgets',
|
|
13955
|
+
action: 'Init',
|
|
13956
|
+
source: sourceP,
|
|
13957
|
+
prop: descP,
|
|
13958
|
+
details: descP,
|
|
13959
|
+
result: null,
|
|
13960
|
+
error: warn ? false : true,
|
|
13961
|
+
fields: null,
|
|
13962
|
+
type: 'widgets',
|
|
13963
|
+
prog_id: _session.DS_GLB[dsP].prog_id,
|
|
13964
|
+
});
|
|
13965
|
+
};
|
|
13966
|
+
const get_fields_data = async function (fields, props) {
|
|
13967
|
+
const report_error = function (descP, warn) {
|
|
13968
|
+
func.utils.debug.log(SESSION_ID, _session.DS_GLB[dsP].prog_id + '_' + _session.DS_GLB[dsP].callingMenuId, {
|
|
13969
|
+
module: 'widgets',
|
|
13970
|
+
action: 'Init',
|
|
14121
13971
|
source: sourceP,
|
|
14122
13972
|
prop: descP,
|
|
14123
13973
|
details: descP,
|
|
14124
13974
|
result: null,
|
|
14125
13975
|
error: warn ? false : true,
|
|
14126
13976
|
fields: null,
|
|
14127
|
-
type:
|
|
13977
|
+
type: 'widgets',
|
|
14128
13978
|
prog_id: _session.DS_GLB[dsP].prog_id,
|
|
14129
|
-
}
|
|
14130
|
-
);
|
|
14131
|
-
};
|
|
14132
|
-
const get_fields_data = async function (fields, props) {
|
|
14133
|
-
const report_error = function (descP, warn) {
|
|
14134
|
-
func.utils.debug.log(
|
|
14135
|
-
SESSION_ID,
|
|
14136
|
-
_session.DS_GLB[dsP].prog_id +
|
|
14137
|
-
"_" +
|
|
14138
|
-
_session.DS_GLB[dsP].callingMenuId,
|
|
14139
|
-
{
|
|
14140
|
-
module: "widgets",
|
|
14141
|
-
action: "Init",
|
|
14142
|
-
source: sourceP,
|
|
14143
|
-
prop: descP,
|
|
14144
|
-
details: descP,
|
|
14145
|
-
result: null,
|
|
14146
|
-
error: warn ? false : true,
|
|
14147
|
-
fields: null,
|
|
14148
|
-
type: "widgets",
|
|
14149
|
-
prog_id: _session.DS_GLB[dsP].prog_id,
|
|
14150
|
-
}
|
|
14151
|
-
);
|
|
13979
|
+
});
|
|
14152
13980
|
};
|
|
14153
13981
|
const get_property_value = async function (fieldIdP, val) {
|
|
14154
13982
|
// var value = props[fieldIdP];
|
|
14155
13983
|
|
|
14156
|
-
var value =
|
|
14157
|
-
props[fieldIdP] ||
|
|
14158
|
-
(typeof val.defaultValue === "function"
|
|
14159
|
-
? val?.defaultValue?.()
|
|
14160
|
-
: val?.defaultValue);
|
|
13984
|
+
var value = props[fieldIdP] || (typeof val.defaultValue === 'function' ? val?.defaultValue?.() : val?.defaultValue);
|
|
14161
13985
|
|
|
14162
13986
|
if (props[`xu-exp:${fieldIdP}`]) {
|
|
14163
|
-
value = (
|
|
14164
|
-
await func.expression.get(
|
|
14165
|
-
SESSION_ID,
|
|
14166
|
-
props[`xu-exp:${fieldIdP}`],
|
|
14167
|
-
dsP,
|
|
14168
|
-
"widget property"
|
|
14169
|
-
)
|
|
14170
|
-
).result;
|
|
13987
|
+
value = (await func.expression.get(SESSION_ID, props[`xu-exp:${fieldIdP}`], dsP, 'widget property')).result;
|
|
14171
13988
|
}
|
|
14172
13989
|
|
|
14173
13990
|
return func.common.get_cast_val(
|
|
14174
13991
|
SESSION_ID,
|
|
14175
|
-
|
|
13992
|
+
'widgets',
|
|
14176
13993
|
fieldIdP,
|
|
14177
13994
|
val.type, //val.type !== "string" || val.type !== "number" ? "string" : val.type,
|
|
14178
13995
|
value,
|
|
14179
|
-
null
|
|
13996
|
+
null,
|
|
14180
13997
|
);
|
|
14181
13998
|
};
|
|
14182
13999
|
var data_obj = {};
|
|
@@ -14199,51 +14016,36 @@ func.events.execute = async function (
|
|
|
14199
14016
|
};
|
|
14200
14017
|
|
|
14201
14018
|
try {
|
|
14202
|
-
const _plugin =
|
|
14203
|
-
APP_OBJ[_session.app_id]?.app_plugins_purchased?.[plugin_name];
|
|
14019
|
+
const _plugin = APP_OBJ[_session.app_id]?.app_plugins_purchased?.[plugin_name];
|
|
14204
14020
|
|
|
14205
|
-
const index = await func.utils.get_plugin_resource(
|
|
14206
|
-
SESSION_ID,
|
|
14207
|
-
plugin_name,
|
|
14208
|
-
`${_plugin.manifest["index.mjs"].dist ? "dist/" : ""}index.mjs`
|
|
14209
|
-
);
|
|
14021
|
+
const index = await func.utils.get_plugin_resource(SESSION_ID, plugin_name, `${_plugin.manifest['index.mjs'].dist ? 'dist/' : ''}index.mjs`);
|
|
14210
14022
|
|
|
14211
14023
|
const methods = index.methods;
|
|
14212
14024
|
if (methods && !methods[method]) {
|
|
14213
|
-
return report_error(
|
|
14025
|
+
return report_error('method not found');
|
|
14214
14026
|
}
|
|
14215
14027
|
|
|
14216
|
-
const fields_ret = await get_fields_data(
|
|
14217
|
-
methods[method].fields,
|
|
14218
|
-
propsP
|
|
14219
|
-
);
|
|
14028
|
+
const fields_ret = await get_fields_data(methods[method].fields, propsP);
|
|
14220
14029
|
|
|
14221
14030
|
if (fields_ret.code < 0) {
|
|
14222
14031
|
return report_error(fields_ret.data);
|
|
14223
14032
|
}
|
|
14224
14033
|
const fields = fields_ret.data;
|
|
14225
14034
|
|
|
14226
|
-
const plugin_setup_ret = await func.utils.get_plugin_setup(
|
|
14227
|
-
SESSION_ID,
|
|
14228
|
-
plugin_name
|
|
14229
|
-
);
|
|
14035
|
+
const plugin_setup_ret = await func.utils.get_plugin_setup(SESSION_ID, plugin_name);
|
|
14230
14036
|
if (plugin_setup_ret.code < 0) {
|
|
14231
14037
|
return report_error(plugin_setup_ret);
|
|
14232
14038
|
}
|
|
14233
14039
|
|
|
14234
|
-
const api_utils = await func.common.get_module(
|
|
14040
|
+
const api_utils = await func.common.get_module(SESSION_ID, 'xuda-api-library.mjs', {
|
|
14041
|
+
func,
|
|
14042
|
+
glb,
|
|
14043
|
+
SESSION_OBJ,
|
|
14235
14044
|
SESSION_ID,
|
|
14236
|
-
|
|
14237
|
-
|
|
14238
|
-
|
|
14239
|
-
|
|
14240
|
-
SESSION_OBJ,
|
|
14241
|
-
SESSION_ID,
|
|
14242
|
-
APP_OBJ,
|
|
14243
|
-
dsSession: dsP,
|
|
14244
|
-
job_id: jobNoP,
|
|
14245
|
-
}
|
|
14246
|
-
);
|
|
14045
|
+
APP_OBJ,
|
|
14046
|
+
dsSession: dsP,
|
|
14047
|
+
job_id: jobNoP,
|
|
14048
|
+
});
|
|
14247
14049
|
|
|
14248
14050
|
const params = {
|
|
14249
14051
|
SESSION_ID,
|
|
@@ -14262,11 +14064,7 @@ func.events.execute = async function (
|
|
|
14262
14064
|
api_utils,
|
|
14263
14065
|
};
|
|
14264
14066
|
|
|
14265
|
-
const fx = await func.utils.get_plugin_resource(
|
|
14266
|
-
SESSION_ID,
|
|
14267
|
-
plugin_name,
|
|
14268
|
-
`${_plugin.manifest["runtime.mjs"].dist ? "dist/" : ""}runtime.mjs`
|
|
14269
|
-
);
|
|
14067
|
+
const fx = await func.utils.get_plugin_resource(SESSION_ID, plugin_name, `${_plugin.manifest['runtime.mjs'].dist ? 'dist/' : ''}runtime.mjs`);
|
|
14270
14068
|
|
|
14271
14069
|
if (!fx[method]) {
|
|
14272
14070
|
throw `Method: ${method} does not exist`;
|
|
@@ -14280,41 +14078,21 @@ func.events.execute = async function (
|
|
|
14280
14078
|
},
|
|
14281
14079
|
|
|
14282
14080
|
call_native_javascript: async function () {
|
|
14283
|
-
const module = await func.common.get_module(
|
|
14284
|
-
|
|
14285
|
-
"xuda-event-javascript-module.mjs"
|
|
14286
|
-
);
|
|
14287
|
-
const result = await module.call_javascript(
|
|
14288
|
-
SESSION_ID,
|
|
14289
|
-
jobNoP,
|
|
14290
|
-
refIdP,
|
|
14291
|
-
dsSession
|
|
14292
|
-
);
|
|
14081
|
+
const module = await func.common.get_module(SESSION_ID, 'xuda-event-javascript-module.mjs');
|
|
14082
|
+
const result = await module.call_javascript(SESSION_ID, jobNoP, refIdP, dsSession);
|
|
14293
14083
|
await func.datasource.set_outputField(SESSION_ID, dsSessionP, result, args);
|
|
14294
14084
|
|
|
14295
|
-
return result
|
|
14085
|
+
return result;
|
|
14296
14086
|
},
|
|
14297
14087
|
call_evaluate_javascript: async function () {
|
|
14298
|
-
const module = await func.common.get_module(
|
|
14299
|
-
|
|
14300
|
-
"xuda-event-javascript-module.mjs"
|
|
14301
|
-
);
|
|
14302
|
-
const result = await module.call_javascript(
|
|
14303
|
-
SESSION_ID,
|
|
14304
|
-
jobNoP,
|
|
14305
|
-
refIdP,
|
|
14306
|
-
dsSession,
|
|
14307
|
-
true
|
|
14308
|
-
);
|
|
14088
|
+
const module = await func.common.get_module(SESSION_ID, 'xuda-event-javascript-module.mjs');
|
|
14089
|
+
const result = await module.call_javascript(SESSION_ID, jobNoP, refIdP, dsSession, true);
|
|
14309
14090
|
await func.datasource.set_outputField(SESSION_ID, dsSessionP, result, args);
|
|
14310
14091
|
|
|
14311
|
-
return result
|
|
14092
|
+
return result;
|
|
14312
14093
|
},
|
|
14313
14094
|
execute_native_javascript: async function () {
|
|
14314
|
-
const module = await func.common.get_module(
|
|
14315
|
-
SESSION_ID,
|
|
14316
|
-
"xuda-event-javascript-module.mjs"
|
|
14317
|
-
);
|
|
14095
|
+
const module = await func.common.get_module(SESSION_ID, 'xuda-event-javascript-module.mjs');
|
|
14318
14096
|
|
|
14319
14097
|
const result = await module.run_javascript(
|
|
14320
14098
|
SESSION_ID,
|
|
@@ -14322,17 +14100,14 @@ func.events.execute = async function (
|
|
|
14322
14100
|
dsSession,
|
|
14323
14101
|
`(async function(el) {
|
|
14324
14102
|
${refIdP.value}
|
|
14325
|
-
})(document.querySelector(\`[xu-ui-id=${elementP}]\`))
|
|
14103
|
+
})(document.querySelector(\`[xu-ui-id=${elementP}]\`))`,
|
|
14326
14104
|
);
|
|
14327
14105
|
await func.datasource.set_outputField(SESSION_ID, dsSessionP, result, args);
|
|
14328
14106
|
|
|
14329
|
-
return result
|
|
14107
|
+
return result;
|
|
14330
14108
|
},
|
|
14331
14109
|
execute_evaluate_javascript: async function () {
|
|
14332
|
-
const module = await func.common.get_module(
|
|
14333
|
-
SESSION_ID,
|
|
14334
|
-
"xuda-event-javascript-module.mjs"
|
|
14335
|
-
);
|
|
14110
|
+
const module = await func.common.get_module(SESSION_ID, 'xuda-event-javascript-module.mjs');
|
|
14336
14111
|
|
|
14337
14112
|
const result = await module.run_javascript(
|
|
14338
14113
|
SESSION_ID,
|
|
@@ -14341,11 +14116,11 @@ func.events.execute = async function (
|
|
|
14341
14116
|
`(async function(el) {
|
|
14342
14117
|
${refIdP.value}
|
|
14343
14118
|
})(document.querySelector(\`[xu-ui-id=${elementP}]\`))`,
|
|
14344
|
-
true
|
|
14119
|
+
true,
|
|
14345
14120
|
);
|
|
14346
14121
|
await func.datasource.set_outputField(SESSION_ID, dsSessionP, result, args);
|
|
14347
14122
|
|
|
14348
|
-
return result
|
|
14123
|
+
return result;
|
|
14349
14124
|
},
|
|
14350
14125
|
loader_on: async function () {
|
|
14351
14126
|
glb.CURRENT_APP_LOADING = null;
|
|
@@ -14366,131 +14141,59 @@ func.events.execute = async function (
|
|
|
14366
14141
|
// if (descP.value) {
|
|
14367
14142
|
$(document).trigger(refIdP.value, [_session.DS_GLB[dsSession]]);
|
|
14368
14143
|
} else {
|
|
14369
|
-
func.utils.debug_report(
|
|
14370
|
-
SESSION_ID,
|
|
14371
|
-
"func.events.execute",
|
|
14372
|
-
"Event name missing",
|
|
14373
|
-
"E"
|
|
14374
|
-
);
|
|
14144
|
+
func.utils.debug_report(SESSION_ID, 'func.events.execute', 'Event name missing', 'E');
|
|
14375
14145
|
}
|
|
14376
14146
|
func.events.delete_job(SESSION_ID, jobNoP);
|
|
14377
14147
|
// if (callbackP) callbackP();
|
|
14378
14148
|
},
|
|
14379
14149
|
|
|
14380
14150
|
invoke_action: async function () {
|
|
14381
|
-
func.utils.debug.watch(
|
|
14382
|
-
SESSION_ID,
|
|
14383
|
-
calling_trigger_prop?.id,
|
|
14384
|
-
functionP,
|
|
14385
|
-
null,
|
|
14386
|
-
null,
|
|
14387
|
-
expCond
|
|
14388
|
-
);
|
|
14151
|
+
func.utils.debug.watch(SESSION_ID, calling_trigger_prop?.id, functionP, null, null, expCond);
|
|
14389
14152
|
|
|
14390
|
-
await func.action.execute(
|
|
14391
|
-
SESSION_ID,
|
|
14392
|
-
refIdP.value,
|
|
14393
|
-
_ds,
|
|
14394
|
-
null,
|
|
14395
|
-
null,
|
|
14396
|
-
jobNoP,
|
|
14397
|
-
containerP
|
|
14398
|
-
);
|
|
14153
|
+
await func.action.execute(SESSION_ID, refIdP.value, _ds, null, null, jobNoP, containerP);
|
|
14399
14154
|
},
|
|
14400
14155
|
raise_event: async function () {
|
|
14401
14156
|
var _ds = _session.DS_GLB[dsSession];
|
|
14402
14157
|
const _view_obj = await func.utils.VIEWS_OBJ.get(SESSION_ID, _ds.prog_id);
|
|
14403
|
-
if (callingSourceP ===
|
|
14404
|
-
let _field_obj = func.common.find_item_by_key(
|
|
14405
|
-
_view_obj.progFields,
|
|
14406
|
-
"field_id",
|
|
14407
|
-
field_elm
|
|
14408
|
-
);
|
|
14158
|
+
if (callingSourceP === 'grid' || callingSourceP === 'form') {
|
|
14159
|
+
let _field_obj = func.common.find_item_by_key(_view_obj.progFields, 'field_id', field_elm);
|
|
14409
14160
|
var event_name = _field_obj?.triggers?.[eventIdP].name.event;
|
|
14410
14161
|
|
|
14411
|
-
if (_field_obj?.triggers?.[eventIdP].name?.properties[
|
|
14412
|
-
event_name = (
|
|
14413
|
-
await func.expression.get(
|
|
14414
|
-
SESSION_ID,
|
|
14415
|
-
props[`xu-exp:event`],
|
|
14416
|
-
dsSession,
|
|
14417
|
-
"event_name expression"
|
|
14418
|
-
)
|
|
14419
|
-
).result;
|
|
14162
|
+
if (_field_obj?.triggers?.[eventIdP].name?.properties['xu-exp:event']) {
|
|
14163
|
+
event_name = (await func.expression.get(SESSION_ID, props[`xu-exp:event`], dsSession, 'event_name expression')).result;
|
|
14420
14164
|
}
|
|
14421
14165
|
|
|
14422
14166
|
if (field_elm && event_name) {
|
|
14423
14167
|
// get container for fields events
|
|
14424
|
-
const dsP = await func.datasource.find_event_dataSource(
|
|
14425
|
-
SESSION_ID,
|
|
14426
|
-
event_name,
|
|
14427
|
-
dsSession
|
|
14428
|
-
);
|
|
14168
|
+
const dsP = await func.datasource.find_event_dataSource(SESSION_ID, event_name, dsSession);
|
|
14429
14169
|
|
|
14430
|
-
return await func.datasource.run_events_functions(
|
|
14431
|
-
SESSION_ID,
|
|
14432
|
-
dsP,
|
|
14433
|
-
event_name,
|
|
14434
|
-
jobNoP,
|
|
14435
|
-
null,
|
|
14436
|
-
calling_trigger_prop?.data?.name?.parameters || {}
|
|
14437
|
-
);
|
|
14170
|
+
return await func.datasource.run_events_functions(SESSION_ID, dsP, event_name, jobNoP, null, calling_trigger_prop?.data?.name?.parameters || {});
|
|
14438
14171
|
}
|
|
14439
14172
|
// done_execution(event_name);
|
|
14440
14173
|
}
|
|
14441
|
-
if (callingSourceP.includes(
|
|
14174
|
+
if (callingSourceP.includes('event')) {
|
|
14442
14175
|
let event_name = refIdP.event;
|
|
14443
14176
|
|
|
14444
|
-
if (refIdP?.properties?.[
|
|
14445
|
-
event_name = (
|
|
14446
|
-
await func.expression.get(
|
|
14447
|
-
SESSION_ID,
|
|
14448
|
-
refIdP.properties["xu-exp:event"],
|
|
14449
|
-
dsSession,
|
|
14450
|
-
"event_name expression"
|
|
14451
|
-
)
|
|
14452
|
-
).result;
|
|
14177
|
+
if (refIdP?.properties?.['xu-exp:event']) {
|
|
14178
|
+
event_name = (await func.expression.get(SESSION_ID, refIdP.properties['xu-exp:event'], dsSession, 'event_name expression')).result;
|
|
14453
14179
|
}
|
|
14454
14180
|
|
|
14455
|
-
const dsP = await func.datasource.find_event_dataSource(
|
|
14456
|
-
SESSION_ID,
|
|
14457
|
-
event_name,
|
|
14458
|
-
dsSession
|
|
14459
|
-
);
|
|
14181
|
+
const dsP = await func.datasource.find_event_dataSource(SESSION_ID, event_name, dsSession);
|
|
14460
14182
|
|
|
14461
|
-
await func.datasource.run_events_functions(
|
|
14462
|
-
SESSION_ID,
|
|
14463
|
-
dsP,
|
|
14464
|
-
event_name,
|
|
14465
|
-
jobNoP,
|
|
14466
|
-
calling_trigger_prop?.props?.async,
|
|
14467
|
-
calling_trigger_prop?.data?.name?.parameters || {}
|
|
14468
|
-
);
|
|
14183
|
+
await func.datasource.run_events_functions(SESSION_ID, dsP, event_name, jobNoP, calling_trigger_prop?.props?.async, calling_trigger_prop?.data?.name?.parameters || {});
|
|
14469
14184
|
// done_execution(event_name);
|
|
14470
14185
|
}
|
|
14471
14186
|
|
|
14472
14187
|
func.events.delete_job(SESSION_ID, jobNoP);
|
|
14473
14188
|
// if (callbackP) callbackP();
|
|
14474
14189
|
|
|
14475
|
-
func.utils.debug.watch(
|
|
14476
|
-
SESSION_ID,
|
|
14477
|
-
calling_trigger_prop?.id,
|
|
14478
|
-
functionP,
|
|
14479
|
-
"",
|
|
14480
|
-
"",
|
|
14481
|
-
expCond
|
|
14482
|
-
);
|
|
14190
|
+
func.utils.debug.watch(SESSION_ID, calling_trigger_prop?.id, functionP, '', '', expCond);
|
|
14483
14191
|
},
|
|
14484
14192
|
get_data: async function () {
|
|
14485
14193
|
const params_obj = await get_params_obj();
|
|
14486
14194
|
|
|
14487
14195
|
if (!(await get_prog_id())) {
|
|
14488
|
-
func.utils.debug_report(
|
|
14489
|
-
SESSION_ID,
|
|
14490
|
-
"func.events.execute",
|
|
14491
|
-
`${elementP} > ${triggerP} > ${functionP} > program ${prog} is missing`,
|
|
14492
|
-
"E"
|
|
14493
|
-
);
|
|
14196
|
+
func.utils.debug_report(SESSION_ID, 'func.events.execute', `${elementP} > ${triggerP} > ${functionP} > program ${prog} is missing`, 'E');
|
|
14494
14197
|
func.events.delete_job(SESSION_ID, jobNoP);
|
|
14495
14198
|
return;
|
|
14496
14199
|
}
|
|
@@ -14503,41 +14206,14 @@ func.events.execute = async function (
|
|
|
14503
14206
|
|
|
14504
14207
|
// args.prog_id = _viewId;
|
|
14505
14208
|
if (_ds) {
|
|
14506
|
-
func.utils.debug.watch(
|
|
14507
|
-
SESSION_ID,
|
|
14508
|
-
calling_trigger_prop?.id,
|
|
14509
|
-
functionP,
|
|
14510
|
-
null,
|
|
14511
|
-
calling_trigger_prop,
|
|
14512
|
-
expCond
|
|
14513
|
-
);
|
|
14209
|
+
func.utils.debug.watch(SESSION_ID, calling_trigger_prop?.id, functionP, null, calling_trigger_prop, expCond);
|
|
14514
14210
|
// }
|
|
14515
|
-
const ret = await func.datasource.create(
|
|
14516
|
-
SESSION_ID,
|
|
14517
|
-
await get_prog_id(),
|
|
14518
|
-
args.dataSourceNoP,
|
|
14519
|
-
args.parentDataSourceNoP,
|
|
14520
|
-
args.containerIdP,
|
|
14521
|
-
args.rowIdP,
|
|
14522
|
-
args.jobNoP,
|
|
14523
|
-
args.calling_trigger_prop,
|
|
14524
|
-
null,
|
|
14525
|
-
null,
|
|
14526
|
-
args.callingSourceP,
|
|
14527
|
-
args.calling_jobP,
|
|
14528
|
-
args.screen_dsP,
|
|
14529
|
-
args.is_panelP,
|
|
14530
|
-
params_obj
|
|
14531
|
-
);
|
|
14211
|
+
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);
|
|
14532
14212
|
|
|
14533
14213
|
let _ds_new = _session.DS_GLB[ret.dsSessionP];
|
|
14534
14214
|
let parameters = args?.calling_trigger_prop?.data?.name?.parameters;
|
|
14535
14215
|
if (parameters && !_.isEmpty(parameters)) {
|
|
14536
|
-
await func.datasource.update_changes_for_out_parameter(
|
|
14537
|
-
SESSION_ID,
|
|
14538
|
-
_ds_new.dsSession,
|
|
14539
|
-
_ds.dsSession
|
|
14540
|
-
);
|
|
14216
|
+
await func.datasource.update_changes_for_out_parameter(SESSION_ID, _ds_new.dsSession, _ds.dsSession);
|
|
14541
14217
|
}
|
|
14542
14218
|
// if (parameters && !_.isEmpty(parameters) && _ds_new.PARAM_OUT_INFO) {
|
|
14543
14219
|
// let data = {};
|
|
@@ -14566,7 +14242,7 @@ func.events.execute = async function (
|
|
|
14566
14242
|
// }
|
|
14567
14243
|
|
|
14568
14244
|
func.events.delete_job(SESSION_ID, jobNoP);
|
|
14569
|
-
return _ds_new
|
|
14245
|
+
return _ds_new;
|
|
14570
14246
|
}
|
|
14571
14247
|
},
|
|
14572
14248
|
set_data: async function () {
|
|
@@ -14576,24 +14252,12 @@ func.events.execute = async function (
|
|
|
14576
14252
|
const result = await this.get_data();
|
|
14577
14253
|
|
|
14578
14254
|
// await set_outputField(SESSION_ID, elementP, triggerP, functionP, dsSessionP, result);
|
|
14579
|
-
return result
|
|
14580
|
-
|
|
14255
|
+
return result;
|
|
14581
14256
|
},
|
|
14582
14257
|
update: async function () {
|
|
14583
|
-
const obj_values_to_update =
|
|
14584
|
-
func.datasource.get_viewFields_for_update_function(
|
|
14585
|
-
SESSION_ID,
|
|
14586
|
-
calling_trigger_prop,
|
|
14587
|
-
null,
|
|
14588
|
-
dsSessionP
|
|
14589
|
-
);
|
|
14258
|
+
const obj_values_to_update = func.datasource.get_viewFields_for_update_function(SESSION_ID, calling_trigger_prop, null, dsSessionP);
|
|
14590
14259
|
if (!obj_values_to_update || _.isEmpty(obj_values_to_update)) {
|
|
14591
|
-
func.utils.debug_report(
|
|
14592
|
-
SESSION_ID,
|
|
14593
|
-
"Update values object is empty",
|
|
14594
|
-
"",
|
|
14595
|
-
"W"
|
|
14596
|
-
);
|
|
14260
|
+
func.utils.debug_report(SESSION_ID, 'Update values object is empty', '', 'W');
|
|
14597
14261
|
if (jobNoP) func.events.delete_job(SESSION_ID, jobNoP);
|
|
14598
14262
|
return;
|
|
14599
14263
|
}
|
|
@@ -14606,32 +14270,8 @@ func.events.execute = async function (
|
|
|
14606
14270
|
$element = $(`[xu-ui-id="${elementP}"]`).clone(true);
|
|
14607
14271
|
}
|
|
14608
14272
|
|
|
14609
|
-
let ret_field_id = await func.expression.get(
|
|
14610
|
-
|
|
14611
|
-
val.id.trim(),
|
|
14612
|
-
dsSessionP,
|
|
14613
|
-
"update",
|
|
14614
|
-
null,
|
|
14615
|
-
null,
|
|
14616
|
-
null,
|
|
14617
|
-
null,
|
|
14618
|
-
null,
|
|
14619
|
-
null,
|
|
14620
|
-
$element?.length ? $element?.data()?.xuData?.iterate_info : null
|
|
14621
|
-
);
|
|
14622
|
-
let ret_value = await func.expression.get(
|
|
14623
|
-
SESSION_ID,
|
|
14624
|
-
val.val.trim(),
|
|
14625
|
-
dsSessionP,
|
|
14626
|
-
"update",
|
|
14627
|
-
null,
|
|
14628
|
-
null,
|
|
14629
|
-
null,
|
|
14630
|
-
null,
|
|
14631
|
-
null,
|
|
14632
|
-
null,
|
|
14633
|
-
$element?.length ? $element?.data()?.xuData?.iterate_info : null
|
|
14634
|
-
);
|
|
14273
|
+
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);
|
|
14274
|
+
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);
|
|
14635
14275
|
let _field_id = ret_field_id.result;
|
|
14636
14276
|
let _value = ret_value.result;
|
|
14637
14277
|
|
|
@@ -14640,25 +14280,16 @@ func.events.execute = async function (
|
|
|
14640
14280
|
|
|
14641
14281
|
let datasource_changes = {};
|
|
14642
14282
|
for await (const change of updates) {
|
|
14643
|
-
let ret_get_value = await func.datasource.get_value(
|
|
14644
|
-
SESSION_ID,
|
|
14645
|
-
change._field_id,
|
|
14646
|
-
dsSessionP
|
|
14647
|
-
);
|
|
14283
|
+
let ret_get_value = await func.datasource.get_value(SESSION_ID, change._field_id, dsSessionP);
|
|
14648
14284
|
if (ret_get_value.found) {
|
|
14649
14285
|
let _ds = _session.DS_GLB[ret_get_value.dsSessionP];
|
|
14650
14286
|
if (!datasource_changes[_ds.dsSession]) {
|
|
14651
14287
|
datasource_changes[_ds.dsSession] = {};
|
|
14652
14288
|
}
|
|
14653
|
-
if (
|
|
14654
|
-
|
|
14655
|
-
) {
|
|
14656
|
-
datasource_changes[_ds.dsSession][ret_get_value.currentRecordId] =
|
|
14657
|
-
{};
|
|
14289
|
+
if (!datasource_changes[_ds.dsSession][ret_get_value.currentRecordId]) {
|
|
14290
|
+
datasource_changes[_ds.dsSession][ret_get_value.currentRecordId] = {};
|
|
14658
14291
|
}
|
|
14659
|
-
datasource_changes[_ds.dsSession][ret_get_value.currentRecordId][
|
|
14660
|
-
change._field_id
|
|
14661
|
-
] = change._value;
|
|
14292
|
+
datasource_changes[_ds.dsSession][ret_get_value.currentRecordId][change._field_id] = change._value;
|
|
14662
14293
|
}
|
|
14663
14294
|
}
|
|
14664
14295
|
|
|
@@ -14667,23 +14298,11 @@ func.events.execute = async function (
|
|
|
14667
14298
|
// return changes;
|
|
14668
14299
|
},
|
|
14669
14300
|
call_alert: async function () {
|
|
14670
|
-
await func.utils.alerts.invoke(
|
|
14671
|
-
SESSION_ID,
|
|
14672
|
-
"call_alert",
|
|
14673
|
-
refIdP,
|
|
14674
|
-
log_source,
|
|
14675
|
-
dsSession
|
|
14676
|
-
);
|
|
14301
|
+
await func.utils.alerts.invoke(SESSION_ID, 'call_alert', refIdP, log_source, dsSession);
|
|
14677
14302
|
func.events.delete_job(SESSION_ID, jobNoP);
|
|
14678
14303
|
},
|
|
14679
14304
|
alert: async function () {
|
|
14680
|
-
await func.utils.alerts.invoke(
|
|
14681
|
-
SESSION_ID,
|
|
14682
|
-
"alert",
|
|
14683
|
-
refIdP,
|
|
14684
|
-
log_source,
|
|
14685
|
-
dsSession
|
|
14686
|
-
);
|
|
14305
|
+
await func.utils.alerts.invoke(SESSION_ID, 'alert', refIdP, log_source, dsSession);
|
|
14687
14306
|
func.events.delete_job(SESSION_ID, jobNoP);
|
|
14688
14307
|
},
|
|
14689
14308
|
delay: async function () {
|
|
@@ -14702,18 +14321,11 @@ func.events.execute = async function (
|
|
|
14702
14321
|
const _prog_id = await get_prog_id();
|
|
14703
14322
|
|
|
14704
14323
|
if (!_prog_id) {
|
|
14705
|
-
func.utils.debug_report(
|
|
14706
|
-
SESSION_ID,
|
|
14707
|
-
"func.events.execute",
|
|
14708
|
-
`${elementP} > ${triggerP} > ${functionP} > program not defined`,
|
|
14709
|
-
"E"
|
|
14710
|
-
);
|
|
14324
|
+
func.utils.debug_report(SESSION_ID, 'func.events.execute', `${elementP} > ${triggerP} > ${functionP} > program not defined`, 'E');
|
|
14711
14325
|
func.events.delete_job(SESSION_ID, jobNoP);
|
|
14712
14326
|
return;
|
|
14713
14327
|
}
|
|
14714
14328
|
|
|
14715
|
-
|
|
14716
|
-
|
|
14717
14329
|
// if (!output_field) {
|
|
14718
14330
|
// func.utils.debug_report(
|
|
14719
14331
|
// SESSION_ID,
|
|
@@ -14729,37 +14341,24 @@ func.events.execute = async function (
|
|
|
14729
14341
|
|
|
14730
14342
|
await func.datasource.set_outputField(SESSION_ID, dsSessionP, api_ret, args);
|
|
14731
14343
|
|
|
14732
|
-
|
|
14733
14344
|
func.events.delete_job(SESSION_ID, jobNoP);
|
|
14734
14345
|
},
|
|
14735
14346
|
call_system_api: async function () {
|
|
14736
|
-
const api_method = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args,
|
|
14347
|
+
const api_method = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args, 'api_method');
|
|
14737
14348
|
|
|
14738
14349
|
if (!api_method) {
|
|
14739
|
-
func.utils.debug_report(
|
|
14740
|
-
SESSION_ID,
|
|
14741
|
-
"func.events.execute",
|
|
14742
|
-
`${elementP} >${triggerP} >${functionP} > api_method not defined`,
|
|
14743
|
-
"E"
|
|
14744
|
-
);
|
|
14350
|
+
func.utils.debug_report(SESSION_ID, 'func.events.execute', `${elementP} >${triggerP} >${functionP} > api_method not defined`, 'E');
|
|
14745
14351
|
func.events.delete_job(SESSION_ID, jobNoP);
|
|
14746
14352
|
return;
|
|
14747
14353
|
}
|
|
14748
14354
|
let payload = {};
|
|
14749
|
-
const _payload = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args,
|
|
14355
|
+
const _payload = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args, 'payload');
|
|
14750
14356
|
if (_payload) {
|
|
14751
14357
|
const get_payload_property_value = async function (prop_name) {
|
|
14752
14358
|
let _prop = _payload;
|
|
14753
14359
|
let _value = _prop[prop_name];
|
|
14754
14360
|
if (_prop?.[`xu-exp:${prop_name}`]) {
|
|
14755
|
-
_value = (
|
|
14756
|
-
await func.expression.get(
|
|
14757
|
-
SESSION_ID,
|
|
14758
|
-
_prop[`xu-exp:${prop_name}`],
|
|
14759
|
-
dsSession,
|
|
14760
|
-
`${prop_name} expression`
|
|
14761
|
-
)
|
|
14762
|
-
).result;
|
|
14361
|
+
_value = (await func.expression.get(SESSION_ID, _prop[`xu-exp:${prop_name}`], dsSession, `${prop_name} expression`)).result;
|
|
14763
14362
|
}
|
|
14764
14363
|
|
|
14765
14364
|
return _value;
|
|
@@ -14767,7 +14366,7 @@ func.events.execute = async function (
|
|
|
14767
14366
|
|
|
14768
14367
|
for await (let [key, val] of Object.entries(_payload)) {
|
|
14769
14368
|
// if (key.substring(0, 7) !== "xu-exp:") {
|
|
14770
|
-
const new_key = key.replaceAll(
|
|
14369
|
+
const new_key = key.replaceAll('xu-exp:', ''); //key.substring(0, 7) === "xu-exp:" ? key.substring(7): key
|
|
14771
14370
|
payload[new_key] = await get_payload_property_value(new_key);
|
|
14772
14371
|
// }
|
|
14773
14372
|
}
|
|
@@ -14784,7 +14383,7 @@ func.events.execute = async function (
|
|
|
14784
14383
|
// return;
|
|
14785
14384
|
// }
|
|
14786
14385
|
|
|
14787
|
-
const output_field = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args,
|
|
14386
|
+
const output_field = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args, 'outputField');
|
|
14788
14387
|
|
|
14789
14388
|
// if (!output_field) {
|
|
14790
14389
|
// func.utils.debug_report(
|
|
@@ -14801,89 +14400,57 @@ func.events.execute = async function (
|
|
|
14801
14400
|
if (output_field) {
|
|
14802
14401
|
let datasource_changes = {};
|
|
14803
14402
|
|
|
14804
|
-
let ret_get_value = await func.datasource.get_value(
|
|
14805
|
-
SESSION_ID,
|
|
14806
|
-
output_field,
|
|
14807
|
-
dsSessionP
|
|
14808
|
-
);
|
|
14403
|
+
let ret_get_value = await func.datasource.get_value(SESSION_ID, output_field, dsSessionP);
|
|
14809
14404
|
if (ret_get_value.found) {
|
|
14810
14405
|
let _ds = _session.DS_GLB[ret_get_value.dsSessionP];
|
|
14811
14406
|
if (!datasource_changes[_ds.dsSession]) {
|
|
14812
14407
|
datasource_changes[_ds.dsSession] = {};
|
|
14813
14408
|
}
|
|
14814
|
-
if (
|
|
14815
|
-
|
|
14816
|
-
) {
|
|
14817
|
-
datasource_changes[_ds.dsSession][ret_get_value.currentRecordId] =
|
|
14818
|
-
{};
|
|
14409
|
+
if (!datasource_changes[_ds.dsSession][ret_get_value.currentRecordId]) {
|
|
14410
|
+
datasource_changes[_ds.dsSession][ret_get_value.currentRecordId] = {};
|
|
14819
14411
|
}
|
|
14820
|
-
datasource_changes[_ds.dsSession][ret_get_value.currentRecordId][
|
|
14821
|
-
output_field
|
|
14822
|
-
] = api_ret;
|
|
14412
|
+
datasource_changes[_ds.dsSession][ret_get_value.currentRecordId][output_field] = api_ret;
|
|
14823
14413
|
await func.datasource.update(SESSION_ID, datasource_changes);
|
|
14824
14414
|
}
|
|
14825
14415
|
}
|
|
14826
14416
|
func.events.delete_job(SESSION_ID, jobNoP);
|
|
14827
14417
|
},
|
|
14828
14418
|
call_external_api: async function () {
|
|
14829
|
-
const method = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args,
|
|
14419
|
+
const method = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args, 'method');
|
|
14830
14420
|
|
|
14831
14421
|
if (!method) {
|
|
14832
|
-
func.utils.debug_report(
|
|
14833
|
-
SESSION_ID,
|
|
14834
|
-
"func.events.execute",
|
|
14835
|
-
`${elementP} >${triggerP} >${functionP} > method not defined`,
|
|
14836
|
-
"E"
|
|
14837
|
-
);
|
|
14422
|
+
func.utils.debug_report(SESSION_ID, 'func.events.execute', `${elementP} >${triggerP} >${functionP} > method not defined`, 'E');
|
|
14838
14423
|
func.events.delete_job(SESSION_ID, jobNoP);
|
|
14839
14424
|
return;
|
|
14840
14425
|
}
|
|
14841
14426
|
|
|
14842
|
-
const url = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args,
|
|
14427
|
+
const url = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args, 'url');
|
|
14843
14428
|
|
|
14844
14429
|
if (!url) {
|
|
14845
|
-
func.utils.debug_report(
|
|
14846
|
-
SESSION_ID,
|
|
14847
|
-
"func.events.execute",
|
|
14848
|
-
`${elementP} >${triggerP} >${functionP} > url not defined`,
|
|
14849
|
-
"E"
|
|
14850
|
-
);
|
|
14430
|
+
func.utils.debug_report(SESSION_ID, 'func.events.execute', `${elementP} >${triggerP} >${functionP} > url not defined`, 'E');
|
|
14851
14431
|
func.events.delete_job(SESSION_ID, jobNoP);
|
|
14852
14432
|
return;
|
|
14853
14433
|
}
|
|
14854
14434
|
|
|
14855
|
-
const payload_arr = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args,
|
|
14435
|
+
const payload_arr = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args, 'payload');
|
|
14856
14436
|
|
|
14857
14437
|
const report_conversion_error = function (res, typeP, valP) {
|
|
14858
14438
|
var msg = `${elementP} >${triggerP} >${functionP} > error converting from ${valP} to ${typeP}`;
|
|
14859
14439
|
if (error) {
|
|
14860
|
-
return func.utils.debug_report(SESSION_ID, msg,
|
|
14440
|
+
return func.utils.debug_report(SESSION_ID, msg, '', 'W');
|
|
14861
14441
|
}
|
|
14862
|
-
func.utils.debug_report(
|
|
14863
|
-
SESSION_ID,
|
|
14864
|
-
msg + " " + _.capitalize(source) + prog_info,
|
|
14865
|
-
"",
|
|
14866
|
-
"E"
|
|
14867
|
-
);
|
|
14442
|
+
func.utils.debug_report(SESSION_ID, msg + ' ' + _.capitalize(source) + prog_info, '', 'E');
|
|
14868
14443
|
};
|
|
14869
14444
|
const report_conversion_warn = function (res) {
|
|
14870
14445
|
var msg = `${elementP} >${triggerP} >${functionP} > type mismatch auto conversion from value ${valP} to ${typeP}`;
|
|
14871
|
-
func.utils.debug_report(
|
|
14872
|
-
SESSION_ID,
|
|
14873
|
-
msg + " " + _.capitalize(source) + prog_info,
|
|
14874
|
-
"",
|
|
14875
|
-
"W"
|
|
14876
|
-
);
|
|
14446
|
+
func.utils.debug_report(SESSION_ID, msg + ' ' + _.capitalize(source) + prog_info, '', 'W');
|
|
14877
14447
|
};
|
|
14878
14448
|
// var ret = valP;
|
|
14879
14449
|
if (error) {
|
|
14880
14450
|
return report_conversion_error();
|
|
14881
14451
|
}
|
|
14882
14452
|
|
|
14883
|
-
const module = await func.common.get_module(
|
|
14884
|
-
SESSION_ID,
|
|
14885
|
-
"xuda-get-cast-util-module.mjs"
|
|
14886
|
-
);
|
|
14453
|
+
const module = await func.common.get_module(SESSION_ID, 'xuda-get-cast-util-module.mjs');
|
|
14887
14454
|
// return module.cast(
|
|
14888
14455
|
// typeP,
|
|
14889
14456
|
// valP,
|
|
@@ -14894,16 +14461,11 @@ func.events.execute = async function (
|
|
|
14894
14461
|
var payload = _.reduce(
|
|
14895
14462
|
payload_arr,
|
|
14896
14463
|
(ret, val, key) => {
|
|
14897
|
-
ret[val.key] = module.cast(
|
|
14898
|
-
val.type,
|
|
14899
|
-
val.val,
|
|
14900
|
-
report_conversion_error,
|
|
14901
|
-
report_conversion_warn
|
|
14902
|
-
);
|
|
14464
|
+
ret[val.key] = module.cast(val.type, val.val, report_conversion_error, report_conversion_warn);
|
|
14903
14465
|
|
|
14904
14466
|
return ret;
|
|
14905
14467
|
},
|
|
14906
|
-
{}
|
|
14468
|
+
{},
|
|
14907
14469
|
);
|
|
14908
14470
|
// if (!payload) {
|
|
14909
14471
|
// func.utils.debug_report(
|
|
@@ -14916,7 +14478,7 @@ func.events.execute = async function (
|
|
|
14916
14478
|
// return;
|
|
14917
14479
|
// }
|
|
14918
14480
|
|
|
14919
|
-
const output_field = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args,
|
|
14481
|
+
const output_field = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args, 'outputField');
|
|
14920
14482
|
|
|
14921
14483
|
// if (!output_field) {
|
|
14922
14484
|
// func.utils.debug_report(
|
|
@@ -14933,25 +14495,16 @@ func.events.execute = async function (
|
|
|
14933
14495
|
if (output_field) {
|
|
14934
14496
|
let datasource_changes = {};
|
|
14935
14497
|
|
|
14936
|
-
let ret_get_value = await func.datasource.get_value(
|
|
14937
|
-
SESSION_ID,
|
|
14938
|
-
output_field,
|
|
14939
|
-
dsSessionP
|
|
14940
|
-
);
|
|
14498
|
+
let ret_get_value = await func.datasource.get_value(SESSION_ID, output_field, dsSessionP);
|
|
14941
14499
|
if (ret_get_value.found) {
|
|
14942
14500
|
let _ds = _session.DS_GLB[ret_get_value.dsSessionP];
|
|
14943
14501
|
if (!datasource_changes[_ds.dsSession]) {
|
|
14944
14502
|
datasource_changes[_ds.dsSession] = {};
|
|
14945
14503
|
}
|
|
14946
|
-
if (
|
|
14947
|
-
|
|
14948
|
-
) {
|
|
14949
|
-
datasource_changes[_ds.dsSession][ret_get_value.currentRecordId] =
|
|
14950
|
-
{};
|
|
14504
|
+
if (!datasource_changes[_ds.dsSession][ret_get_value.currentRecordId]) {
|
|
14505
|
+
datasource_changes[_ds.dsSession][ret_get_value.currentRecordId] = {};
|
|
14951
14506
|
}
|
|
14952
|
-
datasource_changes[_ds.dsSession][ret_get_value.currentRecordId][
|
|
14953
|
-
output_field
|
|
14954
|
-
] = api_ret;
|
|
14507
|
+
datasource_changes[_ds.dsSession][ret_get_value.currentRecordId][output_field] = api_ret;
|
|
14955
14508
|
await func.datasource.update(SESSION_ID, datasource_changes);
|
|
14956
14509
|
}
|
|
14957
14510
|
}
|
|
@@ -14984,16 +14537,9 @@ func.events.delete_job = function (SESSION_ID, jobNoP) {
|
|
|
14984
14537
|
var dsSession = _session.WORKER_OBJ.jobs[job_index].dsSessionP;
|
|
14985
14538
|
let ds_obj = _session?.DS_GLB[dsSession];
|
|
14986
14539
|
if (ds_obj) {
|
|
14987
|
-
delete SCREEN_BLOCKER_OBJ[
|
|
14988
|
-
ds_obj.screenId +
|
|
14989
|
-
(ds_obj.callingScreenId ? "_" + ds_obj.callingScreenId : "")
|
|
14990
|
-
];
|
|
14540
|
+
delete SCREEN_BLOCKER_OBJ[ds_obj.screenId + (ds_obj.callingScreenId ? '_' + ds_obj.callingScreenId : '')];
|
|
14991
14541
|
}
|
|
14992
|
-
if (
|
|
14993
|
-
dsSession &&
|
|
14994
|
-
ds_obj?.loops_limit &&
|
|
14995
|
-
ds_obj?.loops_count < ds_obj?.loops_limit - 1
|
|
14996
|
-
) {
|
|
14542
|
+
if (dsSession && ds_obj?.loops_limit && ds_obj?.loops_count < ds_obj?.loops_limit - 1) {
|
|
14997
14543
|
return;
|
|
14998
14544
|
}
|
|
14999
14545
|
_session.WORKER_OBJ.stat = null;
|
|
@@ -15011,17 +14557,9 @@ func.events.delete_job_0 = function (SESSION_ID) {
|
|
|
15011
14557
|
var dsSession = _session.WORKER_OBJ.jobs[job_index].dsSession;
|
|
15012
14558
|
let ds_obj = _session?.DS_GLB[dsSession];
|
|
15013
14559
|
if (ds_obj) {
|
|
15014
|
-
delete SCREEN_BLOCKER_OBJ[
|
|
15015
|
-
ds_obj.screenId +
|
|
15016
|
-
(ds_obj.callingScreenId ? "_" + ds_obj.callingScreenId : "")
|
|
15017
|
-
];
|
|
14560
|
+
delete SCREEN_BLOCKER_OBJ[ds_obj.screenId + (ds_obj.callingScreenId ? '_' + ds_obj.callingScreenId : '')];
|
|
15018
14561
|
}
|
|
15019
|
-
if (
|
|
15020
|
-
dsSession &&
|
|
15021
|
-
ds_obj &&
|
|
15022
|
-
ds_obj.loops_limit &&
|
|
15023
|
-
ds_obj.loops_count < ds_obj.loops_limit - 1
|
|
15024
|
-
) {
|
|
14562
|
+
if (dsSession && ds_obj && ds_obj.loops_limit && ds_obj.loops_count < ds_obj.loops_limit - 1) {
|
|
15025
14563
|
return;
|
|
15026
14564
|
}
|
|
15027
14565
|
_session.WORKER_OBJ.stat = null;
|
|
@@ -15063,8 +14601,7 @@ setInterval(function () {
|
|
|
15063
14601
|
}, 1000);
|
|
15064
14602
|
|
|
15065
14603
|
func.events.set_browser_changes = function (dsP, fieldsChangedP) {
|
|
15066
|
-
if (fieldsChangedP.includes(
|
|
15067
|
-
document.title = dsP.dataset_new["SYS_GLOBAL_STR_BROWSER_TITLE"];
|
|
14604
|
+
if (fieldsChangedP.includes('SYS_GLOBAL_STR_BROWSER_TITLE')) document.title = dsP.dataset_new['SYS_GLOBAL_STR_BROWSER_TITLE'];
|
|
15068
14605
|
};
|
|
15069
14606
|
|
|
15070
14607
|
func.events.execute_PENDING_OPEN_URL_EVENTS = async function () {
|
|
@@ -15073,52 +14610,29 @@ func.events.execute_PENDING_OPEN_URL_EVENTS = async function () {
|
|
|
15073
14610
|
glb.WINDOW_LOCATION_SEARCH = url;
|
|
15074
14611
|
glb.ROOT_ELEMENT_ATTRIBUTES = func.UI.utils.get_root_element_attributes();
|
|
15075
14612
|
|
|
15076
|
-
const params_obj = func.common.getObjectFromUrl(
|
|
15077
|
-
url,
|
|
15078
|
-
glb.ROOT_ELEMENT_ATTRIBUTES
|
|
15079
|
-
);
|
|
14613
|
+
const params_obj = func.common.getObjectFromUrl(url, glb.ROOT_ELEMENT_ATTRIBUTES);
|
|
15080
14614
|
if (!params_obj.prog) {
|
|
15081
|
-
return console.warn(
|
|
14615
|
+
return console.warn('prog empty');
|
|
15082
14616
|
}
|
|
15083
14617
|
|
|
15084
14618
|
await func.utils.TREE_OBJ.get(SESSION_ID, params_obj.prog);
|
|
15085
|
-
let screen_ret = await func.utils.get_screen_obj(
|
|
15086
|
-
SESSION_ID,
|
|
15087
|
-
params_obj.prog
|
|
15088
|
-
);
|
|
14619
|
+
let screen_ret = await func.utils.get_screen_obj(SESSION_ID, params_obj.prog);
|
|
15089
14620
|
|
|
15090
14621
|
if (screen_ret) {
|
|
15091
|
-
await func.UI.screen.init(
|
|
15092
|
-
SESSION_ID,
|
|
15093
|
-
params_obj.prog,
|
|
15094
|
-
null,
|
|
15095
|
-
null,
|
|
15096
|
-
$("#embed_" + SESSION_ID),
|
|
15097
|
-
null,
|
|
15098
|
-
null,
|
|
15099
|
-
null,
|
|
15100
|
-
null,
|
|
15101
|
-
null,
|
|
15102
|
-
"pendingUrlEvent_embed"
|
|
15103
|
-
);
|
|
14622
|
+
await func.UI.screen.init(SESSION_ID, params_obj.prog, null, null, $('#embed_' + SESSION_ID), null, null, null, null, null, 'pendingUrlEvent_embed');
|
|
15104
14623
|
} else {
|
|
15105
|
-
console.error(
|
|
15106
|
-
func.UI.utils.progressScreen.show(
|
|
15107
|
-
SESSION_ID,
|
|
15108
|
-
"Program not exist",
|
|
15109
|
-
null,
|
|
15110
|
-
true
|
|
15111
|
-
);
|
|
14624
|
+
console.error('Program not exist', params_obj.prog_id);
|
|
14625
|
+
func.UI.utils.progressScreen.show(SESSION_ID, 'Program not exist', null, true);
|
|
15112
14626
|
}
|
|
15113
14627
|
} else {
|
|
15114
|
-
console.warn(
|
|
14628
|
+
console.warn('url empty');
|
|
15115
14629
|
}
|
|
15116
14630
|
}
|
|
15117
14631
|
};
|
|
15118
14632
|
func.events.invoke = async function (event_id) {
|
|
15119
14633
|
var _session = SESSION_OBJ[SESSION_ID];
|
|
15120
14634
|
if (!event_id) {
|
|
15121
|
-
console.warn(
|
|
14635
|
+
console.warn('event_id Cannot be empty');
|
|
15122
14636
|
return false;
|
|
15123
14637
|
}
|
|
15124
14638
|
var ds;
|
|
@@ -15127,10 +14641,7 @@ func.events.invoke = async function (event_id) {
|
|
|
15127
14641
|
if (_.isEmpty(_view_obj.progEvents)) continue;
|
|
15128
14642
|
if (ds) break;
|
|
15129
14643
|
for await (const [key, val] of Object.entries(_view_obj.progEvents)) {
|
|
15130
|
-
if (
|
|
15131
|
-
val?.data?.type === "user_defined" &&
|
|
15132
|
-
val.data.event_name === event_id
|
|
15133
|
-
) {
|
|
14644
|
+
if (val?.data?.type === 'user_defined' && val.data.event_name === event_id) {
|
|
15134
14645
|
ds = ds_key;
|
|
15135
14646
|
break;
|
|
15136
14647
|
}
|
|
@@ -15138,11 +14649,11 @@ func.events.invoke = async function (event_id) {
|
|
|
15138
14649
|
}
|
|
15139
14650
|
|
|
15140
14651
|
if (!ds) {
|
|
15141
|
-
console.warn(
|
|
14652
|
+
console.warn('event_id not found');
|
|
15142
14653
|
return false;
|
|
15143
14654
|
}
|
|
15144
14655
|
|
|
15145
|
-
func.events.validate(SESSION_ID,
|
|
14656
|
+
func.events.validate(SESSION_ID, 'user_defined', ds, event_id);
|
|
15146
14657
|
};
|
|
15147
14658
|
func.expression = {};
|
|
15148
14659
|
|