@xuda.io/runtime-bundle 1.0.656 → 1.0.658

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