@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.
@@ -29278,12 +29278,19 @@ func.datasource.run_events_functions = async function (SESSION_ID, dataSourceSes
29278
29278
  for (let job_num of jobs) {
29279
29279
  job_promises.push(
29280
29280
  new Promise((resolve, reject) => {
29281
+ let i = 0;
29281
29282
  const interval = setInterval(() => {
29283
+ i++;
29282
29284
  var job_index = func.events.find_job_index(SESSION_ID, job_num);
29283
29285
  if (job_index == null) {
29284
29286
  clearInterval(interval);
29285
29287
  resolve(job_num);
29286
29288
  }
29289
+ if (i > 20) {
29290
+ console.error('deadlock detected');
29291
+ clearInterval(interval);
29292
+ resolve(job_num);
29293
+ }
29287
29294
  }, 100);
29288
29295
  }),
29289
29296
  );
@@ -29860,201 +29867,6 @@ func.datasource.del = function (SESSION_ID, dsP) {
29860
29867
  }
29861
29868
  perform_delete();
29862
29869
  };
29863
- // func.datasource.update_old = async function (SESSION_ID, datasource_changes, update_local_scope_only, avoid_refresh) {
29864
- // return new Promise(async (resolve, reject) => {
29865
- // var _session = SESSION_OBJ[SESSION_ID];
29866
-
29867
- // if (_session.IS_API || typeof IS_MASTER_WEBSOCKET !== 'undefined' || typeof IS_PROCESS_SERVER !== 'undefined') {
29868
- // update_local_scope_only = true;
29869
- // }
29870
-
29871
- // if (typeof glb.GLOBAL_VARS === 'undefined') {
29872
- // glb.GLOBAL_VARS = (await func.common.get_module(SESSION_ID, 'xuda-system-globals-module.mjs')).system_globals;
29873
- // }
29874
-
29875
- // const set_fieldComputed_dependencies = async function (dsNo, field_id, parent_ds) {
29876
- // // iterate child ds
29877
- // for (const [dsSession, _ds] of Object.entries(_session.DS_GLB)) {
29878
- // if (parent_ds !== null) {
29879
- // if (_ds.parentDataSourceNo != parent_ds) continue;
29880
- // } else {
29881
- // if (dsSession != dsNo) continue;
29882
- // }
29883
- // let tree_ret = await func.utils.TREE_OBJ.get(SESSION_ID, _ds.prog_id);
29884
- // if (tree_ret.menuType === 'component' || tree_ret.menuType === 'globals') {
29885
- // // check if field has fieldComputed property
29886
- // const _progFields = await func.datasource.get_progFields(SESSION_ID, dsSession);
29887
- // // find if field is computed
29888
- // let fieldComputed_propExpressions, fieldComputed_id;
29889
- // for await (const val of _progFields) {
29890
- // const fieldId = val.data.field_id;
29891
-
29892
- // // if (fieldId !== field_id) continue
29893
- // if (val.data.type !== 'virtual' || !val.props.fieldComputed) continue;
29894
-
29895
- // const _propExpressions = val.props?.propExpressions?.fieldValue;
29896
- // if (_propExpressions && JSON.stringify(_propExpressions).includes(field_id)) {
29897
- // fieldComputed_propExpressions = _propExpressions;
29898
- // fieldComputed_id = fieldId;
29899
- // }
29900
- // }
29901
-
29902
- // if (!fieldComputed_id) return;
29903
-
29904
- // // iterate ds rows
29905
- // for (const row of _ds.data_feed?.rows || []) {
29906
- // // iterate row fields
29907
- // for (const [key, val] of Object.entries(row)) {
29908
- // if (key !== fieldComputed_id) continue;
29909
- // try {
29910
- // let ret = await func.expression.get(SESSION_ID, fieldComputed_propExpressions, dsNo, 'update', row._ROWID);
29911
-
29912
- // const row_idx = func.common.find_ROWID_idx(_ds, row._ROWID);
29913
- // if (_ds.data_feed.rows[row_idx][fieldComputed_id] !== ret.result) {
29914
- // _ds.data_feed.rows[row_idx][fieldComputed_id] = ret.result;
29915
- // if (!fields_changed.includes(fieldComputed_id)) {
29916
- // fields_changed.push(fieldComputed_id);
29917
- // }
29918
- // if (!datasource_changed.includes(dsSession)) {
29919
- // datasource_changed.push(dsSession);
29920
- // }
29921
- // }
29922
- // } catch (err) {
29923
- // console.error(err);
29924
- // }
29925
- // }
29926
- // }
29927
- // }
29928
- // await set_fieldComputed_dependencies(dsNo, field_id, dsSession);
29929
- // }
29930
- // };
29931
-
29932
- // var fields_changed = [];
29933
- // var datasource_changed = [];
29934
- // let client_datasource_changes = {};
29935
- // let server_datasource_changes = {};
29936
- // // iterate changes datasource
29937
- // for await (const [dataSource, row_data] of Object.entries(datasource_changes)) {
29938
- // var _ds = _session.DS_GLB[dataSource];
29939
- // if (!_ds) {
29940
- // continue;
29941
- // }
29942
-
29943
- // const update_xu_ref = async function () {
29944
- // let _ds_0 = _session.DS_GLB[0];
29945
- // for ([ref_name, val] of Object.entries(_ds_0.data_system['SYS_GLOBAL_OBJ_REFS'])) {
29946
- // if (val.ds.dsSession == dataSource) {
29947
- // func.UI.update_xu_ref(SESSION_ID, dataSource, ref_name);
29948
- // }
29949
- // }
29950
- // };
29951
-
29952
- // // iterate changes records
29953
- // for (const [record_id, fields_data] of Object.entries(row_data)) {
29954
- // // iterate changes fields
29955
- // for (const [field_id, value] of Object.entries(fields_data)) {
29956
- // // mechanism to make update directly on the datasource object
29957
- // if (record_id === 'datasource_main') {
29958
- // _.set(_ds, field_id, value);
29959
- // update_xu_ref();
29960
- // continue;
29961
- // }
29962
-
29963
- // if (typeof fields_data === 'object') {
29964
- // if (glb.GLOBAL_VARS[field_id]) {
29965
- // _ds.data_system[field_id] = value;
29966
- // continue;
29967
- // }
29968
-
29969
- // // try {
29970
- // const row_idx = func.common.find_ROWID_idx(_ds, record_id);
29971
- // if (_ds.data_feed.rows[row_idx][field_id] !== value) {
29972
- // _ds.data_feed.rows[row_idx][field_id] = value;
29973
- // await set_fieldComputed_dependencies(dataSource, field_id, null);
29974
-
29975
- // // search the field in refs
29976
- // update_xu_ref();
29977
-
29978
- // if (!update_local_scope_only) {
29979
- // let tree_ret = await func.utils.TREE_OBJ.get(SESSION_ID, _ds.prog_id);
29980
- // if (glb.IS_WORKER) {
29981
- // // RUN AT SERVER
29982
- // if (tree_ret.menuType === 'globals' || tree_ret.menuType === 'component') {
29983
- // const _progFields = await func.datasource.get_progFields(SESSION_ID, dataSource);
29984
- // let view_field_obj = func.common.find_item_by_key(_progFields, 'field_id', field_id);
29985
- // if (!view_field_obj?.data?.serverField && record_id !== 'data_system') {
29986
- // if (!client_datasource_changes[dataSource]) {
29987
- // client_datasource_changes[dataSource] = {};
29988
- // }
29989
- // if (!client_datasource_changes[dataSource][record_id]) {
29990
- // client_datasource_changes[dataSource][record_id] = {};
29991
- // }
29992
- // client_datasource_changes[dataSource][record_id][field_id] = value;
29993
- // }
29994
- // }
29995
- // } else {
29996
- // // RUN AT CLIENT
29997
- // if ((tree_ret.menuType === 'component' && _ds._run_at !== 'client') || tree_ret.menuType === 'globals') {
29998
- // if (!server_datasource_changes[dataSource]) {
29999
- // server_datasource_changes[dataSource] = {};
30000
- // }
30001
- // if (!server_datasource_changes[dataSource][record_id]) {
30002
- // server_datasource_changes[dataSource][record_id] = {};
30003
- // }
30004
- // server_datasource_changes[dataSource][record_id][field_id] = value;
30005
- // }
30006
- // }
30007
- // }
30008
-
30009
- // if (!fields_changed.includes(field_id)) {
30010
- // fields_changed.push(field_id);
30011
- // }
30012
- // if (!datasource_changed.includes(dataSource)) {
30013
- // datasource_changed.push(dataSource);
30014
- // }
30015
-
30016
- // if (!_ds.data_feed.rows_changed) {
30017
- // _ds.data_feed.rows_changed = [];
30018
- // }
30019
- // if (!_ds.data_feed.rows_changed.includes(record_id)) _ds.data_feed.rows_changed.push(record_id);
30020
- // }
30021
- // } else if (fields_data === 'set') {
30022
- // _ds.currentRecordId = record_id;
30023
- // }
30024
- // }
30025
- // }
30026
- // }
30027
-
30028
- // if (glb.IS_WORKER) {
30029
- // if (!update_local_scope_only && !_.isEmpty(client_datasource_changes)) {
30030
- // func.utils.post_back_to_client(SESSION_ID, 'update_client_eventChangesResults_from_worker', _session.worker_id, client_datasource_changes);
30031
- // }
30032
- // } else {
30033
- // if (!update_local_scope_only && !_.isEmpty(server_datasource_changes)) {
30034
- // const ret = await func.index.call_worker(SESSION_ID, {
30035
- // service: 'update_datasource_changes_from_client',
30036
- // data: {
30037
- // session_id: SESSION_ID,
30038
- // datasource_changes: server_datasource_changes,
30039
- // },
30040
- // id: _ds.worker_id,
30041
- // });
30042
- // }
30043
- // ///// REFRESH SCREEN
30044
- // if (!avoid_refresh && fields_changed.length) {
30045
- // await func.UI.screen.refresh_xu_attributes(SESSION_ID, fields_changed);
30046
- // // await removed from the below function cause to dead lock Mar 3 25
30047
- // func.UI.screen.refresh_screen(
30048
- // SESSION_ID,
30049
- // fields_changed,
30050
- // null,
30051
- // datasource_changed[0], // refresh the current datasource only
30052
- // );
30053
- // }
30054
- // }
30055
- // resolve();
30056
- // });
30057
- // };
30058
29870
 
30059
29871
  func.datasource.update = async function (SESSION_ID, datasource_changes, update_local_scope_only, avoid_refresh) {
30060
29872
  return new Promise(async (resolve, reject) => {
@@ -32319,6 +32131,13 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
32319
32131
  const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
32320
32132
  value = _ds.data_feed.rows?.[row_idx]?.[val.value];
32321
32133
  }
32134
+ if (_.isArray(value) && $elm.attr('type') === 'checkbox' && $elm.attr('value')) {
32135
+ if (value.includes($elm.attr('value'))) {
32136
+ value = true;
32137
+ } else {
32138
+ value = false;
32139
+ }
32140
+ }
32322
32141
  } else {
32323
32142
  value = val.value;
32324
32143
  }