@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.
@@ -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,32 @@ 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, $elm) {
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
+ let SYS_GLOBAL_OBJ_REFS = _ds_0.data_system['SYS_GLOBAL_OBJ_REFS'][val.value];
9056
+
9057
+ if (!SYS_GLOBAL_OBJ_REFS) {
9058
+ SYS_GLOBAL_OBJ_REFS = { ds: _ds, data };
9059
+ } else {
9060
+ SYS_GLOBAL_OBJ_REFS.ds = _ds;
9061
+ SYS_GLOBAL_OBJ_REFS.data = data;
9062
+
9063
+ if ($elm) {
9064
+ // const props = _ds.in_parameters || {};
9065
+ // const attributes = $elm?.data()?.xuData?.properties || {};
9066
+
9067
+ SYS_GLOBAL_OBJ_REFS.xu_ui_id = $elm.attr('xu-ui-id');
9068
+ }
9069
+ }
9070
+ };
9044
9071
  func.events = {};
9045
9072
  func.events.validate = async function (SESSION_ID, triggerP, dsSessionP, eventIdP, sourceP, argumentsP, return_validation_onlyP) {
9046
9073
  var _session = SESSION_OBJ[SESSION_ID];
@@ -11929,20 +11956,21 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
11929
11956
 
11930
11957
  const common_fx = {
11931
11958
  'xu-ref': async function ($elm, val) {
11932
- const _session = SESSION_OBJ[SESSION_ID];
11933
- let _ds_0 = _session.DS_GLB[0];
11959
+ func.UI.update_xu_ref(SESSION_ID, paramsP.dsSessionP, $elm);
11960
+ // const _session = SESSION_OBJ[SESSION_ID];
11961
+ // let _ds_0 = _session.DS_GLB[0];
11934
11962
 
11935
- const _ds = func.utils.clean_returned_datasource(SESSION_ID, paramsP.dsSessionP);
11963
+ // const _ds = func.utils.clean_returned_datasource(SESSION_ID, paramsP.dsSessionP);
11936
11964
 
11937
- const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
11938
- const data = _ds?.data_feed?.rows?.[row_idx] || {};
11965
+ // const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
11966
+ // const data = _ds?.data_feed?.rows?.[row_idx] || {};
11939
11967
 
11940
- const props = _ds.in_parameters || {};
11941
- const attributes = $elm?.data()?.xuData?.properties || {};
11942
- const xu_ui_id = $elm.attr('xu-ui-id');
11968
+ // const props = _ds.in_parameters || {};
11969
+ // const attributes = $elm?.data()?.xuData?.properties || {};
11970
+ // const xu_ui_id = $elm.attr('xu-ui-id');
11943
11971
 
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 };
11972
+ // // _ds_0.data_system['SYS_GLOBAL_OBJ_REFS'][val.value] = { $el: $elm, ds: _ds, data, attributes, props };
11973
+ // _ds_0.data_system['SYS_GLOBAL_OBJ_REFS'][val.value] = { ds: _ds, data, attributes, props, xu_ui_id };
11946
11974
 
11947
11975
  // const proxy1 = new Proxy(_session.DS_GLB[paramsP.dsSessionP], {
11948
11976
  // get(target, prop, receiver) {
@@ -11967,64 +11995,64 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
11967
11995
  // childList: true,
11968
11996
  // });
11969
11997
  //==================
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
- }
11998
+ // class ObjectObserver {
11999
+ // constructor(targetObject, callback) {
12000
+ // this.callback = callback;
12001
+ // this.target = targetObject;
12002
+
12003
+ // // Create a proxy to intercept property access and modifications
12004
+ // this.proxy = new Proxy(targetObject, {
12005
+ // set: (target, property, value) => {
12006
+ // const oldValue = target[property];
12007
+ // target[property] = value;
12008
+
12009
+ // // Call the callback with mutation information
12010
+ // this.callback({
12011
+ // type: 'update',
12012
+ // object: target,
12013
+ // property,
12014
+ // oldValue,
12015
+ // newValue: value,
12016
+ // });
12017
+
12018
+ // return true;
12019
+ // },
12020
+
12021
+ // deleteProperty: (target, property) => {
12022
+ // const oldValue = target[property];
12023
+ // const deleted = delete target[property];
12024
+
12025
+ // if (deleted) {
12026
+ // this.callback({
12027
+ // type: 'delete',
12028
+ // object: target,
12029
+ // property,
12030
+ // oldValue,
12031
+ // });
12032
+ // }
12033
+
12034
+ // return deleted;
12035
+ // },
12036
+ // });
12037
+
12038
+ // return this.proxy;
12039
+ // }
12012
12040
 
12013
- // Method to stop observing (for cleanup)
12014
- disconnect() {
12015
- this.callback = null;
12016
- this.target = null;
12017
- this.proxy = null;
12018
- }
12019
- }
12041
+ // // Method to stop observing (for cleanup)
12042
+ // disconnect() {
12043
+ // this.callback = null;
12044
+ // this.target = null;
12045
+ // this.proxy = null;
12046
+ // }
12047
+ // }
12020
12048
 
12021
- // Usage example:
12022
- const originalObject = _session.DS_GLB[paramsP.dsSessionP];
12049
+ // // Usage example:
12050
+ // const originalObject = _session.DS_GLB[paramsP.dsSessionP];
12023
12051
 
12024
- // Create observer with callback
12025
- const observedObject = new ObjectObserver(originalObject, (mutation) => {
12026
- console.log('Change detected:', mutation);
12027
- });
12052
+ // // Create observer with callback
12053
+ // const observedObject = new ObjectObserver(originalObject, (mutation) => {
12054
+ // console.log('Change detected:', mutation);
12055
+ // });
12028
12056
 
12029
12057
  // // These operations will trigger the callback
12030
12058
  // 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,32 @@ 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, $elm) {
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
+ let SYS_GLOBAL_OBJ_REFS = _ds_0.data_system['SYS_GLOBAL_OBJ_REFS'][val.value];
9057
+
9058
+ if (!SYS_GLOBAL_OBJ_REFS) {
9059
+ SYS_GLOBAL_OBJ_REFS = { ds: _ds, data };
9060
+ } else {
9061
+ SYS_GLOBAL_OBJ_REFS.ds = _ds;
9062
+ SYS_GLOBAL_OBJ_REFS.data = data;
9063
+
9064
+ if ($elm) {
9065
+ // const props = _ds.in_parameters || {};
9066
+ // const attributes = $elm?.data()?.xuData?.properties || {};
9067
+
9068
+ SYS_GLOBAL_OBJ_REFS.xu_ui_id = $elm.attr('xu-ui-id');
9069
+ }
9070
+ }
9071
+ };
9045
9072
  func.UI.screen = {};
9046
9073
  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
9074
  if (!prog_id) return console.error('program is empty');
@@ -10002,20 +10029,21 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
10002
10029
 
10003
10030
  const common_fx = {
10004
10031
  'xu-ref': async function ($elm, val) {
10005
- const _session = SESSION_OBJ[SESSION_ID];
10006
- let _ds_0 = _session.DS_GLB[0];
10032
+ func.UI.update_xu_ref(SESSION_ID, paramsP.dsSessionP, $elm);
10033
+ // const _session = SESSION_OBJ[SESSION_ID];
10034
+ // let _ds_0 = _session.DS_GLB[0];
10007
10035
 
10008
- const _ds = func.utils.clean_returned_datasource(SESSION_ID, paramsP.dsSessionP);
10036
+ // const _ds = func.utils.clean_returned_datasource(SESSION_ID, paramsP.dsSessionP);
10009
10037
 
10010
- const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
10011
- const data = _ds?.data_feed?.rows?.[row_idx] || {};
10038
+ // const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
10039
+ // const data = _ds?.data_feed?.rows?.[row_idx] || {};
10012
10040
 
10013
- const props = _ds.in_parameters || {};
10014
- const attributes = $elm?.data()?.xuData?.properties || {};
10015
- const xu_ui_id = $elm.attr('xu-ui-id');
10041
+ // const props = _ds.in_parameters || {};
10042
+ // const attributes = $elm?.data()?.xuData?.properties || {};
10043
+ // const xu_ui_id = $elm.attr('xu-ui-id');
10016
10044
 
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 };
10045
+ // // _ds_0.data_system['SYS_GLOBAL_OBJ_REFS'][val.value] = { $el: $elm, ds: _ds, data, attributes, props };
10046
+ // _ds_0.data_system['SYS_GLOBAL_OBJ_REFS'][val.value] = { ds: _ds, data, attributes, props, xu_ui_id };
10019
10047
 
10020
10048
  // const proxy1 = new Proxy(_session.DS_GLB[paramsP.dsSessionP], {
10021
10049
  // get(target, prop, receiver) {
@@ -10040,64 +10068,64 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
10040
10068
  // childList: true,
10041
10069
  // });
10042
10070
  //==================
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
- }
10071
+ // class ObjectObserver {
10072
+ // constructor(targetObject, callback) {
10073
+ // this.callback = callback;
10074
+ // this.target = targetObject;
10075
+
10076
+ // // Create a proxy to intercept property access and modifications
10077
+ // this.proxy = new Proxy(targetObject, {
10078
+ // set: (target, property, value) => {
10079
+ // const oldValue = target[property];
10080
+ // target[property] = value;
10081
+
10082
+ // // Call the callback with mutation information
10083
+ // this.callback({
10084
+ // type: 'update',
10085
+ // object: target,
10086
+ // property,
10087
+ // oldValue,
10088
+ // newValue: value,
10089
+ // });
10090
+
10091
+ // return true;
10092
+ // },
10093
+
10094
+ // deleteProperty: (target, property) => {
10095
+ // const oldValue = target[property];
10096
+ // const deleted = delete target[property];
10097
+
10098
+ // if (deleted) {
10099
+ // this.callback({
10100
+ // type: 'delete',
10101
+ // object: target,
10102
+ // property,
10103
+ // oldValue,
10104
+ // });
10105
+ // }
10106
+
10107
+ // return deleted;
10108
+ // },
10109
+ // });
10110
+
10111
+ // return this.proxy;
10112
+ // }
10085
10113
 
10086
- // Method to stop observing (for cleanup)
10087
- disconnect() {
10088
- this.callback = null;
10089
- this.target = null;
10090
- this.proxy = null;
10091
- }
10092
- }
10114
+ // // Method to stop observing (for cleanup)
10115
+ // disconnect() {
10116
+ // this.callback = null;
10117
+ // this.target = null;
10118
+ // this.proxy = null;
10119
+ // }
10120
+ // }
10093
10121
 
10094
- // Usage example:
10095
- const originalObject = _session.DS_GLB[paramsP.dsSessionP];
10122
+ // // Usage example:
10123
+ // const originalObject = _session.DS_GLB[paramsP.dsSessionP];
10096
10124
 
10097
- // Create observer with callback
10098
- const observedObject = new ObjectObserver(originalObject, (mutation) => {
10099
- console.log('Change detected:', mutation);
10100
- });
10125
+ // // Create observer with callback
10126
+ // const observedObject = new ObjectObserver(originalObject, (mutation) => {
10127
+ // console.log('Change detected:', mutation);
10128
+ // });
10101
10129
 
10102
10130
  // // These operations will trigger the callback
10103
10131
  // observedObject.name = "Jane"; // Property update