@xuda.io/runtime-bundle 1.0.388 → 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.
@@ -5142,15 +5142,16 @@ func.datasource.update = async function (SESSION_ID, datasource_changes, update_
5142
5142
  _ds.data_feed.rows[row_idx][field_id] = value;
5143
5143
  await set_fieldComputed_dependencies(dataSource, field_id, null);
5144
5144
 
5145
- // // search the field in refs
5146
- // let _ds_0 = _session.DS_GLB[0];
5147
- // for ([ref_name, val] of Object.entries(_ds_0.data_system['SYS_GLOBAL_OBJ_REFS'])) {
5148
- // if (val.ds.dsSession == dataSource) {
5149
- // if (!fields_changed.includes(ref_name)) {
5150
- // fields_changed.push(ref_name);
5151
- // }
5152
- // }
5153
- // }
5145
+ // search the field in refs
5146
+ let _ds_0 = _session.DS_GLB[0];
5147
+ for ([ref_name, val] of Object.entries(_ds_0.data_system['SYS_GLOBAL_OBJ_REFS'])) {
5148
+ if (val.ds.dsSession == dataSource) {
5149
+ func.UI.update_xu_ref(SESSION_ID, dataSource);
5150
+ // if (!fields_changed.includes(ref_name)) {
5151
+ // fields_changed.push(ref_name);
5152
+ // }
5153
+ }
5154
+ }
5154
5155
 
5155
5156
  if (!update_local_scope_only) {
5156
5157
  let tree_ret = await func.utils.TREE_OBJ.get(SESSION_ID, _ds.prog_id);
@@ -9041,6 +9042,22 @@ func.UI.refs_garbage_collector = function (SESSION_ID = Object.keys(SESSION_OBJ)
9041
9042
  }
9042
9043
  }
9043
9044
  };
9045
+
9046
+ func.UI.update_xu_ref = function (SESSION_ID, dsSessionP) {
9047
+ const _session = SESSION_OBJ[SESSION_ID];
9048
+ let _ds_0 = _session.DS_GLB[0];
9049
+
9050
+ const _ds = func.utils.clean_returned_datasource(SESSION_ID, dsSessionP);
9051
+
9052
+ const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
9053
+ const data = _ds?.data_feed?.rows?.[row_idx] || {};
9054
+
9055
+ const props = _ds.in_parameters || {};
9056
+ const attributes = $elm?.data()?.xuData?.properties || {};
9057
+ const xu_ui_id = $elm.attr('xu-ui-id');
9058
+
9059
+ _ds_0.data_system['SYS_GLOBAL_OBJ_REFS'][val.value] = { ds: _ds, data, attributes, props, xu_ui_id };
9060
+ };
9044
9061
  func.events = {};
9045
9062
  func.events.validate = async function (SESSION_ID, triggerP, dsSessionP, eventIdP, sourceP, argumentsP, return_validation_onlyP) {
9046
9063
  var _session = SESSION_OBJ[SESSION_ID];
@@ -11929,20 +11946,21 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
11929
11946
 
11930
11947
  const common_fx = {
11931
11948
  'xu-ref': async function ($elm, val) {
11932
- const _session = SESSION_OBJ[SESSION_ID];
11933
- let _ds_0 = _session.DS_GLB[0];
11949
+ func.UI.update_xu_ref(SESSION_ID, paramsP.dsSessionP);
11950
+ // const _session = SESSION_OBJ[SESSION_ID];
11951
+ // let _ds_0 = _session.DS_GLB[0];
11934
11952
 
11935
- const _ds = func.utils.clean_returned_datasource(SESSION_ID, paramsP.dsSessionP);
11953
+ // const _ds = func.utils.clean_returned_datasource(SESSION_ID, paramsP.dsSessionP);
11936
11954
 
11937
- const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
11938
- const data = _ds?.data_feed?.rows?.[row_idx] || {};
11955
+ // const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
11956
+ // const data = _ds?.data_feed?.rows?.[row_idx] || {};
11939
11957
 
11940
- const props = _ds.in_parameters || {};
11941
- const attributes = $elm?.data()?.xuData?.properties || {};
11942
- const xu_ui_id = $elm.attr('xu-ui-id');
11958
+ // const props = _ds.in_parameters || {};
11959
+ // const attributes = $elm?.data()?.xuData?.properties || {};
11960
+ // const xu_ui_id = $elm.attr('xu-ui-id');
11943
11961
 
11944
- // _ds_0.data_system['SYS_GLOBAL_OBJ_REFS'][val.value] = { $el: $elm, ds: _ds, data, attributes, props };
11945
- _ds_0.data_system['SYS_GLOBAL_OBJ_REFS'][val.value] = { ds: _ds, data, attributes, props, xu_ui_id };
11962
+ // // _ds_0.data_system['SYS_GLOBAL_OBJ_REFS'][val.value] = { $el: $elm, ds: _ds, data, attributes, props };
11963
+ // _ds_0.data_system['SYS_GLOBAL_OBJ_REFS'][val.value] = { ds: _ds, data, attributes, props, xu_ui_id };
11946
11964
 
11947
11965
  // const proxy1 = new Proxy(_session.DS_GLB[paramsP.dsSessionP], {
11948
11966
  // get(target, prop, receiver) {
@@ -11957,15 +11975,80 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
11957
11975
 
11958
11976
  // create a new instance of `MutationObserver` named `observer`,
11959
11977
  // passing it a callback function
11960
- const observer = new MutationObserver(() => {
11961
- console.log('callback that runs when observer is triggered');
11962
- });
11978
+ // const observer = new MutationObserver(() => {
11979
+ // console.log('callback that runs when observer is triggered');
11980
+ // });
11963
11981
 
11964
- // call `observe()`, passing it the element to observe, and the options object
11965
- observer.observe(_session.DS_GLB[paramsP.dsSessionP], {
11966
- subtree: true,
11967
- childList: true,
11968
- });
11982
+ // // call `observe()`, passing it the element to observe, and the options object
11983
+ // observer.observe(_session.DS_GLB[paramsP.dsSessionP], {
11984
+ // subtree: true,
11985
+ // childList: true,
11986
+ // });
11987
+ //==================
11988
+ // class ObjectObserver {
11989
+ // constructor(targetObject, callback) {
11990
+ // this.callback = callback;
11991
+ // this.target = targetObject;
11992
+
11993
+ // // Create a proxy to intercept property access and modifications
11994
+ // this.proxy = new Proxy(targetObject, {
11995
+ // set: (target, property, value) => {
11996
+ // const oldValue = target[property];
11997
+ // target[property] = value;
11998
+
11999
+ // // Call the callback with mutation information
12000
+ // this.callback({
12001
+ // type: 'update',
12002
+ // object: target,
12003
+ // property,
12004
+ // oldValue,
12005
+ // newValue: value,
12006
+ // });
12007
+
12008
+ // return true;
12009
+ // },
12010
+
12011
+ // deleteProperty: (target, property) => {
12012
+ // const oldValue = target[property];
12013
+ // const deleted = delete target[property];
12014
+
12015
+ // if (deleted) {
12016
+ // this.callback({
12017
+ // type: 'delete',
12018
+ // object: target,
12019
+ // property,
12020
+ // oldValue,
12021
+ // });
12022
+ // }
12023
+
12024
+ // return deleted;
12025
+ // },
12026
+ // });
12027
+
12028
+ // return this.proxy;
12029
+ // }
12030
+
12031
+ // // Method to stop observing (for cleanup)
12032
+ // disconnect() {
12033
+ // this.callback = null;
12034
+ // this.target = null;
12035
+ // this.proxy = null;
12036
+ // }
12037
+ // }
12038
+
12039
+ // // Usage example:
12040
+ // const originalObject = _session.DS_GLB[paramsP.dsSessionP];
12041
+
12042
+ // // Create observer with callback
12043
+ // const observedObject = new ObjectObserver(originalObject, (mutation) => {
12044
+ // console.log('Change detected:', mutation);
12045
+ // });
12046
+
12047
+ // // These operations will trigger the callback
12048
+ // observedObject.name = "Jane"; // Property update
12049
+ // observedObject.job = "Developer"; // Property addition
12050
+ // delete observedObject.age; // Property deletion
12051
+ //==================
11969
12052
 
11970
12053
  return {};
11971
12054
  },
@@ -5143,15 +5143,16 @@ func.datasource.update = async function (SESSION_ID, datasource_changes, update_
5143
5143
  _ds.data_feed.rows[row_idx][field_id] = value;
5144
5144
  await set_fieldComputed_dependencies(dataSource, field_id, null);
5145
5145
 
5146
- // // search the field in refs
5147
- // let _ds_0 = _session.DS_GLB[0];
5148
- // for ([ref_name, val] of Object.entries(_ds_0.data_system['SYS_GLOBAL_OBJ_REFS'])) {
5149
- // if (val.ds.dsSession == dataSource) {
5150
- // if (!fields_changed.includes(ref_name)) {
5151
- // fields_changed.push(ref_name);
5152
- // }
5153
- // }
5154
- // }
5146
+ // search the field in refs
5147
+ let _ds_0 = _session.DS_GLB[0];
5148
+ for ([ref_name, val] of Object.entries(_ds_0.data_system['SYS_GLOBAL_OBJ_REFS'])) {
5149
+ if (val.ds.dsSession == dataSource) {
5150
+ func.UI.update_xu_ref(SESSION_ID, dataSource);
5151
+ // if (!fields_changed.includes(ref_name)) {
5152
+ // fields_changed.push(ref_name);
5153
+ // }
5154
+ }
5155
+ }
5155
5156
 
5156
5157
  if (!update_local_scope_only) {
5157
5158
  let tree_ret = await func.utils.TREE_OBJ.get(SESSION_ID, _ds.prog_id);
@@ -9042,6 +9043,22 @@ func.UI.refs_garbage_collector = function (SESSION_ID = Object.keys(SESSION_OBJ)
9042
9043
  }
9043
9044
  }
9044
9045
  };
9046
+
9047
+ func.UI.update_xu_ref = function (SESSION_ID, dsSessionP) {
9048
+ const _session = SESSION_OBJ[SESSION_ID];
9049
+ let _ds_0 = _session.DS_GLB[0];
9050
+
9051
+ const _ds = func.utils.clean_returned_datasource(SESSION_ID, dsSessionP);
9052
+
9053
+ const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
9054
+ const data = _ds?.data_feed?.rows?.[row_idx] || {};
9055
+
9056
+ const props = _ds.in_parameters || {};
9057
+ const attributes = $elm?.data()?.xuData?.properties || {};
9058
+ const xu_ui_id = $elm.attr('xu-ui-id');
9059
+
9060
+ _ds_0.data_system['SYS_GLOBAL_OBJ_REFS'][val.value] = { ds: _ds, data, attributes, props, xu_ui_id };
9061
+ };
9045
9062
  func.UI.screen = {};
9046
9063
  func.UI.screen.init = async function (SESSION_ID, prog_id, sourceScreenP, callingDataSource_objP, $callingContainerP, triggerIdP, rowIdP, jobNoP, is_panelP, parameters_obj_inP, source_functionP, call_screen_propertiesP) {
9047
9064
  if (!prog_id) return console.error('program is empty');
@@ -10002,20 +10019,21 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
10002
10019
 
10003
10020
  const common_fx = {
10004
10021
  'xu-ref': async function ($elm, val) {
10005
- const _session = SESSION_OBJ[SESSION_ID];
10006
- let _ds_0 = _session.DS_GLB[0];
10022
+ func.UI.update_xu_ref(SESSION_ID, paramsP.dsSessionP);
10023
+ // const _session = SESSION_OBJ[SESSION_ID];
10024
+ // let _ds_0 = _session.DS_GLB[0];
10007
10025
 
10008
- const _ds = func.utils.clean_returned_datasource(SESSION_ID, paramsP.dsSessionP);
10026
+ // const _ds = func.utils.clean_returned_datasource(SESSION_ID, paramsP.dsSessionP);
10009
10027
 
10010
- const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
10011
- const data = _ds?.data_feed?.rows?.[row_idx] || {};
10028
+ // const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
10029
+ // const data = _ds?.data_feed?.rows?.[row_idx] || {};
10012
10030
 
10013
- const props = _ds.in_parameters || {};
10014
- const attributes = $elm?.data()?.xuData?.properties || {};
10015
- const xu_ui_id = $elm.attr('xu-ui-id');
10031
+ // const props = _ds.in_parameters || {};
10032
+ // const attributes = $elm?.data()?.xuData?.properties || {};
10033
+ // const xu_ui_id = $elm.attr('xu-ui-id');
10016
10034
 
10017
- // _ds_0.data_system['SYS_GLOBAL_OBJ_REFS'][val.value] = { $el: $elm, ds: _ds, data, attributes, props };
10018
- _ds_0.data_system['SYS_GLOBAL_OBJ_REFS'][val.value] = { ds: _ds, data, attributes, props, xu_ui_id };
10035
+ // // _ds_0.data_system['SYS_GLOBAL_OBJ_REFS'][val.value] = { $el: $elm, ds: _ds, data, attributes, props };
10036
+ // _ds_0.data_system['SYS_GLOBAL_OBJ_REFS'][val.value] = { ds: _ds, data, attributes, props, xu_ui_id };
10019
10037
 
10020
10038
  // const proxy1 = new Proxy(_session.DS_GLB[paramsP.dsSessionP], {
10021
10039
  // get(target, prop, receiver) {
@@ -10030,15 +10048,80 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
10030
10048
 
10031
10049
  // create a new instance of `MutationObserver` named `observer`,
10032
10050
  // passing it a callback function
10033
- const observer = new MutationObserver(() => {
10034
- console.log('callback that runs when observer is triggered');
10035
- });
10051
+ // const observer = new MutationObserver(() => {
10052
+ // console.log('callback that runs when observer is triggered');
10053
+ // });
10036
10054
 
10037
- // call `observe()`, passing it the element to observe, and the options object
10038
- observer.observe(_session.DS_GLB[paramsP.dsSessionP], {
10039
- subtree: true,
10040
- childList: true,
10041
- });
10055
+ // // call `observe()`, passing it the element to observe, and the options object
10056
+ // observer.observe(_session.DS_GLB[paramsP.dsSessionP], {
10057
+ // subtree: true,
10058
+ // childList: true,
10059
+ // });
10060
+ //==================
10061
+ // class ObjectObserver {
10062
+ // constructor(targetObject, callback) {
10063
+ // this.callback = callback;
10064
+ // this.target = targetObject;
10065
+
10066
+ // // Create a proxy to intercept property access and modifications
10067
+ // this.proxy = new Proxy(targetObject, {
10068
+ // set: (target, property, value) => {
10069
+ // const oldValue = target[property];
10070
+ // target[property] = value;
10071
+
10072
+ // // Call the callback with mutation information
10073
+ // this.callback({
10074
+ // type: 'update',
10075
+ // object: target,
10076
+ // property,
10077
+ // oldValue,
10078
+ // newValue: value,
10079
+ // });
10080
+
10081
+ // return true;
10082
+ // },
10083
+
10084
+ // deleteProperty: (target, property) => {
10085
+ // const oldValue = target[property];
10086
+ // const deleted = delete target[property];
10087
+
10088
+ // if (deleted) {
10089
+ // this.callback({
10090
+ // type: 'delete',
10091
+ // object: target,
10092
+ // property,
10093
+ // oldValue,
10094
+ // });
10095
+ // }
10096
+
10097
+ // return deleted;
10098
+ // },
10099
+ // });
10100
+
10101
+ // return this.proxy;
10102
+ // }
10103
+
10104
+ // // Method to stop observing (for cleanup)
10105
+ // disconnect() {
10106
+ // this.callback = null;
10107
+ // this.target = null;
10108
+ // this.proxy = null;
10109
+ // }
10110
+ // }
10111
+
10112
+ // // Usage example:
10113
+ // const originalObject = _session.DS_GLB[paramsP.dsSessionP];
10114
+
10115
+ // // Create observer with callback
10116
+ // const observedObject = new ObjectObserver(originalObject, (mutation) => {
10117
+ // console.log('Change detected:', mutation);
10118
+ // });
10119
+
10120
+ // // These operations will trigger the callback
10121
+ // observedObject.name = "Jane"; // Property update
10122
+ // observedObject.job = "Developer"; // Property addition
10123
+ // delete observedObject.age; // Property deletion
10124
+ //==================
10042
10125
 
10043
10126
  return {};
10044
10127
  },