@xuda.io/xuda-worker-bundle-min 1.3.73 → 1.3.75

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.
Files changed (2) hide show
  1. package/index.js +61 -21
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1800,11 +1800,8 @@ func.datasource.execute = async function (
1800
1800
  };
1801
1801
  let data_arr = [];
1802
1802
  switch (tree_obj.menuType) {
1803
- case "api":
1803
+ case "api": {
1804
1804
  _ds.api_rendered_output = "";
1805
-
1806
- case "batch":
1807
- case "api":
1808
1805
  let has_datasource = await calc_batch_loops();
1809
1806
 
1810
1807
  data_arr = _ds.v?.raw_data?.rows || [];
@@ -1844,12 +1841,69 @@ func.datasource.execute = async function (
1844
1841
  "after_record"
1845
1842
  );
1846
1843
  }
1847
- if (tree_obj.menuType === "api") {
1848
- await render_api_output();
1844
+
1845
+ await render_api_output();
1846
+ }
1847
+
1848
+ if (tree_obj.apiOutput === "json") {
1849
+ var str = _ds.api_rendered_output.substring(
1850
+ 0,
1851
+ _ds.api_rendered_output.length - 1
1852
+ );
1853
+ if (Number(_ds.v.progDataSource?.dataSourceLimit) === 1) {
1854
+ _ds.api_rendered_output = str;
1855
+ } else {
1856
+ _ds.api_rendered_output = "[" + str + "]";
1849
1857
  }
1850
1858
  }
1851
- // ret = await callback_datasource();
1859
+
1852
1860
  break;
1861
+ }
1862
+
1863
+ case "batch": {
1864
+ let has_datasource = await calc_batch_loops();
1865
+
1866
+ data_arr = _ds.v?.raw_data?.rows || [];
1867
+ if (!has_datasource) {
1868
+ for (n = 0; n < _ds.v.batch_loops; n++) {
1869
+ data_arr.push({});
1870
+ }
1871
+ }
1872
+ _ds.currentRecordId = "dataset";
1873
+ for await (let [key, val] of Object.entries(data_arr)) {
1874
+ if (has_datasource && Number(key) >= _ds.v.batch_loops) break;
1875
+
1876
+ if (!has_datasource) {
1877
+ val.value = _ds?.data_feed?.rows?.[_ds.currentRecordId] || {
1878
+ value: {},
1879
+ };
1880
+ }
1881
+
1882
+ if (await get_before_record_count()) {
1883
+ await func.datasource.execute_view_events(
1884
+ SESSION_ID,
1885
+ dataSourceSession,
1886
+ "before_record"
1887
+ );
1888
+ }
1889
+
1890
+ await func.datasource.render_fields_dataset(
1891
+ SESSION_ID,
1892
+ dataSourceSession,
1893
+ val
1894
+ );
1895
+
1896
+ if (await get_after_record_count()) {
1897
+ await func.datasource.execute_view_events(
1898
+ SESSION_ID,
1899
+ dataSourceSession,
1900
+ "after_record"
1901
+ );
1902
+ }
1903
+ }
1904
+
1905
+ break;
1906
+ }
1853
1907
 
1854
1908
  case "get_data":
1855
1909
  if (await get_before_record_count()) {
@@ -1960,20 +2014,6 @@ func.datasource.execute = async function (
1960
2014
 
1961
2015
  break;
1962
2016
 
1963
- case "api":
1964
- if (_ds.apiOutput === "json") {
1965
- var str = _ds.api_rendered_output.substring(
1966
- 0,
1967
- _ds.api_rendered_output.length - 1
1968
- );
1969
- if (Number(_ds.v.progDataSource?.dataSourceLimit) === 1) {
1970
- _ds.api_rendered_output = str;
1971
- } else {
1972
- _ds.api_rendered_output = "[" + str + "]";
1973
- }
1974
- }
1975
- break;
1976
-
1977
2017
  case "component":
1978
2018
  _ds.data_feed = { sort: {}, groupBy: {}, rows: {} };
1979
2019
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/xuda-worker-bundle-min",
3
- "version": "1.3.73",
3
+ "version": "1.3.75",
4
4
  "description": "xuda framework min",
5
5
  "main": "index.js",
6
6
  "scripts": {