@xuda.io/runtime-bundle 1.0.289 → 1.0.291
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 +13 -303
- package/js/xuda-runtime-bundle.min.js +1 -1
- package/js/xuda-runtime-slim.js +13 -303
- package/js/xuda-runtime-slim.min.es.js +13 -303
- package/js/xuda-runtime-slim.min.js +1 -1
- package/js/xuda-server-bundle.min.mjs +1 -1
- package/js/xuda-server-bundle.mjs +13 -303
- package/js/xuda-worker-bundle.js +13 -303
- package/js/xuda-worker-bundle.min.js +1 -1
- package/package.json +1 -1
|
@@ -2656,6 +2656,7 @@ func.datasource.execute = async function (SESSION_ID, dataSourceSession, IS_DATA
|
|
|
2656
2656
|
await func.datasource.execute_field_init_events(SESSION_ID, dataSourceSession, 'form', 'newRecord');
|
|
2657
2657
|
}
|
|
2658
2658
|
}
|
|
2659
|
+
await func.datasource.callback(SESSION_ID, dataSourceSession, args.dataSourceNoP, args.rowIdP, args.jobNoP, null, _ds.prog_id);
|
|
2659
2660
|
};
|
|
2660
2661
|
if (!rows) {
|
|
2661
2662
|
await row_not_found();
|
|
@@ -2943,64 +2944,6 @@ func.datasource.render_fields_form = async function (SESSION_ID, dataSourceSessi
|
|
|
2943
2944
|
}
|
|
2944
2945
|
};
|
|
2945
2946
|
|
|
2946
|
-
// func.datasource.run_rows_form = async function (
|
|
2947
|
-
// SESSION_ID,
|
|
2948
|
-
// dataSourceSession,
|
|
2949
|
-
// rowIdxP,
|
|
2950
|
-
// raw_data_row
|
|
2951
|
-
// ) {
|
|
2952
|
-
// var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[dataSourceSession];
|
|
2953
|
-
// if (!_ds) return;
|
|
2954
|
-
// let _ROWID = raw_data_row.id;
|
|
2955
|
-
// // var val = _ds.data_feed.rows[rowIdxP];
|
|
2956
|
-
|
|
2957
|
-
// var idx = rowIdxP;
|
|
2958
|
-
|
|
2959
|
-
// const find_ROWID_idx_from_raw_data_arr = function (rowId) {
|
|
2960
|
-
// if (!_ds?.v?.raw_data?.rows) {
|
|
2961
|
-
// throw new Error("ds.v.raw_data.rows not found");
|
|
2962
|
-
// }
|
|
2963
|
-
|
|
2964
|
-
// const index = _ds.v.raw_data.rows.findIndex((item) => item.id === rowId);
|
|
2965
|
-
// if (index === -1) {
|
|
2966
|
-
// throw new Error(`item.id "${rowId}" not found`);
|
|
2967
|
-
// }
|
|
2968
|
-
// return index;
|
|
2969
|
-
// };
|
|
2970
|
-
|
|
2971
|
-
// try {
|
|
2972
|
-
// idx = find_ROWID_idx_from_raw_data_arr(raw_data_row.id);
|
|
2973
|
-
// } catch (e) {
|
|
2974
|
-
// _ROWID = "newRecord";
|
|
2975
|
-
// _ds.data_feed.rows.push({ _ROWID });
|
|
2976
|
-
// idx = func.common.find_ROWID_idx(_ds, _ROWID);
|
|
2977
|
-
// }
|
|
2978
|
-
|
|
2979
|
-
// _ds.currentRecordId = _ROWID; // set temporary to allow expression decoder work
|
|
2980
|
-
|
|
2981
|
-
// await func.datasource.render_fields_form(
|
|
2982
|
-
// SESSION_ID,
|
|
2983
|
-
// dataSourceSession,
|
|
2984
|
-
// raw_data_row
|
|
2985
|
-
// );
|
|
2986
|
-
// const init_count = await func.datasource.get_field_init_count(
|
|
2987
|
-
// SESSION_ID,
|
|
2988
|
-
// dataSourceSession,
|
|
2989
|
-
// _ROWID,
|
|
2990
|
-
// false,
|
|
2991
|
-
// _ds.oninit_triggers_to_run
|
|
2992
|
-
// );
|
|
2993
|
-
// if (init_count > 0) {
|
|
2994
|
-
// await func.datasource.execute_field_init_events(
|
|
2995
|
-
// SESSION_ID,
|
|
2996
|
-
// dataSourceSession,
|
|
2997
|
-
// "form",
|
|
2998
|
-
// _ds.data_feed.rows[idx]._ROWID
|
|
2999
|
-
// );
|
|
3000
|
-
// }
|
|
3001
|
-
// // await form_continue();
|
|
3002
|
-
// };
|
|
3003
|
-
|
|
3004
2947
|
func.datasource.execute_field_init_events = async function (SESSION_ID, dataSourceSession, sourceP, rowIdP) {
|
|
3005
2948
|
var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[dataSourceSession];
|
|
3006
2949
|
var args = _ds.args;
|
|
@@ -3622,11 +3565,6 @@ func.datasource.update = async function (SESSION_ID, datasource_changes, update_
|
|
|
3622
3565
|
_ds.currentRecordId = record_id;
|
|
3623
3566
|
}
|
|
3624
3567
|
}
|
|
3625
|
-
// if (!_ds.data_feed.rows_changed) {
|
|
3626
|
-
// _ds.data_feed.rows_changed = [];
|
|
3627
|
-
// }
|
|
3628
|
-
// if (!_ds.data_feed.rows_changed.includes(record_id))
|
|
3629
|
-
// _ds.data_feed.rows_changed.push(record_id);
|
|
3630
3568
|
}
|
|
3631
3569
|
}
|
|
3632
3570
|
|
|
@@ -3660,234 +3598,6 @@ func.datasource.update = async function (SESSION_ID, datasource_changes, update_
|
|
|
3660
3598
|
});
|
|
3661
3599
|
};
|
|
3662
3600
|
|
|
3663
|
-
// func.datasource.update = async function (
|
|
3664
|
-
// SESSION_ID,
|
|
3665
|
-
// datasource_changes,
|
|
3666
|
-
// update_local_scope_only
|
|
3667
|
-
// ) {
|
|
3668
|
-
// return new Promise(async (resolve, reject) => {
|
|
3669
|
-
// var _session = SESSION_OBJ[SESSION_ID];
|
|
3670
|
-
|
|
3671
|
-
// if (typeof glb.GLOBAL_VARS === "undefined") {
|
|
3672
|
-
// glb.GLOBAL_VARS = (
|
|
3673
|
-
// await func.common.get_module(
|
|
3674
|
-
// SESSION_ID,
|
|
3675
|
-
// "xuda-system-globals-module.mjs"
|
|
3676
|
-
// )
|
|
3677
|
-
// ).system_globals;
|
|
3678
|
-
// }
|
|
3679
|
-
|
|
3680
|
-
// let fieldComputed_datasource_changes = {};
|
|
3681
|
-
|
|
3682
|
-
// const set_fieldComputed_dependencies = async function (dsNo, field_id, parent_ds) {
|
|
3683
|
-
|
|
3684
|
-
// // iterate child ds
|
|
3685
|
-
// for (const [dsSession, _ds] of Object.entries(_session.DS_GLB)) {
|
|
3686
|
-
// if (parent_ds !== null) {
|
|
3687
|
-
// if (_ds.parentDataSourceNo != parent_ds) continue
|
|
3688
|
-
// } else {
|
|
3689
|
-
// if (dsSession != dsNo) continue
|
|
3690
|
-
// }
|
|
3691
|
-
// let tree_ret = await func.utils.TREE_OBJ.get(SESSION_ID, _ds.prog_id);
|
|
3692
|
-
// if (tree_ret.menuType === "component" || tree_ret.menuType === "globals") {
|
|
3693
|
-
// // check if field has fieldComputed property
|
|
3694
|
-
// const _progFields = await func.datasource.get_progFields(
|
|
3695
|
-
// SESSION_ID,
|
|
3696
|
-
// dsSession
|
|
3697
|
-
// );
|
|
3698
|
-
// // find if field is computed
|
|
3699
|
-
// let propExpressions
|
|
3700
|
-
// for await (const val of _progFields) {
|
|
3701
|
-
|
|
3702
|
-
// const fieldId = val.data.field_id;
|
|
3703
|
-
|
|
3704
|
-
// if (fieldId !== field_id) continue
|
|
3705
|
-
// if (val.data.type !== "virtual" || !val.props.fieldComputed) break
|
|
3706
|
-
|
|
3707
|
-
// const _propExpressions = val.props?.propExpressions?.fieldValue
|
|
3708
|
-
// if (_propExpressions && JSON.stringify(_propExpressions).includes(field_id)) {
|
|
3709
|
-
// propExpressions = _propExpressions
|
|
3710
|
-
// }
|
|
3711
|
-
// }
|
|
3712
|
-
|
|
3713
|
-
// if (!propExpressions) return
|
|
3714
|
-
|
|
3715
|
-
// if (!fieldComputed_datasource_changes[dsSession]) {
|
|
3716
|
-
// fieldComputed_datasource_changes[dsSession] = {}
|
|
3717
|
-
// }
|
|
3718
|
-
// // iterate ds rows
|
|
3719
|
-
// for (const row of _ds.data_feed?.rows || []) {
|
|
3720
|
-
// // iterate row fields
|
|
3721
|
-
// for (const [key, val] of Object.entries(row)) {
|
|
3722
|
-
// if (key !== field_id) return
|
|
3723
|
-
// try {
|
|
3724
|
-
// if (!fieldComputed_datasource_changes[dsSession][row._ROWID]) {
|
|
3725
|
-
// fieldComputed_datasource_changes[dsSession][row._ROWID] = {}
|
|
3726
|
-
// }
|
|
3727
|
-
// let ret = await func.expression.get(
|
|
3728
|
-
// SESSION_ID,
|
|
3729
|
-
// propExpressions,
|
|
3730
|
-
// dsNo,
|
|
3731
|
-
// "update",
|
|
3732
|
-
// row._ROWID
|
|
3733
|
-
// );
|
|
3734
|
-
// fieldComputed_datasource_changes[dsSession][row._ROWID][field_id] = ret.result
|
|
3735
|
-
// // const row_idx = func.common.find_ROWID_idx(_ds, record_id);
|
|
3736
|
-
|
|
3737
|
-
// // _ds.data_feed.rows[row_idx][field_id] = ret.result;
|
|
3738
|
-
// } catch (err) {
|
|
3739
|
-
// console.error(err);
|
|
3740
|
-
// }
|
|
3741
|
-
// }
|
|
3742
|
-
// }
|
|
3743
|
-
// }
|
|
3744
|
-
// await set_fieldComputed_dependencies(dsNo, field_id, dsSession)
|
|
3745
|
-
// }
|
|
3746
|
-
// debugger
|
|
3747
|
-
|
|
3748
|
-
// }
|
|
3749
|
-
|
|
3750
|
-
// var fields_changed = [];
|
|
3751
|
-
// var datasource_changed = [];
|
|
3752
|
-
// let client_datasource_changes={}
|
|
3753
|
-
// // iterate changes datasource
|
|
3754
|
-
// for await (const [dataSource, row_data] of Object.entries(
|
|
3755
|
-
// datasource_changes
|
|
3756
|
-
// )) {
|
|
3757
|
-
// var _ds = _session.DS_GLB[dataSource];
|
|
3758
|
-
// if (!_ds) {
|
|
3759
|
-
// continue;
|
|
3760
|
-
// }
|
|
3761
|
-
// // iterate changes records
|
|
3762
|
-
// for (const [record_id, fields_data] of Object.entries(row_data)) {
|
|
3763
|
-
// // iterate changes fields
|
|
3764
|
-
// for (const [field_id, value] of Object.entries(fields_data)) {
|
|
3765
|
-
// // mechanism to make update directly on the datasource object
|
|
3766
|
-
// if (record_id === "datasource_main") {
|
|
3767
|
-
// _.set(_ds, field_id, value);
|
|
3768
|
-
// continue;
|
|
3769
|
-
// }
|
|
3770
|
-
|
|
3771
|
-
// if (typeof fields_data === "object") {
|
|
3772
|
-
// if (glb.GLOBAL_VARS[field_id]) {
|
|
3773
|
-
// _ds.data_system[field_id] = value;
|
|
3774
|
-
|
|
3775
|
-
// continue;
|
|
3776
|
-
// }
|
|
3777
|
-
|
|
3778
|
-
// try {
|
|
3779
|
-
// const row_idx = func.common.find_ROWID_idx(_ds, record_id);
|
|
3780
|
-
// _ds.data_feed.rows[row_idx][field_id] = value;
|
|
3781
|
-
// await set_fieldComputed_dependencies(dataSource, field_id, null)
|
|
3782
|
-
// } catch (err) {
|
|
3783
|
-
// console.error(err);
|
|
3784
|
-
// }
|
|
3785
|
-
|
|
3786
|
-
// if (!fields_changed.includes(field_id)) {
|
|
3787
|
-
// fields_changed.push(field_id);
|
|
3788
|
-
// }
|
|
3789
|
-
// if (!datasource_changed.includes(dataSource)) {
|
|
3790
|
-
// datasource_changed.push(dataSource);
|
|
3791
|
-
// }
|
|
3792
|
-
// } else if (fields_data === "set") {
|
|
3793
|
-
// _ds.currentRecordId = record_id;
|
|
3794
|
-
// }
|
|
3795
|
-
|
|
3796
|
-
// if (!update_local_scope_only) {
|
|
3797
|
-
// if (glb.IS_WORKER) {
|
|
3798
|
-
// let tree_ret = await func.utils.TREE_OBJ.get(SESSION_ID, _ds.prog_id);
|
|
3799
|
-
|
|
3800
|
-
// if (tree_ret.menuType === "globals") {
|
|
3801
|
-
|
|
3802
|
-
// const _progFields = await func.datasource.get_progFields(
|
|
3803
|
-
// SESSION_ID,
|
|
3804
|
-
// dataSource
|
|
3805
|
-
// );
|
|
3806
|
-
// let view_field_obj = func.common.find_item_by_key(
|
|
3807
|
-
// _progFields,
|
|
3808
|
-
// "field_id",
|
|
3809
|
-
// field_id
|
|
3810
|
-
// );
|
|
3811
|
-
// if (view_field_obj?.data?.serverField) {
|
|
3812
|
-
// delete datasource_changes[dataSource][record_id][field_id]
|
|
3813
|
-
// }
|
|
3814
|
-
|
|
3815
|
-
// if (record_id === "data_system") {
|
|
3816
|
-
// delete datasource_changes[dataSource][record_id]
|
|
3817
|
-
// }
|
|
3818
|
-
// }
|
|
3819
|
-
// }
|
|
3820
|
-
// }
|
|
3821
|
-
// }
|
|
3822
|
-
// if (!_ds.data_feed.rows_changed) {
|
|
3823
|
-
// _ds.data_feed.rows_changed = [];
|
|
3824
|
-
// }
|
|
3825
|
-
// if (!_ds.data_feed.rows_changed.includes(record_id))
|
|
3826
|
-
// _ds.data_feed.rows_changed.push(record_id);
|
|
3827
|
-
// }
|
|
3828
|
-
|
|
3829
|
-
// let new_datasource_changes = { ...datasource_changes, ...fieldComputed_datasource_changes }
|
|
3830
|
-
|
|
3831
|
-
// if (!update_local_scope_only) {
|
|
3832
|
-
// if (glb.IS_WORKER) {
|
|
3833
|
-
// let tree_ret = await func.utils.TREE_OBJ.get(SESSION_ID, _ds.prog_id);
|
|
3834
|
-
|
|
3835
|
-
// if (_session.IS_API || typeof IS_MASTER_WEBSOCKET !== "undefined" || typeof IS_PROCESS_SERVER !== "undefined") {
|
|
3836
|
-
// continue;
|
|
3837
|
-
// }
|
|
3838
|
-
|
|
3839
|
-
// if (tree_ret.menuType !== "component" && tree_ret.menuType !== "globals") {
|
|
3840
|
-
|
|
3841
|
-
// continue;
|
|
3842
|
-
|
|
3843
|
-
// }
|
|
3844
|
-
|
|
3845
|
-
// // update client
|
|
3846
|
-
|
|
3847
|
-
// func.utils.post_back_to_client(
|
|
3848
|
-
// SESSION_ID,
|
|
3849
|
-
// "update_client_eventChangesResults_from_worker",
|
|
3850
|
-
// _session.worker_id,
|
|
3851
|
-
// new_datasource_changes
|
|
3852
|
-
// );
|
|
3853
|
-
// return resolve();
|
|
3854
|
-
// }
|
|
3855
|
-
|
|
3856
|
-
// if (!glb.IS_WORKER) {
|
|
3857
|
-
// if (_ds._run_at !== "client" || _ds.tree_obj.menuType === "globals") {
|
|
3858
|
-
// // no need to update worker
|
|
3859
|
-
// // return resolve();
|
|
3860
|
-
// // continue;
|
|
3861
|
-
// // }
|
|
3862
|
-
|
|
3863
|
-
// const ret = await func.index.call_worker(SESSION_ID, {
|
|
3864
|
-
// service: "update_datasource_changes_from_client",
|
|
3865
|
-
// data: {
|
|
3866
|
-
// session_id: SESSION_ID,
|
|
3867
|
-
// new_datasource_changes,
|
|
3868
|
-
// },
|
|
3869
|
-
// id: _ds.worker_id,
|
|
3870
|
-
// });
|
|
3871
|
-
// }
|
|
3872
|
-
// }
|
|
3873
|
-
// }
|
|
3874
|
-
// }
|
|
3875
|
-
// if (!glb.IS_WORKER) {
|
|
3876
|
-
// ///// REFRESH SCREEN
|
|
3877
|
-
// if (fields_changed.length) {
|
|
3878
|
-
// await func.UI.screen.refresh_xu_attributes(SESSION_ID, fields_changed);
|
|
3879
|
-
// await func.UI.screen.refresh_screen(
|
|
3880
|
-
// SESSION_ID,
|
|
3881
|
-
// fields_changed,
|
|
3882
|
-
// null,
|
|
3883
|
-
// datasource_changed[0] // refresh the current datasource only
|
|
3884
|
-
// );
|
|
3885
|
-
// }
|
|
3886
|
-
// }
|
|
3887
|
-
// return resolve();
|
|
3888
|
-
// });
|
|
3889
|
-
// };
|
|
3890
|
-
|
|
3891
3601
|
func.datasource.callback = async function (SESSION_ID, dsSessionP, na, rowIdP, jobNoP, NA_callingDataSourceP, NA_isInitP, nodeIdP) {
|
|
3892
3602
|
var _session = SESSION_OBJ[SESSION_ID];
|
|
3893
3603
|
var _ds = _session.DS_GLB[dsSessionP];
|
|
@@ -3907,20 +3617,20 @@ func.datasource.callback = async function (SESSION_ID, dsSessionP, na, rowIdP, j
|
|
|
3907
3617
|
}
|
|
3908
3618
|
}
|
|
3909
3619
|
|
|
3910
|
-
|
|
3911
|
-
|
|
3620
|
+
if (_ds?.progDataSource?.datasetOutputField) {
|
|
3621
|
+
let datasource_changes = {};
|
|
3912
3622
|
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3623
|
+
let _ds = _session.DS_GLB[ret_get_value.dsSessionP];
|
|
3624
|
+
if (!datasource_changes[_ds.dsSession]) {
|
|
3625
|
+
datasource_changes[_ds.dsSession] = {};
|
|
3626
|
+
}
|
|
3627
|
+
if (!datasource_changes[_ds.dsSession][_ds.currentRecordId]) {
|
|
3628
|
+
datasource_changes[_ds.dsSession][_ds.currentRecordId] = {};
|
|
3919
3629
|
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3630
|
+
datasource_changes[_ds.dsSession][ret_get_value.currentRecordId][_ds?.progDataSource?.datasetOutputField] = _ds?.data_feed?.rows || [];
|
|
3631
|
+
await func.datasource.update(SESSION_ID, datasource_changes);
|
|
3632
|
+
}
|
|
3633
|
+
}
|
|
3924
3634
|
} catch (err) {
|
|
3925
3635
|
// console.error(err);
|
|
3926
3636
|
}
|