@xuda.io/runtime-bundle 1.0.518 → 1.0.520
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.
- package/js/xuda-runtime-bundle.js +227 -213
- package/js/xuda-runtime-bundle.min.js +1 -1
- package/js/xuda-runtime-slim.js +231 -217
- package/js/xuda-runtime-slim.min.es.js +231 -217
- package/js/xuda-runtime-slim.min.js +1 -1
- package/js/xuda-server-bundle.min.mjs +1 -1
- package/js/xuda-server-bundle.mjs +208 -203
- package/js/xuda-worker-bundle.js +208 -203
- package/js/xuda-worker-bundle.min.js +1 -1
- package/package.json +1 -1
|
@@ -5057,201 +5057,201 @@ func.datasource.del = function (SESSION_ID, dsP) {
|
|
|
5057
5057
|
}
|
|
5058
5058
|
perform_delete();
|
|
5059
5059
|
};
|
|
5060
|
-
func.datasource.update_old = async function (SESSION_ID, datasource_changes, update_local_scope_only, avoid_refresh) {
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
if (_session.IS_API || typeof IS_MASTER_WEBSOCKET !== 'undefined' || typeof IS_PROCESS_SERVER !== 'undefined') {
|
|
5065
|
-
update_local_scope_only = true;
|
|
5066
|
-
}
|
|
5067
|
-
|
|
5068
|
-
if (typeof glb.GLOBAL_VARS === 'undefined') {
|
|
5069
|
-
glb.GLOBAL_VARS = (await func.common.get_module(SESSION_ID, 'xuda-system-globals-module.mjs')).system_globals;
|
|
5070
|
-
}
|
|
5071
|
-
|
|
5072
|
-
const set_fieldComputed_dependencies = async function (dsNo, field_id, parent_ds) {
|
|
5073
|
-
// iterate child ds
|
|
5074
|
-
for (const [dsSession, _ds] of Object.entries(_session.DS_GLB)) {
|
|
5075
|
-
if (parent_ds !== null) {
|
|
5076
|
-
if (_ds.parentDataSourceNo != parent_ds) continue;
|
|
5077
|
-
} else {
|
|
5078
|
-
if (dsSession != dsNo) continue;
|
|
5079
|
-
}
|
|
5080
|
-
let tree_ret = await func.utils.TREE_OBJ.get(SESSION_ID, _ds.prog_id);
|
|
5081
|
-
if (tree_ret.menuType === 'component' || tree_ret.menuType === 'globals') {
|
|
5082
|
-
// check if field has fieldComputed property
|
|
5083
|
-
const _progFields = await func.datasource.get_progFields(SESSION_ID, dsSession);
|
|
5084
|
-
// find if field is computed
|
|
5085
|
-
let fieldComputed_propExpressions, fieldComputed_id;
|
|
5086
|
-
for await (const val of _progFields) {
|
|
5087
|
-
const fieldId = val.data.field_id;
|
|
5088
|
-
|
|
5089
|
-
// if (fieldId !== field_id) continue
|
|
5090
|
-
if (val.data.type !== 'virtual' || !val.props.fieldComputed) continue;
|
|
5060
|
+
// func.datasource.update_old = async function (SESSION_ID, datasource_changes, update_local_scope_only, avoid_refresh) {
|
|
5061
|
+
// return new Promise(async (resolve, reject) => {
|
|
5062
|
+
// var _session = SESSION_OBJ[SESSION_ID];
|
|
5091
5063
|
|
|
5092
|
-
|
|
5093
|
-
|
|
5094
|
-
|
|
5095
|
-
fieldComputed_id = fieldId;
|
|
5096
|
-
}
|
|
5097
|
-
}
|
|
5098
|
-
|
|
5099
|
-
if (!fieldComputed_id) return;
|
|
5100
|
-
|
|
5101
|
-
// iterate ds rows
|
|
5102
|
-
for (const row of _ds.data_feed?.rows || []) {
|
|
5103
|
-
// iterate row fields
|
|
5104
|
-
for (const [key, val] of Object.entries(row)) {
|
|
5105
|
-
if (key !== fieldComputed_id) continue;
|
|
5106
|
-
try {
|
|
5107
|
-
let ret = await func.expression.get(SESSION_ID, fieldComputed_propExpressions, dsNo, 'update', row._ROWID);
|
|
5108
|
-
|
|
5109
|
-
const row_idx = func.common.find_ROWID_idx(_ds, row._ROWID);
|
|
5110
|
-
if (_ds.data_feed.rows[row_idx][fieldComputed_id] !== ret.result) {
|
|
5111
|
-
_ds.data_feed.rows[row_idx][fieldComputed_id] = ret.result;
|
|
5112
|
-
if (!fields_changed.includes(fieldComputed_id)) {
|
|
5113
|
-
fields_changed.push(fieldComputed_id);
|
|
5114
|
-
}
|
|
5115
|
-
if (!datasource_changed.includes(dsSession)) {
|
|
5116
|
-
datasource_changed.push(dsSession);
|
|
5117
|
-
}
|
|
5118
|
-
}
|
|
5119
|
-
} catch (err) {
|
|
5120
|
-
console.error(err);
|
|
5121
|
-
}
|
|
5122
|
-
}
|
|
5123
|
-
}
|
|
5124
|
-
}
|
|
5125
|
-
await set_fieldComputed_dependencies(dsNo, field_id, dsSession);
|
|
5126
|
-
}
|
|
5127
|
-
};
|
|
5128
|
-
|
|
5129
|
-
var fields_changed = [];
|
|
5130
|
-
var datasource_changed = [];
|
|
5131
|
-
let client_datasource_changes = {};
|
|
5132
|
-
let server_datasource_changes = {};
|
|
5133
|
-
// iterate changes datasource
|
|
5134
|
-
for await (const [dataSource, row_data] of Object.entries(datasource_changes)) {
|
|
5135
|
-
var _ds = _session.DS_GLB[dataSource];
|
|
5136
|
-
if (!_ds) {
|
|
5137
|
-
continue;
|
|
5138
|
-
}
|
|
5139
|
-
|
|
5140
|
-
const update_xu_ref = async function () {
|
|
5141
|
-
let _ds_0 = _session.DS_GLB[0];
|
|
5142
|
-
for ([ref_name, val] of Object.entries(_ds_0.data_system['SYS_GLOBAL_OBJ_REFS'])) {
|
|
5143
|
-
if (val.ds.dsSession == dataSource) {
|
|
5144
|
-
func.UI.update_xu_ref(SESSION_ID, dataSource, ref_name);
|
|
5145
|
-
}
|
|
5146
|
-
}
|
|
5147
|
-
};
|
|
5148
|
-
|
|
5149
|
-
// iterate changes records
|
|
5150
|
-
for (const [record_id, fields_data] of Object.entries(row_data)) {
|
|
5151
|
-
// iterate changes fields
|
|
5152
|
-
for (const [field_id, value] of Object.entries(fields_data)) {
|
|
5153
|
-
// mechanism to make update directly on the datasource object
|
|
5154
|
-
if (record_id === 'datasource_main') {
|
|
5155
|
-
_.set(_ds, field_id, value);
|
|
5156
|
-
update_xu_ref();
|
|
5157
|
-
continue;
|
|
5158
|
-
}
|
|
5159
|
-
|
|
5160
|
-
if (typeof fields_data === 'object') {
|
|
5161
|
-
if (glb.GLOBAL_VARS[field_id]) {
|
|
5162
|
-
_ds.data_system[field_id] = value;
|
|
5163
|
-
continue;
|
|
5164
|
-
}
|
|
5064
|
+
// if (_session.IS_API || typeof IS_MASTER_WEBSOCKET !== 'undefined' || typeof IS_PROCESS_SERVER !== 'undefined') {
|
|
5065
|
+
// update_local_scope_only = true;
|
|
5066
|
+
// }
|
|
5165
5067
|
|
|
5166
|
-
|
|
5167
|
-
|
|
5168
|
-
|
|
5169
|
-
_ds.data_feed.rows[row_idx][field_id] = value;
|
|
5170
|
-
await set_fieldComputed_dependencies(dataSource, field_id, null);
|
|
5068
|
+
// if (typeof glb.GLOBAL_VARS === 'undefined') {
|
|
5069
|
+
// glb.GLOBAL_VARS = (await func.common.get_module(SESSION_ID, 'xuda-system-globals-module.mjs')).system_globals;
|
|
5070
|
+
// }
|
|
5171
5071
|
|
|
5172
|
-
|
|
5173
|
-
|
|
5072
|
+
// const set_fieldComputed_dependencies = async function (dsNo, field_id, parent_ds) {
|
|
5073
|
+
// // iterate child ds
|
|
5074
|
+
// for (const [dsSession, _ds] of Object.entries(_session.DS_GLB)) {
|
|
5075
|
+
// if (parent_ds !== null) {
|
|
5076
|
+
// if (_ds.parentDataSourceNo != parent_ds) continue;
|
|
5077
|
+
// } else {
|
|
5078
|
+
// if (dsSession != dsNo) continue;
|
|
5079
|
+
// }
|
|
5080
|
+
// let tree_ret = await func.utils.TREE_OBJ.get(SESSION_ID, _ds.prog_id);
|
|
5081
|
+
// if (tree_ret.menuType === 'component' || tree_ret.menuType === 'globals') {
|
|
5082
|
+
// // check if field has fieldComputed property
|
|
5083
|
+
// const _progFields = await func.datasource.get_progFields(SESSION_ID, dsSession);
|
|
5084
|
+
// // find if field is computed
|
|
5085
|
+
// let fieldComputed_propExpressions, fieldComputed_id;
|
|
5086
|
+
// for await (const val of _progFields) {
|
|
5087
|
+
// const fieldId = val.data.field_id;
|
|
5088
|
+
|
|
5089
|
+
// // if (fieldId !== field_id) continue
|
|
5090
|
+
// if (val.data.type !== 'virtual' || !val.props.fieldComputed) continue;
|
|
5091
|
+
|
|
5092
|
+
// const _propExpressions = val.props?.propExpressions?.fieldValue;
|
|
5093
|
+
// if (_propExpressions && JSON.stringify(_propExpressions).includes(field_id)) {
|
|
5094
|
+
// fieldComputed_propExpressions = _propExpressions;
|
|
5095
|
+
// fieldComputed_id = fieldId;
|
|
5096
|
+
// }
|
|
5097
|
+
// }
|
|
5174
5098
|
|
|
5175
|
-
|
|
5176
|
-
|
|
5177
|
-
|
|
5178
|
-
|
|
5179
|
-
|
|
5180
|
-
|
|
5181
|
-
|
|
5182
|
-
|
|
5183
|
-
|
|
5184
|
-
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5099
|
+
// if (!fieldComputed_id) return;
|
|
5100
|
+
|
|
5101
|
+
// // iterate ds rows
|
|
5102
|
+
// for (const row of _ds.data_feed?.rows || []) {
|
|
5103
|
+
// // iterate row fields
|
|
5104
|
+
// for (const [key, val] of Object.entries(row)) {
|
|
5105
|
+
// if (key !== fieldComputed_id) continue;
|
|
5106
|
+
// try {
|
|
5107
|
+
// let ret = await func.expression.get(SESSION_ID, fieldComputed_propExpressions, dsNo, 'update', row._ROWID);
|
|
5108
|
+
|
|
5109
|
+
// const row_idx = func.common.find_ROWID_idx(_ds, row._ROWID);
|
|
5110
|
+
// if (_ds.data_feed.rows[row_idx][fieldComputed_id] !== ret.result) {
|
|
5111
|
+
// _ds.data_feed.rows[row_idx][fieldComputed_id] = ret.result;
|
|
5112
|
+
// if (!fields_changed.includes(fieldComputed_id)) {
|
|
5113
|
+
// fields_changed.push(fieldComputed_id);
|
|
5114
|
+
// }
|
|
5115
|
+
// if (!datasource_changed.includes(dsSession)) {
|
|
5116
|
+
// datasource_changed.push(dsSession);
|
|
5117
|
+
// }
|
|
5118
|
+
// }
|
|
5119
|
+
// } catch (err) {
|
|
5120
|
+
// console.error(err);
|
|
5121
|
+
// }
|
|
5122
|
+
// }
|
|
5123
|
+
// }
|
|
5124
|
+
// }
|
|
5125
|
+
// await set_fieldComputed_dependencies(dsNo, field_id, dsSession);
|
|
5126
|
+
// }
|
|
5127
|
+
// };
|
|
5128
|
+
|
|
5129
|
+
// var fields_changed = [];
|
|
5130
|
+
// var datasource_changed = [];
|
|
5131
|
+
// let client_datasource_changes = {};
|
|
5132
|
+
// let server_datasource_changes = {};
|
|
5133
|
+
// // iterate changes datasource
|
|
5134
|
+
// for await (const [dataSource, row_data] of Object.entries(datasource_changes)) {
|
|
5135
|
+
// var _ds = _session.DS_GLB[dataSource];
|
|
5136
|
+
// if (!_ds) {
|
|
5137
|
+
// continue;
|
|
5138
|
+
// }
|
|
5205
5139
|
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
|
|
5210
|
-
|
|
5211
|
-
|
|
5140
|
+
// const update_xu_ref = async function () {
|
|
5141
|
+
// let _ds_0 = _session.DS_GLB[0];
|
|
5142
|
+
// for ([ref_name, val] of Object.entries(_ds_0.data_system['SYS_GLOBAL_OBJ_REFS'])) {
|
|
5143
|
+
// if (val.ds.dsSession == dataSource) {
|
|
5144
|
+
// func.UI.update_xu_ref(SESSION_ID, dataSource, ref_name);
|
|
5145
|
+
// }
|
|
5146
|
+
// }
|
|
5147
|
+
// };
|
|
5148
|
+
|
|
5149
|
+
// // iterate changes records
|
|
5150
|
+
// for (const [record_id, fields_data] of Object.entries(row_data)) {
|
|
5151
|
+
// // iterate changes fields
|
|
5152
|
+
// for (const [field_id, value] of Object.entries(fields_data)) {
|
|
5153
|
+
// // mechanism to make update directly on the datasource object
|
|
5154
|
+
// if (record_id === 'datasource_main') {
|
|
5155
|
+
// _.set(_ds, field_id, value);
|
|
5156
|
+
// update_xu_ref();
|
|
5157
|
+
// continue;
|
|
5158
|
+
// }
|
|
5212
5159
|
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
|
|
5160
|
+
// if (typeof fields_data === 'object') {
|
|
5161
|
+
// if (glb.GLOBAL_VARS[field_id]) {
|
|
5162
|
+
// _ds.data_system[field_id] = value;
|
|
5163
|
+
// continue;
|
|
5164
|
+
// }
|
|
5165
|
+
|
|
5166
|
+
// // try {
|
|
5167
|
+
// const row_idx = func.common.find_ROWID_idx(_ds, record_id);
|
|
5168
|
+
// if (_ds.data_feed.rows[row_idx][field_id] !== value) {
|
|
5169
|
+
// _ds.data_feed.rows[row_idx][field_id] = value;
|
|
5170
|
+
// await set_fieldComputed_dependencies(dataSource, field_id, null);
|
|
5171
|
+
|
|
5172
|
+
// // search the field in refs
|
|
5173
|
+
// update_xu_ref();
|
|
5174
|
+
|
|
5175
|
+
// if (!update_local_scope_only) {
|
|
5176
|
+
// let tree_ret = await func.utils.TREE_OBJ.get(SESSION_ID, _ds.prog_id);
|
|
5177
|
+
// if (glb.IS_WORKER) {
|
|
5178
|
+
// // RUN AT SERVER
|
|
5179
|
+
// if (tree_ret.menuType === 'globals' || tree_ret.menuType === 'component') {
|
|
5180
|
+
// const _progFields = await func.datasource.get_progFields(SESSION_ID, dataSource);
|
|
5181
|
+
// let view_field_obj = func.common.find_item_by_key(_progFields, 'field_id', field_id);
|
|
5182
|
+
// if (!view_field_obj?.data?.serverField && record_id !== 'data_system') {
|
|
5183
|
+
// if (!client_datasource_changes[dataSource]) {
|
|
5184
|
+
// client_datasource_changes[dataSource] = {};
|
|
5185
|
+
// }
|
|
5186
|
+
// if (!client_datasource_changes[dataSource][record_id]) {
|
|
5187
|
+
// client_datasource_changes[dataSource][record_id] = {};
|
|
5188
|
+
// }
|
|
5189
|
+
// client_datasource_changes[dataSource][record_id][field_id] = value;
|
|
5190
|
+
// }
|
|
5191
|
+
// }
|
|
5192
|
+
// } else {
|
|
5193
|
+
// // RUN AT CLIENT
|
|
5194
|
+
// if ((tree_ret.menuType === 'component' && _ds._run_at !== 'client') || tree_ret.menuType === 'globals') {
|
|
5195
|
+
// if (!server_datasource_changes[dataSource]) {
|
|
5196
|
+
// server_datasource_changes[dataSource] = {};
|
|
5197
|
+
// }
|
|
5198
|
+
// if (!server_datasource_changes[dataSource][record_id]) {
|
|
5199
|
+
// server_datasource_changes[dataSource][record_id] = {};
|
|
5200
|
+
// }
|
|
5201
|
+
// server_datasource_changes[dataSource][record_id][field_id] = value;
|
|
5202
|
+
// }
|
|
5203
|
+
// }
|
|
5204
|
+
// }
|
|
5205
|
+
|
|
5206
|
+
// if (!fields_changed.includes(field_id)) {
|
|
5207
|
+
// fields_changed.push(field_id);
|
|
5208
|
+
// }
|
|
5209
|
+
// if (!datasource_changed.includes(dataSource)) {
|
|
5210
|
+
// datasource_changed.push(dataSource);
|
|
5211
|
+
// }
|
|
5212
|
+
|
|
5213
|
+
// if (!_ds.data_feed.rows_changed) {
|
|
5214
|
+
// _ds.data_feed.rows_changed = [];
|
|
5215
|
+
// }
|
|
5216
|
+
// if (!_ds.data_feed.rows_changed.includes(record_id)) _ds.data_feed.rows_changed.push(record_id);
|
|
5217
|
+
// }
|
|
5218
|
+
// } else if (fields_data === 'set') {
|
|
5219
|
+
// _ds.currentRecordId = record_id;
|
|
5220
|
+
// }
|
|
5221
|
+
// }
|
|
5222
|
+
// }
|
|
5223
|
+
// }
|
|
5224
5224
|
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
|
|
5228
|
-
|
|
5229
|
-
|
|
5230
|
-
|
|
5231
|
-
|
|
5232
|
-
|
|
5233
|
-
|
|
5234
|
-
|
|
5235
|
-
|
|
5236
|
-
|
|
5237
|
-
|
|
5238
|
-
|
|
5239
|
-
|
|
5240
|
-
|
|
5241
|
-
|
|
5242
|
-
|
|
5243
|
-
|
|
5244
|
-
|
|
5245
|
-
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
|
|
5249
|
-
|
|
5250
|
-
|
|
5251
|
-
|
|
5252
|
-
|
|
5253
|
-
|
|
5254
|
-
};
|
|
5225
|
+
// if (glb.IS_WORKER) {
|
|
5226
|
+
// if (!update_local_scope_only && !_.isEmpty(client_datasource_changes)) {
|
|
5227
|
+
// func.utils.post_back_to_client(SESSION_ID, 'update_client_eventChangesResults_from_worker', _session.worker_id, client_datasource_changes);
|
|
5228
|
+
// }
|
|
5229
|
+
// } else {
|
|
5230
|
+
// if (!update_local_scope_only && !_.isEmpty(server_datasource_changes)) {
|
|
5231
|
+
// const ret = await func.index.call_worker(SESSION_ID, {
|
|
5232
|
+
// service: 'update_datasource_changes_from_client',
|
|
5233
|
+
// data: {
|
|
5234
|
+
// session_id: SESSION_ID,
|
|
5235
|
+
// datasource_changes: server_datasource_changes,
|
|
5236
|
+
// },
|
|
5237
|
+
// id: _ds.worker_id,
|
|
5238
|
+
// });
|
|
5239
|
+
// }
|
|
5240
|
+
// ///// REFRESH SCREEN
|
|
5241
|
+
// if (!avoid_refresh && fields_changed.length) {
|
|
5242
|
+
// await func.UI.screen.refresh_xu_attributes(SESSION_ID, fields_changed);
|
|
5243
|
+
// // await removed from the below function cause to dead lock Mar 3 25
|
|
5244
|
+
// func.UI.screen.refresh_screen(
|
|
5245
|
+
// SESSION_ID,
|
|
5246
|
+
// fields_changed,
|
|
5247
|
+
// null,
|
|
5248
|
+
// datasource_changed[0], // refresh the current datasource only
|
|
5249
|
+
// );
|
|
5250
|
+
// }
|
|
5251
|
+
// }
|
|
5252
|
+
// resolve();
|
|
5253
|
+
// });
|
|
5254
|
+
// };
|
|
5255
5255
|
|
|
5256
5256
|
func.datasource.update = async function (SESSION_ID, datasource_changes, update_local_scope_only, avoid_refresh) {
|
|
5257
5257
|
return new Promise(async (resolve, reject) => {
|
|
@@ -5326,6 +5326,18 @@ func.datasource.update = async function (SESSION_ID, datasource_changes, update_
|
|
|
5326
5326
|
var datasource_changed = [];
|
|
5327
5327
|
let client_datasource_changes = {};
|
|
5328
5328
|
let server_datasource_changes = {};
|
|
5329
|
+
|
|
5330
|
+
const update_xu_ref = async function (dataSource, field_id) {
|
|
5331
|
+
let ret;
|
|
5332
|
+
let _ds_0 = _session.DS_GLB[0];
|
|
5333
|
+
for ([ref_name, val] of Object.entries(_ds_0.data_system['SYS_GLOBAL_OBJ_REFS'])) {
|
|
5334
|
+
if (val.ds.dsSession == dataSource) {
|
|
5335
|
+
ret = func.UI.update_xu_ref(SESSION_ID, dataSource, ref_name);
|
|
5336
|
+
}
|
|
5337
|
+
}
|
|
5338
|
+
return ret;
|
|
5339
|
+
};
|
|
5340
|
+
|
|
5329
5341
|
// iterate changes datasource
|
|
5330
5342
|
for await (const [dataSource, row_data] of Object.entries(datasource_changes)) {
|
|
5331
5343
|
var _ds = _session.DS_GLB[dataSource];
|
|
@@ -5333,15 +5345,6 @@ func.datasource.update = async function (SESSION_ID, datasource_changes, update_
|
|
|
5333
5345
|
continue;
|
|
5334
5346
|
}
|
|
5335
5347
|
|
|
5336
|
-
const update_xu_ref = async function () {
|
|
5337
|
-
let _ds_0 = _session.DS_GLB[0];
|
|
5338
|
-
for ([ref_name, val] of Object.entries(_ds_0.data_system['SYS_GLOBAL_OBJ_REFS'])) {
|
|
5339
|
-
if (val.ds.dsSession == dataSource) {
|
|
5340
|
-
func.UI.update_xu_ref(SESSION_ID, dataSource, ref_name);
|
|
5341
|
-
}
|
|
5342
|
-
}
|
|
5343
|
-
};
|
|
5344
|
-
|
|
5345
5348
|
// iterate changes records
|
|
5346
5349
|
for (const [record_id, fields_data] of Object.entries(row_data)) {
|
|
5347
5350
|
// iterate changes fields
|
|
@@ -5349,9 +5352,11 @@ func.datasource.update = async function (SESSION_ID, datasource_changes, update_
|
|
|
5349
5352
|
// mechanism to make update directly on the datasource object
|
|
5350
5353
|
if (record_id === 'datasource_main') {
|
|
5351
5354
|
_.set(_ds, field_id, value);
|
|
5352
|
-
update_xu_ref();
|
|
5353
|
-
|
|
5354
|
-
|
|
5355
|
+
const ret = update_xu_ref(dataSource, field_id);
|
|
5356
|
+
if (ret) {
|
|
5357
|
+
fields_changed.push(field_id);
|
|
5358
|
+
datasource_changed.push(dataSource);
|
|
5359
|
+
}
|
|
5355
5360
|
continue;
|
|
5356
5361
|
}
|
|
5357
5362
|
|
|
@@ -5368,7 +5373,7 @@ func.datasource.update = async function (SESSION_ID, datasource_changes, update_
|
|
|
5368
5373
|
await set_fieldComputed_dependencies(dataSource, field_id, null);
|
|
5369
5374
|
|
|
5370
5375
|
// search the field in refs
|
|
5371
|
-
update_xu_ref();
|
|
5376
|
+
update_xu_ref(dataSource, field_id);
|
|
5372
5377
|
|
|
5373
5378
|
if (!update_local_scope_only) {
|
|
5374
5379
|
let tree_ret = await func.utils.TREE_OBJ.get(SESSION_ID, _ds.prog_id);
|
|
@@ -9312,6 +9317,7 @@ func.UI.refs_garbage_collector = function (SESSION_ID = Object.keys(SESSION_OBJ)
|
|
|
9312
9317
|
};
|
|
9313
9318
|
|
|
9314
9319
|
func.UI.update_xu_ref = function (SESSION_ID, dsSessionP, ref_field_id, $elm) {
|
|
9320
|
+
let ret;
|
|
9315
9321
|
const _session = SESSION_OBJ[SESSION_ID];
|
|
9316
9322
|
let _ds_0 = _session.DS_GLB[0];
|
|
9317
9323
|
|
|
@@ -9321,27 +9327,35 @@ func.UI.update_xu_ref = function (SESSION_ID, dsSessionP, ref_field_id, $elm) {
|
|
|
9321
9327
|
|
|
9322
9328
|
let SYS_GLOBAL_OBJ_REFS = _ds_0.data_system['SYS_GLOBAL_OBJ_REFS'];
|
|
9323
9329
|
|
|
9324
|
-
if (!SYS_GLOBAL_OBJ_REFS[ref_field_id]) {
|
|
9325
|
-
|
|
9326
|
-
}
|
|
9327
|
-
SYS_GLOBAL_OBJ_REFS[ref_field_id].ds = _ds;
|
|
9328
|
-
SYS_GLOBAL_OBJ_REFS[ref_field_id].data = _ds?.data_feed?.rows?.[row_idx] || {};
|
|
9329
|
-
SYS_GLOBAL_OBJ_REFS[ref_field_id].props = _ds.in_parameters || {};
|
|
9330
|
-
|
|
9331
|
-
if ($elm) {
|
|
9332
|
-
const attributes = $elm?.data()?.xuData?.xuPanelProps || $elm?.data()?.xuData?.debug_info?.attribute_stat || {};
|
|
9333
|
-
SYS_GLOBAL_OBJ_REFS[ref_field_id].attributes = attributes;
|
|
9334
|
-
SYS_GLOBAL_OBJ_REFS[ref_field_id].xu_ui_id = $elm.attr('xu-ui-id');
|
|
9335
|
-
}
|
|
9336
|
-
|
|
9337
|
-
// let obj = { ds: _ds, data: _ds?.data_feed?.rows?.[row_idx] || {}, props: _ds.in_parameters || {} };
|
|
9330
|
+
// if (!SYS_GLOBAL_OBJ_REFS[ref_field_id]) {
|
|
9331
|
+
// SYS_GLOBAL_OBJ_REFS[ref_field_id] = {};
|
|
9332
|
+
// }
|
|
9333
|
+
// SYS_GLOBAL_OBJ_REFS[ref_field_id].ds = _ds;
|
|
9334
|
+
// SYS_GLOBAL_OBJ_REFS[ref_field_id].data = _ds?.data_feed?.rows?.[row_idx] || {};
|
|
9335
|
+
// SYS_GLOBAL_OBJ_REFS[ref_field_id].props = _ds.in_parameters || {};
|
|
9338
9336
|
|
|
9339
9337
|
// if ($elm) {
|
|
9340
9338
|
// const attributes = $elm?.data()?.xuData?.xuPanelProps || $elm?.data()?.xuData?.debug_info?.attribute_stat || {};
|
|
9341
|
-
//
|
|
9342
|
-
//
|
|
9339
|
+
// SYS_GLOBAL_OBJ_REFS[ref_field_id].attributes = attributes;
|
|
9340
|
+
// SYS_GLOBAL_OBJ_REFS[ref_field_id].xu_ui_id = $elm.attr('xu-ui-id');
|
|
9343
9341
|
// }
|
|
9344
9342
|
|
|
9343
|
+
let obj = { ds: _ds, data: _ds?.data_feed?.rows?.[row_idx] || {}, props: _ds.in_parameters || {} };
|
|
9344
|
+
|
|
9345
|
+
if ($elm) {
|
|
9346
|
+
const attributes = $elm?.data()?.xuData?.xuPanelProps || $elm?.data()?.xuData?.debug_info?.attribute_stat || {};
|
|
9347
|
+
obj.attributes = attributes;
|
|
9348
|
+
obj.xu_ui_id = $elm.attr('xu-ui-id');
|
|
9349
|
+
}
|
|
9350
|
+
|
|
9351
|
+
if (!_.isEqual(SYS_GLOBAL_OBJ_REFS?.[ref_field_id] || {}, obj)) {
|
|
9352
|
+
if (!SYS_GLOBAL_OBJ_REFS[ref_field_id]) {
|
|
9353
|
+
SYS_GLOBAL_OBJ_REFS[ref_field_id] = {};
|
|
9354
|
+
}
|
|
9355
|
+
SYS_GLOBAL_OBJ_REFS[ref_field_id] = obj;
|
|
9356
|
+
ret = true;
|
|
9357
|
+
}
|
|
9358
|
+
return ret;
|
|
9345
9359
|
// func.datasource.update(SESSION_ID, {
|
|
9346
9360
|
// [0]: {
|
|
9347
9361
|
// ['datasource_main']: {
|