@xuda.io/xuda-worker-bundle-min 1.3.843 → 1.3.845
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 +113 -115
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -49,20 +49,9 @@ 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
|
-
|
|
53
|
-
// if (rowId === "newRecord") {
|
|
54
|
-
// index = glb.newRecord;
|
|
55
|
-
// if (!_ds.data_feed.rows[index]) {
|
|
56
|
-
// index = -1;
|
|
57
|
-
// }
|
|
58
|
-
// } else {
|
|
52
|
+
|
|
59
53
|
// Find the index of the object with the given _ROWID
|
|
60
54
|
const index = _ds.data_feed.rows.findIndex((item) => item._ROWID === rowId);
|
|
61
|
-
// }
|
|
62
|
-
// If the index is -1, the ROWID was not found, so throw an error
|
|
63
|
-
// if (index === -1) {
|
|
64
|
-
// throw new Error(`ROWID "${rowId}" not found`);
|
|
65
|
-
// }
|
|
66
55
|
|
|
67
56
|
// Return the found index
|
|
68
57
|
return index;
|
|
@@ -2285,6 +2274,10 @@ func.datasource.execute = async function (
|
|
|
2285
2274
|
}
|
|
2286
2275
|
};
|
|
2287
2276
|
|
|
2277
|
+
if (!_ds.v.raw_data) {
|
|
2278
|
+
_ds.v.raw_data = { rows: [] };
|
|
2279
|
+
}
|
|
2280
|
+
|
|
2288
2281
|
switch (prog_obj.progDataSource?.dataSourceType) {
|
|
2289
2282
|
case "table":
|
|
2290
2283
|
_ds._dataSourceTableId = prog_obj.progDataSource?.dataSourceTableId; // get file id
|
|
@@ -2347,7 +2340,9 @@ func.datasource.execute = async function (
|
|
|
2347
2340
|
filterModelUserSql: _ds.progDataSource.filterModelUserSql,
|
|
2348
2341
|
};
|
|
2349
2342
|
|
|
2350
|
-
_ds.data_feed =
|
|
2343
|
+
_ds.data_feed = [];
|
|
2344
|
+
|
|
2345
|
+
_ds.v.raw_data = await func.db.get_query(
|
|
2351
2346
|
SESSION_ID,
|
|
2352
2347
|
_ds._dataSourceTableId,
|
|
2353
2348
|
_ds.v.couchView,
|
|
@@ -2393,19 +2388,22 @@ func.datasource.execute = async function (
|
|
|
2393
2388
|
data = [];
|
|
2394
2389
|
}
|
|
2395
2390
|
|
|
2396
|
-
let _KEY = 0;
|
|
2397
|
-
for (const _VAL of data) {
|
|
2398
|
-
_ds.data_feed.rows[_KEY] = { _KEY, _VAL };
|
|
2399
|
-
_KEY++;
|
|
2400
|
-
}
|
|
2401
|
-
// if (!_ds.v.raw_data) {
|
|
2402
|
-
// _ds.v.raw_data = { rows: [] };
|
|
2403
|
-
// }
|
|
2404
2391
|
// let _KEY = 0;
|
|
2405
2392
|
// for (const _VAL of data) {
|
|
2406
|
-
// _ds.
|
|
2393
|
+
// _ds.data_feed.rows[_KEY] = { _KEY, _VAL };
|
|
2407
2394
|
// _KEY++;
|
|
2408
2395
|
// }
|
|
2396
|
+
|
|
2397
|
+
_ds.rows_found = data?.length || 0;
|
|
2398
|
+
|
|
2399
|
+
// if (!_ds.v.raw_data) {
|
|
2400
|
+
// _ds.v.raw_data = { rows: [] };
|
|
2401
|
+
// }
|
|
2402
|
+
let _KEY = 0;
|
|
2403
|
+
for (const _VAL of data) {
|
|
2404
|
+
_ds.v.raw_data.rows.push({ id: _KEY, value: { _KEY, _VAL } });
|
|
2405
|
+
_KEY++;
|
|
2406
|
+
}
|
|
2409
2407
|
break;
|
|
2410
2408
|
}
|
|
2411
2409
|
|
|
@@ -2415,16 +2413,17 @@ func.datasource.execute = async function (
|
|
|
2415
2413
|
data = {};
|
|
2416
2414
|
}
|
|
2417
2415
|
|
|
2418
|
-
for (let [_KEY, _VAL] of Object.keys(data)) {
|
|
2419
|
-
|
|
2420
|
-
}
|
|
2416
|
+
// for (let [_KEY, _VAL] of Object.keys(data)) {
|
|
2417
|
+
// _ds.data_feed.rows[_KEY] = { _KEY, _VAL };
|
|
2418
|
+
// }
|
|
2419
|
+
_ds.rows_found = Object.keys(data)?.length || 0;
|
|
2421
2420
|
// if (!_ds.v.raw_data) {
|
|
2422
2421
|
// _ds.v.raw_data = { rows: [] };
|
|
2423
2422
|
// }
|
|
2424
2423
|
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2424
|
+
for (let [_KEY, _VAL] of Object.keys(data)) {
|
|
2425
|
+
_ds.v.raw_data.rows.push({ id: _KEY, value: { _KEY, _VAL } });
|
|
2426
|
+
}
|
|
2428
2427
|
|
|
2429
2428
|
break;
|
|
2430
2429
|
}
|
|
@@ -2435,16 +2434,6 @@ func.datasource.execute = async function (
|
|
|
2435
2434
|
data = "";
|
|
2436
2435
|
}
|
|
2437
2436
|
|
|
2438
|
-
if (!_ds.v.raw_data) {
|
|
2439
|
-
_ds.v.raw_data = { rows: [] };
|
|
2440
|
-
}
|
|
2441
|
-
|
|
2442
|
-
let _KEY = 0;
|
|
2443
|
-
let arr = data.split(",");
|
|
2444
|
-
for (const _VAL of arr) {
|
|
2445
|
-
_ds.data_feed.rows[_KEY] = { _KEY, _VAL };
|
|
2446
|
-
_KEY++;
|
|
2447
|
-
}
|
|
2448
2437
|
// if (!_ds.v.raw_data) {
|
|
2449
2438
|
// _ds.v.raw_data = { rows: [] };
|
|
2450
2439
|
// }
|
|
@@ -2452,10 +2441,21 @@ func.datasource.execute = async function (
|
|
|
2452
2441
|
// let _KEY = 0;
|
|
2453
2442
|
// let arr = data.split(",");
|
|
2454
2443
|
// for (const _VAL of arr) {
|
|
2455
|
-
// _ds.
|
|
2444
|
+
// _ds.data_feed.rows[_KEY] = { _KEY, _VAL };
|
|
2456
2445
|
// _KEY++;
|
|
2457
2446
|
// }
|
|
2447
|
+
// _ds.rows_found = arr?.length || 0;
|
|
2448
|
+
// if (!_ds.v.raw_data) {
|
|
2449
|
+
// _ds.v.raw_data = { rows: [] };
|
|
2450
|
+
// }
|
|
2458
2451
|
|
|
2452
|
+
let _KEY = 0;
|
|
2453
|
+
let arr = data.split(",");
|
|
2454
|
+
for (const _VAL of arr) {
|
|
2455
|
+
_ds.v.raw_data.rows.push({ id: _KEY, value: { _KEY, _VAL } });
|
|
2456
|
+
_KEY++;
|
|
2457
|
+
}
|
|
2458
|
+
_ds.rows_found = arr?.length || 0;
|
|
2459
2459
|
break;
|
|
2460
2460
|
|
|
2461
2461
|
default:
|
|
@@ -2482,24 +2482,24 @@ func.datasource.execute = async function (
|
|
|
2482
2482
|
"after_record"
|
|
2483
2483
|
);
|
|
2484
2484
|
};
|
|
2485
|
-
let
|
|
2485
|
+
let _raw_data_rows = [];
|
|
2486
2486
|
switch (tree_obj.menuType) {
|
|
2487
2487
|
case "api": {
|
|
2488
2488
|
_ds.api_rendered_output = "";
|
|
2489
2489
|
let has_datasource = await calc_batch_loops();
|
|
2490
2490
|
|
|
2491
|
-
|
|
2491
|
+
_raw_data_rows = _ds.raw_data.rows || [];
|
|
2492
2492
|
if (!has_datasource) {
|
|
2493
2493
|
for (n = 0; n < _ds.v.batch_loops; n++) {
|
|
2494
|
-
|
|
2494
|
+
_raw_data_rows.push({ id: n, value: {} });
|
|
2495
2495
|
}
|
|
2496
2496
|
}
|
|
2497
2497
|
_ds.currentRecordId = "dataset";
|
|
2498
|
-
for await (let [key,
|
|
2498
|
+
for await (let [key, raw_data_row] of Object.entries(_raw_data_rows)) {
|
|
2499
2499
|
if (has_datasource && Number(key) >= _ds.v.batch_loops) break;
|
|
2500
2500
|
|
|
2501
2501
|
if (!has_datasource) {
|
|
2502
|
-
|
|
2502
|
+
raw_data_row = _ds?.raw_data?.rows?.[key] || { id: key, value: {} };
|
|
2503
2503
|
}
|
|
2504
2504
|
|
|
2505
2505
|
if (await get_before_record_count()) {
|
|
@@ -2513,7 +2513,7 @@ func.datasource.execute = async function (
|
|
|
2513
2513
|
await func.datasource.render_fields_dataset(
|
|
2514
2514
|
SESSION_ID,
|
|
2515
2515
|
dataSourceSession,
|
|
2516
|
-
|
|
2516
|
+
raw_data_row
|
|
2517
2517
|
);
|
|
2518
2518
|
|
|
2519
2519
|
if (await get_after_record_count()) {
|
|
@@ -2545,18 +2545,18 @@ func.datasource.execute = async function (
|
|
|
2545
2545
|
case "batch": {
|
|
2546
2546
|
let has_datasource = await calc_batch_loops();
|
|
2547
2547
|
|
|
2548
|
-
|
|
2548
|
+
_raw_data_rows = _ds?.raw_data?.rows || [];
|
|
2549
2549
|
if (!has_datasource) {
|
|
2550
2550
|
for (n = 0; n < _ds.v.batch_loops; n++) {
|
|
2551
|
-
|
|
2551
|
+
_raw_data_rows.push({ id: n, value: {} });
|
|
2552
2552
|
}
|
|
2553
2553
|
}
|
|
2554
2554
|
_ds.currentRecordId = "dataset";
|
|
2555
|
-
for await (let [key,
|
|
2555
|
+
for await (let [key, raw_data_row] of Object.entries(_raw_data_rows)) {
|
|
2556
2556
|
if (has_datasource && Number(key) >= _ds.v.batch_loops) break;
|
|
2557
2557
|
|
|
2558
2558
|
if (!has_datasource) {
|
|
2559
|
-
|
|
2559
|
+
raw_data_row = _ds?.raw_data?.rows?.[key] || { id: key, value: {} };
|
|
2560
2560
|
}
|
|
2561
2561
|
|
|
2562
2562
|
if (await get_before_record_count()) {
|
|
@@ -2570,7 +2570,7 @@ func.datasource.execute = async function (
|
|
|
2570
2570
|
await func.datasource.render_fields_dataset(
|
|
2571
2571
|
SESSION_ID,
|
|
2572
2572
|
dataSourceSession,
|
|
2573
|
-
|
|
2573
|
+
raw_data_row
|
|
2574
2574
|
);
|
|
2575
2575
|
|
|
2576
2576
|
if (await get_after_record_count()) {
|
|
@@ -2597,9 +2597,7 @@ func.datasource.execute = async function (
|
|
|
2597
2597
|
ret = await db_adapter_module.process_view_dataset(
|
|
2598
2598
|
SESSION_ID,
|
|
2599
2599
|
dataSourceSession,
|
|
2600
|
-
_ds.v,
|
|
2601
2600
|
_ds
|
|
2602
|
-
// json1
|
|
2603
2601
|
);
|
|
2604
2602
|
|
|
2605
2603
|
if (await get_after_record_count()) {
|
|
@@ -2626,14 +2624,34 @@ func.datasource.execute = async function (
|
|
|
2626
2624
|
);
|
|
2627
2625
|
}
|
|
2628
2626
|
|
|
2627
|
+
const get_data_from_data_feed = function () {
|
|
2628
|
+
const rows = _ds?.data_feed?.rows || [];
|
|
2629
|
+
return rows.map((item) => ({
|
|
2630
|
+
id: item._ROWID,
|
|
2631
|
+
value: {
|
|
2632
|
+
...item.value,
|
|
2633
|
+
},
|
|
2634
|
+
}));
|
|
2635
|
+
};
|
|
2636
|
+
|
|
2637
|
+
const find_ROWID_idx_from_raw_data_arr = function (rowId) {
|
|
2638
|
+
if (!_raw_data_rows) {
|
|
2639
|
+
throw new Error("_raw_data_rows not found");
|
|
2640
|
+
}
|
|
2641
|
+
|
|
2642
|
+
const index = _raw_data_rows.findIndex((item) => item.id === rowId);
|
|
2643
|
+
|
|
2644
|
+
return index;
|
|
2645
|
+
};
|
|
2646
|
+
|
|
2629
2647
|
if (tree_obj.crudMode === "U") {
|
|
2630
2648
|
_ds.set_mode = "U";
|
|
2631
|
-
|
|
2649
|
+
_raw_data_rows = get_data_from_data_feed(); // _ds?.raw_data?.rows || [];
|
|
2632
2650
|
}
|
|
2633
2651
|
|
|
2634
2652
|
if (tree_obj.crudMode === "D") {
|
|
2635
2653
|
_ds.set_mode = "D";
|
|
2636
|
-
|
|
2654
|
+
_raw_data_rows = get_data_from_data_feed(); // _ds.raw_data?.rows || [];
|
|
2637
2655
|
}
|
|
2638
2656
|
|
|
2639
2657
|
// initiated with Update but no rows found
|
|
@@ -2643,28 +2661,28 @@ func.datasource.execute = async function (
|
|
|
2643
2661
|
!_ds?.data_feed?.rows?.length
|
|
2644
2662
|
) {
|
|
2645
2663
|
_ds.set_mode = "C";
|
|
2646
|
-
//
|
|
2664
|
+
// _raw_data_rows[glb.newRecord] = [{ _ROWID: "newRecord" }];
|
|
2647
2665
|
|
|
2648
2666
|
try {
|
|
2649
|
-
const row_idx =
|
|
2650
|
-
|
|
2667
|
+
const row_idx = find_ROWID_idx_from_raw_data_arr("newRecord");
|
|
2668
|
+
_raw_data_rows[row_idx] = [{ id: "newRecord", value: {} }];
|
|
2651
2669
|
} catch (error) {
|
|
2652
|
-
|
|
2670
|
+
_raw_data_rows.push({ _ROWID: "newRecord" });
|
|
2653
2671
|
}
|
|
2654
2672
|
}
|
|
2655
2673
|
|
|
2656
2674
|
if (tree_obj.crudMode === "C") {
|
|
2657
2675
|
_ds.set_mode = "C";
|
|
2658
|
-
//
|
|
2676
|
+
// _raw_data_rows[glb.newRecord] = [{ _ROWID: "newRecord" }];
|
|
2659
2677
|
try {
|
|
2660
|
-
const row_idx =
|
|
2661
|
-
|
|
2678
|
+
const row_idx = find_ROWID_idx_from_raw_data_arr("newRecord");
|
|
2679
|
+
_raw_data_rows[row_idx] = [{ id: "newRecord", value: {} }];
|
|
2662
2680
|
} catch (error) {
|
|
2663
|
-
|
|
2681
|
+
_raw_data_rows.push({ id: "newRecord", value: {} });
|
|
2664
2682
|
}
|
|
2665
2683
|
}
|
|
2666
2684
|
|
|
2667
|
-
for await (let
|
|
2685
|
+
for await (let raw_data_row of _raw_data_rows) {
|
|
2668
2686
|
_ds.currentRecordId = val.id;
|
|
2669
2687
|
if (await get_before_record_count()) {
|
|
2670
2688
|
await func.datasource.execute_view_events(
|
|
@@ -2677,7 +2695,7 @@ func.datasource.execute = async function (
|
|
|
2677
2695
|
await func.datasource.render_fields_dataset(
|
|
2678
2696
|
SESSION_ID,
|
|
2679
2697
|
dataSourceSession,
|
|
2680
|
-
|
|
2698
|
+
raw_data_row
|
|
2681
2699
|
);
|
|
2682
2700
|
let data_feed_str = JSON.stringify(_ds.data_feed);
|
|
2683
2701
|
|
|
@@ -2711,7 +2729,7 @@ func.datasource.execute = async function (
|
|
|
2711
2729
|
_ds.rows_processed = 0;
|
|
2712
2730
|
_ds.viewRangeExp_rows_deleted = 0;
|
|
2713
2731
|
|
|
2714
|
-
let rows = _ds?.
|
|
2732
|
+
let rows = _ds?.raw_data?.rows?.length;
|
|
2715
2733
|
|
|
2716
2734
|
_ds.data_feed.rows_changed = [];
|
|
2717
2735
|
_ds.data_feed.rows_deleted = [];
|
|
@@ -2728,7 +2746,7 @@ func.datasource.execute = async function (
|
|
|
2728
2746
|
await func.datasource.render_fields_form(
|
|
2729
2747
|
SESSION_ID,
|
|
2730
2748
|
dataSourceSession,
|
|
2731
|
-
{
|
|
2749
|
+
{ id: "newRecord", value: {} }
|
|
2732
2750
|
);
|
|
2733
2751
|
}
|
|
2734
2752
|
|
|
@@ -2765,7 +2783,7 @@ func.datasource.execute = async function (
|
|
|
2765
2783
|
break;
|
|
2766
2784
|
}
|
|
2767
2785
|
|
|
2768
|
-
_ds.firstRecordId = _ds.
|
|
2786
|
+
_ds.firstRecordId = _ds.raw_data.rows[0].id;
|
|
2769
2787
|
|
|
2770
2788
|
const finish_form = async function () {
|
|
2771
2789
|
// check if locatedRecordId exist in SESSION_OBJ[SESSION_ID].DS_GLB
|
|
@@ -2788,7 +2806,8 @@ func.datasource.execute = async function (
|
|
|
2788
2806
|
_ds.currentRecordId = _ds.finalRecordId;
|
|
2789
2807
|
};
|
|
2790
2808
|
|
|
2791
|
-
for await (const [key, val] of Object.entries(_ds.
|
|
2809
|
+
for await (const [key, val] of Object.entries(_ds.raw_data.rows)) {
|
|
2810
|
+
const raw_data_row = val.value;
|
|
2792
2811
|
if (await get_before_record_count()) {
|
|
2793
2812
|
await func.datasource.execute_view_events(
|
|
2794
2813
|
SESSION_ID,
|
|
@@ -2801,12 +2820,7 @@ func.datasource.execute = async function (
|
|
|
2801
2820
|
SESSION_ID,
|
|
2802
2821
|
dataSourceSession,
|
|
2803
2822
|
key,
|
|
2804
|
-
|
|
2805
|
-
null,
|
|
2806
|
-
null,
|
|
2807
|
-
_ds.pre_init_fields,
|
|
2808
|
-
val,
|
|
2809
|
-
db_adapter_module
|
|
2823
|
+
raw_data_row
|
|
2810
2824
|
);
|
|
2811
2825
|
|
|
2812
2826
|
if (await get_after_record_count()) {
|
|
@@ -2837,7 +2851,7 @@ func.datasource.execute = async function (
|
|
|
2837
2851
|
func.datasource.render_fields_dataset = async function (
|
|
2838
2852
|
SESSION_ID,
|
|
2839
2853
|
dataSourceSession,
|
|
2840
|
-
|
|
2854
|
+
raw_data_row
|
|
2841
2855
|
) {
|
|
2842
2856
|
var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[dataSourceSession];
|
|
2843
2857
|
var args = _ds.args;
|
|
@@ -2919,11 +2933,11 @@ func.datasource.render_fields_dataset = async function (
|
|
|
2919
2933
|
var fieldId = val.data.field_id;
|
|
2920
2934
|
|
|
2921
2935
|
if (val.data.type === "virtual" || _ds.set_mode === "C") {
|
|
2922
|
-
if (typeof
|
|
2936
|
+
if (typeof raw_data_row?.value?.[fieldId] !== "undefined") {
|
|
2923
2937
|
// supports x=x+1
|
|
2924
2938
|
_ds.data_feed.rows[row_idx][fieldId] = await get_value(
|
|
2925
2939
|
fieldId,
|
|
2926
|
-
|
|
2940
|
+
raw_data_row.value[fieldId]
|
|
2927
2941
|
);
|
|
2928
2942
|
continue;
|
|
2929
2943
|
}
|
|
@@ -2950,12 +2964,12 @@ func.datasource.render_fields_dataset = async function (
|
|
|
2950
2964
|
continue;
|
|
2951
2965
|
}
|
|
2952
2966
|
if (val.data.type === "table" || val.data.type === "datasource") {
|
|
2953
|
-
if (typeof
|
|
2967
|
+
if (typeof raw_data_row.value[fieldId] === "undefined") {
|
|
2954
2968
|
throw "field do not exist in data: " + fieldId;
|
|
2955
2969
|
}
|
|
2956
2970
|
_ds.data_feed.rows[row_idx][fieldId] = await get_value(
|
|
2957
2971
|
fieldId,
|
|
2958
|
-
|
|
2972
|
+
raw_data_row.value[fieldId]
|
|
2959
2973
|
);
|
|
2960
2974
|
}
|
|
2961
2975
|
} catch (err) {
|
|
@@ -2963,13 +2977,6 @@ func.datasource.render_fields_dataset = async function (
|
|
|
2963
2977
|
}
|
|
2964
2978
|
}
|
|
2965
2979
|
}
|
|
2966
|
-
|
|
2967
|
-
// let data_feed = { _ROWID: _ds.currentRecordId };
|
|
2968
|
-
|
|
2969
|
-
// _ds.data_feed._ROWID = _ds.currentRecordId;
|
|
2970
|
-
|
|
2971
|
-
// _ds.data_feed.rows.push(data_feed);
|
|
2972
|
-
// _ds.data_feed.rows[0] = data_feed;
|
|
2973
2980
|
};
|
|
2974
2981
|
|
|
2975
2982
|
func.datasource.run_events_functions = async function (
|
|
@@ -3006,7 +3013,7 @@ func.datasource.run_events_functions = async function (
|
|
|
3006
3013
|
func.datasource.render_fields_form = async function (
|
|
3007
3014
|
SESSION_ID,
|
|
3008
3015
|
dataSourceSession,
|
|
3009
|
-
|
|
3016
|
+
raw_data_row
|
|
3010
3017
|
) {
|
|
3011
3018
|
var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[dataSourceSession];
|
|
3012
3019
|
// var v = _ds.v;
|
|
@@ -3081,15 +3088,15 @@ func.datasource.render_fields_form = async function (
|
|
|
3081
3088
|
|
|
3082
3089
|
let row_idx;
|
|
3083
3090
|
try {
|
|
3084
|
-
row_idx = func.common.find_ROWID_idx(_ds,
|
|
3091
|
+
row_idx = func.common.find_ROWID_idx(_ds, raw_data_row.id);
|
|
3085
3092
|
// data_arr[row_idx] = [{ _ROWID: "newRecord" }];
|
|
3086
3093
|
} catch (error) {
|
|
3087
|
-
// if (
|
|
3088
|
-
// _ds.data_feed.rows[glb.newRecord] = { _ROWID:
|
|
3094
|
+
// if (raw_data_row._ROWID === "newRecord") {
|
|
3095
|
+
// _ds.data_feed.rows[glb.newRecord] = { _ROWID: raw_data_row._ROWID };
|
|
3089
3096
|
// } else {
|
|
3090
|
-
_ds.data_feed.rows.push({ _ROWID:
|
|
3097
|
+
_ds.data_feed.rows.push({ _ROWID: raw_data_row.id });
|
|
3091
3098
|
// }
|
|
3092
|
-
row_idx = func.common.find_ROWID_idx(_ds,
|
|
3099
|
+
row_idx = func.common.find_ROWID_idx(_ds, raw_data_row.id);
|
|
3093
3100
|
}
|
|
3094
3101
|
|
|
3095
3102
|
_ds.dataset_alias = {};
|
|
@@ -3098,7 +3105,7 @@ func.datasource.render_fields_form = async function (
|
|
|
3098
3105
|
try {
|
|
3099
3106
|
var fieldId = val.data.field_id;
|
|
3100
3107
|
|
|
3101
|
-
if (val.data.type === "virtual" ||
|
|
3108
|
+
if (val.data.type === "virtual" || raw_data_row.id === "newRecord") {
|
|
3102
3109
|
if (glb.PROTECTED_VARS.includes(fieldId)) {
|
|
3103
3110
|
switch (fieldId) {
|
|
3104
3111
|
case "_ROWNO": {
|
|
@@ -3111,7 +3118,7 @@ func.datasource.render_fields_form = async function (
|
|
|
3111
3118
|
case "_ROWID": {
|
|
3112
3119
|
_ds.data_feed.rows[row_idx][fieldId] = await get_value(
|
|
3113
3120
|
fieldId,
|
|
3114
|
-
|
|
3121
|
+
raw_data_row.id
|
|
3115
3122
|
);
|
|
3116
3123
|
|
|
3117
3124
|
continue;
|
|
@@ -3119,7 +3126,7 @@ func.datasource.render_fields_form = async function (
|
|
|
3119
3126
|
case "_ROWDOC": {
|
|
3120
3127
|
_ds.data_feed.rows[row_idx][fieldId] = await get_value(
|
|
3121
3128
|
fieldId,
|
|
3122
|
-
|
|
3129
|
+
raw_data_row.value
|
|
3123
3130
|
);
|
|
3124
3131
|
|
|
3125
3132
|
continue;
|
|
@@ -3134,7 +3141,7 @@ func.datasource.render_fields_form = async function (
|
|
|
3134
3141
|
val.props?.propExpressions?.fieldValue,
|
|
3135
3142
|
dataSourceSession,
|
|
3136
3143
|
"update",
|
|
3137
|
-
|
|
3144
|
+
raw_data_row.id
|
|
3138
3145
|
);
|
|
3139
3146
|
_ds.data_feed.rows[row_idx][fieldId] = await get_value(
|
|
3140
3147
|
fieldId,
|
|
@@ -3152,12 +3159,12 @@ func.datasource.render_fields_form = async function (
|
|
|
3152
3159
|
continue;
|
|
3153
3160
|
}
|
|
3154
3161
|
if (val.data.type === "table" || val.data.type === "datasource") {
|
|
3155
|
-
if (typeof
|
|
3162
|
+
if (typeof raw_data_row[fieldId] === "undefined") {
|
|
3156
3163
|
throw "field do not exist in data: " + fieldId;
|
|
3157
3164
|
}
|
|
3158
3165
|
_ds.data_feed.rows[row_idx][fieldId] = await get_value(
|
|
3159
3166
|
fieldId,
|
|
3160
|
-
|
|
3167
|
+
raw_data_row.value[fieldId]
|
|
3161
3168
|
);
|
|
3162
3169
|
}
|
|
3163
3170
|
} catch (err) {
|
|
@@ -3170,43 +3177,34 @@ func.datasource.run_rows_form = async function (
|
|
|
3170
3177
|
SESSION_ID,
|
|
3171
3178
|
dataSourceSession,
|
|
3172
3179
|
rowIdxP,
|
|
3173
|
-
|
|
3174
|
-
NA_callbackP,
|
|
3175
|
-
NA_oninit_triggers_to_runP,
|
|
3176
|
-
pre_init_fieldsP,
|
|
3177
|
-
data,
|
|
3178
|
-
db_adapter_module
|
|
3180
|
+
raw_data_row
|
|
3179
3181
|
) {
|
|
3180
3182
|
var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[dataSourceSession];
|
|
3181
3183
|
if (!_ds) return;
|
|
3182
3184
|
// var v = _ds.v;
|
|
3183
3185
|
|
|
3184
3186
|
var val = _ds.data_feed.rows[rowIdxP];
|
|
3185
|
-
|
|
3187
|
+
let _ROWID = val.id;
|
|
3186
3188
|
var idx;
|
|
3187
3189
|
|
|
3188
3190
|
try {
|
|
3189
3191
|
if (typeof val !== "undefined") {
|
|
3190
3192
|
idx = rowIdxP;
|
|
3191
3193
|
} else {
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
+
_ROWID = "newRecord";
|
|
3195
|
+
val = _ds.data_feed.rows.push({ _ROWID });
|
|
3196
|
+
idx = func.common.find_ROWID_idx(_ds, _ROWID);
|
|
3194
3197
|
}
|
|
3195
3198
|
} catch (e) {
|
|
3196
3199
|
console.error(e);
|
|
3197
3200
|
}
|
|
3198
3201
|
|
|
3199
|
-
_ds.currentRecordId =
|
|
3202
|
+
_ds.currentRecordId = _ROWID; // set temporary to allow expression decoder work
|
|
3200
3203
|
|
|
3201
3204
|
await func.datasource.render_fields_form(
|
|
3202
3205
|
SESSION_ID,
|
|
3203
3206
|
dataSourceSession,
|
|
3204
|
-
|
|
3205
|
-
// null,
|
|
3206
|
-
// true,
|
|
3207
|
-
// idx,
|
|
3208
|
-
// true,
|
|
3209
|
-
// pre_init_fieldsP
|
|
3207
|
+
raw_data_row
|
|
3210
3208
|
);
|
|
3211
3209
|
const init_count = await func.datasource.get_field_init_count(
|
|
3212
3210
|
SESSION_ID,
|
|
@@ -5193,7 +5191,7 @@ func.utils.clean_returned_datasource = function (SESSION_ID, DS) {
|
|
|
5193
5191
|
// }
|
|
5194
5192
|
delete obj.pre_init_fields;
|
|
5195
5193
|
delete obj.oninit_triggers_to_run;
|
|
5196
|
-
|
|
5194
|
+
delete obj.raw_data;
|
|
5197
5195
|
|
|
5198
5196
|
delete obj.debug;
|
|
5199
5197
|
|