@xuda.io/runtime-bundle 1.0.251 → 1.0.253
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
|
@@ -14388,7 +14388,7 @@ func.UI.screen.execute_xu_functions = async function (
|
|
|
14388
14388
|
"xu-bind": async function ($elm, val) {
|
|
14389
14389
|
if (is_skeleton) return;
|
|
14390
14390
|
$f = $elm;
|
|
14391
|
-
|
|
14391
|
+
let view_field_id = val.value;
|
|
14392
14392
|
let _prog_id = $elm.data().xuData.paramsP.prog_id;
|
|
14393
14393
|
let _dsP = $elm.data().xuData.paramsP.dsSessionP;
|
|
14394
14394
|
const view_ret = await func.utils.VIEWS_OBJ.get(SESSION_ID, _prog_id);
|
|
@@ -14398,6 +14398,13 @@ func.UI.screen.execute_xu_functions = async function (
|
|
|
14398
14398
|
let is_dynamic_field = false
|
|
14399
14399
|
let field_prop
|
|
14400
14400
|
|
|
14401
|
+
const iterate_info = $elm?.data()?.xuData?.iterate_info
|
|
14402
|
+
const reference_source_obj = iterate_info?.reference_source_obj
|
|
14403
|
+
|
|
14404
|
+
if (reference_source_obj) {
|
|
14405
|
+
view_field_id = (reference_source_obj.fieldIdP || "") + val.value;
|
|
14406
|
+
}
|
|
14407
|
+
|
|
14401
14408
|
if (["_FOR_VAL", "_FOR_KEY"].includes(view_field_id)) {
|
|
14402
14409
|
is_dynamic_field = true
|
|
14403
14410
|
field_prop = _ds.dynamic_fields[view_field_id]
|
|
@@ -14678,12 +14685,12 @@ func.UI.screen.execute_xu_functions = async function (
|
|
|
14678
14685
|
"xu-for": async function ($elm, data) {
|
|
14679
14686
|
if (parent_infoP?.iterate_info || !data.value) return {};
|
|
14680
14687
|
try {
|
|
14681
|
-
|
|
14688
|
+
// data.value (xu-for) can store actual values such as an array, a CSV, or a field_id that references a specific field within the dataset, initialized with values for the iteration.
|
|
14682
14689
|
let arr = data.value;
|
|
14683
14690
|
|
|
14684
14691
|
// find reference source field
|
|
14685
14692
|
let reference_source_obj
|
|
14686
|
-
|
|
14693
|
+
|
|
14687
14694
|
const _progFields = await func.datasource.get_progFields(
|
|
14688
14695
|
SESSION_ID,
|
|
14689
14696
|
paramsP.dsSessionP
|
|
@@ -14694,28 +14701,13 @@ func.UI.screen.execute_xu_functions = async function (
|
|
|
14694
14701
|
"field_id",
|
|
14695
14702
|
data.value
|
|
14696
14703
|
);
|
|
14704
|
+
// detect if data.value (xu-for) is reference field_id by checking if exist in the dataset
|
|
14697
14705
|
if (view_field_obj) {
|
|
14698
|
-
//
|
|
14699
|
-
// try {
|
|
14700
|
-
// const row_idx = func.common.find_ROWID_idx(
|
|
14701
|
-
// _ds,
|
|
14702
|
-
// currentRecordId
|
|
14703
|
-
// );
|
|
14704
|
-
// reference_source_field = data.value
|
|
14705
|
-
|
|
14706
|
-
// arr = await func.datasource.get_value(SESSION_ID, paramsP.dsSessionP, reference_source_field)
|
|
14707
|
-
// } catch (err) {
|
|
14708
|
-
|
|
14709
|
-
// }
|
|
14710
|
-
// reference_source_field_id = data.value
|
|
14711
|
-
// reference_source_field_type=
|
|
14712
|
-
|
|
14706
|
+
// xu-for is reference field_id
|
|
14713
14707
|
reference_source_obj = await func.datasource.get_value(SESSION_ID, data.value, paramsP.dsSessionP)
|
|
14714
14708
|
arr = reference_source_obj?.ret?.value
|
|
14715
14709
|
} else {
|
|
14716
|
-
//
|
|
14717
|
-
|
|
14718
|
-
|
|
14710
|
+
// xu-for is actual data
|
|
14719
14711
|
if (typeof data.value === "string") {
|
|
14720
14712
|
arr = eval(data.value.replaceAll("\\", ""));
|
|
14721
14713
|
}
|
|
@@ -14723,43 +14715,41 @@ func.UI.screen.execute_xu_functions = async function (
|
|
|
14723
14715
|
arr = Array.from(Array(arr).keys());
|
|
14724
14716
|
}
|
|
14725
14717
|
}
|
|
14726
|
-
// } catch (err) {
|
|
14727
|
-
|
|
14728
|
-
// }
|
|
14729
|
-
|
|
14730
|
-
|
|
14731
|
-
|
|
14732
14718
|
|
|
14719
|
+
const custom_iterator_key = $elm.data().xuData.iterator_key
|
|
14720
|
+
const custom_iterator_val = $elm.data().xuData.iterator_val
|
|
14733
14721
|
|
|
14722
|
+
let iterator_key = custom_iterator_key
|
|
14723
|
+
let iterator_val = custom_iterator_val
|
|
14734
14724
|
|
|
14725
|
+
// custom FOR_VAL name or namespaced default name
|
|
14726
|
+
if (!custom_iterator_key) {
|
|
14727
|
+
is_key_dynamic_field = true
|
|
14728
|
+
iterator_key = (reference_source_obj?.fieldIdP || "") + "_FOR_KEY";
|
|
14729
|
+
}
|
|
14735
14730
|
|
|
14731
|
+
if (!custom_iterator_val) {
|
|
14732
|
+
is_val_dynamic_field = true
|
|
14733
|
+
iterator_val = (reference_source_obj?.fieldIdP || "") + "_FOR_VAL";
|
|
14734
|
+
}
|
|
14736
14735
|
|
|
14737
|
-
// if (typeof data.value === "string") {
|
|
14738
|
-
// arr = eval(data.value.replaceAll("\\", ""));
|
|
14739
|
-
// }
|
|
14740
|
-
// if (typeof arr === "number") {
|
|
14741
|
-
// arr = Array.from(Array(arr).keys());
|
|
14742
|
-
// }
|
|
14743
|
-
let iterator_val = $elm.data().xuData.iterator_val;
|
|
14744
|
-
let iterator_key = $elm.data().xuData.iterator_key;
|
|
14745
14736
|
var i = 0;
|
|
14746
14737
|
for await (let [_key, _val] of Object.entries(arr)) {
|
|
14747
14738
|
|
|
14748
14739
|
if (_.isArray(arr)) { _key = Number(_key) }
|
|
14749
14740
|
|
|
14750
|
-
const set_value = async function (currentRecordId, field_id, value) {
|
|
14751
|
-
let is_dynamic_field = false;
|
|
14741
|
+
const set_value = async function (is_dynamic_field, currentRecordId, field_id, value) {
|
|
14752
14742
|
|
|
14753
14743
|
|
|
14744
|
+
if (is_dynamic_field) {
|
|
14754
14745
|
|
|
14755
|
-
if (["_FOR_VAL", "_FOR_KEY"].includes(field_id)) {
|
|
14756
|
-
is_dynamic_field = true;
|
|
14757
14746
|
func.datasource.add_dynamic_field_to_ds(
|
|
14758
14747
|
SESSION_ID,
|
|
14759
14748
|
paramsP.dsSessionP,
|
|
14760
14749
|
field_id,
|
|
14761
14750
|
value
|
|
14762
14751
|
);
|
|
14752
|
+
|
|
14763
14753
|
} else {
|
|
14764
14754
|
|
|
14765
14755
|
const _progFields = await func.datasource.get_progFields(
|
|
@@ -14788,7 +14778,7 @@ func.UI.screen.execute_xu_functions = async function (
|
|
|
14788
14778
|
}
|
|
14789
14779
|
}
|
|
14790
14780
|
|
|
14791
|
-
|
|
14781
|
+
|
|
14792
14782
|
};
|
|
14793
14783
|
|
|
14794
14784
|
var currentRecordId =
|
|
@@ -14796,17 +14786,16 @@ func.UI.screen.execute_xu_functions = async function (
|
|
|
14796
14786
|
paramsP.dsSessionP
|
|
14797
14787
|
].currentRecordId.toString();
|
|
14798
14788
|
|
|
14799
|
-
|
|
14800
|
-
|
|
14801
|
-
|
|
14789
|
+
await set_value(is_key_dynamic_field, currentRecordId, iterator_key, _key);
|
|
14790
|
+
await set_value(is_val_dynamic_field, currentRecordId, iterator_val, _val);
|
|
14802
14791
|
|
|
14803
14792
|
var iterate_info = {
|
|
14804
14793
|
_val,
|
|
14805
14794
|
_key,
|
|
14806
|
-
iterator_key
|
|
14807
|
-
iterator_val
|
|
14808
|
-
is_val_dynamic_field,
|
|
14795
|
+
iterator_key,
|
|
14796
|
+
iterator_val,
|
|
14809
14797
|
is_key_dynamic_field,
|
|
14798
|
+
is_val_dynamic_field,
|
|
14810
14799
|
reference_source_obj
|
|
14811
14800
|
};
|
|
14812
14801
|
if (parent_infoP) {
|
|
@@ -14836,10 +14825,6 @@ func.UI.screen.execute_xu_functions = async function (
|
|
|
14836
14825
|
$(val).data().xuData.iterate_info = iterate_info;
|
|
14837
14826
|
}
|
|
14838
14827
|
});
|
|
14839
|
-
// // set values in _FOR record
|
|
14840
|
-
// currentRecordId = $divP.data().xuData.ui_id;
|
|
14841
|
-
// set_value(currentRecordId, iterator_key || "_FOR_KEY", _key);
|
|
14842
|
-
// set_value(currentRecordId, iterator_val || "_FOR_VAL", _val);
|
|
14843
14828
|
|
|
14844
14829
|
i++;
|
|
14845
14830
|
}
|
|
@@ -11798,7 +11798,7 @@ func.UI.screen.execute_xu_functions = async function (
|
|
|
11798
11798
|
"xu-bind": async function ($elm, val) {
|
|
11799
11799
|
if (is_skeleton) return;
|
|
11800
11800
|
$f = $elm;
|
|
11801
|
-
|
|
11801
|
+
let view_field_id = val.value;
|
|
11802
11802
|
let _prog_id = $elm.data().xuData.paramsP.prog_id;
|
|
11803
11803
|
let _dsP = $elm.data().xuData.paramsP.dsSessionP;
|
|
11804
11804
|
const view_ret = await func.utils.VIEWS_OBJ.get(SESSION_ID, _prog_id);
|
|
@@ -11808,6 +11808,13 @@ func.UI.screen.execute_xu_functions = async function (
|
|
|
11808
11808
|
let is_dynamic_field = false
|
|
11809
11809
|
let field_prop
|
|
11810
11810
|
|
|
11811
|
+
const iterate_info = $elm?.data()?.xuData?.iterate_info
|
|
11812
|
+
const reference_source_obj = iterate_info?.reference_source_obj
|
|
11813
|
+
|
|
11814
|
+
if (reference_source_obj) {
|
|
11815
|
+
view_field_id = (reference_source_obj.fieldIdP || "") + val.value;
|
|
11816
|
+
}
|
|
11817
|
+
|
|
11811
11818
|
if (["_FOR_VAL", "_FOR_KEY"].includes(view_field_id)) {
|
|
11812
11819
|
is_dynamic_field = true
|
|
11813
11820
|
field_prop = _ds.dynamic_fields[view_field_id]
|
|
@@ -12088,12 +12095,12 @@ func.UI.screen.execute_xu_functions = async function (
|
|
|
12088
12095
|
"xu-for": async function ($elm, data) {
|
|
12089
12096
|
if (parent_infoP?.iterate_info || !data.value) return {};
|
|
12090
12097
|
try {
|
|
12091
|
-
|
|
12098
|
+
// data.value (xu-for) can store actual values such as an array, a CSV, or a field_id that references a specific field within the dataset, initialized with values for the iteration.
|
|
12092
12099
|
let arr = data.value;
|
|
12093
12100
|
|
|
12094
12101
|
// find reference source field
|
|
12095
12102
|
let reference_source_obj
|
|
12096
|
-
|
|
12103
|
+
|
|
12097
12104
|
const _progFields = await func.datasource.get_progFields(
|
|
12098
12105
|
SESSION_ID,
|
|
12099
12106
|
paramsP.dsSessionP
|
|
@@ -12104,28 +12111,13 @@ func.UI.screen.execute_xu_functions = async function (
|
|
|
12104
12111
|
"field_id",
|
|
12105
12112
|
data.value
|
|
12106
12113
|
);
|
|
12114
|
+
// detect if data.value (xu-for) is reference field_id by checking if exist in the dataset
|
|
12107
12115
|
if (view_field_obj) {
|
|
12108
|
-
//
|
|
12109
|
-
// try {
|
|
12110
|
-
// const row_idx = func.common.find_ROWID_idx(
|
|
12111
|
-
// _ds,
|
|
12112
|
-
// currentRecordId
|
|
12113
|
-
// );
|
|
12114
|
-
// reference_source_field = data.value
|
|
12115
|
-
|
|
12116
|
-
// arr = await func.datasource.get_value(SESSION_ID, paramsP.dsSessionP, reference_source_field)
|
|
12117
|
-
// } catch (err) {
|
|
12118
|
-
|
|
12119
|
-
// }
|
|
12120
|
-
// reference_source_field_id = data.value
|
|
12121
|
-
// reference_source_field_type=
|
|
12122
|
-
|
|
12116
|
+
// xu-for is reference field_id
|
|
12123
12117
|
reference_source_obj = await func.datasource.get_value(SESSION_ID, data.value, paramsP.dsSessionP)
|
|
12124
12118
|
arr = reference_source_obj?.ret?.value
|
|
12125
12119
|
} else {
|
|
12126
|
-
//
|
|
12127
|
-
|
|
12128
|
-
|
|
12120
|
+
// xu-for is actual data
|
|
12129
12121
|
if (typeof data.value === "string") {
|
|
12130
12122
|
arr = eval(data.value.replaceAll("\\", ""));
|
|
12131
12123
|
}
|
|
@@ -12133,43 +12125,41 @@ func.UI.screen.execute_xu_functions = async function (
|
|
|
12133
12125
|
arr = Array.from(Array(arr).keys());
|
|
12134
12126
|
}
|
|
12135
12127
|
}
|
|
12136
|
-
// } catch (err) {
|
|
12137
|
-
|
|
12138
|
-
// }
|
|
12139
|
-
|
|
12140
|
-
|
|
12141
|
-
|
|
12142
12128
|
|
|
12129
|
+
const custom_iterator_key = $elm.data().xuData.iterator_key
|
|
12130
|
+
const custom_iterator_val = $elm.data().xuData.iterator_val
|
|
12143
12131
|
|
|
12132
|
+
let iterator_key = custom_iterator_key
|
|
12133
|
+
let iterator_val = custom_iterator_val
|
|
12144
12134
|
|
|
12135
|
+
// custom FOR_VAL name or namespaced default name
|
|
12136
|
+
if (!custom_iterator_key) {
|
|
12137
|
+
is_key_dynamic_field = true
|
|
12138
|
+
iterator_key = (reference_source_obj?.fieldIdP || "") + "_FOR_KEY";
|
|
12139
|
+
}
|
|
12145
12140
|
|
|
12141
|
+
if (!custom_iterator_val) {
|
|
12142
|
+
is_val_dynamic_field = true
|
|
12143
|
+
iterator_val = (reference_source_obj?.fieldIdP || "") + "_FOR_VAL";
|
|
12144
|
+
}
|
|
12146
12145
|
|
|
12147
|
-
// if (typeof data.value === "string") {
|
|
12148
|
-
// arr = eval(data.value.replaceAll("\\", ""));
|
|
12149
|
-
// }
|
|
12150
|
-
// if (typeof arr === "number") {
|
|
12151
|
-
// arr = Array.from(Array(arr).keys());
|
|
12152
|
-
// }
|
|
12153
|
-
let iterator_val = $elm.data().xuData.iterator_val;
|
|
12154
|
-
let iterator_key = $elm.data().xuData.iterator_key;
|
|
12155
12146
|
var i = 0;
|
|
12156
12147
|
for await (let [_key, _val] of Object.entries(arr)) {
|
|
12157
12148
|
|
|
12158
12149
|
if (_.isArray(arr)) { _key = Number(_key) }
|
|
12159
12150
|
|
|
12160
|
-
const set_value = async function (currentRecordId, field_id, value) {
|
|
12161
|
-
let is_dynamic_field = false;
|
|
12151
|
+
const set_value = async function (is_dynamic_field, currentRecordId, field_id, value) {
|
|
12162
12152
|
|
|
12163
12153
|
|
|
12154
|
+
if (is_dynamic_field) {
|
|
12164
12155
|
|
|
12165
|
-
if (["_FOR_VAL", "_FOR_KEY"].includes(field_id)) {
|
|
12166
|
-
is_dynamic_field = true;
|
|
12167
12156
|
func.datasource.add_dynamic_field_to_ds(
|
|
12168
12157
|
SESSION_ID,
|
|
12169
12158
|
paramsP.dsSessionP,
|
|
12170
12159
|
field_id,
|
|
12171
12160
|
value
|
|
12172
12161
|
);
|
|
12162
|
+
|
|
12173
12163
|
} else {
|
|
12174
12164
|
|
|
12175
12165
|
const _progFields = await func.datasource.get_progFields(
|
|
@@ -12198,7 +12188,7 @@ func.UI.screen.execute_xu_functions = async function (
|
|
|
12198
12188
|
}
|
|
12199
12189
|
}
|
|
12200
12190
|
|
|
12201
|
-
|
|
12191
|
+
|
|
12202
12192
|
};
|
|
12203
12193
|
|
|
12204
12194
|
var currentRecordId =
|
|
@@ -12206,17 +12196,16 @@ func.UI.screen.execute_xu_functions = async function (
|
|
|
12206
12196
|
paramsP.dsSessionP
|
|
12207
12197
|
].currentRecordId.toString();
|
|
12208
12198
|
|
|
12209
|
-
|
|
12210
|
-
|
|
12211
|
-
|
|
12199
|
+
await set_value(is_key_dynamic_field, currentRecordId, iterator_key, _key);
|
|
12200
|
+
await set_value(is_val_dynamic_field, currentRecordId, iterator_val, _val);
|
|
12212
12201
|
|
|
12213
12202
|
var iterate_info = {
|
|
12214
12203
|
_val,
|
|
12215
12204
|
_key,
|
|
12216
|
-
iterator_key
|
|
12217
|
-
iterator_val
|
|
12218
|
-
is_val_dynamic_field,
|
|
12205
|
+
iterator_key,
|
|
12206
|
+
iterator_val,
|
|
12219
12207
|
is_key_dynamic_field,
|
|
12208
|
+
is_val_dynamic_field,
|
|
12220
12209
|
reference_source_obj
|
|
12221
12210
|
};
|
|
12222
12211
|
if (parent_infoP) {
|
|
@@ -12246,10 +12235,6 @@ func.UI.screen.execute_xu_functions = async function (
|
|
|
12246
12235
|
$(val).data().xuData.iterate_info = iterate_info;
|
|
12247
12236
|
}
|
|
12248
12237
|
});
|
|
12249
|
-
// // set values in _FOR record
|
|
12250
|
-
// currentRecordId = $divP.data().xuData.ui_id;
|
|
12251
|
-
// set_value(currentRecordId, iterator_key || "_FOR_KEY", _key);
|
|
12252
|
-
// set_value(currentRecordId, iterator_val || "_FOR_VAL", _val);
|
|
12253
12238
|
|
|
12254
12239
|
i++;
|
|
12255
12240
|
}
|