@xuda.io/runtime-bundle 1.0.680 → 1.0.682
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/xuda-runtime-bundle.js +186 -111
- package/js/xuda-runtime-bundle.min.js +1 -1
- package/js/xuda-runtime-slim.js +186 -111
- package/js/xuda-runtime-slim.min.es.js +186 -111
- package/js/xuda-runtime-slim.min.js +1 -1
- package/js/xuda-server-bundle.min.mjs +1 -1
- package/js/xuda-server-bundle.mjs +2 -1
- package/js/xuda-worker-bundle.js +2 -1
- package/js/xuda-worker-bundle.min.js +1 -1
- package/package.json +1 -1
|
@@ -3859,7 +3859,8 @@ func.datasource.execute = async function (SESSION_ID, dataSourceSession, IS_DATA
|
|
|
3859
3859
|
}
|
|
3860
3860
|
|
|
3861
3861
|
// initiated with Update but no rows found
|
|
3862
|
-
if (tree_obj.crudMode === 'U' && tree_obj.allowCreate && !_ds?.data_feed?.rows?.length) {
|
|
3862
|
+
// if (tree_obj.crudMode === 'U' && tree_obj.allowCreate && !_ds?.data_feed?.rows?.length) {
|
|
3863
|
+
if (tree_obj.crudMode === 'U' && tree_obj.allowCreate && !_raw_data_rows?.length) {
|
|
3863
3864
|
_ds.set_mode = 'C';
|
|
3864
3865
|
// _raw_data_rows[glb.newRecord] = [{ _ROWID: "newRecord" }];
|
|
3865
3866
|
|
|
@@ -9480,88 +9481,105 @@ func.UI.screen.refresh_xu_attributes = async function (SESSION_ID, fields_arr, j
|
|
|
9480
9481
|
};
|
|
9481
9482
|
|
|
9482
9483
|
func.UI.screen.refresh_screen = async function (SESSION_ID, fields_changed_arr, datasource_changed, fields_changed_datasource) {
|
|
9483
|
-
|
|
9484
|
-
|
|
9485
|
-
|
|
9486
|
-
|
|
9487
|
-
|
|
9488
|
-
|
|
9489
|
-
|
|
9490
|
-
|
|
9491
|
-
|
|
9484
|
+
var found, refresh_reason, refresh_details;
|
|
9485
|
+
const validate_change = function (prog_doc, panelXuAttributes) {
|
|
9486
|
+
found = null;
|
|
9487
|
+
refresh_reason = null;
|
|
9488
|
+
refresh_details = null;
|
|
9489
|
+
const progDataSource_str = JSON.stringify(prog_doc.progDataSource);
|
|
9490
|
+
for (const field_id of fields_changed_arr) {
|
|
9491
|
+
// get panel attributes
|
|
9492
|
+
const _attributes = panelXuAttributes || {};
|
|
9493
|
+
|
|
9494
|
+
// detect if program changed
|
|
9495
|
+
found = _attributes['xu-exp:program']?.includes('@' + field_id);
|
|
9496
|
+
|
|
9497
|
+
if (found) {
|
|
9498
|
+
refresh_reason = `program ${_attributes['xu-exp:program']} ${field_id} changed `;
|
|
9499
|
+
refresh_details = _attributes;
|
|
9500
|
+
break;
|
|
9492
9501
|
}
|
|
9493
|
-
for (const field_id of fields_changed_arr) {
|
|
9494
|
-
// get panel attributes
|
|
9495
|
-
const _attributes = panel_val?.panelXuAttributes || {};
|
|
9496
9502
|
|
|
9497
|
-
|
|
9498
|
-
|
|
9503
|
+
// _attributes holds also info of parameters in code_in: @code
|
|
9504
|
+
// search field changed in panel call send parameters exp
|
|
9505
|
+
for (const [attr, value] of Object.entries(_attributes)) {
|
|
9506
|
+
const pattern = /xu-exp:(\w+)/;
|
|
9507
|
+
const match = attr.match(pattern);
|
|
9499
9508
|
|
|
9500
|
-
if (
|
|
9501
|
-
|
|
9502
|
-
|
|
9503
|
-
break;
|
|
9509
|
+
if (!match) {
|
|
9510
|
+
// continue if attribute is not expression
|
|
9511
|
+
continue;
|
|
9504
9512
|
}
|
|
9513
|
+
// code_in
|
|
9514
|
+
const parameter_in_field_id = match?.[1];
|
|
9515
|
+
// @code
|
|
9516
|
+
if (value.includes(field_id)) {
|
|
9517
|
+
// search parameter in field in the target program's progDataSource
|
|
9518
|
+
found = progDataSource_str?.includes('@' + parameter_in_field_id);
|
|
9505
9519
|
|
|
9506
|
-
|
|
9507
|
-
|
|
9508
|
-
|
|
9509
|
-
const pattern = /xu-exp:(\w+)/;
|
|
9510
|
-
const match = attr.match(pattern);
|
|
9520
|
+
if (found) {
|
|
9521
|
+
refresh_reason = `field ${field_id} in progDataSource parameter_in changed`;
|
|
9522
|
+
refresh_details = prog_doc?.progDataSource;
|
|
9511
9523
|
|
|
9512
|
-
|
|
9513
|
-
// continue if attribute is not expression
|
|
9514
|
-
continue;
|
|
9524
|
+
break;
|
|
9515
9525
|
}
|
|
9516
|
-
// code_in
|
|
9517
|
-
const parameter_in_field_id = match?.[1];
|
|
9518
|
-
// @code
|
|
9519
|
-
if (value.includes(field_id)) {
|
|
9520
|
-
// search parameter in field in the target program's progDataSource
|
|
9521
|
-
found = progDataSource_str?.includes('@' + parameter_in_field_id);
|
|
9522
9526
|
|
|
9523
|
-
|
|
9524
|
-
refresh_reason = `field ${field_id} in progDataSource parameter_in changed`;
|
|
9525
|
-
refresh_details = panel_val?.prog_doc?.progDataSource;
|
|
9527
|
+
found = func.UI.find_field_in_progUi_attributes(prog_doc.progUi, parameter_in_field_id, 'xu-for').length;
|
|
9526
9528
|
|
|
9527
|
-
|
|
9528
|
-
}
|
|
9529
|
-
|
|
9530
|
-
// found = find_field_in_progUi(prog_doc.progUi, parameter_in_field_id, 'xu-for');
|
|
9531
|
-
found = func.UI.find_field_in_progUi_attributes(panel_val.prog_doc.progUi, parameter_in_field_id, 'xu-for').length;
|
|
9529
|
+
if (found) {
|
|
9530
|
+
refresh_reason = `field ${field_id} in progUi xu-for parameter_in changed`;
|
|
9531
|
+
refresh_details = found;
|
|
9532
9532
|
|
|
9533
|
-
|
|
9534
|
-
refresh_reason = `field ${field_id} in progUi xu-for parameter_in changed`;
|
|
9535
|
-
refresh_details = found;
|
|
9536
|
-
|
|
9537
|
-
break;
|
|
9538
|
-
}
|
|
9533
|
+
break;
|
|
9539
9534
|
}
|
|
9540
9535
|
}
|
|
9536
|
+
}
|
|
9541
9537
|
|
|
9542
|
-
|
|
9538
|
+
if (found) break;
|
|
9543
9539
|
|
|
9544
|
-
|
|
9545
|
-
|
|
9546
|
-
|
|
9547
|
-
|
|
9548
|
-
|
|
9540
|
+
// search field changed in the target program's progDataSource // @code
|
|
9541
|
+
found = progDataSource_str?.includes('@' + field_id);
|
|
9542
|
+
if (found) {
|
|
9543
|
+
refresh_reason = `field ${field_id} in progDataSource changed`;
|
|
9544
|
+
refresh_details = prog_doc?.progDataSource;
|
|
9549
9545
|
|
|
9550
|
-
|
|
9551
|
-
|
|
9546
|
+
break;
|
|
9547
|
+
}
|
|
9552
9548
|
|
|
9553
|
-
|
|
9554
|
-
|
|
9555
|
-
|
|
9556
|
-
|
|
9549
|
+
found = func.UI.find_field_in_progUi_attributes(prog_doc.progUi, field_id, 'xu-for').length;
|
|
9550
|
+
if (found) {
|
|
9551
|
+
refresh_reason = `field ${field_id} in progUi xu-for changed`;
|
|
9552
|
+
refresh_details = found;
|
|
9557
9553
|
|
|
9558
|
-
|
|
9559
|
-
|
|
9554
|
+
break;
|
|
9555
|
+
}
|
|
9560
9556
|
|
|
9561
|
-
|
|
9562
|
-
|
|
9563
|
-
|
|
9557
|
+
if (found) {
|
|
9558
|
+
break;
|
|
9559
|
+
}
|
|
9560
|
+
}
|
|
9561
|
+
};
|
|
9562
|
+
|
|
9563
|
+
// check the main program
|
|
9564
|
+
if (fields_changed_datasource) {
|
|
9565
|
+
const _session = SESSION_OBJ[SESSION_ID];
|
|
9566
|
+
const _ds = _session.DS_GLB[fields_changed_datasource];
|
|
9567
|
+
const prog_doc = await func.utils.DOCS_OBJ.get(SESSION_ID, _ds.prog_id);
|
|
9568
|
+
// const progDataSource_str = JSON.stringify(prog_doc.progDataSource);
|
|
9569
|
+
for (const field_id of fields_changed_arr || []) {
|
|
9570
|
+
}
|
|
9571
|
+
}
|
|
9572
|
+
|
|
9573
|
+
const panels_obj = await func.UI.utils.get_panels_wrapper_from_dom(SESSION_ID, $(SESSION_OBJ[SESSION_ID].root_element), false);
|
|
9574
|
+
|
|
9575
|
+
for await (const [parent_element_ui_id, panel_val] of Object.entries(panels_obj)) {
|
|
9576
|
+
// const progDataSource_str = JSON.stringify(panel_val.prog_doc.progDataSource);
|
|
9577
|
+
|
|
9578
|
+
if (fields_changed_arr) {
|
|
9579
|
+
if (fields_changed_datasource && panel_val._ds.dsSession <= Number(fields_changed_datasource)) {
|
|
9580
|
+
continue;
|
|
9564
9581
|
}
|
|
9582
|
+
validate_change(panel_val.prog_doc, panel_val?.panelXuAttributes);
|
|
9565
9583
|
}
|
|
9566
9584
|
|
|
9567
9585
|
if (datasource_changed) {
|
|
@@ -9632,25 +9650,40 @@ func.UI.screen.refresh_screen = async function (SESSION_ID, fields_changed_arr,
|
|
|
9632
9650
|
}
|
|
9633
9651
|
};
|
|
9634
9652
|
|
|
9635
|
-
// func.UI.screen.
|
|
9636
|
-
//
|
|
9653
|
+
// func.UI.screen.refresh_screen = async function (SESSION_ID, fields_changed_arr, datasource_changed, fields_changed_datasource) {
|
|
9654
|
+
// // check the main program
|
|
9655
|
+
// if (fields_changed_datasource) {
|
|
9656
|
+
// const _session = SESSION_OBJ[SESSION_ID];
|
|
9657
|
+
// const _ds = _session.DS_GLB[fields_changed_datasource];
|
|
9658
|
+
// const prog_doc = await func.utils.DOCS_OBJ.get(SESSION_ID, _ds.prog_id);
|
|
9659
|
+
// const progDataSource_str = JSON.stringify(prog_doc.progDataSource);
|
|
9660
|
+
// for (const field_id of fields_changed_arr || []) {
|
|
9661
|
+
|
|
9662
|
+
// }
|
|
9663
|
+
// }
|
|
9664
|
+
|
|
9665
|
+
// const panels_obj = await func.UI.utils.get_panels_wrapper_from_dom(SESSION_ID, $(SESSION_OBJ[SESSION_ID].root_element), false);
|
|
9637
9666
|
|
|
9638
9667
|
// for await (const [parent_element_ui_id, panel_val] of Object.entries(panels_obj)) {
|
|
9639
|
-
// const
|
|
9640
|
-
// const progDataSource_str = JSON.stringify(prog_doc.progDataSource);
|
|
9668
|
+
// const progDataSource_str = JSON.stringify(panel_val.prog_doc.progDataSource);
|
|
9641
9669
|
|
|
9642
|
-
// var found;
|
|
9670
|
+
// var found, refresh_reason, refresh_details;
|
|
9643
9671
|
// if (fields_changed_arr) {
|
|
9644
|
-
// if (fields_changed_datasource && panel_val._ds.dsSession
|
|
9672
|
+
// if (fields_changed_datasource && panel_val._ds.dsSession <= Number(fields_changed_datasource)) {
|
|
9645
9673
|
// continue;
|
|
9646
9674
|
// }
|
|
9647
9675
|
// for (const field_id of fields_changed_arr) {
|
|
9648
9676
|
// // get panel attributes
|
|
9649
|
-
// const _attributes = panel_val
|
|
9677
|
+
// const _attributes = panel_val?.panelXuAttributes || {};
|
|
9650
9678
|
|
|
9651
9679
|
// // detect if program changed
|
|
9652
9680
|
// found = _attributes['xu-exp:program']?.includes('@' + field_id);
|
|
9653
|
-
|
|
9681
|
+
|
|
9682
|
+
// if (found) {
|
|
9683
|
+
// refresh_reason = `program ${_attributes['xu-exp:program']} ${field_id} changed `;
|
|
9684
|
+
// refresh_details = _attributes;
|
|
9685
|
+
// break;
|
|
9686
|
+
// }
|
|
9654
9687
|
|
|
9655
9688
|
// // _attributes holds also info of parameters in code_in: @code
|
|
9656
9689
|
// // search field changed in panel call send parameters exp
|
|
@@ -9668,11 +9701,23 @@ func.UI.screen.refresh_screen = async function (SESSION_ID, fields_changed_arr,
|
|
|
9668
9701
|
// if (value.includes(field_id)) {
|
|
9669
9702
|
// // search parameter in field in the target program's progDataSource
|
|
9670
9703
|
// found = progDataSource_str?.includes('@' + parameter_in_field_id);
|
|
9671
|
-
|
|
9704
|
+
|
|
9705
|
+
// if (found) {
|
|
9706
|
+
// refresh_reason = `field ${field_id} in progDataSource parameter_in changed`;
|
|
9707
|
+
// refresh_details = panel_val?.prog_doc?.progDataSource;
|
|
9708
|
+
|
|
9709
|
+
// break;
|
|
9710
|
+
// }
|
|
9672
9711
|
|
|
9673
9712
|
// // found = find_field_in_progUi(prog_doc.progUi, parameter_in_field_id, 'xu-for');
|
|
9674
|
-
// found = func.UI.find_field_in_progUi_attributes(prog_doc.progUi, parameter_in_field_id, 'xu-for').length;
|
|
9675
|
-
|
|
9713
|
+
// found = func.UI.find_field_in_progUi_attributes(panel_val.prog_doc.progUi, parameter_in_field_id, 'xu-for').length;
|
|
9714
|
+
|
|
9715
|
+
// if (found) {
|
|
9716
|
+
// refresh_reason = `field ${field_id} in progUi xu-for parameter_in changed`;
|
|
9717
|
+
// refresh_details = found;
|
|
9718
|
+
|
|
9719
|
+
// break;
|
|
9720
|
+
// }
|
|
9676
9721
|
// }
|
|
9677
9722
|
// }
|
|
9678
9723
|
|
|
@@ -9680,63 +9725,93 @@ func.UI.screen.refresh_screen = async function (SESSION_ID, fields_changed_arr,
|
|
|
9680
9725
|
|
|
9681
9726
|
// // search field changed in the target program's progDataSource // @code
|
|
9682
9727
|
// found = progDataSource_str?.includes('@' + field_id);
|
|
9683
|
-
// if (found)
|
|
9728
|
+
// if (found) {
|
|
9729
|
+
// refresh_reason = `field ${field_id} in progDataSource changed`;
|
|
9730
|
+
// refresh_details = panel_val?.prog_doc?.progDataSource;
|
|
9731
|
+
|
|
9732
|
+
// break;
|
|
9733
|
+
// }
|
|
9734
|
+
|
|
9735
|
+
// found = func.UI.find_field_in_progUi_attributes(panel_val.prog_doc.progUi, field_id, 'xu-for').length;
|
|
9736
|
+
// if (found) {
|
|
9737
|
+
// refresh_reason = `field ${field_id} in progUi xu-for changed`;
|
|
9738
|
+
// refresh_details = found;
|
|
9739
|
+
|
|
9740
|
+
// break;
|
|
9741
|
+
// }
|
|
9742
|
+
|
|
9743
|
+
// if (found) {
|
|
9744
|
+
// break;
|
|
9745
|
+
// }
|
|
9684
9746
|
// }
|
|
9685
9747
|
// }
|
|
9686
9748
|
|
|
9687
9749
|
// if (datasource_changed) {
|
|
9688
9750
|
// if (panel_val._ds.dsSession == datasource_changed) {
|
|
9751
|
+
// refresh_reason = `panel datasource ${datasource_changed} changed`;
|
|
9752
|
+
// refresh_details = '';
|
|
9753
|
+
|
|
9689
9754
|
// found = true;
|
|
9690
9755
|
// }
|
|
9691
9756
|
// }
|
|
9692
9757
|
// if (found) {
|
|
9693
|
-
//
|
|
9694
|
-
//
|
|
9695
|
-
// .
|
|
9696
|
-
// .
|
|
9758
|
+
// const _session = SESSION_OBJ[SESSION_ID];
|
|
9759
|
+
// if (_session.engine_mode === 'live_preview') {
|
|
9760
|
+
// console.info('========= refresh info ==============');
|
|
9761
|
+
// console.info('reason:', refresh_reason);
|
|
9762
|
+
// console.info('details:', refresh_details);
|
|
9763
|
+
// console.info('panel:', panel_val);
|
|
9764
|
+
// console.info('=====================================');
|
|
9765
|
+
// }
|
|
9766
|
+
// const $div_elm = panel_val.$panel_div;
|
|
9767
|
+
// const wrapper_data = $div_elm.data();
|
|
9768
|
+
|
|
9769
|
+
// if (_.isEmpty(wrapper_data)) continue;
|
|
9697
9770
|
|
|
9698
|
-
// // restore original panel
|
|
9699
9771
|
// try {
|
|
9700
|
-
//
|
|
9772
|
+
// const ts = Date.now();
|
|
9773
|
+
// // remove old panel content
|
|
9774
|
+
// $.each(panel_val.ids, async function (key, val) {
|
|
9775
|
+
// $("[xu-ui-id='" + val + "']")
|
|
9776
|
+
// .attr('xu-ui-id', val + ts)
|
|
9777
|
+
// .removeData();
|
|
9778
|
+
// });
|
|
9701
9779
|
|
|
9702
|
-
//
|
|
9780
|
+
// let refreshed_ds;
|
|
9781
|
+
// // check if ds exist and deleted by garbage collector
|
|
9782
|
+
|
|
9783
|
+
// if (_session.DS_GLB[panel_val._ds.dsSession]) {
|
|
9784
|
+
// refreshed_ds = panel_val._ds.dsSession;
|
|
9785
|
+
// }
|
|
9786
|
+
// for await (const item of wrapper_data.xuData.node_org.children) {
|
|
9787
|
+
// if (item.tagName !== 'xu-panel') continue;
|
|
9788
|
+
|
|
9789
|
+
// const new_$div = await func.UI.screen.render_ui_tree(
|
|
9790
|
+
// SESSION_ID,
|
|
9791
|
+
// $div_elm, // the wrapper
|
|
9792
|
+
// _.cloneDeep(item), // _.cloneDeep(wrapper_data.xuData.node_org.children[0]), // the xu-panel node
|
|
9793
|
+
// {},
|
|
9794
|
+
// wrapper_data.xuData.paramsP, // the wrapper params
|
|
9795
|
+
// null,
|
|
9796
|
+
// null,
|
|
9797
|
+
// wrapper_data.xuData.key, // the wrapper key
|
|
9798
|
+
// refreshed_ds, // the refreshed_ds
|
|
9799
|
+
// wrapper_data.xuData.parent_node, // the wrapper parent node
|
|
9800
|
+
// null,
|
|
9801
|
+
// wrapper_data.xuData.$root_container, // the wrapper root container
|
|
9802
|
+
// );
|
|
9803
|
+
// }
|
|
9703
9804
|
|
|
9704
9805
|
// // remove old panel content
|
|
9705
9806
|
// $.each(panel_val.ids, async function (key, val) {
|
|
9706
|
-
// $("[xu-ui-id='" + val + "']").remove();
|
|
9807
|
+
// $("[xu-ui-id='" + val + ts + "']").remove();
|
|
9707
9808
|
// });
|
|
9708
9809
|
// } catch (error) {
|
|
9709
9810
|
// debugger;
|
|
9710
9811
|
// }
|
|
9711
|
-
//
|
|
9712
|
-
// }
|
|
9713
|
-
// }
|
|
9714
|
-
// };
|
|
9715
|
-
|
|
9716
|
-
// const get_params_obj = async function (SESSION_ID, prog_id, parameters_obj_inP) {
|
|
9717
|
-
// const _prog = await func.utils.VIEWS_OBJ.get(SESSION_ID, prog_id);
|
|
9718
|
-
// if (!_prog) {
|
|
9719
|
-
// return;
|
|
9720
|
-
// }
|
|
9721
|
-
|
|
9722
|
-
// // get in parameters
|
|
9723
|
-
// var params_obj = {};
|
|
9724
|
-
// if (_prog?.properties?.progParams) {
|
|
9725
|
-
// for await (const [key, val] of Object.entries(_prog.properties.progParams)) {
|
|
9726
|
-
// if (!val.data.dir === 'in') continue;
|
|
9727
|
-
// if (typeof parameters_obj_inP?.[val.data.parameter] !== 'undefined') {
|
|
9728
|
-
// if (parameters_obj_inP?.[val.data.parameter].fx) {
|
|
9729
|
-
// let ret = await func.expression.get(SESSION_ID, parameters_obj_inP?.[val.data.parameter].fx, dsSession, 'parameters');
|
|
9730
|
-
// params_obj[val.data.parameter] = ret.result;
|
|
9731
|
-
// } else {
|
|
9732
|
-
// params_obj[val.data.parameter] = parameters_obj_inP?.[val.data.parameter].value;
|
|
9733
|
-
// }
|
|
9734
|
-
// continue;
|
|
9735
|
-
// }
|
|
9736
|
-
// console.warn(`Warning: Program ${_prog.properties.menuName} expected In parameter: ${val.data.parameter} but received null instead`);
|
|
9812
|
+
// // continue;
|
|
9737
9813
|
// }
|
|
9738
9814
|
// }
|
|
9739
|
-
// return params_obj;
|
|
9740
9815
|
// };
|
|
9741
9816
|
|
|
9742
9817
|
const get_params_obj_new = async function (SESSION_ID, prog_id, nodeP, dsSession) {
|