@xuda.io/runtime-bundle 1.0.1422 → 1.0.1423
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 +160 -3
- package/js/xuda-runtime-bundle.min.js +3 -3
- package/js/xuda-runtime-slim.js +160 -3
- package/js/xuda-runtime-slim.min.es.js +160 -3
- package/js/xuda-runtime-slim.min.js +3 -3
- package/js/xuda-server-bundle.min.mjs +1 -1
- package/js/xuda-server-bundle.mjs +136 -0
- package/js/xuda-worker-bundle.js +136 -0
- package/js/xuda-worker-bundle.min.js +1 -1
- package/js/xuda_common-bundle.js +136 -0
- package/js/xuda_common-bundle.min.js +1 -1
- package/package.json +1 -1
|
@@ -23915,6 +23915,13 @@ func.runtime.session.create_state = function (SESSION_ID, options) {
|
|
|
23915
23915
|
func.runtime.workers.ensure_registry(SESSION_ID);
|
|
23916
23916
|
return SESSION_OBJ[SESSION_ID];
|
|
23917
23917
|
};
|
|
23918
|
+
func.runtime.session.is_slim = function (SESSION_ID) {
|
|
23919
|
+
const session = typeof SESSION_ID === 'undefined' || SESSION_ID === null ? null : SESSION_OBJ?.[SESSION_ID];
|
|
23920
|
+
if (session && typeof session.SLIM_BUNDLE !== 'undefined') {
|
|
23921
|
+
return !!session.SLIM_BUNDLE;
|
|
23922
|
+
}
|
|
23923
|
+
return !!glb.SLIM_BUNDLE;
|
|
23924
|
+
};
|
|
23918
23925
|
func.runtime.session.set_default_value = function (_session, key, value) {
|
|
23919
23926
|
_session[key] = value || func.runtime.env.get_default_session_value(key);
|
|
23920
23927
|
return _session[key];
|
|
@@ -24166,6 +24173,135 @@ func.runtime.bind.build_datasource_changes = function (dsSessionP, currentRecord
|
|
|
24166
24173
|
},
|
|
24167
24174
|
};
|
|
24168
24175
|
};
|
|
24176
|
+
func.runtime.bind.get_native_adapter = function () {
|
|
24177
|
+
const has_explicit_value = function (elm) {
|
|
24178
|
+
return !!elm?.hasAttribute?.('value');
|
|
24179
|
+
};
|
|
24180
|
+
const get_listener_event = function (elm) {
|
|
24181
|
+
const tag_name = elm?.tagName?.toLowerCase?.();
|
|
24182
|
+
const type = (elm?.type || '').toLowerCase();
|
|
24183
|
+
|
|
24184
|
+
if (tag_name === 'select' || ['checkbox', 'radio'].includes(type)) {
|
|
24185
|
+
return 'change';
|
|
24186
|
+
}
|
|
24187
|
+
return 'input';
|
|
24188
|
+
};
|
|
24189
|
+
|
|
24190
|
+
return {
|
|
24191
|
+
getter: function (elm) {
|
|
24192
|
+
if (!elm) {
|
|
24193
|
+
return undefined;
|
|
24194
|
+
}
|
|
24195
|
+
|
|
24196
|
+
const tag_name = elm?.tagName?.toLowerCase?.();
|
|
24197
|
+
const type = (elm?.type || '').toLowerCase();
|
|
24198
|
+
|
|
24199
|
+
if (tag_name === 'select' && elm.multiple) {
|
|
24200
|
+
return Array.from(elm.options || [])
|
|
24201
|
+
.filter(function (option) {
|
|
24202
|
+
return option.selected;
|
|
24203
|
+
})
|
|
24204
|
+
.map(function (option) {
|
|
24205
|
+
return option.value;
|
|
24206
|
+
});
|
|
24207
|
+
}
|
|
24208
|
+
|
|
24209
|
+
if (type === 'checkbox') {
|
|
24210
|
+
return has_explicit_value(elm) ? elm.value : !!elm.checked;
|
|
24211
|
+
}
|
|
24212
|
+
|
|
24213
|
+
if (type === 'radio') {
|
|
24214
|
+
return elm.value;
|
|
24215
|
+
}
|
|
24216
|
+
|
|
24217
|
+
return typeof elm.value !== 'undefined' ? elm.value : undefined;
|
|
24218
|
+
},
|
|
24219
|
+
setter: function (elm, value) {
|
|
24220
|
+
if (!elm) {
|
|
24221
|
+
return false;
|
|
24222
|
+
}
|
|
24223
|
+
|
|
24224
|
+
const tag_name = elm?.tagName?.toLowerCase?.();
|
|
24225
|
+
const type = (elm?.type || '').toLowerCase();
|
|
24226
|
+
|
|
24227
|
+
if (tag_name === 'select' && elm.multiple) {
|
|
24228
|
+
const selected_values = Array.isArray(value)
|
|
24229
|
+
? value.map(function (item) {
|
|
24230
|
+
return String(item);
|
|
24231
|
+
})
|
|
24232
|
+
: [String(value)];
|
|
24233
|
+
Array.from(elm.options || []).forEach(function (option) {
|
|
24234
|
+
option.selected = selected_values.includes(String(option.value));
|
|
24235
|
+
});
|
|
24236
|
+
return true;
|
|
24237
|
+
}
|
|
24238
|
+
|
|
24239
|
+
if (type === 'checkbox' || type === 'radio') {
|
|
24240
|
+
return true;
|
|
24241
|
+
}
|
|
24242
|
+
|
|
24243
|
+
if (typeof elm.value !== 'undefined') {
|
|
24244
|
+
elm.value = value === null || typeof value === 'undefined' ? '' : String(value);
|
|
24245
|
+
}
|
|
24246
|
+
return true;
|
|
24247
|
+
},
|
|
24248
|
+
listener: function (elm, handler) {
|
|
24249
|
+
if (!elm?.addEventListener || typeof handler !== 'function') {
|
|
24250
|
+
return false;
|
|
24251
|
+
}
|
|
24252
|
+
|
|
24253
|
+
const event_name = get_listener_event(elm);
|
|
24254
|
+
const listener_key = '__xuda_native_bind_listener_' + event_name;
|
|
24255
|
+
if (elm[listener_key]) {
|
|
24256
|
+
elm.removeEventListener(event_name, elm[listener_key]);
|
|
24257
|
+
}
|
|
24258
|
+
elm.addEventListener(event_name, handler);
|
|
24259
|
+
elm[listener_key] = handler;
|
|
24260
|
+
return true;
|
|
24261
|
+
},
|
|
24262
|
+
};
|
|
24263
|
+
};
|
|
24264
|
+
func.runtime.bind.is_valid_adapter = function (adapter) {
|
|
24265
|
+
return !!(
|
|
24266
|
+
adapter &&
|
|
24267
|
+
typeof adapter.getter === 'function' &&
|
|
24268
|
+
typeof adapter.setter === 'function' &&
|
|
24269
|
+
typeof adapter.listener === 'function'
|
|
24270
|
+
);
|
|
24271
|
+
};
|
|
24272
|
+
func.runtime.bind.get_adapter = function (SESSION_ID) {
|
|
24273
|
+
const native_adapter = func.runtime.bind.get_native_adapter();
|
|
24274
|
+
if (func.runtime.session.is_slim(SESSION_ID)) {
|
|
24275
|
+
return native_adapter;
|
|
24276
|
+
}
|
|
24277
|
+
|
|
24278
|
+
const plugin_bind = UI_FRAMEWORK_PLUGIN?.bind;
|
|
24279
|
+
if (!plugin_bind) {
|
|
24280
|
+
return native_adapter;
|
|
24281
|
+
}
|
|
24282
|
+
|
|
24283
|
+
if (func.runtime.bind.is_valid_adapter(plugin_bind)) {
|
|
24284
|
+
return plugin_bind;
|
|
24285
|
+
}
|
|
24286
|
+
|
|
24287
|
+
if (typeof plugin_bind === 'function') {
|
|
24288
|
+
try {
|
|
24289
|
+
const bind_instance = new plugin_bind();
|
|
24290
|
+
if (func.runtime.bind.is_valid_adapter(bind_instance)) {
|
|
24291
|
+
return bind_instance;
|
|
24292
|
+
}
|
|
24293
|
+
} catch (error) {}
|
|
24294
|
+
|
|
24295
|
+
try {
|
|
24296
|
+
const bind_factory = plugin_bind();
|
|
24297
|
+
if (func.runtime.bind.is_valid_adapter(bind_factory)) {
|
|
24298
|
+
return bind_factory;
|
|
24299
|
+
}
|
|
24300
|
+
} catch (error) {}
|
|
24301
|
+
}
|
|
24302
|
+
|
|
24303
|
+
return native_adapter;
|
|
24304
|
+
};
|
|
24169
24305
|
func.runtime.bind.resolve_field = async function (SESSION_ID, prog_id, dsSessionP, field_id, iterate_info) {
|
|
24170
24306
|
let _prog_id = prog_id;
|
|
24171
24307
|
let _dsP = dsSessionP;
|
|
@@ -27938,7 +28074,10 @@ func.runtime.ui.find_in_root = function (SESSION_ID, selector) {
|
|
|
27938
28074
|
};
|
|
27939
28075
|
func.runtime.ui.get_root_tag_name = function () {
|
|
27940
28076
|
let root_tag_name = 'div';
|
|
27941
|
-
if (
|
|
28077
|
+
if (!func.runtime.session.is_slim()) {
|
|
28078
|
+
if (typeof UI_FRAMEWORK_PLUGIN?.core !== 'function') {
|
|
28079
|
+
return root_tag_name;
|
|
28080
|
+
}
|
|
27942
28081
|
const ui_plugin_core = new UI_FRAMEWORK_PLUGIN.core();
|
|
27943
28082
|
root_tag_name = ui_plugin_core?.rootTagName() || root_tag_name;
|
|
27944
28083
|
}
|
|
@@ -31765,6 +31904,12 @@ func.runtime.ui.close_modal_session = async function (SESSION_ID, modal_id) {
|
|
|
31765
31904
|
func.runtime.ui.render_screen_type = async function (options) {
|
|
31766
31905
|
const $div_content = func.runtime.ui.get_children(options.$div);
|
|
31767
31906
|
func.runtime.ui.sync_child_parent_container(options.$div);
|
|
31907
|
+
const assert_framework_screen_supported = function (screen_type) {
|
|
31908
|
+
if (!func.runtime.session.is_slim(options.SESSION_ID)) {
|
|
31909
|
+
return;
|
|
31910
|
+
}
|
|
31911
|
+
throw new Error('Slim mode does not support "' + screen_type + '" screens without a UI framework plugin');
|
|
31912
|
+
};
|
|
31768
31913
|
|
|
31769
31914
|
let $ret = options.$div;
|
|
31770
31915
|
let $nav = func.runtime.ui.get_nav(options.SESSION_ID);
|
|
@@ -31772,6 +31917,7 @@ func.runtime.ui.render_screen_type = async function (options) {
|
|
|
31772
31917
|
|
|
31773
31918
|
switch (options.paramsP.screen_type) {
|
|
31774
31919
|
case 'modal': {
|
|
31920
|
+
assert_framework_screen_supported('modal');
|
|
31775
31921
|
params = func.runtime.ui.build_modal_params(options.paramsP, options.$div, options.$container, options.close_modal);
|
|
31776
31922
|
const modal_id = params.modal_id;
|
|
31777
31923
|
func.runtime.ui.set_modal_params(options.SESSION_ID, modal_id, params);
|
|
@@ -31788,6 +31934,7 @@ func.runtime.ui.render_screen_type = async function (options) {
|
|
|
31788
31934
|
}
|
|
31789
31935
|
|
|
31790
31936
|
case 'popover': {
|
|
31937
|
+
assert_framework_screen_supported('popover');
|
|
31791
31938
|
const xu_popover_controller = func.UI.component.create_app_popover_component(options.SESSION_ID);
|
|
31792
31939
|
params = func.runtime.ui.build_popover_params(options.paramsP, options.$div, options.$container);
|
|
31793
31940
|
|
|
@@ -31802,6 +31949,7 @@ func.runtime.ui.render_screen_type = async function (options) {
|
|
|
31802
31949
|
}
|
|
31803
31950
|
|
|
31804
31951
|
case 'page': {
|
|
31952
|
+
assert_framework_screen_supported('page');
|
|
31805
31953
|
const nav = func.runtime.ui.get_first_node($nav);
|
|
31806
31954
|
|
|
31807
31955
|
params = func.runtime.ui.build_page_params(options.SESSION_ID, options.paramsP, $div_content, options.$container, nav);
|
|
@@ -36405,7 +36553,7 @@ func.runtime.render.handle_xu_bind = async function (options) {
|
|
|
36405
36553
|
return {};
|
|
36406
36554
|
}
|
|
36407
36555
|
|
|
36408
|
-
const bind =
|
|
36556
|
+
const bind = func.runtime.bind.get_adapter(options.SESSION_ID);
|
|
36409
36557
|
const field_changed = async function () {
|
|
36410
36558
|
const _ds = SESSION_OBJ[options.SESSION_ID].DS_GLB[_dsP];
|
|
36411
36559
|
const field_type = func.runtime.bind.get_field_type(field_prop);
|
|
@@ -44845,13 +44993,22 @@ func.index.call_worker = async function (SESSION_ID, obj, params, promiseP) {
|
|
|
44845
44993
|
};
|
|
44846
44994
|
|
|
44847
44995
|
func.index.init_SCREEN_BLOCKER = async function (SESSION_ID) {
|
|
44996
|
+
const get_loader = async function () {
|
|
44997
|
+
if (func.runtime.session.is_slim(SESSION_ID) || typeof UI_FRAMEWORK_PLUGIN?.loader !== 'function') {
|
|
44998
|
+
return {
|
|
44999
|
+
dismiss: function () {},
|
|
45000
|
+
};
|
|
45001
|
+
}
|
|
45002
|
+
return await UI_FRAMEWORK_PLUGIN.loader(LOADER_TEXT);
|
|
45003
|
+
};
|
|
45004
|
+
|
|
44848
45005
|
setInterval(async function () {
|
|
44849
45006
|
if (glb.CURRENT_APP_LOADING || (!LOADER_ACTIVE && xu_isEmpty(SCREEN_BLOCKER_OBJ))) {
|
|
44850
45007
|
return;
|
|
44851
45008
|
}
|
|
44852
45009
|
glb.CURRENT_APP_LOADING = 1;
|
|
44853
45010
|
|
|
44854
|
-
const loader = await
|
|
45011
|
+
const loader = await get_loader();
|
|
44855
45012
|
|
|
44856
45013
|
glb.CURRENT_APP_LOADING = loader;
|
|
44857
45014
|
|