@xuda.io/xuda-worker-bundle-min 1.3.836 → 1.3.838
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 +38 -22
- 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`);
|
|
@@ -2361,7 +2361,8 @@ func.datasource.execute = async function (
|
|
|
2361
2361
|
null,
|
|
2362
2362
|
_ds?.progDataSource?.sortModel,
|
|
2363
2363
|
null,
|
|
2364
|
-
filterModel
|
|
2364
|
+
filterModel,
|
|
2365
|
+
_ds?.progDataSource?.dataSourceFilterModelType
|
|
2365
2366
|
);
|
|
2366
2367
|
|
|
2367
2368
|
const ret_rows_found = await func.db.get_query(
|
|
@@ -2378,7 +2379,8 @@ func.datasource.execute = async function (
|
|
|
2378
2379
|
null,
|
|
2379
2380
|
null,
|
|
2380
2381
|
null,
|
|
2381
|
-
filterModel
|
|
2382
|
+
filterModel,
|
|
2383
|
+
_ds?.progDataSource?.dataSourceFilterModelType
|
|
2382
2384
|
);
|
|
2383
2385
|
_ds.rows_found = ret_rows_found?.rows?.[0]?.value || 0;
|
|
2384
2386
|
|
|
@@ -2641,12 +2643,25 @@ func.datasource.execute = async function (
|
|
|
2641
2643
|
!_ds?.data_feed?.rows?.length
|
|
2642
2644
|
) {
|
|
2643
2645
|
_ds.set_mode = "C";
|
|
2644
|
-
data_arr[glb.newRecord] = [{ _ROWID: "newRecord" }];
|
|
2646
|
+
// data_arr[glb.newRecord] = [{ _ROWID: "newRecord" }];
|
|
2647
|
+
|
|
2648
|
+
try {
|
|
2649
|
+
const row_idx = func.common.find_ROWID_idx(_ds, "newRecord");
|
|
2650
|
+
data_arr[row_idx] = [{ _ROWID: "newRecord" }];
|
|
2651
|
+
} catch (error) {
|
|
2652
|
+
data_arr.push({ _ROWID: "newRecord" });
|
|
2653
|
+
}
|
|
2645
2654
|
}
|
|
2646
2655
|
|
|
2647
2656
|
if (tree_obj.crudMode === "C") {
|
|
2648
2657
|
_ds.set_mode = "C";
|
|
2649
|
-
data_arr[glb.newRecord] = [{ _ROWID: "newRecord" }];
|
|
2658
|
+
// data_arr[glb.newRecord] = [{ _ROWID: "newRecord" }];
|
|
2659
|
+
try {
|
|
2660
|
+
const row_idx = func.common.find_ROWID_idx(_ds, "newRecord");
|
|
2661
|
+
data_arr[row_idx] = [{ _ROWID: "newRecord" }];
|
|
2662
|
+
} catch (error) {
|
|
2663
|
+
data_arr.push({ _ROWID: "newRecord" });
|
|
2664
|
+
}
|
|
2650
2665
|
}
|
|
2651
2666
|
|
|
2652
2667
|
for await (let val of data_arr) {
|
|
@@ -3032,12 +3047,13 @@ func.datasource.render_fields_form = async function (
|
|
|
3032
3047
|
let row_idx;
|
|
3033
3048
|
try {
|
|
3034
3049
|
row_idx = func.common.find_ROWID_idx(_ds, data._ROWID);
|
|
3050
|
+
// data_arr[row_idx] = [{ _ROWID: "newRecord" }];
|
|
3035
3051
|
} catch (error) {
|
|
3036
|
-
if (data._ROWID === "newRecord") {
|
|
3037
|
-
|
|
3038
|
-
} else {
|
|
3039
|
-
|
|
3040
|
-
}
|
|
3052
|
+
// if (data._ROWID === "newRecord") {
|
|
3053
|
+
// _ds.data_feed.rows[glb.newRecord] = { _ROWID: data._ROWID };
|
|
3054
|
+
// } else {
|
|
3055
|
+
_ds.data_feed.rows.push({ _ROWID: data._ROWID });
|
|
3056
|
+
// }
|
|
3041
3057
|
row_idx = func.common.find_ROWID_idx(_ds, data._ROWID);
|
|
3042
3058
|
}
|
|
3043
3059
|
|
|
@@ -3138,8 +3154,8 @@ func.datasource.run_rows_form = async function (
|
|
|
3138
3154
|
if (typeof val !== "undefined") {
|
|
3139
3155
|
idx = rowIdxP;
|
|
3140
3156
|
} else {
|
|
3141
|
-
val = _ds.data_feed.rows
|
|
3142
|
-
idx =
|
|
3157
|
+
val = _ds.data_feed.rows.push({ _ROWID: "newRecord" });
|
|
3158
|
+
idx = func.common.find_ROWID_idx(_ds, "newRecord");
|
|
3143
3159
|
}
|
|
3144
3160
|
} catch (e) {
|
|
3145
3161
|
console.error(e);
|