@xuda.io/xuda-worker-bundle 1.3.2688 → 1.3.2689

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 +16 -45
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -5,49 +5,6 @@ if (typeof IS_DOCKER === 'undefined' || typeof IS_PROCESS_SERVER === 'undefined'
5
5
  var DOCS_OBJ = {};
6
6
  }
7
7
 
8
- // Minimal jQuery shim for plugins that still reference $
9
- if (typeof $ === 'undefined' && typeof document !== 'undefined') {
10
- var $ = function (selector) {
11
- var nodes = typeof selector === 'string'
12
- ? Array.from(document.querySelectorAll(selector))
13
- : selector?.nodeType ? [selector] : (selector?.length ? Array.from(selector) : []);
14
- var obj = {
15
- 0: nodes[0], length: nodes.length,
16
- toArray: function () { return nodes.slice(); },
17
- find: function (s) { var r = []; for (var i = 0; i < nodes.length; i++) { r.push.apply(r, Array.from(nodes[i].querySelectorAll(s))); } return $(r); },
18
- each: function (fn) { for (var i = 0; i < nodes.length; i++) { fn.call(nodes[i], i, nodes[i]); } return obj; },
19
- on: function (ev, fn) { for (var i = 0; i < nodes.length; i++) nodes[i].addEventListener(ev, fn); return obj; },
20
- off: function (ev, fn) { for (var i = 0; i < nodes.length; i++) nodes[i].removeEventListener(ev, fn); return obj; },
21
- addClass: function (c) { for (var i = 0; i < nodes.length; i++) nodes[i].classList?.add(c); return obj; },
22
- removeClass: function (c) { for (var i = 0; i < nodes.length; i++) nodes[i].classList?.remove(c); return obj; },
23
- hasClass: function (c) { return nodes[0]?.classList?.contains(c) || false; },
24
- attr: function (k, v) { if (typeof v === 'undefined') return nodes[0]?.getAttribute(k); for (var i = 0; i < nodes.length; i++) nodes[i].setAttribute(k, v); return obj; },
25
- css: function (k, v) { for (var i = 0; i < nodes.length; i++) nodes[i].style[k] = v; return obj; },
26
- data: function () { return nodes[0]?.__xuData || (nodes[0] ? (nodes[0].__xuData = {}) : {}); },
27
- val: function (v) { if (typeof v === 'undefined') return nodes[0]?.value; for (var i = 0; i < nodes.length; i++) nodes[i].value = v; return obj; },
28
- html: function (v) { if (typeof v === 'undefined') return nodes[0]?.innerHTML; for (var i = 0; i < nodes.length; i++) nodes[i].innerHTML = v; return obj; },
29
- text: function (v) { if (typeof v === 'undefined') return nodes[0]?.textContent; for (var i = 0; i < nodes.length; i++) nodes[i].textContent = v; return obj; },
30
- show: function () { for (var i = 0; i < nodes.length; i++) nodes[i].style.display = ''; return obj; },
31
- hide: function () { for (var i = 0; i < nodes.length; i++) nodes[i].style.display = 'none'; return obj; },
32
- remove: function () { for (var i = 0; i < nodes.length; i++) nodes[i].remove?.(); return obj; },
33
- empty: function () { for (var i = 0; i < nodes.length; i++) nodes[i].innerHTML = ''; return obj; },
34
- append: function (c) { var n = c?.nodeType ? c : c?.[0]; if (n && nodes[0]) nodes[0].appendChild(n); return obj; },
35
- parent: function () { return $(nodes[0]?.parentElement ? [nodes[0].parentElement] : []); },
36
- children: function () { return $(nodes[0] ? Array.from(nodes[0].children) : []); },
37
- trigger: function (ev, d) { for (var i = 0; i < nodes.length; i++) nodes[i].dispatchEvent(new CustomEvent(ev, { detail: d })); return obj; },
38
- is: function (s) { return nodes[0]?.matches?.(s) || false; },
39
- prop: function (k, v) { if (typeof v === 'undefined') return nodes[0]?.[k]; for (var i = 0; i < nodes.length; i++) nodes[i][k] = v; return obj; },
40
- unbind: function () { return obj; },
41
- clone: function () { return $(nodes[0]?.cloneNode(true) ? [nodes[0].cloneNode(true)] : []); },
42
- };
43
- obj[Symbol.iterator] = function () { var i = 0; return { next: function () { return i < nodes.length ? { value: nodes[i++], done: false } : { done: true }; } }; };
44
- return obj;
45
- };
46
- $.each = function (o, fn) { if (Array.isArray(o)) { for (var i = 0; i < o.length; i++) fn(i, o[i]); } else { Object.keys(o || {}).forEach(function (k) { fn(k, o[k]); }); } };
47
- $.cookie = function () { return null; };
48
- var jQuery = $;
49
- }
50
-
51
8
  var glb = {};
52
9
  var func = {};
53
10
  func.UI = {};
@@ -1219,7 +1176,7 @@ func.runtime.widgets.load_runtime_css = async function (context) {
1219
1176
  func.utils.load_css_on_demand(plugin_runtime_css_url);
1220
1177
  return true;
1221
1178
  };
1222
- func.runtime.widgets.build_params = function (context, $containerP, plugin_setup, api_utils, extra = {}) {
1179
+ func.runtime.widgets.build_params = function (context, container_node, container_data, plugin_setup, api_utils, extra = {}) {
1223
1180
  return {
1224
1181
  SESSION_ID: context.SESSION_ID,
1225
1182
  method: context.method,
@@ -1228,14 +1185,28 @@ func.runtime.widgets.build_params = function (context, $containerP, plugin_setup
1228
1185
  sourceP: context.sourceP,
1229
1186
  propsP: context.propsP,
1230
1187
  plugin_name: context.plugin_name,
1231
- $containerP,
1188
+ container_node,
1189
+ container_data,
1232
1190
  plugin_setup,
1233
1191
  report_error: function (descP, warn) {
1234
1192
  return func.runtime.widgets.report_error(context, descP, warn);
1235
1193
  },
1194
+ log_error: function (descP, warn) {
1195
+ return func.runtime.widgets.report_error(context, descP, warn);
1196
+ },
1236
1197
  call_plugin_api: async function (plugin_nameP, dataP) {
1237
1198
  return await func.utils.call_plugin_api(context.SESSION_ID, plugin_nameP, dataP);
1238
1199
  },
1200
+ set_SYS_GLOBAL_OBJ_WIDGET_INFO: async function (docP) {
1201
+ return await func.utils.set_SYS_GLOBAL_OBJ_WIDGET_INFO(context.SESSION_ID, docP);
1202
+ },
1203
+ run_widgetCallbackEvent: async function () {
1204
+ const event_id = context.propsP?.widgetCallbackEvent;
1205
+ if (!event_id || !api_utils?.invoke_event) {
1206
+ return false;
1207
+ }
1208
+ return await api_utils.invoke_event(event_id);
1209
+ },
1239
1210
  api_utils,
1240
1211
  ...extra,
1241
1212
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/xuda-worker-bundle",
3
- "version": "1.3.2688",
3
+ "version": "1.3.2689",
4
4
  "description": "xuda framework",
5
5
  "main": "index.js",
6
6
  "scripts": {