@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.
@@ -28151,6 +28151,40 @@ func.UI.teleport_garbage_collector = function (SESSION_ID = Object.keys(SESSION_
28151
28151
  });
28152
28152
  };
28153
28153
 
28154
+ func.UI.find_field_in_progUi_attributes = function (progUi, field_id, prop, tag_name) {
28155
+ let elm_nodes = [];
28156
+ const iterate_progUi = function (node) {
28157
+ for (let item of node) {
28158
+ if (!tag_name || item.tagName === tag_name) {
28159
+ if (prop) {
28160
+ if (!_.isEmpty(item.attributes)) {
28161
+ for (const [attr, val] of Object.entries(item.attributes)) {
28162
+ if (attr === `xu-exp:${prop}` || attr === prop) {
28163
+ // found = val.includes('@' + field_id);
28164
+ if (val.includes('@' + field_id)) {
28165
+ elm_nodes.push(item);
28166
+ break;
28167
+ }
28168
+ }
28169
+ }
28170
+ }
28171
+ } else {
28172
+ if (tag_name) {
28173
+ elm_nodes.push(item);
28174
+ }
28175
+ }
28176
+ }
28177
+ // if (elm_node) break;
28178
+
28179
+ if (item.children) {
28180
+ iterate_progUi(item.children);
28181
+ }
28182
+ }
28183
+ };
28184
+ iterate_progUi(progUi);
28185
+ return elm_nodes;
28186
+ };
28187
+
28154
28188
  func.UI.update_xu_ref = function (SESSION_ID, dsSessionP, ref_field_id, $elm) {
28155
28189
  let ret;
28156
28190
  const _session = SESSION_OBJ[SESSION_ID];
@@ -28158,92 +28192,93 @@ func.UI.update_xu_ref = function (SESSION_ID, dsSessionP, ref_field_id, $elm) {
28158
28192
 
28159
28193
  const _ds = func.utils.clean_returned_datasource(SESSION_ID, dsSessionP);
28160
28194
 
28161
- function createWatchedObject(obj, onChange) {
28162
- const watchers = new WeakMap();
28163
-
28164
- function createProxy(target, path = []) {
28165
- if (watchers.has(target)) {
28166
- return watchers.get(target);
28167
- }
28168
-
28169
- const proxy = new Proxy(target, {
28170
- set(obj, prop, value) {
28171
- const oldValue = obj[prop];
28172
- let currentPath = [...path, prop];
28195
+ // function createWatchedObject(obj, onChange) {
28196
+ // const watchers = new WeakMap();
28173
28197
 
28174
- // Set the new value
28175
- obj[prop] = value;
28176
-
28177
- // If the new value is an object, make it observable too
28178
- if (typeof value === 'object' && value !== null) {
28179
- obj[prop] = createProxy(value, currentPath);
28180
- }
28181
-
28182
- // Notify of change
28183
- if (oldValue !== value) {
28184
- currentPath.shift();
28185
- onChange({
28186
- path: currentPath.join('.'),
28187
- oldValue,
28188
- newValue: value,
28189
- type: 'set',
28190
- timestamp: Date.now(),
28191
- });
28192
- }
28193
-
28194
- return true;
28195
- },
28196
-
28197
- deleteProperty(obj, prop) {
28198
- const oldValue = obj[prop];
28199
- const currentPath = [...path, prop];
28200
-
28201
- delete obj[prop];
28202
-
28203
- onChange({
28204
- path: currentPath.join('.'),
28205
- oldValue,
28206
- newValue: undefined,
28207
- type: 'delete',
28208
- timestamp: Date.now(),
28209
- });
28210
-
28211
- return true;
28212
- },
28213
- });
28198
+ // function createProxy(target, path = []) {
28199
+ // if (watchers.has(target)) {
28200
+ // return watchers.get(target);
28201
+ // }
28214
28202
 
28215
- // Make nested objects observable
28216
- for (const [key, value] of Object.entries(target)) {
28217
- if (typeof value === 'object' && value !== null) {
28218
- target[key] = createProxy(value, [...path, key]);
28219
- }
28220
- }
28203
+ // const proxy = new Proxy(target, {
28204
+ // set(obj, prop, value) {
28205
+ // const oldValue = obj[prop];
28206
+ // let currentPath = [...path, prop];
28207
+
28208
+ // // Set the new value
28209
+ // obj[prop] = value;
28210
+
28211
+ // // If the new value is an object, make it observable too
28212
+ // if (typeof value === 'object' && value !== null) {
28213
+ // obj[prop] = createProxy(value, currentPath);
28214
+ // }
28215
+
28216
+ // // Notify of change
28217
+ // if (oldValue !== value) {
28218
+ // currentPath.shift();
28219
+ // onChange({
28220
+ // path: currentPath.join('.'),
28221
+ // oldValue,
28222
+ // newValue: value,
28223
+ // type: 'set',
28224
+ // timestamp: Date.now(),
28225
+ // });
28226
+ // }
28227
+
28228
+ // return true;
28229
+ // },
28230
+
28231
+ // deleteProperty(obj, prop) {
28232
+ // const oldValue = obj[prop];
28233
+ // const currentPath = [...path, prop];
28234
+
28235
+ // delete obj[prop];
28236
+
28237
+ // onChange({
28238
+ // path: currentPath.join('.'),
28239
+ // oldValue,
28240
+ // newValue: undefined,
28241
+ // type: 'delete',
28242
+ // timestamp: Date.now(),
28243
+ // });
28244
+
28245
+ // return true;
28246
+ // },
28247
+ // });
28248
+
28249
+ // // Make nested objects observable
28250
+ // for (const [key, value] of Object.entries(target)) {
28251
+ // if (typeof value === 'object' && value !== null) {
28252
+ // target[key] = createProxy(value, [...path, key]);
28253
+ // }
28254
+ // }
28221
28255
 
28222
- watchers.set(target, proxy);
28223
- return proxy;
28224
- }
28256
+ // watchers.set(target, proxy);
28257
+ // return proxy;
28258
+ // }
28225
28259
 
28226
- return createProxy(obj);
28227
- }
28260
+ // return createProxy(obj);
28261
+ // }
28228
28262
 
28229
- const watchedDs = createWatchedObject({ _ref: _ds }, async (change) => {
28230
- // console.log('Change detected:', change);
28231
- const { path, newValue } = change;
28232
- try {
28233
- const datasource_changes = {
28234
- [dsSessionP]: {
28235
- ['datasource_main']: {
28236
- watcher: { path, newValue },
28237
- },
28238
- },
28239
- };
28240
- await func.datasource.update(SESSION_ID, datasource_changes);
28241
- } catch (error) {}
28242
- });
28263
+ // const watchedDs = createWatchedObject({ _ref: _ds }, async (change) => {
28264
+ // // console.log('Change detected:', change);
28265
+ // const { path, newValue } = change;
28266
+ // try {
28267
+ // const datasource_changes = {
28268
+ // [dsSessionP]: {
28269
+ // ['datasource_main']: {
28270
+ // watcher: { path, newValue },
28271
+ // },
28272
+ // },
28273
+ // };
28274
+ // await func.datasource.update(SESSION_ID, datasource_changes);
28275
+ // } catch (error) {}
28276
+ // });
28243
28277
 
28244
28278
  //////////////
28245
28279
 
28246
- let obj = { ds: watchedDs._ref, data: {}, props: _ds.in_parameters || {} };
28280
+ // let obj = { ds: watchedDs._ref, data: {}, props: _ds.in_parameters || {} };
28281
+ let obj = { ds: _ds, data: {}, props: _ds.in_parameters || {} };
28247
28282
  try {
28248
28283
  const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
28249
28284
  obj.data = _ds?.data_feed?.rows?.[row_idx];
@@ -28268,40 +28303,6 @@ func.UI.update_xu_ref = function (SESSION_ID, dsSessionP, ref_field_id, $elm) {
28268
28303
 
28269
28304
  return ret;
28270
28305
  };
28271
-
28272
- func.UI.find_field_in_progUi_attributes = function (progUi, field_id, prop, tag_name) {
28273
- let elm_nodes = [];
28274
- const iterate_progUi = function (node) {
28275
- for (let item of node) {
28276
- if (!tag_name || item.tagName === tag_name) {
28277
- if (prop) {
28278
- if (!_.isEmpty(item.attributes)) {
28279
- for (const [attr, val] of Object.entries(item.attributes)) {
28280
- if (attr === `xu-exp:${prop}` || attr === prop) {
28281
- // found = val.includes('@' + field_id);
28282
- if (val.includes('@' + field_id)) {
28283
- elm_nodes.push(item);
28284
- break;
28285
- }
28286
- }
28287
- }
28288
- }
28289
- } else {
28290
- if (tag_name) {
28291
- elm_nodes.push(item);
28292
- }
28293
- }
28294
- }
28295
- // if (elm_node) break;
28296
-
28297
- if (item.children) {
28298
- iterate_progUi(item.children);
28299
- }
28300
- }
28301
- };
28302
- iterate_progUi(progUi);
28303
- return elm_nodes;
28304
- };
28305
28306
  func.datasource = {};
28306
28307
  func.datasource.create = async function (
28307
28308
  SESSION_ID,