@xuda.io/runtime-bundle 1.0.389 → 1.0.391

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,32 @@ 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, $elm) {
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
+ let SYS_GLOBAL_OBJ_REFS = _ds_0.data_system['SYS_GLOBAL_OBJ_REFS'][val.value];
28235
+
28236
+ if (!SYS_GLOBAL_OBJ_REFS) {
28237
+ SYS_GLOBAL_OBJ_REFS = { ds: _ds, data };
28238
+ } else {
28239
+ SYS_GLOBAL_OBJ_REFS.ds = _ds;
28240
+ SYS_GLOBAL_OBJ_REFS.data = data;
28241
+
28242
+ if ($elm) {
28243
+ // const props = _ds.in_parameters || {};
28244
+ // const attributes = $elm?.data()?.xuData?.properties || {};
28245
+
28246
+ SYS_GLOBAL_OBJ_REFS.xu_ui_id = $elm.attr('xu-ui-id');
28247
+ }
28248
+ }
28249
+ };
28224
28250
  func.datasource = {};
28225
28251
  func.datasource.create = async function (
28226
28252
  SESSION_ID,
@@ -30119,15 +30145,16 @@ func.datasource.update = async function (SESSION_ID, datasource_changes, update_
30119
30145
  _ds.data_feed.rows[row_idx][field_id] = value;
30120
30146
  await set_fieldComputed_dependencies(dataSource, field_id, null);
30121
30147
 
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
- // }
30148
+ // search the field in refs
30149
+ let _ds_0 = _session.DS_GLB[0];
30150
+ for ([ref_name, val] of Object.entries(_ds_0.data_system['SYS_GLOBAL_OBJ_REFS'])) {
30151
+ if (val.ds.dsSession == dataSource) {
30152
+ func.UI.update_xu_ref(SESSION_ID, dataSource);
30153
+ // if (!fields_changed.includes(ref_name)) {
30154
+ // fields_changed.push(ref_name);
30155
+ // }
30156
+ }
30157
+ }
30131
30158
 
30132
30159
  if (!update_local_scope_only) {
30133
30160
  let tree_ret = await func.utils.TREE_OBJ.get(SESSION_ID, _ds.prog_id);
@@ -31961,20 +31988,21 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
31961
31988
 
31962
31989
  const common_fx = {
31963
31990
  'xu-ref': async function ($elm, val) {
31964
- const _session = SESSION_OBJ[SESSION_ID];
31965
- let _ds_0 = _session.DS_GLB[0];
31991
+ func.UI.update_xu_ref(SESSION_ID, paramsP.dsSessionP, $elm);
31992
+ // const _session = SESSION_OBJ[SESSION_ID];
31993
+ // let _ds_0 = _session.DS_GLB[0];
31966
31994
 
31967
- const _ds = func.utils.clean_returned_datasource(SESSION_ID, paramsP.dsSessionP);
31995
+ // const _ds = func.utils.clean_returned_datasource(SESSION_ID, paramsP.dsSessionP);
31968
31996
 
31969
- const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
31970
- const data = _ds?.data_feed?.rows?.[row_idx] || {};
31997
+ // const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
31998
+ // const data = _ds?.data_feed?.rows?.[row_idx] || {};
31971
31999
 
31972
- const props = _ds.in_parameters || {};
31973
- const attributes = $elm?.data()?.xuData?.properties || {};
31974
- const xu_ui_id = $elm.attr('xu-ui-id');
32000
+ // const props = _ds.in_parameters || {};
32001
+ // const attributes = $elm?.data()?.xuData?.properties || {};
32002
+ // const xu_ui_id = $elm.attr('xu-ui-id');
31975
32003
 
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 };
32004
+ // // _ds_0.data_system['SYS_GLOBAL_OBJ_REFS'][val.value] = { $el: $elm, ds: _ds, data, attributes, props };
32005
+ // _ds_0.data_system['SYS_GLOBAL_OBJ_REFS'][val.value] = { ds: _ds, data, attributes, props, xu_ui_id };
31978
32006
 
31979
32007
  // const proxy1 = new Proxy(_session.DS_GLB[paramsP.dsSessionP], {
31980
32008
  // get(target, prop, receiver) {
@@ -31999,64 +32027,64 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
31999
32027
  // childList: true,
32000
32028
  // });
32001
32029
  //==================
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
- }
32030
+ // class ObjectObserver {
32031
+ // constructor(targetObject, callback) {
32032
+ // this.callback = callback;
32033
+ // this.target = targetObject;
32034
+
32035
+ // // Create a proxy to intercept property access and modifications
32036
+ // this.proxy = new Proxy(targetObject, {
32037
+ // set: (target, property, value) => {
32038
+ // const oldValue = target[property];
32039
+ // target[property] = value;
32040
+
32041
+ // // Call the callback with mutation information
32042
+ // this.callback({
32043
+ // type: 'update',
32044
+ // object: target,
32045
+ // property,
32046
+ // oldValue,
32047
+ // newValue: value,
32048
+ // });
32049
+
32050
+ // return true;
32051
+ // },
32052
+
32053
+ // deleteProperty: (target, property) => {
32054
+ // const oldValue = target[property];
32055
+ // const deleted = delete target[property];
32056
+
32057
+ // if (deleted) {
32058
+ // this.callback({
32059
+ // type: 'delete',
32060
+ // object: target,
32061
+ // property,
32062
+ // oldValue,
32063
+ // });
32064
+ // }
32065
+
32066
+ // return deleted;
32067
+ // },
32068
+ // });
32069
+
32070
+ // return this.proxy;
32071
+ // }
32044
32072
 
32045
- // Method to stop observing (for cleanup)
32046
- disconnect() {
32047
- this.callback = null;
32048
- this.target = null;
32049
- this.proxy = null;
32050
- }
32051
- }
32073
+ // // Method to stop observing (for cleanup)
32074
+ // disconnect() {
32075
+ // this.callback = null;
32076
+ // this.target = null;
32077
+ // this.proxy = null;
32078
+ // }
32079
+ // }
32052
32080
 
32053
- // Usage example:
32054
- const originalObject = _session.DS_GLB[paramsP.dsSessionP];
32081
+ // // Usage example:
32082
+ // const originalObject = _session.DS_GLB[paramsP.dsSessionP];
32055
32083
 
32056
- // Create observer with callback
32057
- const observedObject = new ObjectObserver(originalObject, (mutation) => {
32058
- console.log('Change detected:', mutation);
32059
- });
32084
+ // // Create observer with callback
32085
+ // const observedObject = new ObjectObserver(originalObject, (mutation) => {
32086
+ // console.log('Change detected:', mutation);
32087
+ // });
32060
32088
 
32061
32089
  // // These operations will trigger the callback
32062
32090
  // observedObject.name = "Jane"; // Property update