@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.
@@ -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) {
@@ -11967,64 +11985,64 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
11967
11985
  // childList: true,
11968
11986
  // });
11969
11987
  //==================
11970
- class ObjectObserver {
11971
- constructor(targetObject, callback) {
11972
- this.callback = callback;
11973
- this.target = targetObject;
11974
-
11975
- // Create a proxy to intercept property access and modifications
11976
- this.proxy = new Proxy(targetObject, {
11977
- set: (target, property, value) => {
11978
- const oldValue = target[property];
11979
- target[property] = value;
11980
-
11981
- // Call the callback with mutation information
11982
- this.callback({
11983
- type: 'update',
11984
- object: target,
11985
- property,
11986
- oldValue,
11987
- newValue: value,
11988
- });
11989
-
11990
- return true;
11991
- },
11992
-
11993
- deleteProperty: (target, property) => {
11994
- const oldValue = target[property];
11995
- const deleted = delete target[property];
11996
-
11997
- if (deleted) {
11998
- this.callback({
11999
- type: 'delete',
12000
- object: target,
12001
- property,
12002
- oldValue,
12003
- });
12004
- }
12005
-
12006
- return deleted;
12007
- },
12008
- });
12009
-
12010
- return this.proxy;
12011
- }
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
+ // }
12012
12030
 
12013
- // Method to stop observing (for cleanup)
12014
- disconnect() {
12015
- this.callback = null;
12016
- this.target = null;
12017
- this.proxy = null;
12018
- }
12019
- }
12031
+ // // Method to stop observing (for cleanup)
12032
+ // disconnect() {
12033
+ // this.callback = null;
12034
+ // this.target = null;
12035
+ // this.proxy = null;
12036
+ // }
12037
+ // }
12020
12038
 
12021
- // Usage example:
12022
- const originalObject = _session.DS_GLB[paramsP.dsSessionP];
12039
+ // // Usage example:
12040
+ // const originalObject = _session.DS_GLB[paramsP.dsSessionP];
12023
12041
 
12024
- // Create observer with callback
12025
- const observedObject = new ObjectObserver(originalObject, (mutation) => {
12026
- console.log('Change detected:', mutation);
12027
- });
12042
+ // // Create observer with callback
12043
+ // const observedObject = new ObjectObserver(originalObject, (mutation) => {
12044
+ // console.log('Change detected:', mutation);
12045
+ // });
12028
12046
 
12029
12047
  // // These operations will trigger the callback
12030
12048
  // observedObject.name = "Jane"; // Property update
@@ -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) {
@@ -10040,64 +10058,64 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
10040
10058
  // childList: true,
10041
10059
  // });
10042
10060
  //==================
10043
- class ObjectObserver {
10044
- constructor(targetObject, callback) {
10045
- this.callback = callback;
10046
- this.target = targetObject;
10047
-
10048
- // Create a proxy to intercept property access and modifications
10049
- this.proxy = new Proxy(targetObject, {
10050
- set: (target, property, value) => {
10051
- const oldValue = target[property];
10052
- target[property] = value;
10053
-
10054
- // Call the callback with mutation information
10055
- this.callback({
10056
- type: 'update',
10057
- object: target,
10058
- property,
10059
- oldValue,
10060
- newValue: value,
10061
- });
10062
-
10063
- return true;
10064
- },
10065
-
10066
- deleteProperty: (target, property) => {
10067
- const oldValue = target[property];
10068
- const deleted = delete target[property];
10069
-
10070
- if (deleted) {
10071
- this.callback({
10072
- type: 'delete',
10073
- object: target,
10074
- property,
10075
- oldValue,
10076
- });
10077
- }
10078
-
10079
- return deleted;
10080
- },
10081
- });
10082
-
10083
- return this.proxy;
10084
- }
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
+ // }
10085
10103
 
10086
- // Method to stop observing (for cleanup)
10087
- disconnect() {
10088
- this.callback = null;
10089
- this.target = null;
10090
- this.proxy = null;
10091
- }
10092
- }
10104
+ // // Method to stop observing (for cleanup)
10105
+ // disconnect() {
10106
+ // this.callback = null;
10107
+ // this.target = null;
10108
+ // this.proxy = null;
10109
+ // }
10110
+ // }
10093
10111
 
10094
- // Usage example:
10095
- const originalObject = _session.DS_GLB[paramsP.dsSessionP];
10112
+ // // Usage example:
10113
+ // const originalObject = _session.DS_GLB[paramsP.dsSessionP];
10096
10114
 
10097
- // Create observer with callback
10098
- const observedObject = new ObjectObserver(originalObject, (mutation) => {
10099
- console.log('Change detected:', mutation);
10100
- });
10115
+ // // Create observer with callback
10116
+ // const observedObject = new ObjectObserver(originalObject, (mutation) => {
10117
+ // console.log('Change detected:', mutation);
10118
+ // });
10101
10119
 
10102
10120
  // // These operations will trigger the callback
10103
10121
  // observedObject.name = "Jane"; // Property update