@xuda.io/xuda-worker-bundle-min 1.3.835 → 1.3.837
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 +32 -12
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -32,7 +32,7 @@ glb.PROTECTED_VARS = [
|
|
|
32
32
|
"_VAL",
|
|
33
33
|
];
|
|
34
34
|
|
|
35
|
-
glb.newRecord = 999999;
|
|
35
|
+
// glb.newRecord = 999999;
|
|
36
36
|
|
|
37
37
|
func.common = {};
|
|
38
38
|
func.common.find_item_by_key = function (arr, key, val) {
|
|
@@ -49,10 +49,16 @@ func.common.find_ROWID_idx = function (_ds, rowId) {
|
|
|
49
49
|
if (!_ds?.data_feed?.rows) {
|
|
50
50
|
throw new Error("data_feed not found");
|
|
51
51
|
}
|
|
52
|
-
|
|
52
|
+
// let index;
|
|
53
|
+
// if (rowId === "newRecord") {
|
|
54
|
+
// index = glb.newRecord;
|
|
55
|
+
// if (!_ds.data_feed.rows[index]) {
|
|
56
|
+
// index = -1;
|
|
57
|
+
// }
|
|
58
|
+
// } else {
|
|
53
59
|
// Find the index of the object with the given _ROWID
|
|
54
60
|
const index = _ds.data_feed.rows.findIndex((item) => item._ROWID === rowId);
|
|
55
|
-
|
|
61
|
+
// }
|
|
56
62
|
// If the index is -1, the ROWID was not found, so throw an error
|
|
57
63
|
if (index === -1) {
|
|
58
64
|
throw new Error(`ROWID "${rowId}" not found`);
|
|
@@ -2635,12 +2641,25 @@ func.datasource.execute = async function (
|
|
|
2635
2641
|
!_ds?.data_feed?.rows?.length
|
|
2636
2642
|
) {
|
|
2637
2643
|
_ds.set_mode = "C";
|
|
2638
|
-
data_arr[glb.newRecord] = [{ _ROWID: "newRecord" }];
|
|
2644
|
+
// data_arr[glb.newRecord] = [{ _ROWID: "newRecord" }];
|
|
2645
|
+
|
|
2646
|
+
try {
|
|
2647
|
+
const row_idx = func.common.find_ROWID_idx(_ds, "newRecord");
|
|
2648
|
+
data_arr[row_idx] = [{ _ROWID: "newRecord" }];
|
|
2649
|
+
} catch (error) {
|
|
2650
|
+
data_arr.push({ _ROWID: "newRecord" });
|
|
2651
|
+
}
|
|
2639
2652
|
}
|
|
2640
2653
|
|
|
2641
2654
|
if (tree_obj.crudMode === "C") {
|
|
2642
2655
|
_ds.set_mode = "C";
|
|
2643
|
-
data_arr[glb.newRecord] = [{ _ROWID: "newRecord" }];
|
|
2656
|
+
// data_arr[glb.newRecord] = [{ _ROWID: "newRecord" }];
|
|
2657
|
+
try {
|
|
2658
|
+
const row_idx = func.common.find_ROWID_idx(_ds, "newRecord");
|
|
2659
|
+
data_arr[row_idx] = [{ _ROWID: "newRecord" }];
|
|
2660
|
+
} catch (error) {
|
|
2661
|
+
data_arr.push({ _ROWID: "newRecord" });
|
|
2662
|
+
}
|
|
2644
2663
|
}
|
|
2645
2664
|
|
|
2646
2665
|
for await (let val of data_arr) {
|
|
@@ -3026,12 +3045,13 @@ func.datasource.render_fields_form = async function (
|
|
|
3026
3045
|
let row_idx;
|
|
3027
3046
|
try {
|
|
3028
3047
|
row_idx = func.common.find_ROWID_idx(_ds, data._ROWID);
|
|
3048
|
+
// data_arr[row_idx] = [{ _ROWID: "newRecord" }];
|
|
3029
3049
|
} catch (error) {
|
|
3030
|
-
if (data._ROWID === "newRecord") {
|
|
3031
|
-
|
|
3032
|
-
} else {
|
|
3033
|
-
|
|
3034
|
-
}
|
|
3050
|
+
// if (data._ROWID === "newRecord") {
|
|
3051
|
+
// _ds.data_feed.rows[glb.newRecord] = { _ROWID: data._ROWID };
|
|
3052
|
+
// } else {
|
|
3053
|
+
_ds.data_feed.rows.push({ _ROWID: data._ROWID });
|
|
3054
|
+
// }
|
|
3035
3055
|
row_idx = func.common.find_ROWID_idx(_ds, data._ROWID);
|
|
3036
3056
|
}
|
|
3037
3057
|
|
|
@@ -3132,8 +3152,8 @@ func.datasource.run_rows_form = async function (
|
|
|
3132
3152
|
if (typeof val !== "undefined") {
|
|
3133
3153
|
idx = rowIdxP;
|
|
3134
3154
|
} else {
|
|
3135
|
-
val = _ds.data_feed.rows
|
|
3136
|
-
idx =
|
|
3155
|
+
val = _ds.data_feed.rows.push({ _ROWID: "newRecord" });
|
|
3156
|
+
idx = func.common.find_ROWID_idx(_ds, "newRecord");
|
|
3137
3157
|
}
|
|
3138
3158
|
} catch (e) {
|
|
3139
3159
|
console.error(e);
|