isdata-customer-sdk 0.2.25 → 0.2.27
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/dist/index.common.js +124 -4
- package/dist/index.common.js.map +1 -1
- package/dist/index.umd.js +124 -4
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +3 -3
- package/dist/index.umd.min.js.map +1 -1
- package/package.json +1 -1
package/dist/index.common.js
CHANGED
|
@@ -29613,12 +29613,14 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
29613
29613
|
hasListener: function() { return /* reexport */ hasListener; },
|
|
29614
29614
|
i18n: function() { return /* reexport */ i18n; },
|
|
29615
29615
|
initDomNodeI18NObserver: function() { return /* reexport */ initDomNodeI18NObserver; },
|
|
29616
|
+
initDomNodeViewObserver: function() { return /* reexport */ initDomNodeViewObserver; },
|
|
29616
29617
|
initEventCenter: function() { return /* reexport */ initEventCenter; },
|
|
29617
29618
|
initFrameWindowListener: function() { return /* reexport */ initFrameWindowListener; },
|
|
29618
29619
|
loadi18nTexts: function() { return /* reexport */ loadi18nTexts; },
|
|
29619
29620
|
loginAccount: function() { return /* reexport */ loginAccount; },
|
|
29620
29621
|
logoutAccount: function() { return /* reexport */ logoutAccount; },
|
|
29621
29622
|
processElement: function() { return /* reexport */ processElement; },
|
|
29623
|
+
processViewElement: function() { return /* reexport */ processViewElement; },
|
|
29622
29624
|
queryAndStoreAppVariable: function() { return /* reexport */ queryAndStoreAppVariable; },
|
|
29623
29625
|
queryAppVariable: function() { return /* reexport */ queryAppVariable; },
|
|
29624
29626
|
queryAssetById: function() { return /* reexport */ queryAssetById; },
|
|
@@ -29912,7 +29914,9 @@ const getMenuDatasByGroupID = async (group_id, role_ids) => {
|
|
|
29912
29914
|
//缓存所有快捷访问菜单信息
|
|
29913
29915
|
for (const tempData of tempMenuDatas) {
|
|
29914
29916
|
let id = tempData.id;
|
|
29915
|
-
|
|
29917
|
+
let isList = tempData.status == "1";
|
|
29918
|
+
// 只缓存启用状态的菜单
|
|
29919
|
+
if (!tempMap[id] && isList) {
|
|
29916
29920
|
finalMenuDatas.push(tempData);
|
|
29917
29921
|
tempMap[id] = tempData;
|
|
29918
29922
|
}
|
|
@@ -33939,6 +33943,56 @@ const dialog_i18n_check = element => {
|
|
|
33939
33943
|
}
|
|
33940
33944
|
return checkResult;
|
|
33941
33945
|
};
|
|
33946
|
+
;// ./src/api/i18n/commom_view.js
|
|
33947
|
+
const commom_view_check = element => {
|
|
33948
|
+
const checkResult = {
|
|
33949
|
+
result: false
|
|
33950
|
+
};
|
|
33951
|
+
const classes = element.classList;
|
|
33952
|
+
if (!classes) {
|
|
33953
|
+
return checkResult;
|
|
33954
|
+
}
|
|
33955
|
+
// 处理容器节点
|
|
33956
|
+
if (element.tagName === "DIV" && classes.contains("template-block")) {
|
|
33957
|
+
let scriptFunction = (appID, lang) => {
|
|
33958
|
+
let divDom = element.parentNode;
|
|
33959
|
+
let divDom2;
|
|
33960
|
+
let appBlockDom;
|
|
33961
|
+
let comDom;
|
|
33962
|
+
let renderDom;
|
|
33963
|
+
if (divDom && divDom.tagName === "DIV") {
|
|
33964
|
+
divDom2 = divDom.parentNode;
|
|
33965
|
+
if (divDom2 && divDom2.tagName === "DIV") {
|
|
33966
|
+
appBlockDom = divDom2.parentNode;
|
|
33967
|
+
if (appBlockDom && appBlockDom.tagName === "DIV" && appBlockDom.classList.contains("application-block")) {
|
|
33968
|
+
comDom = appBlockDom.parentNode;
|
|
33969
|
+
if (comDom && comDom.tagName === "DIV" && comDom.classList.contains("componentDiv")) {
|
|
33970
|
+
renderDom = comDom.parentNode;
|
|
33971
|
+
if (renderDom && renderDom.tagName === "DIV" && renderDom.classList.contains("render-all-blocks")) {
|
|
33972
|
+
//隐藏整个组件
|
|
33973
|
+
renderDom.style.height = "100%";
|
|
33974
|
+
comDom.style.height = "100%";
|
|
33975
|
+
appBlockDom.style.height = "100%";
|
|
33976
|
+
divDom2.style.height = "100%";
|
|
33977
|
+
divDom.style.height = "100%";
|
|
33978
|
+
element.style.height = "100%";
|
|
33979
|
+
//标记已经处理过
|
|
33980
|
+
element.setAttribute("viewDomID", generateUniqueId());
|
|
33981
|
+
}
|
|
33982
|
+
}
|
|
33983
|
+
}
|
|
33984
|
+
}
|
|
33985
|
+
}
|
|
33986
|
+
};
|
|
33987
|
+
checkResult.result = true;
|
|
33988
|
+
checkResult.scriptFunction = scriptFunction;
|
|
33989
|
+
return checkResult;
|
|
33990
|
+
}
|
|
33991
|
+
return checkResult;
|
|
33992
|
+
};
|
|
33993
|
+
function generateUniqueId() {
|
|
33994
|
+
return `rjview_${Date.now()}`;
|
|
33995
|
+
}
|
|
33942
33996
|
;// ./src/api/i18n/i18n.js
|
|
33943
33997
|
|
|
33944
33998
|
|
|
@@ -33952,6 +34006,7 @@ const dialog_i18n_check = element => {
|
|
|
33952
34006
|
|
|
33953
34007
|
|
|
33954
34008
|
|
|
34009
|
+
|
|
33955
34010
|
const getLanguages = async appID => {
|
|
33956
34011
|
let queryData = {
|
|
33957
34012
|
param: {
|
|
@@ -34006,7 +34061,7 @@ function checkTextFormat(text) {
|
|
|
34006
34061
|
}
|
|
34007
34062
|
return null;
|
|
34008
34063
|
}
|
|
34009
|
-
function
|
|
34064
|
+
function i18n_generateUniqueId() {
|
|
34010
34065
|
window.idCounter = window.idCounter || 0;
|
|
34011
34066
|
return `i18n_${Date.now()}_${window.idCounter++}`;
|
|
34012
34067
|
}
|
|
@@ -34041,7 +34096,7 @@ function processElement(element) {
|
|
|
34041
34096
|
return false;
|
|
34042
34097
|
}
|
|
34043
34098
|
|
|
34044
|
-
//
|
|
34099
|
+
// 如果元素有子元素,递归处理子元素
|
|
34045
34100
|
const hasChildren = hasChildElements(element);
|
|
34046
34101
|
if (hasChildren) {
|
|
34047
34102
|
let children = element.children;
|
|
@@ -34097,7 +34152,7 @@ function processElement(element) {
|
|
|
34097
34152
|
}
|
|
34098
34153
|
let elementId = element.getAttribute("localDomID");
|
|
34099
34154
|
if (!elementId) {
|
|
34100
|
-
elementId =
|
|
34155
|
+
elementId = i18n_generateUniqueId();
|
|
34101
34156
|
} else {
|
|
34102
34157
|
// 已经处理过的元素跳过
|
|
34103
34158
|
return false;
|
|
@@ -34266,6 +34321,71 @@ const initDomNodeI18NObserver = () => {
|
|
|
34266
34321
|
processElement(targetNode);
|
|
34267
34322
|
observer.observe(targetNode, config);
|
|
34268
34323
|
};
|
|
34324
|
+
const initDomNodeViewObserver = () => {
|
|
34325
|
+
// 创建观察器实例
|
|
34326
|
+
const observer = new MutationObserver(mutations => {
|
|
34327
|
+
mutations.forEach(mutation => {
|
|
34328
|
+
if (mutation.type === 'childList') {
|
|
34329
|
+
// 节点添加
|
|
34330
|
+
if (mutation.addedNodes.length > 0) {
|
|
34331
|
+
for (let i = 0; i < mutation.addedNodes.length; i++) {
|
|
34332
|
+
let node = mutation.addedNodes[i];
|
|
34333
|
+
processViewElement(node);
|
|
34334
|
+
}
|
|
34335
|
+
}
|
|
34336
|
+
}
|
|
34337
|
+
});
|
|
34338
|
+
});
|
|
34339
|
+
|
|
34340
|
+
// 配置观察选项
|
|
34341
|
+
const config = {
|
|
34342
|
+
childList: true,
|
|
34343
|
+
// 观察子节点变化
|
|
34344
|
+
subtree: true,
|
|
34345
|
+
// 观察所有后代节点
|
|
34346
|
+
attributes: false,
|
|
34347
|
+
// 不观察属性变化
|
|
34348
|
+
characterData: true,
|
|
34349
|
+
// 不观察文本内容变化
|
|
34350
|
+
characterDataOldValue: true
|
|
34351
|
+
};
|
|
34352
|
+
// 开始观察目标节点
|
|
34353
|
+
const targetNode = document.body;
|
|
34354
|
+
processViewElement(targetNode);
|
|
34355
|
+
observer.observe(targetNode, config);
|
|
34356
|
+
};
|
|
34357
|
+
|
|
34358
|
+
// 处理单个DOM元素的函数
|
|
34359
|
+
function processViewElement(element) {
|
|
34360
|
+
if (!element) {
|
|
34361
|
+
return false;
|
|
34362
|
+
}
|
|
34363
|
+
// 仅处理元素节点
|
|
34364
|
+
if (element && element.nodeType !== Node.ELEMENT_NODE) {
|
|
34365
|
+
return false;
|
|
34366
|
+
}
|
|
34367
|
+
// 如果元素有子元素,则不处理innerHTML
|
|
34368
|
+
const hasChildren = hasChildElements(element);
|
|
34369
|
+
if (hasChildren) {
|
|
34370
|
+
let children = element.children;
|
|
34371
|
+
for (let i = 0; i < children.length; i++) {
|
|
34372
|
+
let child = children[i];
|
|
34373
|
+
processViewElement(child);
|
|
34374
|
+
}
|
|
34375
|
+
}
|
|
34376
|
+
let checkState = element.getAttribute("viewDomID");
|
|
34377
|
+
// 已经处理过的元素跳过
|
|
34378
|
+
if (checkState) {
|
|
34379
|
+
return false;
|
|
34380
|
+
}
|
|
34381
|
+
const viewCheckResult = commom_view_check(element);
|
|
34382
|
+
// 如果没有匹配的内容,则不处理
|
|
34383
|
+
if (!viewCheckResult.result) {
|
|
34384
|
+
return false;
|
|
34385
|
+
}
|
|
34386
|
+
viewCheckResult.scriptFunction();
|
|
34387
|
+
return true;
|
|
34388
|
+
}
|
|
34269
34389
|
;// ./src/main.js
|
|
34270
34390
|
|
|
34271
34391
|
|