@xuda.io/runtime-bundle 1.0.655 → 1.0.657
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 +14 -195
- package/js/xuda-runtime-bundle.min.js +1 -1
- package/js/xuda-runtime-slim.js +14 -195
- package/js/xuda-runtime-slim.min.es.js +14 -195
- package/js/xuda-runtime-slim.min.js +1 -1
- package/js/xuda-server-bundle.min.mjs +1 -1
- package/js/xuda-server-bundle.mjs +7 -195
- package/js/xuda-worker-bundle.js +7 -195
- package/js/xuda-worker-bundle.min.js +1 -1
- package/package.json +1 -1
package/js/xuda-runtime-slim.js
CHANGED
|
@@ -4152,12 +4152,19 @@ func.datasource.run_events_functions = async function (SESSION_ID, dataSourceSes
|
|
|
4152
4152
|
for (let job_num of jobs) {
|
|
4153
4153
|
job_promises.push(
|
|
4154
4154
|
new Promise((resolve, reject) => {
|
|
4155
|
+
let i = 0;
|
|
4155
4156
|
const interval = setInterval(() => {
|
|
4157
|
+
i++;
|
|
4156
4158
|
var job_index = func.events.find_job_index(SESSION_ID, job_num);
|
|
4157
4159
|
if (job_index == null) {
|
|
4158
4160
|
clearInterval(interval);
|
|
4159
4161
|
resolve(job_num);
|
|
4160
4162
|
}
|
|
4163
|
+
if (i > 20) {
|
|
4164
|
+
console.error('deadlock detected');
|
|
4165
|
+
clearInterval(interval);
|
|
4166
|
+
resolve(job_num);
|
|
4167
|
+
}
|
|
4161
4168
|
}, 100);
|
|
4162
4169
|
}),
|
|
4163
4170
|
);
|
|
@@ -4734,201 +4741,6 @@ func.datasource.del = function (SESSION_ID, dsP) {
|
|
|
4734
4741
|
}
|
|
4735
4742
|
perform_delete();
|
|
4736
4743
|
};
|
|
4737
|
-
// func.datasource.update_old = async function (SESSION_ID, datasource_changes, update_local_scope_only, avoid_refresh) {
|
|
4738
|
-
// return new Promise(async (resolve, reject) => {
|
|
4739
|
-
// var _session = SESSION_OBJ[SESSION_ID];
|
|
4740
|
-
|
|
4741
|
-
// if (_session.IS_API || typeof IS_MASTER_WEBSOCKET !== 'undefined' || typeof IS_PROCESS_SERVER !== 'undefined') {
|
|
4742
|
-
// update_local_scope_only = true;
|
|
4743
|
-
// }
|
|
4744
|
-
|
|
4745
|
-
// if (typeof glb.GLOBAL_VARS === 'undefined') {
|
|
4746
|
-
// glb.GLOBAL_VARS = (await func.common.get_module(SESSION_ID, 'xuda-system-globals-module.mjs')).system_globals;
|
|
4747
|
-
// }
|
|
4748
|
-
|
|
4749
|
-
// const set_fieldComputed_dependencies = async function (dsNo, field_id, parent_ds) {
|
|
4750
|
-
// // iterate child ds
|
|
4751
|
-
// for (const [dsSession, _ds] of Object.entries(_session.DS_GLB)) {
|
|
4752
|
-
// if (parent_ds !== null) {
|
|
4753
|
-
// if (_ds.parentDataSourceNo != parent_ds) continue;
|
|
4754
|
-
// } else {
|
|
4755
|
-
// if (dsSession != dsNo) continue;
|
|
4756
|
-
// }
|
|
4757
|
-
// let tree_ret = await func.utils.TREE_OBJ.get(SESSION_ID, _ds.prog_id);
|
|
4758
|
-
// if (tree_ret.menuType === 'component' || tree_ret.menuType === 'globals') {
|
|
4759
|
-
// // check if field has fieldComputed property
|
|
4760
|
-
// const _progFields = await func.datasource.get_progFields(SESSION_ID, dsSession);
|
|
4761
|
-
// // find if field is computed
|
|
4762
|
-
// let fieldComputed_propExpressions, fieldComputed_id;
|
|
4763
|
-
// for await (const val of _progFields) {
|
|
4764
|
-
// const fieldId = val.data.field_id;
|
|
4765
|
-
|
|
4766
|
-
// // if (fieldId !== field_id) continue
|
|
4767
|
-
// if (val.data.type !== 'virtual' || !val.props.fieldComputed) continue;
|
|
4768
|
-
|
|
4769
|
-
// const _propExpressions = val.props?.propExpressions?.fieldValue;
|
|
4770
|
-
// if (_propExpressions && JSON.stringify(_propExpressions).includes(field_id)) {
|
|
4771
|
-
// fieldComputed_propExpressions = _propExpressions;
|
|
4772
|
-
// fieldComputed_id = fieldId;
|
|
4773
|
-
// }
|
|
4774
|
-
// }
|
|
4775
|
-
|
|
4776
|
-
// if (!fieldComputed_id) return;
|
|
4777
|
-
|
|
4778
|
-
// // iterate ds rows
|
|
4779
|
-
// for (const row of _ds.data_feed?.rows || []) {
|
|
4780
|
-
// // iterate row fields
|
|
4781
|
-
// for (const [key, val] of Object.entries(row)) {
|
|
4782
|
-
// if (key !== fieldComputed_id) continue;
|
|
4783
|
-
// try {
|
|
4784
|
-
// let ret = await func.expression.get(SESSION_ID, fieldComputed_propExpressions, dsNo, 'update', row._ROWID);
|
|
4785
|
-
|
|
4786
|
-
// const row_idx = func.common.find_ROWID_idx(_ds, row._ROWID);
|
|
4787
|
-
// if (_ds.data_feed.rows[row_idx][fieldComputed_id] !== ret.result) {
|
|
4788
|
-
// _ds.data_feed.rows[row_idx][fieldComputed_id] = ret.result;
|
|
4789
|
-
// if (!fields_changed.includes(fieldComputed_id)) {
|
|
4790
|
-
// fields_changed.push(fieldComputed_id);
|
|
4791
|
-
// }
|
|
4792
|
-
// if (!datasource_changed.includes(dsSession)) {
|
|
4793
|
-
// datasource_changed.push(dsSession);
|
|
4794
|
-
// }
|
|
4795
|
-
// }
|
|
4796
|
-
// } catch (err) {
|
|
4797
|
-
// console.error(err);
|
|
4798
|
-
// }
|
|
4799
|
-
// }
|
|
4800
|
-
// }
|
|
4801
|
-
// }
|
|
4802
|
-
// await set_fieldComputed_dependencies(dsNo, field_id, dsSession);
|
|
4803
|
-
// }
|
|
4804
|
-
// };
|
|
4805
|
-
|
|
4806
|
-
// var fields_changed = [];
|
|
4807
|
-
// var datasource_changed = [];
|
|
4808
|
-
// let client_datasource_changes = {};
|
|
4809
|
-
// let server_datasource_changes = {};
|
|
4810
|
-
// // iterate changes datasource
|
|
4811
|
-
// for await (const [dataSource, row_data] of Object.entries(datasource_changes)) {
|
|
4812
|
-
// var _ds = _session.DS_GLB[dataSource];
|
|
4813
|
-
// if (!_ds) {
|
|
4814
|
-
// continue;
|
|
4815
|
-
// }
|
|
4816
|
-
|
|
4817
|
-
// const update_xu_ref = async function () {
|
|
4818
|
-
// let _ds_0 = _session.DS_GLB[0];
|
|
4819
|
-
// for ([ref_name, val] of Object.entries(_ds_0.data_system['SYS_GLOBAL_OBJ_REFS'])) {
|
|
4820
|
-
// if (val.ds.dsSession == dataSource) {
|
|
4821
|
-
// func.UI.update_xu_ref(SESSION_ID, dataSource, ref_name);
|
|
4822
|
-
// }
|
|
4823
|
-
// }
|
|
4824
|
-
// };
|
|
4825
|
-
|
|
4826
|
-
// // iterate changes records
|
|
4827
|
-
// for (const [record_id, fields_data] of Object.entries(row_data)) {
|
|
4828
|
-
// // iterate changes fields
|
|
4829
|
-
// for (const [field_id, value] of Object.entries(fields_data)) {
|
|
4830
|
-
// // mechanism to make update directly on the datasource object
|
|
4831
|
-
// if (record_id === 'datasource_main') {
|
|
4832
|
-
// _.set(_ds, field_id, value);
|
|
4833
|
-
// update_xu_ref();
|
|
4834
|
-
// continue;
|
|
4835
|
-
// }
|
|
4836
|
-
|
|
4837
|
-
// if (typeof fields_data === 'object') {
|
|
4838
|
-
// if (glb.GLOBAL_VARS[field_id]) {
|
|
4839
|
-
// _ds.data_system[field_id] = value;
|
|
4840
|
-
// continue;
|
|
4841
|
-
// }
|
|
4842
|
-
|
|
4843
|
-
// // try {
|
|
4844
|
-
// const row_idx = func.common.find_ROWID_idx(_ds, record_id);
|
|
4845
|
-
// if (_ds.data_feed.rows[row_idx][field_id] !== value) {
|
|
4846
|
-
// _ds.data_feed.rows[row_idx][field_id] = value;
|
|
4847
|
-
// await set_fieldComputed_dependencies(dataSource, field_id, null);
|
|
4848
|
-
|
|
4849
|
-
// // search the field in refs
|
|
4850
|
-
// update_xu_ref();
|
|
4851
|
-
|
|
4852
|
-
// if (!update_local_scope_only) {
|
|
4853
|
-
// let tree_ret = await func.utils.TREE_OBJ.get(SESSION_ID, _ds.prog_id);
|
|
4854
|
-
// if (glb.IS_WORKER) {
|
|
4855
|
-
// // RUN AT SERVER
|
|
4856
|
-
// if (tree_ret.menuType === 'globals' || tree_ret.menuType === 'component') {
|
|
4857
|
-
// const _progFields = await func.datasource.get_progFields(SESSION_ID, dataSource);
|
|
4858
|
-
// let view_field_obj = func.common.find_item_by_key(_progFields, 'field_id', field_id);
|
|
4859
|
-
// if (!view_field_obj?.data?.serverField && record_id !== 'data_system') {
|
|
4860
|
-
// if (!client_datasource_changes[dataSource]) {
|
|
4861
|
-
// client_datasource_changes[dataSource] = {};
|
|
4862
|
-
// }
|
|
4863
|
-
// if (!client_datasource_changes[dataSource][record_id]) {
|
|
4864
|
-
// client_datasource_changes[dataSource][record_id] = {};
|
|
4865
|
-
// }
|
|
4866
|
-
// client_datasource_changes[dataSource][record_id][field_id] = value;
|
|
4867
|
-
// }
|
|
4868
|
-
// }
|
|
4869
|
-
// } else {
|
|
4870
|
-
// // RUN AT CLIENT
|
|
4871
|
-
// if ((tree_ret.menuType === 'component' && _ds._run_at !== 'client') || tree_ret.menuType === 'globals') {
|
|
4872
|
-
// if (!server_datasource_changes[dataSource]) {
|
|
4873
|
-
// server_datasource_changes[dataSource] = {};
|
|
4874
|
-
// }
|
|
4875
|
-
// if (!server_datasource_changes[dataSource][record_id]) {
|
|
4876
|
-
// server_datasource_changes[dataSource][record_id] = {};
|
|
4877
|
-
// }
|
|
4878
|
-
// server_datasource_changes[dataSource][record_id][field_id] = value;
|
|
4879
|
-
// }
|
|
4880
|
-
// }
|
|
4881
|
-
// }
|
|
4882
|
-
|
|
4883
|
-
// if (!fields_changed.includes(field_id)) {
|
|
4884
|
-
// fields_changed.push(field_id);
|
|
4885
|
-
// }
|
|
4886
|
-
// if (!datasource_changed.includes(dataSource)) {
|
|
4887
|
-
// datasource_changed.push(dataSource);
|
|
4888
|
-
// }
|
|
4889
|
-
|
|
4890
|
-
// if (!_ds.data_feed.rows_changed) {
|
|
4891
|
-
// _ds.data_feed.rows_changed = [];
|
|
4892
|
-
// }
|
|
4893
|
-
// if (!_ds.data_feed.rows_changed.includes(record_id)) _ds.data_feed.rows_changed.push(record_id);
|
|
4894
|
-
// }
|
|
4895
|
-
// } else if (fields_data === 'set') {
|
|
4896
|
-
// _ds.currentRecordId = record_id;
|
|
4897
|
-
// }
|
|
4898
|
-
// }
|
|
4899
|
-
// }
|
|
4900
|
-
// }
|
|
4901
|
-
|
|
4902
|
-
// if (glb.IS_WORKER) {
|
|
4903
|
-
// if (!update_local_scope_only && !_.isEmpty(client_datasource_changes)) {
|
|
4904
|
-
// func.utils.post_back_to_client(SESSION_ID, 'update_client_eventChangesResults_from_worker', _session.worker_id, client_datasource_changes);
|
|
4905
|
-
// }
|
|
4906
|
-
// } else {
|
|
4907
|
-
// if (!update_local_scope_only && !_.isEmpty(server_datasource_changes)) {
|
|
4908
|
-
// const ret = await func.index.call_worker(SESSION_ID, {
|
|
4909
|
-
// service: 'update_datasource_changes_from_client',
|
|
4910
|
-
// data: {
|
|
4911
|
-
// session_id: SESSION_ID,
|
|
4912
|
-
// datasource_changes: server_datasource_changes,
|
|
4913
|
-
// },
|
|
4914
|
-
// id: _ds.worker_id,
|
|
4915
|
-
// });
|
|
4916
|
-
// }
|
|
4917
|
-
// ///// REFRESH SCREEN
|
|
4918
|
-
// if (!avoid_refresh && fields_changed.length) {
|
|
4919
|
-
// await func.UI.screen.refresh_xu_attributes(SESSION_ID, fields_changed);
|
|
4920
|
-
// // await removed from the below function cause to dead lock Mar 3 25
|
|
4921
|
-
// func.UI.screen.refresh_screen(
|
|
4922
|
-
// SESSION_ID,
|
|
4923
|
-
// fields_changed,
|
|
4924
|
-
// null,
|
|
4925
|
-
// datasource_changed[0], // refresh the current datasource only
|
|
4926
|
-
// );
|
|
4927
|
-
// }
|
|
4928
|
-
// }
|
|
4929
|
-
// resolve();
|
|
4930
|
-
// });
|
|
4931
|
-
// };
|
|
4932
4744
|
|
|
4933
4745
|
func.datasource.update = async function (SESSION_ID, datasource_changes, update_local_scope_only, avoid_refresh) {
|
|
4934
4746
|
return new Promise(async (resolve, reject) => {
|
|
@@ -12638,6 +12450,13 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
|
|
|
12638
12450
|
const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
|
|
12639
12451
|
value = _ds.data_feed.rows?.[row_idx]?.[val.value];
|
|
12640
12452
|
}
|
|
12453
|
+
if (_.isArray(value) && $elm.attr('type') === 'checkbox' && $elm.attr('value')) {
|
|
12454
|
+
if (value.includes($elm.attr('value'))) {
|
|
12455
|
+
value = true;
|
|
12456
|
+
} else {
|
|
12457
|
+
value = false;
|
|
12458
|
+
}
|
|
12459
|
+
}
|
|
12641
12460
|
} else {
|
|
12642
12461
|
value = val.value;
|
|
12643
12462
|
}
|
|
@@ -4153,12 +4153,19 @@ func.datasource.run_events_functions = async function (SESSION_ID, dataSourceSes
|
|
|
4153
4153
|
for (let job_num of jobs) {
|
|
4154
4154
|
job_promises.push(
|
|
4155
4155
|
new Promise((resolve, reject) => {
|
|
4156
|
+
let i = 0;
|
|
4156
4157
|
const interval = setInterval(() => {
|
|
4158
|
+
i++;
|
|
4157
4159
|
var job_index = func.events.find_job_index(SESSION_ID, job_num);
|
|
4158
4160
|
if (job_index == null) {
|
|
4159
4161
|
clearInterval(interval);
|
|
4160
4162
|
resolve(job_num);
|
|
4161
4163
|
}
|
|
4164
|
+
if (i > 20) {
|
|
4165
|
+
console.error('deadlock detected');
|
|
4166
|
+
clearInterval(interval);
|
|
4167
|
+
resolve(job_num);
|
|
4168
|
+
}
|
|
4162
4169
|
}, 100);
|
|
4163
4170
|
}),
|
|
4164
4171
|
);
|
|
@@ -4735,201 +4742,6 @@ func.datasource.del = function (SESSION_ID, dsP) {
|
|
|
4735
4742
|
}
|
|
4736
4743
|
perform_delete();
|
|
4737
4744
|
};
|
|
4738
|
-
// func.datasource.update_old = async function (SESSION_ID, datasource_changes, update_local_scope_only, avoid_refresh) {
|
|
4739
|
-
// return new Promise(async (resolve, reject) => {
|
|
4740
|
-
// var _session = SESSION_OBJ[SESSION_ID];
|
|
4741
|
-
|
|
4742
|
-
// if (_session.IS_API || typeof IS_MASTER_WEBSOCKET !== 'undefined' || typeof IS_PROCESS_SERVER !== 'undefined') {
|
|
4743
|
-
// update_local_scope_only = true;
|
|
4744
|
-
// }
|
|
4745
|
-
|
|
4746
|
-
// if (typeof glb.GLOBAL_VARS === 'undefined') {
|
|
4747
|
-
// glb.GLOBAL_VARS = (await func.common.get_module(SESSION_ID, 'xuda-system-globals-module.mjs')).system_globals;
|
|
4748
|
-
// }
|
|
4749
|
-
|
|
4750
|
-
// const set_fieldComputed_dependencies = async function (dsNo, field_id, parent_ds) {
|
|
4751
|
-
// // iterate child ds
|
|
4752
|
-
// for (const [dsSession, _ds] of Object.entries(_session.DS_GLB)) {
|
|
4753
|
-
// if (parent_ds !== null) {
|
|
4754
|
-
// if (_ds.parentDataSourceNo != parent_ds) continue;
|
|
4755
|
-
// } else {
|
|
4756
|
-
// if (dsSession != dsNo) continue;
|
|
4757
|
-
// }
|
|
4758
|
-
// let tree_ret = await func.utils.TREE_OBJ.get(SESSION_ID, _ds.prog_id);
|
|
4759
|
-
// if (tree_ret.menuType === 'component' || tree_ret.menuType === 'globals') {
|
|
4760
|
-
// // check if field has fieldComputed property
|
|
4761
|
-
// const _progFields = await func.datasource.get_progFields(SESSION_ID, dsSession);
|
|
4762
|
-
// // find if field is computed
|
|
4763
|
-
// let fieldComputed_propExpressions, fieldComputed_id;
|
|
4764
|
-
// for await (const val of _progFields) {
|
|
4765
|
-
// const fieldId = val.data.field_id;
|
|
4766
|
-
|
|
4767
|
-
// // if (fieldId !== field_id) continue
|
|
4768
|
-
// if (val.data.type !== 'virtual' || !val.props.fieldComputed) continue;
|
|
4769
|
-
|
|
4770
|
-
// const _propExpressions = val.props?.propExpressions?.fieldValue;
|
|
4771
|
-
// if (_propExpressions && JSON.stringify(_propExpressions).includes(field_id)) {
|
|
4772
|
-
// fieldComputed_propExpressions = _propExpressions;
|
|
4773
|
-
// fieldComputed_id = fieldId;
|
|
4774
|
-
// }
|
|
4775
|
-
// }
|
|
4776
|
-
|
|
4777
|
-
// if (!fieldComputed_id) return;
|
|
4778
|
-
|
|
4779
|
-
// // iterate ds rows
|
|
4780
|
-
// for (const row of _ds.data_feed?.rows || []) {
|
|
4781
|
-
// // iterate row fields
|
|
4782
|
-
// for (const [key, val] of Object.entries(row)) {
|
|
4783
|
-
// if (key !== fieldComputed_id) continue;
|
|
4784
|
-
// try {
|
|
4785
|
-
// let ret = await func.expression.get(SESSION_ID, fieldComputed_propExpressions, dsNo, 'update', row._ROWID);
|
|
4786
|
-
|
|
4787
|
-
// const row_idx = func.common.find_ROWID_idx(_ds, row._ROWID);
|
|
4788
|
-
// if (_ds.data_feed.rows[row_idx][fieldComputed_id] !== ret.result) {
|
|
4789
|
-
// _ds.data_feed.rows[row_idx][fieldComputed_id] = ret.result;
|
|
4790
|
-
// if (!fields_changed.includes(fieldComputed_id)) {
|
|
4791
|
-
// fields_changed.push(fieldComputed_id);
|
|
4792
|
-
// }
|
|
4793
|
-
// if (!datasource_changed.includes(dsSession)) {
|
|
4794
|
-
// datasource_changed.push(dsSession);
|
|
4795
|
-
// }
|
|
4796
|
-
// }
|
|
4797
|
-
// } catch (err) {
|
|
4798
|
-
// console.error(err);
|
|
4799
|
-
// }
|
|
4800
|
-
// }
|
|
4801
|
-
// }
|
|
4802
|
-
// }
|
|
4803
|
-
// await set_fieldComputed_dependencies(dsNo, field_id, dsSession);
|
|
4804
|
-
// }
|
|
4805
|
-
// };
|
|
4806
|
-
|
|
4807
|
-
// var fields_changed = [];
|
|
4808
|
-
// var datasource_changed = [];
|
|
4809
|
-
// let client_datasource_changes = {};
|
|
4810
|
-
// let server_datasource_changes = {};
|
|
4811
|
-
// // iterate changes datasource
|
|
4812
|
-
// for await (const [dataSource, row_data] of Object.entries(datasource_changes)) {
|
|
4813
|
-
// var _ds = _session.DS_GLB[dataSource];
|
|
4814
|
-
// if (!_ds) {
|
|
4815
|
-
// continue;
|
|
4816
|
-
// }
|
|
4817
|
-
|
|
4818
|
-
// const update_xu_ref = async function () {
|
|
4819
|
-
// let _ds_0 = _session.DS_GLB[0];
|
|
4820
|
-
// for ([ref_name, val] of Object.entries(_ds_0.data_system['SYS_GLOBAL_OBJ_REFS'])) {
|
|
4821
|
-
// if (val.ds.dsSession == dataSource) {
|
|
4822
|
-
// func.UI.update_xu_ref(SESSION_ID, dataSource, ref_name);
|
|
4823
|
-
// }
|
|
4824
|
-
// }
|
|
4825
|
-
// };
|
|
4826
|
-
|
|
4827
|
-
// // iterate changes records
|
|
4828
|
-
// for (const [record_id, fields_data] of Object.entries(row_data)) {
|
|
4829
|
-
// // iterate changes fields
|
|
4830
|
-
// for (const [field_id, value] of Object.entries(fields_data)) {
|
|
4831
|
-
// // mechanism to make update directly on the datasource object
|
|
4832
|
-
// if (record_id === 'datasource_main') {
|
|
4833
|
-
// _.set(_ds, field_id, value);
|
|
4834
|
-
// update_xu_ref();
|
|
4835
|
-
// continue;
|
|
4836
|
-
// }
|
|
4837
|
-
|
|
4838
|
-
// if (typeof fields_data === 'object') {
|
|
4839
|
-
// if (glb.GLOBAL_VARS[field_id]) {
|
|
4840
|
-
// _ds.data_system[field_id] = value;
|
|
4841
|
-
// continue;
|
|
4842
|
-
// }
|
|
4843
|
-
|
|
4844
|
-
// // try {
|
|
4845
|
-
// const row_idx = func.common.find_ROWID_idx(_ds, record_id);
|
|
4846
|
-
// if (_ds.data_feed.rows[row_idx][field_id] !== value) {
|
|
4847
|
-
// _ds.data_feed.rows[row_idx][field_id] = value;
|
|
4848
|
-
// await set_fieldComputed_dependencies(dataSource, field_id, null);
|
|
4849
|
-
|
|
4850
|
-
// // search the field in refs
|
|
4851
|
-
// update_xu_ref();
|
|
4852
|
-
|
|
4853
|
-
// if (!update_local_scope_only) {
|
|
4854
|
-
// let tree_ret = await func.utils.TREE_OBJ.get(SESSION_ID, _ds.prog_id);
|
|
4855
|
-
// if (glb.IS_WORKER) {
|
|
4856
|
-
// // RUN AT SERVER
|
|
4857
|
-
// if (tree_ret.menuType === 'globals' || tree_ret.menuType === 'component') {
|
|
4858
|
-
// const _progFields = await func.datasource.get_progFields(SESSION_ID, dataSource);
|
|
4859
|
-
// let view_field_obj = func.common.find_item_by_key(_progFields, 'field_id', field_id);
|
|
4860
|
-
// if (!view_field_obj?.data?.serverField && record_id !== 'data_system') {
|
|
4861
|
-
// if (!client_datasource_changes[dataSource]) {
|
|
4862
|
-
// client_datasource_changes[dataSource] = {};
|
|
4863
|
-
// }
|
|
4864
|
-
// if (!client_datasource_changes[dataSource][record_id]) {
|
|
4865
|
-
// client_datasource_changes[dataSource][record_id] = {};
|
|
4866
|
-
// }
|
|
4867
|
-
// client_datasource_changes[dataSource][record_id][field_id] = value;
|
|
4868
|
-
// }
|
|
4869
|
-
// }
|
|
4870
|
-
// } else {
|
|
4871
|
-
// // RUN AT CLIENT
|
|
4872
|
-
// if ((tree_ret.menuType === 'component' && _ds._run_at !== 'client') || tree_ret.menuType === 'globals') {
|
|
4873
|
-
// if (!server_datasource_changes[dataSource]) {
|
|
4874
|
-
// server_datasource_changes[dataSource] = {};
|
|
4875
|
-
// }
|
|
4876
|
-
// if (!server_datasource_changes[dataSource][record_id]) {
|
|
4877
|
-
// server_datasource_changes[dataSource][record_id] = {};
|
|
4878
|
-
// }
|
|
4879
|
-
// server_datasource_changes[dataSource][record_id][field_id] = value;
|
|
4880
|
-
// }
|
|
4881
|
-
// }
|
|
4882
|
-
// }
|
|
4883
|
-
|
|
4884
|
-
// if (!fields_changed.includes(field_id)) {
|
|
4885
|
-
// fields_changed.push(field_id);
|
|
4886
|
-
// }
|
|
4887
|
-
// if (!datasource_changed.includes(dataSource)) {
|
|
4888
|
-
// datasource_changed.push(dataSource);
|
|
4889
|
-
// }
|
|
4890
|
-
|
|
4891
|
-
// if (!_ds.data_feed.rows_changed) {
|
|
4892
|
-
// _ds.data_feed.rows_changed = [];
|
|
4893
|
-
// }
|
|
4894
|
-
// if (!_ds.data_feed.rows_changed.includes(record_id)) _ds.data_feed.rows_changed.push(record_id);
|
|
4895
|
-
// }
|
|
4896
|
-
// } else if (fields_data === 'set') {
|
|
4897
|
-
// _ds.currentRecordId = record_id;
|
|
4898
|
-
// }
|
|
4899
|
-
// }
|
|
4900
|
-
// }
|
|
4901
|
-
// }
|
|
4902
|
-
|
|
4903
|
-
// if (glb.IS_WORKER) {
|
|
4904
|
-
// if (!update_local_scope_only && !_.isEmpty(client_datasource_changes)) {
|
|
4905
|
-
// func.utils.post_back_to_client(SESSION_ID, 'update_client_eventChangesResults_from_worker', _session.worker_id, client_datasource_changes);
|
|
4906
|
-
// }
|
|
4907
|
-
// } else {
|
|
4908
|
-
// if (!update_local_scope_only && !_.isEmpty(server_datasource_changes)) {
|
|
4909
|
-
// const ret = await func.index.call_worker(SESSION_ID, {
|
|
4910
|
-
// service: 'update_datasource_changes_from_client',
|
|
4911
|
-
// data: {
|
|
4912
|
-
// session_id: SESSION_ID,
|
|
4913
|
-
// datasource_changes: server_datasource_changes,
|
|
4914
|
-
// },
|
|
4915
|
-
// id: _ds.worker_id,
|
|
4916
|
-
// });
|
|
4917
|
-
// }
|
|
4918
|
-
// ///// REFRESH SCREEN
|
|
4919
|
-
// if (!avoid_refresh && fields_changed.length) {
|
|
4920
|
-
// await func.UI.screen.refresh_xu_attributes(SESSION_ID, fields_changed);
|
|
4921
|
-
// // await removed from the below function cause to dead lock Mar 3 25
|
|
4922
|
-
// func.UI.screen.refresh_screen(
|
|
4923
|
-
// SESSION_ID,
|
|
4924
|
-
// fields_changed,
|
|
4925
|
-
// null,
|
|
4926
|
-
// datasource_changed[0], // refresh the current datasource only
|
|
4927
|
-
// );
|
|
4928
|
-
// }
|
|
4929
|
-
// }
|
|
4930
|
-
// resolve();
|
|
4931
|
-
// });
|
|
4932
|
-
// };
|
|
4933
4745
|
|
|
4934
4746
|
func.datasource.update = async function (SESSION_ID, datasource_changes, update_local_scope_only, avoid_refresh) {
|
|
4935
4747
|
return new Promise(async (resolve, reject) => {
|
|
@@ -10360,6 +10172,13 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
|
|
|
10360
10172
|
const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
|
|
10361
10173
|
value = _ds.data_feed.rows?.[row_idx]?.[val.value];
|
|
10362
10174
|
}
|
|
10175
|
+
if (_.isArray(value) && $elm.attr('type') === 'checkbox' && $elm.attr('value')) {
|
|
10176
|
+
if (value.includes($elm.attr('value'))) {
|
|
10177
|
+
value = true;
|
|
10178
|
+
} else {
|
|
10179
|
+
value = false;
|
|
10180
|
+
}
|
|
10181
|
+
}
|
|
10363
10182
|
} else {
|
|
10364
10183
|
value = val.value;
|
|
10365
10184
|
}
|