@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.
package/js/xuda-runtime-slim.js
CHANGED
|
@@ -14387,72 +14387,89 @@ func.UI.screen.execute_xu_functions = async function (
|
|
|
14387
14387
|
const common_fx = {
|
|
14388
14388
|
"xu-bind": async function ($elm, val) {
|
|
14389
14389
|
if (is_skeleton) return;
|
|
14390
|
-
|
|
14390
|
+
|
|
14391
14391
|
let view_field_id = val.value;
|
|
14392
|
+
|
|
14393
|
+
|
|
14392
14394
|
let _prog_id = $elm.data().xuData.paramsP.prog_id;
|
|
14393
14395
|
let _dsP = $elm.data().xuData.paramsP.dsSessionP;
|
|
14394
14396
|
const view_ret = await func.utils.VIEWS_OBJ.get(SESSION_ID, _prog_id);
|
|
14395
14397
|
if (!view_ret) return {};
|
|
14396
14398
|
|
|
14397
|
-
|
|
14398
14399
|
let is_dynamic_field = false
|
|
14399
|
-
let field_prop
|
|
14400
|
-
|
|
14401
|
-
// const iterate_info = $elm?.data()?.xuData?.iterate_info
|
|
14402
|
-
// const reference_source_obj = iterate_info?.reference_source_obj
|
|
14403
|
-
|
|
14400
|
+
let field_prop;
|
|
14401
|
+
let bind_field_id
|
|
14404
14402
|
|
|
14403
|
+
const get_bind_field = async function (field_id) {
|
|
14404
|
+
if (["_FOR_VAL", "_FOR_KEY"].includes(field_id)) {
|
|
14405
|
+
is_dynamic_field = true
|
|
14406
|
+
field_prop = _ds.dynamic_fields[field_id]
|
|
14407
|
+
} else {
|
|
14408
|
+
field_prop = func.common.find_item_by_key(
|
|
14409
|
+
view_ret.progFields,
|
|
14410
|
+
"field_id",
|
|
14411
|
+
field_id
|
|
14412
|
+
);
|
|
14413
|
+
if (!field_prop) {
|
|
14414
|
+
/// find the field everywhere in the chain Aug 30 2024
|
|
14415
|
+
const ret_get_value = await func.datasource.get_value(
|
|
14416
|
+
SESSION_ID,
|
|
14417
|
+
field_id,
|
|
14418
|
+
_dsP // $elm.data().xuData.paramsP.dsSessionP
|
|
14419
|
+
);
|
|
14405
14420
|
|
|
14406
|
-
|
|
14407
|
-
|
|
14408
|
-
|
|
14409
|
-
|
|
14410
|
-
|
|
14421
|
+
if (ret_get_value.found) {
|
|
14422
|
+
_dsP = ret_get_value.dsSessionP;
|
|
14423
|
+
let _ds = SESSION_OBJ[SESSION_ID].DS_GLB[_dsP];
|
|
14424
|
+
_prog_id = _ds.prog_id;
|
|
14425
|
+
const view_ret = await func.utils.VIEWS_OBJ.get(SESSION_ID, _prog_id);
|
|
14426
|
+
if (!view_ret) return {};
|
|
14427
|
+
field_prop = func.common.find_item_by_key(
|
|
14428
|
+
view_ret.progFields,
|
|
14429
|
+
"field_id",
|
|
14430
|
+
field_id
|
|
14431
|
+
);
|
|
14432
|
+
}
|
|
14433
|
+
if (!field_prop) {
|
|
14434
|
+
throw (`field ${field_id} not found in the program scope`)
|
|
14435
|
+
}
|
|
14436
|
+
}
|
|
14437
|
+
}
|
|
14438
|
+
return field_id
|
|
14439
|
+
}
|
|
14411
14440
|
|
|
14412
|
-
|
|
14413
|
-
|
|
14414
|
-
|
|
14441
|
+
try {
|
|
14442
|
+
bind_field_id = await get_bind_field(val.value)
|
|
14443
|
+
} catch (err) {
|
|
14444
|
+
try {
|
|
14415
14445
|
|
|
14416
|
-
|
|
14417
|
-
|
|
14418
|
-
|
|
14419
|
-
|
|
14420
|
-
|
|
14421
|
-
|
|
14422
|
-
|
|
14423
|
-
|
|
14424
|
-
|
|
14425
|
-
view_field_id
|
|
14426
|
-
);
|
|
14427
|
-
if (!field_prop) {
|
|
14428
|
-
/// find the field everywhere in the chain Aug 30 2024
|
|
14429
|
-
const ret_get_value = await func.datasource.get_value(
|
|
14430
|
-
SESSION_ID,
|
|
14431
|
-
view_field_id,
|
|
14432
|
-
_dsP // $elm.data().xuData.paramsP.dsSessionP
|
|
14433
|
-
);
|
|
14446
|
+
if (!_.isEmpty($elm?.data()?.xuAttributes?.["xu-exp:xu-bind"])) {
|
|
14447
|
+
const res = (
|
|
14448
|
+
await func.expression.get(
|
|
14449
|
+
SESSION_ID,
|
|
14450
|
+
$elm.data().xuAttributes["xu-exp:xu-bind"],
|
|
14451
|
+
paramsP.dsSessionP,
|
|
14452
|
+
"UI Attr EXP"
|
|
14453
|
+
)
|
|
14454
|
+
)
|
|
14434
14455
|
|
|
14435
|
-
|
|
14436
|
-
|
|
14437
|
-
|
|
14438
|
-
|
|
14439
|
-
|
|
14440
|
-
|
|
14441
|
-
|
|
14442
|
-
|
|
14443
|
-
"field_id",
|
|
14444
|
-
view_field_id
|
|
14445
|
-
);
|
|
14446
|
-
}
|
|
14447
|
-
if (!field_prop) {
|
|
14448
|
-
console.error(
|
|
14449
|
-
`field ${view_field_id} not found in the program scope`
|
|
14450
|
-
);
|
|
14451
|
-
return {};
|
|
14456
|
+
if (Object.keys(res.fields).length) {
|
|
14457
|
+
const field_id_from_exp = Object.keys(res.fields)[0]
|
|
14458
|
+
bind_field_id = await get_bind_field(field_id_from_exp)
|
|
14459
|
+
} else {
|
|
14460
|
+
throw (err.message)
|
|
14461
|
+
}
|
|
14462
|
+
} else {
|
|
14463
|
+
throw (err.message)
|
|
14452
14464
|
}
|
|
14465
|
+
} catch (err) {
|
|
14466
|
+
console.error(err.message);
|
|
14467
|
+
return {};
|
|
14453
14468
|
}
|
|
14469
|
+
return {};
|
|
14454
14470
|
}
|
|
14455
14471
|
|
|
14472
|
+
|
|
14456
14473
|
const field_changed = async function (e) {
|
|
14457
14474
|
|
|
14458
14475
|
var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[_dsP];
|
|
@@ -14471,7 +14488,7 @@ func.UI.screen.execute_xu_functions = async function (
|
|
|
14471
14488
|
let datasource_changes = {
|
|
14472
14489
|
[_dsP]: {
|
|
14473
14490
|
[_ds.currentRecordId]: {
|
|
14474
|
-
[
|
|
14491
|
+
[bind_field_id]: value,
|
|
14475
14492
|
},
|
|
14476
14493
|
},
|
|
14477
14494
|
};
|
|
@@ -14481,7 +14498,7 @@ func.UI.screen.execute_xu_functions = async function (
|
|
|
14481
14498
|
const reference_source_obj = iterate_info?.reference_source_obj
|
|
14482
14499
|
if (reference_source_obj) {
|
|
14483
14500
|
if (reference_source_obj.ret.type === "array") {
|
|
14484
|
-
if (iterate_info.iterator_val ===
|
|
14501
|
+
if (iterate_info.iterator_val === bind_field_id) {
|
|
14485
14502
|
let new_arr = reference_source_obj.ret.value
|
|
14486
14503
|
new_arr[Number($elm?.data()?.xuData?.iterate_info._key)] = value
|
|
14487
14504
|
datasource_changes[_dsP][_ds.currentRecordId][reference_source_obj.fieldIdP] = new_arr
|
|
@@ -14517,7 +14534,7 @@ func.UI.screen.execute_xu_functions = async function (
|
|
|
14517
14534
|
let value
|
|
14518
14535
|
try {
|
|
14519
14536
|
if (is_dynamic_field) {
|
|
14520
|
-
value = _ds.dynamic_fields[
|
|
14537
|
+
value = _ds.dynamic_fields[bind_field_id].value;
|
|
14521
14538
|
} else {
|
|
14522
14539
|
const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
|
|
14523
14540
|
value = _ds.data_feed.rows?.[row_idx]?.[val.value];
|
|
@@ -11797,72 +11797,89 @@ func.UI.screen.execute_xu_functions = async function (
|
|
|
11797
11797
|
const common_fx = {
|
|
11798
11798
|
"xu-bind": async function ($elm, val) {
|
|
11799
11799
|
if (is_skeleton) return;
|
|
11800
|
-
|
|
11800
|
+
|
|
11801
11801
|
let view_field_id = val.value;
|
|
11802
|
+
|
|
11803
|
+
|
|
11802
11804
|
let _prog_id = $elm.data().xuData.paramsP.prog_id;
|
|
11803
11805
|
let _dsP = $elm.data().xuData.paramsP.dsSessionP;
|
|
11804
11806
|
const view_ret = await func.utils.VIEWS_OBJ.get(SESSION_ID, _prog_id);
|
|
11805
11807
|
if (!view_ret) return {};
|
|
11806
11808
|
|
|
11807
|
-
|
|
11808
11809
|
let is_dynamic_field = false
|
|
11809
|
-
let field_prop
|
|
11810
|
-
|
|
11811
|
-
// const iterate_info = $elm?.data()?.xuData?.iterate_info
|
|
11812
|
-
// const reference_source_obj = iterate_info?.reference_source_obj
|
|
11813
|
-
|
|
11810
|
+
let field_prop;
|
|
11811
|
+
let bind_field_id
|
|
11814
11812
|
|
|
11813
|
+
const get_bind_field = async function (field_id) {
|
|
11814
|
+
if (["_FOR_VAL", "_FOR_KEY"].includes(field_id)) {
|
|
11815
|
+
is_dynamic_field = true
|
|
11816
|
+
field_prop = _ds.dynamic_fields[field_id]
|
|
11817
|
+
} else {
|
|
11818
|
+
field_prop = func.common.find_item_by_key(
|
|
11819
|
+
view_ret.progFields,
|
|
11820
|
+
"field_id",
|
|
11821
|
+
field_id
|
|
11822
|
+
);
|
|
11823
|
+
if (!field_prop) {
|
|
11824
|
+
/// find the field everywhere in the chain Aug 30 2024
|
|
11825
|
+
const ret_get_value = await func.datasource.get_value(
|
|
11826
|
+
SESSION_ID,
|
|
11827
|
+
field_id,
|
|
11828
|
+
_dsP // $elm.data().xuData.paramsP.dsSessionP
|
|
11829
|
+
);
|
|
11815
11830
|
|
|
11816
|
-
|
|
11817
|
-
|
|
11818
|
-
|
|
11819
|
-
|
|
11820
|
-
|
|
11831
|
+
if (ret_get_value.found) {
|
|
11832
|
+
_dsP = ret_get_value.dsSessionP;
|
|
11833
|
+
let _ds = SESSION_OBJ[SESSION_ID].DS_GLB[_dsP];
|
|
11834
|
+
_prog_id = _ds.prog_id;
|
|
11835
|
+
const view_ret = await func.utils.VIEWS_OBJ.get(SESSION_ID, _prog_id);
|
|
11836
|
+
if (!view_ret) return {};
|
|
11837
|
+
field_prop = func.common.find_item_by_key(
|
|
11838
|
+
view_ret.progFields,
|
|
11839
|
+
"field_id",
|
|
11840
|
+
field_id
|
|
11841
|
+
);
|
|
11842
|
+
}
|
|
11843
|
+
if (!field_prop) {
|
|
11844
|
+
throw (`field ${field_id} not found in the program scope`)
|
|
11845
|
+
}
|
|
11846
|
+
}
|
|
11847
|
+
}
|
|
11848
|
+
return field_id
|
|
11849
|
+
}
|
|
11821
11850
|
|
|
11822
|
-
|
|
11823
|
-
|
|
11824
|
-
|
|
11851
|
+
try {
|
|
11852
|
+
bind_field_id = await get_bind_field(val.value)
|
|
11853
|
+
} catch (err) {
|
|
11854
|
+
try {
|
|
11825
11855
|
|
|
11826
|
-
|
|
11827
|
-
|
|
11828
|
-
|
|
11829
|
-
|
|
11830
|
-
|
|
11831
|
-
|
|
11832
|
-
|
|
11833
|
-
|
|
11834
|
-
|
|
11835
|
-
view_field_id
|
|
11836
|
-
);
|
|
11837
|
-
if (!field_prop) {
|
|
11838
|
-
/// find the field everywhere in the chain Aug 30 2024
|
|
11839
|
-
const ret_get_value = await func.datasource.get_value(
|
|
11840
|
-
SESSION_ID,
|
|
11841
|
-
view_field_id,
|
|
11842
|
-
_dsP // $elm.data().xuData.paramsP.dsSessionP
|
|
11843
|
-
);
|
|
11856
|
+
if (!_.isEmpty($elm?.data()?.xuAttributes?.["xu-exp:xu-bind"])) {
|
|
11857
|
+
const res = (
|
|
11858
|
+
await func.expression.get(
|
|
11859
|
+
SESSION_ID,
|
|
11860
|
+
$elm.data().xuAttributes["xu-exp:xu-bind"],
|
|
11861
|
+
paramsP.dsSessionP,
|
|
11862
|
+
"UI Attr EXP"
|
|
11863
|
+
)
|
|
11864
|
+
)
|
|
11844
11865
|
|
|
11845
|
-
|
|
11846
|
-
|
|
11847
|
-
|
|
11848
|
-
|
|
11849
|
-
|
|
11850
|
-
|
|
11851
|
-
|
|
11852
|
-
|
|
11853
|
-
"field_id",
|
|
11854
|
-
view_field_id
|
|
11855
|
-
);
|
|
11856
|
-
}
|
|
11857
|
-
if (!field_prop) {
|
|
11858
|
-
console.error(
|
|
11859
|
-
`field ${view_field_id} not found in the program scope`
|
|
11860
|
-
);
|
|
11861
|
-
return {};
|
|
11866
|
+
if (Object.keys(res.fields).length) {
|
|
11867
|
+
const field_id_from_exp = Object.keys(res.fields)[0]
|
|
11868
|
+
bind_field_id = await get_bind_field(field_id_from_exp)
|
|
11869
|
+
} else {
|
|
11870
|
+
throw (err.message)
|
|
11871
|
+
}
|
|
11872
|
+
} else {
|
|
11873
|
+
throw (err.message)
|
|
11862
11874
|
}
|
|
11875
|
+
} catch (err) {
|
|
11876
|
+
console.error(err.message);
|
|
11877
|
+
return {};
|
|
11863
11878
|
}
|
|
11879
|
+
return {};
|
|
11864
11880
|
}
|
|
11865
11881
|
|
|
11882
|
+
|
|
11866
11883
|
const field_changed = async function (e) {
|
|
11867
11884
|
|
|
11868
11885
|
var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[_dsP];
|
|
@@ -11881,7 +11898,7 @@ func.UI.screen.execute_xu_functions = async function (
|
|
|
11881
11898
|
let datasource_changes = {
|
|
11882
11899
|
[_dsP]: {
|
|
11883
11900
|
[_ds.currentRecordId]: {
|
|
11884
|
-
[
|
|
11901
|
+
[bind_field_id]: value,
|
|
11885
11902
|
},
|
|
11886
11903
|
},
|
|
11887
11904
|
};
|
|
@@ -11891,7 +11908,7 @@ func.UI.screen.execute_xu_functions = async function (
|
|
|
11891
11908
|
const reference_source_obj = iterate_info?.reference_source_obj
|
|
11892
11909
|
if (reference_source_obj) {
|
|
11893
11910
|
if (reference_source_obj.ret.type === "array") {
|
|
11894
|
-
if (iterate_info.iterator_val ===
|
|
11911
|
+
if (iterate_info.iterator_val === bind_field_id) {
|
|
11895
11912
|
let new_arr = reference_source_obj.ret.value
|
|
11896
11913
|
new_arr[Number($elm?.data()?.xuData?.iterate_info._key)] = value
|
|
11897
11914
|
datasource_changes[_dsP][_ds.currentRecordId][reference_source_obj.fieldIdP] = new_arr
|
|
@@ -11927,7 +11944,7 @@ func.UI.screen.execute_xu_functions = async function (
|
|
|
11927
11944
|
let value
|
|
11928
11945
|
try {
|
|
11929
11946
|
if (is_dynamic_field) {
|
|
11930
|
-
value = _ds.dynamic_fields[
|
|
11947
|
+
value = _ds.dynamic_fields[bind_field_id].value;
|
|
11931
11948
|
} else {
|
|
11932
11949
|
const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
|
|
11933
11950
|
value = _ds.data_feed.rows?.[row_idx]?.[val.value];
|