@xuda.io/runtime-bundle 1.0.1383 → 1.0.1385
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/js/modules/xuda-studio-checker.min.mjs +1 -1
- package/js/modules/xuda-studio-checker.mjs +15 -13
- package/js/xuda-runtime-bundle.js +72 -58
- package/js/xuda-runtime-bundle.min.js +1 -1
- package/js/xuda-runtime-slim.js +72 -58
- package/js/xuda-runtime-slim.min.es.js +72 -58
- package/js/xuda-runtime-slim.min.js +1 -1
- package/js/xuda-server-bundle.min.mjs +1 -1
- package/js/xuda-server-bundle.mjs +30 -30
- package/js/xuda-worker-bundle.js +30 -30
- package/js/xuda-worker-bundle.min.js +1 -1
- package/package.json +1 -1
package/js/xuda-runtime-slim.js
CHANGED
|
@@ -3655,6 +3655,36 @@ func.datasource.execute = async function (SESSION_ID, dataSourceSession, IS_DATA
|
|
|
3655
3655
|
_dataSourceFilterModelType,
|
|
3656
3656
|
);
|
|
3657
3657
|
|
|
3658
|
+
if (_dataSourceFilterModelType === 'index' && _ds?.progDataSource?.sortModel) {
|
|
3659
|
+
function sortByKeys(array, sortConfig) {
|
|
3660
|
+
return array.sort((a, b) => {
|
|
3661
|
+
for (let config of sortConfig) {
|
|
3662
|
+
const key = config.field_id;
|
|
3663
|
+
const direction = config.sort_dir === 'desc' ? -1 : 1;
|
|
3664
|
+
|
|
3665
|
+
const valA = a.value[key];
|
|
3666
|
+
const valB = b.value[key];
|
|
3667
|
+
|
|
3668
|
+
// Handle numeric comparison
|
|
3669
|
+
if (typeof valA === 'number' && typeof valB === 'number') {
|
|
3670
|
+
if (valA !== valB) {
|
|
3671
|
+
return (valA - valB) * direction;
|
|
3672
|
+
}
|
|
3673
|
+
}
|
|
3674
|
+
// Handle string comparison
|
|
3675
|
+
else if (typeof valA === 'string' && typeof valB === 'string') {
|
|
3676
|
+
if (valA !== valB) {
|
|
3677
|
+
return valA.localeCompare(valB) * direction;
|
|
3678
|
+
}
|
|
3679
|
+
}
|
|
3680
|
+
}
|
|
3681
|
+
return 0;
|
|
3682
|
+
});
|
|
3683
|
+
}
|
|
3684
|
+
const sorted = sortByKeys(_ds.v.raw_data.rows, _ds.progDataSource.sortModel);
|
|
3685
|
+
_ds.v.raw_data.rows = sorted;
|
|
3686
|
+
}
|
|
3687
|
+
|
|
3658
3688
|
if (_ds?.progDataSource?.dataSourceLimit) {
|
|
3659
3689
|
const ret_rows_found = await func.db.get_query(SESSION_ID, _ds._dataSourceTableId, _ds.v.couchView, dataSourceSession, _ds.viewSourceDesc, 'datasource table', prog_obj.progDataSource.dataSourceReduce, null, null, true, null, null, null, filterModel, _dataSourceFilterModelType);
|
|
3660
3690
|
_ds.rows_found = ret_rows_found?.rows?.[0]?.value || 0;
|
|
@@ -3673,17 +3703,8 @@ func.datasource.execute = async function (SESSION_ID, dataSourceSession, IS_DATA
|
|
|
3673
3703
|
data = [];
|
|
3674
3704
|
}
|
|
3675
3705
|
|
|
3676
|
-
// let _KEY = 0;
|
|
3677
|
-
// for (const _VAL of data) {
|
|
3678
|
-
// _ds.data_feed.rows[_KEY] = { _KEY, _VAL };
|
|
3679
|
-
// _KEY++;
|
|
3680
|
-
// }
|
|
3681
|
-
|
|
3682
3706
|
_ds.rows_found = data?.length || 0;
|
|
3683
3707
|
|
|
3684
|
-
// if (!_ds.v.raw_data) {
|
|
3685
|
-
// _ds.v.raw_data = { rows: [] };
|
|
3686
|
-
// }
|
|
3687
3708
|
let _KEY = 0;
|
|
3688
3709
|
for (const _VAL of data) {
|
|
3689
3710
|
_ds.v.raw_data.rows.push({ id: _KEY, value: { _KEY, _VAL } });
|
|
@@ -3698,13 +3719,7 @@ func.datasource.execute = async function (SESSION_ID, dataSourceSession, IS_DATA
|
|
|
3698
3719
|
data = {};
|
|
3699
3720
|
}
|
|
3700
3721
|
|
|
3701
|
-
// for (let [_KEY, _VAL] of Object.keys(data)) {
|
|
3702
|
-
// _ds.data_feed.rows[_KEY] = { _KEY, _VAL };
|
|
3703
|
-
// }
|
|
3704
3722
|
_ds.rows_found = Object.keys(data)?.length || 0;
|
|
3705
|
-
// if (!_ds.v.raw_data) {
|
|
3706
|
-
// _ds.v.raw_data = { rows: [] };
|
|
3707
|
-
// }
|
|
3708
3723
|
|
|
3709
3724
|
for (let [_KEY, _VAL] of Object.keys(data)) {
|
|
3710
3725
|
_ds.v.raw_data.rows.push({ id: _KEY, value: { _KEY, _VAL } });
|
|
@@ -3719,21 +3734,6 @@ func.datasource.execute = async function (SESSION_ID, dataSourceSession, IS_DATA
|
|
|
3719
3734
|
data = '';
|
|
3720
3735
|
}
|
|
3721
3736
|
|
|
3722
|
-
// if (!_ds.v.raw_data) {
|
|
3723
|
-
// _ds.v.raw_data = { rows: [] };
|
|
3724
|
-
// }
|
|
3725
|
-
|
|
3726
|
-
// let _KEY = 0;
|
|
3727
|
-
// let arr = data.split(",");
|
|
3728
|
-
// for (const _VAL of arr) {
|
|
3729
|
-
// _ds.data_feed.rows[_KEY] = { _KEY, _VAL };
|
|
3730
|
-
// _KEY++;
|
|
3731
|
-
// }
|
|
3732
|
-
// _ds.rows_found = arr?.length || 0;
|
|
3733
|
-
// if (!_ds.v.raw_data) {
|
|
3734
|
-
// _ds.v.raw_data = { rows: [] };
|
|
3735
|
-
// }
|
|
3736
|
-
|
|
3737
3737
|
let _KEY = 0;
|
|
3738
3738
|
let arr = data.split(',');
|
|
3739
3739
|
for (const _VAL of arr) {
|
|
@@ -8469,6 +8469,7 @@ func.UI.utils.get_panels_wrapper_from_dom = async function (SESSION_ID, $xu_embe
|
|
|
8469
8469
|
|
|
8470
8470
|
func.UI.worker = {};
|
|
8471
8471
|
func.UI.worker.ID = null;
|
|
8472
|
+
func.UI.worker.idle = 0;
|
|
8472
8473
|
func.UI.worker.init = async function (SESSION_ID) {
|
|
8473
8474
|
$.fn.isInViewport = function () {
|
|
8474
8475
|
var elementTop = $(this).offset().top;
|
|
@@ -8482,35 +8483,35 @@ func.UI.worker.init = async function (SESSION_ID) {
|
|
|
8482
8483
|
|
|
8483
8484
|
let last_job_in_queue = 0;
|
|
8484
8485
|
// let run_stat;
|
|
8485
|
-
const job_iterator2 = async function () {
|
|
8486
|
-
|
|
8487
|
-
|
|
8488
|
-
|
|
8489
|
-
|
|
8490
|
-
|
|
8491
|
-
|
|
8492
|
-
|
|
8493
|
-
|
|
8494
|
-
|
|
8495
|
-
|
|
8496
|
-
|
|
8497
|
-
|
|
8498
|
-
|
|
8499
|
-
|
|
8500
|
-
|
|
8501
|
-
|
|
8502
|
-
|
|
8503
|
-
|
|
8504
|
-
|
|
8505
|
-
|
|
8506
|
-
|
|
8507
|
-
|
|
8508
|
-
|
|
8509
|
-
|
|
8486
|
+
// const job_iterator2 = async function () {
|
|
8487
|
+
// let from_job_num_to_run = last_job_in_queue;
|
|
8488
|
+
// last_job_in_queue = UI_WORKER_OBJ.num - from_job_num_to_run;
|
|
8489
|
+
|
|
8490
|
+
// if (typeof UI_WORKER_OBJ.stat === 'undefined' || UI_WORKER_OBJ.stat === 'undefined' || UI_WORKER_OBJ.stat === null) {
|
|
8491
|
+
// // idle
|
|
8492
|
+
// this.attempt = 0;
|
|
8493
|
+
// if (UI_WORKER_OBJ.jobs.length) {
|
|
8494
|
+
// // clearInterval(this._interval);
|
|
8495
|
+
// for await (const [key, val] of Object.entries(UI_WORKER_OBJ.jobs)) {
|
|
8496
|
+
// // if (val.job_num < from_job_num_to_run) continue;
|
|
8497
|
+
// try {
|
|
8498
|
+
// if (val.stat) {
|
|
8499
|
+
// break;
|
|
8500
|
+
// }
|
|
8501
|
+
|
|
8502
|
+
// await func.UI.worker.execute(val.SESSION_ID, val);
|
|
8503
|
+
// // break;
|
|
8504
|
+
// } catch (err) {
|
|
8505
|
+
// console.error(err);
|
|
8506
|
+
// }
|
|
8507
|
+
// }
|
|
8508
|
+
// }
|
|
8509
|
+
// } else {
|
|
8510
|
+
// //busy
|
|
8510
8511
|
|
|
8511
|
-
|
|
8512
|
-
|
|
8513
|
-
};
|
|
8512
|
+
// this.attempt++;
|
|
8513
|
+
// }
|
|
8514
|
+
// };
|
|
8514
8515
|
|
|
8515
8516
|
const job_iterator = async function () {
|
|
8516
8517
|
let from_job_num_to_run = last_job_in_queue;
|
|
@@ -8519,7 +8520,9 @@ func.UI.worker.init = async function (SESSION_ID) {
|
|
|
8519
8520
|
// if (typeof UI_WORKER_OBJ.stat === 'undefined' || UI_WORKER_OBJ.stat === 'undefined' || UI_WORKER_OBJ.stat === null) {
|
|
8520
8521
|
// idle
|
|
8521
8522
|
this.attempt = 0;
|
|
8523
|
+
|
|
8522
8524
|
if (UI_WORKER_OBJ.jobs.length) {
|
|
8525
|
+
func.UI.worker.idle = 0;
|
|
8523
8526
|
let running_job_children_elements = [];
|
|
8524
8527
|
let active_job_children_elements = [];
|
|
8525
8528
|
for await (const [key, val] of Object.entries(UI_WORKER_OBJ.jobs)) {
|
|
@@ -8614,6 +8617,17 @@ func.UI.worker.init = async function (SESSION_ID) {
|
|
|
8614
8617
|
console.error(err);
|
|
8615
8618
|
}
|
|
8616
8619
|
}
|
|
8620
|
+
} else {
|
|
8621
|
+
func.UI.worker.idle++;
|
|
8622
|
+
|
|
8623
|
+
if (func.UI.worker.idle > 1000) {
|
|
8624
|
+
// cleaning pending_to_delete
|
|
8625
|
+
$.each($('body').find('*'), (key, val) => {
|
|
8626
|
+
if ($(val)?.data()?.xuData?.pending_to_delete) {
|
|
8627
|
+
$(val).data().xuData.pending_to_delete = false;
|
|
8628
|
+
}
|
|
8629
|
+
});
|
|
8630
|
+
}
|
|
8617
8631
|
}
|
|
8618
8632
|
// } else {
|
|
8619
8633
|
// //busy
|
|
@@ -3656,6 +3656,36 @@ func.datasource.execute = async function (SESSION_ID, dataSourceSession, IS_DATA
|
|
|
3656
3656
|
_dataSourceFilterModelType,
|
|
3657
3657
|
);
|
|
3658
3658
|
|
|
3659
|
+
if (_dataSourceFilterModelType === 'index' && _ds?.progDataSource?.sortModel) {
|
|
3660
|
+
function sortByKeys(array, sortConfig) {
|
|
3661
|
+
return array.sort((a, b) => {
|
|
3662
|
+
for (let config of sortConfig) {
|
|
3663
|
+
const key = config.field_id;
|
|
3664
|
+
const direction = config.sort_dir === 'desc' ? -1 : 1;
|
|
3665
|
+
|
|
3666
|
+
const valA = a.value[key];
|
|
3667
|
+
const valB = b.value[key];
|
|
3668
|
+
|
|
3669
|
+
// Handle numeric comparison
|
|
3670
|
+
if (typeof valA === 'number' && typeof valB === 'number') {
|
|
3671
|
+
if (valA !== valB) {
|
|
3672
|
+
return (valA - valB) * direction;
|
|
3673
|
+
}
|
|
3674
|
+
}
|
|
3675
|
+
// Handle string comparison
|
|
3676
|
+
else if (typeof valA === 'string' && typeof valB === 'string') {
|
|
3677
|
+
if (valA !== valB) {
|
|
3678
|
+
return valA.localeCompare(valB) * direction;
|
|
3679
|
+
}
|
|
3680
|
+
}
|
|
3681
|
+
}
|
|
3682
|
+
return 0;
|
|
3683
|
+
});
|
|
3684
|
+
}
|
|
3685
|
+
const sorted = sortByKeys(_ds.v.raw_data.rows, _ds.progDataSource.sortModel);
|
|
3686
|
+
_ds.v.raw_data.rows = sorted;
|
|
3687
|
+
}
|
|
3688
|
+
|
|
3659
3689
|
if (_ds?.progDataSource?.dataSourceLimit) {
|
|
3660
3690
|
const ret_rows_found = await func.db.get_query(SESSION_ID, _ds._dataSourceTableId, _ds.v.couchView, dataSourceSession, _ds.viewSourceDesc, 'datasource table', prog_obj.progDataSource.dataSourceReduce, null, null, true, null, null, null, filterModel, _dataSourceFilterModelType);
|
|
3661
3691
|
_ds.rows_found = ret_rows_found?.rows?.[0]?.value || 0;
|
|
@@ -3674,17 +3704,8 @@ func.datasource.execute = async function (SESSION_ID, dataSourceSession, IS_DATA
|
|
|
3674
3704
|
data = [];
|
|
3675
3705
|
}
|
|
3676
3706
|
|
|
3677
|
-
// let _KEY = 0;
|
|
3678
|
-
// for (const _VAL of data) {
|
|
3679
|
-
// _ds.data_feed.rows[_KEY] = { _KEY, _VAL };
|
|
3680
|
-
// _KEY++;
|
|
3681
|
-
// }
|
|
3682
|
-
|
|
3683
3707
|
_ds.rows_found = data?.length || 0;
|
|
3684
3708
|
|
|
3685
|
-
// if (!_ds.v.raw_data) {
|
|
3686
|
-
// _ds.v.raw_data = { rows: [] };
|
|
3687
|
-
// }
|
|
3688
3709
|
let _KEY = 0;
|
|
3689
3710
|
for (const _VAL of data) {
|
|
3690
3711
|
_ds.v.raw_data.rows.push({ id: _KEY, value: { _KEY, _VAL } });
|
|
@@ -3699,13 +3720,7 @@ func.datasource.execute = async function (SESSION_ID, dataSourceSession, IS_DATA
|
|
|
3699
3720
|
data = {};
|
|
3700
3721
|
}
|
|
3701
3722
|
|
|
3702
|
-
// for (let [_KEY, _VAL] of Object.keys(data)) {
|
|
3703
|
-
// _ds.data_feed.rows[_KEY] = { _KEY, _VAL };
|
|
3704
|
-
// }
|
|
3705
3723
|
_ds.rows_found = Object.keys(data)?.length || 0;
|
|
3706
|
-
// if (!_ds.v.raw_data) {
|
|
3707
|
-
// _ds.v.raw_data = { rows: [] };
|
|
3708
|
-
// }
|
|
3709
3724
|
|
|
3710
3725
|
for (let [_KEY, _VAL] of Object.keys(data)) {
|
|
3711
3726
|
_ds.v.raw_data.rows.push({ id: _KEY, value: { _KEY, _VAL } });
|
|
@@ -3720,21 +3735,6 @@ func.datasource.execute = async function (SESSION_ID, dataSourceSession, IS_DATA
|
|
|
3720
3735
|
data = '';
|
|
3721
3736
|
}
|
|
3722
3737
|
|
|
3723
|
-
// if (!_ds.v.raw_data) {
|
|
3724
|
-
// _ds.v.raw_data = { rows: [] };
|
|
3725
|
-
// }
|
|
3726
|
-
|
|
3727
|
-
// let _KEY = 0;
|
|
3728
|
-
// let arr = data.split(",");
|
|
3729
|
-
// for (const _VAL of arr) {
|
|
3730
|
-
// _ds.data_feed.rows[_KEY] = { _KEY, _VAL };
|
|
3731
|
-
// _KEY++;
|
|
3732
|
-
// }
|
|
3733
|
-
// _ds.rows_found = arr?.length || 0;
|
|
3734
|
-
// if (!_ds.v.raw_data) {
|
|
3735
|
-
// _ds.v.raw_data = { rows: [] };
|
|
3736
|
-
// }
|
|
3737
|
-
|
|
3738
3738
|
let _KEY = 0;
|
|
3739
3739
|
let arr = data.split(',');
|
|
3740
3740
|
for (const _VAL of arr) {
|
|
@@ -8470,6 +8470,7 @@ func.UI.utils.get_panels_wrapper_from_dom = async function (SESSION_ID, $xu_embe
|
|
|
8470
8470
|
|
|
8471
8471
|
func.UI.worker = {};
|
|
8472
8472
|
func.UI.worker.ID = null;
|
|
8473
|
+
func.UI.worker.idle = 0;
|
|
8473
8474
|
func.UI.worker.init = async function (SESSION_ID) {
|
|
8474
8475
|
$.fn.isInViewport = function () {
|
|
8475
8476
|
var elementTop = $(this).offset().top;
|
|
@@ -8483,35 +8484,35 @@ func.UI.worker.init = async function (SESSION_ID) {
|
|
|
8483
8484
|
|
|
8484
8485
|
let last_job_in_queue = 0;
|
|
8485
8486
|
// let run_stat;
|
|
8486
|
-
const job_iterator2 = async function () {
|
|
8487
|
-
|
|
8488
|
-
|
|
8489
|
-
|
|
8490
|
-
|
|
8491
|
-
|
|
8492
|
-
|
|
8493
|
-
|
|
8494
|
-
|
|
8495
|
-
|
|
8496
|
-
|
|
8497
|
-
|
|
8498
|
-
|
|
8499
|
-
|
|
8500
|
-
|
|
8501
|
-
|
|
8502
|
-
|
|
8503
|
-
|
|
8504
|
-
|
|
8505
|
-
|
|
8506
|
-
|
|
8507
|
-
|
|
8508
|
-
|
|
8509
|
-
|
|
8510
|
-
|
|
8487
|
+
// const job_iterator2 = async function () {
|
|
8488
|
+
// let from_job_num_to_run = last_job_in_queue;
|
|
8489
|
+
// last_job_in_queue = UI_WORKER_OBJ.num - from_job_num_to_run;
|
|
8490
|
+
|
|
8491
|
+
// if (typeof UI_WORKER_OBJ.stat === 'undefined' || UI_WORKER_OBJ.stat === 'undefined' || UI_WORKER_OBJ.stat === null) {
|
|
8492
|
+
// // idle
|
|
8493
|
+
// this.attempt = 0;
|
|
8494
|
+
// if (UI_WORKER_OBJ.jobs.length) {
|
|
8495
|
+
// // clearInterval(this._interval);
|
|
8496
|
+
// for await (const [key, val] of Object.entries(UI_WORKER_OBJ.jobs)) {
|
|
8497
|
+
// // if (val.job_num < from_job_num_to_run) continue;
|
|
8498
|
+
// try {
|
|
8499
|
+
// if (val.stat) {
|
|
8500
|
+
// break;
|
|
8501
|
+
// }
|
|
8502
|
+
|
|
8503
|
+
// await func.UI.worker.execute(val.SESSION_ID, val);
|
|
8504
|
+
// // break;
|
|
8505
|
+
// } catch (err) {
|
|
8506
|
+
// console.error(err);
|
|
8507
|
+
// }
|
|
8508
|
+
// }
|
|
8509
|
+
// }
|
|
8510
|
+
// } else {
|
|
8511
|
+
// //busy
|
|
8511
8512
|
|
|
8512
|
-
|
|
8513
|
-
|
|
8514
|
-
};
|
|
8513
|
+
// this.attempt++;
|
|
8514
|
+
// }
|
|
8515
|
+
// };
|
|
8515
8516
|
|
|
8516
8517
|
const job_iterator = async function () {
|
|
8517
8518
|
let from_job_num_to_run = last_job_in_queue;
|
|
@@ -8520,7 +8521,9 @@ func.UI.worker.init = async function (SESSION_ID) {
|
|
|
8520
8521
|
// if (typeof UI_WORKER_OBJ.stat === 'undefined' || UI_WORKER_OBJ.stat === 'undefined' || UI_WORKER_OBJ.stat === null) {
|
|
8521
8522
|
// idle
|
|
8522
8523
|
this.attempt = 0;
|
|
8524
|
+
|
|
8523
8525
|
if (UI_WORKER_OBJ.jobs.length) {
|
|
8526
|
+
func.UI.worker.idle = 0;
|
|
8524
8527
|
let running_job_children_elements = [];
|
|
8525
8528
|
let active_job_children_elements = [];
|
|
8526
8529
|
for await (const [key, val] of Object.entries(UI_WORKER_OBJ.jobs)) {
|
|
@@ -8615,6 +8618,17 @@ func.UI.worker.init = async function (SESSION_ID) {
|
|
|
8615
8618
|
console.error(err);
|
|
8616
8619
|
}
|
|
8617
8620
|
}
|
|
8621
|
+
} else {
|
|
8622
|
+
func.UI.worker.idle++;
|
|
8623
|
+
|
|
8624
|
+
if (func.UI.worker.idle > 1000) {
|
|
8625
|
+
// cleaning pending_to_delete
|
|
8626
|
+
$.each($('body').find('*'), (key, val) => {
|
|
8627
|
+
if ($(val)?.data()?.xuData?.pending_to_delete) {
|
|
8628
|
+
$(val).data().xuData.pending_to_delete = false;
|
|
8629
|
+
}
|
|
8630
|
+
});
|
|
8631
|
+
}
|
|
8618
8632
|
}
|
|
8619
8633
|
// } else {
|
|
8620
8634
|
// //busy
|