@xuda.io/runtime-bundle 1.0.921 → 1.0.923
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-studio-doc-utils.min.mjs +1 -0
- package/js/modules/xuda-studio-doc-utils.mjs +105 -0
- package/js/xuda-runtime-bundle.js +12 -8
- package/js/xuda-runtime-bundle.min.js +1 -1
- package/js/xuda-runtime-slim.js +12 -8
- package/js/xuda-runtime-slim.min.es.js +12 -8
- package/js/xuda-runtime-slim.min.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const new_node_id=(type,app_id)=>{var last12uuid=crypto.randomUUID().split("-")[4];if(type){var menuAbbreviated=abbreviate(type.replaceAll("_",""));return`${app_id.substr(app_id.length-3)}_${menuAbbreviated}_${last12uuid}`}return app_id.substr(app_id.length-3)+"_"+last12uuid};export const createDoc=function({_id,uid,checkedInUserName,app_id,parentId,properties,studio_meta={},minimal=false}={}){if(!_id){_id=new_node_id(properties.menuType,app_id)}var doc={_id:_id,stat:3,docType:"studio",docDate:Date.now(),ts:Date.now(),order_ts:Date.now(),studio_meta:{...{created:Date.now(),createdByUid:uid,checkedInUserId:uid,checkedInUserName:checkedInUserName,parentId:parentId||properties.menuType},...studio_meta},properties:properties||{}};if(minimal)return doc;if(properties?.menuType){switch(properties.menuType){case"table":if(!doc.tableIndexes)doc.tableIndexes=[];if(!doc.tableFields)doc.tableFields=[];break;case"alert":if(!doc.alertData)doc.alertData={};break;case"javascript":if(!doc.scriptData)doc.scriptData={};break;case"folder":break;case"route":if(!doc.routeMenu)doc.routeMenu={};break;case"api":if(!doc.scriptData)doc.scriptData={};case"component":if(!doc.progUi)doc.progUi=[{id:"root",type:"element",tagName:properties.renderType==="form"?"xu-single-view":"xu-multi-view",attributes:{},children:[]}];default:if(!doc.progDataSource)doc.progDataSource={dataSourceType:""};if(!doc.progFields)doc.progFields=[];if(!doc.progEvents)doc.progEvents=[];break}}return doc};const abbreviate=word=>{if(word.length<=3){return word}let abbreviation=word[0];const vowels="aeiou";for(let i=1;i<word.length&&abbreviation.length<3;i++){if(!vowels.includes(word[i].toLowerCase())){abbreviation+=word[i]}}if(abbreviation.length<3){abbreviation=word.substring(0,3)}return abbreviation};export const valid_menuType=["globals","table","get_data","set_data","batch","alert","javascript","folder","route","api","component"];
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
const new_node_id = (type, app_id) => {
|
|
2
|
+
var last12uuid = crypto.randomUUID().split('-')[4];
|
|
3
|
+
|
|
4
|
+
if (type) {
|
|
5
|
+
var menuAbbreviated = abbreviate(type.replaceAll('_', ''));
|
|
6
|
+
return `${app_id.substr(app_id.length - 3)}_${menuAbbreviated}_${last12uuid}`;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
return app_id.substr(app_id.length - 3) + '_' + last12uuid;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const createDoc = function ({ _id, uid, checkedInUserName, app_id, parentId, properties, studio_meta = {}, minimal = false } = {}) {
|
|
13
|
+
if (!_id) {
|
|
14
|
+
_id = new_node_id(properties.menuType, app_id);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
var doc = {
|
|
18
|
+
_id,
|
|
19
|
+
stat: 3,
|
|
20
|
+
docType: 'studio',
|
|
21
|
+
docDate: Date.now(),
|
|
22
|
+
ts: Date.now(),
|
|
23
|
+
order_ts: Date.now(),
|
|
24
|
+
studio_meta: {
|
|
25
|
+
...{
|
|
26
|
+
created: Date.now(),
|
|
27
|
+
createdByUid: uid,
|
|
28
|
+
checkedInUserId: uid,
|
|
29
|
+
checkedInUserName,
|
|
30
|
+
parentId: parentId || properties.menuType,
|
|
31
|
+
},
|
|
32
|
+
...studio_meta,
|
|
33
|
+
},
|
|
34
|
+
properties: properties || {},
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
if (minimal) return doc;
|
|
38
|
+
|
|
39
|
+
if (properties?.menuType) {
|
|
40
|
+
switch (properties.menuType) {
|
|
41
|
+
case 'table':
|
|
42
|
+
if (!doc.tableIndexes) doc.tableIndexes = [];
|
|
43
|
+
if (!doc.tableFields) doc.tableFields = [];
|
|
44
|
+
break;
|
|
45
|
+
|
|
46
|
+
case 'alert':
|
|
47
|
+
if (!doc.alertData) doc.alertData = {};
|
|
48
|
+
break;
|
|
49
|
+
|
|
50
|
+
case 'javascript':
|
|
51
|
+
if (!doc.scriptData) doc.scriptData = {};
|
|
52
|
+
break;
|
|
53
|
+
|
|
54
|
+
case 'folder':
|
|
55
|
+
break;
|
|
56
|
+
|
|
57
|
+
case 'route':
|
|
58
|
+
if (!doc.routeMenu) doc.routeMenu = {};
|
|
59
|
+
break;
|
|
60
|
+
case 'api':
|
|
61
|
+
if (!doc.scriptData) doc.scriptData = {};
|
|
62
|
+
|
|
63
|
+
case 'component':
|
|
64
|
+
if (!doc.progUi) doc.progUi = [{ id: 'root', type: 'element', tagName: properties.renderType === 'form' ? 'xu-single-view' : 'xu-multi-view', attributes: {}, children: [] }];
|
|
65
|
+
|
|
66
|
+
default:
|
|
67
|
+
//get_data, set_data, batch
|
|
68
|
+
if (!doc.progDataSource)
|
|
69
|
+
doc.progDataSource = {
|
|
70
|
+
dataSourceType: '',
|
|
71
|
+
};
|
|
72
|
+
if (!doc.progFields) doc.progFields = [];
|
|
73
|
+
if (!doc.progEvents) doc.progEvents = [];
|
|
74
|
+
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return doc;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const abbreviate = (word) => {
|
|
83
|
+
if (word.length <= 3) {
|
|
84
|
+
return word;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Remove vowels except the first letter
|
|
88
|
+
let abbreviation = word[0];
|
|
89
|
+
const vowels = 'aeiou';
|
|
90
|
+
|
|
91
|
+
for (let i = 1; i < word.length && abbreviation.length < 3; i++) {
|
|
92
|
+
if (!vowels.includes(word[i].toLowerCase())) {
|
|
93
|
+
abbreviation += word[i];
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// If the abbreviation is still less than 3 letters, pad it with the remaining letters
|
|
98
|
+
if (abbreviation.length < 3) {
|
|
99
|
+
abbreviation = word.substring(0, 3);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return abbreviation;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export const valid_menuType = ['globals', 'table', 'get_data', 'set_data', 'batch', 'alert', 'javascript', 'folder', 'route', 'api', 'component'];
|
|
@@ -34096,6 +34096,10 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
|
|
|
34096
34096
|
},
|
|
34097
34097
|
);
|
|
34098
34098
|
|
|
34099
|
+
$div.on('click contextmenu', function (e) {
|
|
34100
|
+
hover_in($div, e);
|
|
34101
|
+
});
|
|
34102
|
+
|
|
34099
34103
|
let ret = await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $div, true);
|
|
34100
34104
|
if (ret.abort || nodeP.tagName === 'svg' || !_.isEmpty(nodeP?.attributes?.['xu-text']) || !_.isEmpty(nodeP?.attributes?.['xu-html']) || !_.isEmpty(nodeP?.attributes?.['xu-exp:xu-text']) || !_.isEmpty(nodeP?.attributes?.['xu-exp:xu-html'])) return await done();
|
|
34101
34105
|
// check if iterator made to prevent children render
|
|
@@ -34161,14 +34165,14 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
|
|
|
34161
34165
|
return;
|
|
34162
34166
|
}
|
|
34163
34167
|
|
|
34164
|
-
if (UI_WORKER_OBJ.cache[$div.attr('xu-ui-id')]) {
|
|
34165
|
-
|
|
34166
|
-
|
|
34167
|
-
|
|
34168
|
-
} else {
|
|
34169
|
-
|
|
34170
|
-
|
|
34171
|
-
}
|
|
34168
|
+
// if (UI_WORKER_OBJ.cache[$div.attr('xu-ui-id')]) {
|
|
34169
|
+
// $div[0].style.removeProperty('height');
|
|
34170
|
+
// $div.removeClass('skeleton');
|
|
34171
|
+
// $div.html(UI_WORKER_OBJ.cache[$div.attr('xu-ui-id')]);
|
|
34172
|
+
// } else {
|
|
34173
|
+
hover_in($div);
|
|
34174
|
+
ui_job_id = func.UI.worker.add_to_queue(SESSION_ID, 'gui event', 'render_viewport', { $div, nodeP, parent_infoP, $root_container, paramsP, jobNoP, is_skeleton, keyP, refreshed_ds, parent_nodeP, check_existP, $container }, null, null, paramsP.dsSessionP);
|
|
34175
|
+
// }
|
|
34172
34176
|
observer_outViewport.observe($div[0]);
|
|
34173
34177
|
});
|
|
34174
34178
|
|