@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
|
@@ -25574,7 +25574,7 @@ func.utils.job_worker = function (session_id) {
|
|
|
25574
25574
|
val.containerP,
|
|
25575
25575
|
val.elementP,
|
|
25576
25576
|
val.rowP,
|
|
25577
|
-
|
|
25577
|
+
val.evt,
|
|
25578
25578
|
val.descP,
|
|
25579
25579
|
val.rootScreenIdP,
|
|
25580
25580
|
val.dsSessionP,
|
|
@@ -32733,8 +32733,8 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
|
|
|
32733
32733
|
'xu-on': async function ($elm, val) {
|
|
32734
32734
|
CLIENT_ACTIVITY_TS = Date.now();
|
|
32735
32735
|
const trigger = val.key.split('xu-on:')[1].toLowerCase();
|
|
32736
|
-
$elm.on(trigger, async function (
|
|
32737
|
-
for await (const [key, val] of Object.entries($elm.data().xuAttributes['xu-on:' +
|
|
32736
|
+
$elm.on(trigger, async function (evt) {
|
|
32737
|
+
for await (const [key, val] of Object.entries($elm.data().xuAttributes['xu-on:' + evt.type])) {
|
|
32738
32738
|
if (val.handler === 'custom') {
|
|
32739
32739
|
// do BL
|
|
32740
32740
|
for await (const [key2, val2] of Object.entries(val.event)) {
|
|
@@ -32744,7 +32744,12 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
|
|
|
32744
32744
|
cond = expCond.result;
|
|
32745
32745
|
}
|
|
32746
32746
|
if (!cond) continue;
|
|
32747
|
-
|
|
32747
|
+
|
|
32748
|
+
if (val.event_modifiers && evt[val.event_modifiers]) {
|
|
32749
|
+
evt[val.event_modifiers]();
|
|
32750
|
+
}
|
|
32751
|
+
|
|
32752
|
+
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);
|
|
32748
32753
|
}
|
|
32749
32754
|
}
|
|
32750
32755
|
}
|
|
@@ -36073,15 +36078,7 @@ func.expression.secure_eval = async function (
|
|
|
36073
36078
|
}
|
|
36074
36079
|
};
|
|
36075
36080
|
func.events = {};
|
|
36076
|
-
func.events.validate = async function (
|
|
36077
|
-
SESSION_ID,
|
|
36078
|
-
triggerP,
|
|
36079
|
-
dsSessionP,
|
|
36080
|
-
eventIdP,
|
|
36081
|
-
sourceP,
|
|
36082
|
-
argumentsP,
|
|
36083
|
-
return_validation_onlyP
|
|
36084
|
-
) {
|
|
36081
|
+
func.events.validate = async function (SESSION_ID, triggerP, dsSessionP, eventIdP, sourceP, argumentsP, return_validation_onlyP) {
|
|
36085
36082
|
var _session = SESSION_OBJ[SESSION_ID];
|
|
36086
36083
|
var _ds = _session.DS_GLB[dsSessionP];
|
|
36087
36084
|
var args = {
|
|
@@ -36094,16 +36091,8 @@ func.events.validate = async function (
|
|
|
36094
36091
|
return_validation_onlyP,
|
|
36095
36092
|
};
|
|
36096
36093
|
const search_event_in_parent_ds = async function () {
|
|
36097
|
-
if (_ds && typeof _ds.parentDataSourceNo !==
|
|
36098
|
-
await func.events.validate(
|
|
36099
|
-
SESSION_ID,
|
|
36100
|
-
triggerP,
|
|
36101
|
-
_ds.parentDataSourceNo,
|
|
36102
|
-
eventIdP,
|
|
36103
|
-
sourceP,
|
|
36104
|
-
argumentsP,
|
|
36105
|
-
return_validation_onlyP
|
|
36106
|
-
);
|
|
36094
|
+
if (_ds && typeof _ds.parentDataSourceNo !== 'undefined') {
|
|
36095
|
+
await func.events.validate(SESSION_ID, triggerP, _ds.parentDataSourceNo, eventIdP, sourceP, argumentsP, return_validation_onlyP);
|
|
36107
36096
|
}
|
|
36108
36097
|
};
|
|
36109
36098
|
var ret = false;
|
|
@@ -36125,29 +36114,13 @@ func.events.validate = async function (
|
|
|
36125
36114
|
var eventProp = undefined;
|
|
36126
36115
|
if (val.data.type === triggerP) {
|
|
36127
36116
|
// compare event trigger
|
|
36128
|
-
if (
|
|
36129
|
-
(triggerP !== "user_defined") |
|
|
36130
|
-
(triggerP === "user_defined" && eventIdP === val.data.event_name)
|
|
36131
|
-
) {
|
|
36117
|
+
if ((triggerP !== 'user_defined') | (triggerP === 'user_defined' && eventIdP === val.data.event_name)) {
|
|
36132
36118
|
// compare user defined name
|
|
36133
36119
|
|
|
36134
36120
|
var expCond;
|
|
36135
|
-
if (val.data.condition)
|
|
36136
|
-
expCond = await func.expression.get(
|
|
36137
|
-
SESSION_ID,
|
|
36138
|
-
val.data.condition,
|
|
36139
|
-
dsSessionP,
|
|
36140
|
-
"condition"
|
|
36141
|
-
);
|
|
36121
|
+
if (val.data.condition) expCond = await func.expression.get(SESSION_ID, val.data.condition, dsSessionP, 'condition');
|
|
36142
36122
|
if (!val.data.condition || expCond.result) {
|
|
36143
|
-
func.utils.debug.watch(
|
|
36144
|
-
SESSION_ID,
|
|
36145
|
-
_ds.prog_id + "%" + val.id,
|
|
36146
|
-
"view_event",
|
|
36147
|
-
val,
|
|
36148
|
-
triggerP + " " + eventIdP,
|
|
36149
|
-
expCond
|
|
36150
|
-
);
|
|
36123
|
+
func.utils.debug.watch(SESSION_ID, _ds.prog_id + '%' + val.id, 'view_event', val, triggerP + ' ' + eventIdP, expCond);
|
|
36151
36124
|
ret = true;
|
|
36152
36125
|
if (return_validation_onlyP) break;
|
|
36153
36126
|
const set_arguments = async function () {
|
|
@@ -36185,48 +36158,24 @@ func.events.validate = async function (
|
|
|
36185
36158
|
// await func.datasource.update(SESSION_ID, datasource_changes);
|
|
36186
36159
|
// }
|
|
36187
36160
|
|
|
36188
|
-
for await (let [key, fieldId] of Object.entries(
|
|
36189
|
-
|
|
36190
|
-
)) {
|
|
36191
|
-
const field_info = func.common.find_item_by_key(
|
|
36192
|
-
_view_obj.progFields,
|
|
36193
|
-
"field_id",
|
|
36194
|
-
fieldId
|
|
36195
|
-
);
|
|
36161
|
+
for await (let [key, fieldId] of Object.entries(val.data.parameters)) {
|
|
36162
|
+
const field_info = func.common.find_item_by_key(_view_obj.progFields, 'field_id', fieldId);
|
|
36196
36163
|
|
|
36197
|
-
if (field_info?.data?.type !==
|
|
36198
|
-
console.warn(
|
|
36164
|
+
if (field_info?.data?.type !== 'virtual') {
|
|
36165
|
+
console.warn('parameter field must be virtual, update ignored');
|
|
36199
36166
|
continue;
|
|
36200
36167
|
}
|
|
36201
36168
|
|
|
36202
|
-
if (!args[fieldId]) continue
|
|
36203
|
-
|
|
36169
|
+
if (!args[fieldId]) continue;
|
|
36204
36170
|
|
|
36205
|
-
|
|
36206
|
-
let value = await func.common.get_cast_val(
|
|
36207
|
-
SESSION_ID,
|
|
36208
|
-
"events",
|
|
36209
|
-
fieldId,
|
|
36210
|
-
field_info.props.fieldType,
|
|
36211
|
-
args[fieldId].value
|
|
36212
|
-
);
|
|
36171
|
+
let value = await func.common.get_cast_val(SESSION_ID, 'events', fieldId, field_info.props.fieldType, args[fieldId].value);
|
|
36213
36172
|
|
|
36214
36173
|
if (!_.isEmpty(args[fieldId].fx)) {
|
|
36215
|
-
const fx_ret = await func.expression.get(
|
|
36216
|
-
SESSION_ID,
|
|
36217
|
-
args[fieldId].fx,
|
|
36218
|
-
dsSessionP,
|
|
36219
|
-
"update"
|
|
36220
|
-
)
|
|
36174
|
+
const fx_ret = await func.expression.get(SESSION_ID, args[fieldId].fx, dsSessionP, 'update');
|
|
36221
36175
|
value = fx_ret.result;
|
|
36222
36176
|
}
|
|
36223
36177
|
// find the target field in the program dataset
|
|
36224
|
-
const ret = await func.datasource.get_value(
|
|
36225
|
-
SESSION_ID,
|
|
36226
|
-
fieldId,
|
|
36227
|
-
dsSessionP,
|
|
36228
|
-
_ds.currentRecordId
|
|
36229
|
-
);
|
|
36178
|
+
const ret = await func.datasource.get_value(SESSION_ID, fieldId, dsSessionP, _ds.currentRecordId);
|
|
36230
36179
|
|
|
36231
36180
|
const datasource_changes = {
|
|
36232
36181
|
[ret.dsSessionP]: {
|
|
@@ -36239,11 +36188,7 @@ func.events.validate = async function (
|
|
|
36239
36188
|
await add_event();
|
|
36240
36189
|
};
|
|
36241
36190
|
const add_event = async function () {
|
|
36242
|
-
const _event = func.common.find_item_by_key_root(
|
|
36243
|
-
_view_obj.progEvents,
|
|
36244
|
-
"id",
|
|
36245
|
-
val.id
|
|
36246
|
-
);
|
|
36191
|
+
const _event = func.common.find_item_by_key_root(_view_obj.progEvents, 'id', val.id);
|
|
36247
36192
|
if (_event.triggers) {
|
|
36248
36193
|
// check if event property exist
|
|
36249
36194
|
|
|
@@ -36266,22 +36211,19 @@ func.events.validate = async function (
|
|
|
36266
36211
|
if (!glb.IS_WORKER) {
|
|
36267
36212
|
if (_ds.panel_div_id) {
|
|
36268
36213
|
try {
|
|
36269
|
-
container =
|
|
36214
|
+
container = '#' + _ds.panel_div_id;
|
|
36270
36215
|
if ($(container).data().xuData.panel_info) {
|
|
36271
|
-
screen_prop =
|
|
36272
|
-
$(container).data().xuData.panel_info.paramsP;
|
|
36216
|
+
screen_prop = $(container).data().xuData.panel_info.paramsP;
|
|
36273
36217
|
} else {
|
|
36274
36218
|
///////////////
|
|
36275
|
-
container =
|
|
36276
|
-
"#" + _session.DS_GLB[dsSessionP].screenId;
|
|
36219
|
+
container = '#' + _session.DS_GLB[dsSessionP].screenId;
|
|
36277
36220
|
|
|
36278
36221
|
if ($(container) && $(container).data()) {
|
|
36279
36222
|
screen_prop = $(container).data().xuData.paramsP;
|
|
36280
36223
|
}
|
|
36281
36224
|
|
|
36282
36225
|
if (!$(container) || !$(container).length) {
|
|
36283
|
-
container =
|
|
36284
|
-
"#" + _session.DS_GLB[dsSessionP].containerId;
|
|
36226
|
+
container = '#' + _session.DS_GLB[dsSessionP].containerId;
|
|
36285
36227
|
}
|
|
36286
36228
|
//////////////
|
|
36287
36229
|
}
|
|
@@ -36289,14 +36231,14 @@ func.events.validate = async function (
|
|
|
36289
36231
|
console.error(e);
|
|
36290
36232
|
}
|
|
36291
36233
|
} else {
|
|
36292
|
-
container =
|
|
36234
|
+
container = '#' + _ds.screenId;
|
|
36293
36235
|
|
|
36294
36236
|
if ($(container) && $(container).data()) {
|
|
36295
36237
|
screen_prop = $(container).data().xuData.paramsP;
|
|
36296
36238
|
}
|
|
36297
36239
|
|
|
36298
36240
|
if (!$(container) || !$(container).length) {
|
|
36299
|
-
container =
|
|
36241
|
+
container = '#' + _ds.containerId;
|
|
36300
36242
|
}
|
|
36301
36243
|
}
|
|
36302
36244
|
} else {
|
|
@@ -36308,7 +36250,7 @@ func.events.validate = async function (
|
|
|
36308
36250
|
jobs.push(
|
|
36309
36251
|
await func.events.add_to_queue(
|
|
36310
36252
|
SESSION_ID,
|
|
36311
|
-
sourceP +
|
|
36253
|
+
sourceP + ' event',
|
|
36312
36254
|
trigger_obj.id,
|
|
36313
36255
|
null, // was click
|
|
36314
36256
|
trigger_obj.data.action,
|
|
@@ -36334,8 +36276,8 @@ func.events.validate = async function (
|
|
|
36334
36276
|
null,
|
|
36335
36277
|
args,
|
|
36336
36278
|
null,
|
|
36337
|
-
null
|
|
36338
|
-
)
|
|
36279
|
+
null,
|
|
36280
|
+
),
|
|
36339
36281
|
);
|
|
36340
36282
|
}
|
|
36341
36283
|
}
|
|
@@ -36347,15 +36289,7 @@ func.events.validate = async function (
|
|
|
36347
36289
|
}
|
|
36348
36290
|
} else {
|
|
36349
36291
|
if (val.data.condition && !expCond.result) {
|
|
36350
|
-
func.utils.debug.watch(
|
|
36351
|
-
SESSION_ID,
|
|
36352
|
-
_ds.prog_id + "%" + val.id,
|
|
36353
|
-
"view_event",
|
|
36354
|
-
val,
|
|
36355
|
-
triggerP + " " + eventIdP,
|
|
36356
|
-
expCond,
|
|
36357
|
-
true
|
|
36358
|
-
);
|
|
36292
|
+
func.utils.debug.watch(SESSION_ID, _ds.prog_id + '%' + val.id, 'view_event', val, triggerP + ' ' + eventIdP, expCond, true);
|
|
36359
36293
|
}
|
|
36360
36294
|
}
|
|
36361
36295
|
}
|
|
@@ -36378,7 +36312,7 @@ func.events.add_to_queue = async function (
|
|
|
36378
36312
|
containerP,
|
|
36379
36313
|
elementP,
|
|
36380
36314
|
rowP,
|
|
36381
|
-
|
|
36315
|
+
evt,
|
|
36382
36316
|
descP,
|
|
36383
36317
|
NA_rootScreenIdP,
|
|
36384
36318
|
NA_callingEventIdP,
|
|
@@ -36396,7 +36330,7 @@ func.events.add_to_queue = async function (
|
|
|
36396
36330
|
calling_job,
|
|
36397
36331
|
args,
|
|
36398
36332
|
$div,
|
|
36399
|
-
$container
|
|
36333
|
+
$container,
|
|
36400
36334
|
) {
|
|
36401
36335
|
var _session = SESSION_OBJ[SESSION_ID];
|
|
36402
36336
|
var obj = {
|
|
@@ -36421,11 +36355,11 @@ func.events.add_to_queue = async function (
|
|
|
36421
36355
|
args,
|
|
36422
36356
|
$div,
|
|
36423
36357
|
$container,
|
|
36424
|
-
|
|
36358
|
+
evt,
|
|
36425
36359
|
job_num: _session.WORKER_OBJ.num,
|
|
36426
36360
|
};
|
|
36427
36361
|
var _ds = _session.DS_GLB[dsSessionP];
|
|
36428
|
-
if (typeof dsSessionP !==
|
|
36362
|
+
if (typeof dsSessionP !== 'undefined' && dsSessionP !== null) {
|
|
36429
36363
|
obj.prog_id = _ds.prog_id;
|
|
36430
36364
|
obj.parentDataSourceNo = _ds.parentDataSourceNo;
|
|
36431
36365
|
obj.nodeId = _ds.nodeId;
|
|
@@ -36433,21 +36367,16 @@ func.events.add_to_queue = async function (
|
|
|
36433
36367
|
///////
|
|
36434
36368
|
if (glb.IS_WORKER && func.utils.is_onscreen_event(functionP)) {
|
|
36435
36369
|
obj.client = true;
|
|
36436
|
-
if (functionP ===
|
|
36370
|
+
if (functionP === 'call_library') {
|
|
36437
36371
|
obj.client = false;
|
|
36438
36372
|
}
|
|
36439
|
-
if (typeof dsSessionP !==
|
|
36373
|
+
if (typeof dsSessionP !== 'undefined' && dsSessionP !== null) {
|
|
36440
36374
|
obj.ds_obj = func.utils.clean_returned_datasource(SESSION_ID, dsSessionP);
|
|
36441
36375
|
}
|
|
36442
36376
|
if (obj.client) {
|
|
36443
36377
|
_session.WORKER_OBJ.num++;
|
|
36444
36378
|
// if (!_session.IS_API)
|
|
36445
|
-
func.utils.post_back_to_client(
|
|
36446
|
-
SESSION_ID,
|
|
36447
|
-
"job",
|
|
36448
|
-
_session.worker_id,
|
|
36449
|
-
obj
|
|
36450
|
-
);
|
|
36379
|
+
func.utils.post_back_to_client(SESSION_ID, 'job', _session.worker_id, obj);
|
|
36451
36380
|
return;
|
|
36452
36381
|
}
|
|
36453
36382
|
}
|
|
@@ -36461,14 +36390,10 @@ func.events.add_to_queue = async function (
|
|
|
36461
36390
|
_session.WORKER_OBJ.jobs[job_index].splice_count = 0;
|
|
36462
36391
|
}
|
|
36463
36392
|
_session.WORKER_OBJ.jobs[job_index].splice_count++;
|
|
36464
|
-
_session.WORKER_OBJ.jobs.splice(
|
|
36465
|
-
job_index + _session.WORKER_OBJ.jobs[job_index].splice_count,
|
|
36466
|
-
0,
|
|
36467
|
-
obj
|
|
36468
|
-
);
|
|
36393
|
+
_session.WORKER_OBJ.jobs.splice(job_index + _session.WORKER_OBJ.jobs[job_index].splice_count, 0, obj);
|
|
36469
36394
|
// }
|
|
36470
36395
|
} catch (e) {
|
|
36471
|
-
console.error(
|
|
36396
|
+
console.error('bug');
|
|
36472
36397
|
// _session.WORKER_OBJ.jobs.splice(0, 0, obj);
|
|
36473
36398
|
}
|
|
36474
36399
|
} else {
|
|
@@ -36500,7 +36425,7 @@ func.events.execute = async function (
|
|
|
36500
36425
|
containerP,
|
|
36501
36426
|
elementP,
|
|
36502
36427
|
rowP,
|
|
36503
|
-
|
|
36428
|
+
evt,
|
|
36504
36429
|
descP,
|
|
36505
36430
|
rootScreenIdP,
|
|
36506
36431
|
dsSessionP,
|
|
@@ -36518,14 +36443,14 @@ func.events.execute = async function (
|
|
|
36518
36443
|
NA_viewIdP,
|
|
36519
36444
|
NA_nodeIdP,
|
|
36520
36445
|
NA_parentDataSourceNoP,
|
|
36521
|
-
$div
|
|
36446
|
+
$div,
|
|
36522
36447
|
) {
|
|
36523
36448
|
var _session = SESSION_OBJ[SESSION_ID];
|
|
36524
36449
|
var _ds = _session.DS_GLB[dsSessionP];
|
|
36525
|
-
if (functionP ===
|
|
36450
|
+
if (functionP === 'update') refIdP = null; // in case of left over when program changing from call function to update
|
|
36526
36451
|
|
|
36527
36452
|
var job_index = func.events.find_job_index(SESSION_ID, jobNoP);
|
|
36528
|
-
if (_session.WORKER_OBJ.jobs?.[job_index]?.stat ===
|
|
36453
|
+
if (_session.WORKER_OBJ.jobs?.[job_index]?.stat === 'busy') {
|
|
36529
36454
|
if (jobNoP) _session.WORKER_OBJ.stat = job_index;
|
|
36530
36455
|
return;
|
|
36531
36456
|
}
|
|
@@ -36542,61 +36467,44 @@ func.events.execute = async function (
|
|
|
36542
36467
|
}
|
|
36543
36468
|
|
|
36544
36469
|
if (_session.WORKER_OBJ.jobs[job_index]) {
|
|
36545
|
-
_session.WORKER_OBJ.jobs[job_index].stat =
|
|
36470
|
+
_session.WORKER_OBJ.jobs[job_index].stat = 'busy';
|
|
36546
36471
|
}
|
|
36547
36472
|
|
|
36548
36473
|
var dsSession = dsSessionP; // new 2020420
|
|
36549
36474
|
var field_elm = elementP;
|
|
36550
36475
|
|
|
36551
36476
|
var calling_field_id = field_elm;
|
|
36552
|
-
if (field_elm && typeof field_elm ===
|
|
36553
|
-
calling_field_id = field_elm.attr("xu-ui-id");
|
|
36477
|
+
if (field_elm && typeof field_elm === 'object') calling_field_id = field_elm.attr('xu-ui-id');
|
|
36554
36478
|
|
|
36555
36479
|
var log_nodeId;
|
|
36556
36480
|
var log_prog_id;
|
|
36557
36481
|
var log_source;
|
|
36558
36482
|
|
|
36559
|
-
if (_session.DS_GLB[dsSession]?.prog_id)
|
|
36560
|
-
|
|
36561
|
-
log_nodeId = log_prog_id + "_" + eventIdP;
|
|
36483
|
+
if (_session.DS_GLB[dsSession]?.prog_id) log_prog_id = _session.DS_GLB[dsSession].prog_id;
|
|
36484
|
+
log_nodeId = log_prog_id + '_' + eventIdP;
|
|
36562
36485
|
var log_prop = callingSourceP;
|
|
36563
|
-
if (callingSourceP ===
|
|
36564
|
-
log_prop =
|
|
36486
|
+
if (callingSourceP === 'system event') {
|
|
36487
|
+
log_prop = 'global event';
|
|
36565
36488
|
}
|
|
36566
36489
|
if (calling_field_id) {
|
|
36567
36490
|
const _view_obj = await func.utils.VIEWS_OBJ.get(SESSION_ID, _ds.prog_id);
|
|
36568
|
-
let _field_obj = func.common.find_item_by_key(
|
|
36569
|
-
|
|
36570
|
-
"field_id",
|
|
36571
|
-
calling_field_id
|
|
36572
|
-
);
|
|
36573
|
-
log_nodeId = log_prog_id + "_" + eventIdP + "_" + _field_obj?.id;
|
|
36491
|
+
let _field_obj = func.common.find_item_by_key(_view_obj.progFields, 'field_id', calling_field_id);
|
|
36492
|
+
log_nodeId = log_prog_id + '_' + eventIdP + '_' + _field_obj?.id;
|
|
36574
36493
|
|
|
36575
36494
|
log_source = calling_field_id;
|
|
36576
36495
|
}
|
|
36577
36496
|
if (elementP) {
|
|
36578
36497
|
log_prop = triggerP;
|
|
36579
|
-
log_nodeId = log_nodeId +
|
|
36498
|
+
log_nodeId = log_nodeId + '_ui_prop'; //+"_"+eventIdP;
|
|
36580
36499
|
}
|
|
36581
36500
|
//check condition
|
|
36582
36501
|
var expCond;
|
|
36583
36502
|
if (event_propertiesP) {
|
|
36584
36503
|
// conditional event
|
|
36585
36504
|
if (event_propertiesP?.props?.condition) {
|
|
36586
|
-
expCond = await func.expression.get(
|
|
36587
|
-
SESSION_ID,
|
|
36588
|
-
event_propertiesP.props.condition,
|
|
36589
|
-
dsSession,
|
|
36590
|
-
"condition",
|
|
36591
|
-
null,
|
|
36592
|
-
null,
|
|
36593
|
-
null,
|
|
36594
|
-
calling_field_id ? calling_field_id : calling_triggerP,
|
|
36595
|
-
null,
|
|
36596
|
-
descP
|
|
36597
|
-
); // execute expression
|
|
36505
|
+
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
|
|
36598
36506
|
func.utils.debug.log(SESSION_ID, log_nodeId, {
|
|
36599
|
-
module:
|
|
36507
|
+
module: 'event',
|
|
36600
36508
|
action: log_prop,
|
|
36601
36509
|
source: log_source,
|
|
36602
36510
|
prop: descP,
|
|
@@ -36604,7 +36512,7 @@ func.events.execute = async function (
|
|
|
36604
36512
|
result: expCond.result,
|
|
36605
36513
|
error: expCond.error,
|
|
36606
36514
|
fields: expCond.fields,
|
|
36607
|
-
type:
|
|
36515
|
+
type: 'event',
|
|
36608
36516
|
prog_id: log_prog_id,
|
|
36609
36517
|
conditional: true,
|
|
36610
36518
|
});
|
|
@@ -36613,21 +36521,13 @@ func.events.execute = async function (
|
|
|
36613
36521
|
// condition failed // === true 03/04/16
|
|
36614
36522
|
func.events.delete_job(SESSION_ID, jobNoP);
|
|
36615
36523
|
|
|
36616
|
-
func.utils.debug.watch(
|
|
36617
|
-
SESSION_ID,
|
|
36618
|
-
calling_trigger_prop?.id,
|
|
36619
|
-
functionP,
|
|
36620
|
-
"",
|
|
36621
|
-
"",
|
|
36622
|
-
expCond,
|
|
36623
|
-
true
|
|
36624
|
-
);
|
|
36524
|
+
func.utils.debug.watch(SESSION_ID, calling_trigger_prop?.id, functionP, '', '', expCond, true);
|
|
36625
36525
|
return;
|
|
36626
36526
|
}
|
|
36627
36527
|
} // Non conditional event
|
|
36628
36528
|
else {
|
|
36629
36529
|
func.utils.debug.log(SESSION_ID, log_nodeId, {
|
|
36630
|
-
module:
|
|
36530
|
+
module: 'event',
|
|
36631
36531
|
action: log_prop,
|
|
36632
36532
|
source: log_source,
|
|
36633
36533
|
prop: descP,
|
|
@@ -36635,7 +36535,7 @@ func.events.execute = async function (
|
|
|
36635
36535
|
result: null,
|
|
36636
36536
|
error: null,
|
|
36637
36537
|
fields: null,
|
|
36638
|
-
type:
|
|
36538
|
+
type: 'event',
|
|
36639
36539
|
prog_id: log_prog_id,
|
|
36640
36540
|
});
|
|
36641
36541
|
}
|
|
@@ -36658,47 +36558,27 @@ func.events.execute = async function (
|
|
|
36658
36558
|
// };
|
|
36659
36559
|
|
|
36660
36560
|
const get_params_obj = async function () {
|
|
36661
|
-
const _prog = await func.utils.VIEWS_OBJ.get(
|
|
36662
|
-
SESSION_ID,
|
|
36663
|
-
await get_prog_id()
|
|
36664
|
-
);
|
|
36561
|
+
const _prog = await func.utils.VIEWS_OBJ.get(SESSION_ID, await get_prog_id());
|
|
36665
36562
|
if (!_prog) {
|
|
36666
36563
|
func.events.delete_job(SESSION_ID, jobNoP);
|
|
36667
|
-
return func.utils.debug_report(
|
|
36668
|
-
SESSION_ID,
|
|
36669
|
-
"func.events.execute",
|
|
36670
|
-
"Program not found: " + refIdP.prog,
|
|
36671
|
-
"E"
|
|
36672
|
-
);
|
|
36564
|
+
return func.utils.debug_report(SESSION_ID, 'func.events.execute', 'Program not found: ' + refIdP.prog, 'E');
|
|
36673
36565
|
}
|
|
36674
36566
|
|
|
36675
36567
|
// get in parameters
|
|
36676
36568
|
var params_obj = {};
|
|
36677
36569
|
if (_prog?.properties?.progParams) {
|
|
36678
|
-
for await (const [key, val] of Object.entries(
|
|
36679
|
-
|
|
36680
|
-
|
|
36681
|
-
if (!val.data.dir === "in") continue;
|
|
36682
|
-
if (
|
|
36683
|
-
typeof args.parameters_obj_inP?.[val.data.parameter] !== "undefined"
|
|
36684
|
-
) {
|
|
36570
|
+
for await (const [key, val] of Object.entries(_prog.properties.progParams)) {
|
|
36571
|
+
if (!val.data.dir === 'in') continue;
|
|
36572
|
+
if (typeof args.parameters_obj_inP?.[val.data.parameter] !== 'undefined') {
|
|
36685
36573
|
if (args.parameters_obj_inP?.[val.data.parameter].fx) {
|
|
36686
|
-
let ret = await func.expression.get(
|
|
36687
|
-
SESSION_ID,
|
|
36688
|
-
args.parameters_obj_inP?.[val.data.parameter].fx,
|
|
36689
|
-
dsSession,
|
|
36690
|
-
"parameters"
|
|
36691
|
-
);
|
|
36574
|
+
let ret = await func.expression.get(SESSION_ID, args.parameters_obj_inP?.[val.data.parameter].fx, dsSession, 'parameters');
|
|
36692
36575
|
params_obj[val.data.parameter] = ret.result;
|
|
36693
36576
|
} else {
|
|
36694
|
-
params_obj[val.data.parameter] =
|
|
36695
|
-
args.parameters_obj_inP?.[val.data.parameter].value;
|
|
36577
|
+
params_obj[val.data.parameter] = args.parameters_obj_inP?.[val.data.parameter].value;
|
|
36696
36578
|
}
|
|
36697
36579
|
continue;
|
|
36698
36580
|
}
|
|
36699
|
-
console.warn(
|
|
36700
|
-
`Warning: Program ${_prog.properties.menuName} expected In parameter: ${val.data.parameter} but received null instead`
|
|
36701
|
-
);
|
|
36581
|
+
console.warn(`Warning: Program ${_prog.properties.menuName} expected In parameter: ${val.data.parameter} but received null instead`);
|
|
36702
36582
|
}
|
|
36703
36583
|
}
|
|
36704
36584
|
return params_obj;
|
|
@@ -36707,15 +36587,8 @@ func.events.execute = async function (
|
|
|
36707
36587
|
const get_prog_id = async function () {
|
|
36708
36588
|
let _prop = args?.calling_trigger_prop?.data?.name?.properties;
|
|
36709
36589
|
let _prog_id = args.prog_id;
|
|
36710
|
-
if (_prop?.[
|
|
36711
|
-
_prog_id = (
|
|
36712
|
-
await func.expression.get(
|
|
36713
|
-
SESSION_ID,
|
|
36714
|
-
_prop["xu-exp:prog"],
|
|
36715
|
-
dsSession,
|
|
36716
|
-
"prog_id expression"
|
|
36717
|
-
)
|
|
36718
|
-
).result;
|
|
36590
|
+
if (_prop?.['xu-exp:prog']) {
|
|
36591
|
+
_prog_id = (await func.expression.get(SESSION_ID, _prop['xu-exp:prog'], dsSession, 'prog_id expression')).result;
|
|
36719
36592
|
}
|
|
36720
36593
|
|
|
36721
36594
|
return _prog_id;
|
|
@@ -36737,7 +36610,6 @@ func.events.execute = async function (
|
|
|
36737
36610
|
// return _value;
|
|
36738
36611
|
// };
|
|
36739
36612
|
|
|
36740
|
-
|
|
36741
36613
|
var args = {
|
|
36742
36614
|
prog_id: refIdP?.prog,
|
|
36743
36615
|
screenIdP: refIdP?.prog,
|
|
@@ -36765,40 +36637,20 @@ func.events.execute = async function (
|
|
|
36765
36637
|
var $calling_container;
|
|
36766
36638
|
if (_session.WORKER_OBJ.jobs[job_index]) {
|
|
36767
36639
|
if (_session.WORKER_OBJ.jobs[job_index].paramsP) {
|
|
36768
|
-
$calling_container = $(
|
|
36769
|
-
"#" + _session.WORKER_OBJ.jobs[job_index].paramsP.callingContainerP
|
|
36770
|
-
);
|
|
36640
|
+
$calling_container = $('#' + _session.WORKER_OBJ.jobs[job_index].paramsP.callingContainerP);
|
|
36771
36641
|
} else {
|
|
36772
|
-
$calling_container =
|
|
36642
|
+
$calling_container = ''; // calling from datasource 0
|
|
36773
36643
|
_session.WORKER_OBJ.jobs[job_index].paramsP = {};
|
|
36774
36644
|
}
|
|
36775
36645
|
}
|
|
36776
36646
|
|
|
36777
36647
|
if (!refIdP.prog) {
|
|
36778
36648
|
func.events.delete_job(SESSION_ID, jobNoP);
|
|
36779
|
-
return func.utils.debug_report(
|
|
36780
|
-
SESSION_ID,
|
|
36781
|
-
"func.events.execute",
|
|
36782
|
-
"Program is empty",
|
|
36783
|
-
"E"
|
|
36784
|
-
);
|
|
36649
|
+
return func.utils.debug_report(SESSION_ID, 'func.events.execute', 'Program is empty', 'E');
|
|
36785
36650
|
}
|
|
36786
36651
|
|
|
36787
36652
|
const params_obj = await get_params_obj();
|
|
36788
|
-
return await func.UI.screen.init(
|
|
36789
|
-
SESSION_ID,
|
|
36790
|
-
await get_prog_id(),
|
|
36791
|
-
$(containerP)?.data()?.xuData.screenId,
|
|
36792
|
-
_session.DS_GLB[dsSession],
|
|
36793
|
-
$calling_container,
|
|
36794
|
-
eventIdP,
|
|
36795
|
-
rowP,
|
|
36796
|
-
jobNoP,
|
|
36797
|
-
is_panel,
|
|
36798
|
-
params_obj,
|
|
36799
|
-
functionP,
|
|
36800
|
-
args.call_screen_propertiesP
|
|
36801
|
-
);
|
|
36653
|
+
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);
|
|
36802
36654
|
},
|
|
36803
36655
|
call_modal: async function () {
|
|
36804
36656
|
return await fx.Call_window();
|
|
@@ -36821,101 +36673,66 @@ func.events.execute = async function (
|
|
|
36821
36673
|
|
|
36822
36674
|
const set_SYS_GLOBAL_OBJ_WIDGET_INFO = async function (docP) {
|
|
36823
36675
|
var obj = _.clone(docP);
|
|
36824
|
-
obj.date = await func.utils.get_dateTime(
|
|
36825
|
-
|
|
36826
|
-
"SYS_DATE",
|
|
36827
|
-
docP.date
|
|
36828
|
-
);
|
|
36829
|
-
obj.time = await func.utils.get_dateTime(
|
|
36830
|
-
SESSION_ID,
|
|
36831
|
-
"SYS_TIME",
|
|
36832
|
-
docP.date
|
|
36833
|
-
);
|
|
36676
|
+
obj.date = await func.utils.get_dateTime(SESSION_ID, 'SYS_DATE', docP.date);
|
|
36677
|
+
obj.time = await func.utils.get_dateTime(SESSION_ID, 'SYS_TIME', docP.date);
|
|
36834
36678
|
|
|
36835
36679
|
var datasource_changes = {
|
|
36836
36680
|
[0]: {
|
|
36837
|
-
[
|
|
36838
|
-
[
|
|
36681
|
+
['data_system']: {
|
|
36682
|
+
['SYS_GLOBAL_OBJ_WIDGET_INFO']: obj,
|
|
36839
36683
|
},
|
|
36840
36684
|
},
|
|
36841
36685
|
};
|
|
36842
36686
|
await func.datasource.update(SESSION_ID, datasource_changes);
|
|
36843
36687
|
};
|
|
36844
36688
|
const call_plugin_api = async function (plugin_nameP, dataP) {
|
|
36845
|
-
return await func.utils.call_plugin_api(
|
|
36846
|
-
SESSION_ID,
|
|
36847
|
-
plugin_nameP,
|
|
36848
|
-
dataP
|
|
36849
|
-
);
|
|
36689
|
+
return await func.utils.call_plugin_api(SESSION_ID, plugin_nameP, dataP);
|
|
36850
36690
|
};
|
|
36851
36691
|
const report_error = function (descP, warn) {
|
|
36852
|
-
func.utils.debug.log(
|
|
36853
|
-
|
|
36854
|
-
|
|
36855
|
-
|
|
36856
|
-
|
|
36857
|
-
|
|
36858
|
-
|
|
36859
|
-
|
|
36692
|
+
func.utils.debug.log(SESSION_ID, _session.DS_GLB[dsP].prog_id + '_' + _session.DS_GLB[dsP].callingMenuId, {
|
|
36693
|
+
module: 'widgets',
|
|
36694
|
+
action: 'Init',
|
|
36695
|
+
source: sourceP,
|
|
36696
|
+
prop: descP,
|
|
36697
|
+
details: descP,
|
|
36698
|
+
result: null,
|
|
36699
|
+
error: warn ? false : true,
|
|
36700
|
+
fields: null,
|
|
36701
|
+
type: 'widgets',
|
|
36702
|
+
prog_id: _session.DS_GLB[dsP].prog_id,
|
|
36703
|
+
});
|
|
36704
|
+
};
|
|
36705
|
+
const get_fields_data = async function (fields, props) {
|
|
36706
|
+
const report_error = function (descP, warn) {
|
|
36707
|
+
func.utils.debug.log(SESSION_ID, _session.DS_GLB[dsP].prog_id + '_' + _session.DS_GLB[dsP].callingMenuId, {
|
|
36708
|
+
module: 'widgets',
|
|
36709
|
+
action: 'Init',
|
|
36860
36710
|
source: sourceP,
|
|
36861
36711
|
prop: descP,
|
|
36862
36712
|
details: descP,
|
|
36863
36713
|
result: null,
|
|
36864
36714
|
error: warn ? false : true,
|
|
36865
36715
|
fields: null,
|
|
36866
|
-
type:
|
|
36716
|
+
type: 'widgets',
|
|
36867
36717
|
prog_id: _session.DS_GLB[dsP].prog_id,
|
|
36868
|
-
}
|
|
36869
|
-
);
|
|
36870
|
-
};
|
|
36871
|
-
const get_fields_data = async function (fields, props) {
|
|
36872
|
-
const report_error = function (descP, warn) {
|
|
36873
|
-
func.utils.debug.log(
|
|
36874
|
-
SESSION_ID,
|
|
36875
|
-
_session.DS_GLB[dsP].prog_id +
|
|
36876
|
-
"_" +
|
|
36877
|
-
_session.DS_GLB[dsP].callingMenuId,
|
|
36878
|
-
{
|
|
36879
|
-
module: "widgets",
|
|
36880
|
-
action: "Init",
|
|
36881
|
-
source: sourceP,
|
|
36882
|
-
prop: descP,
|
|
36883
|
-
details: descP,
|
|
36884
|
-
result: null,
|
|
36885
|
-
error: warn ? false : true,
|
|
36886
|
-
fields: null,
|
|
36887
|
-
type: "widgets",
|
|
36888
|
-
prog_id: _session.DS_GLB[dsP].prog_id,
|
|
36889
|
-
}
|
|
36890
|
-
);
|
|
36718
|
+
});
|
|
36891
36719
|
};
|
|
36892
36720
|
const get_property_value = async function (fieldIdP, val) {
|
|
36893
36721
|
// var value = props[fieldIdP];
|
|
36894
36722
|
|
|
36895
|
-
var value =
|
|
36896
|
-
props[fieldIdP] ||
|
|
36897
|
-
(typeof val.defaultValue === "function"
|
|
36898
|
-
? val?.defaultValue?.()
|
|
36899
|
-
: val?.defaultValue);
|
|
36723
|
+
var value = props[fieldIdP] || (typeof val.defaultValue === 'function' ? val?.defaultValue?.() : val?.defaultValue);
|
|
36900
36724
|
|
|
36901
36725
|
if (props[`xu-exp:${fieldIdP}`]) {
|
|
36902
|
-
value = (
|
|
36903
|
-
await func.expression.get(
|
|
36904
|
-
SESSION_ID,
|
|
36905
|
-
props[`xu-exp:${fieldIdP}`],
|
|
36906
|
-
dsP,
|
|
36907
|
-
"widget property"
|
|
36908
|
-
)
|
|
36909
|
-
).result;
|
|
36726
|
+
value = (await func.expression.get(SESSION_ID, props[`xu-exp:${fieldIdP}`], dsP, 'widget property')).result;
|
|
36910
36727
|
}
|
|
36911
36728
|
|
|
36912
36729
|
return func.common.get_cast_val(
|
|
36913
36730
|
SESSION_ID,
|
|
36914
|
-
|
|
36731
|
+
'widgets',
|
|
36915
36732
|
fieldIdP,
|
|
36916
36733
|
val.type, //val.type !== "string" || val.type !== "number" ? "string" : val.type,
|
|
36917
36734
|
value,
|
|
36918
|
-
null
|
|
36735
|
+
null,
|
|
36919
36736
|
);
|
|
36920
36737
|
};
|
|
36921
36738
|
var data_obj = {};
|
|
@@ -36938,51 +36755,36 @@ func.events.execute = async function (
|
|
|
36938
36755
|
};
|
|
36939
36756
|
|
|
36940
36757
|
try {
|
|
36941
|
-
const _plugin =
|
|
36942
|
-
APP_OBJ[_session.app_id]?.app_plugins_purchased?.[plugin_name];
|
|
36758
|
+
const _plugin = APP_OBJ[_session.app_id]?.app_plugins_purchased?.[plugin_name];
|
|
36943
36759
|
|
|
36944
|
-
const index = await func.utils.get_plugin_resource(
|
|
36945
|
-
SESSION_ID,
|
|
36946
|
-
plugin_name,
|
|
36947
|
-
`${_plugin.manifest["index.mjs"].dist ? "dist/" : ""}index.mjs`
|
|
36948
|
-
);
|
|
36760
|
+
const index = await func.utils.get_plugin_resource(SESSION_ID, plugin_name, `${_plugin.manifest['index.mjs'].dist ? 'dist/' : ''}index.mjs`);
|
|
36949
36761
|
|
|
36950
36762
|
const methods = index.methods;
|
|
36951
36763
|
if (methods && !methods[method]) {
|
|
36952
|
-
return report_error(
|
|
36764
|
+
return report_error('method not found');
|
|
36953
36765
|
}
|
|
36954
36766
|
|
|
36955
|
-
const fields_ret = await get_fields_data(
|
|
36956
|
-
methods[method].fields,
|
|
36957
|
-
propsP
|
|
36958
|
-
);
|
|
36767
|
+
const fields_ret = await get_fields_data(methods[method].fields, propsP);
|
|
36959
36768
|
|
|
36960
36769
|
if (fields_ret.code < 0) {
|
|
36961
36770
|
return report_error(fields_ret.data);
|
|
36962
36771
|
}
|
|
36963
36772
|
const fields = fields_ret.data;
|
|
36964
36773
|
|
|
36965
|
-
const plugin_setup_ret = await func.utils.get_plugin_setup(
|
|
36966
|
-
SESSION_ID,
|
|
36967
|
-
plugin_name
|
|
36968
|
-
);
|
|
36774
|
+
const plugin_setup_ret = await func.utils.get_plugin_setup(SESSION_ID, plugin_name);
|
|
36969
36775
|
if (plugin_setup_ret.code < 0) {
|
|
36970
36776
|
return report_error(plugin_setup_ret);
|
|
36971
36777
|
}
|
|
36972
36778
|
|
|
36973
|
-
const api_utils = await func.common.get_module(
|
|
36779
|
+
const api_utils = await func.common.get_module(SESSION_ID, 'xuda-api-library.mjs', {
|
|
36780
|
+
func,
|
|
36781
|
+
glb,
|
|
36782
|
+
SESSION_OBJ,
|
|
36974
36783
|
SESSION_ID,
|
|
36975
|
-
|
|
36976
|
-
|
|
36977
|
-
|
|
36978
|
-
|
|
36979
|
-
SESSION_OBJ,
|
|
36980
|
-
SESSION_ID,
|
|
36981
|
-
APP_OBJ,
|
|
36982
|
-
dsSession: dsP,
|
|
36983
|
-
job_id: jobNoP,
|
|
36984
|
-
}
|
|
36985
|
-
);
|
|
36784
|
+
APP_OBJ,
|
|
36785
|
+
dsSession: dsP,
|
|
36786
|
+
job_id: jobNoP,
|
|
36787
|
+
});
|
|
36986
36788
|
|
|
36987
36789
|
const params = {
|
|
36988
36790
|
SESSION_ID,
|
|
@@ -37001,11 +36803,7 @@ func.events.execute = async function (
|
|
|
37001
36803
|
api_utils,
|
|
37002
36804
|
};
|
|
37003
36805
|
|
|
37004
|
-
const fx = await func.utils.get_plugin_resource(
|
|
37005
|
-
SESSION_ID,
|
|
37006
|
-
plugin_name,
|
|
37007
|
-
`${_plugin.manifest["runtime.mjs"].dist ? "dist/" : ""}runtime.mjs`
|
|
37008
|
-
);
|
|
36806
|
+
const fx = await func.utils.get_plugin_resource(SESSION_ID, plugin_name, `${_plugin.manifest['runtime.mjs'].dist ? 'dist/' : ''}runtime.mjs`);
|
|
37009
36807
|
|
|
37010
36808
|
if (!fx[method]) {
|
|
37011
36809
|
throw `Method: ${method} does not exist`;
|
|
@@ -37019,41 +36817,21 @@ func.events.execute = async function (
|
|
|
37019
36817
|
},
|
|
37020
36818
|
|
|
37021
36819
|
call_native_javascript: async function () {
|
|
37022
|
-
const module = await func.common.get_module(
|
|
37023
|
-
|
|
37024
|
-
"xuda-event-javascript-module.mjs"
|
|
37025
|
-
);
|
|
37026
|
-
const result = await module.call_javascript(
|
|
37027
|
-
SESSION_ID,
|
|
37028
|
-
jobNoP,
|
|
37029
|
-
refIdP,
|
|
37030
|
-
dsSession
|
|
37031
|
-
);
|
|
36820
|
+
const module = await func.common.get_module(SESSION_ID, 'xuda-event-javascript-module.mjs');
|
|
36821
|
+
const result = await module.call_javascript(SESSION_ID, jobNoP, refIdP, dsSession);
|
|
37032
36822
|
await func.datasource.set_outputField(SESSION_ID, dsSessionP, result, args);
|
|
37033
36823
|
|
|
37034
|
-
return result
|
|
36824
|
+
return result;
|
|
37035
36825
|
},
|
|
37036
36826
|
call_evaluate_javascript: async function () {
|
|
37037
|
-
const module = await func.common.get_module(
|
|
37038
|
-
|
|
37039
|
-
"xuda-event-javascript-module.mjs"
|
|
37040
|
-
);
|
|
37041
|
-
const result = await module.call_javascript(
|
|
37042
|
-
SESSION_ID,
|
|
37043
|
-
jobNoP,
|
|
37044
|
-
refIdP,
|
|
37045
|
-
dsSession,
|
|
37046
|
-
true
|
|
37047
|
-
);
|
|
36827
|
+
const module = await func.common.get_module(SESSION_ID, 'xuda-event-javascript-module.mjs');
|
|
36828
|
+
const result = await module.call_javascript(SESSION_ID, jobNoP, refIdP, dsSession, true);
|
|
37048
36829
|
await func.datasource.set_outputField(SESSION_ID, dsSessionP, result, args);
|
|
37049
36830
|
|
|
37050
|
-
return result
|
|
36831
|
+
return result;
|
|
37051
36832
|
},
|
|
37052
36833
|
execute_native_javascript: async function () {
|
|
37053
|
-
const module = await func.common.get_module(
|
|
37054
|
-
SESSION_ID,
|
|
37055
|
-
"xuda-event-javascript-module.mjs"
|
|
37056
|
-
);
|
|
36834
|
+
const module = await func.common.get_module(SESSION_ID, 'xuda-event-javascript-module.mjs');
|
|
37057
36835
|
|
|
37058
36836
|
const result = await module.run_javascript(
|
|
37059
36837
|
SESSION_ID,
|
|
@@ -37061,17 +36839,14 @@ func.events.execute = async function (
|
|
|
37061
36839
|
dsSession,
|
|
37062
36840
|
`(async function(el) {
|
|
37063
36841
|
${refIdP.value}
|
|
37064
|
-
})(document.querySelector(\`[xu-ui-id=${elementP}]\`))
|
|
36842
|
+
})(document.querySelector(\`[xu-ui-id=${elementP}]\`))`,
|
|
37065
36843
|
);
|
|
37066
36844
|
await func.datasource.set_outputField(SESSION_ID, dsSessionP, result, args);
|
|
37067
36845
|
|
|
37068
|
-
return result
|
|
36846
|
+
return result;
|
|
37069
36847
|
},
|
|
37070
36848
|
execute_evaluate_javascript: async function () {
|
|
37071
|
-
const module = await func.common.get_module(
|
|
37072
|
-
SESSION_ID,
|
|
37073
|
-
"xuda-event-javascript-module.mjs"
|
|
37074
|
-
);
|
|
36849
|
+
const module = await func.common.get_module(SESSION_ID, 'xuda-event-javascript-module.mjs');
|
|
37075
36850
|
|
|
37076
36851
|
const result = await module.run_javascript(
|
|
37077
36852
|
SESSION_ID,
|
|
@@ -37080,11 +36855,11 @@ func.events.execute = async function (
|
|
|
37080
36855
|
`(async function(el) {
|
|
37081
36856
|
${refIdP.value}
|
|
37082
36857
|
})(document.querySelector(\`[xu-ui-id=${elementP}]\`))`,
|
|
37083
|
-
true
|
|
36858
|
+
true,
|
|
37084
36859
|
);
|
|
37085
36860
|
await func.datasource.set_outputField(SESSION_ID, dsSessionP, result, args);
|
|
37086
36861
|
|
|
37087
|
-
return result
|
|
36862
|
+
return result;
|
|
37088
36863
|
},
|
|
37089
36864
|
loader_on: async function () {
|
|
37090
36865
|
glb.CURRENT_APP_LOADING = null;
|
|
@@ -37105,131 +36880,59 @@ func.events.execute = async function (
|
|
|
37105
36880
|
// if (descP.value) {
|
|
37106
36881
|
$(document).trigger(refIdP.value, [_session.DS_GLB[dsSession]]);
|
|
37107
36882
|
} else {
|
|
37108
|
-
func.utils.debug_report(
|
|
37109
|
-
SESSION_ID,
|
|
37110
|
-
"func.events.execute",
|
|
37111
|
-
"Event name missing",
|
|
37112
|
-
"E"
|
|
37113
|
-
);
|
|
36883
|
+
func.utils.debug_report(SESSION_ID, 'func.events.execute', 'Event name missing', 'E');
|
|
37114
36884
|
}
|
|
37115
36885
|
func.events.delete_job(SESSION_ID, jobNoP);
|
|
37116
36886
|
// if (callbackP) callbackP();
|
|
37117
36887
|
},
|
|
37118
36888
|
|
|
37119
36889
|
invoke_action: async function () {
|
|
37120
|
-
func.utils.debug.watch(
|
|
37121
|
-
SESSION_ID,
|
|
37122
|
-
calling_trigger_prop?.id,
|
|
37123
|
-
functionP,
|
|
37124
|
-
null,
|
|
37125
|
-
null,
|
|
37126
|
-
expCond
|
|
37127
|
-
);
|
|
36890
|
+
func.utils.debug.watch(SESSION_ID, calling_trigger_prop?.id, functionP, null, null, expCond);
|
|
37128
36891
|
|
|
37129
|
-
await func.action.execute(
|
|
37130
|
-
SESSION_ID,
|
|
37131
|
-
refIdP.value,
|
|
37132
|
-
_ds,
|
|
37133
|
-
null,
|
|
37134
|
-
null,
|
|
37135
|
-
jobNoP,
|
|
37136
|
-
containerP
|
|
37137
|
-
);
|
|
36892
|
+
await func.action.execute(SESSION_ID, refIdP.value, _ds, null, null, jobNoP, containerP);
|
|
37138
36893
|
},
|
|
37139
36894
|
raise_event: async function () {
|
|
37140
36895
|
var _ds = _session.DS_GLB[dsSession];
|
|
37141
36896
|
const _view_obj = await func.utils.VIEWS_OBJ.get(SESSION_ID, _ds.prog_id);
|
|
37142
|
-
if (callingSourceP ===
|
|
37143
|
-
let _field_obj = func.common.find_item_by_key(
|
|
37144
|
-
_view_obj.progFields,
|
|
37145
|
-
"field_id",
|
|
37146
|
-
field_elm
|
|
37147
|
-
);
|
|
36897
|
+
if (callingSourceP === 'grid' || callingSourceP === 'form') {
|
|
36898
|
+
let _field_obj = func.common.find_item_by_key(_view_obj.progFields, 'field_id', field_elm);
|
|
37148
36899
|
var event_name = _field_obj?.triggers?.[eventIdP].name.event;
|
|
37149
36900
|
|
|
37150
|
-
if (_field_obj?.triggers?.[eventIdP].name?.properties[
|
|
37151
|
-
event_name = (
|
|
37152
|
-
await func.expression.get(
|
|
37153
|
-
SESSION_ID,
|
|
37154
|
-
props[`xu-exp:event`],
|
|
37155
|
-
dsSession,
|
|
37156
|
-
"event_name expression"
|
|
37157
|
-
)
|
|
37158
|
-
).result;
|
|
36901
|
+
if (_field_obj?.triggers?.[eventIdP].name?.properties['xu-exp:event']) {
|
|
36902
|
+
event_name = (await func.expression.get(SESSION_ID, props[`xu-exp:event`], dsSession, 'event_name expression')).result;
|
|
37159
36903
|
}
|
|
37160
36904
|
|
|
37161
36905
|
if (field_elm && event_name) {
|
|
37162
36906
|
// get container for fields events
|
|
37163
|
-
const dsP = await func.datasource.find_event_dataSource(
|
|
37164
|
-
SESSION_ID,
|
|
37165
|
-
event_name,
|
|
37166
|
-
dsSession
|
|
37167
|
-
);
|
|
36907
|
+
const dsP = await func.datasource.find_event_dataSource(SESSION_ID, event_name, dsSession);
|
|
37168
36908
|
|
|
37169
|
-
return await func.datasource.run_events_functions(
|
|
37170
|
-
SESSION_ID,
|
|
37171
|
-
dsP,
|
|
37172
|
-
event_name,
|
|
37173
|
-
jobNoP,
|
|
37174
|
-
null,
|
|
37175
|
-
calling_trigger_prop?.data?.name?.parameters || {}
|
|
37176
|
-
);
|
|
36909
|
+
return await func.datasource.run_events_functions(SESSION_ID, dsP, event_name, jobNoP, null, calling_trigger_prop?.data?.name?.parameters || {});
|
|
37177
36910
|
}
|
|
37178
36911
|
// done_execution(event_name);
|
|
37179
36912
|
}
|
|
37180
|
-
if (callingSourceP.includes(
|
|
36913
|
+
if (callingSourceP.includes('event')) {
|
|
37181
36914
|
let event_name = refIdP.event;
|
|
37182
36915
|
|
|
37183
|
-
if (refIdP?.properties?.[
|
|
37184
|
-
event_name = (
|
|
37185
|
-
await func.expression.get(
|
|
37186
|
-
SESSION_ID,
|
|
37187
|
-
refIdP.properties["xu-exp:event"],
|
|
37188
|
-
dsSession,
|
|
37189
|
-
"event_name expression"
|
|
37190
|
-
)
|
|
37191
|
-
).result;
|
|
36916
|
+
if (refIdP?.properties?.['xu-exp:event']) {
|
|
36917
|
+
event_name = (await func.expression.get(SESSION_ID, refIdP.properties['xu-exp:event'], dsSession, 'event_name expression')).result;
|
|
37192
36918
|
}
|
|
37193
36919
|
|
|
37194
|
-
const dsP = await func.datasource.find_event_dataSource(
|
|
37195
|
-
SESSION_ID,
|
|
37196
|
-
event_name,
|
|
37197
|
-
dsSession
|
|
37198
|
-
);
|
|
36920
|
+
const dsP = await func.datasource.find_event_dataSource(SESSION_ID, event_name, dsSession);
|
|
37199
36921
|
|
|
37200
|
-
await func.datasource.run_events_functions(
|
|
37201
|
-
SESSION_ID,
|
|
37202
|
-
dsP,
|
|
37203
|
-
event_name,
|
|
37204
|
-
jobNoP,
|
|
37205
|
-
calling_trigger_prop?.props?.async,
|
|
37206
|
-
calling_trigger_prop?.data?.name?.parameters || {}
|
|
37207
|
-
);
|
|
36922
|
+
await func.datasource.run_events_functions(SESSION_ID, dsP, event_name, jobNoP, calling_trigger_prop?.props?.async, calling_trigger_prop?.data?.name?.parameters || {});
|
|
37208
36923
|
// done_execution(event_name);
|
|
37209
36924
|
}
|
|
37210
36925
|
|
|
37211
36926
|
func.events.delete_job(SESSION_ID, jobNoP);
|
|
37212
36927
|
// if (callbackP) callbackP();
|
|
37213
36928
|
|
|
37214
|
-
func.utils.debug.watch(
|
|
37215
|
-
SESSION_ID,
|
|
37216
|
-
calling_trigger_prop?.id,
|
|
37217
|
-
functionP,
|
|
37218
|
-
"",
|
|
37219
|
-
"",
|
|
37220
|
-
expCond
|
|
37221
|
-
);
|
|
36929
|
+
func.utils.debug.watch(SESSION_ID, calling_trigger_prop?.id, functionP, '', '', expCond);
|
|
37222
36930
|
},
|
|
37223
36931
|
get_data: async function () {
|
|
37224
36932
|
const params_obj = await get_params_obj();
|
|
37225
36933
|
|
|
37226
36934
|
if (!(await get_prog_id())) {
|
|
37227
|
-
func.utils.debug_report(
|
|
37228
|
-
SESSION_ID,
|
|
37229
|
-
"func.events.execute",
|
|
37230
|
-
`${elementP} > ${triggerP} > ${functionP} > program ${prog} is missing`,
|
|
37231
|
-
"E"
|
|
37232
|
-
);
|
|
36935
|
+
func.utils.debug_report(SESSION_ID, 'func.events.execute', `${elementP} > ${triggerP} > ${functionP} > program ${prog} is missing`, 'E');
|
|
37233
36936
|
func.events.delete_job(SESSION_ID, jobNoP);
|
|
37234
36937
|
return;
|
|
37235
36938
|
}
|
|
@@ -37242,41 +36945,14 @@ func.events.execute = async function (
|
|
|
37242
36945
|
|
|
37243
36946
|
// args.prog_id = _viewId;
|
|
37244
36947
|
if (_ds) {
|
|
37245
|
-
func.utils.debug.watch(
|
|
37246
|
-
SESSION_ID,
|
|
37247
|
-
calling_trigger_prop?.id,
|
|
37248
|
-
functionP,
|
|
37249
|
-
null,
|
|
37250
|
-
calling_trigger_prop,
|
|
37251
|
-
expCond
|
|
37252
|
-
);
|
|
36948
|
+
func.utils.debug.watch(SESSION_ID, calling_trigger_prop?.id, functionP, null, calling_trigger_prop, expCond);
|
|
37253
36949
|
// }
|
|
37254
|
-
const ret = await func.datasource.create(
|
|
37255
|
-
SESSION_ID,
|
|
37256
|
-
await get_prog_id(),
|
|
37257
|
-
args.dataSourceNoP,
|
|
37258
|
-
args.parentDataSourceNoP,
|
|
37259
|
-
args.containerIdP,
|
|
37260
|
-
args.rowIdP,
|
|
37261
|
-
args.jobNoP,
|
|
37262
|
-
args.calling_trigger_prop,
|
|
37263
|
-
null,
|
|
37264
|
-
null,
|
|
37265
|
-
args.callingSourceP,
|
|
37266
|
-
args.calling_jobP,
|
|
37267
|
-
args.screen_dsP,
|
|
37268
|
-
args.is_panelP,
|
|
37269
|
-
params_obj
|
|
37270
|
-
);
|
|
36950
|
+
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);
|
|
37271
36951
|
|
|
37272
36952
|
let _ds_new = _session.DS_GLB[ret.dsSessionP];
|
|
37273
36953
|
let parameters = args?.calling_trigger_prop?.data?.name?.parameters;
|
|
37274
36954
|
if (parameters && !_.isEmpty(parameters)) {
|
|
37275
|
-
await func.datasource.update_changes_for_out_parameter(
|
|
37276
|
-
SESSION_ID,
|
|
37277
|
-
_ds_new.dsSession,
|
|
37278
|
-
_ds.dsSession
|
|
37279
|
-
);
|
|
36955
|
+
await func.datasource.update_changes_for_out_parameter(SESSION_ID, _ds_new.dsSession, _ds.dsSession);
|
|
37280
36956
|
}
|
|
37281
36957
|
// if (parameters && !_.isEmpty(parameters) && _ds_new.PARAM_OUT_INFO) {
|
|
37282
36958
|
// let data = {};
|
|
@@ -37305,7 +36981,7 @@ func.events.execute = async function (
|
|
|
37305
36981
|
// }
|
|
37306
36982
|
|
|
37307
36983
|
func.events.delete_job(SESSION_ID, jobNoP);
|
|
37308
|
-
return _ds_new
|
|
36984
|
+
return _ds_new;
|
|
37309
36985
|
}
|
|
37310
36986
|
},
|
|
37311
36987
|
set_data: async function () {
|
|
@@ -37315,24 +36991,12 @@ func.events.execute = async function (
|
|
|
37315
36991
|
const result = await this.get_data();
|
|
37316
36992
|
|
|
37317
36993
|
// await set_outputField(SESSION_ID, elementP, triggerP, functionP, dsSessionP, result);
|
|
37318
|
-
return result
|
|
37319
|
-
|
|
36994
|
+
return result;
|
|
37320
36995
|
},
|
|
37321
36996
|
update: async function () {
|
|
37322
|
-
const obj_values_to_update =
|
|
37323
|
-
func.datasource.get_viewFields_for_update_function(
|
|
37324
|
-
SESSION_ID,
|
|
37325
|
-
calling_trigger_prop,
|
|
37326
|
-
null,
|
|
37327
|
-
dsSessionP
|
|
37328
|
-
);
|
|
36997
|
+
const obj_values_to_update = func.datasource.get_viewFields_for_update_function(SESSION_ID, calling_trigger_prop, null, dsSessionP);
|
|
37329
36998
|
if (!obj_values_to_update || _.isEmpty(obj_values_to_update)) {
|
|
37330
|
-
func.utils.debug_report(
|
|
37331
|
-
SESSION_ID,
|
|
37332
|
-
"Update values object is empty",
|
|
37333
|
-
"",
|
|
37334
|
-
"W"
|
|
37335
|
-
);
|
|
36999
|
+
func.utils.debug_report(SESSION_ID, 'Update values object is empty', '', 'W');
|
|
37336
37000
|
if (jobNoP) func.events.delete_job(SESSION_ID, jobNoP);
|
|
37337
37001
|
return;
|
|
37338
37002
|
}
|
|
@@ -37345,32 +37009,8 @@ func.events.execute = async function (
|
|
|
37345
37009
|
$element = $(`[xu-ui-id="${elementP}"]`).clone(true);
|
|
37346
37010
|
}
|
|
37347
37011
|
|
|
37348
|
-
let ret_field_id = await func.expression.get(
|
|
37349
|
-
|
|
37350
|
-
val.id.trim(),
|
|
37351
|
-
dsSessionP,
|
|
37352
|
-
"update",
|
|
37353
|
-
null,
|
|
37354
|
-
null,
|
|
37355
|
-
null,
|
|
37356
|
-
null,
|
|
37357
|
-
null,
|
|
37358
|
-
null,
|
|
37359
|
-
$element?.length ? $element?.data()?.xuData?.iterate_info : null
|
|
37360
|
-
);
|
|
37361
|
-
let ret_value = await func.expression.get(
|
|
37362
|
-
SESSION_ID,
|
|
37363
|
-
val.val.trim(),
|
|
37364
|
-
dsSessionP,
|
|
37365
|
-
"update",
|
|
37366
|
-
null,
|
|
37367
|
-
null,
|
|
37368
|
-
null,
|
|
37369
|
-
null,
|
|
37370
|
-
null,
|
|
37371
|
-
null,
|
|
37372
|
-
$element?.length ? $element?.data()?.xuData?.iterate_info : null
|
|
37373
|
-
);
|
|
37012
|
+
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);
|
|
37013
|
+
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);
|
|
37374
37014
|
let _field_id = ret_field_id.result;
|
|
37375
37015
|
let _value = ret_value.result;
|
|
37376
37016
|
|
|
@@ -37379,25 +37019,16 @@ func.events.execute = async function (
|
|
|
37379
37019
|
|
|
37380
37020
|
let datasource_changes = {};
|
|
37381
37021
|
for await (const change of updates) {
|
|
37382
|
-
let ret_get_value = await func.datasource.get_value(
|
|
37383
|
-
SESSION_ID,
|
|
37384
|
-
change._field_id,
|
|
37385
|
-
dsSessionP
|
|
37386
|
-
);
|
|
37022
|
+
let ret_get_value = await func.datasource.get_value(SESSION_ID, change._field_id, dsSessionP);
|
|
37387
37023
|
if (ret_get_value.found) {
|
|
37388
37024
|
let _ds = _session.DS_GLB[ret_get_value.dsSessionP];
|
|
37389
37025
|
if (!datasource_changes[_ds.dsSession]) {
|
|
37390
37026
|
datasource_changes[_ds.dsSession] = {};
|
|
37391
37027
|
}
|
|
37392
|
-
if (
|
|
37393
|
-
|
|
37394
|
-
) {
|
|
37395
|
-
datasource_changes[_ds.dsSession][ret_get_value.currentRecordId] =
|
|
37396
|
-
{};
|
|
37028
|
+
if (!datasource_changes[_ds.dsSession][ret_get_value.currentRecordId]) {
|
|
37029
|
+
datasource_changes[_ds.dsSession][ret_get_value.currentRecordId] = {};
|
|
37397
37030
|
}
|
|
37398
|
-
datasource_changes[_ds.dsSession][ret_get_value.currentRecordId][
|
|
37399
|
-
change._field_id
|
|
37400
|
-
] = change._value;
|
|
37031
|
+
datasource_changes[_ds.dsSession][ret_get_value.currentRecordId][change._field_id] = change._value;
|
|
37401
37032
|
}
|
|
37402
37033
|
}
|
|
37403
37034
|
|
|
@@ -37406,23 +37037,11 @@ func.events.execute = async function (
|
|
|
37406
37037
|
// return changes;
|
|
37407
37038
|
},
|
|
37408
37039
|
call_alert: async function () {
|
|
37409
|
-
await func.utils.alerts.invoke(
|
|
37410
|
-
SESSION_ID,
|
|
37411
|
-
"call_alert",
|
|
37412
|
-
refIdP,
|
|
37413
|
-
log_source,
|
|
37414
|
-
dsSession
|
|
37415
|
-
);
|
|
37040
|
+
await func.utils.alerts.invoke(SESSION_ID, 'call_alert', refIdP, log_source, dsSession);
|
|
37416
37041
|
func.events.delete_job(SESSION_ID, jobNoP);
|
|
37417
37042
|
},
|
|
37418
37043
|
alert: async function () {
|
|
37419
|
-
await func.utils.alerts.invoke(
|
|
37420
|
-
SESSION_ID,
|
|
37421
|
-
"alert",
|
|
37422
|
-
refIdP,
|
|
37423
|
-
log_source,
|
|
37424
|
-
dsSession
|
|
37425
|
-
);
|
|
37044
|
+
await func.utils.alerts.invoke(SESSION_ID, 'alert', refIdP, log_source, dsSession);
|
|
37426
37045
|
func.events.delete_job(SESSION_ID, jobNoP);
|
|
37427
37046
|
},
|
|
37428
37047
|
delay: async function () {
|
|
@@ -37441,18 +37060,11 @@ func.events.execute = async function (
|
|
|
37441
37060
|
const _prog_id = await get_prog_id();
|
|
37442
37061
|
|
|
37443
37062
|
if (!_prog_id) {
|
|
37444
|
-
func.utils.debug_report(
|
|
37445
|
-
SESSION_ID,
|
|
37446
|
-
"func.events.execute",
|
|
37447
|
-
`${elementP} > ${triggerP} > ${functionP} > program not defined`,
|
|
37448
|
-
"E"
|
|
37449
|
-
);
|
|
37063
|
+
func.utils.debug_report(SESSION_ID, 'func.events.execute', `${elementP} > ${triggerP} > ${functionP} > program not defined`, 'E');
|
|
37450
37064
|
func.events.delete_job(SESSION_ID, jobNoP);
|
|
37451
37065
|
return;
|
|
37452
37066
|
}
|
|
37453
37067
|
|
|
37454
|
-
|
|
37455
|
-
|
|
37456
37068
|
// if (!output_field) {
|
|
37457
37069
|
// func.utils.debug_report(
|
|
37458
37070
|
// SESSION_ID,
|
|
@@ -37468,37 +37080,24 @@ func.events.execute = async function (
|
|
|
37468
37080
|
|
|
37469
37081
|
await func.datasource.set_outputField(SESSION_ID, dsSessionP, api_ret, args);
|
|
37470
37082
|
|
|
37471
|
-
|
|
37472
37083
|
func.events.delete_job(SESSION_ID, jobNoP);
|
|
37473
37084
|
},
|
|
37474
37085
|
call_system_api: async function () {
|
|
37475
|
-
const api_method = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args,
|
|
37086
|
+
const api_method = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args, 'api_method');
|
|
37476
37087
|
|
|
37477
37088
|
if (!api_method) {
|
|
37478
|
-
func.utils.debug_report(
|
|
37479
|
-
SESSION_ID,
|
|
37480
|
-
"func.events.execute",
|
|
37481
|
-
`${elementP} >${triggerP} >${functionP} > api_method not defined`,
|
|
37482
|
-
"E"
|
|
37483
|
-
);
|
|
37089
|
+
func.utils.debug_report(SESSION_ID, 'func.events.execute', `${elementP} >${triggerP} >${functionP} > api_method not defined`, 'E');
|
|
37484
37090
|
func.events.delete_job(SESSION_ID, jobNoP);
|
|
37485
37091
|
return;
|
|
37486
37092
|
}
|
|
37487
37093
|
let payload = {};
|
|
37488
|
-
const _payload = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args,
|
|
37094
|
+
const _payload = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args, 'payload');
|
|
37489
37095
|
if (_payload) {
|
|
37490
37096
|
const get_payload_property_value = async function (prop_name) {
|
|
37491
37097
|
let _prop = _payload;
|
|
37492
37098
|
let _value = _prop[prop_name];
|
|
37493
37099
|
if (_prop?.[`xu-exp:${prop_name}`]) {
|
|
37494
|
-
_value = (
|
|
37495
|
-
await func.expression.get(
|
|
37496
|
-
SESSION_ID,
|
|
37497
|
-
_prop[`xu-exp:${prop_name}`],
|
|
37498
|
-
dsSession,
|
|
37499
|
-
`${prop_name} expression`
|
|
37500
|
-
)
|
|
37501
|
-
).result;
|
|
37100
|
+
_value = (await func.expression.get(SESSION_ID, _prop[`xu-exp:${prop_name}`], dsSession, `${prop_name} expression`)).result;
|
|
37502
37101
|
}
|
|
37503
37102
|
|
|
37504
37103
|
return _value;
|
|
@@ -37506,7 +37105,7 @@ func.events.execute = async function (
|
|
|
37506
37105
|
|
|
37507
37106
|
for await (let [key, val] of Object.entries(_payload)) {
|
|
37508
37107
|
// if (key.substring(0, 7) !== "xu-exp:") {
|
|
37509
|
-
const new_key = key.replaceAll(
|
|
37108
|
+
const new_key = key.replaceAll('xu-exp:', ''); //key.substring(0, 7) === "xu-exp:" ? key.substring(7): key
|
|
37510
37109
|
payload[new_key] = await get_payload_property_value(new_key);
|
|
37511
37110
|
// }
|
|
37512
37111
|
}
|
|
@@ -37523,7 +37122,7 @@ func.events.execute = async function (
|
|
|
37523
37122
|
// return;
|
|
37524
37123
|
// }
|
|
37525
37124
|
|
|
37526
|
-
const output_field = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args,
|
|
37125
|
+
const output_field = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args, 'outputField');
|
|
37527
37126
|
|
|
37528
37127
|
// if (!output_field) {
|
|
37529
37128
|
// func.utils.debug_report(
|
|
@@ -37540,89 +37139,57 @@ func.events.execute = async function (
|
|
|
37540
37139
|
if (output_field) {
|
|
37541
37140
|
let datasource_changes = {};
|
|
37542
37141
|
|
|
37543
|
-
let ret_get_value = await func.datasource.get_value(
|
|
37544
|
-
SESSION_ID,
|
|
37545
|
-
output_field,
|
|
37546
|
-
dsSessionP
|
|
37547
|
-
);
|
|
37142
|
+
let ret_get_value = await func.datasource.get_value(SESSION_ID, output_field, dsSessionP);
|
|
37548
37143
|
if (ret_get_value.found) {
|
|
37549
37144
|
let _ds = _session.DS_GLB[ret_get_value.dsSessionP];
|
|
37550
37145
|
if (!datasource_changes[_ds.dsSession]) {
|
|
37551
37146
|
datasource_changes[_ds.dsSession] = {};
|
|
37552
37147
|
}
|
|
37553
|
-
if (
|
|
37554
|
-
|
|
37555
|
-
) {
|
|
37556
|
-
datasource_changes[_ds.dsSession][ret_get_value.currentRecordId] =
|
|
37557
|
-
{};
|
|
37148
|
+
if (!datasource_changes[_ds.dsSession][ret_get_value.currentRecordId]) {
|
|
37149
|
+
datasource_changes[_ds.dsSession][ret_get_value.currentRecordId] = {};
|
|
37558
37150
|
}
|
|
37559
|
-
datasource_changes[_ds.dsSession][ret_get_value.currentRecordId][
|
|
37560
|
-
output_field
|
|
37561
|
-
] = api_ret;
|
|
37151
|
+
datasource_changes[_ds.dsSession][ret_get_value.currentRecordId][output_field] = api_ret;
|
|
37562
37152
|
await func.datasource.update(SESSION_ID, datasource_changes);
|
|
37563
37153
|
}
|
|
37564
37154
|
}
|
|
37565
37155
|
func.events.delete_job(SESSION_ID, jobNoP);
|
|
37566
37156
|
},
|
|
37567
37157
|
call_external_api: async function () {
|
|
37568
|
-
const method = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args,
|
|
37158
|
+
const method = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args, 'method');
|
|
37569
37159
|
|
|
37570
37160
|
if (!method) {
|
|
37571
|
-
func.utils.debug_report(
|
|
37572
|
-
SESSION_ID,
|
|
37573
|
-
"func.events.execute",
|
|
37574
|
-
`${elementP} >${triggerP} >${functionP} > method not defined`,
|
|
37575
|
-
"E"
|
|
37576
|
-
);
|
|
37161
|
+
func.utils.debug_report(SESSION_ID, 'func.events.execute', `${elementP} >${triggerP} >${functionP} > method not defined`, 'E');
|
|
37577
37162
|
func.events.delete_job(SESSION_ID, jobNoP);
|
|
37578
37163
|
return;
|
|
37579
37164
|
}
|
|
37580
37165
|
|
|
37581
|
-
const url = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args,
|
|
37166
|
+
const url = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args, 'url');
|
|
37582
37167
|
|
|
37583
37168
|
if (!url) {
|
|
37584
|
-
func.utils.debug_report(
|
|
37585
|
-
SESSION_ID,
|
|
37586
|
-
"func.events.execute",
|
|
37587
|
-
`${elementP} >${triggerP} >${functionP} > url not defined`,
|
|
37588
|
-
"E"
|
|
37589
|
-
);
|
|
37169
|
+
func.utils.debug_report(SESSION_ID, 'func.events.execute', `${elementP} >${triggerP} >${functionP} > url not defined`, 'E');
|
|
37590
37170
|
func.events.delete_job(SESSION_ID, jobNoP);
|
|
37591
37171
|
return;
|
|
37592
37172
|
}
|
|
37593
37173
|
|
|
37594
|
-
const payload_arr = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args,
|
|
37174
|
+
const payload_arr = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args, 'payload');
|
|
37595
37175
|
|
|
37596
37176
|
const report_conversion_error = function (res, typeP, valP) {
|
|
37597
37177
|
var msg = `${elementP} >${triggerP} >${functionP} > error converting from ${valP} to ${typeP}`;
|
|
37598
37178
|
if (error) {
|
|
37599
|
-
return func.utils.debug_report(SESSION_ID, msg,
|
|
37179
|
+
return func.utils.debug_report(SESSION_ID, msg, '', 'W');
|
|
37600
37180
|
}
|
|
37601
|
-
func.utils.debug_report(
|
|
37602
|
-
SESSION_ID,
|
|
37603
|
-
msg + " " + _.capitalize(source) + prog_info,
|
|
37604
|
-
"",
|
|
37605
|
-
"E"
|
|
37606
|
-
);
|
|
37181
|
+
func.utils.debug_report(SESSION_ID, msg + ' ' + _.capitalize(source) + prog_info, '', 'E');
|
|
37607
37182
|
};
|
|
37608
37183
|
const report_conversion_warn = function (res) {
|
|
37609
37184
|
var msg = `${elementP} >${triggerP} >${functionP} > type mismatch auto conversion from value ${valP} to ${typeP}`;
|
|
37610
|
-
func.utils.debug_report(
|
|
37611
|
-
SESSION_ID,
|
|
37612
|
-
msg + " " + _.capitalize(source) + prog_info,
|
|
37613
|
-
"",
|
|
37614
|
-
"W"
|
|
37615
|
-
);
|
|
37185
|
+
func.utils.debug_report(SESSION_ID, msg + ' ' + _.capitalize(source) + prog_info, '', 'W');
|
|
37616
37186
|
};
|
|
37617
37187
|
// var ret = valP;
|
|
37618
37188
|
if (error) {
|
|
37619
37189
|
return report_conversion_error();
|
|
37620
37190
|
}
|
|
37621
37191
|
|
|
37622
|
-
const module = await func.common.get_module(
|
|
37623
|
-
SESSION_ID,
|
|
37624
|
-
"xuda-get-cast-util-module.mjs"
|
|
37625
|
-
);
|
|
37192
|
+
const module = await func.common.get_module(SESSION_ID, 'xuda-get-cast-util-module.mjs');
|
|
37626
37193
|
// return module.cast(
|
|
37627
37194
|
// typeP,
|
|
37628
37195
|
// valP,
|
|
@@ -37633,16 +37200,11 @@ func.events.execute = async function (
|
|
|
37633
37200
|
var payload = _.reduce(
|
|
37634
37201
|
payload_arr,
|
|
37635
37202
|
(ret, val, key) => {
|
|
37636
|
-
ret[val.key] = module.cast(
|
|
37637
|
-
val.type,
|
|
37638
|
-
val.val,
|
|
37639
|
-
report_conversion_error,
|
|
37640
|
-
report_conversion_warn
|
|
37641
|
-
);
|
|
37203
|
+
ret[val.key] = module.cast(val.type, val.val, report_conversion_error, report_conversion_warn);
|
|
37642
37204
|
|
|
37643
37205
|
return ret;
|
|
37644
37206
|
},
|
|
37645
|
-
{}
|
|
37207
|
+
{},
|
|
37646
37208
|
);
|
|
37647
37209
|
// if (!payload) {
|
|
37648
37210
|
// func.utils.debug_report(
|
|
@@ -37655,7 +37217,7 @@ func.events.execute = async function (
|
|
|
37655
37217
|
// return;
|
|
37656
37218
|
// }
|
|
37657
37219
|
|
|
37658
|
-
const output_field = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args,
|
|
37220
|
+
const output_field = await func.datasource.get_args_property_value(SESSION_ID, dsSession, args, 'outputField');
|
|
37659
37221
|
|
|
37660
37222
|
// if (!output_field) {
|
|
37661
37223
|
// func.utils.debug_report(
|
|
@@ -37672,25 +37234,16 @@ func.events.execute = async function (
|
|
|
37672
37234
|
if (output_field) {
|
|
37673
37235
|
let datasource_changes = {};
|
|
37674
37236
|
|
|
37675
|
-
let ret_get_value = await func.datasource.get_value(
|
|
37676
|
-
SESSION_ID,
|
|
37677
|
-
output_field,
|
|
37678
|
-
dsSessionP
|
|
37679
|
-
);
|
|
37237
|
+
let ret_get_value = await func.datasource.get_value(SESSION_ID, output_field, dsSessionP);
|
|
37680
37238
|
if (ret_get_value.found) {
|
|
37681
37239
|
let _ds = _session.DS_GLB[ret_get_value.dsSessionP];
|
|
37682
37240
|
if (!datasource_changes[_ds.dsSession]) {
|
|
37683
37241
|
datasource_changes[_ds.dsSession] = {};
|
|
37684
37242
|
}
|
|
37685
|
-
if (
|
|
37686
|
-
|
|
37687
|
-
) {
|
|
37688
|
-
datasource_changes[_ds.dsSession][ret_get_value.currentRecordId] =
|
|
37689
|
-
{};
|
|
37243
|
+
if (!datasource_changes[_ds.dsSession][ret_get_value.currentRecordId]) {
|
|
37244
|
+
datasource_changes[_ds.dsSession][ret_get_value.currentRecordId] = {};
|
|
37690
37245
|
}
|
|
37691
|
-
datasource_changes[_ds.dsSession][ret_get_value.currentRecordId][
|
|
37692
|
-
output_field
|
|
37693
|
-
] = api_ret;
|
|
37246
|
+
datasource_changes[_ds.dsSession][ret_get_value.currentRecordId][output_field] = api_ret;
|
|
37694
37247
|
await func.datasource.update(SESSION_ID, datasource_changes);
|
|
37695
37248
|
}
|
|
37696
37249
|
}
|
|
@@ -37723,16 +37276,9 @@ func.events.delete_job = function (SESSION_ID, jobNoP) {
|
|
|
37723
37276
|
var dsSession = _session.WORKER_OBJ.jobs[job_index].dsSessionP;
|
|
37724
37277
|
let ds_obj = _session?.DS_GLB[dsSession];
|
|
37725
37278
|
if (ds_obj) {
|
|
37726
|
-
delete SCREEN_BLOCKER_OBJ[
|
|
37727
|
-
ds_obj.screenId +
|
|
37728
|
-
(ds_obj.callingScreenId ? "_" + ds_obj.callingScreenId : "")
|
|
37729
|
-
];
|
|
37279
|
+
delete SCREEN_BLOCKER_OBJ[ds_obj.screenId + (ds_obj.callingScreenId ? '_' + ds_obj.callingScreenId : '')];
|
|
37730
37280
|
}
|
|
37731
|
-
if (
|
|
37732
|
-
dsSession &&
|
|
37733
|
-
ds_obj?.loops_limit &&
|
|
37734
|
-
ds_obj?.loops_count < ds_obj?.loops_limit - 1
|
|
37735
|
-
) {
|
|
37281
|
+
if (dsSession && ds_obj?.loops_limit && ds_obj?.loops_count < ds_obj?.loops_limit - 1) {
|
|
37736
37282
|
return;
|
|
37737
37283
|
}
|
|
37738
37284
|
_session.WORKER_OBJ.stat = null;
|
|
@@ -37750,17 +37296,9 @@ func.events.delete_job_0 = function (SESSION_ID) {
|
|
|
37750
37296
|
var dsSession = _session.WORKER_OBJ.jobs[job_index].dsSession;
|
|
37751
37297
|
let ds_obj = _session?.DS_GLB[dsSession];
|
|
37752
37298
|
if (ds_obj) {
|
|
37753
|
-
delete SCREEN_BLOCKER_OBJ[
|
|
37754
|
-
ds_obj.screenId +
|
|
37755
|
-
(ds_obj.callingScreenId ? "_" + ds_obj.callingScreenId : "")
|
|
37756
|
-
];
|
|
37299
|
+
delete SCREEN_BLOCKER_OBJ[ds_obj.screenId + (ds_obj.callingScreenId ? '_' + ds_obj.callingScreenId : '')];
|
|
37757
37300
|
}
|
|
37758
|
-
if (
|
|
37759
|
-
dsSession &&
|
|
37760
|
-
ds_obj &&
|
|
37761
|
-
ds_obj.loops_limit &&
|
|
37762
|
-
ds_obj.loops_count < ds_obj.loops_limit - 1
|
|
37763
|
-
) {
|
|
37301
|
+
if (dsSession && ds_obj && ds_obj.loops_limit && ds_obj.loops_count < ds_obj.loops_limit - 1) {
|
|
37764
37302
|
return;
|
|
37765
37303
|
}
|
|
37766
37304
|
_session.WORKER_OBJ.stat = null;
|
|
@@ -37802,8 +37340,7 @@ setInterval(function () {
|
|
|
37802
37340
|
}, 1000);
|
|
37803
37341
|
|
|
37804
37342
|
func.events.set_browser_changes = function (dsP, fieldsChangedP) {
|
|
37805
|
-
if (fieldsChangedP.includes(
|
|
37806
|
-
document.title = dsP.dataset_new["SYS_GLOBAL_STR_BROWSER_TITLE"];
|
|
37343
|
+
if (fieldsChangedP.includes('SYS_GLOBAL_STR_BROWSER_TITLE')) document.title = dsP.dataset_new['SYS_GLOBAL_STR_BROWSER_TITLE'];
|
|
37807
37344
|
};
|
|
37808
37345
|
|
|
37809
37346
|
func.events.execute_PENDING_OPEN_URL_EVENTS = async function () {
|
|
@@ -37812,52 +37349,29 @@ func.events.execute_PENDING_OPEN_URL_EVENTS = async function () {
|
|
|
37812
37349
|
glb.WINDOW_LOCATION_SEARCH = url;
|
|
37813
37350
|
glb.ROOT_ELEMENT_ATTRIBUTES = func.UI.utils.get_root_element_attributes();
|
|
37814
37351
|
|
|
37815
|
-
const params_obj = func.common.getObjectFromUrl(
|
|
37816
|
-
url,
|
|
37817
|
-
glb.ROOT_ELEMENT_ATTRIBUTES
|
|
37818
|
-
);
|
|
37352
|
+
const params_obj = func.common.getObjectFromUrl(url, glb.ROOT_ELEMENT_ATTRIBUTES);
|
|
37819
37353
|
if (!params_obj.prog) {
|
|
37820
|
-
return console.warn(
|
|
37354
|
+
return console.warn('prog empty');
|
|
37821
37355
|
}
|
|
37822
37356
|
|
|
37823
37357
|
await func.utils.TREE_OBJ.get(SESSION_ID, params_obj.prog);
|
|
37824
|
-
let screen_ret = await func.utils.get_screen_obj(
|
|
37825
|
-
SESSION_ID,
|
|
37826
|
-
params_obj.prog
|
|
37827
|
-
);
|
|
37358
|
+
let screen_ret = await func.utils.get_screen_obj(SESSION_ID, params_obj.prog);
|
|
37828
37359
|
|
|
37829
37360
|
if (screen_ret) {
|
|
37830
|
-
await func.UI.screen.init(
|
|
37831
|
-
SESSION_ID,
|
|
37832
|
-
params_obj.prog,
|
|
37833
|
-
null,
|
|
37834
|
-
null,
|
|
37835
|
-
$("#embed_" + SESSION_ID),
|
|
37836
|
-
null,
|
|
37837
|
-
null,
|
|
37838
|
-
null,
|
|
37839
|
-
null,
|
|
37840
|
-
null,
|
|
37841
|
-
"pendingUrlEvent_embed"
|
|
37842
|
-
);
|
|
37361
|
+
await func.UI.screen.init(SESSION_ID, params_obj.prog, null, null, $('#embed_' + SESSION_ID), null, null, null, null, null, 'pendingUrlEvent_embed');
|
|
37843
37362
|
} else {
|
|
37844
|
-
console.error(
|
|
37845
|
-
func.UI.utils.progressScreen.show(
|
|
37846
|
-
SESSION_ID,
|
|
37847
|
-
"Program not exist",
|
|
37848
|
-
null,
|
|
37849
|
-
true
|
|
37850
|
-
);
|
|
37363
|
+
console.error('Program not exist', params_obj.prog_id);
|
|
37364
|
+
func.UI.utils.progressScreen.show(SESSION_ID, 'Program not exist', null, true);
|
|
37851
37365
|
}
|
|
37852
37366
|
} else {
|
|
37853
|
-
console.warn(
|
|
37367
|
+
console.warn('url empty');
|
|
37854
37368
|
}
|
|
37855
37369
|
}
|
|
37856
37370
|
};
|
|
37857
37371
|
func.events.invoke = async function (event_id) {
|
|
37858
37372
|
var _session = SESSION_OBJ[SESSION_ID];
|
|
37859
37373
|
if (!event_id) {
|
|
37860
|
-
console.warn(
|
|
37374
|
+
console.warn('event_id Cannot be empty');
|
|
37861
37375
|
return false;
|
|
37862
37376
|
}
|
|
37863
37377
|
var ds;
|
|
@@ -37866,10 +37380,7 @@ func.events.invoke = async function (event_id) {
|
|
|
37866
37380
|
if (_.isEmpty(_view_obj.progEvents)) continue;
|
|
37867
37381
|
if (ds) break;
|
|
37868
37382
|
for await (const [key, val] of Object.entries(_view_obj.progEvents)) {
|
|
37869
|
-
if (
|
|
37870
|
-
val?.data?.type === "user_defined" &&
|
|
37871
|
-
val.data.event_name === event_id
|
|
37872
|
-
) {
|
|
37383
|
+
if (val?.data?.type === 'user_defined' && val.data.event_name === event_id) {
|
|
37873
37384
|
ds = ds_key;
|
|
37874
37385
|
break;
|
|
37875
37386
|
}
|
|
@@ -37877,11 +37388,11 @@ func.events.invoke = async function (event_id) {
|
|
|
37877
37388
|
}
|
|
37878
37389
|
|
|
37879
37390
|
if (!ds) {
|
|
37880
|
-
console.warn(
|
|
37391
|
+
console.warn('event_id not found');
|
|
37881
37392
|
return false;
|
|
37882
37393
|
}
|
|
37883
37394
|
|
|
37884
|
-
func.events.validate(SESSION_ID,
|
|
37395
|
+
func.events.validate(SESSION_ID, 'user_defined', ds, event_id);
|
|
37885
37396
|
};
|
|
37886
37397
|
func.action = {};
|
|
37887
37398
|
func.action.execute = async function (
|