@xuda.io/xuda-worker-bundle-min 1.3.836 → 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 +34 -20
- 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,16 +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
|
-
let index;
|
|
53
|
-
if (rowId === "newRecord") {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
} else {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
52
|
+
// let index;
|
|
53
|
+
// if (rowId === "newRecord") {
|
|
54
|
+
// index = glb.newRecord;
|
|
55
|
+
// if (!_ds.data_feed.rows[index]) {
|
|
56
|
+
// index = -1;
|
|
57
|
+
// }
|
|
58
|
+
// } else {
|
|
59
|
+
// Find the index of the object with the given _ROWID
|
|
60
|
+
const index = _ds.data_feed.rows.findIndex((item) => item._ROWID === rowId);
|
|
61
|
+
// }
|
|
62
62
|
// If the index is -1, the ROWID was not found, so throw an error
|
|
63
63
|
if (index === -1) {
|
|
64
64
|
throw new Error(`ROWID "${rowId}" not found`);
|
|
@@ -2641,12 +2641,25 @@ func.datasource.execute = async function (
|
|
|
2641
2641
|
!_ds?.data_feed?.rows?.length
|
|
2642
2642
|
) {
|
|
2643
2643
|
_ds.set_mode = "C";
|
|
2644
|
-
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
|
+
}
|
|
2645
2652
|
}
|
|
2646
2653
|
|
|
2647
2654
|
if (tree_obj.crudMode === "C") {
|
|
2648
2655
|
_ds.set_mode = "C";
|
|
2649
|
-
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
|
+
}
|
|
2650
2663
|
}
|
|
2651
2664
|
|
|
2652
2665
|
for await (let val of data_arr) {
|
|
@@ -3032,12 +3045,13 @@ func.datasource.render_fields_form = async function (
|
|
|
3032
3045
|
let row_idx;
|
|
3033
3046
|
try {
|
|
3034
3047
|
row_idx = func.common.find_ROWID_idx(_ds, data._ROWID);
|
|
3048
|
+
// data_arr[row_idx] = [{ _ROWID: "newRecord" }];
|
|
3035
3049
|
} catch (error) {
|
|
3036
|
-
if (data._ROWID === "newRecord") {
|
|
3037
|
-
|
|
3038
|
-
} else {
|
|
3039
|
-
|
|
3040
|
-
}
|
|
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
|
+
// }
|
|
3041
3055
|
row_idx = func.common.find_ROWID_idx(_ds, data._ROWID);
|
|
3042
3056
|
}
|
|
3043
3057
|
|
|
@@ -3138,8 +3152,8 @@ func.datasource.run_rows_form = async function (
|
|
|
3138
3152
|
if (typeof val !== "undefined") {
|
|
3139
3153
|
idx = rowIdxP;
|
|
3140
3154
|
} else {
|
|
3141
|
-
val = _ds.data_feed.rows
|
|
3142
|
-
idx =
|
|
3155
|
+
val = _ds.data_feed.rows.push({ _ROWID: "newRecord" });
|
|
3156
|
+
idx = func.common.find_ROWID_idx(_ds, "newRecord");
|
|
3143
3157
|
}
|
|
3144
3158
|
} catch (e) {
|
|
3145
3159
|
console.error(e);
|