@xuda.io/xuda-worker-bundle 1.3.1243 → 1.3.1245
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/index.js +12 -6
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -4115,13 +4115,13 @@ func.datasource.update = async function (
|
|
|
4115
4115
|
).system_globals;
|
|
4116
4116
|
}
|
|
4117
4117
|
|
|
4118
|
-
const set_fieldComputed_dependencies = async function (dsNo,
|
|
4118
|
+
const set_fieldComputed_dependencies = async function (dsNo, field_id, value) {
|
|
4119
4119
|
// check if field has fieldComputed property
|
|
4120
4120
|
const _progFields = await func.datasource.get_progFields(
|
|
4121
4121
|
SESSION_ID,
|
|
4122
|
-
|
|
4122
|
+
dsNo
|
|
4123
4123
|
);
|
|
4124
|
-
|
|
4124
|
+
// find if field is computed
|
|
4125
4125
|
let propExpressions
|
|
4126
4126
|
for await (const val of _progFields) {
|
|
4127
4127
|
|
|
@@ -4130,20 +4130,25 @@ func.datasource.update = async function (
|
|
|
4130
4130
|
if (fieldId !== field_id) continue
|
|
4131
4131
|
if (val.data.type !== "virtual" || !val.props.fieldComputed) break
|
|
4132
4132
|
|
|
4133
|
-
|
|
4134
|
-
|
|
4133
|
+
const _propExpressions = val.props?.propExpressions?.fieldValue
|
|
4134
|
+
if (_propExpressions && JSON.stringify(_propExpressions).includes(field_id)) {
|
|
4135
|
+
propExpressions = _propExpressions
|
|
4136
|
+
}
|
|
4135
4137
|
}
|
|
4136
4138
|
|
|
4137
4139
|
if (!propExpressions) return
|
|
4138
4140
|
|
|
4139
|
-
let new_datasource_changes = {}
|
|
4141
|
+
let new_datasource_changes = {};
|
|
4142
|
+
// iterate child ds
|
|
4140
4143
|
for (const _ds of _session.DS_GLB) {
|
|
4141
4144
|
if (_ds.parentDataSourceNo !== dsNo) continue
|
|
4142
4145
|
|
|
4143
4146
|
if (!new_datasource_changes[_ds.dsSession]) {
|
|
4144
4147
|
new_datasource_changes[_ds.dsSession] = {}
|
|
4145
4148
|
}
|
|
4149
|
+
// iterate ds rows
|
|
4146
4150
|
for (const row of _ds.data_feed?.rows || []) {
|
|
4151
|
+
// iterate row fields
|
|
4147
4152
|
for (const [key, val] of Object.entries(row)) {
|
|
4148
4153
|
if (key !== field_id) return
|
|
4149
4154
|
try {
|
|
@@ -4205,6 +4210,7 @@ func.datasource.update = async function (
|
|
|
4205
4210
|
try {
|
|
4206
4211
|
const row_idx = func.common.find_ROWID_idx(_ds, record_id);
|
|
4207
4212
|
_ds.data_feed.rows[row_idx][field_id] = value;
|
|
4213
|
+
await set_fieldComputed_dependencies(dataSource, field_id, value)
|
|
4208
4214
|
} catch (err) {
|
|
4209
4215
|
console.error(err);
|
|
4210
4216
|
}
|