@xuda.io/runtime-bundle 1.0.460 → 1.0.462
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-actions-module.esm.js +111 -169
- package/js/modules/xuda-actions-module.esm.min.js +1 -1
- package/js/modules/xuda-studio-checker.min.mjs +1 -1
- package/js/modules/xuda-studio-checker.mjs +621 -982
- package/js/xuda-runtime-bundle.js +107 -171
- package/js/xuda-runtime-bundle.min.js +1 -1
- package/js/xuda-runtime-mini-bundle.js +98 -131
- package/js/xuda-runtime-slim.js +107 -171
- package/js/xuda-runtime-slim.min.es.js +107 -171
- package/js/xuda-runtime-slim.min.js +1 -1
- package/js/xuda-server-bundle.min.mjs +1 -1
- package/js/xuda-server-bundle.mjs +104 -137
- package/js/xuda-worker-bundle.js +104 -137
- package/js/xuda-worker-bundle.min.js +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const screen_save = async function (SESSION_ID, paramsP) {
|
|
2
2
|
var str = '[screenid="' + paramsP.screenId + '"]';
|
|
3
|
-
var elm = $(
|
|
3
|
+
var elm = $('#' + paramsP.screenId).find(str);
|
|
4
4
|
var dsSession;
|
|
5
5
|
|
|
6
6
|
if (!elm || !elm.length) {
|
|
@@ -8,7 +8,7 @@ const screen_save = async function (SESSION_ID, paramsP) {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
for await (const [key, val] of Object.entries(elm)) {
|
|
11
|
-
if (key ===
|
|
11
|
+
if (key === 'length') {
|
|
12
12
|
break;
|
|
13
13
|
}
|
|
14
14
|
if (!val) {
|
|
@@ -21,11 +21,10 @@ const screen_save = async function (SESSION_ID, paramsP) {
|
|
|
21
21
|
continue;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
if (_ds.tree_obj.renderType ===
|
|
24
|
+
if (_ds.tree_obj.renderType === 'form') {
|
|
25
25
|
if (_ds._dataSourceTableId) {
|
|
26
26
|
// update only when file exist
|
|
27
|
-
if (!_ds.abort_save)
|
|
28
|
-
await func.db.save_data(SESSION_ID, dsSession, key);
|
|
27
|
+
if (!_ds.abort_save) await func.db.save_data(SESSION_ID, dsSession, key);
|
|
29
28
|
_ds.abort_save = false;
|
|
30
29
|
continue;
|
|
31
30
|
}
|
|
@@ -33,15 +32,7 @@ const screen_save = async function (SESSION_ID, paramsP) {
|
|
|
33
32
|
}
|
|
34
33
|
};
|
|
35
34
|
|
|
36
|
-
export const action_execute = async function (
|
|
37
|
-
SESSION_ID,
|
|
38
|
-
actionP,
|
|
39
|
-
params,
|
|
40
|
-
isScreenActionP,
|
|
41
|
-
event_sourceP,
|
|
42
|
-
jobNoP,
|
|
43
|
-
containerP
|
|
44
|
-
) {
|
|
35
|
+
export const action_execute = async function (SESSION_ID, actionP, params, isScreenActionP, event_sourceP, jobNoP, containerP) {
|
|
45
36
|
var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[params.dsSession];
|
|
46
37
|
|
|
47
38
|
if (!_ds) {
|
|
@@ -53,7 +44,7 @@ export const action_execute = async function (
|
|
|
53
44
|
var action = actionP;
|
|
54
45
|
|
|
55
46
|
var formGrid_dsSession; // null when action triggered from screen
|
|
56
|
-
var EVENTSUFFIX =
|
|
47
|
+
var EVENTSUFFIX = '_triggered';
|
|
57
48
|
if (!isScreenActionP) formGrid_dsSession = params.dsSession;
|
|
58
49
|
|
|
59
50
|
var do_event = async function (actionP) {
|
|
@@ -61,161 +52,142 @@ export const action_execute = async function (
|
|
|
61
52
|
await func.events.check_jobs_idle(SESSION_ID, jobsP);
|
|
62
53
|
func.events.delete_job(SESSION_ID, jobNoP);
|
|
63
54
|
};
|
|
64
|
-
const jobsP = await func.events.validate(
|
|
65
|
-
SESSION_ID,
|
|
66
|
-
actionP + EVENTSUFFIX,
|
|
67
|
-
params.dsSession,
|
|
68
|
-
null,
|
|
69
|
-
"action"
|
|
70
|
-
);
|
|
55
|
+
const jobsP = await func.events.validate(SESSION_ID, actionP + EVENTSUFFIX, params.dsSession, null, 'action');
|
|
71
56
|
await delete_job(jobsP);
|
|
72
57
|
};
|
|
73
58
|
|
|
74
59
|
const fx = {
|
|
75
60
|
act_next: async function () {
|
|
76
|
-
await locate_record(SESSION_ID,
|
|
77
|
-
if (_ds.tree_obj.renderType ===
|
|
78
|
-
$(
|
|
61
|
+
await locate_record(SESSION_ID, 'next', params.dsSession);
|
|
62
|
+
if (_ds.tree_obj.renderType === 'form') {
|
|
63
|
+
$('body').trigger('xu-bind-refresh.' + params.dsSession.toString());
|
|
79
64
|
}
|
|
80
65
|
},
|
|
81
66
|
act_prev: async function () {
|
|
82
|
-
await locate_record(SESSION_ID,
|
|
83
|
-
if (_ds.tree_obj.renderType ===
|
|
84
|
-
$("body").trigger("xu-bind-refresh." + params.dsSession.toString());
|
|
67
|
+
await locate_record(SESSION_ID, 'prev', params.dsSession);
|
|
68
|
+
if (_ds.tree_obj.renderType === 'form') $('body').trigger('xu-bind-refresh.' + params.dsSession.toString());
|
|
85
69
|
},
|
|
86
|
-
|
|
87
70
|
act_last: async function () {
|
|
88
|
-
await locate_record(SESSION_ID,
|
|
89
|
-
if (_ds.tree_obj.renderType ===
|
|
90
|
-
$("body").trigger("xu-bind-refresh." + params.dsSession.toString());
|
|
71
|
+
await locate_record(SESSION_ID, 'last', params.dsSession);
|
|
72
|
+
if (_ds.tree_obj.renderType === 'form') $('body').trigger('xu-bind-refresh.' + params.dsSession.toString());
|
|
91
73
|
},
|
|
92
74
|
act_first: async function () {
|
|
93
|
-
await locate_record(SESSION_ID,
|
|
94
|
-
if (_ds.tree_obj.renderType ===
|
|
95
|
-
$("body").trigger("xu-bind-refresh." + params.dsSession.toString());
|
|
75
|
+
await locate_record(SESSION_ID, 'first', params.dsSession);
|
|
76
|
+
if (_ds.tree_obj.renderType === 'form') $('body').trigger('xu-bind-refresh.' + params.dsSession.toString());
|
|
96
77
|
},
|
|
97
|
-
|
|
98
78
|
act_refresh: async function (sourceP) {
|
|
99
79
|
let screen_params = params.screen_params;
|
|
100
80
|
|
|
101
|
-
await func.datasource.create(
|
|
102
|
-
SESSION_ID,
|
|
103
|
-
params.prog_id,
|
|
104
|
-
params.dsSession,
|
|
105
|
-
params.parentDataSourceNo,
|
|
106
|
-
params.containerId,
|
|
107
|
-
params.rowIdP
|
|
108
|
-
);
|
|
81
|
+
await func.datasource.create(SESSION_ID, params.prog_id, params.dsSession, params.parentDataSourceNo, params.containerId, params.rowIdP);
|
|
109
82
|
let _ds = SESSION_OBJ[SESSION_ID].DS_GLB[params.dsSession];
|
|
110
83
|
_ds.screen_params = screen_params;
|
|
111
84
|
func.UI.screen.update_SYS_OBJ_WIN_INFO(SESSION_ID, params.dsSession);
|
|
112
|
-
$(
|
|
85
|
+
$('body').trigger('xu-bind-refresh.' + params.dsSession.toString());
|
|
113
86
|
|
|
114
87
|
let prog_obj = await func.utils.VIEWS_OBJ.get(SESSION_ID, _ds.prog_id);
|
|
115
88
|
let field_changed = [];
|
|
116
89
|
for (let field of prog_obj?.progFields) {
|
|
117
|
-
field_changed.push(field?.data?.field_id ||
|
|
90
|
+
field_changed.push(field?.data?.field_id || '');
|
|
118
91
|
}
|
|
119
92
|
func.UI.screen.refresh_xu_attributes(SESSION_ID, field_changed);
|
|
120
93
|
},
|
|
121
|
-
|
|
122
94
|
act_save: async function () {
|
|
123
95
|
await screen_save(SESSION_ID, params);
|
|
124
96
|
},
|
|
125
|
-
act_close: async function () {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
},
|
|
97
|
+
// act_close: async function () {
|
|
98
|
+
// switch (params.screen_params.screen_type) {
|
|
99
|
+
// case 'modal':
|
|
100
|
+
// let modal_id = 'app_modal-' + params.dsSession.toString();
|
|
101
|
+
// // APP_MODAL_OBJ[modal_id].dismiss().then(async () => {
|
|
102
|
+
// // APP_MODAL_OBJ[modal_id] = null;
|
|
103
|
+
|
|
104
|
+
// // func.events.delete_job(SESSION_ID, jobNoP);
|
|
105
|
+
// // });
|
|
106
|
+
// APP_MODAL_OBJ[modal_id].close();
|
|
107
|
+
// // APP_MODAL_OBJ[modal_id] = null;
|
|
108
|
+
// func.events.delete_job(SESSION_ID, jobNoP);
|
|
109
|
+
// break;
|
|
110
|
+
|
|
111
|
+
// case 'popover':
|
|
112
|
+
// CURRENT_APP_POPOVER.dismiss().then(async () => {
|
|
113
|
+
// CURRENT_APP_POPOVER = null;
|
|
114
|
+
|
|
115
|
+
// func.events.delete_job(SESSION_ID, jobNoP);
|
|
116
|
+
// });
|
|
117
|
+
// break;
|
|
118
|
+
|
|
119
|
+
// case 'page':
|
|
120
|
+
// var nav = $(SESSION_OBJ[SESSION_ID].root_element).find('xu-nav')[0];
|
|
121
|
+
// nav.popToRoot();
|
|
122
|
+
|
|
123
|
+
// var ds_obj = $(nav).data().xuData.nav_params;
|
|
124
|
+
|
|
125
|
+
// break;
|
|
126
|
+
|
|
127
|
+
// default:
|
|
128
|
+
// break;
|
|
129
|
+
// }
|
|
130
|
+
|
|
131
|
+
// // if (params.screen_params.is_mobile_modal) {
|
|
132
|
+
// // let modal_id = "app_modal-" + params.dsSession.toString();
|
|
133
|
+
// // APP_MODAL_OBJ[modal_id].dismiss().then(async () => {
|
|
134
|
+
// // APP_MODAL_OBJ[modal_id] = null;
|
|
135
|
+
|
|
136
|
+
// // // func.datasource.clean_all(SESSION_ID, params.dsSession);
|
|
137
|
+
// // func.events.delete_job(SESSION_ID, jobNoP);
|
|
138
|
+
// // });
|
|
139
|
+
// // }
|
|
140
|
+
// // if (params.screen_params.is_mobile_popover) {
|
|
141
|
+
// // CURRENT_APP_POPOVER.dismiss().then(async () => {
|
|
142
|
+
// // CURRENT_APP_POPOVER = null;
|
|
143
|
+
|
|
144
|
+
// // // func.datasource.clean_all(SESSION_ID, params.dsSession);
|
|
145
|
+
// // func.events.delete_job(SESSION_ID, jobNoP);
|
|
146
|
+
// // });
|
|
147
|
+
// // }
|
|
148
|
+
// // if (params.screen_params.is_mobile_page) {
|
|
149
|
+
// // var nav = $(SESSION_OBJ[SESSION_ID].root_element).find("xu-nav")[0];
|
|
150
|
+
// // nav.popToRoot();
|
|
151
|
+
|
|
152
|
+
// // var ds_obj = $(nav).data().xuData.nav_params;
|
|
153
|
+
|
|
154
|
+
// // // $.each(ds_obj, function (key, val) {
|
|
155
|
+
// // // func.datasource.clean_all(SESSION_ID, key);
|
|
156
|
+
// // // });
|
|
157
|
+
|
|
158
|
+
// // // var interval = setInterval(function () {
|
|
159
|
+
// // // if (!validate_pending_ds_jobs()) {
|
|
160
|
+
// // // setTimeout(function () {
|
|
161
|
+
// // // func.datasource.del(SESSION_ID, params.dsSession);
|
|
162
|
+
// // // // clean after screen is closing but causing a bug when interval is low
|
|
163
|
+
// // // }, 10000);
|
|
164
|
+
// // // clearInterval(interval);
|
|
165
|
+
// // // }
|
|
166
|
+
// // // }, 2000);
|
|
167
|
+
// // }
|
|
168
|
+
// },
|
|
197
169
|
act_reload: async function () {
|
|
198
170
|
var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[params.dsSession];
|
|
199
171
|
|
|
200
172
|
let screen_params = _.cloneDeep(params.screen_params);
|
|
201
173
|
|
|
202
174
|
switch (params.screen_params.screen_type) {
|
|
203
|
-
case
|
|
175
|
+
case 'modal':
|
|
204
176
|
debugger;
|
|
205
177
|
break;
|
|
206
178
|
|
|
207
|
-
case
|
|
179
|
+
case 'popover':
|
|
208
180
|
debugger;
|
|
209
181
|
break;
|
|
210
182
|
|
|
211
|
-
case
|
|
183
|
+
case 'panel':
|
|
212
184
|
func.UI.screen.refresh_screen(SESSION_ID, null, params.dsSession);
|
|
213
185
|
func.events.delete_job(SESSION_ID, jobNoP);
|
|
214
186
|
|
|
215
187
|
break;
|
|
216
188
|
|
|
217
|
-
case
|
|
218
|
-
let nav = $(SESSION_OBJ[SESSION_ID].root_element).find(
|
|
189
|
+
case 'page':
|
|
190
|
+
let nav = $(SESSION_OBJ[SESSION_ID].root_element).find('xu-nav')[0];
|
|
219
191
|
nav.popTo();
|
|
220
192
|
break;
|
|
221
193
|
|
|
@@ -235,55 +207,25 @@ export const action_execute = async function (
|
|
|
235
207
|
null,
|
|
236
208
|
params.screen_params.is_panelP,
|
|
237
209
|
params.screen_params.parameters_obj_inP,
|
|
238
|
-
params.screen_params.source_functionP
|
|
210
|
+
params.screen_params.source_functionP,
|
|
239
211
|
);
|
|
240
212
|
},
|
|
241
|
-
act_back: async function () {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
},
|
|
247
|
-
|
|
213
|
+
// act_back: async function () {
|
|
214
|
+
// if (params.screen_params.is_mobile_page) {
|
|
215
|
+
// var nav = $(SESSION_OBJ[SESSION_ID].root_element).find('xu-nav')[0];
|
|
216
|
+
// nav.popTo();
|
|
217
|
+
// }
|
|
218
|
+
// },
|
|
248
219
|
act_print: async function () {
|
|
249
220
|
window.print();
|
|
250
221
|
},
|
|
251
222
|
};
|
|
252
223
|
|
|
253
|
-
if (event_sourceP ===
|
|
254
|
-
await func.events.validate(
|
|
255
|
-
SESSION_ID,
|
|
256
|
-
action + "_clicked",
|
|
257
|
-
params.dsSession,
|
|
258
|
-
null,
|
|
259
|
-
"toolbar"
|
|
260
|
-
);
|
|
224
|
+
if (event_sourceP === 'click') {
|
|
225
|
+
await func.events.validate(SESSION_ID, action + '_clicked', params.dsSession, null, 'toolbar');
|
|
261
226
|
params.event_sourceP = event_sourceP;
|
|
262
227
|
params.isScreenActionP = isScreenActionP;
|
|
263
|
-
await func.events.add_to_queue(
|
|
264
|
-
SESSION_ID,
|
|
265
|
-
params.renderType,
|
|
266
|
-
null,
|
|
267
|
-
event_sourceP,
|
|
268
|
-
"invoke_action",
|
|
269
|
-
action,
|
|
270
|
-
params.udfContainer,
|
|
271
|
-
null,
|
|
272
|
-
null,
|
|
273
|
-
null,
|
|
274
|
-
null,
|
|
275
|
-
params.rootScreenIdP,
|
|
276
|
-
null,
|
|
277
|
-
null,
|
|
278
|
-
null,
|
|
279
|
-
null,
|
|
280
|
-
null,
|
|
281
|
-
"click",
|
|
282
|
-
params,
|
|
283
|
-
null,
|
|
284
|
-
null,
|
|
285
|
-
null
|
|
286
|
-
);
|
|
228
|
+
await func.events.add_to_queue(SESSION_ID, params.renderType, null, event_sourceP, 'invoke_action', action, params.udfContainer, null, null, null, null, params.rootScreenIdP, null, null, null, null, null, 'click', params, null, null, null);
|
|
287
229
|
} else {
|
|
288
230
|
await fx[action]();
|
|
289
231
|
await do_event(action);
|
|
@@ -312,7 +254,7 @@ const locate_record = async function (SESSION_ID, actionP, dsSessionP) {
|
|
|
312
254
|
var len = srr.length;
|
|
313
255
|
const idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
|
|
314
256
|
|
|
315
|
-
if (actionP ===
|
|
257
|
+
if (actionP === 'next') {
|
|
316
258
|
if (idx + 1 < len) {
|
|
317
259
|
new_idx = idx + 1;
|
|
318
260
|
result = arr[new_idx]._ROWID;
|
|
@@ -321,7 +263,7 @@ const locate_record = async function (SESSION_ID, actionP, dsSessionP) {
|
|
|
321
263
|
result = arr[new_idx]._ROWID;
|
|
322
264
|
}
|
|
323
265
|
}
|
|
324
|
-
if (actionP ===
|
|
266
|
+
if (actionP === 'prev') {
|
|
325
267
|
if (idx - 1 > 0) {
|
|
326
268
|
new_idx = idx - 1;
|
|
327
269
|
result = arr[new_idx]._ROWID;
|
|
@@ -330,18 +272,18 @@ const locate_record = async function (SESSION_ID, actionP, dsSessionP) {
|
|
|
330
272
|
result = arr[new_idx]._ROWID;
|
|
331
273
|
}
|
|
332
274
|
}
|
|
333
|
-
if (actionP ===
|
|
275
|
+
if (actionP === 'first') {
|
|
334
276
|
new_idx = 1;
|
|
335
277
|
result = arr[new_idx]._ROWID;
|
|
336
278
|
}
|
|
337
|
-
if (actionP ===
|
|
279
|
+
if (actionP === 'last') {
|
|
338
280
|
new_idx = arr.length - 1;
|
|
339
281
|
result = arr[new_idx]._ROWID;
|
|
340
282
|
}
|
|
341
283
|
// _ds.currentRecordId = result;
|
|
342
284
|
|
|
343
285
|
var datasource_changes = {
|
|
344
|
-
[_ds.dsSession]: { [result]:
|
|
286
|
+
[_ds.dsSession]: { [result]: 'set' },
|
|
345
287
|
};
|
|
346
288
|
await func.datasource.update(SESSION_ID, datasource_changes);
|
|
347
289
|
} catch (err) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const screen_save=async function(SESSION_ID,paramsP){var str='[screenid="'+paramsP.screenId+'"]';var elm=$("#"+paramsP.screenId).find(str);var dsSession;if(!elm||!elm.length){return func.db.save_data(SESSION_ID,paramsP.dsSession,0)}for await(const[key,val]of Object.entries(elm)){if(key==="length"){break}if(!val){continue}dsSession=$(val).data().xuData.dsSession;let _ds=SESSION_OBJ[SESSION_ID].DS_GLB[dsSession];if(!dsSession||!_ds){continue}if(_ds.tree_obj.renderType==="form"){if(_ds._dataSourceTableId){if(!_ds.abort_save)await func.db.save_data(SESSION_ID,dsSession,key);_ds.abort_save=false;continue}}}};export const action_execute=async function(SESSION_ID,actionP,params,isScreenActionP,event_sourceP,jobNoP,containerP){var _ds=SESSION_OBJ[SESSION_ID].DS_GLB[params.dsSession];if(!_ds){func.events.delete_job(SESSION_ID,jobNoP);return}var action=actionP;var formGrid_dsSession;var EVENTSUFFIX="_triggered";if(!isScreenActionP)formGrid_dsSession=params.dsSession;var do_event=async function(actionP){var delete_job=async function(jobsP){await func.events.check_jobs_idle(SESSION_ID,jobsP);func.events.delete_job(SESSION_ID,jobNoP)};const jobsP=await func.events.validate(SESSION_ID,actionP+EVENTSUFFIX,params.dsSession,null,"action");await delete_job(jobsP)};const fx={act_next:async function(){await locate_record(SESSION_ID,"next",params.dsSession);if(_ds.tree_obj.renderType==="form"){$("body").trigger("xu-bind-refresh."+params.dsSession.toString())}},act_prev:async function(){await locate_record(SESSION_ID,"prev",params.dsSession);if(_ds.tree_obj.renderType==="form")$("body").trigger("xu-bind-refresh."+params.dsSession.toString())},act_last:async function(){await locate_record(SESSION_ID,"last",params.dsSession);if(_ds.tree_obj.renderType==="form")$("body").trigger("xu-bind-refresh."+params.dsSession.toString())},act_first:async function(){await locate_record(SESSION_ID,"first",params.dsSession);if(_ds.tree_obj.renderType==="form")$("body").trigger("xu-bind-refresh."+params.dsSession.toString())},act_refresh:async function(sourceP){let screen_params=params.screen_params;await func.datasource.create(SESSION_ID,params.prog_id,params.dsSession,params.parentDataSourceNo,params.containerId,params.rowIdP);let _ds=SESSION_OBJ[SESSION_ID].DS_GLB[params.dsSession];_ds.screen_params=screen_params;func.UI.screen.update_SYS_OBJ_WIN_INFO(SESSION_ID,params.dsSession);$("body").trigger("xu-bind-refresh."+params.dsSession.toString());let prog_obj=await func.utils.VIEWS_OBJ.get(SESSION_ID,_ds.prog_id);let field_changed=[];for(let field of prog_obj?.progFields){field_changed.push(field?.data?.field_id||"")}func.UI.screen.refresh_xu_attributes(SESSION_ID,field_changed)},act_save:async function(){await screen_save(SESSION_ID,params)},
|
|
1
|
+
const screen_save=async function(SESSION_ID,paramsP){var str='[screenid="'+paramsP.screenId+'"]';var elm=$("#"+paramsP.screenId).find(str);var dsSession;if(!elm||!elm.length){return func.db.save_data(SESSION_ID,paramsP.dsSession,0)}for await(const[key,val]of Object.entries(elm)){if(key==="length"){break}if(!val){continue}dsSession=$(val).data().xuData.dsSession;let _ds=SESSION_OBJ[SESSION_ID].DS_GLB[dsSession];if(!dsSession||!_ds){continue}if(_ds.tree_obj.renderType==="form"){if(_ds._dataSourceTableId){if(!_ds.abort_save)await func.db.save_data(SESSION_ID,dsSession,key);_ds.abort_save=false;continue}}}};export const action_execute=async function(SESSION_ID,actionP,params,isScreenActionP,event_sourceP,jobNoP,containerP){var _ds=SESSION_OBJ[SESSION_ID].DS_GLB[params.dsSession];if(!_ds){func.events.delete_job(SESSION_ID,jobNoP);return}var action=actionP;var formGrid_dsSession;var EVENTSUFFIX="_triggered";if(!isScreenActionP)formGrid_dsSession=params.dsSession;var do_event=async function(actionP){var delete_job=async function(jobsP){await func.events.check_jobs_idle(SESSION_ID,jobsP);func.events.delete_job(SESSION_ID,jobNoP)};const jobsP=await func.events.validate(SESSION_ID,actionP+EVENTSUFFIX,params.dsSession,null,"action");await delete_job(jobsP)};const fx={act_next:async function(){await locate_record(SESSION_ID,"next",params.dsSession);if(_ds.tree_obj.renderType==="form"){$("body").trigger("xu-bind-refresh."+params.dsSession.toString())}},act_prev:async function(){await locate_record(SESSION_ID,"prev",params.dsSession);if(_ds.tree_obj.renderType==="form")$("body").trigger("xu-bind-refresh."+params.dsSession.toString())},act_last:async function(){await locate_record(SESSION_ID,"last",params.dsSession);if(_ds.tree_obj.renderType==="form")$("body").trigger("xu-bind-refresh."+params.dsSession.toString())},act_first:async function(){await locate_record(SESSION_ID,"first",params.dsSession);if(_ds.tree_obj.renderType==="form")$("body").trigger("xu-bind-refresh."+params.dsSession.toString())},act_refresh:async function(sourceP){let screen_params=params.screen_params;await func.datasource.create(SESSION_ID,params.prog_id,params.dsSession,params.parentDataSourceNo,params.containerId,params.rowIdP);let _ds=SESSION_OBJ[SESSION_ID].DS_GLB[params.dsSession];_ds.screen_params=screen_params;func.UI.screen.update_SYS_OBJ_WIN_INFO(SESSION_ID,params.dsSession);$("body").trigger("xu-bind-refresh."+params.dsSession.toString());let prog_obj=await func.utils.VIEWS_OBJ.get(SESSION_ID,_ds.prog_id);let field_changed=[];for(let field of prog_obj?.progFields){field_changed.push(field?.data?.field_id||"")}func.UI.screen.refresh_xu_attributes(SESSION_ID,field_changed)},act_save:async function(){await screen_save(SESSION_ID,params)},act_reload:async function(){var _ds=SESSION_OBJ[SESSION_ID].DS_GLB[params.dsSession];let screen_params=_.cloneDeep(params.screen_params);switch(params.screen_params.screen_type){case"modal":debugger;break;case"popover":debugger;break;case"panel":func.UI.screen.refresh_screen(SESSION_ID,null,params.dsSession);func.events.delete_job(SESSION_ID,jobNoP);break;case"page":let nav=$(SESSION_OBJ[SESSION_ID].root_element).find("xu-nav")[0];nav.popTo();break;default:screen_params.$callingContainerP.empty();break}let ret=await func.UI.screen.init(SESSION_ID,params.screen_params.prog_id,params.screen_params.sourceScreenP,params.screen_params.callingDataSource_objP,params.screen_params.$callingContainerP,params.screen_params.triggerIdP,params.screen_params.rowIdP,null,params.screen_params.is_panelP,params.screen_params.parameters_obj_inP,params.screen_params.source_functionP)},act_print:async function(){window.print()}};if(event_sourceP==="click"){await func.events.validate(SESSION_ID,action+"_clicked",params.dsSession,null,"toolbar");params.event_sourceP=event_sourceP;params.isScreenActionP=isScreenActionP;await func.events.add_to_queue(SESSION_ID,params.renderType,null,event_sourceP,"invoke_action",action,params.udfContainer,null,null,null,null,params.rootScreenIdP,null,null,null,null,null,"click",params,null,null,null)}else{await fx[action]();await do_event(action)}};const locate_record=async function(SESSION_ID,actionP,dsSessionP){var arr=[];var result;var _ds=SESSION_OBJ[SESSION_ID].DS_GLB[dsSessionP];var current=_ds.currentRecordId;if(!current)return;var i=1;try{let arr=ds?.data_feed?.rows||[];var len=srr.length;const idx=func.common.find_ROWID_idx(_ds,_ds.currentRecordId);if(actionP==="next"){if(idx+1<len){new_idx=idx+1;result=arr[new_idx]._ROWID}else{new_idx=idx;result=arr[new_idx]._ROWID}}if(actionP==="prev"){if(idx-1>0){new_idx=idx-1;result=arr[new_idx]._ROWID}else{new_idx=idx;result=arr[new_idx]._ROWID}}if(actionP==="first"){new_idx=1;result=arr[new_idx]._ROWID}if(actionP==="last"){new_idx=arr.length-1;result=arr[new_idx]._ROWID}var datasource_changes={[_ds.dsSession]:{[result]:"set"}};await func.datasource.update(SESSION_ID,datasource_changes)}catch(err){console.error(err)}};
|