@xuda.io/xuda-worker-bundle-min 1.3.882 → 1.3.884
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 +126 -110
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -2724,7 +2724,7 @@ func.datasource.execute = async function (
|
|
|
2724
2724
|
) {
|
|
2725
2725
|
const dbMsgP = await func.db.save_data(SESSION_ID, dataSourceSession);
|
|
2726
2726
|
if (dbMsgP) _ds.currentRecordId = dbMsgP.id;
|
|
2727
|
-
_ds.set_mode = "
|
|
2727
|
+
_ds.set_mode = "U";
|
|
2728
2728
|
}
|
|
2729
2729
|
|
|
2730
2730
|
if (_ds.set_mode === "D") {
|
|
@@ -2747,48 +2747,48 @@ func.datasource.execute = async function (
|
|
|
2747
2747
|
_ds.data_feed.rows_deleted = [];
|
|
2748
2748
|
_ds.data_feed.rows_added = [];
|
|
2749
2749
|
|
|
2750
|
+
if (tree_obj.rwMode === "U") {
|
|
2751
|
+
_ds.set_mode = "U";
|
|
2752
|
+
} else {
|
|
2753
|
+
_ds.set_mode = "R";
|
|
2754
|
+
}
|
|
2755
|
+
|
|
2750
2756
|
const row_not_found = async function () {
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2757
|
+
if (tree_obj.rwMode === "U" && tree_obj.allowCreate) {
|
|
2758
|
+
_ds.currentRecordId = "newRecord";
|
|
2759
|
+
_ds.set_mode = "C";
|
|
2760
|
+
_ds.record_not_found = true;
|
|
2754
2761
|
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2762
|
+
try {
|
|
2763
|
+
const row_idx = func.common.find_ROWID_idx(
|
|
2764
|
+
_ds,
|
|
2765
|
+
_ds.currentRecordId
|
|
2766
|
+
);
|
|
2767
|
+
} catch (error) {
|
|
2768
|
+
await func.datasource.render_fields_form(
|
|
2769
|
+
SESSION_ID,
|
|
2770
|
+
dataSourceSession,
|
|
2771
|
+
{ id: "newRecord", value: {} }
|
|
2772
|
+
);
|
|
2773
|
+
}
|
|
2764
2774
|
|
|
2765
|
-
|
|
2766
|
-
// await func.datasource.render_fields_form(
|
|
2767
|
-
// SESSION_ID,
|
|
2768
|
-
// dataSourceSession,
|
|
2769
|
-
// { _ROWID: "newRecord" } // { id: "newRecord", value: {} },
|
|
2770
|
-
// // null,
|
|
2771
|
-
// // false,
|
|
2772
|
-
// // "newRecord"
|
|
2773
|
-
// );
|
|
2774
|
-
// }
|
|
2775
|
-
var count = await func.datasource.get_field_init_count(
|
|
2776
|
-
SESSION_ID,
|
|
2777
|
-
dataSourceSession,
|
|
2778
|
-
"newRecord",
|
|
2779
|
-
false
|
|
2780
|
-
);
|
|
2781
|
-
if (
|
|
2782
|
-
count > 0 // was: && !args.dataSourceNoP
|
|
2783
|
-
) {
|
|
2784
|
-
await func.datasource.execute_field_init_events(
|
|
2775
|
+
var count = await func.datasource.get_field_init_count(
|
|
2785
2776
|
SESSION_ID,
|
|
2786
2777
|
dataSourceSession,
|
|
2787
|
-
"
|
|
2788
|
-
|
|
2778
|
+
"newRecord",
|
|
2779
|
+
false
|
|
2789
2780
|
);
|
|
2781
|
+
if (
|
|
2782
|
+
count > 0 // was: && !args.dataSourceNoP
|
|
2783
|
+
) {
|
|
2784
|
+
await func.datasource.execute_field_init_events(
|
|
2785
|
+
SESSION_ID,
|
|
2786
|
+
dataSourceSession,
|
|
2787
|
+
"form",
|
|
2788
|
+
"newRecord"
|
|
2789
|
+
);
|
|
2790
|
+
}
|
|
2790
2791
|
}
|
|
2791
|
-
// return await callback_datasource();
|
|
2792
2792
|
};
|
|
2793
2793
|
if (!rows) {
|
|
2794
2794
|
await row_not_found();
|
|
@@ -2829,13 +2829,46 @@ func.datasource.execute = async function (
|
|
|
2829
2829
|
);
|
|
2830
2830
|
}
|
|
2831
2831
|
|
|
2832
|
-
await func.datasource.run_rows_form(
|
|
2832
|
+
// await func.datasource.run_rows_form(
|
|
2833
|
+
// SESSION_ID,
|
|
2834
|
+
// dataSourceSession,
|
|
2835
|
+
// idx,
|
|
2836
|
+
// raw_data_row
|
|
2837
|
+
// );
|
|
2838
|
+
|
|
2839
|
+
///////////////////////
|
|
2840
|
+
|
|
2841
|
+
_ds.currentRecordId = raw_data_row.id; // set temporary to allow expression decoder work
|
|
2842
|
+
|
|
2843
|
+
await func.datasource.render_fields_form(
|
|
2833
2844
|
SESSION_ID,
|
|
2834
2845
|
dataSourceSession,
|
|
2835
|
-
idx,
|
|
2836
2846
|
raw_data_row
|
|
2837
2847
|
);
|
|
2838
2848
|
|
|
2849
|
+
try {
|
|
2850
|
+
const init_count = await func.datasource.get_field_init_count(
|
|
2851
|
+
SESSION_ID,
|
|
2852
|
+
dataSourceSession,
|
|
2853
|
+
_ROWID,
|
|
2854
|
+
false,
|
|
2855
|
+
_ds.oninit_triggers_to_run
|
|
2856
|
+
);
|
|
2857
|
+
|
|
2858
|
+
if (init_count > 0) {
|
|
2859
|
+
await func.datasource.execute_field_init_events(
|
|
2860
|
+
SESSION_ID,
|
|
2861
|
+
dataSourceSession,
|
|
2862
|
+
"form",
|
|
2863
|
+
raw_data_row.id
|
|
2864
|
+
);
|
|
2865
|
+
}
|
|
2866
|
+
} catch (err) {
|
|
2867
|
+
console.error(err);
|
|
2868
|
+
}
|
|
2869
|
+
|
|
2870
|
+
/////////////////////
|
|
2871
|
+
|
|
2839
2872
|
if (await get_after_record_count()) {
|
|
2840
2873
|
await func.datasource.execute_view_events(
|
|
2841
2874
|
SESSION_ID,
|
|
@@ -3028,7 +3061,6 @@ func.datasource.render_fields_form = async function (
|
|
|
3028
3061
|
raw_data_row
|
|
3029
3062
|
) {
|
|
3030
3063
|
var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[dataSourceSession];
|
|
3031
|
-
// var v = _ds.v;
|
|
3032
3064
|
|
|
3033
3065
|
const _progFields = await func.datasource.get_progFields(
|
|
3034
3066
|
SESSION_ID,
|
|
@@ -3101,13 +3133,8 @@ func.datasource.render_fields_form = async function (
|
|
|
3101
3133
|
let row_idx;
|
|
3102
3134
|
try {
|
|
3103
3135
|
row_idx = func.common.find_ROWID_idx(_ds, raw_data_row.id);
|
|
3104
|
-
// data_arr[row_idx] = [{ _ROWID: "newRecord" }];
|
|
3105
3136
|
} catch (error) {
|
|
3106
|
-
// if (raw_data_row._ROWID === "newRecord") {
|
|
3107
|
-
// _ds.data_feed.rows[glb.newRecord] = { _ROWID: raw_data_row._ROWID };
|
|
3108
|
-
// } else {
|
|
3109
3137
|
_ds.data_feed.rows.push({ _ROWID: raw_data_row.id });
|
|
3110
|
-
// }
|
|
3111
3138
|
row_idx = func.common.find_ROWID_idx(_ds, raw_data_row.id);
|
|
3112
3139
|
}
|
|
3113
3140
|
|
|
@@ -3185,76 +3212,63 @@ func.datasource.render_fields_form = async function (
|
|
|
3185
3212
|
}
|
|
3186
3213
|
};
|
|
3187
3214
|
|
|
3188
|
-
func.datasource.run_rows_form = async function (
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
) {
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
var idx = rowIdxP;
|
|
3200
|
-
|
|
3201
|
-
const find_ROWID_idx_from_raw_data_arr = function (rowId) {
|
|
3202
|
-
if (!_ds?.v?.raw_data?.rows) {
|
|
3203
|
-
throw new Error("ds.v.raw_data.rows not found");
|
|
3204
|
-
}
|
|
3205
|
-
|
|
3206
|
-
const index = _ds.v.raw_data.rows.findIndex((item) => item.id === rowId);
|
|
3207
|
-
if (index === -1) {
|
|
3208
|
-
throw new Error(`item.id "${rowId}" not found`);
|
|
3209
|
-
}
|
|
3210
|
-
return index;
|
|
3211
|
-
};
|
|
3215
|
+
// func.datasource.run_rows_form = async function (
|
|
3216
|
+
// SESSION_ID,
|
|
3217
|
+
// dataSourceSession,
|
|
3218
|
+
// rowIdxP,
|
|
3219
|
+
// raw_data_row
|
|
3220
|
+
// ) {
|
|
3221
|
+
// var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[dataSourceSession];
|
|
3222
|
+
// if (!_ds) return;
|
|
3223
|
+
// let _ROWID = raw_data_row.id;
|
|
3224
|
+
// // var val = _ds.data_feed.rows[rowIdxP];
|
|
3212
3225
|
|
|
3213
|
-
|
|
3214
|
-
idx = find_ROWID_idx_from_raw_data_arr(raw_data_row.id);
|
|
3215
|
-
} catch (e) {
|
|
3216
|
-
_ROWID = "newRecord";
|
|
3217
|
-
_ds.data_feed.rows.push({ _ROWID });
|
|
3218
|
-
idx = func.common.find_ROWID_idx(_ds, _ROWID);
|
|
3219
|
-
}
|
|
3226
|
+
// var idx = rowIdxP;
|
|
3220
3227
|
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
// } else {
|
|
3226
|
-
// _ROWID = "newRecord";
|
|
3227
|
-
// val = _ds.data_feed.rows.push({ _ROWID });
|
|
3228
|
-
// idx = func.common.find_ROWID_idx(_ds, _ROWID);
|
|
3229
|
-
// }
|
|
3230
|
-
// } catch (e) {
|
|
3231
|
-
// console.error(e);
|
|
3232
|
-
// }
|
|
3228
|
+
// const find_ROWID_idx_from_raw_data_arr = function (rowId) {
|
|
3229
|
+
// if (!_ds?.v?.raw_data?.rows) {
|
|
3230
|
+
// throw new Error("ds.v.raw_data.rows not found");
|
|
3231
|
+
// }
|
|
3233
3232
|
|
|
3234
|
-
|
|
3233
|
+
// const index = _ds.v.raw_data.rows.findIndex((item) => item.id === rowId);
|
|
3234
|
+
// if (index === -1) {
|
|
3235
|
+
// throw new Error(`item.id "${rowId}" not found`);
|
|
3236
|
+
// }
|
|
3237
|
+
// return index;
|
|
3238
|
+
// };
|
|
3239
|
+
|
|
3240
|
+
// try {
|
|
3241
|
+
// idx = find_ROWID_idx_from_raw_data_arr(raw_data_row.id);
|
|
3242
|
+
// } catch (e) {
|
|
3243
|
+
// _ROWID = "newRecord";
|
|
3244
|
+
// _ds.data_feed.rows.push({ _ROWID });
|
|
3245
|
+
// idx = func.common.find_ROWID_idx(_ds, _ROWID);
|
|
3246
|
+
// }
|
|
3235
3247
|
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
}
|
|
3248
|
+
// _ds.currentRecordId = _ROWID; // set temporary to allow expression decoder work
|
|
3249
|
+
|
|
3250
|
+
// await func.datasource.render_fields_form(
|
|
3251
|
+
// SESSION_ID,
|
|
3252
|
+
// dataSourceSession,
|
|
3253
|
+
// raw_data_row
|
|
3254
|
+
// );
|
|
3255
|
+
// const init_count = await func.datasource.get_field_init_count(
|
|
3256
|
+
// SESSION_ID,
|
|
3257
|
+
// dataSourceSession,
|
|
3258
|
+
// _ROWID,
|
|
3259
|
+
// false,
|
|
3260
|
+
// _ds.oninit_triggers_to_run
|
|
3261
|
+
// );
|
|
3262
|
+
// if (init_count > 0) {
|
|
3263
|
+
// await func.datasource.execute_field_init_events(
|
|
3264
|
+
// SESSION_ID,
|
|
3265
|
+
// dataSourceSession,
|
|
3266
|
+
// "form",
|
|
3267
|
+
// _ds.data_feed.rows[idx]._ROWID
|
|
3268
|
+
// );
|
|
3269
|
+
// }
|
|
3270
|
+
// // await form_continue();
|
|
3271
|
+
// };
|
|
3258
3272
|
|
|
3259
3273
|
func.datasource.execute_field_init_events = async function (
|
|
3260
3274
|
SESSION_ID,
|
|
@@ -3333,6 +3347,7 @@ func.datasource.execute_field_init_events = async function (
|
|
|
3333
3347
|
}
|
|
3334
3348
|
}
|
|
3335
3349
|
};
|
|
3350
|
+
|
|
3336
3351
|
func.datasource.get_field_init_count = async function (
|
|
3337
3352
|
SESSION_ID,
|
|
3338
3353
|
dataSourceSession,
|
|
@@ -3427,6 +3442,7 @@ func.datasource.get_field_init_count = async function (
|
|
|
3427
3442
|
// }
|
|
3428
3443
|
return ret;
|
|
3429
3444
|
};
|
|
3445
|
+
|
|
3430
3446
|
func.datasource.get_view_events_count = async function (
|
|
3431
3447
|
SESSION_ID,
|
|
3432
3448
|
dataSourceSession,
|