@xuda.io/runtime-bundle 1.0.271 → 1.0.273
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.
|
@@ -33756,72 +33756,89 @@ func.UI.screen.execute_xu_functions = async function (
|
|
|
33756
33756
|
const common_fx = {
|
|
33757
33757
|
"xu-bind": async function ($elm, val) {
|
|
33758
33758
|
if (is_skeleton) return;
|
|
33759
|
-
|
|
33759
|
+
|
|
33760
33760
|
let view_field_id = val.value;
|
|
33761
|
+
|
|
33762
|
+
|
|
33761
33763
|
let _prog_id = $elm.data().xuData.paramsP.prog_id;
|
|
33762
33764
|
let _dsP = $elm.data().xuData.paramsP.dsSessionP;
|
|
33763
33765
|
const view_ret = await func.utils.VIEWS_OBJ.get(SESSION_ID, _prog_id);
|
|
33764
33766
|
if (!view_ret) return {};
|
|
33765
33767
|
|
|
33766
|
-
|
|
33767
33768
|
let is_dynamic_field = false
|
|
33768
|
-
let field_prop
|
|
33769
|
-
|
|
33770
|
-
// const iterate_info = $elm?.data()?.xuData?.iterate_info
|
|
33771
|
-
// const reference_source_obj = iterate_info?.reference_source_obj
|
|
33772
|
-
|
|
33769
|
+
let field_prop;
|
|
33770
|
+
let bind_field_id
|
|
33773
33771
|
|
|
33772
|
+
const get_bind_field = async function (field_id) {
|
|
33773
|
+
if (["_FOR_VAL", "_FOR_KEY"].includes(field_id)) {
|
|
33774
|
+
is_dynamic_field = true
|
|
33775
|
+
field_prop = _ds.dynamic_fields[field_id]
|
|
33776
|
+
} else {
|
|
33777
|
+
field_prop = func.common.find_item_by_key(
|
|
33778
|
+
view_ret.progFields,
|
|
33779
|
+
"field_id",
|
|
33780
|
+
field_id
|
|
33781
|
+
);
|
|
33782
|
+
if (!field_prop) {
|
|
33783
|
+
/// find the field everywhere in the chain Aug 30 2024
|
|
33784
|
+
const ret_get_value = await func.datasource.get_value(
|
|
33785
|
+
SESSION_ID,
|
|
33786
|
+
field_id,
|
|
33787
|
+
_dsP // $elm.data().xuData.paramsP.dsSessionP
|
|
33788
|
+
);
|
|
33774
33789
|
|
|
33775
|
-
|
|
33776
|
-
|
|
33777
|
-
|
|
33778
|
-
|
|
33779
|
-
|
|
33790
|
+
if (ret_get_value.found) {
|
|
33791
|
+
_dsP = ret_get_value.dsSessionP;
|
|
33792
|
+
let _ds = SESSION_OBJ[SESSION_ID].DS_GLB[_dsP];
|
|
33793
|
+
_prog_id = _ds.prog_id;
|
|
33794
|
+
const view_ret = await func.utils.VIEWS_OBJ.get(SESSION_ID, _prog_id);
|
|
33795
|
+
if (!view_ret) return {};
|
|
33796
|
+
field_prop = func.common.find_item_by_key(
|
|
33797
|
+
view_ret.progFields,
|
|
33798
|
+
"field_id",
|
|
33799
|
+
field_id
|
|
33800
|
+
);
|
|
33801
|
+
}
|
|
33802
|
+
if (!field_prop) {
|
|
33803
|
+
throw (`field ${field_id} not found in the program scope`)
|
|
33804
|
+
}
|
|
33805
|
+
}
|
|
33806
|
+
}
|
|
33807
|
+
return field_id
|
|
33808
|
+
}
|
|
33780
33809
|
|
|
33781
|
-
|
|
33782
|
-
|
|
33783
|
-
|
|
33810
|
+
try {
|
|
33811
|
+
bind_field_id = await get_bind_field(val.value)
|
|
33812
|
+
} catch (err) {
|
|
33813
|
+
try {
|
|
33784
33814
|
|
|
33785
|
-
|
|
33786
|
-
|
|
33787
|
-
|
|
33788
|
-
|
|
33789
|
-
|
|
33790
|
-
|
|
33791
|
-
|
|
33792
|
-
|
|
33793
|
-
|
|
33794
|
-
view_field_id
|
|
33795
|
-
);
|
|
33796
|
-
if (!field_prop) {
|
|
33797
|
-
/// find the field everywhere in the chain Aug 30 2024
|
|
33798
|
-
const ret_get_value = await func.datasource.get_value(
|
|
33799
|
-
SESSION_ID,
|
|
33800
|
-
view_field_id,
|
|
33801
|
-
_dsP // $elm.data().xuData.paramsP.dsSessionP
|
|
33802
|
-
);
|
|
33815
|
+
if (!_.isEmpty($elm?.data()?.xuAttributes?.["xu-exp:xu-bind"])) {
|
|
33816
|
+
const res = (
|
|
33817
|
+
await func.expression.get(
|
|
33818
|
+
SESSION_ID,
|
|
33819
|
+
$elm.data().xuAttributes["xu-exp:xu-bind"],
|
|
33820
|
+
paramsP.dsSessionP,
|
|
33821
|
+
"UI Attr EXP"
|
|
33822
|
+
)
|
|
33823
|
+
)
|
|
33803
33824
|
|
|
33804
|
-
|
|
33805
|
-
|
|
33806
|
-
|
|
33807
|
-
|
|
33808
|
-
|
|
33809
|
-
|
|
33810
|
-
|
|
33811
|
-
|
|
33812
|
-
"field_id",
|
|
33813
|
-
view_field_id
|
|
33814
|
-
);
|
|
33815
|
-
}
|
|
33816
|
-
if (!field_prop) {
|
|
33817
|
-
console.error(
|
|
33818
|
-
`field ${view_field_id} not found in the program scope`
|
|
33819
|
-
);
|
|
33820
|
-
return {};
|
|
33825
|
+
if (Object.keys(res.fields).length) {
|
|
33826
|
+
const field_id_from_exp = Object.keys(res.fields)[0]
|
|
33827
|
+
bind_field_id = await get_bind_field(field_id_from_exp)
|
|
33828
|
+
} else {
|
|
33829
|
+
throw (err.message)
|
|
33830
|
+
}
|
|
33831
|
+
} else {
|
|
33832
|
+
throw (err.message)
|
|
33821
33833
|
}
|
|
33834
|
+
} catch (err) {
|
|
33835
|
+
console.error(err.message);
|
|
33836
|
+
return {};
|
|
33822
33837
|
}
|
|
33838
|
+
return {};
|
|
33823
33839
|
}
|
|
33824
33840
|
|
|
33841
|
+
|
|
33825
33842
|
const field_changed = async function (e) {
|
|
33826
33843
|
|
|
33827
33844
|
var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[_dsP];
|
|
@@ -33840,7 +33857,7 @@ func.UI.screen.execute_xu_functions = async function (
|
|
|
33840
33857
|
let datasource_changes = {
|
|
33841
33858
|
[_dsP]: {
|
|
33842
33859
|
[_ds.currentRecordId]: {
|
|
33843
|
-
[
|
|
33860
|
+
[bind_field_id]: value,
|
|
33844
33861
|
},
|
|
33845
33862
|
},
|
|
33846
33863
|
};
|
|
@@ -33850,7 +33867,7 @@ func.UI.screen.execute_xu_functions = async function (
|
|
|
33850
33867
|
const reference_source_obj = iterate_info?.reference_source_obj
|
|
33851
33868
|
if (reference_source_obj) {
|
|
33852
33869
|
if (reference_source_obj.ret.type === "array") {
|
|
33853
|
-
if (iterate_info.iterator_val ===
|
|
33870
|
+
if (iterate_info.iterator_val === bind_field_id) {
|
|
33854
33871
|
let new_arr = reference_source_obj.ret.value
|
|
33855
33872
|
new_arr[Number($elm?.data()?.xuData?.iterate_info._key)] = value
|
|
33856
33873
|
datasource_changes[_dsP][_ds.currentRecordId][reference_source_obj.fieldIdP] = new_arr
|
|
@@ -33886,7 +33903,7 @@ func.UI.screen.execute_xu_functions = async function (
|
|
|
33886
33903
|
let value
|
|
33887
33904
|
try {
|
|
33888
33905
|
if (is_dynamic_field) {
|
|
33889
|
-
value = _ds.dynamic_fields[
|
|
33906
|
+
value = _ds.dynamic_fields[bind_field_id].value;
|
|
33890
33907
|
} else {
|
|
33891
33908
|
const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
|
|
33892
33909
|
value = _ds.data_feed.rows?.[row_idx]?.[val.value];
|