@xuda.io/runtime-bundle 1.0.681 → 1.0.683
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 +185 -111
- package/js/xuda-runtime-bundle.min.js +1 -1
- package/js/xuda-runtime-slim.js +185 -111
- package/js/xuda-runtime-slim.min.es.js +185 -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,89 +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;
|
|
9564
9559
|
}
|
|
9565
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
|
+
validate_change(prog_doc);
|
|
9570
|
+
}
|
|
9571
|
+
|
|
9572
|
+
const panels_obj = await func.UI.utils.get_panels_wrapper_from_dom(SESSION_ID, $(SESSION_OBJ[SESSION_ID].root_element), false);
|
|
9573
|
+
|
|
9574
|
+
for await (const [parent_element_ui_id, panel_val] of Object.entries(panels_obj)) {
|
|
9575
|
+
// const progDataSource_str = JSON.stringify(panel_val.prog_doc.progDataSource);
|
|
9576
|
+
|
|
9577
|
+
if (fields_changed_arr) {
|
|
9578
|
+
if (fields_changed_datasource && panel_val._ds.dsSession <= Number(fields_changed_datasource)) {
|
|
9579
|
+
continue;
|
|
9580
|
+
}
|
|
9581
|
+
validate_change(panel_val.prog_doc, panel_val?.panelXuAttributes);
|
|
9582
|
+
}
|
|
9566
9583
|
|
|
9567
9584
|
if (datasource_changed) {
|
|
9568
9585
|
if (panel_val._ds.dsSession == datasource_changed) {
|
|
@@ -9632,25 +9649,40 @@ func.UI.screen.refresh_screen = async function (SESSION_ID, fields_changed_arr,
|
|
|
9632
9649
|
}
|
|
9633
9650
|
};
|
|
9634
9651
|
|
|
9635
|
-
// func.UI.screen.
|
|
9636
|
-
//
|
|
9652
|
+
// func.UI.screen.refresh_screen = async function (SESSION_ID, fields_changed_arr, datasource_changed, fields_changed_datasource) {
|
|
9653
|
+
// // check the main program
|
|
9654
|
+
// if (fields_changed_datasource) {
|
|
9655
|
+
// const _session = SESSION_OBJ[SESSION_ID];
|
|
9656
|
+
// const _ds = _session.DS_GLB[fields_changed_datasource];
|
|
9657
|
+
// const prog_doc = await func.utils.DOCS_OBJ.get(SESSION_ID, _ds.prog_id);
|
|
9658
|
+
// const progDataSource_str = JSON.stringify(prog_doc.progDataSource);
|
|
9659
|
+
// for (const field_id of fields_changed_arr || []) {
|
|
9660
|
+
|
|
9661
|
+
// }
|
|
9662
|
+
// }
|
|
9663
|
+
|
|
9664
|
+
// const panels_obj = await func.UI.utils.get_panels_wrapper_from_dom(SESSION_ID, $(SESSION_OBJ[SESSION_ID].root_element), false);
|
|
9637
9665
|
|
|
9638
9666
|
// 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);
|
|
9667
|
+
// const progDataSource_str = JSON.stringify(panel_val.prog_doc.progDataSource);
|
|
9641
9668
|
|
|
9642
|
-
// var found;
|
|
9669
|
+
// var found, refresh_reason, refresh_details;
|
|
9643
9670
|
// if (fields_changed_arr) {
|
|
9644
|
-
// if (fields_changed_datasource && panel_val._ds.dsSession
|
|
9671
|
+
// if (fields_changed_datasource && panel_val._ds.dsSession <= Number(fields_changed_datasource)) {
|
|
9645
9672
|
// continue;
|
|
9646
9673
|
// }
|
|
9647
9674
|
// for (const field_id of fields_changed_arr) {
|
|
9648
9675
|
// // get panel attributes
|
|
9649
|
-
// const _attributes = panel_val
|
|
9676
|
+
// const _attributes = panel_val?.panelXuAttributes || {};
|
|
9650
9677
|
|
|
9651
9678
|
// // detect if program changed
|
|
9652
9679
|
// found = _attributes['xu-exp:program']?.includes('@' + field_id);
|
|
9653
|
-
|
|
9680
|
+
|
|
9681
|
+
// if (found) {
|
|
9682
|
+
// refresh_reason = `program ${_attributes['xu-exp:program']} ${field_id} changed `;
|
|
9683
|
+
// refresh_details = _attributes;
|
|
9684
|
+
// break;
|
|
9685
|
+
// }
|
|
9654
9686
|
|
|
9655
9687
|
// // _attributes holds also info of parameters in code_in: @code
|
|
9656
9688
|
// // search field changed in panel call send parameters exp
|
|
@@ -9668,11 +9700,23 @@ func.UI.screen.refresh_screen = async function (SESSION_ID, fields_changed_arr,
|
|
|
9668
9700
|
// if (value.includes(field_id)) {
|
|
9669
9701
|
// // search parameter in field in the target program's progDataSource
|
|
9670
9702
|
// found = progDataSource_str?.includes('@' + parameter_in_field_id);
|
|
9671
|
-
|
|
9703
|
+
|
|
9704
|
+
// if (found) {
|
|
9705
|
+
// refresh_reason = `field ${field_id} in progDataSource parameter_in changed`;
|
|
9706
|
+
// refresh_details = panel_val?.prog_doc?.progDataSource;
|
|
9707
|
+
|
|
9708
|
+
// break;
|
|
9709
|
+
// }
|
|
9672
9710
|
|
|
9673
9711
|
// // 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
|
-
|
|
9712
|
+
// found = func.UI.find_field_in_progUi_attributes(panel_val.prog_doc.progUi, parameter_in_field_id, 'xu-for').length;
|
|
9713
|
+
|
|
9714
|
+
// if (found) {
|
|
9715
|
+
// refresh_reason = `field ${field_id} in progUi xu-for parameter_in changed`;
|
|
9716
|
+
// refresh_details = found;
|
|
9717
|
+
|
|
9718
|
+
// break;
|
|
9719
|
+
// }
|
|
9676
9720
|
// }
|
|
9677
9721
|
// }
|
|
9678
9722
|
|
|
@@ -9680,63 +9724,93 @@ func.UI.screen.refresh_screen = async function (SESSION_ID, fields_changed_arr,
|
|
|
9680
9724
|
|
|
9681
9725
|
// // search field changed in the target program's progDataSource // @code
|
|
9682
9726
|
// found = progDataSource_str?.includes('@' + field_id);
|
|
9683
|
-
// if (found)
|
|
9727
|
+
// if (found) {
|
|
9728
|
+
// refresh_reason = `field ${field_id} in progDataSource changed`;
|
|
9729
|
+
// refresh_details = panel_val?.prog_doc?.progDataSource;
|
|
9730
|
+
|
|
9731
|
+
// break;
|
|
9732
|
+
// }
|
|
9733
|
+
|
|
9734
|
+
// found = func.UI.find_field_in_progUi_attributes(panel_val.prog_doc.progUi, field_id, 'xu-for').length;
|
|
9735
|
+
// if (found) {
|
|
9736
|
+
// refresh_reason = `field ${field_id} in progUi xu-for changed`;
|
|
9737
|
+
// refresh_details = found;
|
|
9738
|
+
|
|
9739
|
+
// break;
|
|
9740
|
+
// }
|
|
9741
|
+
|
|
9742
|
+
// if (found) {
|
|
9743
|
+
// break;
|
|
9744
|
+
// }
|
|
9684
9745
|
// }
|
|
9685
9746
|
// }
|
|
9686
9747
|
|
|
9687
9748
|
// if (datasource_changed) {
|
|
9688
9749
|
// if (panel_val._ds.dsSession == datasource_changed) {
|
|
9750
|
+
// refresh_reason = `panel datasource ${datasource_changed} changed`;
|
|
9751
|
+
// refresh_details = '';
|
|
9752
|
+
|
|
9689
9753
|
// found = true;
|
|
9690
9754
|
// }
|
|
9691
9755
|
// }
|
|
9692
9756
|
// if (found) {
|
|
9693
|
-
//
|
|
9694
|
-
//
|
|
9695
|
-
// .
|
|
9696
|
-
// .
|
|
9757
|
+
// const _session = SESSION_OBJ[SESSION_ID];
|
|
9758
|
+
// if (_session.engine_mode === 'live_preview') {
|
|
9759
|
+
// console.info('========= refresh info ==============');
|
|
9760
|
+
// console.info('reason:', refresh_reason);
|
|
9761
|
+
// console.info('details:', refresh_details);
|
|
9762
|
+
// console.info('panel:', panel_val);
|
|
9763
|
+
// console.info('=====================================');
|
|
9764
|
+
// }
|
|
9765
|
+
// const $div_elm = panel_val.$panel_div;
|
|
9766
|
+
// const wrapper_data = $div_elm.data();
|
|
9767
|
+
|
|
9768
|
+
// if (_.isEmpty(wrapper_data)) continue;
|
|
9697
9769
|
|
|
9698
|
-
// // restore original panel
|
|
9699
9770
|
// try {
|
|
9700
|
-
//
|
|
9771
|
+
// const ts = Date.now();
|
|
9772
|
+
// // remove old panel content
|
|
9773
|
+
// $.each(panel_val.ids, async function (key, val) {
|
|
9774
|
+
// $("[xu-ui-id='" + val + "']")
|
|
9775
|
+
// .attr('xu-ui-id', val + ts)
|
|
9776
|
+
// .removeData();
|
|
9777
|
+
// });
|
|
9701
9778
|
|
|
9702
|
-
//
|
|
9779
|
+
// let refreshed_ds;
|
|
9780
|
+
// // check if ds exist and deleted by garbage collector
|
|
9781
|
+
|
|
9782
|
+
// if (_session.DS_GLB[panel_val._ds.dsSession]) {
|
|
9783
|
+
// refreshed_ds = panel_val._ds.dsSession;
|
|
9784
|
+
// }
|
|
9785
|
+
// for await (const item of wrapper_data.xuData.node_org.children) {
|
|
9786
|
+
// if (item.tagName !== 'xu-panel') continue;
|
|
9787
|
+
|
|
9788
|
+
// const new_$div = await func.UI.screen.render_ui_tree(
|
|
9789
|
+
// SESSION_ID,
|
|
9790
|
+
// $div_elm, // the wrapper
|
|
9791
|
+
// _.cloneDeep(item), // _.cloneDeep(wrapper_data.xuData.node_org.children[0]), // the xu-panel node
|
|
9792
|
+
// {},
|
|
9793
|
+
// wrapper_data.xuData.paramsP, // the wrapper params
|
|
9794
|
+
// null,
|
|
9795
|
+
// null,
|
|
9796
|
+
// wrapper_data.xuData.key, // the wrapper key
|
|
9797
|
+
// refreshed_ds, // the refreshed_ds
|
|
9798
|
+
// wrapper_data.xuData.parent_node, // the wrapper parent node
|
|
9799
|
+
// null,
|
|
9800
|
+
// wrapper_data.xuData.$root_container, // the wrapper root container
|
|
9801
|
+
// );
|
|
9802
|
+
// }
|
|
9703
9803
|
|
|
9704
9804
|
// // remove old panel content
|
|
9705
9805
|
// $.each(panel_val.ids, async function (key, val) {
|
|
9706
|
-
// $("[xu-ui-id='" + val + "']").remove();
|
|
9806
|
+
// $("[xu-ui-id='" + val + ts + "']").remove();
|
|
9707
9807
|
// });
|
|
9708
9808
|
// } catch (error) {
|
|
9709
9809
|
// debugger;
|
|
9710
9810
|
// }
|
|
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`);
|
|
9811
|
+
// // continue;
|
|
9737
9812
|
// }
|
|
9738
9813
|
// }
|
|
9739
|
-
// return params_obj;
|
|
9740
9814
|
// };
|
|
9741
9815
|
|
|
9742
9816
|
const get_params_obj_new = async function (SESSION_ID, prog_id, nodeP, dsSession) {
|