@xuda.io/runtime-bundle 1.0.1276 → 1.0.1278
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 -1
- package/js/modules/xuda-studio-doc-utils.mjs +6 -6
- package/js/xuda-runtime-bundle.js +51 -1
- package/js/xuda-runtime-bundle.min.js +1 -1
- package/js/xuda-runtime-slim.js +51 -1
- package/js/xuda-runtime-slim.min.es.js +51 -1
- package/js/xuda-runtime-slim.min.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const new_node_id=(type,app_id)=>{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};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,
|
|
1
|
+
const new_node_id=(type,app_id)=>{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};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)}const t=Date.now();var doc={_id:_id,stat:3,app_id:app_id,docType:"studio",docDate:t,ts:t,order_ts:t,studio_meta:{...{created:t,createdByUid:uid,checkedInUserId:uid,checkedInUserName:checkedInUserName,parentId:parentId||properties.menuType==="globals"?"globals":properties.menuType==="table"?"database":properties.menuType==="route"?"routes":"programs"},...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"ai_agent":if(!doc.agentConfig)doc.agentConfig={};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:doc?.properties?.renderType!=="form"?"xu-multi-view":"xu-single-view",attributes:{},children:[]}];default:if(!doc.progDataSource)doc.progDataSource={dataSourceType:""};if(!doc.progFields)doc.progFields=[];if(!doc.progEvents)doc.progEvents=[];break}}return doc};export const valid_menuType=["globals","table","get_data","set_data","batch","alert","javascript","folder","route","api","component","ai_agent"];
|
|
@@ -32,22 +32,22 @@ const new_node_id = (type, app_id) => {
|
|
|
32
32
|
return app_id.substr(app_id.length - 3) + '_' + last12uuid;
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
-
export const createDoc = function ({ _id, uid,
|
|
35
|
+
export const createDoc = function ({ _id, uid, checkedInUserName, app_id, parentId, properties, studio_meta = {}, minimal = false } = {}) {
|
|
36
36
|
if (!_id) {
|
|
37
37
|
_id = new_node_id(properties.menuType, app_id);
|
|
38
38
|
}
|
|
39
|
-
|
|
39
|
+
const t = Date.now();
|
|
40
40
|
var doc = {
|
|
41
41
|
_id,
|
|
42
42
|
stat: 3,
|
|
43
43
|
app_id,
|
|
44
44
|
docType: 'studio',
|
|
45
|
-
docDate:
|
|
46
|
-
ts:
|
|
47
|
-
order_ts:
|
|
45
|
+
docDate: t,
|
|
46
|
+
ts: t,
|
|
47
|
+
order_ts: t,
|
|
48
48
|
studio_meta: {
|
|
49
49
|
...{
|
|
50
|
-
created:
|
|
50
|
+
created: t,
|
|
51
51
|
createdByUid: uid,
|
|
52
52
|
checkedInUserId: uid,
|
|
53
53
|
checkedInUserName,
|
|
@@ -27848,6 +27848,8 @@ func.UI.worker.execute = async function (SESSION_ID, queue_obj) {
|
|
|
27848
27848
|
var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[queue_obj.dsSession];
|
|
27849
27849
|
_ds.currentRecordId = currentRecordId || queue_obj.paramsP.currentRecordId;
|
|
27850
27850
|
|
|
27851
|
+
console.info(queue_obj.dsSession, _ds.currentRecordId);
|
|
27852
|
+
|
|
27851
27853
|
var datasource_changes = {
|
|
27852
27854
|
[_ds.dsSession]: { [_ds.currentRecordId]: 'set' },
|
|
27853
27855
|
};
|
|
@@ -28147,7 +28149,55 @@ func.UI.update_xu_ref = function (SESSION_ID, dsSessionP, ref_field_id, $elm) {
|
|
|
28147
28149
|
|
|
28148
28150
|
const _ds = func.utils.clean_returned_datasource(SESSION_ID, dsSessionP);
|
|
28149
28151
|
|
|
28150
|
-
|
|
28152
|
+
//////////////
|
|
28153
|
+
function createWatchedObject(obj, onChange) {
|
|
28154
|
+
return new Proxy(obj, {
|
|
28155
|
+
set(target, property, value) {
|
|
28156
|
+
const oldValue = target[property];
|
|
28157
|
+
target[property] = value;
|
|
28158
|
+
|
|
28159
|
+
if (oldValue !== value) {
|
|
28160
|
+
onChange({
|
|
28161
|
+
property,
|
|
28162
|
+
oldValue,
|
|
28163
|
+
newValue: value,
|
|
28164
|
+
timestamp: new Date(),
|
|
28165
|
+
});
|
|
28166
|
+
}
|
|
28167
|
+
|
|
28168
|
+
return true;
|
|
28169
|
+
},
|
|
28170
|
+
|
|
28171
|
+
deleteProperty(target, property) {
|
|
28172
|
+
const oldValue = target[property];
|
|
28173
|
+
delete target[property];
|
|
28174
|
+
|
|
28175
|
+
onChange({
|
|
28176
|
+
property,
|
|
28177
|
+
oldValue,
|
|
28178
|
+
newValue: undefined,
|
|
28179
|
+
deleted: true,
|
|
28180
|
+
timestamp: new Date(),
|
|
28181
|
+
});
|
|
28182
|
+
|
|
28183
|
+
return true;
|
|
28184
|
+
},
|
|
28185
|
+
});
|
|
28186
|
+
}
|
|
28187
|
+
|
|
28188
|
+
// // Usage
|
|
28189
|
+
// const watchedUser = createWatchedObject(
|
|
28190
|
+
// { name: "John", age: 25 },
|
|
28191
|
+
// (change) => console.log("Change detected:", change)
|
|
28192
|
+
// );
|
|
28193
|
+
|
|
28194
|
+
// watchedUser.age = 26; // Logs: Change detected: { property: "age", oldValue: 25, newValue: 26, ... }
|
|
28195
|
+
|
|
28196
|
+
const watchedUser = createWatchedObject(_ds, (change) => console.log('Change detected:', change));
|
|
28197
|
+
|
|
28198
|
+
//////////////
|
|
28199
|
+
|
|
28200
|
+
let obj = { ds: _ds, data: {}, props: _ds.in_parameters || {}, watcher: watchedUser };
|
|
28151
28201
|
try {
|
|
28152
28202
|
const row_idx = func.common.find_ROWID_idx(_ds, _ds.currentRecordId);
|
|
28153
28203
|
obj.data = _ds?.data_feed?.rows?.[row_idx];
|