@xuda.io/runtime-bundle 1.0.389 → 1.0.390

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.
@@ -28221,6 +28221,22 @@ func.UI.refs_garbage_collector = function (SESSION_ID = Object.keys(SESSION_OBJ)
28221
28221
  }
28222
28222
  }
28223
28223
  };
28224
+
28225
+ func.UI.update_xu_ref = function (SESSION_ID, dsSessionP) {
28226
+ const _session = SESSION_OBJ[SESSION_ID];
28227
+ let _ds_0 = _session.DS_GLB[0];
28228
+
28229
+ const _ds = func.utils.clean_returned_datasource(SESSION_ID, dsSessionP);
28230
+
28231
+ const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
28232
+ const data = _ds?.data_feed?.rows?.[row_idx] || {};
28233
+
28234
+ const props = _ds.in_parameters || {};
28235
+ const attributes = $elm?.data()?.xuData?.properties || {};
28236
+ const xu_ui_id = $elm.attr('xu-ui-id');
28237
+
28238
+ _ds_0.data_system['SYS_GLOBAL_OBJ_REFS'][val.value] = { ds: _ds, data, attributes, props, xu_ui_id };
28239
+ };
28224
28240
  func.datasource = {};
28225
28241
  func.datasource.create = async function (
28226
28242
  SESSION_ID,
@@ -30119,15 +30135,16 @@ func.datasource.update = async function (SESSION_ID, datasource_changes, update_
30119
30135
  _ds.data_feed.rows[row_idx][field_id] = value;
30120
30136
  await set_fieldComputed_dependencies(dataSource, field_id, null);
30121
30137
 
30122
- // // search the field in refs
30123
- // let _ds_0 = _session.DS_GLB[0];
30124
- // for ([ref_name, val] of Object.entries(_ds_0.data_system['SYS_GLOBAL_OBJ_REFS'])) {
30125
- // if (val.ds.dsSession == dataSource) {
30126
- // if (!fields_changed.includes(ref_name)) {
30127
- // fields_changed.push(ref_name);
30128
- // }
30129
- // }
30130
- // }
30138
+ // search the field in refs
30139
+ let _ds_0 = _session.DS_GLB[0];
30140
+ for ([ref_name, val] of Object.entries(_ds_0.data_system['SYS_GLOBAL_OBJ_REFS'])) {
30141
+ if (val.ds.dsSession == dataSource) {
30142
+ func.UI.update_xu_ref(SESSION_ID, dataSource);
30143
+ // if (!fields_changed.includes(ref_name)) {
30144
+ // fields_changed.push(ref_name);
30145
+ // }
30146
+ }
30147
+ }
30131
30148
 
30132
30149
  if (!update_local_scope_only) {
30133
30150
  let tree_ret = await func.utils.TREE_OBJ.get(SESSION_ID, _ds.prog_id);
@@ -31961,20 +31978,21 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
31961
31978
 
31962
31979
  const common_fx = {
31963
31980
  'xu-ref': async function ($elm, val) {
31964
- const _session = SESSION_OBJ[SESSION_ID];
31965
- let _ds_0 = _session.DS_GLB[0];
31981
+ func.UI.update_xu_ref(SESSION_ID, paramsP.dsSessionP);
31982
+ // const _session = SESSION_OBJ[SESSION_ID];
31983
+ // let _ds_0 = _session.DS_GLB[0];
31966
31984
 
31967
- const _ds = func.utils.clean_returned_datasource(SESSION_ID, paramsP.dsSessionP);
31985
+ // const _ds = func.utils.clean_returned_datasource(SESSION_ID, paramsP.dsSessionP);
31968
31986
 
31969
- const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
31970
- const data = _ds?.data_feed?.rows?.[row_idx] || {};
31987
+ // const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
31988
+ // const data = _ds?.data_feed?.rows?.[row_idx] || {};
31971
31989
 
31972
- const props = _ds.in_parameters || {};
31973
- const attributes = $elm?.data()?.xuData?.properties || {};
31974
- const xu_ui_id = $elm.attr('xu-ui-id');
31990
+ // const props = _ds.in_parameters || {};
31991
+ // const attributes = $elm?.data()?.xuData?.properties || {};
31992
+ // const xu_ui_id = $elm.attr('xu-ui-id');
31975
31993
 
31976
- // _ds_0.data_system['SYS_GLOBAL_OBJ_REFS'][val.value] = { $el: $elm, ds: _ds, data, attributes, props };
31977
- _ds_0.data_system['SYS_GLOBAL_OBJ_REFS'][val.value] = { ds: _ds, data, attributes, props, xu_ui_id };
31994
+ // // _ds_0.data_system['SYS_GLOBAL_OBJ_REFS'][val.value] = { $el: $elm, ds: _ds, data, attributes, props };
31995
+ // _ds_0.data_system['SYS_GLOBAL_OBJ_REFS'][val.value] = { ds: _ds, data, attributes, props, xu_ui_id };
31978
31996
 
31979
31997
  // const proxy1 = new Proxy(_session.DS_GLB[paramsP.dsSessionP], {
31980
31998
  // get(target, prop, receiver) {
@@ -31999,64 +32017,64 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
31999
32017
  // childList: true,
32000
32018
  // });
32001
32019
  //==================
32002
- class ObjectObserver {
32003
- constructor(targetObject, callback) {
32004
- this.callback = callback;
32005
- this.target = targetObject;
32006
-
32007
- // Create a proxy to intercept property access and modifications
32008
- this.proxy = new Proxy(targetObject, {
32009
- set: (target, property, value) => {
32010
- const oldValue = target[property];
32011
- target[property] = value;
32012
-
32013
- // Call the callback with mutation information
32014
- this.callback({
32015
- type: 'update',
32016
- object: target,
32017
- property,
32018
- oldValue,
32019
- newValue: value,
32020
- });
32021
-
32022
- return true;
32023
- },
32024
-
32025
- deleteProperty: (target, property) => {
32026
- const oldValue = target[property];
32027
- const deleted = delete target[property];
32028
-
32029
- if (deleted) {
32030
- this.callback({
32031
- type: 'delete',
32032
- object: target,
32033
- property,
32034
- oldValue,
32035
- });
32036
- }
32037
-
32038
- return deleted;
32039
- },
32040
- });
32041
-
32042
- return this.proxy;
32043
- }
32020
+ // class ObjectObserver {
32021
+ // constructor(targetObject, callback) {
32022
+ // this.callback = callback;
32023
+ // this.target = targetObject;
32024
+
32025
+ // // Create a proxy to intercept property access and modifications
32026
+ // this.proxy = new Proxy(targetObject, {
32027
+ // set: (target, property, value) => {
32028
+ // const oldValue = target[property];
32029
+ // target[property] = value;
32030
+
32031
+ // // Call the callback with mutation information
32032
+ // this.callback({
32033
+ // type: 'update',
32034
+ // object: target,
32035
+ // property,
32036
+ // oldValue,
32037
+ // newValue: value,
32038
+ // });
32039
+
32040
+ // return true;
32041
+ // },
32042
+
32043
+ // deleteProperty: (target, property) => {
32044
+ // const oldValue = target[property];
32045
+ // const deleted = delete target[property];
32046
+
32047
+ // if (deleted) {
32048
+ // this.callback({
32049
+ // type: 'delete',
32050
+ // object: target,
32051
+ // property,
32052
+ // oldValue,
32053
+ // });
32054
+ // }
32055
+
32056
+ // return deleted;
32057
+ // },
32058
+ // });
32059
+
32060
+ // return this.proxy;
32061
+ // }
32044
32062
 
32045
- // Method to stop observing (for cleanup)
32046
- disconnect() {
32047
- this.callback = null;
32048
- this.target = null;
32049
- this.proxy = null;
32050
- }
32051
- }
32063
+ // // Method to stop observing (for cleanup)
32064
+ // disconnect() {
32065
+ // this.callback = null;
32066
+ // this.target = null;
32067
+ // this.proxy = null;
32068
+ // }
32069
+ // }
32052
32070
 
32053
- // Usage example:
32054
- const originalObject = _session.DS_GLB[paramsP.dsSessionP];
32071
+ // // Usage example:
32072
+ // const originalObject = _session.DS_GLB[paramsP.dsSessionP];
32055
32073
 
32056
- // Create observer with callback
32057
- const observedObject = new ObjectObserver(originalObject, (mutation) => {
32058
- console.log('Change detected:', mutation);
32059
- });
32074
+ // // Create observer with callback
32075
+ // const observedObject = new ObjectObserver(originalObject, (mutation) => {
32076
+ // console.log('Change detected:', mutation);
32077
+ // });
32060
32078
 
32061
32079
  // // These operations will trigger the callback
32062
32080
  // observedObject.name = "Jane"; // Property update