@xuda.io/runtime-bundle 1.0.251 → 1.0.252
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
|
@@ -14398,6 +14398,9 @@ 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
|
+
|
|
14401
14404
|
if (["_FOR_VAL", "_FOR_KEY"].includes(view_field_id)) {
|
|
14402
14405
|
is_dynamic_field = true
|
|
14403
14406
|
field_prop = _ds.dynamic_fields[view_field_id]
|
|
@@ -14678,12 +14681,12 @@ func.UI.screen.execute_xu_functions = async function (
|
|
|
14678
14681
|
"xu-for": async function ($elm, data) {
|
|
14679
14682
|
if (parent_infoP?.iterate_info || !data.value) return {};
|
|
14680
14683
|
try {
|
|
14681
|
-
|
|
14684
|
+
// 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
14685
|
let arr = data.value;
|
|
14683
14686
|
|
|
14684
14687
|
// find reference source field
|
|
14685
14688
|
let reference_source_obj
|
|
14686
|
-
|
|
14689
|
+
|
|
14687
14690
|
const _progFields = await func.datasource.get_progFields(
|
|
14688
14691
|
SESSION_ID,
|
|
14689
14692
|
paramsP.dsSessionP
|
|
@@ -14694,28 +14697,13 @@ func.UI.screen.execute_xu_functions = async function (
|
|
|
14694
14697
|
"field_id",
|
|
14695
14698
|
data.value
|
|
14696
14699
|
);
|
|
14700
|
+
// detect if data.value (xu-for) is reference field_id by checking if exist in the dataset
|
|
14697
14701
|
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
|
-
|
|
14702
|
+
// xu-for is reference field_id
|
|
14713
14703
|
reference_source_obj = await func.datasource.get_value(SESSION_ID, data.value, paramsP.dsSessionP)
|
|
14714
14704
|
arr = reference_source_obj?.ret?.value
|
|
14715
14705
|
} else {
|
|
14716
|
-
//
|
|
14717
|
-
|
|
14718
|
-
|
|
14706
|
+
// xu-for is actual data
|
|
14719
14707
|
if (typeof data.value === "string") {
|
|
14720
14708
|
arr = eval(data.value.replaceAll("\\", ""));
|
|
14721
14709
|
}
|
|
@@ -14723,43 +14711,41 @@ func.UI.screen.execute_xu_functions = async function (
|
|
|
14723
14711
|
arr = Array.from(Array(arr).keys());
|
|
14724
14712
|
}
|
|
14725
14713
|
}
|
|
14726
|
-
// } catch (err) {
|
|
14727
|
-
|
|
14728
|
-
// }
|
|
14729
|
-
|
|
14730
|
-
|
|
14731
|
-
|
|
14732
14714
|
|
|
14715
|
+
const custom_iterator_key = $elm.data().xuData.iterator_key
|
|
14716
|
+
const custom_iterator_val = $elm.data().xuData.iterator_val
|
|
14733
14717
|
|
|
14718
|
+
let iterator_key = custom_iterator_key
|
|
14719
|
+
let iterator_val = custom_iterator_val
|
|
14734
14720
|
|
|
14721
|
+
// custom FOR_VAL name or namespaced default name
|
|
14722
|
+
if (!custom_iterator_key) {
|
|
14723
|
+
is_key_dynamic_field = true
|
|
14724
|
+
iterator_key = (reference_source_obj?.fieldIdP || "") + "_FOR_KEY";
|
|
14725
|
+
}
|
|
14735
14726
|
|
|
14727
|
+
if (!custom_iterator_val) {
|
|
14728
|
+
is_val_dynamic_field = true
|
|
14729
|
+
iterator_val = (reference_source_obj?.fieldIdP || "") + "_FOR_VAL";
|
|
14730
|
+
}
|
|
14736
14731
|
|
|
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
14732
|
var i = 0;
|
|
14746
14733
|
for await (let [_key, _val] of Object.entries(arr)) {
|
|
14747
14734
|
|
|
14748
14735
|
if (_.isArray(arr)) { _key = Number(_key) }
|
|
14749
14736
|
|
|
14750
|
-
const set_value = async function (currentRecordId, field_id, value) {
|
|
14751
|
-
let is_dynamic_field = false;
|
|
14737
|
+
const set_value = async function (is_dynamic_field, currentRecordId, field_id, value) {
|
|
14752
14738
|
|
|
14753
14739
|
|
|
14740
|
+
if (is_dynamic_field) {
|
|
14754
14741
|
|
|
14755
|
-
if (["_FOR_VAL", "_FOR_KEY"].includes(field_id)) {
|
|
14756
|
-
is_dynamic_field = true;
|
|
14757
14742
|
func.datasource.add_dynamic_field_to_ds(
|
|
14758
14743
|
SESSION_ID,
|
|
14759
14744
|
paramsP.dsSessionP,
|
|
14760
14745
|
field_id,
|
|
14761
14746
|
value
|
|
14762
14747
|
);
|
|
14748
|
+
|
|
14763
14749
|
} else {
|
|
14764
14750
|
|
|
14765
14751
|
const _progFields = await func.datasource.get_progFields(
|
|
@@ -14788,7 +14774,7 @@ func.UI.screen.execute_xu_functions = async function (
|
|
|
14788
14774
|
}
|
|
14789
14775
|
}
|
|
14790
14776
|
|
|
14791
|
-
|
|
14777
|
+
|
|
14792
14778
|
};
|
|
14793
14779
|
|
|
14794
14780
|
var currentRecordId =
|
|
@@ -14796,17 +14782,16 @@ func.UI.screen.execute_xu_functions = async function (
|
|
|
14796
14782
|
paramsP.dsSessionP
|
|
14797
14783
|
].currentRecordId.toString();
|
|
14798
14784
|
|
|
14799
|
-
|
|
14800
|
-
|
|
14801
|
-
|
|
14785
|
+
await set_value(is_key_dynamic_field, currentRecordId, iterator_key, _key);
|
|
14786
|
+
await set_value(is_val_dynamic_field, currentRecordId, iterator_val, _val);
|
|
14802
14787
|
|
|
14803
14788
|
var iterate_info = {
|
|
14804
14789
|
_val,
|
|
14805
14790
|
_key,
|
|
14806
|
-
iterator_key
|
|
14807
|
-
iterator_val
|
|
14808
|
-
is_val_dynamic_field,
|
|
14791
|
+
iterator_key,
|
|
14792
|
+
iterator_val,
|
|
14809
14793
|
is_key_dynamic_field,
|
|
14794
|
+
is_val_dynamic_field,
|
|
14810
14795
|
reference_source_obj
|
|
14811
14796
|
};
|
|
14812
14797
|
if (parent_infoP) {
|
|
@@ -14836,10 +14821,6 @@ func.UI.screen.execute_xu_functions = async function (
|
|
|
14836
14821
|
$(val).data().xuData.iterate_info = iterate_info;
|
|
14837
14822
|
}
|
|
14838
14823
|
});
|
|
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
14824
|
|
|
14844
14825
|
i++;
|
|
14845
14826
|
}
|
|
@@ -11808,6 +11808,9 @@ 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
|
+
|
|
11811
11814
|
if (["_FOR_VAL", "_FOR_KEY"].includes(view_field_id)) {
|
|
11812
11815
|
is_dynamic_field = true
|
|
11813
11816
|
field_prop = _ds.dynamic_fields[view_field_id]
|
|
@@ -12088,12 +12091,12 @@ func.UI.screen.execute_xu_functions = async function (
|
|
|
12088
12091
|
"xu-for": async function ($elm, data) {
|
|
12089
12092
|
if (parent_infoP?.iterate_info || !data.value) return {};
|
|
12090
12093
|
try {
|
|
12091
|
-
|
|
12094
|
+
// 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
12095
|
let arr = data.value;
|
|
12093
12096
|
|
|
12094
12097
|
// find reference source field
|
|
12095
12098
|
let reference_source_obj
|
|
12096
|
-
|
|
12099
|
+
|
|
12097
12100
|
const _progFields = await func.datasource.get_progFields(
|
|
12098
12101
|
SESSION_ID,
|
|
12099
12102
|
paramsP.dsSessionP
|
|
@@ -12104,28 +12107,13 @@ func.UI.screen.execute_xu_functions = async function (
|
|
|
12104
12107
|
"field_id",
|
|
12105
12108
|
data.value
|
|
12106
12109
|
);
|
|
12110
|
+
// detect if data.value (xu-for) is reference field_id by checking if exist in the dataset
|
|
12107
12111
|
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
|
-
|
|
12112
|
+
// xu-for is reference field_id
|
|
12123
12113
|
reference_source_obj = await func.datasource.get_value(SESSION_ID, data.value, paramsP.dsSessionP)
|
|
12124
12114
|
arr = reference_source_obj?.ret?.value
|
|
12125
12115
|
} else {
|
|
12126
|
-
//
|
|
12127
|
-
|
|
12128
|
-
|
|
12116
|
+
// xu-for is actual data
|
|
12129
12117
|
if (typeof data.value === "string") {
|
|
12130
12118
|
arr = eval(data.value.replaceAll("\\", ""));
|
|
12131
12119
|
}
|
|
@@ -12133,43 +12121,41 @@ func.UI.screen.execute_xu_functions = async function (
|
|
|
12133
12121
|
arr = Array.from(Array(arr).keys());
|
|
12134
12122
|
}
|
|
12135
12123
|
}
|
|
12136
|
-
// } catch (err) {
|
|
12137
|
-
|
|
12138
|
-
// }
|
|
12139
|
-
|
|
12140
|
-
|
|
12141
|
-
|
|
12142
12124
|
|
|
12125
|
+
const custom_iterator_key = $elm.data().xuData.iterator_key
|
|
12126
|
+
const custom_iterator_val = $elm.data().xuData.iterator_val
|
|
12143
12127
|
|
|
12128
|
+
let iterator_key = custom_iterator_key
|
|
12129
|
+
let iterator_val = custom_iterator_val
|
|
12144
12130
|
|
|
12131
|
+
// custom FOR_VAL name or namespaced default name
|
|
12132
|
+
if (!custom_iterator_key) {
|
|
12133
|
+
is_key_dynamic_field = true
|
|
12134
|
+
iterator_key = (reference_source_obj?.fieldIdP || "") + "_FOR_KEY";
|
|
12135
|
+
}
|
|
12145
12136
|
|
|
12137
|
+
if (!custom_iterator_val) {
|
|
12138
|
+
is_val_dynamic_field = true
|
|
12139
|
+
iterator_val = (reference_source_obj?.fieldIdP || "") + "_FOR_VAL";
|
|
12140
|
+
}
|
|
12146
12141
|
|
|
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
12142
|
var i = 0;
|
|
12156
12143
|
for await (let [_key, _val] of Object.entries(arr)) {
|
|
12157
12144
|
|
|
12158
12145
|
if (_.isArray(arr)) { _key = Number(_key) }
|
|
12159
12146
|
|
|
12160
|
-
const set_value = async function (currentRecordId, field_id, value) {
|
|
12161
|
-
let is_dynamic_field = false;
|
|
12147
|
+
const set_value = async function (is_dynamic_field, currentRecordId, field_id, value) {
|
|
12162
12148
|
|
|
12163
12149
|
|
|
12150
|
+
if (is_dynamic_field) {
|
|
12164
12151
|
|
|
12165
|
-
if (["_FOR_VAL", "_FOR_KEY"].includes(field_id)) {
|
|
12166
|
-
is_dynamic_field = true;
|
|
12167
12152
|
func.datasource.add_dynamic_field_to_ds(
|
|
12168
12153
|
SESSION_ID,
|
|
12169
12154
|
paramsP.dsSessionP,
|
|
12170
12155
|
field_id,
|
|
12171
12156
|
value
|
|
12172
12157
|
);
|
|
12158
|
+
|
|
12173
12159
|
} else {
|
|
12174
12160
|
|
|
12175
12161
|
const _progFields = await func.datasource.get_progFields(
|
|
@@ -12198,7 +12184,7 @@ func.UI.screen.execute_xu_functions = async function (
|
|
|
12198
12184
|
}
|
|
12199
12185
|
}
|
|
12200
12186
|
|
|
12201
|
-
|
|
12187
|
+
|
|
12202
12188
|
};
|
|
12203
12189
|
|
|
12204
12190
|
var currentRecordId =
|
|
@@ -12206,17 +12192,16 @@ func.UI.screen.execute_xu_functions = async function (
|
|
|
12206
12192
|
paramsP.dsSessionP
|
|
12207
12193
|
].currentRecordId.toString();
|
|
12208
12194
|
|
|
12209
|
-
|
|
12210
|
-
|
|
12211
|
-
|
|
12195
|
+
await set_value(is_key_dynamic_field, currentRecordId, iterator_key, _key);
|
|
12196
|
+
await set_value(is_val_dynamic_field, currentRecordId, iterator_val, _val);
|
|
12212
12197
|
|
|
12213
12198
|
var iterate_info = {
|
|
12214
12199
|
_val,
|
|
12215
12200
|
_key,
|
|
12216
|
-
iterator_key
|
|
12217
|
-
iterator_val
|
|
12218
|
-
is_val_dynamic_field,
|
|
12201
|
+
iterator_key,
|
|
12202
|
+
iterator_val,
|
|
12219
12203
|
is_key_dynamic_field,
|
|
12204
|
+
is_val_dynamic_field,
|
|
12220
12205
|
reference_source_obj
|
|
12221
12206
|
};
|
|
12222
12207
|
if (parent_infoP) {
|
|
@@ -12246,10 +12231,6 @@ func.UI.screen.execute_xu_functions = async function (
|
|
|
12246
12231
|
$(val).data().xuData.iterate_info = iterate_info;
|
|
12247
12232
|
}
|
|
12248
12233
|
});
|
|
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
12234
|
|
|
12254
12235
|
i++;
|
|
12255
12236
|
}
|