@xuda.io/runtime-bundle 1.0.518 → 1.0.520
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 +227 -213
- package/js/xuda-runtime-bundle.min.js +1 -1
- package/js/xuda-runtime-slim.js +231 -217
- package/js/xuda-runtime-slim.min.es.js +231 -217
- package/js/xuda-runtime-slim.min.js +1 -1
- package/js/xuda-server-bundle.min.mjs +1 -1
- package/js/xuda-server-bundle.mjs +208 -203
- package/js/xuda-worker-bundle.js +208 -203
- package/js/xuda-worker-bundle.min.js +1 -1
- package/package.json +1 -1
package/js/xuda-worker-bundle.js
CHANGED
|
@@ -3432,201 +3432,201 @@ func.datasource.del = function (SESSION_ID, dsP) {
|
|
|
3432
3432
|
}
|
|
3433
3433
|
perform_delete();
|
|
3434
3434
|
};
|
|
3435
|
-
func.datasource.update_old = async function (SESSION_ID, datasource_changes, update_local_scope_only, avoid_refresh) {
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
if (_session.IS_API || typeof IS_MASTER_WEBSOCKET !== 'undefined' || typeof IS_PROCESS_SERVER !== 'undefined') {
|
|
3440
|
-
update_local_scope_only = true;
|
|
3441
|
-
}
|
|
3442
|
-
|
|
3443
|
-
if (typeof glb.GLOBAL_VARS === 'undefined') {
|
|
3444
|
-
glb.GLOBAL_VARS = (await func.common.get_module(SESSION_ID, 'xuda-system-globals-module.mjs')).system_globals;
|
|
3445
|
-
}
|
|
3446
|
-
|
|
3447
|
-
const set_fieldComputed_dependencies = async function (dsNo, field_id, parent_ds) {
|
|
3448
|
-
// iterate child ds
|
|
3449
|
-
for (const [dsSession, _ds] of Object.entries(_session.DS_GLB)) {
|
|
3450
|
-
if (parent_ds !== null) {
|
|
3451
|
-
if (_ds.parentDataSourceNo != parent_ds) continue;
|
|
3452
|
-
} else {
|
|
3453
|
-
if (dsSession != dsNo) continue;
|
|
3454
|
-
}
|
|
3455
|
-
let tree_ret = await func.utils.TREE_OBJ.get(SESSION_ID, _ds.prog_id);
|
|
3456
|
-
if (tree_ret.menuType === 'component' || tree_ret.menuType === 'globals') {
|
|
3457
|
-
// check if field has fieldComputed property
|
|
3458
|
-
const _progFields = await func.datasource.get_progFields(SESSION_ID, dsSession);
|
|
3459
|
-
// find if field is computed
|
|
3460
|
-
let fieldComputed_propExpressions, fieldComputed_id;
|
|
3461
|
-
for await (const val of _progFields) {
|
|
3462
|
-
const fieldId = val.data.field_id;
|
|
3435
|
+
// func.datasource.update_old = async function (SESSION_ID, datasource_changes, update_local_scope_only, avoid_refresh) {
|
|
3436
|
+
// return new Promise(async (resolve, reject) => {
|
|
3437
|
+
// var _session = SESSION_OBJ[SESSION_ID];
|
|
3463
3438
|
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
const _propExpressions = val.props?.propExpressions?.fieldValue;
|
|
3468
|
-
if (_propExpressions && JSON.stringify(_propExpressions).includes(field_id)) {
|
|
3469
|
-
fieldComputed_propExpressions = _propExpressions;
|
|
3470
|
-
fieldComputed_id = fieldId;
|
|
3471
|
-
}
|
|
3472
|
-
}
|
|
3473
|
-
|
|
3474
|
-
if (!fieldComputed_id) return;
|
|
3475
|
-
|
|
3476
|
-
// iterate ds rows
|
|
3477
|
-
for (const row of _ds.data_feed?.rows || []) {
|
|
3478
|
-
// iterate row fields
|
|
3479
|
-
for (const [key, val] of Object.entries(row)) {
|
|
3480
|
-
if (key !== fieldComputed_id) continue;
|
|
3481
|
-
try {
|
|
3482
|
-
let ret = await func.expression.get(SESSION_ID, fieldComputed_propExpressions, dsNo, 'update', row._ROWID);
|
|
3483
|
-
|
|
3484
|
-
const row_idx = func.common.find_ROWID_idx(_ds, row._ROWID);
|
|
3485
|
-
if (_ds.data_feed.rows[row_idx][fieldComputed_id] !== ret.result) {
|
|
3486
|
-
_ds.data_feed.rows[row_idx][fieldComputed_id] = ret.result;
|
|
3487
|
-
if (!fields_changed.includes(fieldComputed_id)) {
|
|
3488
|
-
fields_changed.push(fieldComputed_id);
|
|
3489
|
-
}
|
|
3490
|
-
if (!datasource_changed.includes(dsSession)) {
|
|
3491
|
-
datasource_changed.push(dsSession);
|
|
3492
|
-
}
|
|
3493
|
-
}
|
|
3494
|
-
} catch (err) {
|
|
3495
|
-
console.error(err);
|
|
3496
|
-
}
|
|
3497
|
-
}
|
|
3498
|
-
}
|
|
3499
|
-
}
|
|
3500
|
-
await set_fieldComputed_dependencies(dsNo, field_id, dsSession);
|
|
3501
|
-
}
|
|
3502
|
-
};
|
|
3503
|
-
|
|
3504
|
-
var fields_changed = [];
|
|
3505
|
-
var datasource_changed = [];
|
|
3506
|
-
let client_datasource_changes = {};
|
|
3507
|
-
let server_datasource_changes = {};
|
|
3508
|
-
// iterate changes datasource
|
|
3509
|
-
for await (const [dataSource, row_data] of Object.entries(datasource_changes)) {
|
|
3510
|
-
var _ds = _session.DS_GLB[dataSource];
|
|
3511
|
-
if (!_ds) {
|
|
3512
|
-
continue;
|
|
3513
|
-
}
|
|
3514
|
-
|
|
3515
|
-
const update_xu_ref = async function () {
|
|
3516
|
-
let _ds_0 = _session.DS_GLB[0];
|
|
3517
|
-
for ([ref_name, val] of Object.entries(_ds_0.data_system['SYS_GLOBAL_OBJ_REFS'])) {
|
|
3518
|
-
if (val.ds.dsSession == dataSource) {
|
|
3519
|
-
func.UI.update_xu_ref(SESSION_ID, dataSource, ref_name);
|
|
3520
|
-
}
|
|
3521
|
-
}
|
|
3522
|
-
};
|
|
3523
|
-
|
|
3524
|
-
// iterate changes records
|
|
3525
|
-
for (const [record_id, fields_data] of Object.entries(row_data)) {
|
|
3526
|
-
// iterate changes fields
|
|
3527
|
-
for (const [field_id, value] of Object.entries(fields_data)) {
|
|
3528
|
-
// mechanism to make update directly on the datasource object
|
|
3529
|
-
if (record_id === 'datasource_main') {
|
|
3530
|
-
_.set(_ds, field_id, value);
|
|
3531
|
-
update_xu_ref();
|
|
3532
|
-
continue;
|
|
3533
|
-
}
|
|
3534
|
-
|
|
3535
|
-
if (typeof fields_data === 'object') {
|
|
3536
|
-
if (glb.GLOBAL_VARS[field_id]) {
|
|
3537
|
-
_ds.data_system[field_id] = value;
|
|
3538
|
-
continue;
|
|
3539
|
-
}
|
|
3540
|
-
|
|
3541
|
-
// try {
|
|
3542
|
-
const row_idx = func.common.find_ROWID_idx(_ds, record_id);
|
|
3543
|
-
if (_ds.data_feed.rows[row_idx][field_id] !== value) {
|
|
3544
|
-
_ds.data_feed.rows[row_idx][field_id] = value;
|
|
3545
|
-
await set_fieldComputed_dependencies(dataSource, field_id, null);
|
|
3546
|
-
|
|
3547
|
-
// search the field in refs
|
|
3548
|
-
update_xu_ref();
|
|
3439
|
+
// if (_session.IS_API || typeof IS_MASTER_WEBSOCKET !== 'undefined' || typeof IS_PROCESS_SERVER !== 'undefined') {
|
|
3440
|
+
// update_local_scope_only = true;
|
|
3441
|
+
// }
|
|
3549
3442
|
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
// RUN AT SERVER
|
|
3554
|
-
if (tree_ret.menuType === 'globals' || tree_ret.menuType === 'component') {
|
|
3555
|
-
const _progFields = await func.datasource.get_progFields(SESSION_ID, dataSource);
|
|
3556
|
-
let view_field_obj = func.common.find_item_by_key(_progFields, 'field_id', field_id);
|
|
3557
|
-
if (!view_field_obj?.data?.serverField && record_id !== 'data_system') {
|
|
3558
|
-
if (!client_datasource_changes[dataSource]) {
|
|
3559
|
-
client_datasource_changes[dataSource] = {};
|
|
3560
|
-
}
|
|
3561
|
-
if (!client_datasource_changes[dataSource][record_id]) {
|
|
3562
|
-
client_datasource_changes[dataSource][record_id] = {};
|
|
3563
|
-
}
|
|
3564
|
-
client_datasource_changes[dataSource][record_id][field_id] = value;
|
|
3565
|
-
}
|
|
3566
|
-
}
|
|
3567
|
-
} else {
|
|
3568
|
-
// RUN AT CLIENT
|
|
3569
|
-
if ((tree_ret.menuType === 'component' && _ds._run_at !== 'client') || tree_ret.menuType === 'globals') {
|
|
3570
|
-
if (!server_datasource_changes[dataSource]) {
|
|
3571
|
-
server_datasource_changes[dataSource] = {};
|
|
3572
|
-
}
|
|
3573
|
-
if (!server_datasource_changes[dataSource][record_id]) {
|
|
3574
|
-
server_datasource_changes[dataSource][record_id] = {};
|
|
3575
|
-
}
|
|
3576
|
-
server_datasource_changes[dataSource][record_id][field_id] = value;
|
|
3577
|
-
}
|
|
3578
|
-
}
|
|
3579
|
-
}
|
|
3443
|
+
// if (typeof glb.GLOBAL_VARS === 'undefined') {
|
|
3444
|
+
// glb.GLOBAL_VARS = (await func.common.get_module(SESSION_ID, 'xuda-system-globals-module.mjs')).system_globals;
|
|
3445
|
+
// }
|
|
3580
3446
|
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3447
|
+
// const set_fieldComputed_dependencies = async function (dsNo, field_id, parent_ds) {
|
|
3448
|
+
// // iterate child ds
|
|
3449
|
+
// for (const [dsSession, _ds] of Object.entries(_session.DS_GLB)) {
|
|
3450
|
+
// if (parent_ds !== null) {
|
|
3451
|
+
// if (_ds.parentDataSourceNo != parent_ds) continue;
|
|
3452
|
+
// } else {
|
|
3453
|
+
// if (dsSession != dsNo) continue;
|
|
3454
|
+
// }
|
|
3455
|
+
// let tree_ret = await func.utils.TREE_OBJ.get(SESSION_ID, _ds.prog_id);
|
|
3456
|
+
// if (tree_ret.menuType === 'component' || tree_ret.menuType === 'globals') {
|
|
3457
|
+
// // check if field has fieldComputed property
|
|
3458
|
+
// const _progFields = await func.datasource.get_progFields(SESSION_ID, dsSession);
|
|
3459
|
+
// // find if field is computed
|
|
3460
|
+
// let fieldComputed_propExpressions, fieldComputed_id;
|
|
3461
|
+
// for await (const val of _progFields) {
|
|
3462
|
+
// const fieldId = val.data.field_id;
|
|
3463
|
+
|
|
3464
|
+
// // if (fieldId !== field_id) continue
|
|
3465
|
+
// if (val.data.type !== 'virtual' || !val.props.fieldComputed) continue;
|
|
3466
|
+
|
|
3467
|
+
// const _propExpressions = val.props?.propExpressions?.fieldValue;
|
|
3468
|
+
// if (_propExpressions && JSON.stringify(_propExpressions).includes(field_id)) {
|
|
3469
|
+
// fieldComputed_propExpressions = _propExpressions;
|
|
3470
|
+
// fieldComputed_id = fieldId;
|
|
3471
|
+
// }
|
|
3472
|
+
// }
|
|
3473
|
+
|
|
3474
|
+
// if (!fieldComputed_id) return;
|
|
3475
|
+
|
|
3476
|
+
// // iterate ds rows
|
|
3477
|
+
// for (const row of _ds.data_feed?.rows || []) {
|
|
3478
|
+
// // iterate row fields
|
|
3479
|
+
// for (const [key, val] of Object.entries(row)) {
|
|
3480
|
+
// if (key !== fieldComputed_id) continue;
|
|
3481
|
+
// try {
|
|
3482
|
+
// let ret = await func.expression.get(SESSION_ID, fieldComputed_propExpressions, dsNo, 'update', row._ROWID);
|
|
3483
|
+
|
|
3484
|
+
// const row_idx = func.common.find_ROWID_idx(_ds, row._ROWID);
|
|
3485
|
+
// if (_ds.data_feed.rows[row_idx][fieldComputed_id] !== ret.result) {
|
|
3486
|
+
// _ds.data_feed.rows[row_idx][fieldComputed_id] = ret.result;
|
|
3487
|
+
// if (!fields_changed.includes(fieldComputed_id)) {
|
|
3488
|
+
// fields_changed.push(fieldComputed_id);
|
|
3489
|
+
// }
|
|
3490
|
+
// if (!datasource_changed.includes(dsSession)) {
|
|
3491
|
+
// datasource_changed.push(dsSession);
|
|
3492
|
+
// }
|
|
3493
|
+
// }
|
|
3494
|
+
// } catch (err) {
|
|
3495
|
+
// console.error(err);
|
|
3496
|
+
// }
|
|
3497
|
+
// }
|
|
3498
|
+
// }
|
|
3499
|
+
// }
|
|
3500
|
+
// await set_fieldComputed_dependencies(dsNo, field_id, dsSession);
|
|
3501
|
+
// }
|
|
3502
|
+
// };
|
|
3503
|
+
|
|
3504
|
+
// var fields_changed = [];
|
|
3505
|
+
// var datasource_changed = [];
|
|
3506
|
+
// let client_datasource_changes = {};
|
|
3507
|
+
// let server_datasource_changes = {};
|
|
3508
|
+
// // iterate changes datasource
|
|
3509
|
+
// for await (const [dataSource, row_data] of Object.entries(datasource_changes)) {
|
|
3510
|
+
// var _ds = _session.DS_GLB[dataSource];
|
|
3511
|
+
// if (!_ds) {
|
|
3512
|
+
// continue;
|
|
3513
|
+
// }
|
|
3587
3514
|
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3515
|
+
// const update_xu_ref = async function () {
|
|
3516
|
+
// let _ds_0 = _session.DS_GLB[0];
|
|
3517
|
+
// for ([ref_name, val] of Object.entries(_ds_0.data_system['SYS_GLOBAL_OBJ_REFS'])) {
|
|
3518
|
+
// if (val.ds.dsSession == dataSource) {
|
|
3519
|
+
// func.UI.update_xu_ref(SESSION_ID, dataSource, ref_name);
|
|
3520
|
+
// }
|
|
3521
|
+
// }
|
|
3522
|
+
// };
|
|
3523
|
+
|
|
3524
|
+
// // iterate changes records
|
|
3525
|
+
// for (const [record_id, fields_data] of Object.entries(row_data)) {
|
|
3526
|
+
// // iterate changes fields
|
|
3527
|
+
// for (const [field_id, value] of Object.entries(fields_data)) {
|
|
3528
|
+
// // mechanism to make update directly on the datasource object
|
|
3529
|
+
// if (record_id === 'datasource_main') {
|
|
3530
|
+
// _.set(_ds, field_id, value);
|
|
3531
|
+
// update_xu_ref();
|
|
3532
|
+
// continue;
|
|
3533
|
+
// }
|
|
3534
|
+
|
|
3535
|
+
// if (typeof fields_data === 'object') {
|
|
3536
|
+
// if (glb.GLOBAL_VARS[field_id]) {
|
|
3537
|
+
// _ds.data_system[field_id] = value;
|
|
3538
|
+
// continue;
|
|
3539
|
+
// }
|
|
3540
|
+
|
|
3541
|
+
// // try {
|
|
3542
|
+
// const row_idx = func.common.find_ROWID_idx(_ds, record_id);
|
|
3543
|
+
// if (_ds.data_feed.rows[row_idx][field_id] !== value) {
|
|
3544
|
+
// _ds.data_feed.rows[row_idx][field_id] = value;
|
|
3545
|
+
// await set_fieldComputed_dependencies(dataSource, field_id, null);
|
|
3546
|
+
|
|
3547
|
+
// // search the field in refs
|
|
3548
|
+
// update_xu_ref();
|
|
3549
|
+
|
|
3550
|
+
// if (!update_local_scope_only) {
|
|
3551
|
+
// let tree_ret = await func.utils.TREE_OBJ.get(SESSION_ID, _ds.prog_id);
|
|
3552
|
+
// if (glb.IS_WORKER) {
|
|
3553
|
+
// // RUN AT SERVER
|
|
3554
|
+
// if (tree_ret.menuType === 'globals' || tree_ret.menuType === 'component') {
|
|
3555
|
+
// const _progFields = await func.datasource.get_progFields(SESSION_ID, dataSource);
|
|
3556
|
+
// let view_field_obj = func.common.find_item_by_key(_progFields, 'field_id', field_id);
|
|
3557
|
+
// if (!view_field_obj?.data?.serverField && record_id !== 'data_system') {
|
|
3558
|
+
// if (!client_datasource_changes[dataSource]) {
|
|
3559
|
+
// client_datasource_changes[dataSource] = {};
|
|
3560
|
+
// }
|
|
3561
|
+
// if (!client_datasource_changes[dataSource][record_id]) {
|
|
3562
|
+
// client_datasource_changes[dataSource][record_id] = {};
|
|
3563
|
+
// }
|
|
3564
|
+
// client_datasource_changes[dataSource][record_id][field_id] = value;
|
|
3565
|
+
// }
|
|
3566
|
+
// }
|
|
3567
|
+
// } else {
|
|
3568
|
+
// // RUN AT CLIENT
|
|
3569
|
+
// if ((tree_ret.menuType === 'component' && _ds._run_at !== 'client') || tree_ret.menuType === 'globals') {
|
|
3570
|
+
// if (!server_datasource_changes[dataSource]) {
|
|
3571
|
+
// server_datasource_changes[dataSource] = {};
|
|
3572
|
+
// }
|
|
3573
|
+
// if (!server_datasource_changes[dataSource][record_id]) {
|
|
3574
|
+
// server_datasource_changes[dataSource][record_id] = {};
|
|
3575
|
+
// }
|
|
3576
|
+
// server_datasource_changes[dataSource][record_id][field_id] = value;
|
|
3577
|
+
// }
|
|
3578
|
+
// }
|
|
3579
|
+
// }
|
|
3580
|
+
|
|
3581
|
+
// if (!fields_changed.includes(field_id)) {
|
|
3582
|
+
// fields_changed.push(field_id);
|
|
3583
|
+
// }
|
|
3584
|
+
// if (!datasource_changed.includes(dataSource)) {
|
|
3585
|
+
// datasource_changed.push(dataSource);
|
|
3586
|
+
// }
|
|
3587
|
+
|
|
3588
|
+
// if (!_ds.data_feed.rows_changed) {
|
|
3589
|
+
// _ds.data_feed.rows_changed = [];
|
|
3590
|
+
// }
|
|
3591
|
+
// if (!_ds.data_feed.rows_changed.includes(record_id)) _ds.data_feed.rows_changed.push(record_id);
|
|
3592
|
+
// }
|
|
3593
|
+
// } else if (fields_data === 'set') {
|
|
3594
|
+
// _ds.currentRecordId = record_id;
|
|
3595
|
+
// }
|
|
3596
|
+
// }
|
|
3597
|
+
// }
|
|
3598
|
+
// }
|
|
3599
3599
|
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
};
|
|
3600
|
+
// if (glb.IS_WORKER) {
|
|
3601
|
+
// if (!update_local_scope_only && !_.isEmpty(client_datasource_changes)) {
|
|
3602
|
+
// func.utils.post_back_to_client(SESSION_ID, 'update_client_eventChangesResults_from_worker', _session.worker_id, client_datasource_changes);
|
|
3603
|
+
// }
|
|
3604
|
+
// } else {
|
|
3605
|
+
// if (!update_local_scope_only && !_.isEmpty(server_datasource_changes)) {
|
|
3606
|
+
// const ret = await func.index.call_worker(SESSION_ID, {
|
|
3607
|
+
// service: 'update_datasource_changes_from_client',
|
|
3608
|
+
// data: {
|
|
3609
|
+
// session_id: SESSION_ID,
|
|
3610
|
+
// datasource_changes: server_datasource_changes,
|
|
3611
|
+
// },
|
|
3612
|
+
// id: _ds.worker_id,
|
|
3613
|
+
// });
|
|
3614
|
+
// }
|
|
3615
|
+
// ///// REFRESH SCREEN
|
|
3616
|
+
// if (!avoid_refresh && fields_changed.length) {
|
|
3617
|
+
// await func.UI.screen.refresh_xu_attributes(SESSION_ID, fields_changed);
|
|
3618
|
+
// // await removed from the below function cause to dead lock Mar 3 25
|
|
3619
|
+
// func.UI.screen.refresh_screen(
|
|
3620
|
+
// SESSION_ID,
|
|
3621
|
+
// fields_changed,
|
|
3622
|
+
// null,
|
|
3623
|
+
// datasource_changed[0], // refresh the current datasource only
|
|
3624
|
+
// );
|
|
3625
|
+
// }
|
|
3626
|
+
// }
|
|
3627
|
+
// resolve();
|
|
3628
|
+
// });
|
|
3629
|
+
// };
|
|
3630
3630
|
|
|
3631
3631
|
func.datasource.update = async function (SESSION_ID, datasource_changes, update_local_scope_only, avoid_refresh) {
|
|
3632
3632
|
return new Promise(async (resolve, reject) => {
|
|
@@ -3701,6 +3701,18 @@ func.datasource.update = async function (SESSION_ID, datasource_changes, update_
|
|
|
3701
3701
|
var datasource_changed = [];
|
|
3702
3702
|
let client_datasource_changes = {};
|
|
3703
3703
|
let server_datasource_changes = {};
|
|
3704
|
+
|
|
3705
|
+
const update_xu_ref = async function (dataSource, field_id) {
|
|
3706
|
+
let ret;
|
|
3707
|
+
let _ds_0 = _session.DS_GLB[0];
|
|
3708
|
+
for ([ref_name, val] of Object.entries(_ds_0.data_system['SYS_GLOBAL_OBJ_REFS'])) {
|
|
3709
|
+
if (val.ds.dsSession == dataSource) {
|
|
3710
|
+
ret = func.UI.update_xu_ref(SESSION_ID, dataSource, ref_name);
|
|
3711
|
+
}
|
|
3712
|
+
}
|
|
3713
|
+
return ret;
|
|
3714
|
+
};
|
|
3715
|
+
|
|
3704
3716
|
// iterate changes datasource
|
|
3705
3717
|
for await (const [dataSource, row_data] of Object.entries(datasource_changes)) {
|
|
3706
3718
|
var _ds = _session.DS_GLB[dataSource];
|
|
@@ -3708,15 +3720,6 @@ func.datasource.update = async function (SESSION_ID, datasource_changes, update_
|
|
|
3708
3720
|
continue;
|
|
3709
3721
|
}
|
|
3710
3722
|
|
|
3711
|
-
const update_xu_ref = async function () {
|
|
3712
|
-
let _ds_0 = _session.DS_GLB[0];
|
|
3713
|
-
for ([ref_name, val] of Object.entries(_ds_0.data_system['SYS_GLOBAL_OBJ_REFS'])) {
|
|
3714
|
-
if (val.ds.dsSession == dataSource) {
|
|
3715
|
-
func.UI.update_xu_ref(SESSION_ID, dataSource, ref_name);
|
|
3716
|
-
}
|
|
3717
|
-
}
|
|
3718
|
-
};
|
|
3719
|
-
|
|
3720
3723
|
// iterate changes records
|
|
3721
3724
|
for (const [record_id, fields_data] of Object.entries(row_data)) {
|
|
3722
3725
|
// iterate changes fields
|
|
@@ -3724,9 +3727,11 @@ func.datasource.update = async function (SESSION_ID, datasource_changes, update_
|
|
|
3724
3727
|
// mechanism to make update directly on the datasource object
|
|
3725
3728
|
if (record_id === 'datasource_main') {
|
|
3726
3729
|
_.set(_ds, field_id, value);
|
|
3727
|
-
update_xu_ref();
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
+
const ret = update_xu_ref(dataSource, field_id);
|
|
3731
|
+
if (ret) {
|
|
3732
|
+
fields_changed.push(field_id);
|
|
3733
|
+
datasource_changed.push(dataSource);
|
|
3734
|
+
}
|
|
3730
3735
|
continue;
|
|
3731
3736
|
}
|
|
3732
3737
|
|
|
@@ -3743,7 +3748,7 @@ func.datasource.update = async function (SESSION_ID, datasource_changes, update_
|
|
|
3743
3748
|
await set_fieldComputed_dependencies(dataSource, field_id, null);
|
|
3744
3749
|
|
|
3745
3750
|
// search the field in refs
|
|
3746
|
-
update_xu_ref();
|
|
3751
|
+
update_xu_ref(dataSource, field_id);
|
|
3747
3752
|
|
|
3748
3753
|
if (!update_local_scope_only) {
|
|
3749
3754
|
let tree_ret = await func.utils.TREE_OBJ.get(SESSION_ID, _ds.prog_id);
|