@xuda.io/runtime-bundle 1.0.1318 → 1.0.1320

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.
@@ -9020,6 +9020,40 @@ func.UI.teleport_garbage_collector = function (SESSION_ID = Object.keys(SESSION_
9020
9020
  });
9021
9021
  };
9022
9022
 
9023
+ func.UI.find_field_in_progUi_attributes = function (progUi, field_id, prop, tag_name) {
9024
+ let elm_nodes = [];
9025
+ const iterate_progUi = function (node) {
9026
+ for (let item of node) {
9027
+ if (!tag_name || item.tagName === tag_name) {
9028
+ if (prop) {
9029
+ if (!_.isEmpty(item.attributes)) {
9030
+ for (const [attr, val] of Object.entries(item.attributes)) {
9031
+ if (attr === `xu-exp:${prop}` || attr === prop) {
9032
+ // found = val.includes('@' + field_id);
9033
+ if (val.includes('@' + field_id)) {
9034
+ elm_nodes.push(item);
9035
+ break;
9036
+ }
9037
+ }
9038
+ }
9039
+ }
9040
+ } else {
9041
+ if (tag_name) {
9042
+ elm_nodes.push(item);
9043
+ }
9044
+ }
9045
+ }
9046
+ // if (elm_node) break;
9047
+
9048
+ if (item.children) {
9049
+ iterate_progUi(item.children);
9050
+ }
9051
+ }
9052
+ };
9053
+ iterate_progUi(progUi);
9054
+ return elm_nodes;
9055
+ };
9056
+
9023
9057
  func.UI.update_xu_ref = function (SESSION_ID, dsSessionP, ref_field_id, $elm) {
9024
9058
  let ret;
9025
9059
  const _session = SESSION_OBJ[SESSION_ID];
@@ -9027,92 +9061,93 @@ func.UI.update_xu_ref = function (SESSION_ID, dsSessionP, ref_field_id, $elm) {
9027
9061
 
9028
9062
  const _ds = func.utils.clean_returned_datasource(SESSION_ID, dsSessionP);
9029
9063
 
9030
- function createWatchedObject(obj, onChange) {
9031
- const watchers = new WeakMap();
9032
-
9033
- function createProxy(target, path = []) {
9034
- if (watchers.has(target)) {
9035
- return watchers.get(target);
9036
- }
9037
-
9038
- const proxy = new Proxy(target, {
9039
- set(obj, prop, value) {
9040
- const oldValue = obj[prop];
9041
- let currentPath = [...path, prop];
9064
+ // function createWatchedObject(obj, onChange) {
9065
+ // const watchers = new WeakMap();
9042
9066
 
9043
- // Set the new value
9044
- obj[prop] = value;
9045
-
9046
- // If the new value is an object, make it observable too
9047
- if (typeof value === 'object' && value !== null) {
9048
- obj[prop] = createProxy(value, currentPath);
9049
- }
9050
-
9051
- // Notify of change
9052
- if (oldValue !== value) {
9053
- currentPath.shift();
9054
- onChange({
9055
- path: currentPath.join('.'),
9056
- oldValue,
9057
- newValue: value,
9058
- type: 'set',
9059
- timestamp: Date.now(),
9060
- });
9061
- }
9062
-
9063
- return true;
9064
- },
9065
-
9066
- deleteProperty(obj, prop) {
9067
- const oldValue = obj[prop];
9068
- const currentPath = [...path, prop];
9069
-
9070
- delete obj[prop];
9071
-
9072
- onChange({
9073
- path: currentPath.join('.'),
9074
- oldValue,
9075
- newValue: undefined,
9076
- type: 'delete',
9077
- timestamp: Date.now(),
9078
- });
9079
-
9080
- return true;
9081
- },
9082
- });
9067
+ // function createProxy(target, path = []) {
9068
+ // if (watchers.has(target)) {
9069
+ // return watchers.get(target);
9070
+ // }
9083
9071
 
9084
- // Make nested objects observable
9085
- for (const [key, value] of Object.entries(target)) {
9086
- if (typeof value === 'object' && value !== null) {
9087
- target[key] = createProxy(value, [...path, key]);
9088
- }
9089
- }
9072
+ // const proxy = new Proxy(target, {
9073
+ // set(obj, prop, value) {
9074
+ // const oldValue = obj[prop];
9075
+ // let currentPath = [...path, prop];
9076
+
9077
+ // // Set the new value
9078
+ // obj[prop] = value;
9079
+
9080
+ // // If the new value is an object, make it observable too
9081
+ // if (typeof value === 'object' && value !== null) {
9082
+ // obj[prop] = createProxy(value, currentPath);
9083
+ // }
9084
+
9085
+ // // Notify of change
9086
+ // if (oldValue !== value) {
9087
+ // currentPath.shift();
9088
+ // onChange({
9089
+ // path: currentPath.join('.'),
9090
+ // oldValue,
9091
+ // newValue: value,
9092
+ // type: 'set',
9093
+ // timestamp: Date.now(),
9094
+ // });
9095
+ // }
9096
+
9097
+ // return true;
9098
+ // },
9099
+
9100
+ // deleteProperty(obj, prop) {
9101
+ // const oldValue = obj[prop];
9102
+ // const currentPath = [...path, prop];
9103
+
9104
+ // delete obj[prop];
9105
+
9106
+ // onChange({
9107
+ // path: currentPath.join('.'),
9108
+ // oldValue,
9109
+ // newValue: undefined,
9110
+ // type: 'delete',
9111
+ // timestamp: Date.now(),
9112
+ // });
9113
+
9114
+ // return true;
9115
+ // },
9116
+ // });
9117
+
9118
+ // // Make nested objects observable
9119
+ // for (const [key, value] of Object.entries(target)) {
9120
+ // if (typeof value === 'object' && value !== null) {
9121
+ // target[key] = createProxy(value, [...path, key]);
9122
+ // }
9123
+ // }
9090
9124
 
9091
- watchers.set(target, proxy);
9092
- return proxy;
9093
- }
9125
+ // watchers.set(target, proxy);
9126
+ // return proxy;
9127
+ // }
9094
9128
 
9095
- return createProxy(obj);
9096
- }
9129
+ // return createProxy(obj);
9130
+ // }
9097
9131
 
9098
- const watchedDs = createWatchedObject({ _ref: _ds }, async (change) => {
9099
- // console.log('Change detected:', change);
9100
- const { path, newValue } = change;
9101
- try {
9102
- const datasource_changes = {
9103
- [dsSessionP]: {
9104
- ['datasource_main']: {
9105
- watcher: { path, newValue },
9106
- },
9107
- },
9108
- };
9109
- await func.datasource.update(SESSION_ID, datasource_changes);
9110
- } catch (error) {}
9111
- });
9132
+ // const watchedDs = createWatchedObject({ _ref: _ds }, async (change) => {
9133
+ // // console.log('Change detected:', change);
9134
+ // const { path, newValue } = change;
9135
+ // try {
9136
+ // const datasource_changes = {
9137
+ // [dsSessionP]: {
9138
+ // ['datasource_main']: {
9139
+ // watcher: { path, newValue },
9140
+ // },
9141
+ // },
9142
+ // };
9143
+ // await func.datasource.update(SESSION_ID, datasource_changes);
9144
+ // } catch (error) {}
9145
+ // });
9112
9146
 
9113
9147
  //////////////
9114
9148
 
9115
- let obj = { ds: watchedDs._ref, data: {}, props: _ds.in_parameters || {} };
9149
+ // let obj = { ds: watchedDs._ref, data: {}, props: _ds.in_parameters || {} };
9150
+ let obj = { ds: _ds, data: {}, props: _ds.in_parameters || {} };
9116
9151
  try {
9117
9152
  const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
9118
9153
  obj.data = _ds?.data_feed?.rows?.[row_idx];
@@ -9137,40 +9172,6 @@ func.UI.update_xu_ref = function (SESSION_ID, dsSessionP, ref_field_id, $elm) {
9137
9172
 
9138
9173
  return ret;
9139
9174
  };
9140
-
9141
- func.UI.find_field_in_progUi_attributes = function (progUi, field_id, prop, tag_name) {
9142
- let elm_nodes = [];
9143
- const iterate_progUi = function (node) {
9144
- for (let item of node) {
9145
- if (!tag_name || item.tagName === tag_name) {
9146
- if (prop) {
9147
- if (!_.isEmpty(item.attributes)) {
9148
- for (const [attr, val] of Object.entries(item.attributes)) {
9149
- if (attr === `xu-exp:${prop}` || attr === prop) {
9150
- // found = val.includes('@' + field_id);
9151
- if (val.includes('@' + field_id)) {
9152
- elm_nodes.push(item);
9153
- break;
9154
- }
9155
- }
9156
- }
9157
- }
9158
- } else {
9159
- if (tag_name) {
9160
- elm_nodes.push(item);
9161
- }
9162
- }
9163
- }
9164
- // if (elm_node) break;
9165
-
9166
- if (item.children) {
9167
- iterate_progUi(item.children);
9168
- }
9169
- }
9170
- };
9171
- iterate_progUi(progUi);
9172
- return elm_nodes;
9173
- };
9174
9175
  func.events = {};
9175
9176
  func.events.validate = async function (SESSION_ID, triggerP, dsSessionP, eventIdP, sourceP, argumentsP, return_validation_onlyP) {
9176
9177
  var _session = SESSION_OBJ[SESSION_ID];
@@ -9021,6 +9021,40 @@ func.UI.teleport_garbage_collector = function (SESSION_ID = Object.keys(SESSION_
9021
9021
  });
9022
9022
  };
9023
9023
 
9024
+ func.UI.find_field_in_progUi_attributes = function (progUi, field_id, prop, tag_name) {
9025
+ let elm_nodes = [];
9026
+ const iterate_progUi = function (node) {
9027
+ for (let item of node) {
9028
+ if (!tag_name || item.tagName === tag_name) {
9029
+ if (prop) {
9030
+ if (!_.isEmpty(item.attributes)) {
9031
+ for (const [attr, val] of Object.entries(item.attributes)) {
9032
+ if (attr === `xu-exp:${prop}` || attr === prop) {
9033
+ // found = val.includes('@' + field_id);
9034
+ if (val.includes('@' + field_id)) {
9035
+ elm_nodes.push(item);
9036
+ break;
9037
+ }
9038
+ }
9039
+ }
9040
+ }
9041
+ } else {
9042
+ if (tag_name) {
9043
+ elm_nodes.push(item);
9044
+ }
9045
+ }
9046
+ }
9047
+ // if (elm_node) break;
9048
+
9049
+ if (item.children) {
9050
+ iterate_progUi(item.children);
9051
+ }
9052
+ }
9053
+ };
9054
+ iterate_progUi(progUi);
9055
+ return elm_nodes;
9056
+ };
9057
+
9024
9058
  func.UI.update_xu_ref = function (SESSION_ID, dsSessionP, ref_field_id, $elm) {
9025
9059
  let ret;
9026
9060
  const _session = SESSION_OBJ[SESSION_ID];
@@ -9028,92 +9062,93 @@ func.UI.update_xu_ref = function (SESSION_ID, dsSessionP, ref_field_id, $elm) {
9028
9062
 
9029
9063
  const _ds = func.utils.clean_returned_datasource(SESSION_ID, dsSessionP);
9030
9064
 
9031
- function createWatchedObject(obj, onChange) {
9032
- const watchers = new WeakMap();
9033
-
9034
- function createProxy(target, path = []) {
9035
- if (watchers.has(target)) {
9036
- return watchers.get(target);
9037
- }
9038
-
9039
- const proxy = new Proxy(target, {
9040
- set(obj, prop, value) {
9041
- const oldValue = obj[prop];
9042
- let currentPath = [...path, prop];
9065
+ // function createWatchedObject(obj, onChange) {
9066
+ // const watchers = new WeakMap();
9043
9067
 
9044
- // Set the new value
9045
- obj[prop] = value;
9046
-
9047
- // If the new value is an object, make it observable too
9048
- if (typeof value === 'object' && value !== null) {
9049
- obj[prop] = createProxy(value, currentPath);
9050
- }
9051
-
9052
- // Notify of change
9053
- if (oldValue !== value) {
9054
- currentPath.shift();
9055
- onChange({
9056
- path: currentPath.join('.'),
9057
- oldValue,
9058
- newValue: value,
9059
- type: 'set',
9060
- timestamp: Date.now(),
9061
- });
9062
- }
9063
-
9064
- return true;
9065
- },
9066
-
9067
- deleteProperty(obj, prop) {
9068
- const oldValue = obj[prop];
9069
- const currentPath = [...path, prop];
9070
-
9071
- delete obj[prop];
9072
-
9073
- onChange({
9074
- path: currentPath.join('.'),
9075
- oldValue,
9076
- newValue: undefined,
9077
- type: 'delete',
9078
- timestamp: Date.now(),
9079
- });
9080
-
9081
- return true;
9082
- },
9083
- });
9068
+ // function createProxy(target, path = []) {
9069
+ // if (watchers.has(target)) {
9070
+ // return watchers.get(target);
9071
+ // }
9084
9072
 
9085
- // Make nested objects observable
9086
- for (const [key, value] of Object.entries(target)) {
9087
- if (typeof value === 'object' && value !== null) {
9088
- target[key] = createProxy(value, [...path, key]);
9089
- }
9090
- }
9073
+ // const proxy = new Proxy(target, {
9074
+ // set(obj, prop, value) {
9075
+ // const oldValue = obj[prop];
9076
+ // let currentPath = [...path, prop];
9077
+
9078
+ // // Set the new value
9079
+ // obj[prop] = value;
9080
+
9081
+ // // If the new value is an object, make it observable too
9082
+ // if (typeof value === 'object' && value !== null) {
9083
+ // obj[prop] = createProxy(value, currentPath);
9084
+ // }
9085
+
9086
+ // // Notify of change
9087
+ // if (oldValue !== value) {
9088
+ // currentPath.shift();
9089
+ // onChange({
9090
+ // path: currentPath.join('.'),
9091
+ // oldValue,
9092
+ // newValue: value,
9093
+ // type: 'set',
9094
+ // timestamp: Date.now(),
9095
+ // });
9096
+ // }
9097
+
9098
+ // return true;
9099
+ // },
9100
+
9101
+ // deleteProperty(obj, prop) {
9102
+ // const oldValue = obj[prop];
9103
+ // const currentPath = [...path, prop];
9104
+
9105
+ // delete obj[prop];
9106
+
9107
+ // onChange({
9108
+ // path: currentPath.join('.'),
9109
+ // oldValue,
9110
+ // newValue: undefined,
9111
+ // type: 'delete',
9112
+ // timestamp: Date.now(),
9113
+ // });
9114
+
9115
+ // return true;
9116
+ // },
9117
+ // });
9118
+
9119
+ // // Make nested objects observable
9120
+ // for (const [key, value] of Object.entries(target)) {
9121
+ // if (typeof value === 'object' && value !== null) {
9122
+ // target[key] = createProxy(value, [...path, key]);
9123
+ // }
9124
+ // }
9091
9125
 
9092
- watchers.set(target, proxy);
9093
- return proxy;
9094
- }
9126
+ // watchers.set(target, proxy);
9127
+ // return proxy;
9128
+ // }
9095
9129
 
9096
- return createProxy(obj);
9097
- }
9130
+ // return createProxy(obj);
9131
+ // }
9098
9132
 
9099
- const watchedDs = createWatchedObject({ _ref: _ds }, async (change) => {
9100
- // console.log('Change detected:', change);
9101
- const { path, newValue } = change;
9102
- try {
9103
- const datasource_changes = {
9104
- [dsSessionP]: {
9105
- ['datasource_main']: {
9106
- watcher: { path, newValue },
9107
- },
9108
- },
9109
- };
9110
- await func.datasource.update(SESSION_ID, datasource_changes);
9111
- } catch (error) {}
9112
- });
9133
+ // const watchedDs = createWatchedObject({ _ref: _ds }, async (change) => {
9134
+ // // console.log('Change detected:', change);
9135
+ // const { path, newValue } = change;
9136
+ // try {
9137
+ // const datasource_changes = {
9138
+ // [dsSessionP]: {
9139
+ // ['datasource_main']: {
9140
+ // watcher: { path, newValue },
9141
+ // },
9142
+ // },
9143
+ // };
9144
+ // await func.datasource.update(SESSION_ID, datasource_changes);
9145
+ // } catch (error) {}
9146
+ // });
9113
9147
 
9114
9148
  //////////////
9115
9149
 
9116
- let obj = { ds: watchedDs._ref, data: {}, props: _ds.in_parameters || {} };
9150
+ // let obj = { ds: watchedDs._ref, data: {}, props: _ds.in_parameters || {} };
9151
+ let obj = { ds: _ds, data: {}, props: _ds.in_parameters || {} };
9117
9152
  try {
9118
9153
  const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
9119
9154
  obj.data = _ds?.data_feed?.rows?.[row_idx];
@@ -9138,40 +9173,6 @@ func.UI.update_xu_ref = function (SESSION_ID, dsSessionP, ref_field_id, $elm) {
9138
9173
 
9139
9174
  return ret;
9140
9175
  };
9141
-
9142
- func.UI.find_field_in_progUi_attributes = function (progUi, field_id, prop, tag_name) {
9143
- let elm_nodes = [];
9144
- const iterate_progUi = function (node) {
9145
- for (let item of node) {
9146
- if (!tag_name || item.tagName === tag_name) {
9147
- if (prop) {
9148
- if (!_.isEmpty(item.attributes)) {
9149
- for (const [attr, val] of Object.entries(item.attributes)) {
9150
- if (attr === `xu-exp:${prop}` || attr === prop) {
9151
- // found = val.includes('@' + field_id);
9152
- if (val.includes('@' + field_id)) {
9153
- elm_nodes.push(item);
9154
- break;
9155
- }
9156
- }
9157
- }
9158
- }
9159
- } else {
9160
- if (tag_name) {
9161
- elm_nodes.push(item);
9162
- }
9163
- }
9164
- }
9165
- // if (elm_node) break;
9166
-
9167
- if (item.children) {
9168
- iterate_progUi(item.children);
9169
- }
9170
- }
9171
- };
9172
- iterate_progUi(progUi);
9173
- return elm_nodes;
9174
- };
9175
9176
  func.UI.screen = {};
9176
9177
  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, refreshed_ds, parameters_raw_obj) {
9177
9178
  if (!prog_id) return console.error('program is empty');