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.umd.js
CHANGED
|
@@ -29631,12 +29631,14 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
29631
29631
|
hasListener: function() { return /* reexport */ hasListener; },
|
|
29632
29632
|
i18n: function() { return /* reexport */ i18n; },
|
|
29633
29633
|
initDomNodeI18NObserver: function() { return /* reexport */ initDomNodeI18NObserver; },
|
|
29634
|
+
initDomNodeViewObserver: function() { return /* reexport */ initDomNodeViewObserver; },
|
|
29634
29635
|
initEventCenter: function() { return /* reexport */ initEventCenter; },
|
|
29635
29636
|
initFrameWindowListener: function() { return /* reexport */ initFrameWindowListener; },
|
|
29636
29637
|
loadi18nTexts: function() { return /* reexport */ loadi18nTexts; },
|
|
29637
29638
|
loginAccount: function() { return /* reexport */ loginAccount; },
|
|
29638
29639
|
logoutAccount: function() { return /* reexport */ logoutAccount; },
|
|
29639
29640
|
processElement: function() { return /* reexport */ processElement; },
|
|
29641
|
+
processViewElement: function() { return /* reexport */ processViewElement; },
|
|
29640
29642
|
queryAndStoreAppVariable: function() { return /* reexport */ queryAndStoreAppVariable; },
|
|
29641
29643
|
queryAppVariable: function() { return /* reexport */ queryAppVariable; },
|
|
29642
29644
|
queryAssetById: function() { return /* reexport */ queryAssetById; },
|
|
@@ -29930,7 +29932,9 @@ const getMenuDatasByGroupID = async (group_id, role_ids) => {
|
|
|
29930
29932
|
//缓存所有快捷访问菜单信息
|
|
29931
29933
|
for (const tempData of tempMenuDatas) {
|
|
29932
29934
|
let id = tempData.id;
|
|
29933
|
-
|
|
29935
|
+
let isList = tempData.status == "1";
|
|
29936
|
+
// 只缓存启用状态的菜单
|
|
29937
|
+
if (!tempMap[id] && isList) {
|
|
29934
29938
|
finalMenuDatas.push(tempData);
|
|
29935
29939
|
tempMap[id] = tempData;
|
|
29936
29940
|
}
|
|
@@ -33957,6 +33961,56 @@ const dialog_i18n_check = element => {
|
|
|
33957
33961
|
}
|
|
33958
33962
|
return checkResult;
|
|
33959
33963
|
};
|
|
33964
|
+
;// ./src/api/i18n/commom_view.js
|
|
33965
|
+
const commom_view_check = element => {
|
|
33966
|
+
const checkResult = {
|
|
33967
|
+
result: false
|
|
33968
|
+
};
|
|
33969
|
+
const classes = element.classList;
|
|
33970
|
+
if (!classes) {
|
|
33971
|
+
return checkResult;
|
|
33972
|
+
}
|
|
33973
|
+
// 处理容器节点
|
|
33974
|
+
if (element.tagName === "DIV" && classes.contains("template-block")) {
|
|
33975
|
+
let scriptFunction = (appID, lang) => {
|
|
33976
|
+
let divDom = element.parentNode;
|
|
33977
|
+
let divDom2;
|
|
33978
|
+
let appBlockDom;
|
|
33979
|
+
let comDom;
|
|
33980
|
+
let renderDom;
|
|
33981
|
+
if (divDom && divDom.tagName === "DIV") {
|
|
33982
|
+
divDom2 = divDom.parentNode;
|
|
33983
|
+
if (divDom2 && divDom2.tagName === "DIV") {
|
|
33984
|
+
appBlockDom = divDom2.parentNode;
|
|
33985
|
+
if (appBlockDom && appBlockDom.tagName === "DIV" && appBlockDom.classList.contains("application-block")) {
|
|
33986
|
+
comDom = appBlockDom.parentNode;
|
|
33987
|
+
if (comDom && comDom.tagName === "DIV" && comDom.classList.contains("componentDiv")) {
|
|
33988
|
+
renderDom = comDom.parentNode;
|
|
33989
|
+
if (renderDom && renderDom.tagName === "DIV" && renderDom.classList.contains("render-all-blocks")) {
|
|
33990
|
+
//隐藏整个组件
|
|
33991
|
+
renderDom.style.height = "100%";
|
|
33992
|
+
comDom.style.height = "100%";
|
|
33993
|
+
appBlockDom.style.height = "100%";
|
|
33994
|
+
divDom2.style.height = "100%";
|
|
33995
|
+
divDom.style.height = "100%";
|
|
33996
|
+
element.style.height = "100%";
|
|
33997
|
+
//标记已经处理过
|
|
33998
|
+
element.setAttribute("viewDomID", generateUniqueId());
|
|
33999
|
+
}
|
|
34000
|
+
}
|
|
34001
|
+
}
|
|
34002
|
+
}
|
|
34003
|
+
}
|
|
34004
|
+
};
|
|
34005
|
+
checkResult.result = true;
|
|
34006
|
+
checkResult.scriptFunction = scriptFunction;
|
|
34007
|
+
return checkResult;
|
|
34008
|
+
}
|
|
34009
|
+
return checkResult;
|
|
34010
|
+
};
|
|
34011
|
+
function generateUniqueId() {
|
|
34012
|
+
return `rjview_${Date.now()}`;
|
|
34013
|
+
}
|
|
33960
34014
|
;// ./src/api/i18n/i18n.js
|
|
33961
34015
|
|
|
33962
34016
|
|
|
@@ -33970,6 +34024,7 @@ const dialog_i18n_check = element => {
|
|
|
33970
34024
|
|
|
33971
34025
|
|
|
33972
34026
|
|
|
34027
|
+
|
|
33973
34028
|
const getLanguages = async appID => {
|
|
33974
34029
|
let queryData = {
|
|
33975
34030
|
param: {
|
|
@@ -34024,7 +34079,7 @@ function checkTextFormat(text) {
|
|
|
34024
34079
|
}
|
|
34025
34080
|
return null;
|
|
34026
34081
|
}
|
|
34027
|
-
function
|
|
34082
|
+
function i18n_generateUniqueId() {
|
|
34028
34083
|
window.idCounter = window.idCounter || 0;
|
|
34029
34084
|
return `i18n_${Date.now()}_${window.idCounter++}`;
|
|
34030
34085
|
}
|
|
@@ -34059,7 +34114,7 @@ function processElement(element) {
|
|
|
34059
34114
|
return false;
|
|
34060
34115
|
}
|
|
34061
34116
|
|
|
34062
|
-
//
|
|
34117
|
+
// 如果元素有子元素,递归处理子元素
|
|
34063
34118
|
const hasChildren = hasChildElements(element);
|
|
34064
34119
|
if (hasChildren) {
|
|
34065
34120
|
let children = element.children;
|
|
@@ -34115,7 +34170,7 @@ function processElement(element) {
|
|
|
34115
34170
|
}
|
|
34116
34171
|
let elementId = element.getAttribute("localDomID");
|
|
34117
34172
|
if (!elementId) {
|
|
34118
|
-
elementId =
|
|
34173
|
+
elementId = i18n_generateUniqueId();
|
|
34119
34174
|
} else {
|
|
34120
34175
|
// 已经处理过的元素跳过
|
|
34121
34176
|
return false;
|
|
@@ -34284,6 +34339,71 @@ const initDomNodeI18NObserver = () => {
|
|
|
34284
34339
|
processElement(targetNode);
|
|
34285
34340
|
observer.observe(targetNode, config);
|
|
34286
34341
|
};
|
|
34342
|
+
const initDomNodeViewObserver = () => {
|
|
34343
|
+
// 创建观察器实例
|
|
34344
|
+
const observer = new MutationObserver(mutations => {
|
|
34345
|
+
mutations.forEach(mutation => {
|
|
34346
|
+
if (mutation.type === 'childList') {
|
|
34347
|
+
// 节点添加
|
|
34348
|
+
if (mutation.addedNodes.length > 0) {
|
|
34349
|
+
for (let i = 0; i < mutation.addedNodes.length; i++) {
|
|
34350
|
+
let node = mutation.addedNodes[i];
|
|
34351
|
+
processViewElement(node);
|
|
34352
|
+
}
|
|
34353
|
+
}
|
|
34354
|
+
}
|
|
34355
|
+
});
|
|
34356
|
+
});
|
|
34357
|
+
|
|
34358
|
+
// 配置观察选项
|
|
34359
|
+
const config = {
|
|
34360
|
+
childList: true,
|
|
34361
|
+
// 观察子节点变化
|
|
34362
|
+
subtree: true,
|
|
34363
|
+
// 观察所有后代节点
|
|
34364
|
+
attributes: false,
|
|
34365
|
+
// 不观察属性变化
|
|
34366
|
+
characterData: true,
|
|
34367
|
+
// 不观察文本内容变化
|
|
34368
|
+
characterDataOldValue: true
|
|
34369
|
+
};
|
|
34370
|
+
// 开始观察目标节点
|
|
34371
|
+
const targetNode = document.body;
|
|
34372
|
+
processViewElement(targetNode);
|
|
34373
|
+
observer.observe(targetNode, config);
|
|
34374
|
+
};
|
|
34375
|
+
|
|
34376
|
+
// 处理单个DOM元素的函数
|
|
34377
|
+
function processViewElement(element) {
|
|
34378
|
+
if (!element) {
|
|
34379
|
+
return false;
|
|
34380
|
+
}
|
|
34381
|
+
// 仅处理元素节点
|
|
34382
|
+
if (element && element.nodeType !== Node.ELEMENT_NODE) {
|
|
34383
|
+
return false;
|
|
34384
|
+
}
|
|
34385
|
+
// 如果元素有子元素,则不处理innerHTML
|
|
34386
|
+
const hasChildren = hasChildElements(element);
|
|
34387
|
+
if (hasChildren) {
|
|
34388
|
+
let children = element.children;
|
|
34389
|
+
for (let i = 0; i < children.length; i++) {
|
|
34390
|
+
let child = children[i];
|
|
34391
|
+
processViewElement(child);
|
|
34392
|
+
}
|
|
34393
|
+
}
|
|
34394
|
+
let checkState = element.getAttribute("viewDomID");
|
|
34395
|
+
// 已经处理过的元素跳过
|
|
34396
|
+
if (checkState) {
|
|
34397
|
+
return false;
|
|
34398
|
+
}
|
|
34399
|
+
const viewCheckResult = commom_view_check(element);
|
|
34400
|
+
// 如果没有匹配的内容,则不处理
|
|
34401
|
+
if (!viewCheckResult.result) {
|
|
34402
|
+
return false;
|
|
34403
|
+
}
|
|
34404
|
+
viewCheckResult.scriptFunction();
|
|
34405
|
+
return true;
|
|
34406
|
+
}
|
|
34287
34407
|
;// ./src/main.js
|
|
34288
34408
|
|
|
34289
34409
|
|